Ver código fonte

使用报表

chenshudong 1 mês atrás
pai
commit
71f5a60cc6

+ 265 - 0
airport-admin/src/main/java/com/sundot/airport/web/controller/system/SysUsageReportController.java

@@ -0,0 +1,265 @@
1
+package com.sundot.airport.web.controller.system;
2
+
3
+import cn.hutool.core.collection.CollUtil;
4
+import cn.hutool.core.date.DatePattern;
5
+import cn.hutool.core.date.DateUtil;
6
+import cn.hutool.core.util.ObjectUtil;
7
+import cn.hutool.core.util.StrUtil;
8
+import com.sundot.airport.attendance.domain.AttendanceRecord;
9
+import com.sundot.airport.attendance.service.IAttendanceRecordService;
10
+import com.sundot.airport.check.service.ICheckLargeScreenService;
11
+import com.sundot.airport.common.core.controller.BaseController;
12
+import com.sundot.airport.common.core.domain.AjaxResult;
13
+import com.sundot.airport.common.core.domain.BaseLargeScreenQueryParamDto;
14
+import com.sundot.airport.common.core.domain.SysUsageReportDto;
15
+import com.sundot.airport.common.core.domain.entity.SysDept;
16
+import com.sundot.airport.common.core.domain.entity.SysUser;
17
+import com.sundot.airport.common.dto.BaseCommonDto;
18
+import com.sundot.airport.common.dto.QuizAccuracyAnalysisResultDto;
19
+import com.sundot.airport.common.enums.DeptTypeEnum;
20
+import com.sundot.airport.common.exception.ServiceException;
21
+import com.sundot.airport.common.utils.DeptUtils;
22
+import com.sundot.airport.exam.dto.DashboardOverviewDTO;
23
+import com.sundot.airport.exam.dto.DashboardQueryDTO;
24
+import com.sundot.airport.exam.dto.DashboardUserRankingDTO;
25
+import com.sundot.airport.exam.service.IAccuracyStatisticsService;
26
+import com.sundot.airport.exam.service.IDashboardService;
27
+import com.sundot.airport.item.service.ItemLargeScreenService;
28
+import com.sundot.airport.system.service.ISysDeptService;
29
+import com.sundot.airport.system.service.ISysUserService;
30
+import org.springframework.beans.factory.annotation.Autowired;
31
+import org.springframework.web.bind.annotation.GetMapping;
32
+import org.springframework.web.bind.annotation.RequestMapping;
33
+import org.springframework.web.bind.annotation.RestController;
34
+
35
+import java.math.BigDecimal;
36
+import java.time.DayOfWeek;
37
+import java.time.LocalDate;
38
+import java.time.ZoneId;
39
+import java.util.ArrayList;
40
+import java.util.Date;
41
+import java.util.List;
42
+import java.util.stream.Collectors;
43
+
44
+/**
45
+ * 使用报告
46
+ *
47
+ * @author ruoyi
48
+ */
49
+@RestController
50
+@RequestMapping("/system/usageReport")
51
+public class SysUsageReportController extends BaseController {
52
+
53
+    @Autowired
54
+    private ISysDeptService sysDeptService;
55
+
56
+    @Autowired
57
+    private ISysUserService sysUserService;
58
+
59
+    @Autowired
60
+    private ICheckLargeScreenService checkLargeScreenService;
61
+
62
+    @Autowired
63
+    private ItemLargeScreenService itemLargeScreenService;
64
+
65
+    @Autowired
66
+    private IAttendanceRecordService attendanceRecordService;
67
+
68
+    @Autowired
69
+    private IDashboardService dashboardService;
70
+
71
+    @Autowired
72
+    private IAccuracyStatisticsService accuracyStatisticsService;
73
+
74
+    /**
75
+     * 使用报告
76
+     */
77
+    @GetMapping("/report")
78
+    public AjaxResult checkAnalysisReportCheckProblemDistributionDto(BaseLargeScreenQueryParamDto paramDto) {
79
+        SysUsageReportDto result = getSysUsageReportDto(paramDto);
80
+        return success(result);
81
+    }
82
+
83
+    /**
84
+     * 获取使用报告
85
+     */
86
+    private SysUsageReportDto getSysUsageReportDto(BaseLargeScreenQueryParamDto paramDto) {
87
+        if (ObjectUtil.isNull(paramDto.getStartDate()) || ObjectUtil.isNull(paramDto.getEndDate())) {
88
+            Date lastMonday = getLastWeekMonday();
89
+            Date lastSunday = getLastWeekSunday();
90
+            paramDto.setStartDate(lastMonday);
91
+            paramDto.setEndDate(lastSunday);
92
+        }
93
+        SysUsageReportDto result = new SysUsageReportDto();
94
+        result.setStartDate(paramDto.getStartDate());
95
+        result.setEndDate(paramDto.getEndDate());
96
+        result.setBasicSituation(getBasicSituation(paramDto));
97
+        result.setRunSituation(getRunSituation(paramDto));
98
+        return result;
99
+    }
100
+
101
+    /**
102
+     * 获取上周周一的日期 (java.util.Date)
103
+     */
104
+    public static Date getLastWeekMonday() {
105
+        LocalDate today = LocalDate.now();
106
+        // 计算本周周一(ISO标准:周一为1,周日为7)
107
+        LocalDate mondayThisWeek = today.with(DayOfWeek.MONDAY);
108
+        // 上周周一 = 本周周一 - 7天
109
+        LocalDate lastMonday = mondayThisWeek.minusWeeks(1);
110
+
111
+        return convertToUtilDate(lastMonday);
112
+    }
113
+
114
+    /**
115
+     * 获取上周周日的日期 (java.util.Date)
116
+     */
117
+    public static Date getLastWeekSunday() {
118
+        LocalDate today = LocalDate.now();
119
+        // 计算本周周一
120
+        LocalDate mondayThisWeek = today.with(DayOfWeek.MONDAY);
121
+        // 上周周日 = 本周周一 - 1天
122
+        LocalDate lastSunday = mondayThisWeek.minusDays(1);
123
+
124
+        return convertToUtilDate(lastSunday);
125
+    }
126
+
127
+    /**
128
+     * 将LocalDate转换为java.util.Date
129
+     */
130
+    private static Date convertToUtilDate(LocalDate localDate) {
131
+        return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
132
+    }
133
+
134
+    /**
135
+     * 获取基本情况
136
+     */
137
+    private SysUsageReportDto.BasicSituation getBasicSituation(BaseLargeScreenQueryParamDto paramDto) {
138
+        SysUsageReportDto.BasicSituation basicSituation = new SysUsageReportDto.BasicSituation();
139
+        List<SysUsageReportDto.SysDeptInfo> sysDeptInfoList = new ArrayList<>();
140
+        // 获取当前用户所在站点ID
141
+        Long topSiteId = DeptUtils.getTopSiteId(sysDeptService.selectDeptById(getDeptId()));
142
+        if (ObjectUtil.isNull(topSiteId)) {
143
+            throw new ServiceException("无法找到有效的站点信息");
144
+        }
145
+        List<SysDept> deptList = sysDeptService.selectChildrenDeptById(topSiteId);
146
+        deptList = deptList.stream().filter(item -> StrUtil.equals(DeptTypeEnum.BRIGADE.getCode(), item.getDeptType())).collect(Collectors.toList());
147
+        deptList.forEach(item -> {
148
+            SysUsageReportDto.SysDeptInfo sysDeptInfo = new SysUsageReportDto.SysDeptInfo();
149
+            List<SysUser> sysUserList = sysUserService.selectUserByDeptId(item.getDeptId());
150
+//            List<SysUser> sysUserList = sysUserService.selectUserListByRoleKeyAndDeptId(Arrays.asList(RoleTypeEnum.banzuzhang.getCode(), RoleTypeEnum.SecurityCheck.getCode()), item.getId());
151
+            sysDeptInfo.setDeptId(item.getDeptId());
152
+            sysDeptInfo.setDeptName(item.getDeptName());
153
+            sysDeptInfo.setPeopleNumber(sysUserList.size());
154
+            sysDeptInfoList.add(sysDeptInfo);
155
+        });
156
+        basicSituation.setSysDeptInfoList(sysDeptInfoList);
157
+        basicSituation.setSysDeptInfoListDesc(sysDeptInfoList.stream().map(SysUsageReportDto.SysDeptInfo::getDeptName).collect(Collectors.joining("、")));
158
+        basicSituation.setTotalPeopleNumber(sysDeptInfoList.stream().mapToInt(SysUsageReportDto.SysDeptInfo::getPeopleNumber).sum());
159
+        return basicSituation;
160
+    }
161
+
162
+    /**
163
+     * 获取运行情况
164
+     */
165
+    private SysUsageReportDto.RunSituation getRunSituation(BaseLargeScreenQueryParamDto paramDto) {
166
+        SysUsageReportDto.RunSituation runSituation = new SysUsageReportDto.RunSituation();
167
+        runSituation.setAttendanceModule(getAttendanceModule(paramDto));
168
+        runSituation.setSeizureModule(getSeizureModule(paramDto));
169
+        runSituation.setExamModule(getExamModule(paramDto));
170
+        runSituation.setCheckModule(getCheckModule(paramDto));
171
+        return runSituation;
172
+    }
173
+
174
+    /**
175
+     * 获取勤务模块
176
+     */
177
+    private SysUsageReportDto.AttendanceModule getAttendanceModule(BaseLargeScreenQueryParamDto paramDto) {
178
+        SysUsageReportDto.AttendanceModule attendanceModule = new SysUsageReportDto.AttendanceModule();
179
+        AttendanceRecord attendanceRecordReq = new AttendanceRecord();
180
+        attendanceRecordReq.setAttendanceDateStart(paramDto.getStartDate());
181
+        attendanceRecordReq.setAttendanceDateEnd(paramDto.getEndDate());
182
+        List<AttendanceRecord> attendanceRecordList = attendanceRecordService.selectAttendanceRecordList(attendanceRecordReq);
183
+        attendanceRecordList = attendanceRecordList.stream().filter(item -> ObjectUtil.isNull(item.getCheckOutTime()) || "2000-01-01 00:00:00".equals(DateUtil.format(item.getCheckOutTime(), DatePattern.NORM_DATETIME_PATTERN))).collect(Collectors.toList());
184
+        if (CollUtil.isEmpty(attendanceRecordList)) {
185
+            return null;
186
+        }
187
+        List<SysUsageReportDto.SysDeptInfo> sysDeptInfoList = new ArrayList<>();
188
+        attendanceRecordList.stream().filter(item -> StrUtil.isNotBlank(item.getBrigadeCode())).collect(Collectors.groupingBy(item -> item.getBrigadeCode() + "_" + item.getBrigadeName())).forEach((key, value) -> {
189
+            SysUsageReportDto.SysDeptInfo sysDeptInfo = new SysUsageReportDto.SysDeptInfo();
190
+            sysDeptInfo.setDeptId(Long.valueOf(key.split("_")[0]));
191
+            sysDeptInfo.setDeptName(key.split("_")[1]);
192
+            sysDeptInfo.setPeopleNumber(value.size());
193
+            sysDeptInfoList.add(sysDeptInfo);
194
+        });
195
+        attendanceModule.setSysDeptInfoList(sysDeptInfoList);
196
+        attendanceModule.setSysDeptInfoListDesc(sysDeptInfoList.stream().map(item -> item.getDeptName() + item.getPeopleNumber() + "人").collect(Collectors.joining("、")));
197
+        attendanceModule.setTotalPeopleNumber(sysDeptInfoList.stream().mapToInt(SysUsageReportDto.SysDeptInfo::getPeopleNumber).sum());
198
+        return attendanceModule;
199
+    }
200
+
201
+    /**
202
+     * 获取查获模块
203
+     */
204
+    private SysUsageReportDto.SeizureModule getSeizureModule(BaseLargeScreenQueryParamDto paramDto) {
205
+        SysUsageReportDto.SeizureModule seizureModule = itemLargeScreenService.getSeizureModule(paramDto);
206
+        return seizureModule;
207
+    }
208
+
209
+    /**
210
+     * 获取抽问抽答模块
211
+     */
212
+    private SysUsageReportDto.ExamModule getExamModule(BaseLargeScreenQueryParamDto paramDto) {
213
+        SysUsageReportDto.ExamModule examModule = new SysUsageReportDto.ExamModule();
214
+
215
+        String startDateStr = DateUtil.format(paramDto.getStartDate(), DatePattern.NORM_DATE_PATTERN);
216
+        String endDateStr = DateUtil.format(paramDto.getEndDate(), DatePattern.NORM_DATE_PATTERN);
217
+
218
+        DashboardQueryDTO query = new DashboardQueryDTO();
219
+        query.setStartDate(startDateStr);
220
+        query.setEndDate(endDateStr);
221
+        query.setTimeRange("custom");
222
+
223
+        // 总项数、平均分
224
+        DashboardOverviewDTO overview = dashboardService.getOverview(query);
225
+        if (overview != null) {
226
+            examModule.setTotalItem(overview.getCompletedTasks() != null ? overview.getCompletedTasks().intValue() : 0);
227
+            examModule.setAverageScore(overview.getAvgScore() != null ? BigDecimal.valueOf(overview.getAvgScore()) : BigDecimal.ZERO);
228
+        }
229
+
230
+        // 参与人数(有完成任务的用户数)
231
+        List<DashboardUserRankingDTO> allUsers = dashboardService.getAllUsersRanking(query);
232
+        if (CollUtil.isNotEmpty(allUsers)) {
233
+            long participantCount = allUsers.stream()
234
+                    .filter(user -> user.getCompletedTasks() != null && user.getCompletedTasks() > 0)
235
+                    .count();
236
+            examModule.setTotalPeopleNumber((int) participantCount);
237
+        } else {
238
+            examModule.setTotalPeopleNumber(0);
239
+        }
240
+
241
+        // 各分类正确率列表
242
+        QuizAccuracyAnalysisResultDto accuracyAnalysis = accuracyStatisticsService.getQuizAccuracyAnalysis(startDateStr, endDateStr);
243
+        if (accuracyAnalysis != null && CollUtil.isNotEmpty(accuracyAnalysis.getCategoryList())) {
244
+            List<BaseCommonDto> typeList = accuracyAnalysis.getCategoryList().stream().map(item -> {
245
+                BaseCommonDto dto = new BaseCommonDto();
246
+                dto.setName(item.getCategoryName());
247
+                dto.setScale(item.getCorrectRate());
248
+                dto.setRemark(item.getLabel());
249
+                return dto;
250
+            }).collect(Collectors.toList());
251
+            examModule.setTypeList(typeList);
252
+        }
253
+
254
+        return examModule;
255
+    }
256
+
257
+    /**
258
+     * 获取巡检模块
259
+     */
260
+    private SysUsageReportDto.CheckModule getCheckModule(BaseLargeScreenQueryParamDto paramDto) {
261
+        SysUsageReportDto.CheckModule checkModule = checkLargeScreenService.getCheckModule(paramDto);
262
+        return checkModule;
263
+    }
264
+
265
+}

