|
|
|
@@ -156,7 +156,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
wxCouponChannel.setShowBeginTime(new Date()); |
|
|
|
wxCouponChannel.setBeginTime(new Date()); |
|
|
|
wxCouponChannel.setEndTime(coupon.getValidEndDate()); |
|
|
|
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_AFTER.getCode()); |
|
|
|
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode()); |
|
|
|
wxCouponChannel.setCouponId(coupon.getId()); |
|
|
|
wxCouponChannel.setType(coupon.getType()); |
|
|
|
wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode()); |
|
|
|
@@ -221,7 +221,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
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(),"该商品未提交审核"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该券未提交审核"); |
|
|
|
} |
|
|
|
try { |
|
|
|
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); |
|
|
|
@@ -255,7 +255,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
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(),"该商品未提交审核"); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该券未提交审核"); |
|
|
|
} |
|
|
|
try { |
|
|
|
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); |
|
|
|
@@ -285,6 +285,69 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData productOperate(TenantEntity tenantInfo, Long id) { |
|
|
|
WxCoupon wxCoupon = wxCouponMapper.selectById(id, tenantInfo.getTenantId()); |
|
|
|
if(wxCoupon == null || EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wxCoupon.getStatus())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到或已作废"); |
|
|
|
} |
|
|
|
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),id); |
|
|
|
if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); |
|
|
|
} |
|
|
|
//查询上架 |
|
|
|
//op_type int64 TRUE 1-上线 2-下线 |
|
|
|
Integer op_type = 2; |
|
|
|
WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); |
|
|
|
wxCouponChannelQuery.updateTenantInfo(wxCoupon); |
|
|
|
wxCouponChannelQuery.setCouponId(wxCoupon.getId()); |
|
|
|
wxCouponChannelQuery.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode()); |
|
|
|
wxCouponChannelQuery.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); |
|
|
|
List<WxCouponChannel> wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); |
|
|
|
if(wxCouponChannels.size() > 0){ |
|
|
|
op_type = 1; |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); |
|
|
|
boolean b = ttWebService.getGoodsService().productOperate(null,wxCoupon.getId().toString(),op_type); |
|
|
|
if(b){ |
|
|
|
return new ResultData(); |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); |
|
|
|
} |
|
|
|
|
|
|
|
} catch (WxErrorException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData productStockSync(TenantEntity tenantInfo, Long id) { |
|
|
|
WxCoupon wxCoupon = wxCouponMapper.selectById(id, tenantInfo.getTenantId()); |
|
|
|
if(wxCoupon == null || EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wxCoupon.getStatus())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到或已作废"); |
|
|
|
} |
|
|
|
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),id); |
|
|
|
if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); |
|
|
|
} |
|
|
|
try { |
|
|
|
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); |
|
|
|
boolean b = ttWebService.getGoodsService().stockSync(null,wxCoupon.getId().toString(),wxCoupon.getInventory()); |
|
|
|
if(b){ |
|
|
|
return new ResultData(); |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); |
|
|
|
} |
|
|
|
|
|
|
|
} catch (WxErrorException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void syncCouponChannelPoi(WxCoupon coupon,Long couponChannelId,String productId){ |
|
|
|
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(coupon.getTenantId(),coupon.getId()); |
|
|
|
Date date = new Date(); |
|
|
|
|