|
|
@ -143,6 +143,7 @@ public class TzcPolicyApplicationServiceImpl implements TzcPolicyApplicationServ |
|
|
|
public void commitPolicy(Long policyId){ |
|
|
|
seeYonService.testConnection(); |
|
|
|
TzcPolicy tzcPolicy = tzcPolicyService.getById(policyId); |
|
|
|
Integer tzcPolicyStatus = tzcPolicy.getPolicyStatus(); |
|
|
|
if(!tzcPolicy.allowEditFlag()){ |
|
|
|
Assert.throwEx("操作失败,政策状态不支持"); |
|
|
|
} |
|
|
@ -211,8 +212,7 @@ public class TzcPolicyApplicationServiceImpl implements TzcPolicyApplicationServ |
|
|
|
tbsBudgetCostItemPolicyService.saveBatch(allBudgetItem); |
|
|
|
//保存预算使用日志
|
|
|
|
List<TbsBudgetLog> budgetLogList = saveBudgetLog(result, sysUser, tzcPolicy, result.getPolicyBudgetMatchList(),result.getPolicyItemList()); |
|
|
|
if(tzcPolicy.getPolicyStatus().equals(TzcPolicyStatus.Status_0_UnCommit)){ |
|
|
|
//todo 待测试,没能触发到
|
|
|
|
if(tzcPolicyStatus.equals(TzcPolicyStatus.Status_0_UnCommit)){ |
|
|
|
budgetLogService.saveBatch(budgetLogList); |
|
|
|
}else { |
|
|
|
//排除历史记录
|
|
|
@ -566,7 +566,7 @@ public class TzcPolicyApplicationServiceImpl implements TzcPolicyApplicationServ |
|
|
|
//按品类条件,提取可用预算(列表已按小维度到大维度排列)
|
|
|
|
List<TzcPolicyGoods> policyGoodsList = tzcPolicyGoodsService.listByItemId(policyItem.getId()); |
|
|
|
List<String> levelPathIdsList = policyGoodsList.stream().map(TzcPolicyGoods::getTargetLevelPathIds).collect(Collectors.toList()); |
|
|
|
List<TbsBudget> currentItemBudgetList = this.filterMatchGoodsCondition(budgetList, levelPathIdsList); |
|
|
|
List<TbsBudget> currentItemBudgetList = this.filterMatchGoodsCondition(policyItem,budgetList, levelPathIdsList); |
|
|
|
//关联无条件预算
|
|
|
|
currentItemBudgetList.addAll(noConditionBudgetList); |
|
|
|
//提取可用预算的考核期
|
|
|
@ -672,12 +672,13 @@ public class TzcPolicyApplicationServiceImpl implements TzcPolicyApplicationServ |
|
|
|
|
|
|
|
/** |
|
|
|
* 按品类条件,提取可用预算 |
|
|
|
* @param policyItem 用于绑定target信息保存到budeget_log |
|
|
|
* @param budgetList 预算(已关联参数_条件列表) |
|
|
|
* @param levelPathIdsList |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@NotNull |
|
|
|
public List<TbsBudget> filterMatchGoodsCondition(List<TbsBudget> budgetList,List<String> levelPathIdsList) { |
|
|
|
public List<TbsBudget> filterMatchGoodsCondition(TzcPolicyItem policyItem,List<TbsBudget> budgetList,List<String> levelPathIdsList) { |
|
|
|
List<TbsBudget> currentItemBudgetList = new ArrayList<>(); |
|
|
|
for (String levelPath : levelPathIdsList) { |
|
|
|
Set<String> levelPathSet = new LinkedHashSet<>(); |
|
|
@ -693,6 +694,12 @@ public class TzcPolicyApplicationServiceImpl implements TzcPolicyApplicationServ |
|
|
|
if(budgetCondition.getTargetLevelPathIds().contains(conditionString)){ |
|
|
|
isMatch = true; |
|
|
|
currentItemBudgetList.add(budget); |
|
|
|
List<TbsBudgetCondition> usedConditionList = policyItem.getUsedConditionList(); |
|
|
|
if(usedConditionList==null){ |
|
|
|
usedConditionList = new ArrayList<>(); |
|
|
|
} |
|
|
|
usedConditionList.add(budgetCondition); |
|
|
|
policyItem.setUsedConditionList(usedConditionList); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|