Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/master'

liuyc 2 rokov pred
rodič
commit
40231dac9c

+ 6 - 0
blade-service/blade-control/src/main/java/org/springblade/control/service/IEmployeeTaskInfoService.java

@@ -55,6 +55,12 @@ public interface IEmployeeTaskInfoService extends BaseService<EmployeeTaskInfo>
     //根据年查询当年所有的维护支出,并按照项目分组,组里的数据是项目年支出,如果该项目没有支出将不会插入
     Map<Long,BigDecimal> getAllMaintainSalaryByYear3(int y);
 
+    //根据年查询所有维护支出,按月分组,当月没有支出将不会插入
+    Map<Integer, BigDecimal> getAllMaintainSalaryByYear4(int y);
+
+    //根据年查询所有维护支出,按部门分组,再按月统计
+    Map<Long,Map<Integer, BigDecimal>> getAllMaintainSalaryByYear5(int y);
+
     //获取项目的所有维护支出,按环节分组,如果该环节没有支出,将不会插入
     Map<Long,BigDecimal> getAllMaintainSalaryByProject(Long projectId);
 

+ 16 - 7
blade-service/blade-control/src/main/java/org/springblade/control/service/impl/AnnualBudgetServiceImpl.java

@@ -988,10 +988,9 @@ public class AnnualBudgetServiceImpl extends BaseServiceImpl<AnnualBudgetMapper,
         //获取所有项目当年每月的实际回款
         List<BigDecimal> returned2 = returnedInfoService.getAllMonthReturnedByYear(y,2);
         //获取每月实际的人工支出
-//        List<BigDecimal> staffCost = budgetService.getAllMonthStaffCostByYear(y);
         Map<Integer, BigDecimal> costMap = employeeTaskInfoService.getAllEmployeeSalaryByYear4(y);
         //获取每月实际的维护支出
-        List<BigDecimal> maintainCost = budgetService.getAllMonthMaintainCostByYear(y);
+        Map<Integer, BigDecimal> maintainCost = employeeTaskInfoService.getAllMaintainSalaryByYear4(y);
         //获取每月实际的报销支出
         List<BigDecimal> reimburse = projectInfoService.getAllMonthReimburseByYear(y);
         //结果集
@@ -1036,11 +1035,16 @@ public class AnnualBudgetServiceImpl extends BaseServiceImpl<AnnualBudgetMapper,
             c5 = c5.add(returned2.get(i-1));
             //实际每月支出
             BigDecimal big = new BigDecimal(0);
+            //人工支出
             if (costMap != null && costMap.get(i) != null){
                 big = costMap.get(i);
             }
-            vo1.setDisburse3(big.add(maintainCost.get(i-1).add(reimburse.get(i-1))));
-            c6 = c6.add(big.add(maintainCost.get(i-1).add(reimburse.get(i-1))));
+            //维护支出
+            if (maintainCost != null && maintainCost.get(i) != null){
+                big = big.add(maintainCost.get(i));
+            }
+            vo1.setDisburse3(big.add(reimburse.get(i-1)));
+            c6 = c6.add(big.add(reimburse.get(i-1)));
 
         list.add(vo1);
         }
@@ -1071,8 +1075,8 @@ public class AnnualBudgetServiceImpl extends BaseServiceImpl<AnnualBudgetMapper,
         Map<Long, Map<Integer, BigDecimal>> budgetMap = employeeTaskInfoService.getAllBudgetSalaryByYear2(y);
         //实际人工支出
         Map<Long, Map<Integer, BigDecimal>> costMap = employeeTaskInfoService.getAllEmployeeSalaryByYear5(y);
-        //维护支出,返回null证明没有
-        Map<Integer, List<BigDecimal>> maintainMap = budgetService.getAllMaintainCost9(y);
+        //维护支出
+        Map<Long, Map<Integer, BigDecimal>> maintainMap = employeeTaskInfoService.getAllMaintainSalaryByYear5(y);
         //报销支出
         Map<Long, Map<Integer, BigDecimal>> reimburseMap = projectInfoService.getThisYearAllReimburseByYear2(y);
         //循环12个月,为每个月设置值
