|
|
@@ -1356,6 +1356,74 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
return ttCouponChannelPoiMapper.updateBySpuId(couponChannelPoi); |
|
|
return ttCouponChannelPoiMapper.updateBySpuId(couponChannelPoi); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public ResultData productDraftGet(Long id) { |
|
|
|
|
|
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(id); |
|
|
|
|
|
if(ttCouponChannelPoi == null){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该商品未提交审核"); |
|
|
|
|
|
} |
|
|
|
|
|
try { |
|
|
|
|
|
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); |
|
|
|
|
|
List<Product> products = ttWebService.getGoodsService().productDraftGet(null, ttCouponChannelPoi.getId().toString()); |
|
|
|
|
|
if(products.size() > 0){ |
|
|
|
|
|
Product product = products.get(0); |
|
|
|
|
|
if(product.getDraftStatus().intValue() == 12 && !EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ |
|
|
|
|
|
ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_audit_rejection.getCode()); |
|
|
|
|
|
ttCouponChannelPoi.setLastStatusDesc(product.getAuditMsg()); |
|
|
|
|
|
ttCouponChannelPoi.setUpdateDate(new Date()); |
|
|
|
|
|
ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); |
|
|
|
|
|
|
|
|
|
|
|
}else if(product.getDraftStatus().intValue() == 1 && !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){ |
|
|
|
|
|
ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_audit_pass.getCode()); |
|
|
|
|
|
ttCouponChannelPoi.setLastStatusDesc(""); |
|
|
|
|
|
ttCouponChannelPoi.setUpdateDate(new Date()); |
|
|
|
|
|
ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new ResultData(product); |
|
|
|
|
|
}else{ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到审核数据"); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (WxErrorException e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public ResultData productOnlineGet(Long id) { |
|
|
|
|
|
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(id); |
|
|
|
|
|
if(ttCouponChannelPoi == null){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该商品未提交审核"); |
|
|
|
|
|
} |
|
|
|
|
|
try { |
|
|
|
|
|
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); |
|
|
|
|
|
List<Product> products = ttWebService.getGoodsService().productOnlineGet(null, ttCouponChannelPoi.getId().toString()); |
|
|
|
|
|
if(products.size() > 0){ |
|
|
|
|
|
Product product = products.get(0); |
|
|
|
|
|
if(product.getOnlineStatus().intValue() == 1 && !EnumSpuSyncStatus.sync_put_on.getCode().equals(ttCouponChannelPoi.getStatus())){ |
|
|
|
|
|
ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_put_on.getCode()); |
|
|
|
|
|
ttCouponChannelPoi.setUpdateDate(new Date()); |
|
|
|
|
|
ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); |
|
|
|
|
|
}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); |
|
|
|
|
|
}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); |
|
|
|
|
|
} |
|
|
|
|
|
return new ResultData(product); |
|
|
|
|
|
}else{ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_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){ |
|
|
private void syncCouponChannelPoi(WxCoupon coupon,Long couponChannelId,String productId){ |
|
|
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(coupon.getId()); |
|
|
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(coupon.getId()); |
|
|
Date date = new Date(); |
|
|
Date date = new Date(); |
|
|
|