| | |
| | | public Result<?> add(@Valid AddPaymentMethodModel model) { |
| | | String language = ServletUtil.getRequest().getParameter("language"); |
| | | if (StringUtils.isNullOrEmpty(model.getMethod_config_id())) { |
| | | throw new YamiShopBindException("支付方式模板不正确"); |
| | | throw new YamiShopBindException("Invalid payment method template"); |
| | | } |
| | | if (StringUtils.isNullOrEmpty(model.getReal_name())) { |
| | | throw new YamiShopBindException("真实姓名必填"); |
| | | throw new YamiShopBindException("Real name is required"); |
| | | } |
| | | if (StringUtils.isNullOrEmpty(model.getParam_value1())) { |
| | | throw new YamiShopBindException("参数值1必填"); |
| | | throw new YamiShopBindException("Parameter value 1 is required"); |
| | | } |
| | | if (model.getReal_name().length() > 20) { |
| | | if (language.equals("zh-CN")) { |
| | | throw new YamiShopBindException("真实姓名长度大于20"); |
| | | throw new YamiShopBindException("Real name exceeds 20 characters"); |
| | | } else { |
| | | throw new YamiShopBindException("Real name length greater than 20"); |
| | | } |
| | | } |
| | | if (model.getRemark().length() > 100) { |
| | | if (language.equals("zh-CN")) { |
| | | throw new YamiShopBindException("备注长度大于100"); |
| | | throw new YamiShopBindException("Remark exceeds 100 characters"); |
| | | } else { |
| | | throw new YamiShopBindException("Note length greater than 100"); |
| | | } |
| | | } |
| | | C2cPaymentMethodConfig methodConfig = c2cPaymentMethodConfigService.getById(model.getMethod_config_id()); |
| | | if (null == methodConfig) { |
| | | throw new YamiShopBindException("支付方式模板不存在"); |
| | | throw new YamiShopBindException("Payment method template does not exist"); |
| | | } |
| | | if (!StrUtil.isEmpty(model.getParam_value1())) { |
| | | if (model.getParam_value1().length() > 25) { |
| | | throw new YamiShopBindException(methodConfig.getParamName1() + "长度大于25"); |
| | | throw new YamiShopBindException(methodConfig.getParamName1() + " exceeds 25 characters"); |
| | | } |
| | | } |
| | | if (!StrUtil.isEmpty(model.getParam_value2())) { |
| | | if (model.getParam_value2().length() > 25) { |
| | | throw new YamiShopBindException(methodConfig.getParamName2() + "长度大于25"); |
| | | throw new YamiShopBindException(methodConfig.getParamName2() + " exceeds 25 characters"); |
| | | } |
| | | } |
| | | String partyId = SecurityUtils.getUser().getUserId(); |
| | | if (null == partyId) { |
| | | throw new YamiShopBindException("请重新登录"); |
| | | throw new YamiShopBindException("Please log in again"); |
| | | } |
| | | // C2C用户和承兑商添加支付方式最大数量 |
| | | Map<String, C2cPaymentMethod> methodMap = c2cPaymentMethodService.getByPartyId(partyId); |
| | | Object obj = this.sysparaService.find("c2c_payment_method_count_max"); |
| | | if (null != obj) { |
| | | if (methodMap.size() >= Integer.valueOf(this.sysparaService.find("c2c_payment_method_count_max").getSvalue()).intValue()) { |
| | | throw new YamiShopBindException("支付方式数量已达上限"); |
| | | throw new YamiShopBindException("Payment method limit reached"); |
| | | } |
| | | } |
| | | C2cPaymentMethod method = new C2cPaymentMethod(); |
| | |
| | | public Result<?> update(@Valid AddPaymentMethodModel model) { |
| | | String language = ServletUtil.getRequest().getParameter("language"); |
| | | if (StringUtils.isNullOrEmpty(model.getReal_name())) { |
| | | throw new YamiShopBindException("真实姓名必填"); |
| | | throw new YamiShopBindException("Real name is required"); |
| | | } |
| | | if (StringUtils.isNullOrEmpty(model.getParam_value1())) { |
| | | throw new YamiShopBindException("参数值1必填"); |
| | | throw new YamiShopBindException("Parameter value 1 is required"); |
| | | } |
| | | if (model.getReal_name().length() > 20) { |
| | | if (language.equals("zh-CN")) { |
| | | throw new YamiShopBindException("真实姓名长度大于20"); |
| | | throw new YamiShopBindException("Real name exceeds 20 characters"); |
| | | } else { |
| | | throw new YamiShopBindException("Real name length greater than 20"); |
| | | } |
| | | } |
| | | if (model.getRemark().length() > 100) { |
| | | if (language.equals("zh-CN")) { |
| | | throw new YamiShopBindException("备注长度大于100"); |
| | | throw new YamiShopBindException("Remark exceeds 100 characters"); |
| | | } else { |
| | | throw new YamiShopBindException("Note length greater than 100"); |
| | | } |
| | | } |
| | | C2cPaymentMethod method = this.c2cPaymentMethodService.getById(model.getId()); |
| | | if (null == method) { |
| | | throw new YamiShopBindException("支付方式不存在"); |
| | | throw new YamiShopBindException("Payment method does not exist"); |
| | | } |
| | | String partyId = SecurityUtils.getUser().getUserId(); |
| | | if (!method.getPartyId().equals(partyId)) { |
| | | throw new YamiShopBindException("支付方式不匹配该用户"); |
| | | throw new YamiShopBindException("Payment method does not match this user"); |
| | | } |
| | | String log = MessageFormat.format("ip:" + IPHelper.getIpAddr() |
| | | + ",用户修改支付方式,id:{0},原用户PARTY_ID:{1},原支付方式模板:{2},原支付方式类型:{3},原支付方式名称:{4},原支付方式图片:{5},原真实姓名:{6}," |