|
@@ -3866,6 +3866,10 @@ public class CostDepartmentProfitServiceImpl extends BaseBatchServiceImpl<CostDe
|
|
|
for (ReportForm reportForm : firstLevelReports) {
|
|
for (ReportForm reportForm : firstLevelReports) {
|
|
|
setChildReport(reportForm,reportParentGroup);
|
|
setChildReport(reportForm,reportParentGroup);
|
|
|
}
|
|
}
|
|
|
|
|
+ //虚拟一个最上层的节点方便循环嵌套计算
|
|
|
|
|
+ ReportForm baseReport=new ReportForm();
|
|
|
|
|
+ baseReport.setId(NumberConstant.ZERO_L);
|
|
|
|
|
+ baseReport.setChild(firstLevelReports);
|
|
|
//按责任中心计算科室损益
|
|
//按责任中心计算科室损益
|
|
|
// for (Responsibility responsibility : profitCalculationData.getResponsibilityList()) {
|
|
// for (Responsibility responsibility : profitCalculationData.getResponsibilityList()) {
|
|
|
// Map<Integer,CostDepartmentProfitVO> costDepartmentProfitMap=new HashMap<>();
|
|
// Map<Integer,CostDepartmentProfitVO> costDepartmentProfitMap=new HashMap<>();
|
|
@@ -3881,9 +3885,7 @@ public class CostDepartmentProfitServiceImpl extends BaseBatchServiceImpl<CostDe
|
|
|
.map(responsibility -> {
|
|
.map(responsibility -> {
|
|
|
Map<Integer, CostDepartmentProfitVO> costDepartmentProfitMap = new HashMap<>();
|
|
Map<Integer, CostDepartmentProfitVO> costDepartmentProfitMap = new HashMap<>();
|
|
|
// 计算责任中心的所有报表项目
|
|
// 计算责任中心的所有报表项目
|
|
|
- for (ReportForm reportForm : firstLevelReports) {
|
|
|
|
|
- calcRespReportAmount(responsibility, reportForm, profitCalculationData, costDepartmentProfitMap);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ calcRespReportAmount(responsibility, baseReport, profitCalculationData, costDepartmentProfitMap);
|
|
|
return new ArrayList<>(costDepartmentProfitMap.values());
|
|
return new ArrayList<>(costDepartmentProfitMap.values());
|
|
|
})
|
|
})
|
|
|
.flatMap(List::stream)
|
|
.flatMap(List::stream)
|
|
@@ -3944,9 +3946,11 @@ public class CostDepartmentProfitServiceImpl extends BaseBatchServiceImpl<CostDe
|
|
|
calcReportAmount(responsibility,reportForm,profitCalculationData,costDepartmentProfitMap);
|
|
calcReportAmount(responsibility,reportForm,profitCalculationData,costDepartmentProfitMap);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }else{
|
|
|
|
|
- //没有子级项目的只要计算自己
|
|
|
|
|
- calcReportAmount(responsibility,parentReport,profitCalculationData,costDepartmentProfitMap);
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ //虚拟的最上层不需要计算
|
|
|
|
|
+ if(!NumberConstant.ZERO_L.equals(parentReport.getId())) {
|
|
|
|
|
+ //再计算自己
|
|
|
|
|
+ calcReportAmount(responsibility, parentReport, profitCalculationData, costDepartmentProfitMap);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|