diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/device/WxScreenAdController.java b/mallinkAdmin/src/main/java/com/iformall/controller/device/WxScreenAdController.java index 7d5f5bad9..163051be3 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/device/WxScreenAdController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/device/WxScreenAdController.java @@ -84,7 +84,7 @@ public class WxScreenAdController extends BaseController { Object target = null; if (wxScreenAd.getType().equals(EnumScreenAdType.COUPON.getCode())) - target = wxCouponChannelService.findDetailVo(wxScreenAd.getTargetId()); + target = wxCouponChannelService.findDetailVo(wxScreenAd.getTargetId(),wxScreenAd.getTenantId()); if (wxScreenAd.getType().equals(EnumScreenAdType.COUPON.getCode())) target = wxCampaignService.getById(wxScreenAd.getTargetId()); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java index c88671ccd..f4a8f9207 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java @@ -114,7 +114,7 @@ public class WxCouponChannelController extends BaseController { @SystemControllerLog(description = "券投放-查询") public ResultData findById(Long id) { logger.debug("[" + getIpAddr() + "] WxCouponChannelController::findById"); - return new ResultData(Result.SUCCESS, "查询成功", wxCouponChannelService.getById(id)); + return new ResultData(Result.SUCCESS, "查询成功", wxCouponChannelService.getById(id,getTenantInfo().getTenantId())); } @ApiOperation("批量新增") 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 b6290ce5e..30526074f 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderController.java @@ -158,7 +158,7 @@ public class WxOrderController extends BaseController { if (orderSaveDto.getCouponChannelId() == null) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空"); } - WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(orderSaveDto.getCouponChannelId()); + WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(orderSaveDto.getCouponChannelId(),getTenantInfo().getTenantId()); ResultData resultData = couponChannelCheck(orderSaveDto, wxCouponChannel); if (resultData != null) { return resultData; 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 b544fefdf..fb5e115ff 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/MemCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/MemCouponController.java @@ -96,7 +96,7 @@ public class MemCouponController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId必填"); } memCouponFromDsp.updateTenantInfo(getTenantInfo()); - WxCouponChannel couponChannel = couponChannelService.getById(memCouponFromDsp.getCouponChannelId()); + WxCouponChannel couponChannel = couponChannelService.getById(memCouponFromDsp.getCouponChannelId(),getTenantInfo().getTenantId()); if (memCouponFromDsp.getCouponId() == null) { memCouponFromDsp.setCouponId(couponChannel.getCouponId()); } @@ -139,7 +139,7 @@ public class MemCouponController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId必填"); } memCouponFromDsp.updateTenantInfo(getTenantInfo()); - WxCouponChannel couponChannel = couponChannelService.getById(memCouponFromDsp.getCouponChannelId()); + WxCouponChannel couponChannel = couponChannelService.getById(memCouponFromDsp.getCouponChannelId(),getTenantInfo().getTenantId()); if (memCouponFromDsp.getCouponId() == null) { memCouponFromDsp.setCouponId(couponChannel.getCouponId()); } diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java index 00251e4e6..499d5a174 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java @@ -101,7 +101,7 @@ public class WxCouponChannelController extends BaseController { @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) public ResultData findById(Long id) { logger.debug("[" + getIpAddr() + "] WxCouponChannelController::findById"); - return new ResultData(Result.SUCCESS, "查询成功", wxCouponChannelService.getById(id)); + return new ResultData(Result.SUCCESS, "查询成功", wxCouponChannelService.getById(id,getTenantInfo().getTenantId())); } @ApiOperation("批量新增") diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java index 48b1558bf..8ee5d3ed1 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.getTenantId()); + WxCouponCVo couponCVo = couponService.getVoStatusById(couponIdL,getTenantInfo().getTenantId()); if (wxCouponCVo == null) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } @@ -95,7 +95,7 @@ public class WxCouponController extends BaseController { } else { // 更新状态 // WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelIdL); - WxCouponCVo couponCVo = generateWxCouponCVo(couponChannelIdL); + WxCouponCVo couponCVo = generateWxCouponCVo(couponChannelIdL,getTenantInfo().getTenantId()); if (wxCouponCVo == null) { return new ResultData(ErrorCode.COUPON_IS_EMPTY); } @@ -111,7 +111,7 @@ public class WxCouponController extends BaseController { //WxCouponCVo wxCouponCVo = wxCouponChannelService.findDetailVo(couponChannelIdL); WxCouponCVo wxCouponCVo = null; try { - wxCouponCVo = generateWxCouponCVoex(couponChannelIdL); + wxCouponCVo = generateWxCouponCVoex(couponChannelIdL,getTenantInfo().getTenantId()); } catch (IllegalAccessException e) { logger.error("coupon detail fail,copyproperties error" + couponChannelId,e); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "coupon detail fail,copyproperties error" + couponChannelId); @@ -163,7 +163,7 @@ public class WxCouponController extends BaseController { } WxCouponCVo wxCouponCVo = null; try { - wxCouponCVo = generateWxCouponCVoForHtml(couponChannelIdL, couponIdL); + wxCouponCVo = generateWxCouponCVoForHtml(couponChannelIdL, couponIdL,getTenantInfo().getTenantId()); } catch (Exception e) { logger.error("coupon html fail: " + couponChannelId,e); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "coupon html fail: " + couponChannelId); @@ -178,8 +178,8 @@ public class WxCouponController extends BaseController { return new ResultData(wxCouponCVo); } - private WxCouponCVo generateWxCouponCVo(Long couponChannelIdL) { - WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL); + private WxCouponCVo generateWxCouponCVo(Long couponChannelIdL,String tenantId) { + WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId); if (cc == null) { return null; } @@ -197,8 +197,8 @@ public class WxCouponController extends BaseController { return couponCVo; } - private WxCouponCVo generateWxCouponCVoForHtml(Long couponChannelIdL, Long couponIdL) { - WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL); + private WxCouponCVo generateWxCouponCVoForHtml(Long couponChannelIdL, Long couponIdL,String tenantId) { + WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId); if (cc == null) { return null; } @@ -216,8 +216,8 @@ public class WxCouponController extends BaseController { } - private WxCouponCVo generateWxCouponCVoex(Long couponChannelIdL) throws IllegalAccessException, InvocationTargetException { - WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL); + private WxCouponCVo generateWxCouponCVoex(Long couponChannelIdL,String tenantId) throws IllegalAccessException, InvocationTargetException { + WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId); if (cc == null) { return null; } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java index 3838ea530..6d3bf2531 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java @@ -79,7 +79,7 @@ public class WxOrderController extends BaseController { if (orderSaveDto.getCouponChannelId() == null) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空"); } - WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(orderSaveDto.getCouponChannelId()); + WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(orderSaveDto.getCouponChannelId(),getTenantInfo().getTenantId()); if (wxCouponChannel == null) { logger.error("couponChannelId find error, " + orderSaveDto.getCouponChannelId()); return new ResultData(ErrorCode.COUPON_CHANNEL_IS_TAKE_OFF); @@ -119,7 +119,7 @@ public class WxOrderController extends BaseController { wxCouponCVo = operations.get(key); } else { // 游戏没有入缓存,需要从数据库中读取 - wxCouponCVo = wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId()); + wxCouponCVo = wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId(),wxCouponChannel.getTenantId()); if (wxCouponCVo != null) { // 游戏优化,进缓存 cdRedisTemplate.opsForValue().set(key, wxCouponCVo, 3600, TimeUnit.SECONDS); diff --git a/mallinkCallback/src/main/java/com/iformall/controller/device/WxDeviceScreenAdController.java b/mallinkCallback/src/main/java/com/iformall/controller/device/WxDeviceScreenAdController.java index 615a469d3..1f07d1272 100644 --- a/mallinkCallback/src/main/java/com/iformall/controller/device/WxDeviceScreenAdController.java +++ b/mallinkCallback/src/main/java/com/iformall/controller/device/WxDeviceScreenAdController.java @@ -82,7 +82,7 @@ public class WxDeviceScreenAdController extends BaseController { page.getList().stream().forEach(s->{ Object target = null; if (s.getType().equals(EnumScreenAdType.COUPON.getCode())) - target = wxCouponChannelService.findDetailVo(s.getTargetId()); + target = wxCouponChannelService.findDetailVo(s.getTargetId(),wxScreenAd.getTenantId()); else if (s.getType().equals(EnumScreenAdType.CAMPAIGN.getCode())) target = wxCampaignService.getById(s.getTargetId()); else if (s.getType().equals(EnumScreenAdType.MERCHANT.getCode())) diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/CouponExpiringSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/CouponExpiringSchedule.java index 22b8c5e4d..85e3dd61c 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/CouponExpiringSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/CouponExpiringSchedule.java @@ -2,6 +2,7 @@ package com.iformall.schedule; import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.po.WxGame; +import com.iformall.domain.po.WxMall; import com.iformall.enums.EnumCouponChannelStatus; import com.iformall.enums.EnumCouponChannelType; import com.iformall.enums.EnumGameStatus; @@ -35,17 +36,31 @@ public class CouponExpiringSchedule { @Autowired private WxGameMapper wxGameMapper; + + @Autowired + private WxMallMapper wxMallMapper; + + private List getMalls() { + WxMall wxMall = new WxMall(); + return wxMallMapper.findList(wxMall); + } @Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 作废过期券,商户禁用券 //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 public void couponExpiringSchedule() { - - wxCouponMapper.offExpiriedCouponByValidDate(); - wxCouponMapper.offExpiriedCouponByMerchantStatus(); - - wxCouponSendMapper.offExpiriedCouponSendByCouponStatus(); - wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(); + List malls = getMalls(); + for (WxMall mall : malls) { + try { + wxCouponMapper.offExpiriedCouponByValidDate(); + wxCouponMapper.offExpiriedCouponByMerchantStatus(); + + wxCouponSendMapper.offExpiriedCouponSendByCouponStatus(); + wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(mall.getTenantId()); + }catch(Exception e) { + logger.error("couponExpiringSchedule error.mall:"+mall.getTenantId(),e); + } + } } @Scheduled(cron = "0 10 0 * * ?") // 每天凌晨00:10 下架定向发放 @@ -57,10 +72,16 @@ public class CouponExpiringSchedule { @Scheduled(cron = "0 10 0 * * ?") // 每天凌晨00:10 下架主动领取 //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 public void couponChannelExpiringSchedule() { - - wxCouponChannelMapper.offExpiriedCouponChannelByEndTime(); - wxCouponChannelMapper.offExpiriedCouponChannelByValidDate(); - wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(); + List malls = getMalls(); + for (WxMall mall : malls) { + try { + wxCouponChannelMapper.offExpiriedCouponChannelByEndTime(mall.getTenantId()); + wxCouponChannelMapper.offExpiriedCouponChannelByValidDate(mall.getTenantId()); + wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(mall.getTenantId()); + }catch(Exception e) { + logger.error("couponChannelExpiringSchedule error.mall:"+mall.getTenantId(),e); + } + } } @Scheduled(cron = "0 15 0 * * ?") // 每天凌晨00:15 下架券广告 @@ -72,7 +93,14 @@ public class CouponExpiringSchedule { @Scheduled(cron = "0 0,1,2,3 0/1 * * ?") // 每小时 0, 1 ,2 ,3 分钟(整点)执行//限时抢购 //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 public void couponChannel2ExpiringSchedule() { - wxCouponChannelMapper.offExpiriedCouponChannel2ByEndTime(); + List malls = getMalls(); + for (WxMall mall : malls) { + try { + wxCouponChannelMapper.offExpiriedCouponChannel2ByEndTime(mall.getTenantId()); + }catch(Exception e) { + logger.error("couponChannel2ExpiringSchedule error.mall:"+mall.getTenantId(),e); + } + } } @Scheduled(cron = "0 20 0 * * ?") // 每天凌晨00:20 下架游戏 diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java index dbd4d98e3..3583af424 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java @@ -11,6 +11,8 @@ import org.apache.ibatis.annotations.Param; public interface WxCouponChannelMapper extends CommonMapper { + WxCouponChannel selectById(@Param("id")Long id,@Param("tenantId")String tenantId); + List findList(WxCouponChannel wxCouponChannel); int countCoupon(WxCouponChannel wxCouponChannel); @@ -21,25 +23,25 @@ public interface WxCouponChannelMapper extends CommonMapper findVoListByMerchant(WxCouponChannel wxCouponChannel); - WxCouponCVo findVoDetail(@Param("id")Long id); + WxCouponCVo findVoDetail(@Param("id")Long id,@Param("tenantId")String tenantId); - WxCouponCVo findVoStatusDetail(@Param("id")Long id); + WxCouponCVo findVoStatusDetail(@Param("id")Long id,@Param("tenantId")String tenantId); void updateStatusByCouponId(WxCouponChannel wxCouponChannel); int updateEndTimeByCouponId(WxCouponChannel wxCouponChannel); - void offExpiriedCouponChannelByEndTime(); + void offExpiriedCouponChannelByEndTime(@Param("tenantId")String tenantId); - void offExpiriedCouponChannelByValidDate(); + void offExpiriedCouponChannelByValidDate(@Param("tenantId")String tenantId); - void offExpiriedCouponChannelByCouponStatus(); + void offExpiriedCouponChannelByCouponStatus(@Param("tenantId")String tenantId); - void offExpiriedCouponChannel2ByEndTime(); + void offExpiriedCouponChannel2ByEndTime(@Param("tenantId")String tenantId); void delByTopic(WxTopic wxTopic); List findQrcodeEmptyList(); - void cardDefer(@Param("couponId")Long couponId,@Param("endTime")Date endTime); + void cardDefer(@Param("couponId")Long couponId,@Param("tenantId")String tenantId,@Param("endTime")Date endTime); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java index 735223066..7f852a5ef 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java @@ -43,9 +43,9 @@ public interface WxCouponChannelService { */ PageInfo listByMerchant(WxCouponChannel record, Integer pageIndex, Integer pageSize); - WxCouponCVo findDetailVo(Long id); + WxCouponCVo findDetailVo(Long id,String tenantId); - WxCouponCVo findVoStatusDetail(Long id); + WxCouponCVo findVoStatusDetail(Long id,String tenantId); /** * 根据实体查询Vo分页列表 @@ -61,7 +61,7 @@ public interface WxCouponChannelService { * @param id * @return */ - WxCouponChannel getById(Long id); + WxCouponChannel getById(Long id,String tenantId); /** * 保存或更新实体 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 a5f27e149..bff8e0e8a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java @@ -71,8 +71,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { } @Override - public WxCouponChannel getById(Long id) { - return wxCouponChannelMapper.selectById(id); + public WxCouponChannel getById(Long id,String tenantId) { + return wxCouponChannelMapper.selectById(id,tenantId); } @Override @@ -85,7 +85,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { return new ResultData(record); } else { if (record.getCouponId() != null && record.getStatus() != null) { - WxCouponChannel orignal = getById(record.getId()); + WxCouponChannel orignal = getById(record.getId(),record.getTenantId()); if (orignal.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) && record.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode())) { @@ -108,7 +108,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { } } if (record.getStatus() != null) { - WxCouponChannel orignal = getById(record.getId()); + WxCouponChannel orignal = getById(record.getId(),record.getTenantId()); if (orignal.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()) && record.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode())) { wxScreenAdService.updateStatusByCouponChannelId(record.getId(),record,EnumScreenAdStatus.INVALID.getCode()); @@ -294,6 +294,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { WxCouponChannel couponChannel = new WxCouponChannel(); couponChannel.setId(vo.getId()); couponChannel.setType(vo.getType()); + couponChannel.updateTenantInfo(tenantEntity); String param = couponChannel.getWeappScene(); //此处只有微信二维码 @@ -342,13 +343,13 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { } @Override - public WxCouponCVo findDetailVo(Long id) { - return wxCouponChannelMapper.findVoDetail(id); + public WxCouponCVo findDetailVo(Long id,String tenantId) { + return wxCouponChannelMapper.findVoDetail(id,tenantId); } @Override - public WxCouponCVo findVoStatusDetail(Long id) { - return wxCouponChannelMapper.findVoStatusDetail(id); + public WxCouponCVo findVoStatusDetail(Long id,String tenantId) { + return wxCouponChannelMapper.findVoStatusDetail(id,tenantId); } @Override 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 0df6d7184..52a9750ee 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -764,7 +764,7 @@ public class WxCouponServiceImpl implements WxCouponService { wxCouponMapper.updateValidEndDate(coupon); //更新coupon_channel - wxCouponChannelMapper.cardDefer(id, validEndDate); + wxCouponChannelMapper.cardDefer(id,tenantId, validEndDate); //更新coupon_order的状态,已过期的变为使用中 5-->4 List couponOrderIds = wxCouponOrderMapper.cardDeferCouponOrderId(id); 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 fce60ff70..968947f19 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java @@ -198,7 +198,7 @@ public class WxGameServiceImpl implements WxGameService { couponIdsList.add(couponChannelVo); String key = "cc:" + couponChannelVo.getId(); if (!cdRedisTemplate.hasKey(key)) { - WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelVo.getId()); + WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelVo.getId(),couponChannelQ.getTenantId()); if(Objects.nonNull(couponCVo)) { // 插入缓存 operations.set(key, couponCVo, 3600, TimeUnit.SECONDS); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java index 96a41258c..8479b5a53 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java @@ -68,7 +68,7 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { if (record.getType().equals(EnumScreenAdType.COUPON.getCode())) { if (record.getTargetId() == null) return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); - WxCouponCVo wxCouponCVo = wxCouponChannelMapper.findVoDetail(record.getTargetId()); + WxCouponCVo wxCouponCVo = wxCouponChannelMapper.findVoDetail(record.getTargetId(),record.getTenantId()); if (wxCouponCVo == null) return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); record.setCoverImg(wxCouponCVo.getCoverImg()); 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 99ca9412e..d56451922 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 @@ -53,7 +53,7 @@ public class FmInsideOrderSuccessMsgServiceImpl implements MsgSendService { logger.error("订单用户不一致: " + msg.getOrderId()); throw new MallinkException(ErrorCode.ORDER_USER_NOT_MATCH.getCode(), "订单用户不一致" + msg.getOrderId()); } - WxCouponChannel couponChannel = couponChannelService.getById(record.getCouponChannelId()); + WxCouponChannel couponChannel = couponChannelService.getById(record.getCouponChannelId(),record.getTenantId()); if(couponChannel == null) { logger.error("投放渠道未找到: " + record.getCouponChannelId()); throw new MallinkException(ErrorCode.ORDER_COUPON_CHANNEL_NOT_MATCH.getCode(), "投放渠道未找到" + record.getCouponChannelId()); diff --git a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml index 30fc959ee..2fe48f030 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml @@ -126,6 +126,10 @@ order by ${sortColumns} + + + - select from wx_coupon c, wx_coupon_channel cc - where cc.coupon_id = c.id and cc.id = #{id} + where cc.coupon_id = c.id and cc.id = #{id} and cc.tenant_id = #{tenantId} @@ -375,24 +379,24 @@ - + update wx_coupon_channel SET status = 1, update_date = now() - where status = 0 and end_time < now() + where status = 0 and tenant_id = #{tenantId} and end_time < now() update wx_coupon_channel cc, wx_coupon c SET cc.status = 1, cc.update_date = now() - where cc.status = 0 and cc.coupon_id = c.id and c.valid_type = 1 and c.valid_end_date < now() + where cc.status = 0 and cc.tenant_id = #{tenantId} and cc.coupon_id = c.id and c.valid_type = 1 and c.valid_end_date < now() update wx_coupon_channel cc, wx_coupon c SET cc.status = 1, cc.update_date = now() - where cc.status = 0 and cc.coupon_id = c.id and c.status = 1 + where cc.status = 0 and cc.tenant_id = #{tenantId} and cc.coupon_id = c.id and c.status = 1 update wx_coupon_channel SET status = 1, update_date = now() - where status = 0 and target_ad = 2 and end_time < now() + where status = 0 and tenant_id = #{tenantId} and target_ad = 2 and end_time < now() @@ -404,7 +408,7 @@ - update wx_coupon_channel set end_time = #{endTime} where coupon_id = #{couponId} and target_ad = 5 and type = 100 + update wx_coupon_channel set end_time = #{endTime} where coupon_id = #{couponId} and tenant_id = #{tenantId} and target_ad = 5 and type = 100