Browse Source

opt: 常规费用需要经模板申请

feat: 返利添加明细日志字段
master
Yen 2 months ago
parent
commit
5cb576f032
  1. 2
      cms-modules/cms-policy/cms-policy-api/src/main/java/com/qs/serve/modules/tzc/entity/dto/TzcRebateLevelAmountDTO.java
  2. 13
      cms-modules/cms-system/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java
  3. 7
      cms-modules/cms-system/src/main/java/com/qs/serve/modules/tzc/service/TzcRebateApplication4VerificationService.java
  4. 23
      cms-modules/cms-system/src/main/java/com/qs/serve/modules/tzc/service/impl/TzcRebateApplication4CostServiceImpl.java
  5. 10
      cms-modules/cms-system/src/main/java/com/qs/serve/modules/tzc/service/impl/TzcRebateApplication4VerificationServiceImpl.java
  6. 7
      cms-modules/cms-system/src/main/java/com/qs/serve/modules/vtb/entity/VtbVerification.java
  7. 3
      cms-modules/cms-system/src/main/java/com/qs/serve/modules/vtb/entity/VtbVerificationSubject.java
  8. 2
      cms-modules/cms-system/src/main/java/com/qs/serve/modules/vtb/service/impl/VtbVerificationServiceImpl.java

2
cms-modules/cms-policy/cms-policy-api/src/main/java/com/qs/serve/modules/tzc/entity/dto/TzcRebateLevelAmountDTO.java

@ -42,4 +42,6 @@ public class TzcRebateLevelAmountDTO extends TzcRebateLevels {
@NotNull @NotNull
private TzcRebateLevelsArgument argument; private TzcRebateLevelsArgument argument;
private String debugMsg;
} }

13
cms-modules/cms-system/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java