+ 26 - 0
airport-check/src/main/java/com/sundot/airport/check/mapper/CheckLargeScreenMapper.java

@@ -19,6 +19,8 @@ import com.sundot.airport.check.domain.CheckTask;
19 19
 import com.sundot.airport.common.core.domain.BaseLargeScreenQueryParamDto;
20 20
 import com.sundot.airport.common.core.domain.SysCheckAnalysisReportCheckProblemCorrectionItemDto;
21 21
 import com.sundot.airport.common.core.domain.SysCheckAnalysisReportCheckProblemDistributionItemDto;
22
+import com.sundot.airport.common.core.domain.SysUsageReportCheckTaskDto;
23
+import com.sundot.airport.common.dto.BaseCommonDto;
22 24
 
23 25
 import java.math.BigDecimal;
24 26
 import java.util.List;
@@ -286,4 +288,28 @@ public interface CheckLargeScreenMapper {
286 288
      */
287 289
     public List<SysCheckAnalysisReportCheckProblemCorrectionItemDto> problemCorrectionStatistics(BaseLargeScreenQueryParamDto dto);
288 290
 
291
+    /**
292
+     * 使用报表-运行情况-巡检模块
293
+     *
294
+     * @param dto 大屏查询参数
295
+     * @return 检查级别与分类
296
+     */
297
+    public List<SysUsageReportCheckTaskDto> getUsageReportCheckTaskDto(BaseLargeScreenQueryParamDto dto);
298
+
299
+    /**
300
+     * 使用报表-运行情况-巡检模块
301
+     *
302
+     * @param list 任务单编码列表
303
+     * @return 检查单数量
304
+     */
305
+    public Integer getUsageReportCheckRecordCount(List<String> list);
306
+
307
+    /**
308
+     * 使用报表-运行情况-巡检模块
309
+     *
310
+     * @param list 任务单编码列表
311
+     * @return 分类列表
312
+     */
313
+    public List<BaseCommonDto> getUsageReportCheckCorrectionDto(List<String> list);
314
+
289 315
 }

