|
|
@@ -34,6 +34,7 @@ import org.springframework.transaction.annotation.Propagation; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
@@ -453,6 +454,10 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
if(ttCouponChannelPoi == null){ |
|
|
if(ttCouponChannelPoi == null){ |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该券未提交审核"); |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该券未提交审核"); |
|
|
} |
|
|
} |
|
|
|
|
|
// WxCoupon onlineCoupon = wxCouponMapper.selectOnlineCoupon(id,tenantEntity.getTenantId()); |
|
|
|
|
|
// if(onlineCoupon == null){ |
|
|
|
|
|
// return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"该券未找到"); |
|
|
|
|
|
// } |
|
|
try { |
|
|
try { |
|
|
List<Product> products = null; |
|
|
List<Product> products = null; |
|
|
if (isSaas) { |
|
|
if (isSaas) { |
|
|
@@ -463,51 +468,50 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
|
|
|
|
|
if(null != products && products.size() > 0){ |
|
|
if(null != products && products.size() > 0){ |
|
|
Product product = products.get(0); |
|
|
Product product = products.get(0); |
|
|
|
|
|
Integer draftStatus = product.getDraftStatus(); |
|
|
|
|
|
Integer auditing = null; |
|
|
|
|
|
if(draftStatus.intValue() == 12){//审核失败 |
|
|
|
|
|
auditing = EnumSpuSyncStatus.sync_audit_rejection.getCode(); |
|
|
|
|
|
}else if(draftStatus.intValue() == 1){//审核通过 |
|
|
|
|
|
auditing = EnumSpuSyncStatus.sync_audit_pass.getCode(); |
|
|
|
|
|
} |
|
|
|
|
|
if(auditing == null){ |
|
|
|
|
|
return new ResultData(product); |
|
|
|
|
|
} |
|
|
|
|
|
Date now = new Date(); |
|
|
|
|
|
|
|
|
//判断是否存在草稿数据 |
|
|
//判断是否存在草稿数据 |
|
|
WxCoupon draftCoupon = wxCouponMapper.selectDraftCoupon(id,tenantEntity.getTenantId()); |
|
|
WxCoupon draftCoupon = wxCouponMapper.selectDraftCoupon(id,tenantEntity.getTenantId()); |
|
|
if(draftCoupon == null){ |
|
|
|
|
|
if(product.getDraftStatus().intValue() == 12 && !EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getStatus())){ |
|
|
|
|
|
ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_audit_rejection.getCode()); |
|
|
|
|
|
|
|
|
if(draftCoupon == null) { |
|
|
|
|
|
if (!auditing.equals(ttCouponChannelPoi.getStatus())) { |
|
|
|
|
|
ttCouponChannelPoi.setStatus(auditing); |
|
|
ttCouponChannelPoi.setStatusDesc(product.getAuditMsg()); |
|
|
ttCouponChannelPoi.setStatusDesc(product.getAuditMsg()); |
|
|
ttCouponChannelPoi.setUpdateDate(new Date()); |
|
|
|
|
|
|
|
|
ttCouponChannelPoi.setUpdateDate(now); |
|
|
ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); |
|
|
ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); |
|
|
}else if(product.getDraftStatus().intValue() == 1 && !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getStatus())){ |
|
|
|
|
|
//审核通过即上线 |
|
|
|
|
|
ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_put_on.getCode()); |
|
|
|
|
|
ttCouponChannelPoi.setStatusDesc(""); |
|
|
|
|
|
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{ |
|
|
}else{ |
|
|
TtCouponChannelPoi ttDraftCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantEntity.getTenantId(),draftCoupon.getId()); |
|
|
TtCouponChannelPoi ttDraftCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantEntity.getTenantId(),draftCoupon.getId()); |
|
|
if(ttDraftCouponChannelPoi == null){ |
|
|
if(ttDraftCouponChannelPoi == null){ |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"草稿数据异常"); |
|
|
|
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"草稿审核数据异常"); |
|
|
} |
|
|
} |
|
|
if(product.getDraftStatus().intValue() == 12 && !EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttDraftCouponChannelPoi.getStatus())){ |
|
|
|
|
|
ttDraftCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_audit_rejection.getCode()); |
|
|
|
|
|
|
|
|
if(!auditing.equals(ttDraftCouponChannelPoi.getStatus())){ |
|
|
|
|
|
ttDraftCouponChannelPoi.setStatus(auditing); |
|
|
ttDraftCouponChannelPoi.setStatusDesc(product.getAuditMsg()); |
|
|
ttDraftCouponChannelPoi.setStatusDesc(product.getAuditMsg()); |
|
|
ttDraftCouponChannelPoi.setUpdateDate(new Date()); |
|
|
|
|
|
|
|
|
ttDraftCouponChannelPoi.setUpdateDate(now); |
|
|
ttCouponChannelPoiMapper.updateById(ttDraftCouponChannelPoi); |
|
|
ttCouponChannelPoiMapper.updateById(ttDraftCouponChannelPoi); |
|
|
}else if(product.getDraftStatus().intValue() == 1 && !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttDraftCouponChannelPoi.getStatus())){ |
|
|
|
|
|
//审核通过即上线,商品数据同步 |
|
|
|
|
|
WxCoupon wxCoupon = new WxCoupon(); |
|
|
|
|
|
BeanUtils.copyProperties(wxCoupon,draftCoupon); |
|
|
|
|
|
wxCoupon.setId(draftCoupon.getCouponId()); |
|
|
|
|
|
wxCoupon.setVersion(null); |
|
|
|
|
|
wxCoupon.setRemainInventory(null); |
|
|
|
|
|
wxCoupon.setInventory(null); |
|
|
|
|
|
wxCoupon.setUpdateDate(new Date()); |
|
|
|
|
|
wxCouponMapper.updateById(wxCoupon); |
|
|
|
|
|
//商场数据同步 |
|
|
|
|
|
//商户数据同步 |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(EnumSpuSyncStatus.sync_audit_pass.getCode().equals(auditing)){ |
|
|
|
|
|
//商品数据同步 |
|
|
|
|
|
WxCoupon onlineCoupon = new WxCoupon(); |
|
|
|
|
|
BeanUtils.copyProperties(onlineCoupon,draftCoupon); |
|
|
|
|
|
onlineCoupon.setId(draftCoupon.getCouponId()); |
|
|
|
|
|
onlineCoupon.setVersion(null); |
|
|
|
|
|
onlineCoupon.setRemainInventory(null); |
|
|
|
|
|
onlineCoupon.setInventory(null); |
|
|
|
|
|
onlineCoupon.setUpdateDate(now); |
|
|
|
|
|
wxCouponMapper.updateById(onlineCoupon); |
|
|
|
|
|
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
if (EnumCouponType.isParentCoupon(draftCoupon.getType())) { |
|
|
if (EnumCouponType.isParentCoupon(draftCoupon.getType())) { |
|
|
WxCouponMall couponMall = new WxCouponMall(); |
|
|
WxCouponMall couponMall = new WxCouponMall(); |
|
|
@@ -549,48 +553,9 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ttDraftCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_audit_pass.getCode()); |
|
|
|
|
|
ttDraftCouponChannelPoi.setStatusDesc(""); |
|
|
|
|
|
ttDraftCouponChannelPoi.setUpdateDate(new Date()); |
|
|
|
|
|
ttCouponChannelPoiMapper.updateById(ttDraftCouponChannelPoi); |
|
|
|
|
|
|
|
|
|
|
|
//审核通过即上线 |
|
|
|
|
|
ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_put_on.getCode()); |
|
|
|
|
|
ttCouponChannelPoi.setStatusDesc(""); |
|
|
|
|
|
ttCouponChannelPoi.setUpdateDate(new Date()); |
|
|
|
|
|
ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); |
|
|
|
|
|
|
|
|
|
|
|
Date now = new Date(); |
|
|
|
|
|
Date showBeginTime = now; |
|
|
|
|
|
Date beginTime = null; |
|
|
|
|
|
Date endTime = null; |
|
|
|
|
|
if(wxCoupon.getSoldStartTime() != null && wxCoupon.getSoldEndTime() != null){ |
|
|
|
|
|
beginTime = wxCoupon.getSoldStartTime(); |
|
|
|
|
|
endTime = wxCoupon.getSoldEndTime(); |
|
|
|
|
|
}else{ |
|
|
|
|
|
beginTime = showBeginTime; |
|
|
|
|
|
endTime = wxCoupon.getValidEndDate(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WxCouponChannel couponChannel = new WxCouponChannel(); |
|
|
|
|
|
couponChannel.setId(ttCouponChannelPoi.getCouponChannelId()); |
|
|
|
|
|
couponChannel.updateTenantInfo(ttCouponChannelPoi); |
|
|
|
|
|
couponChannel.setShowBeginTime(showBeginTime); |
|
|
|
|
|
couponChannel.setBeginTime(beginTime); |
|
|
|
|
|
couponChannel.setEndTime(endTime); |
|
|
|
|
|
couponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); |
|
|
|
|
|
couponChannel.setCouponId(wxCoupon.getId()); |
|
|
|
|
|
couponChannel.setMakeMerchantId(wxCoupon.getMakeMerchantId()); |
|
|
|
|
|
couponChannel.setType(wxCoupon.getType()); |
|
|
|
|
|
couponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN.getCode()); |
|
|
|
|
|
couponChannel.setBusiness(wxCoupon.getBusiness()); |
|
|
|
|
|
couponChannel.setSubBusiness(wxCoupon.getSubBusiness()); |
|
|
|
|
|
couponChannel.setTitle(wxCoupon.getTitle()); |
|
|
|
|
|
couponChannel.setUpdateDate(now); |
|
|
|
|
|
wxCouponChannelMapper.updateById(couponChannel); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//审核通过即上架 |
|
|
|
|
|
handlePullOn(ttCouponChannelPoi,now); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return new ResultData(product); |
|
|
return new ResultData(product); |
|
|
@@ -605,6 +570,88 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void handlePullOn(TtCouponChannelPoi ttCouponChannelPoi,Date now){ |
|
|
|
|
|
WxCoupon wxCoupon = wxCouponMapper.selectOnlineCoupon(ttCouponChannelPoi.getId(),ttCouponChannelPoi.getTenantId()); |
|
|
|
|
|
if(wxCoupon == null){ |
|
|
|
|
|
throw new MallinkException(ErrorCode.COUPON_IS_EMPTY.getCode(),"该券未找到"); |
|
|
|
|
|
} |
|
|
|
|
|
if(!EnumCouponVersion.online.getCode().equals(wxCoupon.getVersion())){ |
|
|
|
|
|
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"上架券参数异常"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TtCouponChannelPoi couponChannelPoiUpd = new TtCouponChannelPoi(); |
|
|
|
|
|
couponChannelPoiUpd.setId(ttCouponChannelPoi.getId()); |
|
|
|
|
|
couponChannelPoiUpd.updateTenantInfo(ttCouponChannelPoi); |
|
|
|
|
|
couponChannelPoiUpd.setStatus(EnumSpuSyncStatus.sync_put_on.getCode()); |
|
|
|
|
|
couponChannelPoiUpd.setStatusDesc(""); |
|
|
|
|
|
couponChannelPoiUpd.setUpdateDate(now); |
|
|
|
|
|
ttCouponChannelPoiMapper.updateById(couponChannelPoiUpd); |
|
|
|
|
|
|
|
|
|
|
|
WxCouponChannel couponChannel = new WxCouponChannel(); |
|
|
|
|
|
couponChannel.setId(ttCouponChannelPoi.getCouponChannelId()); |
|
|
|
|
|
couponChannel.updateTenantInfo(ttCouponChannelPoi); |
|
|
|
|
|
couponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); |
|
|
|
|
|
couponChannel.setUpdateDate(now); |
|
|
|
|
|
wxCouponChannelMapper.updateById(couponChannel); |
|
|
|
|
|
|
|
|
|
|
|
//修改投放数据 |
|
|
|
|
|
WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); |
|
|
|
|
|
wxCouponChannelQuery.updateTenantInfo(wxCoupon); |
|
|
|
|
|
wxCouponChannelQuery.setCouponId(wxCoupon.getId()); |
|
|
|
|
|
wxCouponChannelQuery.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); |
|
|
|
|
|
List<WxCouponChannel> wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); |
|
|
|
|
|
|
|
|
|
|
|
boolean addDouyiList = true; |
|
|
|
|
|
|
|
|
|
|
|
Date showBeginTime = now; |
|
|
|
|
|
Date beginTime = null; |
|
|
|
|
|
Date endTime = null; |
|
|
|
|
|
if(wxCoupon.getSoldStartTime() != null && wxCoupon.getSoldEndTime() != null){ |
|
|
|
|
|
beginTime = wxCoupon.getSoldStartTime(); |
|
|
|
|
|
endTime = wxCoupon.getSoldEndTime(); |
|
|
|
|
|
}else{ |
|
|
|
|
|
beginTime = showBeginTime; |
|
|
|
|
|
endTime = wxCoupon.getValidEndDate(); |
|
|
|
|
|
} |
|
|
|
|
|
for (WxCouponChannel couponChannelUpd:wxCouponChannels) { |
|
|
|
|
|
if(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode().equals(couponChannelUpd.getTargetAd())){ |
|
|
|
|
|
addDouyiList = false; |
|
|
|
|
|
} |
|
|
|
|
|
couponChannelUpd.setShowBeginTime(showBeginTime); |
|
|
|
|
|
couponChannelUpd.setBeginTime(beginTime); |
|
|
|
|
|
couponChannelUpd.setEndTime(endTime); |
|
|
|
|
|
couponChannelUpd.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); |
|
|
|
|
|
couponChannelUpd.setMakeMerchantId(wxCoupon.getMakeMerchantId()); |
|
|
|
|
|
couponChannelUpd.setType(wxCoupon.getType()); |
|
|
|
|
|
couponChannelUpd.setBusiness(wxCoupon.getBusiness()); |
|
|
|
|
|
couponChannelUpd.setSubBusiness(wxCoupon.getSubBusiness()); |
|
|
|
|
|
couponChannelUpd.setTitle(wxCoupon.getTitle()); |
|
|
|
|
|
couponChannelUpd.setUpdateDate(now); |
|
|
|
|
|
wxCouponChannelMapper.updateById(couponChannelUpd); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(addDouyiList){ |
|
|
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
|
|
WxCouponChannel addCouponChannel = new WxCouponChannel(); |
|
|
|
|
|
addCouponChannel.setId(idWorker.nextId()); |
|
|
|
|
|
addCouponChannel.updateTenantInfo(wxCoupon); |
|
|
|
|
|
addCouponChannel.setShowBeginTime(showBeginTime); |
|
|
|
|
|
addCouponChannel.setBeginTime(beginTime); |
|
|
|
|
|
addCouponChannel.setEndTime(endTime); |
|
|
|
|
|
addCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); |
|
|
|
|
|
addCouponChannel.setCouponId(wxCoupon.getId()); |
|
|
|
|
|
addCouponChannel.setMakeMerchantId(wxCoupon.getMakeMerchantId()); |
|
|
|
|
|
addCouponChannel.setType(wxCoupon.getType()); |
|
|
|
|
|
addCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode()); |
|
|
|
|
|
addCouponChannel.setBusiness(wxCoupon.getBusiness()); |
|
|
|
|
|
addCouponChannel.setSubBusiness(wxCoupon.getSubBusiness()); |
|
|
|
|
|
addCouponChannel.setTitle(wxCoupon.getTitle()); |
|
|
|
|
|
addCouponChannel.setTtSpuId(wxCoupon.getGoodsId()); |
|
|
|
|
|
wxCouponChannelMapper.insert(addCouponChannel); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public ResultData productOnlineGet(TenantEntity tenantEntity,Long id,boolean isSaas) { |
|
|
public ResultData productOnlineGet(TenantEntity tenantEntity,Long id,boolean isSaas) { |
|
|
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantEntity.getTenantId(),id); |
|
|
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantEntity.getTenantId(),id); |
|
|
@@ -621,17 +668,13 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
|
|
|
|
|
if(products.size() > 0){ |
|
|
if(products.size() > 0){ |
|
|
Product product = products.get(0); |
|
|
Product product = products.get(0); |
|
|
|
|
|
Date now = new Date(); |
|
|
if(product.getOnlineStatus().intValue() == 1 && !EnumSpuSyncStatus.sync_put_on.getCode().equals(ttCouponChannelPoi.getStatus())){ |
|
|
if(product.getOnlineStatus().intValue() == 1 && !EnumSpuSyncStatus.sync_put_on.getCode().equals(ttCouponChannelPoi.getStatus())){ |
|
|
ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_put_on.getCode()); |
|
|
ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_put_on.getCode()); |
|
|
ttCouponChannelPoi.setUpdateDate(new Date()); |
|
|
|
|
|
|
|
|
ttCouponChannelPoi.setUpdateDate(now); |
|
|
ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); |
|
|
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); |
|
|
|
|
|
|
|
|
handlePullOn(ttCouponChannelPoi,now); |
|
|
}else if(product.getOnlineStatus().intValue() == 2 && !EnumSpuSyncStatus.sync_pull_off.getCode().equals(ttCouponChannelPoi.getStatus())){ |
|
|
}else if(product.getOnlineStatus().intValue() == 2 && !EnumSpuSyncStatus.sync_pull_off.getCode().equals(ttCouponChannelPoi.getStatus())){ |
|
|
ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_pull_off.getCode()); |
|
|
ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_pull_off.getCode()); |
|
|
ttCouponChannelPoi.setUpdateDate(new Date()); |
|
|
ttCouponChannelPoi.setUpdateDate(new Date()); |
|
|
@@ -641,7 +684,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
couponChannel.updateTenantInfo(ttCouponChannelPoi); |
|
|
couponChannel.updateTenantInfo(ttCouponChannelPoi); |
|
|
couponChannel.setCouponId(ttCouponChannelPoi.getId()); |
|
|
couponChannel.setCouponId(ttCouponChannelPoi.getId()); |
|
|
couponChannel.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); |
|
|
couponChannel.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); |
|
|
couponChannel.setUpdateDate(new Date()); |
|
|
|
|
|
|
|
|
couponChannel.setUpdateDate(now); |
|
|
wxCouponChannelMapper.updateStatusByCouponId(couponChannel); |
|
|
wxCouponChannelMapper.updateStatusByCouponId(couponChannel); |
|
|
}else if(product.getOnlineStatus().intValue() == 3 && !EnumSpuSyncStatus.sync_audit_disable.getCode().equals(ttCouponChannelPoi.getStatus())){ |
|
|
}else if(product.getOnlineStatus().intValue() == 3 && !EnumSpuSyncStatus.sync_audit_disable.getCode().equals(ttCouponChannelPoi.getStatus())){ |
|
|
ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_audit_disable.getCode()); |
|
|
ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_audit_disable.getCode()); |
|
|
@@ -652,7 +695,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
couponChannel.updateTenantInfo(ttCouponChannelPoi); |
|
|
couponChannel.updateTenantInfo(ttCouponChannelPoi); |
|
|
couponChannel.setCouponId(ttCouponChannelPoi.getId()); |
|
|
couponChannel.setCouponId(ttCouponChannelPoi.getId()); |
|
|
couponChannel.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); |
|
|
couponChannel.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); |
|
|
couponChannel.setUpdateDate(new Date()); |
|
|
|
|
|
|
|
|
couponChannel.setUpdateDate(now); |
|
|
wxCouponChannelMapper.updateStatusByCouponId(couponChannel); |
|
|
wxCouponChannelMapper.updateStatusByCouponId(couponChannel); |
|
|
} |
|
|
} |
|
|
return new ResultData(product); |
|
|
return new ResultData(product); |
|
|
@@ -681,29 +724,6 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
&& !EnumSpuSyncStatus.sync_pull_off.getCode().equals(ttCouponChannelPoi.getStatus()))){ |
|
|
&& !EnumSpuSyncStatus.sync_pull_off.getCode().equals(ttCouponChannelPoi.getStatus()))){ |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券上下架状态异常"); |
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
TtCouponChannelPoi ccPoi = new TtCouponChannelPoi(); |
|
|
|
|
|
ccPoi.setId(ttCouponChannelPoi.getId()); |
|
|
|
|
|
ccPoi.updateTenantInfo(ttCouponChannelPoi); |
|
|
|
|
|
ccPoi.setStatus(op_type); |
|
|
|
|
|
ccPoi.setUpdateDate(new Date()); |
|
|
|
|
|
ttCouponChannelPoiMapper.updateById(ccPoi); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
boolean b = false; |
|
|
boolean b = false; |
|
|
@@ -714,6 +734,33 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(b){ |
|
|
if(b){ |
|
|
|
|
|
if(!op_type.equals(ttCouponChannelPoi.getStatus())){ |
|
|
|
|
|
Date now = new Date(); |
|
|
|
|
|
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); |
|
|
|
|
|
handlePullOn(ttCouponChannelPoi,now); |
|
|
|
|
|
}else{ |
|
|
|
|
|
TtCouponChannelPoi ccPoi = new TtCouponChannelPoi(); |
|
|
|
|
|
ccPoi.setId(ttCouponChannelPoi.getId()); |
|
|
|
|
|
ccPoi.updateTenantInfo(ttCouponChannelPoi); |
|
|
|
|
|
ccPoi.setStatus(op_type); |
|
|
|
|
|
ccPoi.setUpdateDate(now); |
|
|
|
|
|
ttCouponChannelPoiMapper.updateById(ccPoi); |
|
|
|
|
|
|
|
|
|
|
|
WxCouponChannel couponChannel = new WxCouponChannel(); |
|
|
|
|
|
couponChannel.updateTenantInfo(ttCouponChannelPoi); |
|
|
|
|
|
couponChannel.setCouponId(ttCouponChannelPoi.getId()); |
|
|
|
|
|
couponChannel.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); |
|
|
|
|
|
couponChannel.setUpdateDate(now); |
|
|
|
|
|
wxCouponChannelMapper.updateStatusByCouponId(couponChannel); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
return new ResultData(); |
|
|
return new ResultData(); |
|
|
}else{ |
|
|
}else{ |
|
|
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); |
|
|
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); |
|
|
|