@ -546,7 +546,7 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
@Override @Override
public boolean checkTemplateId(BmsSupplier supplier, TbsActivityTemplate template) { public boolean checkTemplateId(BmsSupplier supplier, TbsActivityTemplate template) {
Long templateId = template.getId(); Long templateId = template.getId();
boolean isIgnore = template.getSaleRegionFlag().equals(0)&&template.getBizRegionFlag().equals(0)&&template.getContractFlag().equals(0); boolean isIgnore = template.getSaleRegionFlag().equals(0)&&template.getBizRegionFlag().equals(0)&&template.getCustomFlag().equals(0);
boolean isStop = template.getSaleRegionFlag().equals(2)&&template.getBizRegionFlag().equals(2)&&template.getCustomFlag().equals(2); boolean isStop = template.getSaleRegionFlag().equals(2)&&template.getBizRegionFlag().equals(2)&&template.getCustomFlag().equals(2);
if(isStop){ if(isStop){
Assert.throwEx("模板已停用"); Assert.throwEx("模板已停用");
@ -572,7 +572,7 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
break; break;
} }
} }
if (templateRegion.getType().equals("cus")&&template.getBizRegionFlag().equals(1)){ if (templateRegion.getType().equals("cus")&&template.getCustomFlag().equals(1)){
if(templateRegion.getRegionId().equals(supplierId)){ if(templateRegion.getRegionId().equals(supplierId)){
isPass = true; isPass = true;
break; break;
@ -637,6 +637,15 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
TbsCostApply tbsCostApply = this.getById(id); TbsCostApply tbsCostApply = this.getById(id);
redisService.throwResLock(TbsCostApply.class.getSimpleName(),id); redisService.throwResLock(TbsCostApply.class.getSimpleName(),id);
// 只能通过模板创建费用,不支持手动创建
if (tbsCostApply.getTemplateId()==null){
// 退回和异动可忽略模板
if (!tbsCostApply.getChargeState().equals(4)
&&!tbsCostApply.getChargeState().equals(7)){
Assert.throwEx("请通过模板创建费用");
}
}
BmsSupplier supplier = bmsSupplierService.getById(tbsCostApply.getSupplierId()); BmsSupplier supplier = bmsSupplierService.getById(tbsCostApply.getSupplierId());
if(supplier.getCostFlag().equals(0)||supplier.getStopFlag().equals(1)){ if(supplier.getCostFlag().equals(0)||supplier.getStopFlag().equals(1)){
Assert.throwEx("["+supplier.getName()+"]无投放费用权限"); Assert.throwEx("["+supplier.getName()+"]无投放费用权限");

7
cms-modules/cms-system/src/main/java/com/qs/serve/modules/tzc/service/TzcRebateApplication4VerificationService.java

@ -14,6 +14,13 @@ import java.util.List;
*/ */
public interface TzcRebateApplication4VerificationService { public interface TzcRebateApplication4VerificationService {
/**
* 获取批量核销列表(总目标达标补偿)
* @param costApplyId
* @return
*/
Object getRebateBatchVerificationList(Long costApplyId);
/** /**
* 获取活动返利金额 * 获取活动返利金额
* @param activityId * @param activityId

23
cms-modules/cms-system/src/main/java/com/qs/serve/modules/tzc/service/impl/TzcRebateApplication4CostServiceImpl.java

@ -357,32 +357,34 @@ public class TzcRebateApplication4CostServiceImpl implements TzcRebateApplicatio
if (levels.getConditionSelect().equals(0)){ if (levels.getConditionSelect().equals(0)){
// 条件类型:0-同期进货金额;1-区间目标金额 // 条件类型:0-同期进货金额;1-区间目标金额
BigDecimal periodAmount = null; BigDecimal periodAmount = null;
String msg = "";
if (levels.getConditionType().equals(0)){ if (levels.getConditionType().equals(0)){
periodAmount = rebatePeriod.getSamePeriodAmount(); periodAmount = rebatePeriod.getSamePeriodAmount();
msg = "同期金额:"+periodAmount;
}else if (levels.getConditionType().equals(1)){ }else if (levels.getConditionType().equals(1)){
periodAmount = rebatePeriod.getPeriodAmount(); periodAmount = rebatePeriod.getPeriodAmount();
msg = "目标金额:"+periodAmount;
} }
msg = "("+msg+",占比:"+levels.getConditionRate()+"%)";
BigDecimal targetAmt = periodAmount.multiply(levels.getConditionRate()) BigDecimal targetAmt = periodAmount.multiply(levels.getConditionRate())
.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP); .divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
// 发货金额大于坎级制定的百分比 // 发货金额大于坎级制定的百分比
boolean ok = dispatchAmt.compareTo(targetAmt)>=0; boolean ok = dispatchAmt.compareTo(targetAmt)>=0;
if (!ok){ if (!ok){
dto.appendDebugMsg("跳过坎级:"+levels.getLevelNum()+",条件金额:"+targetAmt+",发货金额:"+dispatchAmt); dto.appendDebugMsg("跳过坎级:"+levels.getLevelNum()+",门槛金额:"+targetAmt+msg+",发货金额:"+dispatchAmt);
log.debug("跳过坎级:{},条件金额:{},发货金额:{}",levels.getLevelNum(),targetAmt,dispatchAmt);
continue; continue;
} }
dto.appendDebugMsg("命中坎级:"+levels.getLevelNum()+",条件金额:"+targetAmt+",发货金额:"+dispatchAmt); dto.appendDebugMsg("命中坎级:"+levels.getLevelNum()+",条件金额:"+targetAmt+msg+",发货金额:"+dispatchAmt);
dto.setMaxLevels(levels); dto.setMaxLevels(levels);
return dto; return dto;
}else if (levels.getConditionSelect().equals(1)){ }else if (levels.getConditionSelect().equals(1)){
// 发货金额大于坎级制定的固定金额 // 发货金额大于坎级制定的固定金额
boolean ok = dispatchAmt.compareTo(levels.getConditionAmount())>=0; boolean ok = dispatchAmt.compareTo(levels.getConditionAmount())>=0;
if (!ok){ if (!ok){
dto.appendDebugMsg("跳过坎级:"+levels.getLevelNum()+",条件金额:"+levels.getConditionAmount()+",发货金额:"+dispatchAmt); dto.appendDebugMsg("跳过坎级:"+levels.getLevelNum()+",门槛固定金额:"+levels.getConditionAmount()+",发货金额:"+dispatchAmt);
log.debug("跳过坎级:{},条件金额:{},发货金额:{}",levels.getLevelNum(),levels.getConditionAmount(),dispatchAmt);
continue; continue;
} }
dto.appendDebugMsg("命中坎级:"+levels.getLevelNum()+",条件固定金额:"+levels.getConditionAmount()+",发货金额:"+dispatchAmt); dto.appendDebugMsg("命中坎级:"+levels.getLevelNum()+",门槛固定金额:"+levels.getConditionAmount()+",发货金额:"+dispatchAmt);
dto.setMaxLevels(levels); dto.setMaxLevels(levels);
return dto; return dto;
} }
@ -452,7 +454,8 @@ public class TzcRebateApplication4CostServiceImpl implements TzcRebateApplicatio
} }
} }
if (currentArgument==null){ if (currentArgument==null){
log.error("没有命中坎级参数:"+argType.name()); log.error("坎级ID:"+rebateLevels.getId()+",缺少参数:"+argType.name());
dto.appendErrorMsg("坎级ID:"+rebateLevels.getId()+",缺少参数:"+argType.name());
continue; continue;
} }
TzcRebateLevelAmountDTO rebateLevelsDTO = CopierUtil.copy(rebateLevels,new TzcRebateLevelAmountDTO()); TzcRebateLevelAmountDTO rebateLevelsDTO = CopierUtil.copy(rebateLevels,new TzcRebateLevelAmountDTO());
@ -461,23 +464,27 @@ public class TzcRebateApplication4CostServiceImpl implements TzcRebateApplicatio
// 选择的策略:0-百分比;1-固定金额 // 选择的策略:0-百分比;1-固定金额
if (currentArgument.getRateAmtFlag().equals(1)){ if (currentArgument.getRateAmtFlag().equals(1)){
rebateLevelsDTO.setReturnAmt(currentArgument.getReturnFixed()); rebateLevelsDTO.setReturnAmt(currentArgument.getReturnFixed());
rebateLevelsDTO.setDebugMsg("返利为固定金额:"+currentArgument.getReturnFixed());
}else if (currentArgument.getRateAmtFlag().equals(0)){ }else if (currentArgument.getRateAmtFlag().equals(0)){
//目标销量维度:0-总量;1-增量 //目标销量维度:0-总量;1-增量
if (currentArgument.getSumAddFlag().equals(0)){ if (currentArgument.getSumAddFlag().equals(0)){
BigDecimal rs = dispatchAmt.multiply(currentArgument.getReturnRate()) BigDecimal rs = dispatchAmt.multiply(currentArgument.getReturnRate())
.divide(BigDecimal.valueOf(100),2,RoundingMode.HALF_UP); .divide(BigDecimal.valueOf(100),2,RoundingMode.HALF_UP);
rebateLevelsDTO.setReturnAmt(rs); rebateLevelsDTO.setReturnAmt(rs);
rebateLevelsDTO.setDebugMsg("基于总量("+rs+")=返货金额("+dispatchAmt+")*返利百分比("+currentArgument.getReturnRate()+"%)");
}else if (currentArgument.getSumAddFlag().equals(1)){ }else if (currentArgument.getSumAddFlag().equals(1)){
// 增量 = (发货金额 - 同比发货金额) * 返利比例 / 100 // 增量 = (发货金额 - 同比发货金额) * 返利比例 / 100
BigDecimal rs = dispatchAmt.subtract(sameDispatchAmt) BigDecimal rs = dispatchAmt.subtract(sameDispatchAmt)
.multiply(currentArgument.getReturnRate()) .multiply(currentArgument.getReturnRate())
.divide(BigDecimal.valueOf(100),2,RoundingMode.HALF_UP); .divide(BigDecimal.valueOf(100),2,RoundingMode.HALF_UP);
if (rs.compareTo(BigDecimal.ZERO)>0){ if (rs.compareTo(BigDecimal.ZERO)>0){
rebateLevelsDTO.setDebugMsg("基于增量("+rs+") " +
"= (发货金额["+dispatchAmt+"] - 同比发货金额["+sameDispatchAmt+"]) * 返利比例["+currentArgument.getReturnRate()+"%]");
rebateLevelsDTO.setReturnAmt(rs); rebateLevelsDTO.setReturnAmt(rs);
}else { }else {
rebateLevelsDTO.setReturnAmt(BigDecimal.ZERO); rebateLevelsDTO.setReturnAmt(BigDecimal.ZERO);
log.warn("返利参数TzcRebateLevelsArgument-ID:{},返利金额小于0",currentArgument.getId()); log.warn("返利参数TzcRebateLevelsArgument-ID:{},返利金额小于0",currentArgument.getId());
dto.appendErrorMsg("返利参数TzcRebateLevelsArgument-ID:"+currentArgument.getId()+",返利金额小于0"); rebateLevelsDTO.setDebugMsg("返利参数TzcRebateLevelsArgument-ID:"+currentArgument.getId()+",返利金额小于0");
} }
} }
} }

10
cms-modules/cms-system/src/main/java/com/qs/serve/modules/tzc/service/impl/TzcRebateApplication4VerificationServiceImpl.java

@ -48,6 +48,16 @@ public class TzcRebateApplication4VerificationServiceImpl implements TzcRebateAp
private final TzcRebateLevelsConfigService tzcRebateLevelsConfigService; private final TzcRebateLevelsConfigService tzcRebateLevelsConfigService;
private final TzcRebateLevelsService tzcRebateLevelsService; private final TzcRebateLevelsService tzcRebateLevelsService;
@Override
public Object getRebateBatchVerificationList(Long costApplyId) {
// 过滤不需要补充的返利期间
// 加载相关活动
// 已核销金额
// 计算返利每个期间补充金额
// 结合核销金额及最高补偿金额,计算返利金额
// 返回活动对应的核销金额及返利计算流程
return null;
}
@Override @Override
public TzcRebateCalculateDTO getActivityRebateAmount(Long activityId, BigDecimal dispatchAmt) { public TzcRebateCalculateDTO getActivityRebateAmount(Long activityId, BigDecimal dispatchAmt) {

7
cms-modules/cms-system/src/main/java/com/qs/serve/modules/vtb/entity/VtbVerification.java

@ -203,12 +203,15 @@ public class VtbVerification implements Serializable {
/** 返利期间id */ /** 返利期间id */
private Long rebatePeriodId; private Long rebatePeriodId;
/** 实际发货金额(针对返利业务) */ /** 自动获取发货金额(针对返利业务) */
private BigDecimal autoDispatchAmt; private BigDecimal autoDispatchAmt;
/** 系统获取的发货金额 */ /** 实际发货金额 */
private BigDecimal finalDispatchAmt; private BigDecimal finalDispatchAmt;
/** 实际发货金额(申请时) */
private BigDecimal finalDispatchAmtRecord;
@TableField(exist = false) @TableField(exist = false)
private List<?> attachList; private List<?> attachList;

3
cms-modules/cms-system/src/main/java/com/qs/serve/modules/vtb/entity/VtbVerificationSubject.java

@ -162,6 +162,9 @@ public class VtbVerificationSubject implements Serializable {
/** 系统获取的发货金额 */ /** 系统获取的发货金额 */
private BigDecimal finalDispatchAmt; private BigDecimal finalDispatchAmt;
/** 实际发货金额(申请时) */
private BigDecimal finalDispatchAmtRecord;
private Integer syncPayFlag; private Integer syncPayFlag;
/** 可更变的最大金额 */ /** 可更变的最大金额 */

2
cms-modules/cms-system/src/main/java/com/qs/serve/modules/vtb/service/impl/VtbVerificationServiceImpl.java

@ -921,6 +921,7 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe
ErpDispatchSumPmsVo dispatchSumPmsVo = activityService.getDispatchSumByActivity(activity); ErpDispatchSumPmsVo dispatchSumPmsVo = activityService.getDispatchSumByActivity(activity);
verification.setAutoDispatchAmt(dispatchSumPmsVo.getTotalAmount()); verification.setAutoDispatchAmt(dispatchSumPmsVo.getTotalAmount());
verification.setFinalDispatchAmt(totalDispatchAmt); verification.setFinalDispatchAmt(totalDispatchAmt);
verification.setFinalDispatchAmtRecord(totalDispatchAmt);
verification.setAmount(totalAmount); verification.setAmount(totalAmount);
verification.setAmountRecord(totalAmount); verification.setAmountRecord(totalAmount);
@ -1092,6 +1093,7 @@ public class VtbVerificationServiceImpl extends ServiceImpl<VtbVerificationMappe
verificationSubject.setFormContext(subjectCenterBo.getFormContext()); verificationSubject.setFormContext(subjectCenterBo.getFormContext());
verificationSubject.setFormContextValue(subjectCenterBo.getFormContextValue()); verificationSubject.setFormContextValue(subjectCenterBo.getFormContextValue());
verificationSubject.setFinalDispatchAmt(subjectCenterBo.getFinalDispatchAmt()); verificationSubject.setFinalDispatchAmt(subjectCenterBo.getFinalDispatchAmt());
verificationSubject.setFinalDispatchAmtRecord(subjectCenterBo.getFinalDispatchAmt());
verificationSubjects.add(verificationSubject); verificationSubjects.add(verificationSubject);
} }
} }

Loading…
Cancel
Save