|
|
@ -112,6 +112,9 @@ public class TzcPolicyApplication { |
|
|
|
for (TbsScheduleItemBudget itemBudget : scheduleItemList) { |
|
|
|
//TODO 需要重新检查这里
|
|
|
|
BigDecimal budgetItemApplyAmount = tbsScheduleItemBudgetMapper.totalApplyAmount(itemBudget.getId(),policyId); |
|
|
|
if (budgetItemApplyAmount==null){ |
|
|
|
budgetItemApplyAmount = BigDecimal.ZERO; |
|
|
|
} |
|
|
|
budgetItemApplyAmountMap.put(itemBudget.getId(),budgetItemApplyAmount); |
|
|
|
BigDecimal budgetItemAmount = tbsScheduleItemBudgetMapper.totalCostAmount(itemBudget.getBudgetId(),itemBudget.getScheduleItemId(),policyId); |
|
|
|
//因为结果为负数,需去相反数
|
|
|
@ -215,7 +218,7 @@ public class TzcPolicyApplication { |
|
|
|
for (TbsBudgetCostItemPolicy costItem : allBudgetItem) { |
|
|
|
TbsBudgetTableVo.TableValue tableValue = new TbsBudgetTableVo.TableValue(); |
|
|
|
tableValue.setTopId(costItem.getScheduleItemBudgetId()+""); |
|
|
|
tableValue.setLeftId(costItem.getPolicyId()+""); |
|
|
|
tableValue.setLeftId(costItem.getPolicyItemId()+""); |
|
|
|
tableValue.setValue(costItem.getPolicyItemAmount()); |
|
|
|
tableValueList.add(tableValue); |
|
|
|
} |
|
|
@ -254,6 +257,15 @@ public class TzcPolicyApplication { |
|
|
|
budgetItemCostResult.setPolicyItem(policyItem); |
|
|
|
//过滤满全条件的预算
|
|
|
|
List<Long> allowBudgetIds = allowBudgetIdMap.get(policyItem.getId()); |
|
|
|
if(CollectionUtil.isEmpty(allowBudgetIds)){ |
|
|
|
budgetItemCostResult.setBudgetId(0L); |
|
|
|
budgetItemCostResult.setScheduleId(0L); |
|
|
|
budgetItemCostResult.setScheduleItemId(0L); |
|
|
|
budgetItemCostResult.setScheduleItemBudgetId(0L); |
|
|
|
budgetItemCostResult.setScheduleItemName("无"); |
|
|
|
actUnMatchList.add(budgetItemCostResult); |
|
|
|
return; |
|
|
|
} |
|
|
|
//PS:排序规则:优先为时间条件,其次匹配品牌条件
|
|
|
|
List<TbsBudget> budgetList = allBudgetList.stream().filter(obj->allowBudgetIds.contains(obj.getId())).collect(Collectors.toList()); |
|
|
|
//按品类条件,提取可用预算(列表已按小维度到大维度排列)
|
|
|
@ -370,33 +382,26 @@ public class TzcPolicyApplication { |
|
|
|
@NotNull |
|
|
|
public List<TbsBudget> filterMatchGoodsCondition(List<TbsBudget> budgetList,List<String> levelPathIdsList) { |
|
|
|
List<TbsBudget> currentItemBudgetList = new ArrayList<>(); |
|
|
|
for (TbsBudget budget : budgetList) { |
|
|
|
if(budget.getConditionFlag().equals(1)){ |
|
|
|
List<TbsBudgetCondition> budgetConditionListByBudget = budget.getBudgetConditionList(); |
|
|
|
boolean anyUnMatch = true; |
|
|
|
for (String levelPath : levelPathIdsList) { |
|
|
|
boolean match = false; |
|
|
|
Set<String> levelPathSet = new LinkedHashSet<>(); |
|
|
|
levelPathSet.add(levelPath); |
|
|
|
TbsBudgetCostUtil.buildPaths(levelPath,levelPathSet); |
|
|
|
for (String conditionString : levelPathSet) { |
|
|
|
if(!match){ |
|
|
|
for (TbsBudget budget : budgetList) { |
|
|
|
if(budget.getConditionFlag().equals(1)){ |
|
|
|
boolean isMatch = false; |
|
|
|
List<TbsBudgetCondition> budgetConditionListByBudget = budget.getBudgetConditionList(); |
|
|
|
for (TbsBudgetCondition budgetCondition : budgetConditionListByBudget) { |
|
|
|
if(isMatch){break;} |
|
|
|
for (String conditionString : levelPathSet) { |
|
|
|
if(budgetCondition.getTargetLevelPathIds().contains(conditionString)){ |
|
|
|
match = true; |
|
|
|
isMatch = true; |
|
|
|
currentItemBudgetList.add(budget); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if(!match){ |
|
|
|
anyUnMatch = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if(!anyUnMatch){ |
|
|
|
currentItemBudgetList.add(budget); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return currentItemBudgetList; |
|
|
|