+ 9 - 0
airport-check/src/main/java/com/sundot/airport/check/service/ICheckLargeScreenService.java

@@ -20,6 +20,7 @@ import com.sundot.airport.common.core.domain.SysCheckAnalysisReportCheckProblemD
20 20
 import com.sundot.airport.common.core.domain.SysCheckAnalysisReportDto;
21 21
 import com.sundot.airport.common.core.domain.SysHomeReportDetailDto;
22 22
 import com.sundot.airport.common.core.domain.SysLargeScreenDetailDto;
23
+import com.sundot.airport.common.core.domain.SysUsageReportDto;
23 24
 
24 25
 import java.math.BigDecimal;
25 26
 import java.util.List;
@@ -230,4 +231,12 @@ public interface ICheckLargeScreenService {
230 231
      * @return 质控分析报告-质控活动-问题分布统计
231 232
      */
232 233
     public SysCheckAnalysisReportCheckProblemDistributionDto getCheckProblemDistribution(BaseLargeScreenQueryParamDto paramDto);
234
+
235
+    /**
236
+     * 使用报表-运行情况-巡检模块
237
+     *
238
+     * @param paramDto 查询参数
239
+     * @return 使用报表-运行情况-巡检模块
240
+     */
241
+    public SysUsageReportDto.CheckModule getCheckModule(BaseLargeScreenQueryParamDto paramDto);
233 242
 }

