diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/TtCouponGoodsController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/TtCouponGoodsController.java index 6343ffea9..b2113ac6e 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/TtCouponGoodsController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/TtCouponGoodsController.java @@ -73,9 +73,6 @@ public class TtCouponGoodsController extends BaseController { public ResultData channelList(@ModelAttribute TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize) { logger.debug("[" + getIpAddr() + "] WxCouponController::channelList"); if (ttChannelVo == null) ttChannelVo = new TtCouponChannelVo(); - if (ttChannelVo.getStatus() != null && ttChannelVo.getStatus() == -1) { - ttChannelVo.setStatus(null); - } ttChannelVo.updateTenantInfo(getTenantInfo()); ttChannelVo.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode()); if(null == ttChannelVo.getSourceType()){ @@ -148,7 +145,7 @@ public class TtCouponGoodsController extends BaseController { if (id == null) { return new ResultData(ResultData.ERROR, "缺少id"); } - return ttCouponGoodsService.productDraftGet(id); + return ttCouponGoodsService.productDraftGet(getTenantInfo(),id); } @ApiOperation("实时查询线上商品状态") @@ -158,7 +155,9 @@ public class TtCouponGoodsController extends BaseController { if (id == null) { return new ResultData(ResultData.ERROR, "缺少id"); } - return ttCouponGoodsService.productOnlineGet(id); + return ttCouponGoodsService.productOnlineGet(getTenantInfo(),id); } + + } 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 4f2fbbae5..aabd2912f 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java @@ -99,6 +99,23 @@ public class WxCouponChannelController extends BaseController { return resultData; } + @ApiOperation("预审核上架") + @PostMapping("updateOnline") + @SystemControllerLog(description = "预审核上架") + public ResultData updateOnline(@RequestBody WxCouponChannel wxCouponChannel) { + wxCouponChannel.updateTenantInfo(getTenantInfo()); + if (wxCouponChannel.getId() == null) { + return new ResultData(ResultData.ERROR, "缺少id"); + } + ResultData resultData = wxCouponChannelService.updateOnline(wxCouponChannel); + if(resultData.code == 200){ + CouponCacheUtils.removeCouponChannelCache(redisTemplate, wxCouponChannel.getId()); + CouponCacheUtils.removeDouyinLivePageCache(redisTemplate, wxCouponChannel.getTenantId(), null, null); + } + + return resultData; + } + @ApiOperation("根据id查询接口") diff --git a/mallinkService/src/main/java/com/iformall/mapper/TtCouponChannelPoiMapper.java b/mallinkService/src/main/java/com/iformall/mapper/TtCouponChannelPoiMapper.java index a1c9318b5..7ce8ad0f7 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/TtCouponChannelPoiMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/TtCouponChannelPoiMapper.java @@ -15,4 +15,8 @@ public interface TtCouponChannelPoiMapper extends CommonMapper ids); int updateBySpuId(TtCouponChannelPoi couponChannelPoi); + + TtCouponChannelPoi selectById(@Param("tenantId")String tenantId,@Param("id")Long id); + + TtCouponChannelPoi selectByChannelId(@Param("tenantId")String tenantId,@Param("channelId")Long channelId); } diff --git a/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java b/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java index d8ecb9084..41a90efee 100644 --- a/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java +++ b/mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java @@ -3,6 +3,7 @@ package com.iformall.service; import com.iformall.common.ResultData; import com.iformall.domain.po.TtCouponChannelPoi; import com.iformall.domain.po.WxCoupon; +import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.TtCouponChannelVo; import com.iformall.domain.vo.TtCouponVo; @@ -17,8 +18,8 @@ public interface TtCouponGoodsService { int handlerTtGoodsAudit(TtCouponChannelPoi couponChannelPoi); - ResultData productDraftGet(Long id); + ResultData productDraftGet(TenantEntity tenantEntity,Long id); - ResultData productOnlineGet(Long id); + ResultData productOnlineGet(TenantEntity tenantEntity,Long id); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java index fad89f87d..7db48b56b 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java @@ -80,4 +80,6 @@ public interface WxCouponChannelService { ResultData getCouponChannelPoi(TenantEntity tenantInfo, Long id); PageInfo ttChannelList(TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize); + + ResultData updateOnline(WxCouponChannel wxCouponChannel); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java index ffda4d2c8..d2c79e153 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java @@ -218,8 +218,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { } @Override - public ResultData productDraftGet(Long id) { - TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(id); + public ResultData productDraftGet(TenantEntity tenantEntity,Long id) { + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantEntity.getTenantId(),id); if(ttCouponChannelPoi == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该商品未提交审核"); } @@ -252,8 +252,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { } @Override - public ResultData productOnlineGet(Long id) { - TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(id); + public ResultData productOnlineGet(TenantEntity tenantEntity,Long id) { + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantEntity.getTenantId(),id); if(ttCouponChannelPoi == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该商品未提交审核"); } @@ -286,7 +286,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { } private void syncCouponChannelPoi(WxCoupon coupon,Long couponChannelId,String productId){ - TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(coupon.getId()); + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(coupon.getTenantId(),coupon.getId()); Date date = new Date(); if(ttCouponChannelPoi != null){ ttCouponChannelPoi.setCouponChannelId(couponChannelId); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java index 4490a9dfa..8d1eb5155 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java @@ -613,7 +613,7 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { } private void syncCouponChannelPoi(WxCouponChannel ccUpd){ - TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(ccUpd.getId()); + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(ccUpd.getTenantId(),ccUpd.getId()); if(ttCouponChannelPoi != null){ ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_auditing.getCode()); ttCouponChannelPoi.setLastStatusDesc(""); @@ -806,7 +806,7 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { TtSpuSync spuDetail = spuGetResult.getSpuDetail(); if(spuDetail != null && StringUtils.isNotBlank(spuDetail.getSpuId()) && StringUtils.isNotBlank(spuDetail.getSpuExtId()) && spuDetail.getStatus() != null){ - TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(Long.parseLong(spuDetail.getSpuExtId())); + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),Long.parseLong(spuDetail.getSpuExtId())); if(ttCouponChannelPoi != null && !spuDetail.getStatus().equals(ttCouponChannelPoi.getStatus())){ TtCouponChannelPoi ccPoi = new TtCouponChannelPoi(); ccPoi.setId(ttCouponChannelPoi.getId()); @@ -831,7 +831,7 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { TtSpuSync spuDraft = spuDraftList.get(0); if(spuDraft != null && StringUtils.isNotBlank(spuDraft.getSpuId()) && StringUtils.isNotBlank(spuDraft.getSpuExtId()) && spuDraft.getStatus() != null){ - TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(Long.parseLong(spuDraft.getSpuExtId())); + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),Long.parseLong(spuDraft.getSpuExtId())); if(ttCouponChannelPoi != null && !spuDraft.getStatus().equals(ttCouponChannelPoi.getStatus())){ TtCouponChannelPoi ccPoi = new TtCouponChannelPoi(); ccPoi.setId(ttCouponChannelPoi.getId()); 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 ffa685f5c..c25d4132e 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java @@ -794,7 +794,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { @Override public ResultData getCouponChannelPoi(TenantEntity tenantInfo, Long id) { - TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(id); + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),id); if(ttCouponChannelPoi != null && ttCouponChannelPoi.getStatus() != null && ttCouponChannelPoi.getStatus().intValue() > 0){ return new ResultData(ttCouponChannelPoi); } @@ -820,6 +820,24 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { return pageInfo; } + @Override + public ResultData updateOnline(WxCouponChannel wxCouponChannel) { + TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectByChannelId(wxCouponChannel.getTenantId(),wxCouponChannel.getId()); + if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该商品未提交审核或审核未通过"); + } + Date date = new Date(); + WxCouponChannel updChannel = new WxCouponChannel(); + updChannel.setId(wxCouponChannel.getId()); + updChannel.updateTenantInfo(wxCouponChannel); + updChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); + wxCouponChannel.setShowBeginTime(date); + wxCouponChannel.setBeginTime(date); + wxCouponChannel.setUpdateDate(date); + wxCouponChannelMapper.updateById(updChannel); + return new ResultData(); + } + @Override public WxCouponChannel getPriceAndStock(TenantEntity tenantEntity, Long couponChannelId) { return wxCouponChannelMapper.getPriceAndStock(couponChannelId, tenantEntity.getTenantId()); diff --git a/mallinkService/src/main/resources/mapper/TtCouponChannelPoiMapper.xml b/mallinkService/src/main/resources/mapper/TtCouponChannelPoiMapper.xml index 24bf2f52c..15e1685f0 100644 --- a/mallinkService/src/main/resources/mapper/TtCouponChannelPoiMapper.xml +++ b/mallinkService/src/main/resources/mapper/TtCouponChannelPoiMapper.xml @@ -70,6 +70,20 @@ from tt_coupon_channel_poi + + + +