| @@ -373,13 +373,18 @@ public class WxMicroPayController extends BaseController { | |||||
| logger.error("payPrice不能为空"); | logger.error("payPrice不能为空"); | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "payPrice不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "payPrice不能为空"); | ||||
| } | } | ||||
| if (StringUtils.isNotBlank(authCode)) { | |||||
| // 如果传了收款码,先检查收款码格式是否正确 | |||||
| if (!checkAuthCode(authCode)) { | |||||
| logger.error("微信收款码/authCode不符合规则: {}", authCode); | |||||
| return new ResultData(ErrorCode.MICRO_PAY_ERR_AUTHCODE.getCode(), "请扫描微信收款码"); | |||||
| } | |||||
| } | |||||
| BigDecimal totalFee = new BigDecimal(payPriceStr); | BigDecimal totalFee = new BigDecimal(payPriceStr); | ||||
| totalFee.setScale(2, BigDecimal.ROUND_HALF_UP); // 第一个变量是小数位数,第二个变量是取舍方法(四舍五入) | totalFee.setScale(2, BigDecimal.ROUND_HALF_UP); // 第一个变量是小数位数,第二个变量是取舍方法(四舍五入) | ||||
| Integer payPrice = totalFee.multiply(new BigDecimal(100)).intValue(); | Integer payPrice = totalFee.multiply(new BigDecimal(100)).intValue(); | ||||
| String ipStr = IPUtil.getIpAddr(request); | String ipStr = IPUtil.getIpAddr(request); | ||||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserService.getById(user.getId()); | WxMerchantBUser wxMerchantBUser = wxMerchantBUserService.getById(user.getId()); | ||||
| @@ -441,10 +446,6 @@ public class WxMicroPayController extends BaseController { | |||||
| logger.error("微信收款码/authCode不能为空"); | logger.error("微信收款码/authCode不能为空"); | ||||
| return new ResultData(ErrorCode.MICRO_PAY_NO_AUTHCODE.getCode(), "请提供微信收款码"); | return new ResultData(ErrorCode.MICRO_PAY_NO_AUTHCODE.getCode(), "请提供微信收款码"); | ||||
| } | } | ||||
| if (!checkAuthCode(authCode)) { | |||||
| logger.error("微信收款码/authCode不符合规则: {}", authCode); | |||||
| return new ResultData(ErrorCode.MICRO_PAY_ERR_AUTHCODE.getCode(), "请扫描微信收款码"); | |||||
| } | |||||
| WxPayOrder record = new WxPayOrder(); | WxPayOrder record = new WxPayOrder(); | ||||
| record.updateTenantInfo(user); | record.updateTenantInfo(user); | ||||