| @@ -445,13 +445,13 @@ public class WxCouponController extends BaseController { | |||||
| } | } | ||||
| if (EnumCouponSubsidyType.WECHAT_COUPON.getCode().equals(coupon.getSubsidyType())) { | if (EnumCouponSubsidyType.WECHAT_COUPON.getCode().equals(coupon.getSubsidyType())) { | ||||
| // 微信 立减 | // 微信 立减 | ||||
| if (coupon.getSubsidyNum() > coupon.getSalePrice()) { | |||||
| if (wxCoupon.getSubsidyNum() > coupon.getSalePrice()) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); | ||||
| } | } | ||||
| } else if (EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode().equals(coupon.getSubsidyType())) { | } else if (EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode().equals(coupon.getSubsidyType())) { | ||||
| // 线下补贴 | // 线下补贴 | ||||
| int subsidy_num = wxCoupon.getPrice() - coupon.getSalePrice(); | int subsidy_num = wxCoupon.getPrice() - coupon.getSalePrice(); | ||||
| if (coupon.getSubsidyNum() > subsidy_num) { | |||||
| if (wxCoupon.getSubsidyNum() > subsidy_num) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); | ||||
| } | } | ||||
| } | } | ||||
| @@ -42,7 +42,7 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); | void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); | ||||
| Integer setPrice(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("price")Integer price); | |||||
| Integer setPrice(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("price")Integer price,@Param("subsidyNum")Integer subsidyNum); | |||||
| Integer reduceInventory(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("number")Integer number); | Integer reduceInventory(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("number")Integer number); | ||||
| @@ -1022,7 +1022,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| @Override | @Override | ||||
| @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public ResultData setPrice(WxCoupon record) { | public ResultData setPrice(WxCoupon record) { | ||||
| Integer count = wxCouponMapper.setPrice(record.getId(), record.getTenantId(), record.getPrice()); | |||||
| Integer count = wxCouponMapper.setPrice(record.getId(), record.getTenantId(), record.getPrice(),record.getSubsidyNum()); | |||||
| if (null == count || count <= 0 ) { | if (null == count || count <= 0 ) { | ||||
| return new ResultData(Result.ERROR,"设置失败"); | return new ResultData(Result.ERROR,"设置失败"); | ||||
| } | } | ||||
| @@ -1525,7 +1525,7 @@ | |||||
| </update> | </update> | ||||
| <update id="setPrice" parameterType="HashMap"> | <update id="setPrice" parameterType="HashMap"> | ||||
| update wx_coupon set price = #{price} where id = #{id} and tenant_id = #{tenantId} and price = 0 | |||||
| update wx_coupon set price = #{price},subsidy_num={subsidyNum} where id = #{id} and tenant_id = #{tenantId} and price = 0 | |||||
| </update> | </update> | ||||
| </mapper> | </mapper> | ||||