diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCampaignController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCampaignController.java index 4d9205386..fe0dca468 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCampaignController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCampaignController.java @@ -125,7 +125,7 @@ public class WxCampaignController extends BaseController { for (String couponIdStr : ids) { Long couponId = Long.parseLong(couponIdStr); - WxCoupon wxCoupon = wxCouponService.getById(couponId); + WxCoupon wxCoupon = wxCouponService.getById(couponId,campaign.getTenantId()); if (wxCoupon == null) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java index e1109293e..4ea10b5d9 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java @@ -147,7 +147,7 @@ public class WxCouponController extends BaseController { } } - WxCoupon coupon = wxCouponService.getById(wxCoupon.getId()); + WxCoupon coupon = wxCouponService.getById(wxCoupon.getId(),wxCoupon.getTenantId()); if (null == coupon) { return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); } @@ -289,7 +289,7 @@ public class WxCouponController extends BaseController { @SystemControllerLog(description = "券投放-删除") public ResultData delete(Long id) { logger.debug("[" + getIpAddr() + "] WxCouponController::delete"); - wxCouponService.deleteById(id); + wxCouponService.deleteById(id,getTenantInfo().getTenantId()); return new ResultData(Result.SUCCESS, "删除成功", null); } @@ -299,7 +299,7 @@ public class WxCouponController extends BaseController { @SystemControllerLog(description = "券投放-查询") public ResultData findById(@RequestParam Long id) { logger.debug("[" + getIpAddr() + "] WxCouponController::findById"); - return new ResultData(wxCouponService.getVoById(id)); + return new ResultData(wxCouponService.getVoById(id,getTenantInfo().getTenantId())); } @@ -395,7 +395,7 @@ public class WxCouponController extends BaseController { @SystemControllerLog(description = "券投放-富文本获取") public ResultData getHtml(@RequestParam Long id) { logger.debug("[" + getIpAddr() + "] WxCouponController::getHtmlById"); - return new ResultData(wxCouponService.getHtmlById(id)); + return new ResultData(wxCouponService.getHtmlById(id,getTenantInfo().getTenantId())); } @ApiOperation("卡延期") @@ -409,7 +409,7 @@ public class WxCouponController extends BaseController { return new ResultData(ResultData.ERROR, "缺少validEndDate"); } - return new ResultData(wxCouponService.cardDefer(wxCoupon.getId(),wxCoupon.getValidEndDate())); + return new ResultData(wxCouponService.cardDefer(wxCoupon.getId(),getTenantInfo().getTenantId(),wxCoupon.getValidEndDate())); } } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPresentController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPresentController.java index 6bd58000b..0ba38e4a3 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPresentController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPresentController.java @@ -97,7 +97,7 @@ public class WxCouponPresentController extends BaseController { logger.error(e.getMessage()); return new ResultData(e.getErrorCode(), e.getMessage()); } - WxCoupon wxCoupon = wxCouponService.getById(wxCouponPresent.getCouponId()); + WxCoupon wxCoupon = wxCouponService.getById(wxCouponPresent.getCouponId(),wxCouponPresent.getTenantId()); if (wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { //时间范围 if (new Date().after(wxCoupon.getValidEndDate())) { return new ResultData(ErrorCode.COUPON_IS_EXPIRED); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponSendController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponSendController.java index 52d4bf843..267ea9a42 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponSendController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponSendController.java @@ -106,7 +106,7 @@ public class WxCouponSendController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); } - WxCoupon wxCoupon = wxCouponService.getById(wxCouponSend.getCouponId()); + WxCoupon wxCoupon = wxCouponService.getById(wxCouponSend.getCouponId(),getTenantInfo().getTenantId()); if (!EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode().equals(wxCoupon.getStatus())) { return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderController.java index 17d21c258..b6290ce5e 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderController.java @@ -180,7 +180,7 @@ public class WxOrderController extends BaseController { user.setOperatorType(EnumUserType.MALLUSER.getCode()); user.setOperatorId(getUserId()); WxOrder order = null; - WxCoupon coupon = wxCouponService.getById(couponId); + WxCoupon coupon = wxCouponService.getById(couponId,wxCouponChannel.getTenantId()); if (coupon == null) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/MemCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/MemCouponController.java index d2df602d6..b544fefdf 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/MemCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/MemCouponController.java @@ -101,7 +101,7 @@ public class MemCouponController extends BaseController { memCouponFromDsp.setCouponId(couponChannel.getCouponId()); } // 1. 检查券是否已超限, 无剩余库存 - WxCoupon coupon = couponService.getById(memCouponFromDsp.getCouponId()); + WxCoupon coupon = couponService.getById(memCouponFromDsp.getCouponId(),memCouponFromDsp.getTenantId()); if (coupon == null) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券不存在:" + memCouponFromDsp.getCouponId()); } @@ -144,7 +144,7 @@ public class MemCouponController extends BaseController { memCouponFromDsp.setCouponId(couponChannel.getCouponId()); } // 1. 检查券是否已超限, 无剩余库存 - WxCoupon coupon = couponService.getById(memCouponFromDsp.getCouponId()); + WxCoupon coupon = couponService.getById(memCouponFromDsp.getCouponId(),couponChannel.getTenantId()); if (coupon == null) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券不存在:" + memCouponFromDsp.getCouponId()); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java index 9f030cd98..6ee97355c 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java @@ -246,7 +246,7 @@ public class WxCUserBasicInfoController extends BaseController { if (page.getSize() > 0) { List list = page.getList(); for (WxCouponOrder c : list) { - WxCoupon coupon = wxCouponService.getById(c.getCouponId()); + WxCoupon coupon = wxCouponService.getById(c.getCouponId(),c.getTenantId()); c.setCouponName(coupon.getTitle()); c.setSalePrice(coupon.getPrice()); @@ -276,7 +276,7 @@ public class WxCUserBasicInfoController extends BaseController { //if (page.getSize() > 0) { List list = page.getList(); for (WxCouponOrder c : list) { - WxCoupon coupon = wxCouponService.getById(c.getCouponId()); + WxCoupon coupon = wxCouponService.getById(c.getCouponId(),c.getTenantId()); c.setCouponName(coupon.getTitle()); c.setSalePrice(coupon.getPrice()); } diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java index 89263d283..1169d4a53 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java @@ -164,7 +164,7 @@ public class WxCouponController extends BaseController { if (wxCoupon.getId() == null) { return new ResultData(ResultData.ERROR, "缺少id"); } - WxCoupon coupon = wxCouponService.getById(wxCoupon.getId()); + WxCoupon coupon = wxCouponService.getById(wxCoupon.getId(),getTenantInfo().getTenantId()); if(coupon.getSourceType().intValue() != EnumCouponSourceType.COUPONSource_Bapi.getCode().intValue()){ return new ResultData(Result.ERROR,"非B端券,不能进行此操作"); @@ -241,7 +241,7 @@ public class WxCouponController extends BaseController { wxCoupon.setMerchantParams(JSONObject.toJSONString(merchantList)); - WxCoupon coupon = wxCouponService.getById(wxCoupon.getId()); + WxCoupon coupon = wxCouponService.getById(wxCoupon.getId(),wxCoupon.getTenantId()); if (null == coupon) { return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); } @@ -328,7 +328,7 @@ public class WxCouponController extends BaseController { return new ResultData(Result.ERROR,EnumFlowKey.B_COUPON_MERCHANT_CREATE.getMessage()+"未配置审批流程"); } logger.debug("[" + getIpAddr() + "] WxCouponController::delete"); - wxCouponService.deleteById(id); + wxCouponService.deleteById(id,getTenantInfo().getTenantId()); return new ResultData(Result.SUCCESS, "删除成功", null); } @@ -337,7 +337,7 @@ public class WxCouponController extends BaseController { @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) public ResultData findById(@RequestParam Long id) { logger.debug("[" + getIpAddr() + "] WxCouponController::findById"); - return new ResultData(wxCouponService.getVoById(id)); + return new ResultData(wxCouponService.getVoById(id,getTenantInfo().getTenantId())); } @@ -428,7 +428,7 @@ public class WxCouponController extends BaseController { @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) public ResultData getHtml(@RequestParam Long id) { logger.debug("[" + getIpAddr() + "] WxCouponController::getHtmlById"); - return new ResultData(wxCouponService.getHtmlById(id)); + return new ResultData(wxCouponService.getHtmlById(id,getTenantInfo().getTenantId())); } diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java index ac1657ab7..b8b49f7cc 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java @@ -157,7 +157,7 @@ public class WxCouponOrderController extends BaseController { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } } else { - wxCouponCVo = wxCouponService.getVoById(wxCouponOrderCVo.getCouponId()); + wxCouponCVo = wxCouponService.getVoById(wxCouponOrderCVo.getCouponId(),wxMerchantBUser.getTenantId()); if (wxCouponCVo == null) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } @@ -214,7 +214,7 @@ public class WxCouponOrderController extends BaseController { } wxCouponOrderCVo.setHtml(wxCouponCVo.getHtml()); } else { - WxCoupon wxCoupon = wxCouponService.getHtmlById(wxCouponOrderCVo.getCouponId()); + WxCoupon wxCoupon = wxCouponService.getHtmlById(wxCouponOrderCVo.getCouponId(),wxCouponOrderCVo.getTenantId()); if (wxCoupon == null) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java index aa2e68e3d..0dd01a5c2 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java @@ -341,7 +341,7 @@ public class WxCarController extends BaseController { } return new ResultData(Result.SUCCESS,"已经使用过优惠券, 不能重复使用."); } else { - WxCoupon coupon = couponService.getById(userCar.getCouponId()); + WxCoupon coupon = couponService.getById(userCar.getCouponId(),park.getFinalTenantId()); if (coupon == null) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券为空"); } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java index 678e223af..5175bbad5 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java @@ -86,7 +86,7 @@ public class WxCouponController extends BaseController { // 库存 if (couponIdL > 0L) { // 更新状态 - WxCouponCVo couponCVo = couponService.getVoStatusById(couponIdL); + WxCouponCVo couponCVo = couponService.getVoStatusById(couponIdL,wxCouponCVo.getTenantId()); if (wxCouponCVo == null) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } @@ -184,7 +184,7 @@ public class WxCouponController extends BaseController { return null; } - WxCoupon c = couponService.getById(cc.getCouponId()); + WxCoupon c = couponService.getById(cc.getCouponId(),cc.getTenantId()); if (c == null) { return null; } @@ -203,7 +203,7 @@ public class WxCouponController extends BaseController { return null; } - WxCoupon c = couponService.getHtmlById(cc.getCouponId()); + WxCoupon c = couponService.getHtmlById(cc.getCouponId(),cc.getTenantId()); if (c == null) { return null; } @@ -222,7 +222,7 @@ public class WxCouponController extends BaseController { return null; } - WxCoupon c = couponService.getById(cc.getCouponId()); + WxCoupon c = couponService.getById(cc.getCouponId(),cc.getTenantId()); if (c == null) { c = new WxCoupon(); } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java index ddacb5bac..f50a04cdf 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java @@ -140,7 +140,7 @@ public class WxCouponOrderController extends BaseController { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } } else { - wxCouponCVo = wxCouponService.getVoById(wxCouponOrderCVo.getCouponId()); + wxCouponCVo = wxCouponService.getVoById(wxCouponOrderCVo.getCouponId(),wxCouponOrderCVo.getTenantId()); if (wxCouponCVo == null) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } @@ -209,7 +209,7 @@ public class WxCouponOrderController extends BaseController { wxCouponOrderCVo.setContentType(wxCouponCVo.getContentType()); wxCouponOrderCVo.setHtml(wxCouponCVo.getHtml()); } else { - WxCoupon wxCoupon = wxCouponService.getHtmlById(wxCouponOrderCVo.getCouponId()); + WxCoupon wxCoupon = wxCouponService.getHtmlById(wxCouponOrderCVo.getCouponId(),wxCouponOrderCVo.getTenantId()); if (wxCoupon == null) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponPasswordController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponPasswordController.java index 5b11b2844..5de989ae7 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponPasswordController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponPasswordController.java @@ -80,7 +80,7 @@ public class WxCouponPasswordController extends BaseController { throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "会员用户未找到" + memberId); } - WxCoupon coupon = couponService.getById(couponPassword.getCouponId()); + WxCoupon coupon = couponService.getById(couponPassword.getCouponId(),couponPassword.getTenantId()); if (coupon == null) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java index 57a0032b4..3838ea530 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java @@ -93,7 +93,7 @@ public class WxOrderController extends BaseController { return new ResultData(ErrorCode.MEMBER_IS_LOCKED); } - WxCoupon coupon = wxCouponService.getById(wxCouponChannel.getCouponId()); + WxCoupon coupon = wxCouponService.getById(wxCouponChannel.getCouponId(),wxCouponChannel.getTenantId()); if (null == coupon) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } @@ -415,7 +415,7 @@ public class WxOrderController extends BaseController { } WxCoupon wxCoupon = null; try { - wxCoupon = wxCouponService.getById(id); + wxCoupon = wxCouponService.getById(id,getTenantInfo().getTenantId()); } catch (Exception e) { logger.error("券ID获取券信息失败, couponId: " + couponId); return new ResultData(ErrorCode.COUPON_IS_EMPTY); diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxPayOrderController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxPayOrderController.java index 2eb0054f9..4b40dbc53 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxPayOrderController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxPayOrderController.java @@ -186,7 +186,7 @@ public class WxPayOrderController extends BaseController { if (null == order) { return new ResultData(ErrorCode.PAY_ORDER_ERROR, "未查询到Order["+orderId+"]."); } - WxCoupon wxCoupon = wxCouponService.getById(order.getProductId()); + WxCoupon wxCoupon = wxCouponService.getById(order.getProductId(),order.getTenantId()); if (null == wxCoupon) { return new ResultData(ErrorCode.PAY_ORDER_ERROR, "未查询到优惠券[orderId:"+orderId+"]."); } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxPressOrderController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxPressOrderController.java index e7f81ad53..22e8c46a9 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxPressOrderController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxPressOrderController.java @@ -113,7 +113,7 @@ public class WxPressOrderController extends BaseController { wxCouponCVo = cdOperations.get(cdKey); } else { // 券信息没有入缓存,需要从数据库中读取 - wxCouponCVo = wxCouponService.getVoById(order.getProductId()); + wxCouponCVo = wxCouponService.getVoById(order.getProductId(),order.getTenantId()); if (wxCouponCVo != null) { // 券详情优化,进缓存 couponCVoRedisTemplate.opsForValue().set(cdKey, wxCouponCVo, 3600, TimeUnit.SECONDS); diff --git a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java index 8f1308239..b5c4933f3 100644 --- a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java +++ b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java @@ -460,7 +460,7 @@ public class PosServiceImpl implements PosService { throw new MallinkException(ErrorCode.VERIFY_COUPON_TYPE_NOT_SUPPORT); } // 5. get coupon - WxCoupon wxCoupon = couponMapper.selectById(couponOrderCVo.getCouponId()); + WxCoupon wxCoupon = couponMapper.selectById(couponOrderCVo.getCouponId(),couponOrderCVo.getTenantId()); if (wxCoupon == null) { logger.error("券: coupon-" + wxCoupon.getId() + "不存在" + "couponOrder-" + couponOrderCVo.getId()); throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); @@ -610,7 +610,7 @@ public class PosServiceImpl implements PosService { } if (couponSelected) { // 5. get coupon - WxCoupon wxCoupon = couponMapper.selectById(couponOrderCVo.getCouponId()); + WxCoupon wxCoupon = couponMapper.selectById(couponOrderCVo.getCouponId(),couponOrderCVo.getTenantId()); if (wxCoupon == null) { logger.error("券: coupon-" + wxCoupon.getId() + "不存在" + "couponOrder-" + couponOrderCVo.getId()); throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); @@ -1083,7 +1083,7 @@ public class PosServiceImpl implements PosService { throw new MallinkException(ErrorCode.VERIFY_COUPON_ORDER_MERCHANT_IS_NULL); } // 5. 核销后无法反向 - WxCoupon coupon = couponMapper.selectById(couponOrderCVo.getCouponId()); + WxCoupon coupon = couponMapper.selectById(couponOrderCVo.getCouponId(),couponOrderCVo.getTenantId()); if (coupon.getSalePrice() > 0 || (coupon.getSubsidyType() > EnumCouponSubsidyType.NO_SUBSIDY.getCode() && coupon.getSubsidyNum() > 0)) { logger.error("券包ID: " + couponOrderIdStr + "核销无法退回"); @@ -2188,7 +2188,7 @@ public class PosServiceImpl implements PosService { logger.error("交易核销成长值异常:" + e.getMessage()); } - WxCoupon wxCoupon = couponMapper.selectById(couponOrderCVo.getCouponId()); + WxCoupon wxCoupon = couponMapper.selectById(couponOrderCVo.getCouponId(),couponOrderCVo.getTenantId()); if (wxCoupon == null) { logger.error("券: coupon-" + wxCoupon.getId() + "不存在" + "couponOrder-" + couponOrderCVo.getId()); throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java index e5678a031..04117c30e 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java @@ -191,7 +191,7 @@ public class CouponSendSchedule { // 发放免费券 try { - WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(), cs.getCouponId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_SYSTEM_SEND); + WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(), cs.getTenantId(),cs.getCouponId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_SYSTEM_SEND); wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId()); } catch (Exception e) { logger.error("定时发券:发券失败 levelId=" + l.getId() + " couponId=" + cs.getCouponId() + " userId=" + cu.getId() + e.getMessage()); @@ -321,7 +321,7 @@ public class CouponSendSchedule { for (WxCUserBasicInfo cu : newUserList) { // 发放生日券 try { - WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(), cs.getCouponId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_SYSTEM_SEND); + WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(),cs.getTenantId(), cs.getCouponId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_SYSTEM_SEND); wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId()); couponSendedUsers.add(cu); } catch (Exception e) { diff --git a/mallinkService/src/main/java/com/iformall/domain/po/msg/UpdateCouponStockMsg.java b/mallinkService/src/main/java/com/iformall/domain/po/msg/UpdateCouponStockMsg.java deleted file mode 100644 index 354273ad6..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/po/msg/UpdateCouponStockMsg.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.iformall.domain.po.msg; - -import cn.binarywang.wx.miniapp.bean.WxMaTemplateData; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.util.List; -import java.util.Map; - -/** - * 更新券库存消息 - * @author Stormeye - * @date 2019/4/9 13:55 - */ -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class UpdateCouponStockMsg extends BaseMsg { - private static final long serialVersionUID = 223232132183760321L; - - public static final String OPERATE_TYPE_INCREASE = "increase"; - public static final String OPERATE_TYPE_DECREASE = "decrease"; - - @io.swagger.annotations.ApiModelProperty(value="券Id",name="couponId") - private Long couponId; - @io.swagger.annotations.ApiModelProperty(value="更新数量",name="number") - private long number; - @io.swagger.annotations.ApiModelProperty(value="操作类型 1-增加库存 ,2-减少库存",name="operateType") - private String operateType; -} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java index 3ccfd203f..0e9ace2bf 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java @@ -16,13 +16,17 @@ public interface WxCouponMapper extends CommonMapper { List findList(WxCoupon wxCoupon); List findCouponList(WxCoupon wxCoupon); + WxCoupon selectById(@Param("id")Long id,@Param("tenantId")String tenantId); - WxCouponCVo findVoDetail(@Param("id")Long id); - WxCouponCVo findVoStatusDetail(@Param("id")Long id); + WxCouponCVo findVoDetail(@Param("id")Long id,@Param("tenantId")String tenantId); + WxCouponCVo findVoStatusDetail(@Param("id")Long id,@Param("tenantId")String tenantId); + + void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); + - Integer reduceInventory(@Param("id")Long id,@Param("number")Integer number); + Integer reduceInventory(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("number")Integer number); - Integer backInventory(@Param("id")Long id, @Param("number")Integer number,@Param("remainInventory")Integer remainInventory); + Integer backInventory(@Param("id")Long id,@Param("tenantId")String tenantId, @Param("number")Integer number,@Param("remainInventory")Integer remainInventory); void offExpiriedCouponByValidDate(); diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java index 011841b97..f059741ba 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java @@ -52,14 +52,14 @@ public interface WxCouponService { * @param id * @return */ - WxCoupon getById(Long id); + WxCoupon getById(Long id,String tenantId); - WxCoupon getHtmlById(Long id); + WxCoupon getHtmlById(Long id,String tenantId); - WxCouponCVo getVoById(Long id); + WxCouponCVo getVoById(Long id,String tenantId); - WxCouponCVo getVoStatusById(Long id); + WxCouponCVo getVoStatusById(Long id,String tenantId); /** * 保存或更新实体 * @@ -77,7 +77,7 @@ public interface WxCouponService { * * @param id */ - void deleteById(Long id); + void deleteById(Long id,String tenantId); /** @@ -214,7 +214,7 @@ public interface WxCouponService { * @param number 减少数量 * @param remainInventory 当前库存 */ - void reduceRemainInventory(Long id, Integer number); + void reduceRemainInventory(Long id,String tenantId, Integer number); /** * 库存退回 @@ -223,12 +223,12 @@ public interface WxCouponService { * @param number 回退数量 * @param remainInventory 当前库存 */ - void backRemainInventory(Long id, Integer number, Integer remainInventory); + void backRemainInventory(Long id,String tenantId, Integer number, Integer remainInventory); /** * 卡延期 * @param wxCoupon * @return */ - ResultData cardDefer(Long id,Date validEndDate); + ResultData cardDefer(Long id,String tenantId,Date validEndDate); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxOrderService.java b/mallinkService/src/main/java/com/iformall/service/WxOrderService.java index b8345bcf8..7e16178d5 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxOrderService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxOrderService.java @@ -86,7 +86,7 @@ public interface WxOrderService { * @param wxCouponSendVo 商户注券时必须指定 * @return WxCouponOrder */ - WxCouponOrder sendFreeCouponToUser(Long userId, Long couponId, WxCouponSendVo wxCouponSendVo,EnumPayWay payWay); + WxCouponOrder sendFreeCouponToUser(Long userId, String tenantId,Long couponId, WxCouponSendVo wxCouponSendVo,EnumPayWay payWay); /** * orderSuccess 订单已支付 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/MemCouponFromDspServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/MemCouponFromDspServiceImpl.java index dcdc85529..2d8290b75 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/MemCouponFromDspServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/MemCouponFromDspServiceImpl.java @@ -103,7 +103,7 @@ public class MemCouponFromDspServiceImpl implements MemCouponFromDspService { List couponFromDsps = memCouponFromDspMapper.findList(memQ); for (MemCouponFromDsp memCouponFromDsp: couponFromDsps) { // 注入券码, 无论此券是有价还是免费 - WxCoupon coupon = couponMapper.selectById(memCouponFromDsp.getCouponId()); + WxCoupon coupon = couponMapper.selectById(memCouponFromDsp.getCouponId(),memCouponFromDsp.getTenantId()); if (coupon != null) { try { Long couponOrderId = wxOrderService.saveOuterOrderForCoupon(user, coupon, memCouponFromDsp.getCouponChannelId(), null, null); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java index ba2cda6b7..294004a40 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java @@ -228,7 +228,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { public void saveOrUpdateCouponChannel(Long couponId, Map wxCouponChannelsMap, WxCampaign record){ - WxCoupon wxCoupon = wxCouponService.getById(couponId); + WxCoupon wxCoupon = wxCouponService.getById(couponId,record.getTenantId()); if (wxCoupon == null) { return; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java index 9763f5e97..ccf6b73ad 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java @@ -103,7 +103,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { } // 2. coupon Integer subsidyRate = 0; - WxCoupon coupon = wxCouponMapper.selectById(cardInfo.getCouponId()); + WxCoupon coupon = wxCouponMapper.selectById(cardInfo.getCouponId(),cardInfo.getTenantId()); if (coupon == null) { logger.error("card's coupon not found: " + cardInfo.getCouponId()); return new ResultData(ErrorCode.CARD_IS_NOT_FOUND); @@ -619,7 +619,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { } // 2. coupon Integer subsidyRate = 0; - WxCoupon coupon = wxCouponMapper.selectById(cardInfo.getCouponId()); + WxCoupon coupon = wxCouponMapper.selectById(cardInfo.getCouponId(),cardInfo.getTenantId()); if (coupon == null) { logger.error("card's coupon not found: " + cardInfo.getCouponId()); throw new MallinkException(ErrorCode.CARD_IS_NOT_FOUND); @@ -720,7 +720,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { } // 2. coupon Integer subsidyRate = 0; - WxCoupon coupon = wxCouponMapper.selectById(cardInfo.getCouponId()); + WxCoupon coupon = wxCouponMapper.selectById(cardInfo.getCouponId(),cardInfo.getTenantId()); if (coupon == null) { logger.error("card's coupon not found: " + cardInfo.getCouponId()); throw new MallinkException(ErrorCode.CARD_IS_NOT_FOUND); @@ -810,7 +810,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { // 2. coupon Integer subsidyRate = 0; - WxCoupon coupon = wxCouponMapper.selectById(cardInfo.getCouponId()); + WxCoupon coupon = wxCouponMapper.selectById(cardInfo.getCouponId(),cardInfo.getTenantId()); if (coupon == null) { logger.error("card's coupon not found: " + cardInfo.getCouponId()); throw new MallinkException(ErrorCode.CARD_IS_NOT_FOUND); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java index 0b71a678c..560250433 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java @@ -89,7 +89,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { if (orignal.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) && record.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode())) { - WxCoupon wxCoupon = wxCouponService.getById(orignal.getCouponId()); + WxCoupon wxCoupon = wxCouponService.getById(orignal.getCouponId(),orignal.getTenantId()); if (wxCoupon == null) return new ResultData(ErrorCode.COUPON_IS_EMPTY); if (wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF)) @@ -214,7 +214,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { WxCouponChannelAddVo vo = new WxCouponChannelAddVo(); - WxCoupon wxCoupon = wxCouponService.getById(couponid); + WxCoupon wxCoupon = wxCouponService.getById(couponid,tenantEntity.getTenantId()); if(wxCoupon==null){ logger.debug(couponid+ErrorCode.COUPON_IS_EMPTY.getMessage()); vo.toCouponChannnelVo(null,channelId); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponInjectServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponInjectServiceImpl.java index 580e476f4..2f1dff1ce 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponInjectServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponInjectServiceImpl.java @@ -101,7 +101,7 @@ public class WxCouponInjectServiceImpl implements WxCouponInjectService { return new ResultData(e.getErrorCode(),e.getMessage()); } - WxCoupon wxCoupon = wxCouponService.getById(record.getCouponId()); + WxCoupon wxCoupon = wxCouponService.getById(record.getCouponId(),record.getTenantId()); if (wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode()) ) { //时间范围 if (new Date().after(wxCoupon.getValidEndDate())) { return new ResultData(ErrorCode.COUPON_IS_EXPIRED); @@ -274,7 +274,7 @@ public class WxCouponInjectServiceImpl implements WxCouponInjectService { // 发放免费券 WxCouponOrder couponOrder = null; try { - couponOrder = wxOrderService.sendFreeCouponToUser(tempCUser.getId(), wxCoupon.getId(),null,EnumPayWay.PAY_WAY_NOT_UNPAY_BATCH_SEND); + couponOrder = wxOrderService.sendFreeCouponToUser(tempCUser.getId(),wxCoupon.getTenantId(), wxCoupon.getId(),null,EnumPayWay.PAY_WAY_NOT_UNPAY_BATCH_SEND); if (couponOrder != null) { wxCouponActionLogService.addOne(couponOrder, wxCoupon.getId(), couponOrder.getId(), EnumCouponSendSendType.INJECT.getCode(), couponInjectId); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java index adf751344..b71bad4b8 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java @@ -359,7 +359,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { public WxCouponOrder verify(WxCouponOrder couponOrder, WxMerchantBUser bUser) { // 1. 获取券信息 - WxCoupon wxCoupon = wxCouponMapper.selectById(couponOrder.getCouponId()); + WxCoupon wxCoupon = wxCouponMapper.selectById(couponOrder.getCouponId(),couponOrder.getTenantId()); if (wxCoupon == null) { logger.error("券: coupon-" + wxCoupon.getId() + "不存在" + "couponOrder-" + couponOrder.getId()); throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); @@ -545,7 +545,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { } public void recordAfterVerified(WxCouponOrder couponOrder, Long merchantId) { - WxCoupon wxCoupon = wxCouponMapper.selectById(couponOrder.getCouponId()); + WxCoupon wxCoupon = wxCouponMapper.selectById(couponOrder.getCouponId(),couponOrder.getTenantId()); WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); if (couponOrder.getCouponType().equals(EnumCouponType.COUPON_PRESS.getCode()) && couponOrder.getCouponPrice().equals(wxCoupon.getSalePrice())) { @@ -646,7 +646,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { // coupon WxCoupon coupon; try { - coupon = wxCouponMapper.selectById(couponOrder.getCouponId()); + coupon = wxCouponMapper.selectById(couponOrder.getCouponId(),couponOrder.getTenantId()); } catch (Exception e) { logger.error("查找卡券错误: " + "CouponId:" + couponMerchantQ.getProductId()); throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR); @@ -753,7 +753,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); } // 2. get coupon info - WxCoupon coupon = wxCouponMapper.selectById(couponOrder.getCouponId()); + WxCoupon coupon = wxCouponMapper.selectById(couponOrder.getCouponId(),order.getTenantId()); if (coupon == null) { logger.error("找不到券信息"); throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); @@ -1274,7 +1274,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) public WxPayOrder microPayPreVerify(WxOrder microOrder, WxCouponOrder couponOrder, WxMerchantBUser bUser, Integer payPrice, EnumPayWay payWay,String ipstr,String authCode) { // 1. 获取券信息 - WxCoupon wxCoupon = wxCouponMapper.selectById(couponOrder.getCouponId()); + WxCoupon wxCoupon = wxCouponMapper.selectById(couponOrder.getCouponId(),couponOrder.getTenantId()); if (wxCoupon == null) { logger.error("券: coupon-" + wxCoupon.getId() + "不存在" + "couponOrder-" + couponOrder.getId()); throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); @@ -1453,7 +1453,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { int num = wxCouponOrderMapper.updateById(updateCouponOrder); if (num == 1) { WxCouponOrder couponOrder = wxCouponOrderMapper.selectById(couponOrderId); - WxCoupon coupon = wxCouponMapper.selectById(couponOrder.getCouponId()); + WxCoupon coupon = wxCouponMapper.selectById(couponOrder.getCouponId(),bUser.getTenantId()); doAfterVerify(couponOrder, bUser, coupon); } return 0; @@ -1471,7 +1471,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { if (num == 1) { WxCouponOrder couponOrder = wxCouponOrderMapper.selectById(couponOrderId); WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(couponOrder.getcUserId()); - WxCoupon coupon = wxCouponMapper.selectById(couponOrder.getCouponId()); + WxCoupon coupon = wxCouponMapper.selectById(couponOrder.getCouponId(),couponOrder.getTenantId()); doAfterVerify(couponOrder, coupon, wxCUserBasicInfo); } return 0; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java index f7841e689..cf4ebb2cb 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java @@ -181,7 +181,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { } //更新库存 - wxCouponService.reduceRemainInventory(wxCouponOfDb.getId(), merchantLnventory); + wxCouponService.reduceRemainInventory(wxCouponOfDb.getId(),wxCouponOfDb.getTenantId(), merchantLnventory); } @Override @@ -210,7 +210,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { } //退回coupon库存 if(merchantRemain!=0) { - wxCouponService.backRemainInventory(queryById.getId(), merchantRemain, wxCouponOfDb.getRemainInventory()); + wxCouponService.backRemainInventory(queryById.getId(),wxCouponOfDb.getTenantId(), merchantRemain, wxCouponOfDb.getRemainInventory()); } } wxCouponSendMapper.updateById(record); @@ -369,7 +369,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { // 发放免费券 WxCouponOrder couponOrder = null; try { - couponOrder = wxOrderService.sendFreeCouponToUser(cUserId, send.getCouponId(), null,payWay); + couponOrder = wxOrderService.sendFreeCouponToUser(cUserId,send.getTenantId(), send.getCouponId(), null,payWay); if (couponOrder != null) { bRet = true; @@ -639,7 +639,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { } couponSendList.forEach(cs -> { // 发放免费券 - WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cUserId, cs.getCouponId(), cs,payWay); + WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cUserId,cs.getTenantId(), cs.getCouponId(), cs,payWay); if (couponOrder != null) { wxCouponActionLogService.addOne(couponOrder, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId()); sendMsgForSendCoupon(couponOrder, cs, couponOrder, wxCUserBasicInfo); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 142b10b91..0df6d7184 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -178,19 +178,18 @@ public class WxCouponServiceImpl implements WxCouponService { } @Override - public WxCoupon getById(Long id) { - // TODO 富文本优化 - return wxCouponMapper.selectById(id); + public WxCoupon getById(Long id,String tenantId) { + return wxCouponMapper.selectById(id,tenantId); } @Override - public WxCoupon getHtmlById(Long id) { - return wxCouponMapper.selectById(id); + public WxCoupon getHtmlById(Long id,String tenantId) { + return wxCouponMapper.selectById(id,tenantId); } @Override - public WxCouponCVo getVoById(Long id) { - WxCouponCVo wxCouponCVo = wxCouponMapper.findVoDetail(id); + public WxCouponCVo getVoById(Long id,String tenantId) { + WxCouponCVo wxCouponCVo = wxCouponMapper.findVoDetail(id,tenantId); List merchantList = wxCouponCVo.getMerchantVoList(); if (merchantList != null) { merchantList = merchantList.stream().filter( @@ -202,8 +201,8 @@ public class WxCouponServiceImpl implements WxCouponService { } @Override - public WxCouponCVo getVoStatusById(Long id) { - WxCouponCVo wxCouponCVo = wxCouponMapper.findVoStatusDetail(id); + public WxCouponCVo getVoStatusById(Long id,String tenantId) { + WxCouponCVo wxCouponCVo = wxCouponMapper.findVoStatusDetail(id,tenantId); return wxCouponCVo; } @@ -390,7 +389,7 @@ public class WxCouponServiceImpl implements WxCouponService { } else { if(record.getInventory() != null && record.getRemainInventory() != null) { // 库存修改检查 - WxCoupon oldCoupon = wxCouponMapper.selectById(record.getId()); + WxCoupon oldCoupon = wxCouponMapper.selectById(record.getId(),record.getTenantId()); if (Objects.equals(oldCoupon.getRemainInventory(), record.getRemainInventory())) { // 库存未变, 不更新库存 record.setRemainInventory(null); @@ -493,8 +492,8 @@ public class WxCouponServiceImpl implements WxCouponService { } @Override - public void deleteById(Long id) { - wxCouponMapper.deleteById(id); + public void deleteById(Long id,String tenantId) { + wxCouponMapper.deleteById(id,tenantId); } @Override @@ -624,7 +623,7 @@ public class WxCouponServiceImpl implements WxCouponService { // 3. check 新的有效期是否合适 // 4. 更新库存及有效期 boolean bChanged = false; - WxCoupon oldCoupon = wxCouponMapper.selectById(wxCoupon.getId()); + WxCoupon oldCoupon = wxCouponMapper.selectById(wxCoupon.getId(),wxCoupon.getTenantId()); if(oldCoupon == null) { logger.error(ErrorCode.COUPON_IS_EMPTY.getMessage()); return new ResultData(ErrorCode.COUPON_IS_EMPTY); @@ -733,8 +732,8 @@ public class WxCouponServiceImpl implements WxCouponService { @Override @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) - public void reduceRemainInventory(Long id, Integer number) { - int num = wxCouponMapper.reduceInventory(id, number); + public void reduceRemainInventory(Long id,String tenantId, Integer number) { + int num = wxCouponMapper.reduceInventory(id,tenantId, number); if (num == 0) { throw new MallinkException(ErrorCode.ORDER_SAVE_ERR); } @@ -742,8 +741,8 @@ public class WxCouponServiceImpl implements WxCouponService { @Override @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) - public void backRemainInventory(Long id, Integer number, Integer remainInventory) { - int num = wxCouponMapper.backInventory(id, number, remainInventory); + public void backRemainInventory(Long id,String tenantId, Integer number, Integer remainInventory) { + int num = wxCouponMapper.backInventory(id,tenantId, number, remainInventory); if (num == 0) { throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL); } @@ -751,8 +750,8 @@ public class WxCouponServiceImpl implements WxCouponService { @Override @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) - public ResultData cardDefer(Long id,Date validEndDate) { - WxCoupon coupon = wxCouponMapper.selectById(id); + public ResultData cardDefer(Long id,String tenantId,Date validEndDate) { + WxCoupon coupon = wxCouponMapper.selectById(id,tenantId); if (null == coupon) { return new ResultData(Result.ERROR,id+"未查询到券信息."); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java index 12ba2d70f..67031b8a0 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -1120,7 +1120,7 @@ public class WxFlowServiceImpl implements WxFlowService { msgReplaceMap.put("contract", businessId.toString()); }else if(isCoupon(flowType)){ wxMsgRecord.setModelType(EnumMsgModel.FLOW_C_APPLY_NODIFY.getCode()); - WxCoupon wxCoupon = this.wxCouponMapper.selectById(businessId); + WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),tenantEntity.getTenantId()); msgReplaceMap.put("type",EnumCouponType.getEnum(wxCoupon.getType()).getMessage()); msgReplaceMap.put("name",wxCoupon.getTitle()); }else if(isSettle(flowType)){ @@ -1147,7 +1147,7 @@ public class WxFlowServiceImpl implements WxFlowService { msgReplaceMap.put("contract", businessId.toString()); }else if(isCoupon(flowType)){ mailMsg.setModelType(EnumMailMsgModel.MAIL_C_APPLY_NODIFY.getCode()); - WxCoupon wxCoupon = this.wxCouponMapper.selectById(businessId); + WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),tenantEntity.getTenantId()); msgReplaceMap.put("type",EnumCouponType.getEnum(wxCoupon.getType()).getMessage()); msgReplaceMap.put("name",wxCoupon.getTitle()); }else if(isSettle(flowType)){ @@ -1184,7 +1184,7 @@ public class WxFlowServiceImpl implements WxFlowService { msgReplaceMap.put("contract", businessId.toString()); }else if(isCoupon(flowType)){ wxMsgRecord.setModelType(EnumMsgModel.FLOW_C_PASS_NODIFY.getCode()); - WxCoupon wxCoupon = this.wxCouponMapper.selectById(businessId); + WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),tenantEntity.getTenantId()); msgReplaceMap.put("type",EnumCouponType.getEnum(wxCoupon.getType()).getMessage()); msgReplaceMap.put("name",wxCoupon.getTitle()); }else if(isSettle(flowType)){ @@ -1211,7 +1211,7 @@ public class WxFlowServiceImpl implements WxFlowService { msgReplaceMap.put("contract", businessId.toString()); }else if(isCoupon(flowType)){ mailMsg.setModelType(EnumMailMsgModel.MAIL_C_PASS_NODIFY.getCode()); - WxCoupon wxCoupon = this.wxCouponMapper.selectById(businessId); + WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),tenantEntity.getTenantId()); msgReplaceMap.put("type",EnumCouponType.getEnum(wxCoupon.getType()).getMessage()); msgReplaceMap.put("name",wxCoupon.getTitle()); }else if(isSettle(flowType)){ @@ -1337,7 +1337,7 @@ public class WxFlowServiceImpl implements WxFlowService { msgReplaceMap.put("contract", businessId.toString()); } else if (isCoupon(flowType)) { wxMsgRecord.setModelType(EnumMsgModel.FLOW_C_REJECT_NODIFY.getCode()); - WxCoupon wxCoupon = this.wxCouponMapper.selectById(businessId); + WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),tenantEntity.getTenantId()); msgReplaceMap.put("type",EnumCouponType.getEnum(wxCoupon.getType()).getMessage()); msgReplaceMap.put("name",wxCoupon.getTitle()); }else if (isSettle(flowType)) { @@ -1372,7 +1372,7 @@ public class WxFlowServiceImpl implements WxFlowService { msgReplaceMap.put("contract", businessId.toString()); }else if(isCoupon(flowType)){ mailMsg.setModelType(EnumMailMsgModel.MAIL_C_REJECT_NODIFY.getCode()); - WxCoupon wxCoupon = this.wxCouponMapper.selectById(businessId); + WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),tenantEntity.getTenantId()); msgReplaceMap.put("type",EnumCouponType.getEnum(wxCoupon.getType()).getMessage()); msgReplaceMap.put("name",wxCoupon.getTitle()); }else if(isSettle(flowType)){ diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java index fd7774e32..fce60ff70 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java @@ -294,7 +294,7 @@ public class WxGameServiceImpl implements WxGameService { public void saveOrUpdateCouponChannel(Long couponId, Map wxCouponChannelsMap, WxGame record){ - WxCoupon wxCoupon = wxCouponService.getById(couponId); + WxCoupon wxCoupon = wxCouponService.getById(couponId,record.getTenantId()); if (wxCoupon == null) { throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderGroupServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderGroupServiceImpl.java index f5132fb61..3049842ce 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderGroupServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderGroupServiceImpl.java @@ -384,7 +384,7 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { Long id = wxOrderGroup.getId(); WxOrderGroup group = wxOrderGroupMapper.selectById(id); if (group != null && group.getStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING.getCode())) { - WxCoupon wxCoupon = wxCouponMapper.selectById(wxOrderGroup.getCouponId()); + WxCoupon wxCoupon = wxCouponMapper.selectById(wxOrderGroup.getCouponId(),group.getTenantId()); Integer status = wxCoupon.getStatus(); if (status.equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode())) { group.setStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_CANCEL.getCode()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderPressServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderPressServiceImpl.java index aed2ab8db..5da2bcf0e 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderPressServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderPressServiceImpl.java @@ -156,7 +156,7 @@ public class WxOrderPressServiceImpl implements WxOrderPressService { throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); } // 2. get coupon info - WxCoupon coupon = wxCouponMapper.selectById(order.getProductId()); + WxCoupon coupon = wxCouponMapper.selectById(order.getProductId(),order.getTenantId()); if (order == null) { logger.error("找不到券信息"); throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java index 407b36d46..1f436e79a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java @@ -56,7 +56,6 @@ import com.iformall.domain.po.WxPayAccount; import com.iformall.domain.po.WxPayOrder; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.msg.FmInsideOrderSuccessMsg; -import com.iformall.domain.po.msg.UpdateCouponStockMsg; import com.iformall.domain.vo.WxCouponSendVo; import com.iformall.domain.vo.WxMerchantVo; import com.iformall.domain.vo.WxOrderCouponPressVo; @@ -593,7 +592,7 @@ public class WxOrderServiceImpl implements WxOrderService { boolean stocksetlock = redisLock.lock("couponLockStockSet_"+coupon.getId(), timeStr); if (stocksetlock) { if (!redisLock.hasCouponStockCache(coupon.getId())) { - WxCoupon cou = wxCouponMapper.selectById(coupon.getId()); + WxCoupon cou = wxCouponMapper.selectById(coupon.getId(),coupon.getTenantId()); if (null == cou) { redisLock.unlock("couponLockStockSet_"+coupon.getId(), timeStr); throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"未查询到券!"+coupon.getId()); @@ -660,7 +659,7 @@ public class WxOrderServiceImpl implements WxOrderService { try { //减库存,从redis中取,然后发mq消息同步到数据库 - wxCouponService.reduceRemainInventory(coupon.getId(), 1); + wxCouponService.reduceRemainInventory(coupon.getId(),coupon.getTenantId(), 1); long stock = redisLock.decrease(EnumCacheKey.COUPON_STOCK.getMessage()+coupon.getId(), 1); if (stock < 0 ) { @@ -784,7 +783,7 @@ public class WxOrderServiceImpl implements WxOrderService { } WxCoupon coupon = null; try { - coupon = wxCouponMapper.selectById(couponId); + coupon = wxCouponMapper.selectById(couponId,updateOrder.getTenantId()); } catch (Exception e) { logger.error("券未找到, e:" + e.getMessage()); redisLock.unlock(couponIdStr, timeStr); @@ -797,7 +796,7 @@ public class WxOrderServiceImpl implements WxOrderService { } try { - int num = wxCouponMapper.backInventory(coupon.getId(), 1, coupon.getRemainInventory()); + int num = wxCouponMapper.backInventory(coupon.getId(),coupon.getTenantId(), 1, coupon.getRemainInventory()); if (num <= 0) { logger.error("此券加库存失败, couponId: " + couponIdStr); throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"券couponId:["+couponIdStr+"]库存回滚失败,更新记录条数小于等于0."); @@ -1236,7 +1235,7 @@ public class WxOrderServiceImpl implements WxOrderService { @Override @Transactional(propagation = Propagation.NESTED, readOnly = false, rollbackFor = {Exception.class}) - public WxCouponOrder sendFreeCouponToUser(Long userId, Long couponId, WxCouponSendVo wxCouponSendVo,EnumPayWay payWay) { + public WxCouponOrder sendFreeCouponToUser(Long userId,String tenantId, Long couponId, WxCouponSendVo wxCouponSendVo,EnumPayWay payWay) { // check 用户状态 WxCUserBasicInfo user = null; try { @@ -1251,7 +1250,7 @@ public class WxOrderServiceImpl implements WxOrderService { // 检查券状态 String couponIdStr = String.valueOf(couponId); - WxCoupon coupon = wxCouponMapper.selectById(couponId); + WxCoupon coupon = wxCouponMapper.selectById(couponId,tenantId); if (coupon == null) { logger.error("券不存在, couponId: " + couponIdStr); throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); @@ -1331,7 +1330,7 @@ public class WxOrderServiceImpl implements WxOrderService { public int couponOrderSuccess(WxOrder updateOrder) { Date currentDate = new Date(); // 检查券相关 - WxCoupon coupon = wxCouponMapper.selectById(updateOrder.getProductId()); + WxCoupon coupon = wxCouponMapper.selectById(updateOrder.getProductId(),updateOrder.getTenantId()); if (coupon == null) { logger.error("券不存在, couponId: " + updateOrder.getProductId()); throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); @@ -1388,7 +1387,7 @@ public class WxOrderServiceImpl implements WxOrderService { @Override public void sendOrderSuccessActionMsg(WxOrder updateOrder) { // 检查券相关 - WxCoupon coupon = wxCouponMapper.selectById(updateOrder.getProductId()); + WxCoupon coupon = wxCouponMapper.selectById(updateOrder.getProductId(),updateOrder.getTenantId()); if (coupon == null) { logger.error("券不存在, couponId: " + updateOrder.getProductId()); throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java index ade99bd09..7f8d00eca 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java @@ -130,7 +130,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { wxPayOrderMapper.updateById(oldRecord); //处理其他信息 - WxCoupon wxCoupon = wxCouponMapper.selectById(order.getProductId()); + WxCoupon wxCoupon = wxCouponMapper.selectById(order.getProductId(),order.getTenantId()); if(wxCoupon != null) { if (isOrderGroupCoupon(oldRecord, wxCoupon)) { // 如果是Coupon是拼团, 创建拼团信息, 不创建COUPON_ORDER @@ -250,7 +250,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { } } - WxCoupon wxCoupon = wxCouponMapper.selectById(order.getProductId()); + WxCoupon wxCoupon = wxCouponMapper.selectById(order.getProductId(),order.getTenantId()); if (wxCoupon.getType().equals(EnumCouponType.COUPON_GROUP.getCode()) && wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode())) { logger.error("券已经下架了>>>" + order.getProductId()); @@ -824,7 +824,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { return; } Long productId = order.getProductId(); - WxCoupon wxCoupon = wxCouponMapper.selectById(productId); + WxCoupon wxCoupon = wxCouponMapper.selectById(productId,order.getTenantId()); if(wxCoupon != null) { if (isOrderGroupCoupon(record, wxCoupon)) { // 如果是Coupon是拼团, 创建拼团信息, 不创建COUPON_ORDER diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java index 180f05717..7560dee83 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java @@ -94,7 +94,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { private boolean isMerchantOrder(WxOrder wxOrder, Long merchantId) { if (wxOrder.getType().equals(EnumOrderType.COUPON.getCode())) { - WxCoupon wxCoupon = wxCouponMapper.selectById(wxOrder.getProductId()); + WxCoupon wxCoupon = wxCouponMapper.selectById(wxOrder.getProductId(),wxOrder.getTenantId()); if (wxCoupon != null) { WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); wxCouponMerchant.setProductId(wxCoupon.getId()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxTopicServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxTopicServiceImpl.java index 968c53962..06ab8f64a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxTopicServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxTopicServiceImpl.java @@ -122,7 +122,7 @@ public class WxTopicServiceImpl implements WxTopicService { final IdWorker idWorker = IdWorker.get(); String[] couponArray = couponId.split("-"); //保存coupon_channel - WxCoupon wxCoupon = wxCouponMapper.selectById(Long.parseLong(couponArray[1])); + WxCoupon wxCoupon = wxCouponMapper.selectById(Long.parseLong(couponArray[1]),record.getTenantId()); WxCouponChannel wxCouponChannel = new WxCouponChannel(); wxCouponChannel.setId(idWorker.nextId()); wxCouponChannel.setBeginTime(record.getBeginTime()); diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideOrderSuccessMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideOrderSuccessMsgServiceImpl.java index fcc0c5057..99ca9412e 100644 --- a/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideOrderSuccessMsgServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideOrderSuccessMsgServiceImpl.java @@ -68,7 +68,7 @@ public class FmInsideOrderSuccessMsgServiceImpl implements MsgSendService { logger.error("用户未找到: " + msg.getCUserId()); throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "用户未找到" + msg.getCUserId()); } - WxCoupon coupon = couponService.getById(msg.getCouponId()); + WxCoupon coupon = couponService.getById(msg.getCouponId(),couponChannel.getTenantId()); if(coupon == null) { logger.error("券未找到" + msg.getCouponId()); throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL.getCode(), "券未找到" + msg.getCouponId()); diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/UpdateCouponStockMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/UpdateCouponStockMsgServiceImpl.java index fe46cf65c..5714748c3 100644 --- a/mallinkService/src/main/java/com/iformall/service/msg/impl/UpdateCouponStockMsgServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/UpdateCouponStockMsgServiceImpl.java @@ -6,7 +6,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.iformall.domain.po.msg.BaseMsg; -import com.iformall.domain.po.msg.UpdateCouponStockMsg; import com.iformall.enums.EnumPayWay; import com.iformall.service.WxCouponService; import com.iformall.service.msg.MsgSendService; @@ -25,11 +24,11 @@ public class UpdateCouponStockMsgServiceImpl implements MsgSendService { @Override public void send(BaseMsg baseMsg) throws Exception { - UpdateCouponStockMsg msg = (UpdateCouponStockMsg)baseMsg; - if (null != msg ) { - if (msg.getOperateType().equals(UpdateCouponStockMsg.OPERATE_TYPE_DECREASE)) { - wxCouponService.reduceRemainInventory(msg.getCouponId(), (int)msg.getNumber()); - } - } +// UpdateCouponStockMsg msg = (UpdateCouponStockMsg)baseMsg; +// if (null != msg ) { +// if (msg.getOperateType().equals(UpdateCouponStockMsg.OPERATE_TYPE_DECREASE)) { +// wxCouponService.reduceRemainInventory(msg.getCouponId(), (int)msg.getNumber()); +// } +// } } } diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index 0af596860..269728cad 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -292,6 +292,15 @@ order by ${sortColumns} + + + + + update wx_coupon set is_del = 1 where id = #{id} and tenant_id = #{tenantId} + + + - select id, remain_inventory, status from wx_coupon - where id = #{id} + where id = #{id} and tenant_id =#{tenantId} - update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory - #{number} >= 0 + update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and tenant_id =#{tenantId} and remain_inventory - #{number} >= 0 - update wx_coupon SET remain_inventory = remain_inventory + #{number} where id = #{id} and remain_inventory + #{number} <= inventory + update wx_coupon SET remain_inventory = remain_inventory + #{number} where id = #{id} and tenant_id =#{tenantId} and remain_inventory + #{number} <= inventory diff --git a/mallinkSysAdmin/src/main/java/com/iformall/controller/datafix/DataInitController.java b/mallinkSysAdmin/src/main/java/com/iformall/controller/datafix/DataInitController.java index 2093a2d2b..f932ab471 100644 --- a/mallinkSysAdmin/src/main/java/com/iformall/controller/datafix/DataInitController.java +++ b/mallinkSysAdmin/src/main/java/com/iformall/controller/datafix/DataInitController.java @@ -171,7 +171,7 @@ public class DataInitController extends BaseController { List coList = couponOrderMapper.findListOfVerifiedByDate(dateMap); // 2 重新计算积分,比较是否需要修复 coList.forEach(co -> { - WxCoupon coupon = couponMapper.selectById(co.getCouponId()); + WxCoupon coupon = couponMapper.selectById(co.getCouponId(),co.getTenantId()); WxMerchantBUser buUser = merchantBUserMapper.selectById(co.getBUserId());