| @@ -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); | |||
| @@ -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) { | |||
| @@ -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 订单已支付 | |||
| @@ -103,7 +103,7 @@ public class MemCouponFromDspServiceImpl implements MemCouponFromDspService { | |||
| List<MemCouponFromDsp> 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); | |||
| @@ -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); | |||
| @@ -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); | |||
| } | |||
| @@ -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; | |||
| @@ -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); | |||
| @@ -389,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); | |||
| @@ -623,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); | |||
| @@ -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)){ | |||
| @@ -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()); | |||
| @@ -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); | |||
| @@ -592,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()); | |||
| @@ -783,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); | |||
| @@ -1235,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 { | |||
| @@ -1250,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); | |||
| @@ -1330,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); | |||
| @@ -1387,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); | |||
| @@ -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 | |||
| @@ -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()); | |||
| @@ -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()); | |||
| @@ -171,7 +171,7 @@ public class DataInitController extends BaseController { | |||
| List<WxCouponOrder> 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()); | |||