@@ -1095,6 +1099,11 @@ public class AnnualBudgetServiceImpl extends BaseServiceImpl<AnnualBudgetMapper,
                 if (costMap != null && costMap.get(dept.getId()) != null && costMap.get(dept.getId()).get(i) != null){
                     b2 = costMap.get(dept.getId()).get(i);
                 }
+                //维护支出
+                if (maintainMap != null && maintainMap.get(dept.getId()) != null && maintainMap.get(dept.getId()).get(i) != null){
+                    b2 = b2.add(maintainMap.get(dept.getId()).get(i));
+                }
+                //报销支出
                 if (reimburseMap != null && reimburseMap.get(dept.getId()) != null && reimburseMap.get(dept.getId()).get(i) != null){
                     b2 = b2.add(reimburseMap.get(dept.getId()).get(i));
                 }
@@ -1934,7 +1943,7 @@ public class AnnualBudgetServiceImpl extends BaseServiceImpl<AnnualBudgetMapper,
         //人工支出
         BigDecimal disburse = employeeTaskInfoService.getAllEmployeeSalaryByYear(y);
         //维护支出
-        BigDecimal maintainCost = budgetService.getAllMaintainCost(y);
+        BigDecimal maintainCost = employeeTaskInfoService.getAllMaintainSalaryByYear(y);
         //报销支出
         BigDecimal decimal = projectInfoService.getThisYearReimburse(y);
         vo.setPracticalOutput(disburse.add(maintainCost).add(decimal));

+ 48 - 0
blade-service/blade-control/src/main/java/org/springblade/control/service/impl/EmployeeTaskInfoServiceImpl.java

@@ -130,6 +130,54 @@ public class EmployeeTaskInfoServiceImpl extends BaseServiceImpl<EmployeeTaskInf
         return null;
     }
 
+    /**
+     * 根据年查询所有维护支出,按月分组,当月没有支出将不会插入
+     * @param y
+     * @return
+     */
+    @Override
+    public Map<Integer, BigDecimal> getAllMaintainSalaryByYear4(int y) {
+        List<EmployeeTaskInfo> list = baseMapper.getAllMaintainSalaryByYear2(y);
+        if (list != null && list.size() > 0){
+            //按项目分组
+            Map<Integer, BigDecimal> monthMap = list.stream().collect(
+                    Collectors.groupingBy(
+                            o -> o.getOneDay().getMonthValue(),
+                            Collectors.mapping(EmployeeTaskInfo::getEmployeeSalary, Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))
+                    ));
+            return monthMap;
+        }
+        return null;
+    }
+
+    /**
+     * 根据年查询所有维护支出,按部门分组,再按月统计
+     * @param y
+     * @return
+     */
+    @Override
+    public Map<Long, Map<Integer, BigDecimal>> getAllMaintainSalaryByYear5(int y) {
+        List<EmployeeTaskInfo> list = baseMapper.getAllMaintainSalaryByYear2(y);
+        if (list != null && list.size() > 0){
+            Map<Long, Map<Integer, BigDecimal>> map = new HashMap<>();
+            Map<Long, List<EmployeeTaskInfo>> listMap = list.parallelStream()
+                    .collect(Collectors.groupingBy(EmployeeTaskInfo::getDeptId));
+            for (Long aLong : listMap.keySet()) {
+                //该项目所有支出
+                List<EmployeeTaskInfo> infoList = listMap.get(aLong);
+                //按月份分组
+                Map<Integer, BigDecimal> monthMap = infoList.stream().collect(
+                        Collectors.groupingBy(
+                                o -> o.getOneDay().getMonthValue(),
+                                Collectors.mapping(EmployeeTaskInfo::getEmployeeSalary, Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))
+                        ));
+                map.put(aLong,monthMap);
+            }
+            return map;
+        }
+        return null;
+    }
+
     /**
      * 获取项目的所有支出,按环节分组,如果该环节没有支出,将不会插入
      * @param projectId