+ 39 - 0
airport-check/src/main/java/com/sundot/airport/check/service/impl/CheckLargeScreenServiceImpl.java

@@ -47,11 +47,14 @@ import com.sundot.airport.common.core.domain.SysCheckAnalysisReportCheckTaskType
47 47
 import com.sundot.airport.common.core.domain.SysCheckAnalysisReportDto;
48 48
 import com.sundot.airport.common.core.domain.SysHomeReportDetailDto;
49 49
 import com.sundot.airport.common.core.domain.SysLargeScreenDetailDto;
50
+import com.sundot.airport.common.core.domain.SysUsageReportCheckTaskDto;
51
+import com.sundot.airport.common.core.domain.SysUsageReportDto;
50 52
 import com.sundot.airport.common.core.domain.entity.SysDept;
51 53
 import com.sundot.airport.common.core.domain.entity.SysDictData;
52 54
 import com.sundot.airport.common.core.domain.entity.SysRole;
53 55
 import com.sundot.airport.common.core.domain.entity.SysUser;
54 56
 import com.sundot.airport.common.core.redis.RedisCache;
57
+import com.sundot.airport.common.dto.BaseCommonDto;
55 58
 import com.sundot.airport.common.enums.CheckLargeScreenCorrectionTypeEnum;
56 59
 import com.sundot.airport.common.enums.CheckLevelEnum;
57 60
 import com.sundot.airport.common.enums.CheckTaskTypeEnum;
@@ -3185,4 +3188,40 @@ public class CheckLargeScreenServiceImpl implements ICheckLargeScreenService {
3185 3188
         return checkProblemDistributionDto;
3186 3189
     }
3187 3190
 
3191
+    /**
3192
+     * 使用报表-运行情况-巡检模块
3193
+     *
3194
+     * @param paramDto 查询参数
3195
+     * @return 使用报表-运行情况-巡检模块
3196
+     */
3197
+    @Override
3198
+    public SysUsageReportDto.CheckModule getCheckModule(BaseLargeScreenQueryParamDto paramDto) {
3199
+        SysUsageReportDto.CheckModule checkModule = new SysUsageReportDto.CheckModule();
3200
+        List<SysUsageReportCheckTaskDto> checkTaskDtoList = checkLargeScreenMapper.getUsageReportCheckTaskDto(paramDto);
3201
+        if (CollUtil.isEmpty(checkTaskDtoList)) {
3202
+            return null;
3203
+        }
3204
+        List<String> taskCodeList = checkTaskDtoList.stream().map(SysUsageReportCheckTaskDto::getTaskCode).collect(Collectors.toList());
3205
+        List<BaseCommonDto> checkTaskTypeList = new ArrayList<>();
3206
+        Map<String, List<SysUsageReportCheckTaskDto>> levelCodeMap = checkTaskDtoList.stream().collect(Collectors.groupingBy(dto -> dto.getLevelCode() + "###" + dto.getLevelName()));
3207
+        levelCodeMap.forEach((key, value) -> {
3208
+            String[] split = key.split("###");
3209
+            String levelCode = split[0];
3210
+            String levelName = split[1];
3211
+            BaseCommonDto baseCommonDto = new BaseCommonDto();
3212
+            baseCommonDto.setCode(levelCode);
3213
+            baseCommonDto.setName(levelName);
3214
+            baseCommonDto.setTotal(new BigDecimal((int) value.stream().map(SysUsageReportCheckTaskDto::getTaskCode).distinct().count()));
3215
+            baseCommonDto.setRemark(value.stream().map(SysUsageReportCheckTaskDto::getCategoryName).distinct().collect(Collectors.joining("、")));
3216
+            checkTaskTypeList.add(baseCommonDto);
3217
+        });
3218
+        checkTaskTypeList.sort(Comparator.comparing(BaseCommonDto::getTotal).reversed());
3219
+        checkModule.setCheckTaskTypeList(checkTaskTypeList);
3220
+        checkModule.setTotalCheckForm(checkLargeScreenMapper.getUsageReportCheckRecordCount(taskCodeList));
3221
+        List<BaseCommonDto> usageReportCheckCorrectionDto = checkLargeScreenMapper.getUsageReportCheckCorrectionDto(taskCodeList);
3222
+        checkModule.setCheckCategoryTypeList(usageReportCheckCorrectionDto);
3223
+        checkModule.setTotalProblemItem(usageReportCheckCorrectionDto.stream().map(BaseCommonDto::getTotal).reduce(BigDecimal.ZERO, BigDecimal::add).intValue());
3224
+        return checkModule;
3225
+    }
3226
+
3188 3227
 }

