| @@ -7,6 +7,7 @@ import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.controller.base.DouyinBaseController; | |||
| import com.iformall.domain.po.TtCouponChannelPoi; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.vo.TtCouponChannelVo; | |||
| @@ -153,6 +154,39 @@ public class TtCouponGoodsController extends DouyinBaseController { | |||
| } | |||
| } | |||
| @TenantIgnore | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("updateOnlieStatus") | |||
| @SystemControllerLog(description = "抖音poi 上下架") | |||
| public ResultData updateOnlieStatus(@RequestBody WxCoupon wxCoupon) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::updateOnlieStatus"); | |||
| if (wxCoupon.getId() == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||
| } | |||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponGoodsService.getCouponChannelByCouponId(getTenantInfo(), wxCoupon.getId()); | |||
| if(ttCouponChannelPoi == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"审核数据异常"); | |||
| } | |||
| EnumSpuSyncStatus poiStatus = EnumSpuSyncStatus.getEnum(ttCouponChannelPoi.getStatus()); | |||
| if(poiStatus == null || EnumSpuSyncStatus.sync_auditing.equals(poiStatus) || EnumSpuSyncStatus.sync_audit_rejection.equals(poiStatus)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"审核状态异常"); | |||
| } | |||
| if (wxCoupon.getPoiStatus() == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少状态值"); | |||
| } | |||
| EnumSpuSyncStatus updPoiStatus = EnumSpuSyncStatus.getEnum(wxCoupon.getPoiStatus()); | |||
| if(updPoiStatus == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"上下架参数异常"); | |||
| } | |||
| try { | |||
| boolean isSaas = this.isGoodLifeSaas(); | |||
| return ttCouponGoodsService.productOperate(getTenantInfo(), wxCoupon.getId(),updPoiStatus,isSaas); | |||
| } catch (Exception e) { | |||
| logger.error("product draft error.",e); | |||
| return new ResultData(Result.ERROR,e.getMessage()); | |||
| } | |||
| } | |||
| @TenantIgnore | |||
| @ApiOperation("实时查询审核状态") | |||
| @GetMapping("product/draft") | |||
| @@ -188,6 +222,7 @@ public class TtCouponGoodsController extends DouyinBaseController { | |||
| } | |||
| @ApiOperation("实时同步上下架状态") | |||
| @GetMapping("product/operate") | |||
| @SystemControllerLog(description = "实时同步上下架状态") | |||
| @@ -195,9 +230,17 @@ public class TtCouponGoodsController extends DouyinBaseController { | |||
| if (id == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||
| } | |||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponGoodsService.getCouponChannelByCouponId(getTenantInfo(), id); | |||
| if(ttCouponChannelPoi == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"审核数据异常"); | |||
| } | |||
| EnumSpuSyncStatus poiStatus = EnumSpuSyncStatus.getEnum(ttCouponChannelPoi.getStatus()); | |||
| if(poiStatus == null || EnumSpuSyncStatus.sync_auditing.equals(poiStatus) || EnumSpuSyncStatus.sync_audit_rejection.equals(poiStatus)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"审核状态异常"); | |||
| } | |||
| try { | |||
| boolean isSaas = this.isGoodLifeSaas(); | |||
| return ttCouponGoodsService.productOperate(getTenantInfo(),id,isSaas); | |||
| return ttCouponGoodsService.productOperate(getTenantInfo(),id,poiStatus,isSaas); | |||
| } catch (Exception e) { | |||
| logger.error("allTreeList error.",e); | |||
| return new ResultData(Result.ERROR,e.getMessage()); | |||
| @@ -212,9 +255,18 @@ public class TtCouponGoodsController extends DouyinBaseController { | |||
| if (id == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||
| } | |||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponGoodsService.getCouponChannelByCouponId(getTenantInfo(), id); | |||
| if(ttCouponChannelPoi == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"审核数据异常"); | |||
| } | |||
| EnumSpuSyncStatus poiStatus = EnumSpuSyncStatus.getEnum(ttCouponChannelPoi.getStatus()); | |||
| if(poiStatus == null || EnumSpuSyncStatus.sync_auditing.equals(poiStatus) || EnumSpuSyncStatus.sync_audit_rejection.equals(poiStatus)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"审核状态异常"); | |||
| } | |||
| try { | |||
| boolean isSaas = this.isGoodLifeSaas(); | |||
| return ttCouponGoodsService.productStockSync(getTenantInfo(),id,isSaas); | |||
| return ttCouponGoodsService.productStockSync(getTenantInfo(),id,isSaas); | |||
| } catch (Exception e) { | |||
| logger.error("allTreeList error.",e); | |||
| return new ResultData(Result.ERROR,e.getMessage()); | |||
| @@ -100,7 +100,7 @@ public class WxCouponChannelController extends BaseController { | |||
| if(couponChannel!=null){ | |||
| wxCouponChannelService.updateQrCode(couponChannel,couponChannel.getId(),couponChannel.getType()); | |||
| wxCouponChannelService.spuStatusSyncByCoupon(couponChannel,couponChannel.getCouponId()); | |||
| // wxCouponChannelService.spuStatusSyncByCoupon(couponChannel,couponChannel.getCouponId()); | |||
| } | |||
| CouponCacheUtils.removeCouponChannelCache(redisTemplate, wxCouponChannel.getId()); | |||
| CouponCacheUtils.removeDouyinLivePageCache(redisTemplate, wxCouponChannel.getTenantId(), null, null); | |||
| @@ -47,6 +47,8 @@ public class WxCouponController extends BaseController { | |||
| @Autowired | |||
| private WxCouponChannelService wxCouponChannelService; | |||
| @Autowired | |||
| private TtCouponGoodsService ttCouponGoodsService; | |||
| @Autowired | |||
| private WxFlowService wxFlowService; | |||
| @Autowired | |||
| private WxMallService wxMallService; | |||
| @@ -84,7 +84,7 @@ public class WxCouponChannelController extends BaseController { | |||
| if(couponChannel!=null){ | |||
| wxCouponChannelService.updateQrCode(couponChannel,couponChannel.getId(),couponChannel.getType()); | |||
| wxCouponChannelService.spuStatusSyncByCoupon(couponChannel,couponChannel.getCouponId()); | |||
| // wxCouponChannelService.spuStatusSyncByCoupon(couponChannel,couponChannel.getCouponId()); | |||
| } | |||
| CouponCacheUtils.removeCouponChannelCache(redisTemplate, wxCouponChannel.getId()); | |||
| return resultData; | |||
| @@ -74,4 +74,5 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str | |||
| int updateStatusByTargetAd(WxCouponChannel updCC); | |||
| int selectCountExclude(WxCouponChannel ccQ); | |||
| } | |||
| @@ -7,6 +7,7 @@ import com.iformall.domain.po.TtPoiTakeRate; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumCpsPlanType; | |||
| import com.iformall.enums.EnumSpuSyncStatus; | |||
| public interface TtCouponGoodsService { | |||
| @@ -17,6 +18,7 @@ public interface TtCouponGoodsService { | |||
| ResultData productSave(WxCoupon coupon,boolean isSaas) throws Exception; | |||
| TtCouponChannelPoi getCouponChannelBySpuId(String spuId); | |||
| TtCouponChannelPoi getCouponChannelByCouponId(TenantEntity tenantEntity,Long couponId); | |||
| int handlerTtGoodsAudit(TtCouponChannelPoi couponChannelPoi); | |||
| @@ -24,7 +26,7 @@ public interface TtCouponGoodsService { | |||
| ResultData productOnlineGet(TenantEntity tenantEntity,Long id,boolean isSaas); | |||
| ResultData productOperate(TenantEntity tenantInfo, Long id,boolean isSaas); | |||
| ResultData productOperate(TenantEntity tenantInfo, Long couponId, EnumSpuSyncStatus status, boolean isSaas); | |||
| ResultData productStockSync(TenantEntity tenantInfo, Long id,boolean isSaas); | |||
| @@ -436,6 +436,11 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||
| return ttCouponChannelPoiMapper.selectBySpuId(spuId); | |||
| } | |||
| @Override | |||
| public TtCouponChannelPoi getCouponChannelByCouponId(TenantEntity tenantEntity,Long couponId) { | |||
| return ttCouponChannelPoiMapper.selectById(tenantEntity.getTenantId(),couponId); | |||
| } | |||
| @Override | |||
| public int handlerTtGoodsAudit(TtCouponChannelPoi couponChannelPoi) { | |||
| @@ -615,14 +620,35 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||
| ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_put_on.getCode()); | |||
| ttCouponChannelPoi.setUpdateDate(new Date()); | |||
| ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); | |||
| WxCouponChannel couponChannel = new WxCouponChannel(); | |||
| couponChannel.setId(ttCouponChannelPoi.getCouponChannelId()); | |||
| couponChannel.updateTenantInfo(ttCouponChannelPoi); | |||
| couponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||
| couponChannel.setUpdateDate(new Date()); | |||
| wxCouponChannelMapper.updateById(couponChannel); | |||
| }else if(product.getOnlineStatus().intValue() == 2 && !EnumSpuSyncStatus.sync_pull_off.getCode().equals(ttCouponChannelPoi.getStatus())){ | |||
| ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_pull_off.getCode()); | |||
| ttCouponChannelPoi.setUpdateDate(new Date()); | |||
| ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); | |||
| WxCouponChannel couponChannel = new WxCouponChannel(); | |||
| couponChannel.updateTenantInfo(ttCouponChannelPoi); | |||
| couponChannel.setCouponId(ttCouponChannelPoi.getId()); | |||
| couponChannel.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); | |||
| couponChannel.setUpdateDate(new Date()); | |||
| wxCouponChannelMapper.updateStatusByCouponId(couponChannel); | |||
| }else if(product.getOnlineStatus().intValue() == 3 && !EnumSpuSyncStatus.sync_audit_disable.getCode().equals(ttCouponChannelPoi.getStatus())){ | |||
| ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_audit_disable.getCode()); | |||
| ttCouponChannelPoi.setUpdateDate(new Date()); | |||
| ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); | |||
| WxCouponChannel couponChannel = new WxCouponChannel(); | |||
| couponChannel.updateTenantInfo(ttCouponChannelPoi); | |||
| couponChannel.setCouponId(ttCouponChannelPoi.getId()); | |||
| couponChannel.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); | |||
| couponChannel.setUpdateDate(new Date()); | |||
| wxCouponChannelMapper.updateStatusByCouponId(couponChannel); | |||
| } | |||
| return new ResultData(product); | |||
| }else{ | |||
| @@ -637,61 +663,58 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||
| } | |||
| @Override | |||
| public ResultData productOperate(TenantEntity tenantInfo, Long id,boolean isSaas) { | |||
| WxCoupon wxCoupon = wxCouponMapper.selectById(id, tenantInfo.getTenantId()); | |||
| if(wxCoupon == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到"); | |||
| } | |||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),id); | |||
| if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getStatus()) | |||
| || EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getStatus())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); | |||
| @Transactional(rollbackFor = Exception.class) | |||
| public ResultData productOperate(TenantEntity tenantInfo, Long couponId,EnumSpuSyncStatus status,boolean isSaas) { | |||
| Integer op_type = status.getCode(); | |||
| if(!EnumSpuSyncStatus.sync_put_on.getCode().equals(op_type) | |||
| && !EnumSpuSyncStatus.sync_pull_off.getCode().equals(op_type)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"上下架参数异常"); | |||
| } | |||
| //查询上架 | |||
| //op_type int64 TRUE EnumSpuSyncStatus 1-上线 2-下线 | |||
| Integer op_type = EnumSpuSyncStatus.sync_pull_off.getCode(); | |||
| if(!EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wxCoupon.getStatus())){ | |||
| WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); | |||
| wxCouponChannelQuery.updateTenantInfo(wxCoupon); | |||
| wxCouponChannelQuery.setCouponId(wxCoupon.getId()); | |||
| wxCouponChannelQuery.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode()); | |||
| wxCouponChannelQuery.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||
| List<WxCouponChannel> wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); | |||
| if(wxCouponChannels.size() > 0){ | |||
| op_type = EnumSpuSyncStatus.sync_put_on.getCode(); | |||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),couponId); | |||
| if(ttCouponChannelPoi == null || | |||
| (!EnumSpuSyncStatus.sync_put_on.getCode().equals(ttCouponChannelPoi.getStatus()) | |||
| && !EnumSpuSyncStatus.sync_pull_off.getCode().equals(ttCouponChannelPoi.getStatus()))){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券上下架状态异常"); | |||
| } | |||
| if(!op_type.equals(ttCouponChannelPoi.getStatus())){ | |||
| if(EnumSpuSyncStatus.sync_put_on.getCode().equals(op_type)){ | |||
| WxCouponChannel couponChannel = new WxCouponChannel(); | |||
| couponChannel.setId(ttCouponChannelPoi.getCouponChannelId()); | |||
| couponChannel.updateTenantInfo(ttCouponChannelPoi); | |||
| couponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||
| couponChannel.setUpdateDate(new Date()); | |||
| wxCouponChannelMapper.updateById(couponChannel); | |||
| }else{ | |||
| WxCouponChannel couponChannel = new WxCouponChannel(); | |||
| couponChannel.updateTenantInfo(ttCouponChannelPoi); | |||
| couponChannel.setCouponId(ttCouponChannelPoi.getId()); | |||
| couponChannel.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); | |||
| couponChannel.setUpdateDate(new Date()); | |||
| wxCouponChannelMapper.updateStatusByCouponId(couponChannel); | |||
| } | |||
| } | |||
| if(op_type.equals(ttCouponChannelPoi.getStatus())){ | |||
| logger.info("与线上状态一致, 无需同步{}"+wxCoupon.getId()); | |||
| return new ResultData(); | |||
| } | |||
| try { | |||
| boolean b = false; | |||
| if (isSaas) { | |||
| b = ttMerchantPoiService.getTtGoodLifeSassService(ttCouponChannelPoi).getGoodsService().productOperate(getDouyinLaikeId(wxCoupon),null,wxCoupon.getId().toString(),op_type); | |||
| b = ttMerchantPoiService.getTtGoodLifeSassService(tenantInfo).getGoodsService().productOperate(getDouyinLaikeId(tenantInfo),null,ttCouponChannelPoi.getId().toString(),op_type); | |||
| }else { | |||
| b = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi).getGoodsService().productOperate(null,wxCoupon.getId().toString(),op_type); | |||
| b = ttMerchantPoiService.getTtWebService(tenantInfo).getGoodsService().productOperate(null,ttCouponChannelPoi.getId().toString(),op_type); | |||
| } | |||
| if(b){ | |||
| TtCouponChannelPoi ccPoi = new TtCouponChannelPoi(); | |||
| ccPoi.setId(ttCouponChannelPoi.getId()); | |||
| ccPoi.updateTenantInfo(ttCouponChannelPoi); | |||
| ccPoi.setStatus(op_type); | |||
| ccPoi.setUpdateDate(new Date()); | |||
| ttCouponChannelPoiMapper.updateById(ccPoi); | |||
| return new ResultData(); | |||
| }else{ | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); | |||
| // return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); | |||
| } | |||
| } catch (WxErrorException e) { | |||
| e.printStackTrace(); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getError().getErrorMsg()); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getError().getErrorMsg()); | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getError().getErrorMsg()); | |||
| } catch (Exception e) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage()); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage()); | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage()); | |||
| } | |||
| } | |||
| @@ -701,17 +724,17 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||
| if(wxCoupon == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到"); | |||
| } | |||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),id); | |||
| if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getStatus()) | |||
| || EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getStatus())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); | |||
| } | |||
| // TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),id); | |||
| // if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getStatus()) | |||
| // || EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getStatus())){ | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); | |||
| // } | |||
| try { | |||
| boolean b = false; | |||
| if (isSaas) { | |||
| b = ttMerchantPoiService.getTtGoodLifeSassService(ttCouponChannelPoi).getGoodsService().stockSync(getDouyinLaikeId(ttCouponChannelPoi),null,wxCoupon.getId().toString(),wxCoupon.getInventory()); | |||
| b = ttMerchantPoiService.getTtGoodLifeSassService(tenantInfo).getGoodsService().stockSync(getDouyinLaikeId(tenantInfo),null,wxCoupon.getId().toString(),wxCoupon.getInventory()); | |||
| } else { | |||
| b = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi).getGoodsService().stockSync(null,wxCoupon.getId().toString(),wxCoupon.getInventory()); | |||
| b = ttMerchantPoiService.getTtWebService(tenantInfo).getGoodsService().stockSync(null,wxCoupon.getId().toString(),wxCoupon.getInventory()); | |||
| } | |||
| if(b){ | |||
| return new ResultData(); | |||
| @@ -733,18 +756,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||
| if(wxCoupon == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到"); | |||
| } | |||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),id); | |||
| if(ttCouponChannelPoi == null || EnumSpuSyncStatus.sync_auditing.getCode().equals(ttCouponChannelPoi.getStatus()) | |||
| || EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getStatus())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); | |||
| } | |||
| try { | |||
| boolean b = false; | |||
| if (isSaas) { | |||
| b = ttMerchantPoiService.getTtGoodLifeSassService(ttCouponChannelPoi).getGoodsService().productFreeAudit(getDouyinLaikeId(ttCouponChannelPoi),null,wxCoupon.getId().toString(), | |||
| b = ttMerchantPoiService.getTtGoodLifeSassService(tenantInfo).getGoodsService().productFreeAudit(getDouyinLaikeId(tenantInfo),null,wxCoupon.getId().toString(), | |||
| null,wxCoupon.getInventory()); | |||
| }else { | |||
| b = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi).getGoodsService().productFreeAudit(null,wxCoupon.getId().toString(), | |||
| b = ttMerchantPoiService.getTtWebService(tenantInfo).getGoodsService().productFreeAudit(null,wxCoupon.getId().toString(), | |||
| null,wxCoupon.getInventory()); | |||
| } | |||
| @@ -284,7 +284,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||
| wxCouponChannel.setUpdateDate(new Date()); | |||
| wxCouponChannelMapper.updateById(wxCouponChannel); | |||
| wxCouponChannelService.spuStatusSyncByCoupon(wxCouponChannel,wxCouponChannel.getCouponId()); | |||
| // wxCouponChannelService.spuStatusSyncByCoupon(wxCouponChannel,wxCouponChannel.getCouponId()); | |||
| } | |||
| } | |||
| } | |||
| @@ -382,7 +382,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||
| wxCouponChannelService.updateQrCode(wxCouponChannel,wxCouponChannel.getId(),wxCouponChannel.getType()); | |||
| } | |||
| wxCouponChannelService.spuStatusSyncByCoupon(wxCouponChannel,couponId); | |||
| // wxCouponChannelService.spuStatusSyncByCoupon(wxCouponChannel,couponId); | |||
| } | |||
| @Override | |||
| @@ -765,7 +765,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| this.updateQrCode(channel,channel.getId(),channel.getType()); | |||
| this.spuStatusSyncByCoupon(channel,channel.getCouponId()); | |||
| // this.spuStatusSyncByCoupon(channel,channel.getCouponId()); | |||
| } | |||
| return vo; | |||
| } | |||
| @@ -1,10 +1,16 @@ | |||
| package com.iformall.service.msg.impl; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.TtCouponChannelPoi; | |||
| import com.iformall.domain.po.WxMallVersion; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.msg.BaseMsg; | |||
| import com.iformall.domain.po.msg.FmInsideProductPushMsg; | |||
| import com.iformall.enums.EnumDouyinApplicationVersion; | |||
| import com.iformall.enums.EnumPushType; | |||
| import com.iformall.enums.EnumSpuSyncStatus; | |||
| import com.iformall.mapper.TtCouponChannelPoiMapper; | |||
| import com.iformall.service.TtCouponGoodsService; | |||
| import com.iformall.service.TtGoodsCategoryService; | |||
| import com.iformall.service.TtMerchantPoiService; | |||
| @@ -34,24 +40,40 @@ public class FmInsideProductPushMsgServiceImpl implements MsgSendService { | |||
| @Autowired | |||
| private WxMallService wxMallService; | |||
| @Autowired | |||
| private TtCouponChannelPoiMapper ttCouponChannelPoiMapper; | |||
| @Override | |||
| public void send(BaseMsg baseMsg) throws Exception{ | |||
| FmInsideProductPushMsg msg = (FmInsideProductPushMsg)baseMsg; | |||
| TenantEntity tenantInfo = msg.getTenantInfo(); | |||
| try{ | |||
| Thread.currentThread().sleep(1000);//延时秒 | |||
| }catch(Exception e){} | |||
| EnumDouyinApplicationVersion douyinApplicationVersion = wxMallService.getDouyinApplicationVersion(msg.getTenantInfo()); | |||
| EnumDouyinApplicationVersion douyinApplicationVersion = wxMallService.getDouyinApplicationVersion(tenantInfo); | |||
| boolean isSaas = EnumDouyinApplicationVersion.GOODLIFE_SAAS.equals(douyinApplicationVersion); | |||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),msg.getCouponId()); | |||
| if(ttCouponChannelPoi == null){ | |||
| logger.error("处理抖音商品同步数据异常(审核数据为空){}"+tenantInfo.getTenantId()+"--"+msg.getCouponId()); | |||
| return; | |||
| } | |||
| EnumSpuSyncStatus poiStatus = EnumSpuSyncStatus.getEnum(ttCouponChannelPoi.getStatus()); | |||
| if(poiStatus == null || EnumSpuSyncStatus.sync_auditing.equals(poiStatus) || EnumSpuSyncStatus.sync_audit_rejection.equals(poiStatus)){ | |||
| logger.error("处理抖音商品同步数据异常(状态异常){}"+tenantInfo.getTenantId()+"--"+msg.getCouponId()); | |||
| return; | |||
| } | |||
| if(EnumPushType.SPU_STATUS_SYNC.equals(msg.getSyncType())){ | |||
| ttCouponGoodsService.productOperate(msg.getTenantInfo(),msg.getCouponId(),isSaas); | |||
| ttCouponGoodsService.productOperate(tenantInfo,ttCouponChannelPoi,msg.getCouponId(),poiStatus,isSaas); | |||
| // poiService.spuStatusSync(msg.getTenantInfo(),msg.getCouponId()); | |||
| }else if(EnumPushType.SPU_STOCK_SYNC.equals(msg.getSyncType())){ | |||
| ttCouponGoodsService.productStockSync(msg.getTenantInfo(),msg.getCouponId(),isSaas); | |||
| ttCouponGoodsService.productStockSync(tenantInfo,msg.getCouponId(),isSaas); | |||
| // poiService.spuStockSync(msg.getTenantInfo(),msg.getCouponId()); | |||
| }else if(EnumPushType.SPU_FREE_AUDIT_SYNC.equals(msg.getSyncType())){ | |||
| ttCouponGoodsService.productFreeAudit(msg.getTenantInfo(),msg.getCouponId(),isSaas); | |||
| ttCouponGoodsService.productFreeAudit(tenantInfo,msg.getCouponId(),isSaas); | |||
| } | |||
| } | |||