Переглянути джерело

08 20 02 计算数值修改

hr 4 роки тому
батько
коміт
74ac81a6f6

+ 19 - 16
src/main/java/com/imed/costaccount/service/impl/CostCostingGroupServiceImpl.java

@@ -123,7 +123,7 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
     }
 
     /**
-     * 开始归集代码
+     * 开始成本分摊
      *
      * @param startDTO {@link StartDTO}
      * @param hospId   医院id
@@ -131,21 +131,24 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
     public void startAllocation(StartDTO startDTO, Long hospId) {
-//        // 先拿到这个月数据 如果数据量很大 优化处理
-//        List<CostCostingGroup> list = this.list(
-//                new LambdaQueryWrapper<CostCostingGroup>()
-//                        .eq(CostCostingGroup::getDateYear, startDTO.getYear())
-//                        .eq(CostCostingGroup::getDateMonth, startDTO.getMonth())
-//                        .eq(CostCostingGroup::getHospId, hospId)
-//        );
-//
-//        // 删除该年月已经归集过的数据
-//        costingCollectionService.remove(
-//                new LambdaQueryWrapper<CostCostingCollection>()
-//                        .eq(CostCostingCollection::getYear, startDTO.getYear())
-//                        .eq(CostCostingCollection::getMonth, startDTO.getMonth())
-//                        .eq(CostCostingCollection::getHospId, hospId)
-//        );
+        // 先拿到这个月数据 如果数据量很大 优化处理
+        List<CostCostingGroup> list = this.list(
+                new LambdaQueryWrapper<CostCostingGroup>()
+                        .eq(CostCostingGroup::getDateYear, startDTO.getYear())
+                        .eq(CostCostingGroup::getDateMonth, startDTO.getMonth())
+                        .eq(CostCostingGroup::getHospId, hospId)
+        );
+
+        // 删除该年月已经过的数据
+        costingCollectionService.remove(
+                new LambdaQueryWrapper<CostCostingCollection>()
+                        .eq(CostCostingCollection::getYear, startDTO.getYear())
+                        .eq(CostCostingCollection::getMonth, startDTO.getMonth())
+                        .eq(CostCostingCollection::getHospId, hospId)
+        );
+        // 得到分摊层级为1 的
+//        list.stream().map(get)
+
     }
 
     /**

+ 2 - 4
src/main/java/com/imed/costaccount/service/impl/ShareParamValueServiceImpl.java

@@ -474,15 +474,13 @@ public class ShareParamValueServiceImpl extends ServiceImpl<ShareParamValueMappe
         }
 
         Map<String, List<IncomeCollection>> collectMap = incomeCollections.stream()
-                .collect(Collectors.groupingBy(i->i.getResponsibilityCode() + "cost" + i.getAccountingCode()));
+                .collect(Collectors.groupingBy(i -> i.getResponsibilityCode() + "cost" + i.getAccountingCode()));
         Set<String> strings = collectMap.keySet();
         Map<String, BigDecimal> map = new ConcurrentHashMap<>();
         strings.forEach(str -> {
             List<IncomeCollection> collections = collectMap.get(str);
             if (CollUtil.isNotEmpty(collections)) {
-                BigDecimal reduce = incomeCollections.stream().map(IncomeCollection::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-                IncomeCollection incomeCollection = incomeCollections.get(0);
-                incomeCollection.setAmount(reduce);
+                BigDecimal reduce = collections.stream().map(IncomeCollection::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
                 map.put(str, reduce);
             }
         });