+ 51 - 0
airport-check/src/main/resources/mapper/check/CheckLargeScreenMapper.xml

@@ -948,4 +948,55 @@
948 948
         group by temp.deptId, temp.deptName
949 949
     </select>
950 950
 
951
+    <select id="getUsageReportCheckTaskDto"
952
+            resultType="com.sundot.airport.common.core.domain.SysUsageReportCheckTaskDto">
953
+        select ct.task_code taskCode,
954
+        ct.check_level levelCode,
955
+        ct.check_level_desc levelName,
956
+        cpi.category_code_one categoryCode,
957
+        cpi.category_name_one categoryName
958
+        from check_task ct
959
+        inner join check_project_item cpi on (cpi.source_id = ct.id and cpi.type = 'CHECK_TASK')
960
+        where 1 = 1
961
+        <if test="startDate != null and endDate != null">
962
+            and (
963
+            (ct.check_start_time >= #{startDate} and
964
+            ct.check_start_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
965
+            or
966
+            (ct.check_end_time > #{startDate} and
967
+            ct.check_end_time <![CDATA[ <= ]]> date_add(#{endDate} , interval 1 day))
968
+            or
969
+            (ct.check_start_time <![CDATA[ < ]]> #{startDate} and
970
+            ct.check_end_time > date_add(#{endDate} , interval 1 day))
971
+            )
972
+        </if>
973
+    </select>
974
+
975
+    <select id="getUsageReportCheckRecordCount"
976
+            resultType="java.lang.Integer">
977
+        select count(1)
978
+        from check_record cr
979
+        where 1 = 1
980
+        and cr.task_code in
981
+        <foreach collection="list" item="item" open="(" separator="," close=")">
982
+            #{item}
983
+        </foreach>
984
+    </select>
985
+
986
+    <select id="getUsageReportCheckCorrectionDto"
987
+            resultType="com.sundot.airport.common.dto.BaseCommonDto">
988
+        select cpi.category_code_one code,
989
+        cpi.category_name_one name,
990
+        count(1) total
991
+        from check_correction cc
992
+        inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
993
+        where 1 = 1
994
+        and cc.task_code in
995
+        <foreach collection="list" item="item" open="(" separator="," close=")">
996
+            #{item}
997
+        </foreach>
998
+        group by cpi.category_code_one, cpi.category_name_one
999
+        order by total desc
1000
+    </select>
1001
+
951 1002
 </mapper>

+ 39 - 0
airport-common/src/main/java/com/sundot/airport/common/core/domain/SysUsageReportCheckTaskDto.java

@@ -0,0 +1,39 @@
1
+package com.sundot.airport.common.core.domain;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * 使用报表-运行情况-巡检模块
7
+ *
8
+ * @author ruoyi
9
+ * @date 2025-01-06
10
+ */
11
+@Data
12
+public class SysUsageReportCheckTaskDto {
13
+
14
+    /**
15
+     * 检查任务编码
16
+     */
17
+    private String taskCode;
18
+
19
+    /**
20
+     * 检查级别编码
21
+     */
22
+    private String levelCode;
23
+
24
+    /**
25
+     * 检查级别名称
26
+     */
27
+    private String levelName;
28
+
29
+    /**
30
+     * 分类编码
31
+     */
32
+    private String categoryCode;
33
+
34
+    /**
35
+     * 分类名称
36
+     */
37
+    private String categoryName;
38
+
39
+}

+ 205 - 0
airport-common/src/main/java/com/sundot/airport/common/core/domain/SysUsageReportDto.java

@@ -0,0 +1,205 @@
1
+package com.sundot.airport.common.core.domain;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import com.sundot.airport.common.dto.BaseCommonDto;
5
+import lombok.Data;
6
+import org.springframework.format.annotation.DateTimeFormat;
7
+
8
+import java.math.BigDecimal;
9
+import java.util.Date;
10
+import java.util.List;
11
+
12
+/**
13
+ * 使用报表
14
+ *
15
+ * @author ruoyi
16
+ * @date 2025-01-06
17
+ */
18
+@Data
19
+public class SysUsageReportDto {
20
+
21
+    /**
22
+     * 开始日期
23
+     */
24
+    @JsonFormat(pattern = "yyyy-MM-dd")
25
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
26
+    private Date startDate;
27
+
28
+    /**
29
+     * 结束日期
30
+     */
31
+    @JsonFormat(pattern = "yyyy-MM-dd")
32
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
33
+    private Date endDate;
34
+
35
+    /**
36
+     * 基本情况
37
+     */
38
+    private BasicSituation basicSituation;
39
+
40
+    /**
41
+     * 运行情况
42
+     */
43
+    private RunSituation runSituation;
44
+
45
+    /**
46
+     * 基本情况
47
+     */
48
+    @Data
49
+    public static class BasicSituation {
50
+        /**
51
+         * 部门信息列表
52
+         */
53
+        private List<SysDeptInfo> sysDeptInfoList;
54
+        /**
55
+         * 部门信息列表描述
56
+         */
57
+        private String sysDeptInfoListDesc;
58
+        /**
59
+         * 总人员数量
60
+         */
61
+        private Integer totalPeopleNumber;
62
+    }
63
+
64
+    /**
65
+     * 运行情况
66
+     */
67
+    @Data
68
+    public static class RunSituation {
69
+        /**
70
+         * 勤务模块
71
+         */
72
+        private AttendanceModule attendanceModule;
73
+        /**
74
+         * 查获模块
75
+         */
76
+        private SeizureModule seizureModule;
77
+        /**
78
+         * 抽问抽答模块
79
+         */
80
+        private ExamModule examModule;
81
+        /**
82
+         * 巡检模块
83
+         */
84
+        private CheckModule checkModule;
85
+    }
86
+
87
+    /**
88
+     * 部门信息
89
+     */
90
+    @Data
91
+    public static class SysDeptInfo {
92
+        /**
93
+         * 部门ID
94
+         */
95
+        private Long deptId;
96
+        /**
97
+         * 部门名称
98
+         */
99
+        private String deptName;
100
+        /**
101
+         * 人员数量
102
+         */
103
+        private Integer peopleNumber;
104
+    }
105
+
106
+    /**
107
+     * 勤务模块
108
+     */
109
+    @Data
110
+    public static class AttendanceModule {
111
+        /**
112
+         * 部门信息列表
113
+         */
114
+        private List<SysDeptInfo> sysDeptInfoList;
115
+        /**
116
+         * 部门信息列表描述
117
+         */
118
+        private String sysDeptInfoListDesc;
119
+        /**
120
+         * 总人员数量
121
+         */
122
+        private Integer totalPeopleNumber;
123
+    }
124
+
125
+    /**
126
+     * 查获模块
127
+     */
128
+    @Data
129
+    public static class SeizureModule {
130
+        /**
131
+         * 表单数量
132
+         */
133
+        private Integer totalForm;
134
+        /**
135
+         * 查获总数
136
+         */
137
+        private BigDecimal totalSeizure;
138
+        /**
139
+         * 违禁品类型列表
140
+         */
141
+        private List<BaseCommonDto> seizureTypeList;
142
+        /**
143
+         * 查获岗位列表
144
+         */
145
+        private List<BaseCommonDto> seizurePositionList;
146
+        /**
147
+         * 查获部位列表
148
+         */
149
+        private List<BaseCommonDto> seizurePartList;
150
+        /**
151
+         * 隐匿物品查获部位列表
152
+         */
153
+        private List<BaseCommonDto> seizurePartHiddenList;
154
+    }
155
+
156
+    /**
157
+     * 抽问抽答模块
158
+     */
159
+    @Data
160
+    public static class ExamModule {
161
+        /**
162
+         * 总人数
163
+         */
164
+        private Integer totalPeopleNumber;
165
+        /**
166
+         * 总项数
167
+         */
168
+        private Integer totalItem;
169
+        /**
170
+         * 平均分
171
+         */
172
+        private BigDecimal averageScore;
173
+        /**
174
+         * 类型列表
175
+         */
176
+        private List<BaseCommonDto> typeList;
177
+    }
178
+
179
+    /**
180
+     * 巡检模块
181
+     */
182
+    @Data
183
+    public static class CheckModule {
184
+        /**
185
+         * 检查单数量
186
+         */
187
+        private Integer totalCheckForm;
188
+        /**
189
+         * 问题项数量
190
+         */
191
+        private Integer totalProblemItem;
192
+        /**
193
+         * 检查任务类型列表
194
+         */
195
+        private List<BaseCommonDto> checkTaskTypeList;
196
+        /**
197
+         * 检查项类型列表
198
+         */
199
+        private List<BaseCommonDto> checkCategoryTypeList;
200
+    }
201
+
202
+}
203
+
204
+
205
+

+ 61 - 0
airport-common/src/main/java/com/sundot/airport/common/core/domain/SysUsageReportSeizureDto.java

@@ -0,0 +1,61 @@
1
+package com.sundot.airport.common.core.domain;
2
+
3
+import lombok.Data;
4
+
5
+import java.math.BigDecimal;
6
+
7
+/**
8
+ * 使用报表-运行情况-查获模块
9
+ *
10
+ * @author ruoyi
11
+ * @date 2025-01-06
12
+ */
13
+@Data
14
+public class SysUsageReportSeizureDto {
15
+
16
+    /**
17
+     * 主键
18
+     */
19
+    private String id;
20
+
21
+    /**
22
+     * 数量
23
+     */
24
+    private BigDecimal total;
25
+
26
+    /**
27
+     * 检查岗位编码
28
+     */
29
+    private String positionCode;
30
+
31
+    /**
32
+     * 检查岗位名称
33
+     */
34
+    private String positionName;
35
+
36
+    /**
37
+     * 物品分类编码
38
+     */
39
+    private String categoryCode;
40
+
41
+    /**
42
+     * 物品分类名称
43
+     */
44
+    private String categoryName;
45
+
46
+    /**
47
+     * 检查部位编码
48
+     */
49
+    private String partCode;
50
+
51
+    /**
52
+     * 检查部位名称
53
+     */
54
+    private String partName;
55
+
56
+    /**
57
+     * 是否故意隐匿(1-是,0-否)
58
+     */
59
+    private Integer hidden;
60
+
61
+}

+ 64 - 0
airport-common/src/main/java/com/sundot/airport/common/dto/BaseCommonDto.java

@@ -0,0 +1,64 @@
1
+package com.sundot.airport.common.dto;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+import java.math.BigDecimal;
7
+
8
+/**
9
+ * 通用报文
10
+ *
11
+ * @author ruoyi
12
+ * @date 2025-09-07
13
+ */
14
+@Data
15
+public class BaseCommonDto implements Serializable {
16
+
17
+    private static final long serialVersionUID = 1L;
18
+
19
+    /**
20
+     * 主键
21
+     */
22
+    private Long id;
23
+
24
+    /**
25
+     * 编码
26
+     */
27
+    private String code;
28
+
29
+    /**
30
+     * 名称
31
+     */
32
+    private String name;
33
+
34
+    /**
35
+     * 数量
36
+     */
37
+    private BigDecimal total;
38
+
39
+    /**
40
+     * 比例
41
+     */
42
+    private BigDecimal scale;
43
+
44
+    /**
45
+     * 比例描述
46
+     */
47
+    private String scaleDesc;
48
+
49
+    /**
50
+     * 排名
51
+     */
52
+    private Integer ranking;
53
+
54
+    /**
55
+     * 备注
56
+     */
57
+    private String remark;
58
+
59
+    /**
60
+     * 描述
61
+     */
62
+    private String desc;
63
+
64
+}

+ 9 - 0
airport-item/src/main/java/com/sundot/airport/item/mapper/ItemLargeScreenMapper.java

@@ -1,6 +1,7 @@
1 1
 package com.sundot.airport.item.mapper;
2 2
 
3 3
 import com.sundot.airport.common.core.domain.BaseLargeScreenQueryParamDto;
4
+import com.sundot.airport.common.core.domain.SysUsageReportSeizureDto;
4 5
 import com.sundot.airport.item.domain.*;
5 6
 import com.sundot.airport.item.domain.dto.ConcealmentPositionTop1DTO;
6 7
 import com.sundot.airport.item.domain.dto.ProhibitedItemsTop3DTO;
@@ -197,4 +198,12 @@ public interface ItemLargeScreenMapper {
197 198
      */
198 199
     List<ConcealmentPositionTop1DTO> selectConcealmentPositionTop1(BaseLargeScreenQueryParamDto dto);
199 200
 
201
+    /**
202
+     * 使用报表-运行情况-查获模块
203
+     *
204
+     * @param dto 查询参数
205
+     * @return 使用报表-运行情况-查获模块数据
206
+     */
207
+    List<SysUsageReportSeizureDto> getSeizureModule(BaseLargeScreenQueryParamDto dto);
208
+
200 209
 }

+ 8 - 0
airport-item/src/main/java/com/sundot/airport/item/service/ItemLargeScreenService.java

@@ -1,6 +1,7 @@
1 1
 package com.sundot.airport.item.service;
2 2
 
3 3
 import com.sundot.airport.common.core.domain.BaseLargeScreenQueryParamDto;
4
+import com.sundot.airport.common.core.domain.SysUsageReportDto;
4 5
 import com.sundot.airport.item.domain.*;
5 6
 
6 7
 import java.util.List;
@@ -110,5 +111,12 @@ public interface ItemLargeScreenService {
110 111
      */
111 112
     public List<ItemLargeScreenChannelDto> channel(BaseLargeScreenQueryParamDto dto);
112 113
 
114
+    /**
115
+     * 使用报表-运行情况-查获模块
116
+     *
117
+     * @param dto 大屏查询参数
118
+     * @return 使用报表-运行情况-查获模块
119
+     */
120
+    public SysUsageReportDto.SeizureModule getSeizureModule(BaseLargeScreenQueryParamDto dto);
113 121
 
114 122
 }

+ 70 - 0
airport-item/src/main/java/com/sundot/airport/item/service/impl/ItemLargeScreenServiceImpl.java

@@ -1,7 +1,11 @@
1 1
 package com.sundot.airport.item.service.impl;
2 2
 
3
+import cn.hutool.core.collection.CollUtil;
3 4
 import com.sundot.airport.common.core.domain.BaseLargeScreenQueryParamDto;
5
+import com.sundot.airport.common.core.domain.SysUsageReportDto;
6
+import com.sundot.airport.common.core.domain.SysUsageReportSeizureDto;
4 7
 import com.sundot.airport.common.core.domain.entity.SysUser;
8
+import com.sundot.airport.common.dto.BaseCommonDto;
5 9
 import com.sundot.airport.item.domain.*;
6 10
 import com.sundot.airport.item.mapper.ItemLargeScreenMapper;
7 11
 import com.sundot.airport.item.service.ItemLargeScreenService;
@@ -10,9 +14,11 @@ import org.springframework.beans.factory.annotation.Autowired;
10 14
 import org.springframework.stereotype.Service;
11 15
 
12 16
 import java.math.BigDecimal;
17
+import java.math.RoundingMode;
13 18
 import java.time.LocalDate;
14 19
 import java.time.ZoneId;
15 20
 import java.util.*;
21
+import java.util.function.Function;
16 22
 import java.util.stream.Collectors;
17 23
 
18 24
 /**
@@ -266,4 +272,68 @@ public class ItemLargeScreenServiceImpl implements ItemLargeScreenService {
266 272
         return itemLargeScreenMapper.channel(dto);
267 273
     }
268 274
 
275
+    /**
276
+     * 使用报表-运行情况-查获模块
277
+     *
278
+     * @param dto 大屏查询参数
279
+     * @return 使用报表-运行情况-查获模块
280
+     */
281
+    @Override
282
+    public SysUsageReportDto.SeizureModule getSeizureModule(BaseLargeScreenQueryParamDto dto) {
283
+        SysUsageReportDto.SeizureModule seizureModule = new SysUsageReportDto.SeizureModule();
284
+        List<SysUsageReportSeizureDto> dataList = itemLargeScreenMapper.getSeizureModule(dto);
285
+        if (CollUtil.isEmpty(dataList)) {
286
+            return null;
287
+        }
288
+        seizureModule.setTotalForm((int) dataList.stream().map(SysUsageReportSeizureDto::getId).distinct().count());
289
+        seizureModule.setTotalSeizure(dataList.stream().map(SysUsageReportSeizureDto::getTotal).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
290
+        seizureModule.setSeizureTypeList(convertAndGroupByField(dataList, d -> d.getCategoryCode() + "###" + d.getCategoryName()));
291
+        seizureModule.setSeizurePositionList(convertAndGroupByField(dataList, d -> d.getPositionCode() + "###" + d.getPositionName()));
292
+        List<BaseCommonDto> allParts = convertAndGroupByField(dataList, d -> d.getPartCode() + "###" + d.getPartName());
293
+        allParts.forEach(item -> {
294
+            item.setScale(seizureModule.getTotalSeizure().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : item.getTotal().divide(seizureModule.getTotalSeizure(), 4, RoundingMode.HALF_UP));
295
+            item.setScaleDesc(item.getScale().multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) + "%");
296
+        });
297
+        seizureModule.setSeizurePartList(allParts);
298
+        List<BaseCommonDto> hiddenParts = convertAndGroupByField(dataList.stream().filter(item -> item.getHidden() != null && item.getHidden() == 1).collect(Collectors.toList()), d -> d.getPartCode() + "###" + d.getPartName());
299
+        seizureModule.setSeizurePartHiddenList(hiddenParts);
300
+        return seizureModule;
301
+    }
302
+
303
+    /**
304
+     * 按指定字段分组汇总数量(通用方法)
305
+     *
306
+     * @param sourceList   原始数据列表
307
+     * @param keyExtractor 分组键提取函数
308
+     * @return 转换后数据列表
309
+     */
310
+    private List<BaseCommonDto> convertAndGroupByField(List<SysUsageReportSeizureDto> sourceList, Function<SysUsageReportSeizureDto, String> keyExtractor) {
311
+        if (CollUtil.isEmpty(sourceList)) {
312
+            return Collections.emptyList();
313
+        }
314
+        Map<String, BigDecimal> groupedTotals = sourceList.stream()
315
+                .filter(dto -> dto.getTotal() != null)
316
+                .filter(dto -> {
317
+                    String key = keyExtractor.apply(dto);
318
+                    return key != null && !key.contains("null");
319
+                })
320
+                .collect(Collectors.groupingBy(
321
+                        keyExtractor,
322
+                        Collectors.reducing(BigDecimal.ZERO,
323
+                                SysUsageReportSeizureDto::getTotal,
324
+                                BigDecimal::add)
325
+                ));
326
+        return groupedTotals.entrySet().stream()
327
+                .map(entry -> {
328
+                    String[] parts = entry.getKey().split("###", 2);
329
+                    BaseCommonDto dto = new BaseCommonDto();
330
+                    dto.setCode(parts.length > 0 ? parts[0] : "");
331
+                    dto.setName(parts.length > 1 ? parts[1] : "");
332
+                    dto.setTotal(entry.getValue());
333
+                    return dto;
334
+                })
335
+                .sorted(Comparator.comparing(BaseCommonDto::getTotal).reversed())
336
+                .collect(Collectors.toList());
337
+    }
338
+
269 339
 }

+ 21 - 0
airport-item/src/main/resources/mapper/item/ItemLargeScreenMapper.xml

@@ -645,4 +645,25 @@
645 645
         LIMIT 1
646 646
     </select>
647 647
 
648
+    <!-- 使用报表-运行情况-查获模块 -->
649
+    <select id="getSeizureModule" resultType="com.sundot.airport.common.core.domain.SysUsageReportSeizureDto">
650
+        select isr.id id,
651
+        isi.quantity total,
652
+        isr.check_method positionCode,
653
+        isr.check_method_desc positionName,
654
+        isi.category_code_one categoryCode,
655
+        isi.category_name_one categoryName,
656
+        isi.check_position_code_one partCode,
657
+        isi.check_position_name_one partName,
658
+        isi.is_active_concealment hidden
659
+        from item_seizure_record isr
660
+        inner join item_seizure_items isi on isi.record_id = isr.id
661
+        where 1 = 1
662
+        and isr.process_status = 3
663
+        <if test="startDate != null and endDate != null">
664
+            AND isr.seizure_time >= #{startDate}
665
+            AND isr.seizure_time <![CDATA[ < ]]> date_add(#{endDate}, interval 1 day)
666
+        </if>
667
+    </select>
668
+
648 669
 </mapper>