|
@@ -38,7 +38,8 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
|
|
|
private String fileTempPath;
|
|
|
|
|
|
@Value("${file.serverUrl}")
|
|
|
- private String FILE_PATH; private final CostCostingGroupService costCostingGroupService;
|
|
|
+ private String FILE_PATH;
|
|
|
+ private final CostCostingGroupService costCostingGroupService;
|
|
|
private final CostShareLevelService shareLevelService;
|
|
|
private final ResponsibilityService responsibilityService;
|
|
|
private final CostAccountShareService accountShareService;
|
|
@@ -74,8 +75,9 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
|
|
|
List<CostCostingGroup> costingGroups = costCostingGroupService.getByYearAndDate(startDTO.getYear(), startDTO.getMonth(), hospId);
|
|
|
// 没有重新导入
|
|
|
if (costingGroups.isEmpty()) {
|
|
|
- throw new CostException("本月分摊参数值数据未导入");
|
|
|
+ throw new CostException("本月分摊数据未导入");
|
|
|
}
|
|
|
+ // 导入数据按责任中心归类
|
|
|
Map<String, List<CostCostingGroup>> responsibilityCodeMap = costingGroups.stream().collect(Collectors.groupingBy(CostCostingGroup::getResponsibilityCode));
|
|
|
// 得到这个月导入的成本分摊参数值列表
|
|
|
List<ShareParamValue> shareParamValues = shareParamValueService.getListByYearAndMonth(startDTO.getYear(), startDTO.getMonth(), hospId);
|
|
@@ -93,7 +95,7 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
|
|
|
List<Allocation> allocations = new LinkedList<>();
|
|
|
// key 责任中心代码, value 分摊过来的钱
|
|
|
// Map<String, BigDecimal> costMap = new ConcurrentReaderHashMap();
|
|
|
- List<Allocation> costList = new ArrayList();
|
|
|
+ List<Allocation> costList = new ArrayList<>();
|
|
|
for (CostShareLevelVO shareLevelVO : shareLevelVOs) {
|
|
|
// 分摊层级id
|
|
|
Long levelId = shareLevelVO.getId();
|
|
@@ -135,7 +137,6 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
|
|
|
continue;
|
|
|
}
|
|
|
// 计算本次分摊的钱
|
|
|
-
|
|
|
BigDecimal totalAmount = this.getCostAmount(accountShare, calcType, responsibilityCodeMap, costList);
|
|
|
if (totalAmount.equals(BigDecimal.ZERO)) {
|
|
|
continue;
|
|
@@ -293,10 +294,6 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
|
|
|
List<Allocation> all = new ArrayList<>();
|
|
|
if (!costList.isEmpty()) {
|
|
|
all = costList.stream().filter(i -> i.getTargetResponsibilityCode().equals(responsibilityCode)).collect(Collectors.toList());
|
|
|
-// Stream<Allocation> allocationStream = costList.stream().filter(i -> i.getTargetResponsibilityCode().equals(responsibilityCode));
|
|
|
-// if (Objects.nonNull(allocationStream)) {
|
|
|
-// all = allocationStream.collect(Collectors.toList());
|
|
|
-// }
|
|
|
}
|
|
|
if (calcType == 0) {
|
|
|
costAmount = costingGroups.stream().map(CostCostingGroup::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|