Explorar o código

组织画像-明细-人均巡检问题数

chenshudong hai 4 meses
pai
achega
b8da05116c

+ 1 - 1
airport-admin/src/main/java/com/sundot/airport/web/controller/system/SysUserController.java

@@ -257,7 +257,7 @@ public class SysUserController extends BaseController {
257 257
 
258 258
         // 返回结果处理
259 259
         SysDept sysDept = deptService.selectDeptById(dto.getDeptId());
260
-        if (StrUtil.equals(DeptTypeEnum.STATION.getCode(), sysDept.getDeptType()) || StrUtil.equals(DeptTypeEnum.DEPARTMENT.getCode(), sysDept.getDeptType())) {
260
+        if (StrUtil.equals(DeptTypeEnum.STATION.getCode(), sysDept.getDeptType()) || StrUtil.equals(DeptTypeEnum.BRIGADE.getCode(), sysDept.getDeptType()) || StrUtil.equals(DeptTypeEnum.MANAGER.getCode(), sysDept.getDeptType())) {
261 261
             indicatorCalculateParams.setUserType(StrUtil.equals(DeptTypeEnum.STATION.getCode(), sysDept.getDeptType()) ? UserType.DEPARTMENT : UserType.TEAM);
262 262
             SysDept temp = new SysDept();
263 263
             temp.setParentId(dto.getDeptId());

+ 33 - 1
airport-check/src/main/java/com/sundot/airport/check/service/impl/CheckLargeScreenServiceImpl.java

@@ -1656,11 +1656,43 @@ public class CheckLargeScreenServiceImpl implements ICheckLargeScreenService {
1656 1656
                 }
1657 1657
             });
1658 1658
         }
1659
+        //补充被检查班科室数据
1660
+        List<Long> checkedTeamIdListTemp = all.stream().filter(item -> ObjectUtil.isNull(item.getCheckedDepartmentId())).map(CheckLargeScreenCorrectionPortraitSqlDto::getCheckedTeamId).distinct().collect(Collectors.toList());
1661
+        if (CollUtil.isNotEmpty(checkedTeamIdListTemp)) {
1662
+            List<SysDept> checkedTeamListTemp = sysDeptService.selectDeptByIdList(checkedTeamIdListTemp);
1663
+            if (CollUtil.isNotEmpty(checkedTeamListTemp)) {
1664
+                Map<Long, Long> deptIdMap = checkedTeamListTemp.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getParentId, (oldValue, newValue) -> newValue));
1665
+                List<Long> checkedDepartmentIdListTemp = checkedTeamListTemp.stream().map(SysDept::getParentId).collect(Collectors.toList());
1666
+                List<SysDept> checkedDepartmentListTemp = sysDeptService.selectDeptByIdList(checkedDepartmentIdListTemp);
1667
+                if (CollUtil.isNotEmpty(checkedDepartmentListTemp)) {
1668
+                    Map<Long, String> deptMap = checkedDepartmentListTemp.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName, (oldValue, newValue) -> newValue));
1669
+                    all.forEach(item -> {
1670
+                        if (ObjectUtil.isNull(item.getCheckedDepartmentId())) {
1671
+                            item.setCheckedDepartmentId(deptIdMap.getOrDefault(item.getCheckedTeamId(), 0L));
1672
+                            item.setCheckedTeamName(deptMap.getOrDefault(item.getCheckedDepartmentId(), ""));
1673
+                        }
1674
+                    });
1675
+                }
1676
+            }
1677
+        }
1659 1678
 
1660 1679
         // 对全量数据进行过滤+处理返回数据
1661 1680
         SysDept sysDept = sysDeptService.selectDeptById(dto.getDeptId());
1662 1681
         if (StrUtil.equals(DeptTypeEnum.STATION.getCode(), sysDept.getDeptType())) {
1663 1682
             List<CheckLargeScreenCorrectionPortraitSqlDto> target = all;
1683
+            Map<Long, String> map = target.stream().collect(Collectors.toMap(CheckLargeScreenCorrectionPortraitSqlDto::getCheckedBrigadeId, CheckLargeScreenCorrectionPortraitSqlDto::getCheckedBrigadeName, (oldValue, newValue) -> newValue));
1684
+            Map<Long, List<CheckLargeScreenCorrectionPortraitSqlDto>> groupingBy = target.stream().collect(Collectors.groupingBy(CheckLargeScreenCorrectionPortraitSqlDto::getCheckedBrigadeId));
1685
+            groupingBy.forEach((key, value) -> {
1686
+                SysLargeScreenDetailDto temp = new SysLargeScreenDetailDto();
1687
+                temp.setId(key);
1688
+                temp.setName(map.getOrDefault(key, ""));
1689
+                int sum = value.size();
1690
+                long count = value.stream().map(CheckLargeScreenCorrectionPortraitSqlDto::getUserId).distinct().count();
1691
+                temp.setCheckCount(BigDecimal.valueOf(sum).divide(BigDecimal.valueOf(count), 1, RoundingMode.HALF_UP));
1692
+                result.add(temp);
1693
+            });
1694
+        } else if (StrUtil.equals(DeptTypeEnum.BRIGADE.getCode(), sysDept.getDeptType())) {
1695
+            List<CheckLargeScreenCorrectionPortraitSqlDto> target = all.stream().filter(item -> ObjUtil.equals(item.getCheckedBrigadeId(), dto.getDeptId())).collect(Collectors.toList());
1664 1696
             Map<Long, String> map = target.stream().collect(Collectors.toMap(CheckLargeScreenCorrectionPortraitSqlDto::getCheckedDepartmentId, CheckLargeScreenCorrectionPortraitSqlDto::getCheckedDepartmentName, (oldValue, newValue) -> newValue));
1665 1697
             Map<Long, List<CheckLargeScreenCorrectionPortraitSqlDto>> groupingBy = target.stream().collect(Collectors.groupingBy(CheckLargeScreenCorrectionPortraitSqlDto::getCheckedDepartmentId));
1666 1698
             groupingBy.forEach((key, value) -> {
@@ -1672,7 +1704,7 @@ public class CheckLargeScreenServiceImpl implements ICheckLargeScreenService {
1672 1704
                 temp.setCheckCount(BigDecimal.valueOf(sum).divide(BigDecimal.valueOf(count), 1, RoundingMode.HALF_UP));
1673 1705
                 result.add(temp);
1674 1706
             });
1675
-        } else if (StrUtil.equals(DeptTypeEnum.DEPARTMENT.getCode(), sysDept.getDeptType())) {
1707
+        } else if (StrUtil.equals(DeptTypeEnum.MANAGER.getCode(), sysDept.getDeptType())) {
1676 1708
             List<CheckLargeScreenCorrectionPortraitSqlDto> target = all.stream().filter(item -> ObjUtil.equals(item.getCheckedDepartmentId(), dto.getDeptId())).collect(Collectors.toList());
1677 1709
             Map<Long, String> map = target.stream().collect(Collectors.toMap(CheckLargeScreenCorrectionPortraitSqlDto::getCheckedTeamId, CheckLargeScreenCorrectionPortraitSqlDto::getCheckedTeamName, (oldValue, newValue) -> newValue));
1678 1710
             Map<Long, List<CheckLargeScreenCorrectionPortraitSqlDto>> groupingBy = target.stream().collect(Collectors.groupingBy(CheckLargeScreenCorrectionPortraitSqlDto::getCheckedTeamId));