| @@ -20,6 +20,7 @@ import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | |||||
| import com.iformall.domain.vo.WxCouponPasswordVo; | import com.iformall.domain.vo.WxCouponPasswordVo; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.WxCardInfoService; | |||||
| import com.iformall.service.WxCouponPasswordService; | import com.iformall.service.WxCouponPasswordService; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| @@ -66,6 +67,8 @@ public class WxCouponPasswordController extends BaseController { | |||||
| private AsyncTask asyncTask; | private AsyncTask asyncTask; | ||||
| @Autowired | @Autowired | ||||
| private String fmUploadDir; | private String fmUploadDir; | ||||
| @Autowired | |||||
| private WxCardInfoService wxCardInfoService; | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("/list") | @GetMapping("/list") | ||||
| @@ -203,8 +206,10 @@ public class WxCouponPasswordController extends BaseController { | |||||
| if (couponPassword.getIsStop().intValue() == EnumYesOrNo.YES.getCode().intValue() ) { | if (couponPassword.getIsStop().intValue() == EnumYesOrNo.YES.getCode().intValue() ) { | ||||
| return new ResultData(ResultData.ERROR, "已停用,不能设置。"); | return new ResultData(ResultData.ERROR, "已停用,不能设置。"); | ||||
| } | } | ||||
| if (couponPassword.getPrice() > 0 ) { | |||||
| return new ResultData(ResultData.ERROR, "已设置面额,不能再次设置面额。"); | |||||
| //已经绑定了的不能设置 | |||||
| WxCardInfo cardInfo = wxCardInfoService.getByCouponPasswordId(wxCouponPassword.getId(), wxCouponPassword); | |||||
| if (null != cardInfo) { | |||||
| return new ResultData(ResultData.ERROR, "卡已绑定,不能再次设置面额。"); | |||||
| } | } | ||||
| wxCouponPasswordService.setPrice(wxCouponPassword); | wxCouponPasswordService.setPrice(wxCouponPassword); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -23,6 +23,7 @@ import com.iformall.mapper.WxCouponPasswordMapper; | |||||
| import com.iformall.service.ExcelService; | import com.iformall.service.ExcelService; | ||||
| import com.iformall.service.SysConfigService; | import com.iformall.service.SysConfigService; | ||||
| import com.iformall.service.WxCUserBasicInfoService; | import com.iformall.service.WxCUserBasicInfoService; | ||||
| import com.iformall.service.WxCardInfoService; | |||||
| import com.iformall.service.WxCouponPasswordService; | import com.iformall.service.WxCouponPasswordService; | ||||
| import com.iformall.utils.sign.AppUtils; | import com.iformall.utils.sign.AppUtils; | ||||
| @@ -72,6 +73,10 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| @Autowired | @Autowired | ||||
| SysConfigService sysConfigService; | SysConfigService sysConfigService; | ||||
| @Lazy | |||||
| @Autowired | |||||
| WxCardInfoService wxCardInfoService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxCouponPassword> listAsPage(WxCouponPassword record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCouponPassword> listAsPage(WxCouponPassword record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -337,7 +342,11 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| @Override | @Override | ||||
| public Integer setPrice(WxCouponPassword wxCouponPassword) { | public Integer setPrice(WxCouponPassword wxCouponPassword) { | ||||
| return wxCouponPasswordMapper.setPrice(wxCouponPassword); | |||||
| WxCardInfo cardInfo = wxCardInfoService.getByCouponPasswordId(wxCouponPassword.getId(), wxCouponPassword); | |||||
| if (null == cardInfo) { | |||||
| return wxCouponPasswordMapper.setPrice(wxCouponPassword); | |||||
| } | |||||
| return 0; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -226,7 +226,7 @@ | |||||
| <update id="setPrice" parameterType="com.iformall.domain.po.WxCouponPassword"> | <update id="setPrice" parameterType="com.iformall.domain.po.WxCouponPassword"> | ||||
| update wx_coupon_password set price = #{price} , update_date = now() | update wx_coupon_password set price = #{price} , update_date = now() | ||||
| where tenant_id = #{tenantId} and price = 0 | |||||
| where tenant_id = #{tenantId} | |||||
| <if test=" null != couponId"> | <if test=" null != couponId"> | ||||
| and coupon_id = #{couponId} | and coupon_id = #{couponId} | ||||
| </if> | </if> | ||||