|
@@ -120,6 +120,7 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
|
|
if (CollUtil.isEmpty(costShareLevelList)) {
|
|
if (CollUtil.isEmpty(costShareLevelList)) {
|
|
throw new CostException(500, "分摊层级未设置");
|
|
throw new CostException(500, "分摊层级未设置");
|
|
}
|
|
}
|
|
|
|
+ // TODO 可能多个
|
|
Long id = costShareLevelList.get(0).getId();
|
|
Long id = costShareLevelList.get(0).getId();
|
|
// 查询责任中心里面是这个层级的所有的收益中心
|
|
// 查询责任中心里面是这个层级的所有的收益中心
|
|
List<Responsibility> responsibilityList = responsibilityService.list(new QueryWrapper<Responsibility>().lambda()
|
|
List<Responsibility> responsibilityList = responsibilityService.list(new QueryWrapper<Responsibility>().lambda()
|
|
@@ -132,7 +133,7 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
|
|
throw new CostException(500, "归集后数据不存在");
|
|
throw new CostException(500, "归集后数据不存在");
|
|
}
|
|
}
|
|
Map<Long, List<ReportRelation>> reportRelationMap = reportRelationService.list(new QueryWrapper<ReportRelation>().lambda().eq(ReportRelation::getHospId, hospId)).stream().collect(Collectors.groupingBy(ReportRelation::getReportId));
|
|
Map<Long, List<ReportRelation>> reportRelationMap = reportRelationService.list(new QueryWrapper<ReportRelation>().lambda().eq(ReportRelation::getHospId, hospId)).stream().collect(Collectors.groupingBy(ReportRelation::getReportId));
|
|
- // 分摊后的数据getOriginType等于2说明是分摊后的数据
|
|
|
|
|
|
+ // 分摊后的数据说明是分摊后的数据
|
|
List<AllocationQuery> allocationQueryList = allocationQueryService.list(new QueryWrapper<AllocationQuery>().lambda().eq(AllocationQuery::getHospId, hospId)
|
|
List<AllocationQuery> allocationQueryList = allocationQueryService.list(new QueryWrapper<AllocationQuery>().lambda().eq(AllocationQuery::getHospId, hospId)
|
|
.eq(year > 0, AllocationQuery::getDateYear, year)
|
|
.eq(year > 0, AllocationQuery::getDateYear, year)
|
|
.eq(month > 0, AllocationQuery::getDateMonth, month)
|
|
.eq(month > 0, AllocationQuery::getDateMonth, month)
|
|
@@ -376,6 +377,13 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
|
|
writer.merge(jj, i + 1, 0, 0, cellValue1, false);
|
|
writer.merge(jj, i + 1, 0, 0, cellValue1, false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // 设置列宽
|
|
|
|
+ for (int i = 0; i < 50; i++) {
|
|
|
|
+ // 调整每一列宽度
|
|
|
|
+ sheet.autoSizeColumn((short) i);
|
|
|
|
+ // 解决自动设置列宽中文失效的问题
|
|
|
|
+ sheet.setColumnWidth(i, sheet.getColumnWidth(i) * 14 / 10);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -457,9 +465,11 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
|
|
// 查询报表里面是当前分摊层级的数据
|
|
// 查询报表里面是当前分摊层级的数据
|
|
List<Allocation> allocations = allocationList.stream().filter(i -> i.getTargetResponsibilityCode().equals(costDepartmentProfitVO.getResponsibilityCode()) && responsibilityCodes.contains(i.getResponsibilityCode())).collect(Collectors.toList());
|
|
List<Allocation> allocations = allocationList.stream().filter(i -> i.getTargetResponsibilityCode().equals(costDepartmentProfitVO.getResponsibilityCode()) && responsibilityCodes.contains(i.getResponsibilityCode())).collect(Collectors.toList());
|
|
if (CollUtil.isNotEmpty(allocations)) {
|
|
if (CollUtil.isNotEmpty(allocations)) {
|
|
- allocations.forEach(m -> {
|
|
|
|
- sum.updateAndGet(v -> v.add(m.getAmount()));
|
|
|
|
- });
|
|
|
|
|
|
+ BigDecimal reduce = allocations.stream().map(Allocation::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ sum.set(reduce);
|
|
|
|
+// allocations.forEach(m -> {
|
|
|
|
+// sum.updateAndGet(v -> v.add(m.getAmount()));
|
|
|
|
+// });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -483,7 +493,7 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
|
|
Long reportParentId = costDepartmentProfitVO.getReportParentId();
|
|
Long reportParentId = costDepartmentProfitVO.getReportParentId();
|
|
String responsibilityCode = costDepartmentProfitVO.getResponsibilityCode();
|
|
String responsibilityCode = costDepartmentProfitVO.getResponsibilityCode();
|
|
// 查询报表里面在当前父层级下的并且不是自己的报表项目
|
|
// 查询报表里面在当前父层级下的并且不是自己的报表项目
|
|
- List<CostDepartmentProfitVO> costDepartmentProfitVOS = profitVOS.stream().filter(i -> i.getReportParentId().equals(reportParentId) && i.getResponsibilityCode().equals(responsibilityCode) && !NumberConstant.THREE.equals(i.getCalcType())).collect(Collectors.toList());
|
|
|
|
|
|
+ List<CostDepartmentProfitVO> costDepartmentProfitVOS = allList.stream().filter(i -> i.getReportParentId().equals(reportParentId) && i.getResponsibilityCode().equals(responsibilityCode) && !NumberConstant.THREE.equals(i.getCalcType())).collect(Collectors.toList());
|
|
AtomicReference<BigDecimal> sum = new AtomicReference<>(new BigDecimal("0.0000"));
|
|
AtomicReference<BigDecimal> sum = new AtomicReference<>(new BigDecimal("0.0000"));
|
|
// 遍历数据 之前的已经经过了计算
|
|
// 遍历数据 之前的已经经过了计算
|
|
costDepartmentProfitVOS.forEach(i -> {
|
|
costDepartmentProfitVOS.forEach(i -> {
|
|
@@ -493,7 +503,7 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
|
|
throw new CostException(500, "报表未找到");
|
|
throw new CostException(500, "报表未找到");
|
|
}
|
|
}
|
|
BigDecimal amount = getAmount(costDepartmentProfitVOS1, costShareLevelList, responsibilityCode, list, allocationQueryReportVOList, reportRelationMap, allocationList, listMap,allList);
|
|
BigDecimal amount = getAmount(costDepartmentProfitVOS1, costShareLevelList, responsibilityCode, list, allocationQueryReportVOList, reportRelationMap, allocationList, listMap,allList);
|
|
- sum.updateAndGet(v -> v.add(amount));
|
|
|
|
|
|
+ sum.set(amount.add(sum.get()));;
|
|
});
|
|
});
|
|
// costDepartmentProfitVO.setAmount(new BigDecimal(sum.toString()));
|
|
// costDepartmentProfitVO.setAmount(new BigDecimal(sum.toString()));
|
|
return sum.get();
|
|
return sum.get();
|