|
|
@@ -61,8 +61,6 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
@Autowired |
|
|
|
TtMerchantPoiMapper ttMerchantPoiMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private TtMerchantPoiService ttMerchantPoiService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
TtCouponChannelPoiMapper ttCouponChannelPoiMapper; |
|
|
@@ -179,34 +177,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
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.setLastStatus(EnumSpuSyncStatus.sync_put_on.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.getError().getErrorMsg()); |
|
|
|
} |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@@ -215,35 +186,9 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
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.setLastStatus(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.setLastStatus(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.setLastStatus(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.getError().getErrorMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
return new ResultData(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@@ -277,25 +222,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); |
|
|
|
boolean b = ttWebService.getGoodsService().productOperate(null,wxCoupon.getId().toString(),op_type); |
|
|
|
if(b){ |
|
|
|
TtCouponChannelPoi ccPoi = new TtCouponChannelPoi(); |
|
|
|
ccPoi.setId(ttCouponChannelPoi.getId()); |
|
|
|
ccPoi.updateTenantInfo(ttCouponChannelPoi); |
|
|
|
ccPoi.setLastStatus(op_type); |
|
|
|
ccPoi.setUpdateDate(new Date()); |
|
|
|
ttCouponChannelPoiMapper.updateById(ccPoi); |
|
|
|
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.getError().getErrorMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@@ -309,19 +236,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
|| EnumSpuSyncStatus.sync_audit_rejection.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.getError().getErrorMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@@ -335,20 +251,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
|| EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); |
|
|
|
} |
|
|
|
try { |
|
|
|
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi); |
|
|
|
boolean b = ttWebService.getGoodsService().productFreeAudit(null,wxCoupon.getId().toString(), |
|
|
|
null,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.getError().getErrorMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@@ -441,14 +345,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
|| EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); |
|
|
|
} |
|
|
|
try { |
|
|
|
Long spu_id = Long.parseLong(ttCouponChannelPoi.getSpuId()); |
|
|
|
PoiPlanPage poiPlanPage = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiPlanList(spu_id, pageNum, pageSize); |
|
|
|
return new ResultData(poiPlanPage); |
|
|
|
} catch (WxErrorException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getError().getErrorMsg()); |
|
|
|
} |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@@ -458,14 +356,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
|| EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); |
|
|
|
} |
|
|
|
try { |
|
|
|
Long spu_id = Long.parseLong(ttCouponChannelPoi.getSpuId()); |
|
|
|
PoiOrientedPlanPage poiOrientedPlanPage = ttMerchantPoiService.getTtWebService(tenantInfo).getPoiPlanService().poiOrientedPlanList(spu_id, pageNum, pageSize); |
|
|
|
return new ResultData(poiOrientedPlanPage); |
|
|
|
} catch (WxErrorException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getError().getErrorMsg()); |
|
|
|
} |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@@ -501,21 +393,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
poiPlan.setContentType(record.getContentType()); |
|
|
|
poiPlan.setCommissionRate(record.getTakeRate()); |
|
|
|
|
|
|
|
Long returnPlanId = ttMerchantPoiService.getTtWebService(record).getPoiPlanService().poiPlanSave(poiPlan); |
|
|
|
if(returnPlanId != null){ |
|
|
|
if(record.getId() == null){ |
|
|
|
record.setId(returnPlanId); |
|
|
|
} |
|
|
|
record.setType(EnumCpsPlanType.COMMON.getCode()); |
|
|
|
this.saveorupdate(record); |
|
|
|
return new ResultData(returnPlanId); |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未获取到计划ID"); |
|
|
|
} |
|
|
|
} catch (WxErrorException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getError().getErrorMsg()); |
|
|
|
} catch (MallinkException e){ |
|
|
|
return new ResultData(); |
|
|
|
} catch (MallinkException e){ |
|
|
|
return new ResultData(e.getErrorCode(),e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
@@ -534,7 +413,6 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
|| EnumSpuSyncStatus.sync_audit_rejection.getCode().equals(ttCouponChannelPoi.getLastStatus())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过"); |
|
|
|
} |
|
|
|
try { |
|
|
|
int rateMin = getRateMin(EnumCpsPlanType.DIRECTIONAL); |
|
|
|
if(record.getTakeRate() < rateMin){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"分佣率低于最小值("+rateMin+")"); |
|
|
@@ -544,108 +422,9 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"分佣率超过最大值("+rateMax+")"); |
|
|
|
} |
|
|
|
Long spu_id = Long.parseLong(ttCouponChannelPoi.getSpuId()); |
|
|
|
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(record); |
|
|
|
Long returnPlanId = null; |
|
|
|
PoiOrientedPlan poiPlan = new PoiOrientedPlan(); |
|
|
|
if(record.getId() != null){ |
|
|
|
//修改 |
|
|
|
poiPlan.setPlanId(record.getId()); |
|
|
|
//不能修改达人 |
|
|
|
// this.poiOrientedPlanDeleteTalent(ttWebService,record); |
|
|
|
//修改只能添加达人 |
|
|
|
TtPoiTakeRate oldTakeRate = ttPoiTakeRateMapper.selectById(record.getId(), record.getTenantId()); |
|
|
|
if(oldTakeRate == null || StringUtils.isBlank(oldTakeRate.getDouyinId())){ |
|
|
|
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR); |
|
|
|
} |
|
|
|
if(!EnumCpsPlanStatus.ING.getCode().equals(oldTakeRate.getStatus())){ |
|
|
|
throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该计划已取消或已完成"); |
|
|
|
} |
|
|
|
|
|
|
|
List<String> addDouyinIdList = new ArrayList<>(); |
|
|
|
addDouyinIdList.addAll(record.getDouyinIdList()); |
|
|
|
List<String> oldDouyinIdList = JSONObject.parseArray(oldTakeRate.getDouyinId(), String.class); |
|
|
|
addDouyinIdList.removeAll(oldDouyinIdList); |
|
|
|
if(!addDouyinIdList.isEmpty()){//有新增的达人 |
|
|
|
poiPlan.setDouyinIdList(addDouyinIdList); |
|
|
|
Map<String, Integer> douyinMap = JSONObject.parseObject(oldTakeRate.getDouyinIdStatus(), Map.class); |
|
|
|
for (String douyin:addDouyinIdList) { |
|
|
|
douyinMap.put(douyin,EnumCpsPlanStatus.ING.getCode()); |
|
|
|
} |
|
|
|
record.setDouyinId(JSON.toJSONString(record.getDouyinIdList())); |
|
|
|
record.setDouyinIdStatus(JSON.toJSONString(douyinMap)); |
|
|
|
}else{//没有新增的达人 |
|
|
|
record.setDouyinId(null); |
|
|
|
record.setDouyinIdStatus(null); |
|
|
|
} |
|
|
|
|
|
|
|
if(EnumCpsPlanContentType.VIDEO.getCode().equals(record.getContentType())){ |
|
|
|
//当时间改变时, |
|
|
|
if(record.getStartTime() != null && record.getStartTime().after(oldTakeRate.getStartTime())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"开始时间只能向前修改"); |
|
|
|
} |
|
|
|
if(record.getEndTime() != null && record.getEndTime().before(oldTakeRate.getEndTime())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"结束时间只能向后延长"); |
|
|
|
} |
|
|
|
//当时间未改变时, |
|
|
|
if(record.getStartTime() == null || record.getStartTime().equals(oldTakeRate.getStartTime())){ |
|
|
|
record.setStartTime(null); |
|
|
|
} |
|
|
|
if(record.getEndTime() == null || record.getEndTime().equals(oldTakeRate.getEndTime())){ |
|
|
|
record.setEndTime(null); |
|
|
|
} |
|
|
|
record.setCommissionDuration(null);//佣金有效期不能修改 |
|
|
|
} |
|
|
|
record.setName(null);//名称不能修改 |
|
|
|
}else{ |
|
|
|
poiPlan.setPlanName(record.getName()); |
|
|
|
poiPlan.setDouyinIdList(record.getDouyinIdList()); |
|
|
|
|
|
|
|
Map<String, Integer> douyinMap = new HashMap<>(); |
|
|
|
for (String douyin: record.getDouyinIdList()) { |
|
|
|
douyinMap.put(douyin,EnumCpsPlanStatus.ING.getCode()); |
|
|
|
} |
|
|
|
record.setDouyinId(JSON.toJSONString(record.getDouyinIdList())); |
|
|
|
record.setDouyinIdStatus(JSON.toJSONString(douyinMap)); |
|
|
|
} |
|
|
|
poiPlan.setMerchantPhone(record.getMerchantPhone()); |
|
|
|
List<PoiOrientedPlan.ProductRate> productList = new ArrayList<>(); |
|
|
|
PoiOrientedPlan.ProductRate product = new PoiOrientedPlan.ProductRate(); |
|
|
|
product.setProductId(spu_id); |
|
|
|
product.setCommissionRate(record.getTakeRate()); |
|
|
|
productList.add(product); |
|
|
|
poiPlan.setProductList(productList); |
|
|
|
|
|
|
|
if(EnumCpsPlanContentType.LIVE.getCode().equals(record.getContentType())){ |
|
|
|
returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanLiveSave(poiPlan); |
|
|
|
}else if(EnumCpsPlanContentType.VIDEO.getCode().equals(record.getContentType())){ |
|
|
|
if(record.getStartTime() != null){ |
|
|
|
poiPlan.setStartTime(record.getStartTime().getTime()/1000); |
|
|
|
} |
|
|
|
if(record.getEndTime() != null){ |
|
|
|
poiPlan.setEndTime(record.getEndTime().getTime()/1000); |
|
|
|
} |
|
|
|
if(record.getCommissionDuration() != null){ |
|
|
|
poiPlan.setCommissionDuration(record.getCommissionDuration()); |
|
|
|
} |
|
|
|
returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanVideoSave(poiPlan); |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"带货场景错误"); |
|
|
|
} |
|
|
|
if(returnPlanId != null){ |
|
|
|
if(record.getId() == null){ |
|
|
|
record.setId(returnPlanId); |
|
|
|
} |
|
|
|
record.setType(EnumCpsPlanType.DIRECTIONAL.getCode()); |
|
|
|
this.saveorupdate(record); |
|
|
|
return new ResultData(returnPlanId); |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未获取到计划ID"); |
|
|
|
} |
|
|
|
|
|
|
|
return new ResultData(); |
|
|
|
|
|
|
|
} catch (WxErrorException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getError().getErrorMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@@ -666,30 +445,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
douyinMap.put(douyin,EnumCpsPlanStatus.ING.getCode()); |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(record); |
|
|
|
PoiOrientedPlan poiPlan = new PoiOrientedPlan(); |
|
|
|
poiPlan.setPlanId(record.getId()); |
|
|
|
poiPlan.setDouyinIdList(record.getDouyinIdList()); |
|
|
|
Long returnPlanId = null; |
|
|
|
if(EnumCpsPlanContentType.LIVE.getCode().equals(record.getContentType())){ |
|
|
|
returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanLiveSave(poiPlan); |
|
|
|
}else if(EnumCpsPlanContentType.VIDEO.getCode().equals(record.getContentType())){ |
|
|
|
returnPlanId = ttWebService.getPoiPlanService().poiOrientedPlanVideoSave(poiPlan); |
|
|
|
} |
|
|
|
|
|
|
|
TtPoiTakeRate updTakeRate = new TtPoiTakeRate(); |
|
|
|
updTakeRate.setId(record.getId()); |
|
|
|
updTakeRate.updateTenantInfo(record); |
|
|
|
updTakeRate.setDouyinId(JSON.toJSONString(douyinIdList)); |
|
|
|
updTakeRate.setDouyinIdStatus(JSON.toJSONString(douyinMap)); |
|
|
|
updTakeRate.setUpdateDate(new Date()); |
|
|
|
ttPoiTakeRateMapper.updateById(updTakeRate); |
|
|
|
return new ResultData(); |
|
|
|
}catch (WxErrorException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getError().getErrorMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@@ -704,28 +460,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
} |
|
|
|
Map<String, Integer> douyinMap = JSONObject.parseObject(takeRate.getDouyinIdStatus(), Map.class); |
|
|
|
douyinMap.put(record.getDouyinId(),EnumCpsPlanStatus.OFF.getCode()); |
|
|
|
try { |
|
|
|
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(record); |
|
|
|
boolean b = ttWebService.getPoiPlanService().poiOrientedPlanDeleteTalent(record.getId(), record.getDouyinId()); |
|
|
|
|
|
|
|
|
|
|
|
TtPoiTakeRate updTakeRate = new TtPoiTakeRate(); |
|
|
|
updTakeRate.setId(record.getId()); |
|
|
|
updTakeRate.updateTenantInfo(record); |
|
|
|
updTakeRate.setDouyinIdStatus(JSON.toJSONString(douyinMap)); |
|
|
|
|
|
|
|
Collection<Integer> values = douyinMap.values(); |
|
|
|
values.removeIf(e -> e.equals(EnumCpsPlanStatus.OFF.getCode())); |
|
|
|
if(values.isEmpty()){ |
|
|
|
updTakeRate.setStatus(EnumCpsPlanStatus.OFF.getCode()); |
|
|
|
} |
|
|
|
updTakeRate.setUpdateDate(new Date()); |
|
|
|
ttPoiTakeRateMapper.updateById(updTakeRate); |
|
|
|
return new ResultData(); |
|
|
|
}catch (WxErrorException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getError().getErrorMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -786,47 +521,14 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData poiPlanUpdateStatus(TtPoiTakeRate record) { |
|
|
|
try { |
|
|
|
boolean b = ttMerchantPoiService.getTtWebService(record).getPoiPlanService().poiPlanUpdateStatus(record.getId(), record.getStatus()); |
|
|
|
if(b){ |
|
|
|
TtPoiTakeRate updTakeRate = new TtPoiTakeRate(); |
|
|
|
updTakeRate.setId(record.getId()); |
|
|
|
updTakeRate.updateTenantInfo(record); |
|
|
|
updTakeRate.setType(EnumCpsPlanType.COMMON.getCode()); |
|
|
|
updTakeRate.setStatus(record.getStatus()); |
|
|
|
updTakeRate.setUpdateDate(new Date()); |
|
|
|
ttPoiTakeRateMapper.updateById(updTakeRate); |
|
|
|
return new ResultData(); |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"false"); |
|
|
|
} |
|
|
|
} catch (WxErrorException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getError().getErrorMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData poiOrientedPlanUpdateStatus(TtPoiTakeRate record) { |
|
|
|
try { |
|
|
|
//仅支持传3,将计划修改为已取消 |
|
|
|
//仅支持修改直播间定向佣金计划,不支持修改短视频定向佣金计划 |
|
|
|
boolean b = ttMerchantPoiService.getTtWebService(record).getPoiPlanService().poiOrientedPlanUpdateStatus(record.getId(), record.getStatus()); |
|
|
|
if(b){ |
|
|
|
TtPoiTakeRate updTakeRate = new TtPoiTakeRate(); |
|
|
|
updTakeRate.setId(record.getId()); |
|
|
|
updTakeRate.updateTenantInfo(record); |
|
|
|
updTakeRate.setStatus(record.getStatus()); |
|
|
|
updTakeRate.setUpdateDate(new Date()); |
|
|
|
ttPoiTakeRateMapper.updateById(updTakeRate); |
|
|
|
return new ResultData(); |
|
|
|
}else{ |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"false"); |
|
|
|
} |
|
|
|
} catch (WxErrorException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getError().getErrorMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|