| @@ -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); | |||
| } | |||
| } | |||
| @@ -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查询接口") | |||
| @@ -15,4 +15,8 @@ public interface TtCouponChannelPoiMapper extends CommonMapper<TtCouponChannelPo | |||
| Integer getPoiPutOnCount(@Param("tenantId")String tenantId, @Param("ids")List<Long> 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); | |||
| } | |||
| @@ -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); | |||
| } | |||
| @@ -80,4 +80,6 @@ public interface WxCouponChannelService { | |||
| ResultData getCouponChannelPoi(TenantEntity tenantInfo, Long id); | |||
| PageInfo<TtCouponChannelVo> ttChannelList(TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize); | |||
| ResultData updateOnline(WxCouponChannel wxCouponChannel); | |||
| } | |||
| @@ -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); | |||
| @@ -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()); | |||
| @@ -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()); | |||
| @@ -70,6 +70,20 @@ | |||
| from tt_coupon_channel_poi | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from tt_coupon_channel_poi | |||
| where `id` = #{id} | |||
| </select> | |||
| <select id="selectByChannelId" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from tt_coupon_channel_poi | |||
| where `coupon_channel_id` = #{couponChannelId} | |||
| </select> | |||
| <select id="findIdList" parameterType="com.iformall.domain.po.TtCouponChannelPoi" resultType="Long"> | |||
| select id | |||