Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

hr vor 4 Jahren
Ursprung
Commit
c1f8c2c836

+ 2 - 0
src/main/java/com/imed/costaccount/service/impl/AllocationServiceImpl.java

@@ -664,11 +664,13 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
                     if (CollUtil.isNotEmpty(allocations1)) {
                         allocations1.forEach(m -> {
                             money.updateAndGet(v -> v.add(m.getAmount()));
+//                            System.out.println(m.getAmount());
                         });
                     } else {
                         // TODO 封装测试数据
                         shareMoney.add("0");
                     }
+//                    System.out.println("第"+j+"次"+money);
                     shareMoney.add(money.toString());
                 }
             }

+ 40 - 26
src/main/java/com/imed/costaccount/service/impl/CostDepartmentProfitServiceImpl.java

@@ -84,7 +84,8 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
                 .eq(CostDepartmentProfit::getHospId, hospId)
                 .eq(StrUtil.isNotBlank(responsibilityCode), CostDepartmentProfit::getResponsibilityCode, responsibilityCode)
                 .eq(StrUtil.isNotBlank(date), CostDepartmentProfit::getYear, year)
-                .eq(StrUtil.isNotBlank(date), CostDepartmentProfit::getMonth, month).ne(CostDepartmentProfit::getCalcType, NumberConstant.ZERO));
+                .eq(StrUtil.isNotBlank(date), CostDepartmentProfit::getMonth, month)
+                .ne(CostDepartmentProfit::getCalcType, NumberConstant.ZERO).orderByDesc(CostDepartmentProfit::getAmount));
         List<CostDepartmentProfit> records = pages.getRecords();
         List<CostDepartmentProfitVO> costDepartmentProfitVOList = BeanUtil.convertList(records, CostDepartmentProfitVO.class);
         PageUtils pageUtils = new PageUtils(pages);
@@ -181,32 +182,44 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
         Map<Long, List<CostDepartmentProfitVO>> listMap = list.stream().collect(Collectors.groupingBy(CostDepartmentProfitVO::getReportId));
         // 记录每一次计算的钱
         list.forEach(i -> {
-            Integer calcType = i.getCostType();
-            switch (calcType) {
-                case 1:
-                    // TODO 按照会计科目进行计算
-                    i.setAmount(setAccountReportData(i, incomeList, allocationQueryReportVOList, reportRelationMap));
-                    break;
-                case 2:
-                    // TODO 按照分摊层级进行计算
-                    i.setAmount(setShareLevelReportData(i, costShareLevelList, reportRelationMap, allocationList));
-                    break;
-                case 3:
-                    // TODO 按照小计进行计算
-                    i.setAmount(setSubtotal(i, costShareLevelList, listMap, list, incomeList, allocationQueryReportVOList, reportRelationMap, allocationList));
-                    break;
-                case 4:
-                    // TODO 按照计算公式进行计算
-                    i.setAmount(setCalculation(i, list, costShareLevelList, listMap, incomeList, allocationQueryReportVOList, reportRelationMap, allocationList));
-                    break;
-                case 5:
-                    // TODO  按照责任中心进行计算
-                    i.setAmount(setResponsibilityCode(i, reportRelationMap, allocationList));
-                    break;
-                default:
-                    i.setAmount(new BigDecimal("0.0000"));
-                    break;
+            Integer calcType = i.getCalcType();
+            if (NumberConstant.ONE.equals(calcType)){
+                // TODO 按照会计科目进行计算
+                i.setAmount(setAccountReportData(i, incomeList, allocationQueryReportVOList, reportRelationMap));
+            }else if (NumberConstant.TWO.equals(calcType)){
+                // TODO 按照分摊层级进行计算
+                i.setAmount(setShareLevelReportData(i, costShareLevelList, reportRelationMap, allocationList));
+            }else if (NumberConstant.THREE.equals(calcType)){
+                // TODO 按照小计进行计算
+                i.setAmount(setSubtotal(i, costShareLevelList, listMap, list, incomeList, allocationQueryReportVOList, reportRelationMap, allocationList));
+            }else if (NumberConstant.FOUR.equals(calcType)){
+                // TODO 按照计算公式进行计算
+                i.setAmount(setCalculation(i, list, costShareLevelList, listMap, incomeList, allocationQueryReportVOList, reportRelationMap, allocationList));
+            }else if (NumberConstant.FIVE.equals(calcType)){
+                // TODO  按照责任中心进行计算
+                i.setAmount(setResponsibilityCode(i, reportRelationMap, allocationList));
+            }else {
+                i.setAmount(new BigDecimal("0.0000"));
             }
+//            switch (calcType) {
+//                case 1:
+//
+//                    break;
+//                case 2:
+//
+//                    break;
+//                case 3:
+//
+//                    break;
+//                case 4:
+//
+//                    break;
+//                case 5:
+//
+//                    break;
+//                default:
+//                    break;
+//            }
         });
         // 删除这个年月的数据
         this.remove(new QueryWrapper<CostDepartmentProfit>().lambda().eq(CostDepartmentProfit::getHospId, hospId)
@@ -256,6 +269,7 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
      */
     private BigDecimal setAccountReportData(CostDepartmentProfitVO i, List<IncomeCollection> list, List<AllocationQueryReportVO> allocationQueryReportVOList, Map<Long, List<ReportRelation>> reportRelationMap) {
         // 在报表关联里面查询当前报表关联的
+        Long reportId = i.getReportId();
         List<ReportRelation> reportRelationList = reportRelationMap.get(i.getReportId());
         AtomicReference<BigDecimal> sum = new AtomicReference<>(new BigDecimal("0.000"));
         if (CollUtil.isNotEmpty(reportRelationList)) {