|
|
@@ -67,6 +67,7 @@ import com.sundot.airport.common.enums.MedalTypeEnum;
|
|
67
|
67
|
import com.sundot.airport.common.enums.RoleTypeEnum;
|
|
68
|
68
|
import com.sundot.airport.common.enums.SourceTypeEnum;
|
|
69
|
69
|
import com.sundot.airport.common.exception.ServiceException;
|
|
|
70
|
+import com.sundot.airport.common.utils.DeptUtils;
|
|
70
|
71
|
import com.sundot.airport.common.utils.LargeScreenDateUtils;
|
|
71
|
72
|
import com.sundot.airport.common.utils.SecurityUtils;
|
|
72
|
73
|
import com.sundot.airport.common.utils.StringUtils;
|
|
|
@@ -2797,6 +2798,9 @@ public class CheckLargeScreenServiceImpl implements ICheckLargeScreenService {
|
|
2797
|
2798
|
*/
|
|
2798
|
2799
|
@Override
|
|
2799
|
2800
|
public SysCheckAnalysisReportDto checkAnalysisReport(SysAnalysisReportParamDto paramDto) {
|
|
|
2801
|
+ if (ObjUtil.isNull(paramDto.getUserId()) && ObjUtil.isNull(paramDto.getDeptId())) {
|
|
|
2802
|
+ paramDto.setDeptId(DeptUtils.getTopSiteId(sysDeptService.selectDeptById(SecurityUtils.getDeptId())));
|
|
|
2803
|
+ }
|
|
2800
|
2804
|
SysCheckAnalysisReportDto result = new SysCheckAnalysisReportDto();
|
|
2801
|
2805
|
result.setCheckTaskDto(getCheckTaskDto(paramDto));
|
|
2802
|
2806
|
result.setCheckProblemDiscoveryDto(getCheckProblemDiscoveryDto(paramDto));
|
|
|
@@ -2812,13 +2816,53 @@ public class CheckLargeScreenServiceImpl implements ICheckLargeScreenService {
|
|
2812
|
2816
|
* @return 任务计划安排统计
|
|
2813
|
2817
|
*/
|
|
2814
|
2818
|
private SysCheckAnalysisReportCheckTaskDto getCheckTaskDto(SysAnalysisReportParamDto paramDto) {
|
|
|
2819
|
+ if (ObjectUtil.isNotNull(paramDto.getUserId())) {
|
|
|
2820
|
+ return null;
|
|
|
2821
|
+ }
|
|
|
2822
|
+ SysDept sysDept = sysDeptService.selectDeptById(paramDto.getDeptId());
|
|
|
2823
|
+ if (ObjUtil.isNull(sysDept)) {
|
|
|
2824
|
+ throw new ServiceException("【" + paramDto.getDeptId() + "】部门不存在");
|
|
|
2825
|
+ }
|
|
|
2826
|
+ if (!StrUtil.equals(DeptTypeEnum.STATION.getCode(), sysDept.getDeptType()) && !StrUtil.equals(DeptTypeEnum.BRIGADE.getCode(), sysDept.getDeptType()) && !StrUtil.equals(DeptTypeEnum.MANAGER.getCode(), sysDept.getDeptType())) {
|
|
|
2827
|
+ return null;
|
|
|
2828
|
+ }
|
|
|
2829
|
+ List<SysUser> sysUserList;
|
|
|
2830
|
+ if (StrUtil.equals(DeptTypeEnum.BRIGADE.getCode(), sysDept.getDeptType())) {
|
|
|
2831
|
+ sysUserList = sysUserService.selectUserListByRoleKeyAndDeptId(Arrays.asList(RoleTypeEnum.jingli.getCode(), RoleTypeEnum.xingzheng.getCode()), sysDept.getDeptId());
|
|
|
2832
|
+ } else if (StrUtil.equals(DeptTypeEnum.MANAGER.getCode(), sysDept.getDeptType())) {
|
|
|
2833
|
+ sysUserList = sysUserService.selectUserListByRoleKeyAndDeptId(Arrays.asList(RoleTypeEnum.kezhang.getCode()), sysDept.getDeptId());
|
|
|
2834
|
+ } else {
|
|
|
2835
|
+ sysUserList = Collections.emptyList();
|
|
|
2836
|
+ }
|
|
2815
|
2837
|
SysCheckAnalysisReportCheckTaskDto checkTaskDto = new SysCheckAnalysisReportCheckTaskDto();
|
|
2816
|
2838
|
List<SysCheckAnalysisReportCheckTaskItemDto> checkTaskItemDtoList = new ArrayList<>();
|
|
2817
|
2839
|
paramDto.getDateRangeList().forEach(dateRange -> {
|
|
|
2840
|
+ List<CheckTask> checkTaskList = Collections.emptyList();
|
|
2818
|
2841
|
CheckLargeScreenPlanQueryParamDto dto = new CheckLargeScreenPlanQueryParamDto();
|
|
2819
|
2842
|
dto.setStartDate(dateRange.getStartDate());
|
|
2820
|
2843
|
dto.setEndDate(dateRange.getEndDate());
|
|
2821
|
|
- List<CheckTask> checkTaskList = checkLargeScreenMapper.planStatistics(dto);
|
|
|
2844
|
+ if (StrUtil.equals(DeptTypeEnum.STATION.getCode(), sysDept.getDeptType())) {
|
|
|
2845
|
+ dto.setIsSelfCheck(null);
|
|
|
2846
|
+ dto.setCreateId(null);
|
|
|
2847
|
+ dto.setUserIdList(null);
|
|
|
2848
|
+ checkTaskList = checkLargeScreenMapper.planStatistics(dto);
|
|
|
2849
|
+ } else if (StrUtil.equals(DeptTypeEnum.BRIGADE.getCode(), sysDept.getDeptType())) {
|
|
|
2850
|
+ if (!CollUtil.isEmpty(sysUserList)) {
|
|
|
2851
|
+ List<Long> userIdList = sysUserList.stream().map(SysUser::getUserId).collect(Collectors.toList());
|
|
|
2852
|
+ dto.setIsSelfCheck(1);
|
|
|
2853
|
+ dto.setCreateId(null);
|
|
|
2854
|
+ dto.setUserIdList(userIdList);
|
|
|
2855
|
+ checkTaskList = checkLargeScreenMapper.planStatistics(dto);
|
|
|
2856
|
+ }
|
|
|
2857
|
+ } else {
|
|
|
2858
|
+ if (!CollUtil.isEmpty(sysUserList)) {
|
|
|
2859
|
+ List<Long> userIdList = sysUserList.stream().map(SysUser::getUserId).collect(Collectors.toList());
|
|
|
2860
|
+ dto.setIsSelfCheck(0);
|
|
|
2861
|
+ dto.setCreateId(null);
|
|
|
2862
|
+ dto.setUserIdList(userIdList);
|
|
|
2863
|
+ checkTaskList = checkLargeScreenMapper.planStatistics(dto);
|
|
|
2864
|
+ }
|
|
|
2865
|
+ }
|
|
2822
|
2866
|
Map<String, Long> map = checkTaskList.stream().collect(Collectors.groupingBy(CheckTask::getCheckCategory, Collectors.counting()));
|
|
2823
|
2867
|
|
|
2824
|
2868
|
SysCheckAnalysisReportCheckTaskItemDto itemDtoSpecialTask = new SysCheckAnalysisReportCheckTaskItemDto();
|
|
|
@@ -2985,12 +3029,23 @@ public class CheckLargeScreenServiceImpl implements ICheckLargeScreenService {
|
|
2985
|
3029
|
* @return 问题发现统计
|
|
2986
|
3030
|
*/
|
|
2987
|
3031
|
private SysCheckAnalysisReportCheckProblemDiscoveryDto getCheckProblemDiscoveryDto(SysAnalysisReportParamDto paramDto) {
|
|
|
3032
|
+ List<Long> userIdList = new ArrayList<>();
|
|
|
3033
|
+ if (ObjUtil.isNotNull(paramDto.getUserId())) {
|
|
|
3034
|
+ userIdList.add(paramDto.getUserId());
|
|
|
3035
|
+ } else {
|
|
|
3036
|
+ List<SysUser> sysUserList = sysUserService.selectUserByDeptId(paramDto.getDeptId());
|
|
|
3037
|
+ if (ObjUtil.isEmpty(sysUserList)) {
|
|
|
3038
|
+ return null;
|
|
|
3039
|
+ }
|
|
|
3040
|
+ userIdList.addAll(sysUserList.stream().map(SysUser::getUserId).collect(Collectors.toList()));
|
|
|
3041
|
+ }
|
|
2988
|
3042
|
SysCheckAnalysisReportCheckProblemDiscoveryDto checkProblemDiscoveryDto = new SysCheckAnalysisReportCheckProblemDiscoveryDto();
|
|
2989
|
3043
|
List<SysCheckAnalysisReportCheckProblemDiscoveryItemDto> checkProblemDiscoveryItemDtoList = new ArrayList<>();
|
|
2990
|
3044
|
paramDto.getDateRangeList().forEach(dateRange -> {
|
|
2991
|
3045
|
CheckLargeScreenPlanQueryParamDto dto = new CheckLargeScreenPlanQueryParamDto();
|
|
2992
|
3046
|
dto.setStartDate(dateRange.getStartDate());
|
|
2993
|
3047
|
dto.setEndDate(dateRange.getEndDate());
|
|
|
3048
|
+ dto.setUserIdList(userIdList);
|
|
2994
|
3049
|
BigDecimal count = checkLargeScreenMapper.problemDistributionTotal(dto);
|
|
2995
|
3050
|
SysCheckAnalysisReportCheckProblemDiscoveryItemDto checkProblemDiscoveryItemDto = new SysCheckAnalysisReportCheckProblemDiscoveryItemDto();
|
|
2996
|
3051
|
checkProblemDiscoveryItemDto.setStartDate(dateRange.getStartDate());
|
|
|
@@ -3071,11 +3126,22 @@ public class CheckLargeScreenServiceImpl implements ICheckLargeScreenService {
|
|
3071
|
3126
|
* @return 问题分布统计
|
|
3072
|
3127
|
*/
|
|
3073
|
3128
|
private SysCheckAnalysisReportCheckProblemDistributionDto getCheckProblemDistributionDto(SysAnalysisReportParamDto paramDto) {
|
|
|
3129
|
+ List<Long> userIdList = new ArrayList<>();
|
|
|
3130
|
+ if (ObjUtil.isNotNull(paramDto.getUserId())) {
|
|
|
3131
|
+ userIdList.add(paramDto.getUserId());
|
|
|
3132
|
+ } else {
|
|
|
3133
|
+ List<SysUser> sysUserList = sysUserService.selectUserByDeptId(paramDto.getDeptId());
|
|
|
3134
|
+ if (ObjUtil.isEmpty(sysUserList)) {
|
|
|
3135
|
+ return null;
|
|
|
3136
|
+ }
|
|
|
3137
|
+ userIdList.addAll(sysUserList.stream().map(SysUser::getUserId).collect(Collectors.toList()));
|
|
|
3138
|
+ }
|
|
3074
|
3139
|
SysCheckAnalysisReportCheckProblemDistributionDto checkProblemDistributionDto = new SysCheckAnalysisReportCheckProblemDistributionDto();
|
|
3075
|
3140
|
SysAnalysisReportDateRangeDto currentDateRangeDto = paramDto.getDateRangeList().stream().filter(dateRange -> StrUtil.equals(CompareTypeEnum.CURRENT.getCode(), dateRange.getTag())).findFirst().orElse(null);
|
|
3076
|
3141
|
BaseLargeScreenQueryParamDto queryParamDto = new BaseLargeScreenQueryParamDto();
|
|
3077
|
3142
|
queryParamDto.setStartDate(currentDateRangeDto.getStartDate());
|
|
3078
|
3143
|
queryParamDto.setEndDate(currentDateRangeDto.getEndDate());
|
|
|
3144
|
+ queryParamDto.setUserIdList(userIdList);
|
|
3079
|
3145
|
List<SysCheckAnalysisReportCheckProblemDistributionItemDto> checkProblemDistributionItemDtoList = checkLargeScreenMapper.problemDistributionStatistics(queryParamDto);
|
|
3080
|
3146
|
checkProblemDistributionDto.setCheckProblemDistributionItemDtoList(checkProblemDistributionItemDtoList);
|
|
3081
|
3147
|
if (CollUtil.isEmpty(checkProblemDistributionItemDtoList)) {
|
|
|
@@ -3108,59 +3174,189 @@ public class CheckLargeScreenServiceImpl implements ICheckLargeScreenService {
|
|
3108
|
3174
|
private SysCheckAnalysisReportCheckProblemCorrectionDto getCheckProblemCorrectionDto(SysAnalysisReportParamDto paramDto) {
|
|
3109
|
3175
|
SysCheckAnalysisReportCheckProblemCorrectionDto checkProblemCorrectionDto = new SysCheckAnalysisReportCheckProblemCorrectionDto();
|
|
3110
|
3176
|
List<SysCheckAnalysisReportCheckProblemCorrectionItemDto> checkProblemCorrectionItemDtoList = new ArrayList<>();
|
|
|
3177
|
+ checkProblemCorrectionDto.setCheckProblemCorrectionItemDtoList(checkProblemCorrectionItemDtoList);
|
|
3111
|
3178
|
SysAnalysisReportDateRangeDto currentDateRangeDto = paramDto.getDateRangeList().stream().filter(dateRange -> StrUtil.equals(CompareTypeEnum.CURRENT.getCode(), dateRange.getTag())).findFirst().orElse(null);
|
|
3112
|
|
- BaseLargeScreenQueryParamDto queryParamDto = new BaseLargeScreenQueryParamDto();
|
|
3113
|
|
- queryParamDto.setStartDate(currentDateRangeDto.getStartDate());
|
|
3114
|
|
- queryParamDto.setEndDate(currentDateRangeDto.getEndDate());
|
|
3115
|
|
- List<SysCheckAnalysisReportCheckProblemCorrectionItemDto> tempCheckProblemCorrectionItemDtoList = checkLargeScreenMapper.problemCorrectionStatistics(queryParamDto);
|
|
3116
|
|
- if (CollUtil.isEmpty(tempCheckProblemCorrectionItemDtoList)) {
|
|
|
3179
|
+
|
|
|
3180
|
+ CheckLargeScreenCorrectionQueryParamDto tempQueryParam = new CheckLargeScreenCorrectionQueryParamDto();
|
|
|
3181
|
+ tempQueryParam.setStartDate(currentDateRangeDto.getStartDate());
|
|
|
3182
|
+ tempQueryParam.setEndDate(currentDateRangeDto.getEndDate());
|
|
|
3183
|
+ List<CheckLargeScreenCorrectionPortraitSqlDto> all = checkLargeScreenMapper.portrait(tempQueryParam);
|
|
|
3184
|
+ if (CollUtil.isEmpty(all)) {
|
|
3117
|
3185
|
return null;
|
|
3118
|
3186
|
}
|
|
3119
|
|
- Map<Long, SysCheckAnalysisReportCheckProblemCorrectionItemDto> deptMap = tempCheckProblemCorrectionItemDtoList.stream().collect(Collectors.toMap(SysCheckAnalysisReportCheckProblemCorrectionItemDto::getDeptId, item -> item, (oldValue, newValue) -> newValue));
|
|
|
3187
|
+ //补充检查级别为站级的整改单中的被检查班组数据
|
|
|
3188
|
+ List<Long> userIdList = all.stream().filter(item -> ObjectUtil.isNull(item.getCheckedTeamId())).map(CheckLargeScreenCorrectionPortraitSqlDto::getUserId).distinct().collect(Collectors.toList());
|
|
|
3189
|
+ if (CollUtil.isNotEmpty(userIdList)) {
|
|
|
3190
|
+ List<SysUser> sysUserList = sysUserService.selectByUserIdList(userIdList);
|
|
|
3191
|
+ Map<Long, Long> sysUserMap = sysUserList.stream().collect(Collectors.toMap(SysUser::getUserId, SysUser::getDeptId, (oldValue, newValue) -> newValue));
|
|
|
3192
|
+ List<Long> deptIdList = sysUserList.stream().map(SysUser::getDeptId).distinct().collect(Collectors.toList());
|
|
|
3193
|
+ List<SysDept> deptList = sysDeptService.selectDeptByIdList(deptIdList);
|
|
|
3194
|
+ Map<Long, String> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName, (oldValue, newValue) -> newValue));
|
|
|
3195
|
+ all.forEach(item -> {
|
|
|
3196
|
+ if (ObjectUtil.isNull(item.getCheckedTeamId())) {
|
|
|
3197
|
+ item.setCheckedTeamId(sysUserMap.getOrDefault(item.getUserId(), 0L));
|
|
|
3198
|
+ item.setCheckedTeamName(deptMap.getOrDefault(item.getCheckedTeamId(), ""));
|
|
|
3199
|
+ }
|
|
|
3200
|
+ });
|
|
|
3201
|
+ }
|
|
|
3202
|
+ //补充被检查班科室数据
|
|
|
3203
|
+ List<Long> checkedTeamIdListTemp = all.stream().filter(item -> ObjectUtil.isNull(item.getCheckedDepartmentId())).map(CheckLargeScreenCorrectionPortraitSqlDto::getCheckedTeamId).distinct().collect(Collectors.toList());
|
|
|
3204
|
+ if (CollUtil.isNotEmpty(checkedTeamIdListTemp)) {
|
|
|
3205
|
+ List<SysDept> checkedTeamListTemp = sysDeptService.selectDeptByIdList(checkedTeamIdListTemp);
|
|
|
3206
|
+ if (CollUtil.isNotEmpty(checkedTeamListTemp)) {
|
|
|
3207
|
+ Map<Long, Long> deptIdMap = checkedTeamListTemp.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getParentId, (oldValue, newValue) -> newValue));
|
|
|
3208
|
+ List<Long> checkedDepartmentIdListTemp = checkedTeamListTemp.stream().map(SysDept::getParentId).collect(Collectors.toList());
|
|
|
3209
|
+ List<SysDept> checkedDepartmentListTemp = sysDeptService.selectDeptByIdList(checkedDepartmentIdListTemp);
|
|
|
3210
|
+ if (CollUtil.isNotEmpty(checkedDepartmentListTemp)) {
|
|
|
3211
|
+ Map<Long, String> deptMap = checkedDepartmentListTemp.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName, (oldValue, newValue) -> newValue));
|
|
|
3212
|
+ all.forEach(item -> {
|
|
|
3213
|
+ if (ObjectUtil.isNull(item.getCheckedDepartmentId())) {
|
|
|
3214
|
+ item.setCheckedDepartmentId(deptIdMap.getOrDefault(item.getCheckedTeamId(), 0L));
|
|
|
3215
|
+ item.setCheckedDepartmentName(deptMap.getOrDefault(item.getCheckedDepartmentId(), ""));
|
|
|
3216
|
+ }
|
|
|
3217
|
+ });
|
|
|
3218
|
+ }
|
|
|
3219
|
+ }
|
|
|
3220
|
+ }
|
|
3120
|
3221
|
|
|
3121
|
|
- SysCheckAnalysisReportCheckProblemCorrectionItemDto maxItemDto = tempCheckProblemCorrectionItemDtoList.stream()
|
|
3122
|
|
- .filter(p -> p.getOnTimeCompletedCount() != null && p.getOnTimeCompletedCount().compareTo(BigDecimal.ZERO) > 0)
|
|
3123
|
|
- .max(Comparator.comparing(SysCheckAnalysisReportCheckProblemCorrectionItemDto::getOnTimeCompletedCount))
|
|
3124
|
|
- .orElse(null);
|
|
3125
|
|
- if (ObjUtil.isNotNull(maxItemDto)) {
|
|
3126
|
|
- String desc = maxItemDto.getDeptName() + "的按时整改率更高、整改更及时,是当时整改工作落实较好的科室";
|
|
|
3222
|
+ if (ObjUtil.isNotNull(paramDto.getUserId())) {
|
|
|
3223
|
+ List<CheckLargeScreenCorrectionPortraitSqlDto> targetList = all.stream().filter(item -> ObjUtil.equals(paramDto.getUserId(), item.getUserId())).collect(Collectors.toList());
|
|
|
3224
|
+ if (CollUtil.isEmpty(targetList)) {
|
|
|
3225
|
+ return null;
|
|
|
3226
|
+ }
|
|
|
3227
|
+ SysCheckAnalysisReportCheckProblemCorrectionItemDto individual = new SysCheckAnalysisReportCheckProblemCorrectionItemDto();
|
|
|
3228
|
+ SysUser sysUser = sysUserService.selectUserById(paramDto.getUserId());
|
|
|
3229
|
+ individual.setDeptId(sysUser.getUserId());
|
|
|
3230
|
+ individual.setDeptName(sysUser.getNickName());
|
|
|
3231
|
+ individual.setOnTimeCompletedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_COMPLETED.getCode(), item.getCorrectionType())).count()));
|
|
|
3232
|
+ individual.setOverTimeCompletedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OVER_TIME_COMPLETED.getCode(), item.getCorrectionType())).count()));
|
|
|
3233
|
+ individual.setOnTimeUnfinishedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_UNFINISHED.getCode(), item.getCorrectionType())).count()));
|
|
|
3234
|
+ individual.setOverTimeUnfinishedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OVER_TIME_UNFINISHED.getCode(), item.getCorrectionType())).count()));
|
|
|
3235
|
+ individual.setOtherCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OTHER.getCode(), item.getCorrectionType())).count()));
|
|
|
3236
|
+ String desc = "按期整改" + individual.getOnTimeCompletedCount().add(individual.getOnTimeUnfinishedCount()) + "个,超期整改" + individual.getOverTimeCompletedCount().add(individual.getOverTimeUnfinishedCount()) + "个";
|
|
3127
|
3237
|
checkProblemCorrectionDto.setDesc(desc);
|
|
3128
|
|
- }
|
|
|
3238
|
+ checkProblemCorrectionItemDtoList.add(individual);
|
|
|
3239
|
+ } else {
|
|
|
3240
|
+ SysDept sysDept = sysDeptService.selectDeptById(paramDto.getDeptId());
|
|
|
3241
|
+ List<SysUser> sysUserList = sysUserService.selectUserByDeptId(sysDept.getDeptId());
|
|
|
3242
|
+ if (CollUtil.isEmpty(sysUserList)) {
|
|
|
3243
|
+ return null;
|
|
|
3244
|
+ }
|
|
|
3245
|
+ List<Long> targetUserIdList = sysUserList.stream().map(SysUser::getUserId).collect(Collectors.toList());
|
|
|
3246
|
+ List<CheckLargeScreenCorrectionPortraitSqlDto> targetList = all.stream().filter(item -> targetUserIdList.contains(item.getUserId())).collect(Collectors.toList());
|
|
|
3247
|
+ if (CollUtil.isEmpty(targetList)) {
|
|
|
3248
|
+ return null;
|
|
|
3249
|
+ }
|
|
|
3250
|
+ if (StrUtil.equals(sysDept.getDeptType(), DeptTypeEnum.STATION.getCode())) {
|
|
|
3251
|
+ Map<String, Long> descMap = targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_COMPLETED.getCode(), item.getCorrectionType())).collect(Collectors.groupingBy(item -> item.getCheckedBrigadeId() + "###" + item.getCheckedBrigadeName(), Collectors.counting()));
|
|
|
3252
|
+ String key = descMap.entrySet().stream()
|
|
|
3253
|
+ .max(Map.Entry.comparingByValue())
|
|
|
3254
|
+ .map(Map.Entry::getKey)
|
|
|
3255
|
+ .orElse(null);
|
|
|
3256
|
+ if (ObjUtil.isNotNull(key)) {
|
|
|
3257
|
+ String desc = key.split("###")[1] + "的按时整改率更高、整改更及时,是当时整改工作落实较好的大队";
|
|
|
3258
|
+ checkProblemCorrectionDto.setDesc(desc);
|
|
|
3259
|
+ }
|
|
|
3260
|
+
|
|
|
3261
|
+ Map<Long, List<CheckLargeScreenCorrectionPortraitSqlDto>> deptMap = targetList.stream().collect(Collectors.groupingBy(CheckLargeScreenCorrectionPortraitSqlDto::getCheckedBrigadeId));
|
|
|
3262
|
+ SysDept deptQuery = new SysDept();
|
|
|
3263
|
+ deptQuery.setParentId(sysDept.getDeptId());
|
|
|
3264
|
+ deptQuery.setDeptType(DeptTypeEnum.BRIGADE.getCode());
|
|
|
3265
|
+ List<SysDept> sysDeptList = sysDeptService.selectDeptInfoAll(deptQuery);
|
|
|
3266
|
+ sysDeptList.forEach(dept -> {
|
|
|
3267
|
+ SysCheckAnalysisReportCheckProblemCorrectionItemDto itemDto = new SysCheckAnalysisReportCheckProblemCorrectionItemDto();
|
|
|
3268
|
+ itemDto.setDeptId(dept.getDeptId());
|
|
|
3269
|
+ itemDto.setDeptName(dept.getDeptName());
|
|
|
3270
|
+ List<CheckLargeScreenCorrectionPortraitSqlDto> list = deptMap.get(dept.getDeptId());
|
|
|
3271
|
+ if (CollUtil.isNotEmpty(list)) {
|
|
|
3272
|
+ itemDto.setOnTimeCompletedCount(BigDecimal.valueOf(list.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_COMPLETED.getCode(), item.getCorrectionType())).count()));
|
|
|
3273
|
+ itemDto.setOverTimeCompletedCount(BigDecimal.valueOf(list.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OVER_TIME_COMPLETED.getCode(), item.getCorrectionType())).count()));
|
|
|
3274
|
+ itemDto.setOnTimeUnfinishedCount(BigDecimal.valueOf(list.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_UNFINISHED.getCode(), item.getCorrectionType())).count()));
|
|
|
3275
|
+ itemDto.setOverTimeUnfinishedCount(BigDecimal.valueOf(list.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OVER_TIME_UNFINISHED.getCode(), item.getCorrectionType())).count()));
|
|
|
3276
|
+ itemDto.setOtherCount(BigDecimal.valueOf(list.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OTHER.getCode(), item.getCorrectionType())).count()));
|
|
|
3277
|
+ } else {
|
|
|
3278
|
+ itemDto.setOnTimeCompletedCount(BigDecimal.ZERO);
|
|
|
3279
|
+ itemDto.setOverTimeCompletedCount(BigDecimal.ZERO);
|
|
|
3280
|
+ itemDto.setOnTimeUnfinishedCount(BigDecimal.ZERO);
|
|
|
3281
|
+ itemDto.setOverTimeUnfinishedCount(BigDecimal.ZERO);
|
|
|
3282
|
+ itemDto.setOtherCount(BigDecimal.ZERO);
|
|
|
3283
|
+ }
|
|
|
3284
|
+ checkProblemCorrectionItemDtoList.add(itemDto);
|
|
|
3285
|
+ });
|
|
|
3286
|
+
|
|
|
3287
|
+ SysCheckAnalysisReportCheckProblemCorrectionItemDto totalItem = new SysCheckAnalysisReportCheckProblemCorrectionItemDto();
|
|
|
3288
|
+ totalItem.setDeptId(null);
|
|
|
3289
|
+ totalItem.setDeptName("总数");
|
|
|
3290
|
+ totalItem.setOnTimeCompletedCount(checkProblemCorrectionItemDtoList.stream().map(SysCheckAnalysisReportCheckProblemCorrectionItemDto::getOnTimeCompletedCount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
3291
|
+ totalItem.setOverTimeCompletedCount(checkProblemCorrectionItemDtoList.stream().map(SysCheckAnalysisReportCheckProblemCorrectionItemDto::getOverTimeCompletedCount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
3292
|
+ totalItem.setOnTimeUnfinishedCount(checkProblemCorrectionItemDtoList.stream().map(SysCheckAnalysisReportCheckProblemCorrectionItemDto::getOnTimeUnfinishedCount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
3293
|
+ totalItem.setOverTimeUnfinishedCount(checkProblemCorrectionItemDtoList.stream().map(SysCheckAnalysisReportCheckProblemCorrectionItemDto::getOverTimeUnfinishedCount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
3294
|
+ totalItem.setOtherCount(checkProblemCorrectionItemDtoList.stream().map(SysCheckAnalysisReportCheckProblemCorrectionItemDto::getOtherCount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
3295
|
+ checkProblemCorrectionItemDtoList.add(0, totalItem);
|
|
|
3296
|
+ } else if (StrUtil.equals(sysDept.getDeptType(), DeptTypeEnum.BRIGADE.getCode())) {
|
|
|
3297
|
+ Map<String, Long> descMap = targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_COMPLETED.getCode(), item.getCorrectionType())).collect(Collectors.groupingBy(item -> item.getCheckedDepartmentId() + "###" + item.getCheckedDepartmentName(), Collectors.counting()));
|
|
|
3298
|
+ String key = descMap.entrySet().stream()
|
|
|
3299
|
+ .max(Map.Entry.comparingByValue())
|
|
|
3300
|
+ .map(Map.Entry::getKey)
|
|
|
3301
|
+ .orElse(null);
|
|
|
3302
|
+ if (ObjUtil.isNotNull(key)) {
|
|
|
3303
|
+ String desc = key.split("###")[1] + "的按时整改率更高、整改更及时,是当时整改工作落实较好的主管";
|
|
|
3304
|
+ checkProblemCorrectionDto.setDesc(desc);
|
|
|
3305
|
+ }
|
|
3129
|
3306
|
|
|
3130
|
|
- List<SysDept> deptList = sysDeptService.selectAllDept(SecurityUtils.getLoginUser().getDeptId());
|
|
3131
|
|
- Collections.reverse(deptList);
|
|
3132
|
|
- SysDept station = deptList.stream().filter(x -> StrUtil.equals(DeptType.STATION.getCode(), x.getDeptType())).findFirst().orElse(null);
|
|
3133
|
|
- SysDept deptQuery = new SysDept();
|
|
3134
|
|
- deptQuery.setParentId(station.getDeptId());
|
|
3135
|
|
- deptQuery.setDeptType(DeptType.DEPARTMENT.getCode());
|
|
3136
|
|
- List<SysDept> sysDeptList = sysDeptService.selectDeptInfoAll(deptQuery);
|
|
3137
|
|
- sysDeptList.forEach(dept -> {
|
|
3138
|
|
- SysCheckAnalysisReportCheckProblemCorrectionItemDto itemDto = deptMap.get(dept.getDeptId());
|
|
3139
|
|
- if (itemDto != null) {
|
|
3140
|
|
- checkProblemCorrectionItemDtoList.add(itemDto);
|
|
|
3307
|
+ SysCheckAnalysisReportCheckProblemCorrectionItemDto totalItem = new SysCheckAnalysisReportCheckProblemCorrectionItemDto();
|
|
|
3308
|
+ totalItem.setDeptId(sysDept.getDeptId());
|
|
|
3309
|
+ totalItem.setDeptName(sysDept.getDeptName());
|
|
|
3310
|
+ totalItem.setOnTimeCompletedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_COMPLETED.getCode(), item.getCorrectionType())).count()));
|
|
|
3311
|
+ totalItem.setOverTimeCompletedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OVER_TIME_COMPLETED.getCode(), item.getCorrectionType())).count()));
|
|
|
3312
|
+ totalItem.setOnTimeUnfinishedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_UNFINISHED.getCode(), item.getCorrectionType())).count()));
|
|
|
3313
|
+ totalItem.setOverTimeUnfinishedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OVER_TIME_UNFINISHED.getCode(), item.getCorrectionType())).count()));
|
|
|
3314
|
+ totalItem.setOtherCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OTHER.getCode(), item.getCorrectionType())).count()));
|
|
|
3315
|
+ checkProblemCorrectionItemDtoList.add(totalItem);
|
|
|
3316
|
+ } else if (StrUtil.equals(sysDept.getDeptType(), DeptTypeEnum.MANAGER.getCode())) {
|
|
|
3317
|
+ Map<String, Long> descMap = targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_COMPLETED.getCode(), item.getCorrectionType())).collect(Collectors.groupingBy(item -> item.getCheckedTeamId() + "###" + item.getCheckedTeamName(), Collectors.counting()));
|
|
|
3318
|
+ String key = descMap.entrySet().stream()
|
|
|
3319
|
+ .max(Map.Entry.comparingByValue())
|
|
|
3320
|
+ .map(Map.Entry::getKey)
|
|
|
3321
|
+ .orElse(null);
|
|
|
3322
|
+ if (ObjUtil.isNotNull(key)) {
|
|
|
3323
|
+ String desc = key.split("###")[1] + "的按时整改率更高、整改更及时,是当时整改工作落实较好的班组";
|
|
|
3324
|
+ checkProblemCorrectionDto.setDesc(desc);
|
|
|
3325
|
+ }
|
|
|
3326
|
+
|
|
|
3327
|
+ SysCheckAnalysisReportCheckProblemCorrectionItemDto totalItem = new SysCheckAnalysisReportCheckProblemCorrectionItemDto();
|
|
|
3328
|
+ totalItem.setDeptId(sysDept.getDeptId());
|
|
|
3329
|
+ totalItem.setDeptName(sysDept.getDeptName());
|
|
|
3330
|
+ totalItem.setOnTimeCompletedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_COMPLETED.getCode(), item.getCorrectionType())).count()));
|
|
|
3331
|
+ totalItem.setOverTimeCompletedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OVER_TIME_COMPLETED.getCode(), item.getCorrectionType())).count()));
|
|
|
3332
|
+ totalItem.setOnTimeUnfinishedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_UNFINISHED.getCode(), item.getCorrectionType())).count()));
|
|
|
3333
|
+ totalItem.setOverTimeUnfinishedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OVER_TIME_UNFINISHED.getCode(), item.getCorrectionType())).count()));
|
|
|
3334
|
+ totalItem.setOtherCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OTHER.getCode(), item.getCorrectionType())).count()));
|
|
|
3335
|
+ checkProblemCorrectionItemDtoList.add(totalItem);
|
|
|
3336
|
+ } else if (StrUtil.equals(sysDept.getDeptType(), DeptTypeEnum.TEAMS.getCode())) {
|
|
|
3337
|
+ Map<String, Long> descMap = targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_COMPLETED.getCode(), item.getCorrectionType())).collect(Collectors.groupingBy(item -> item.getUserId() + "###" + item.getUserName(), Collectors.counting()));
|
|
|
3338
|
+ String key = descMap.entrySet().stream()
|
|
|
3339
|
+ .max(Map.Entry.comparingByValue())
|
|
|
3340
|
+ .map(Map.Entry::getKey)
|
|
|
3341
|
+ .orElse(null);
|
|
|
3342
|
+ if (ObjUtil.isNotNull(key)) {
|
|
|
3343
|
+ String desc = key.split("###")[1] + "的按时整改率更高、整改更及时,是当时整改工作落实较好的成员";
|
|
|
3344
|
+ checkProblemCorrectionDto.setDesc(desc);
|
|
|
3345
|
+ }
|
|
|
3346
|
+
|
|
|
3347
|
+ SysCheckAnalysisReportCheckProblemCorrectionItemDto totalItem = new SysCheckAnalysisReportCheckProblemCorrectionItemDto();
|
|
|
3348
|
+ totalItem.setDeptId(sysDept.getDeptId());
|
|
|
3349
|
+ totalItem.setDeptName(sysDept.getDeptName());
|
|
|
3350
|
+ totalItem.setOnTimeCompletedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_COMPLETED.getCode(), item.getCorrectionType())).count()));
|
|
|
3351
|
+ totalItem.setOverTimeCompletedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OVER_TIME_COMPLETED.getCode(), item.getCorrectionType())).count()));
|
|
|
3352
|
+ totalItem.setOnTimeUnfinishedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.ON_TIME_UNFINISHED.getCode(), item.getCorrectionType())).count()));
|
|
|
3353
|
+ totalItem.setOverTimeUnfinishedCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OVER_TIME_UNFINISHED.getCode(), item.getCorrectionType())).count()));
|
|
|
3354
|
+ totalItem.setOtherCount(BigDecimal.valueOf(targetList.stream().filter(item -> StrUtil.equals(CheckLargeScreenCorrectionTypeEnum.OTHER.getCode(), item.getCorrectionType())).count()));
|
|
|
3355
|
+ checkProblemCorrectionItemDtoList.add(totalItem);
|
|
3141
|
3356
|
} else {
|
|
3142
|
|
- SysCheckAnalysisReportCheckProblemCorrectionItemDto itemDtoZero = new SysCheckAnalysisReportCheckProblemCorrectionItemDto();
|
|
3143
|
|
- itemDtoZero.setDeptId(dept.getDeptId());
|
|
3144
|
|
- itemDtoZero.setDeptName(dept.getDeptName());
|
|
3145
|
|
- itemDtoZero.setOnTimeCompletedCount(BigDecimal.ZERO);
|
|
3146
|
|
- itemDtoZero.setOverTimeCompletedCount(BigDecimal.ZERO);
|
|
3147
|
|
- itemDtoZero.setOnTimeUnfinishedCount(BigDecimal.ZERO);
|
|
3148
|
|
- itemDtoZero.setOverTimeUnfinishedCount(BigDecimal.ZERO);
|
|
3149
|
|
- itemDtoZero.setOtherCount(BigDecimal.ZERO);
|
|
3150
|
|
- checkProblemCorrectionItemDtoList.add(itemDtoZero);
|
|
|
3357
|
+ throw new ServiceException("部门类型错误");
|
|
3151
|
3358
|
}
|
|
3152
|
|
- });
|
|
3153
|
|
-
|
|
3154
|
|
- SysCheckAnalysisReportCheckProblemCorrectionItemDto totalItem = new SysCheckAnalysisReportCheckProblemCorrectionItemDto();
|
|
3155
|
|
- totalItem.setDeptId(null);
|
|
3156
|
|
- totalItem.setDeptName("总数");
|
|
3157
|
|
- totalItem.setOnTimeCompletedCount(tempCheckProblemCorrectionItemDtoList.stream().map(SysCheckAnalysisReportCheckProblemCorrectionItemDto::getOnTimeCompletedCount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
3158
|
|
- totalItem.setOverTimeCompletedCount(tempCheckProblemCorrectionItemDtoList.stream().map(SysCheckAnalysisReportCheckProblemCorrectionItemDto::getOverTimeCompletedCount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
3159
|
|
- totalItem.setOnTimeUnfinishedCount(tempCheckProblemCorrectionItemDtoList.stream().map(SysCheckAnalysisReportCheckProblemCorrectionItemDto::getOnTimeUnfinishedCount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
3160
|
|
- totalItem.setOverTimeUnfinishedCount(tempCheckProblemCorrectionItemDtoList.stream().map(SysCheckAnalysisReportCheckProblemCorrectionItemDto::getOverTimeUnfinishedCount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
3161
|
|
- totalItem.setOtherCount(tempCheckProblemCorrectionItemDtoList.stream().map(SysCheckAnalysisReportCheckProblemCorrectionItemDto::getOtherCount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
3162
|
|
- checkProblemCorrectionItemDtoList.add(0, totalItem);
|
|
3163
|
|
- checkProblemCorrectionDto.setCheckProblemCorrectionItemDtoList(checkProblemCorrectionItemDtoList);
|
|
|
3359
|
+ }
|
|
3164
|
3360
|
|
|
3165
|
3361
|
return checkProblemCorrectionDto;
|
|
3166
|
3362
|
}
|