| @@ -101,33 +101,35 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| record.setValidDays(null); | record.setValidDays(null); | ||||
| } | } | ||||
| } | } | ||||
| if(record.getType().equals(EnumCouponType.COUPON_MULTIMCH.getCode()) || | |||||
| record.getType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) { | |||||
| Integer subsidyType = record.getSubsidyType(); | |||||
| if(subsidyType == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "请填写补贴类型"); | |||||
| } | |||||
| if(subsidyType.equals(EnumCouponSubsidyType.WECHAT_COUPON.getCode())) { | |||||
| // 微信 立减 | |||||
| if(record.getSubsidyNum() > record.getSalePrice()) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); | |||||
| } | |||||
| } else if(subsidyType.equals(EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode())) { | |||||
| // 线下补贴 | |||||
| int subsidy_num = record.getPrice() - record.getSalePrice(); | |||||
| if(record.getSubsidyNum() > subsidy_num) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); | |||||
| } | |||||
| } else if(subsidyType.equals(EnumCouponSubsidyType.WECHAT_MCHPAY.getCode())) { | |||||
| // TODO 微信转账到银行卡 | |||||
| } | |||||
| } | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| // check 卡券补贴设置 | |||||
| if(record.getType().equals(EnumCouponType.COUPON_MULTIMCH.getCode()) || | |||||
| record.getType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) { | |||||
| Integer subsidyType = record.getSubsidyType(); | |||||
| if(subsidyType == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "请填写补贴类型"); | |||||
| } | |||||
| if(subsidyType.equals(EnumCouponSubsidyType.WECHAT_COUPON.getCode())) { | |||||
| // 微信 立减 | |||||
| if(record.getSubsidyNum() > record.getSalePrice()) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); | |||||
| } | |||||
| } else if(subsidyType.equals(EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode())) { | |||||
| // 线下补贴 | |||||
| int subsidy_num = record.getPrice() - record.getSalePrice(); | |||||
| if(record.getSubsidyNum() > subsidy_num) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); | |||||
| } | |||||
| } else if(subsidyType.equals(EnumCouponSubsidyType.WECHAT_MCHPAY.getCode())) { | |||||
| // TODO 微信转账到银行卡 | |||||
| } | |||||
| } | |||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| if (record.getMerchantParams() != null) { | if (record.getMerchantParams() != null) { | ||||
| List<JSONObject> merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class); | List<JSONObject> merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class); | ||||