Quellcode durchsuchen

15.添加不安全事件物品分布接口;
16.添加不安全事件类型分布接口;
17.添加不安全事件岗位分布接口;

sunpanhu vor 4 Wochen
Ursprung
Commit
a546b5ccc0

+ 49 - 0
airport-admin/src/main/java/com/sundot/airport/web/controller/ledger/LedgerUnsafeEventController.java

@@ -10,6 +10,10 @@ import com.sundot.airport.common.core.page.TableDataInfo;
10 10
 import com.sundot.airport.common.enums.BusinessType;
11 11
 import com.sundot.airport.common.utils.poi.ExcelUtil;
12 12
 import com.sundot.airport.ledger.domain.LedgerUnsafeEvent;
13
+import com.sundot.airport.ledger.domain.vo.CountQueryReqVO;
14
+import com.sundot.airport.ledger.domain.vo.UnsafeItemVO;
15
+import com.sundot.airport.ledger.domain.vo.UnsafePositionVO;
16
+import com.sundot.airport.ledger.domain.vo.UnsafeTypeVO;
13 17
 import com.sundot.airport.ledger.service.ILedgerUnsafeEventService;
14 18
 import org.springframework.beans.factory.annotation.Autowired;
15 19
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -47,4 +51,49 @@ public class LedgerUnsafeEventController extends BaseController {
47 51
     public AjaxResult getInfo(@PathVariable Long id) {
48 52
         return AjaxResult.success(service.getById(id));
49 53
     }
54
+
55
+    /**
56
+     * 功能描述:不安全事件物品分布
57
+     *
58
+     * @param countQueryReq 查询入参
59
+     * @return AjaxResult
60
+     * @method countSeizureStatsItem
61
+     * @author PanHu Sun
62
+     * @date 2026/5/20 16:24
63
+     */
64
+    @PostMapping("/countSeizureStatsItem")
65
+    public AjaxResult countSeizureStatsItem(@RequestBody CountQueryReqVO countQueryReq) {
66
+        List<UnsafeItemVO> unsafeItemList = service.countSeizureStatsItem(countQueryReq);
67
+        return AjaxResult.success(unsafeItemList);
68
+    }
69
+
70
+    /**
71
+     * 功能描述:不安全事件类型分布
72
+     *
73
+     * @param countQueryReq 查询入参
74
+     * @return AjaxResult
75
+     * @method countSeizureStatsItem
76
+     * @author PanHu Sun
77
+     * @date 2026/5/20 16:24
78
+     */
79
+    @PostMapping("/countSeizureStatsType")
80
+    public AjaxResult countSeizureStatsType(@RequestBody CountQueryReqVO countQueryReq) {
81
+        List<UnsafeTypeVO> unsafeTypeList = service.countSeizureStatsType(countQueryReq);
82
+        return AjaxResult.success(unsafeTypeList);
83
+    }
84
+
85
+    /**
86
+     * 功能描述:不安全事件岗位分布
87
+     *
88
+     * @param countQueryReq 查询入参
89
+     * @return AjaxResult
90
+     * @method countSeizureStatsItem
91
+     * @author PanHu Sun
92
+     * @date 2026/5/20 16:24
93
+     */
94
+    @PostMapping("/countSeizureStatsPost")
95
+    public AjaxResult countSeizureStatsPost(@RequestBody CountQueryReqVO countQueryReq) {
96
+        List<UnsafePositionVO> unsafePositionList = service.countSeizureStatsPost(countQueryReq);
97
+        return AjaxResult.success(unsafePositionList);
98
+    }
50 99
 }

+ 23 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/UnsafeItemVO.java

@@ -0,0 +1,23 @@
1
+package com.sundot.airport.ledger.domain.vo;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+
7
+/**
8
+ * 功能描述:不安全事件物品分布 Res Entity
9
+ *
10
+ * @author PanHu Sun
11
+ * @date 2026/5/20 16:37
12
+ */
13
+@Data
14
+public class UnsafeItemVO implements Serializable {
15
+    /**
16
+     * 涉及物品名称(饼图名称)
17
+     */
18
+    private String itemName;
19
+    /**
20
+     * 该物品不安全事件数量(饼图数值,统计条数)
21
+     */
22
+    private Integer itemNum;
23
+}

+ 27 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/UnsafePositionVO.java

@@ -0,0 +1,27 @@
1
+package com.sundot.airport.ledger.domain.vo;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+
7
+/**
8
+ * 功能描述:不安全事件岗位分布 Res Entity
9
+ *
10
+ * @author PanHu Sun
11
+ * @date 2026/5/20 17:19
12
+ */
13
+@Data
14
+public class UnsafePositionVO implements Serializable {
15
+    /**
16
+     * 岗位id
17
+     */
18
+    private String positionId;
19
+    /**
20
+     * 岗位名称
21
+     */
22
+    private String positionName;
23
+    /**
24
+     * 该岗位不安全事件数量
25
+     */
26
+    private Integer positionNum;
27
+}

+ 27 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/UnsafeTypeVO.java

@@ -0,0 +1,27 @@
1
+package com.sundot.airport.ledger.domain.vo;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+
7
+/**
8
+ * 功能描述:不安全事件类型分布 Res Entity
9
+ *
10
+ * @author PanHu Sun
11
+ * @date 2026/5/20 17:07
12
+ */
13
+@Data
14
+public class UnsafeTypeVO implements Serializable {
15
+    /**
16
+     * 事件类型值(数据字典)
17
+     */
18
+    private String eventType;
19
+    /**
20
+     * 事件类型名称(数据字典)
21
+     */
22
+    private String eventTypeName;
23
+    /**
24
+     * 该类型不安全事件数量(饼图数值,统计条数)
25
+     */
26
+    private Integer typeNum;
27
+}

+ 37 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/mapper/LedgerUnsafeEventMapper.java

@@ -3,10 +3,47 @@ package com.sundot.airport.ledger.mapper;
3 3
 import java.util.List;
4 4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 5
 import com.sundot.airport.ledger.domain.LedgerUnsafeEvent;
6
+import com.sundot.airport.ledger.domain.vo.CountQueryReqVO;
7
+import com.sundot.airport.ledger.domain.vo.UnsafeItemVO;
8
+import com.sundot.airport.ledger.domain.vo.UnsafePositionVO;
9
+import com.sundot.airport.ledger.domain.vo.UnsafeTypeVO;
6 10
 
7 11
 /**
8 12
  * 不安全事件记录Mapper接口
9 13
  */
10 14
 public interface LedgerUnsafeEventMapper extends BaseMapper<LedgerUnsafeEvent> {
11 15
     List<LedgerUnsafeEvent> selectList(LedgerUnsafeEvent query);
16
+
17
+    /**
18
+     * 功能描述:不安全事件物品分布
19
+     *
20
+     * @param query 查询参数
21
+     * @return List<UnsafeItemVO>
22
+     * @method countSeizureStatsItem
23
+     * @author PanHu Sun
24
+     * @date 2026/5/20 16:38
25
+     */
26
+    List<UnsafeItemVO> countSeizureStatsItem(CountQueryReqVO query);
27
+
28
+    /**
29
+     * 功能描述:不安全事件物品分布
30
+     *
31
+     * @param query 统计查询参数
32
+     * @return List<UnsafeTypeVO>
33
+     * @method countSeizureStatsType
34
+     * @author PanHu Sun
35
+     * @date 2026/5/20 17:10
36
+     */
37
+    List<UnsafeTypeVO> countSeizureStatsType(CountQueryReqVO query);
38
+
39
+    /**
40
+     * 功能描述:不安全事件岗位分布
41
+     *
42
+     * @param query 统计查询参数
43
+     * @return List<UnsafePositionVO>
44
+     * @method countSeizureStatsPost
45
+     * @author PanHu Sun
46
+     * @date 2026/5/20 17:21
47
+     */
48
+    List<UnsafePositionVO> countSeizureStatsPost(CountQueryReqVO query);
12 49
 }

+ 37 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/service/ILedgerUnsafeEventService.java

@@ -3,8 +3,45 @@ package com.sundot.airport.ledger.service;
3 3
 import java.util.List;
4 4
 import com.baomidou.mybatisplus.extension.service.IService;
5 5
 import com.sundot.airport.ledger.domain.LedgerUnsafeEvent;
6
+import com.sundot.airport.ledger.domain.vo.CountQueryReqVO;
7
+import com.sundot.airport.ledger.domain.vo.UnsafeItemVO;
8
+import com.sundot.airport.ledger.domain.vo.UnsafePositionVO;
9
+import com.sundot.airport.ledger.domain.vo.UnsafeTypeVO;
6 10
 
7 11
 public interface ILedgerUnsafeEventService extends IService<LedgerUnsafeEvent> {
8 12
     List<LedgerUnsafeEvent> selectList(LedgerUnsafeEvent query);
9 13
     int batchInsert(List<LedgerUnsafeEvent> list);
14
+
15
+    /**
16
+     * 功能描述:不安全事件物品分布
17
+     *
18
+     * @param countQueryReq 查询参数
19
+     * @return List<UnsafeItemVO>
20
+     * @method countSeizureStatsItem
21
+     * @author PanHu Sun
22
+     * @date 2026/5/20 16:41
23
+     */
24
+    List<UnsafeItemVO> countSeizureStatsItem(CountQueryReqVO countQueryReq);
25
+
26
+    /**
27
+     * 功能描述:countSeizureStatsType
28
+     *
29
+     * @param countQueryReq 查询参数
30
+     * @return List<UnsafeTypeVO>
31
+     * @method countSeizureStatsType
32
+     * @author PanHu Sun
33
+     * @date 2026/5/20 17:09
34
+     */
35
+    List<UnsafeTypeVO> countSeizureStatsType(CountQueryReqVO countQueryReq);
36
+
37
+    /**
38
+     * 功能描述:不安全事件岗位分布
39
+     *
40
+     * @param countQueryReq 查询参数
41
+     * @return List<UnsafePositionVO>
42
+     * @method countSeizureStatsPost
43
+     * @author PanHu Sun
44
+     * @date 2026/5/20 17:20
45
+     */
46
+    List<UnsafePositionVO> countSeizureStatsPost(CountQueryReqVO countQueryReq);
10 47
 }

+ 48 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/service/impl/LedgerUnsafeEventServiceImpl.java

@@ -1,9 +1,14 @@
1 1
 package com.sundot.airport.ledger.service.impl;
2 2
 
3
+import java.util.Collections;
3 4
 import java.util.List;
4 5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 6
 import com.sundot.airport.common.utils.DateUtils;
6 7
 import com.sundot.airport.ledger.domain.LedgerUnsafeEvent;
8
+import com.sundot.airport.ledger.domain.vo.CountQueryReqVO;
9
+import com.sundot.airport.ledger.domain.vo.UnsafeItemVO;
10
+import com.sundot.airport.ledger.domain.vo.UnsafePositionVO;
11
+import com.sundot.airport.ledger.domain.vo.UnsafeTypeVO;
7 12
 import com.sundot.airport.ledger.mapper.LedgerUnsafeEventMapper;
8 13
 import com.sundot.airport.ledger.service.ILedgerUnsafeEventService;
9 14
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,4 +37,47 @@ public class LedgerUnsafeEventServiceImpl extends ServiceImpl<LedgerUnsafeEventM
32 37
         saveBatch(list);
33 38
         return list.size();
34 39
     }
40
+
41
+    /**
42
+     * 功能描述:不安全事件物品分布
43
+     *
44
+     * @param countQueryReq 查询参数
45
+     * @return List<UnsafeItemVO>
46
+     * @method countSeizureStatsItem
47
+     * @author PanHu Sun
48
+     * @date 2026/5/20 16:41
49
+     */
50
+    @Override
51
+    public List<UnsafeItemVO> countSeizureStatsItem(CountQueryReqVO countQueryReq) {
52
+        // 无数据自动返回空数组,符合需求
53
+        return this.baseMapper.countSeizureStatsItem(countQueryReq);
54
+    }
55
+
56
+    /**
57
+     * 功能描述:countSeizureStatsType
58
+     *
59
+     * @param countQueryReq 查询参数
60
+     * @return List<UnsafeTypeVO>
61
+     * @method countSeizureStatsType
62
+     * @author PanHu Sun
63
+     * @date 2026/5/20 17:09
64
+     */
65
+    @Override
66
+    public List<UnsafeTypeVO> countSeizureStatsType(CountQueryReqVO countQueryReq) {
67
+        return this.baseMapper.countSeizureStatsType(countQueryReq);
68
+    }
69
+
70
+    /**
71
+     * 功能描述:不安全事件岗位分布
72
+     *
73
+     * @param countQueryReq 查询参数
74
+     * @return List<UnsafePositionVO>
75
+     * @method countSeizureStatsPost
76
+     * @author PanHu Sun
77
+     * @date 2026/5/20 17:20
78
+     */
79
+    @Override
80
+    public List<UnsafePositionVO> countSeizureStatsPost(CountQueryReqVO countQueryReq) {
81
+        return this.baseMapper.countSeizureStatsPost(countQueryReq);
82
+    }
35 83
 }

+ 49 - 0
airport-ledger/src/main/resources/mapper/ledger/LedgerUnsafeEventMapper.xml

@@ -56,4 +56,53 @@
56 56
         ORDER BY id DESC
57 57
     </select>
58 58
 
59
+    <select id="countSeizureStatsItem" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="com.sundot.airport.ledger.domain.vo.UnsafeItemVO">
60
+        SELECT involved_items AS itemName, COUNT(*) AS itemNum
61
+        FROM ledger_unsafe_event
62
+        WHERE
63
+            del_flag = '0'
64
+            AND record_date BETWEEN #{startDate} AND #{endDate}
65
+            <!-- 三级联动筛选 -->
66
+            <if test="deptId != null">AND dept_id = #{deptId}</if>
67
+            <if test="teamId != null">AND team_id = #{teamId}</if>
68
+            <if test="groupId != null">AND group_id = #{groupId}</if>
69
+            <!-- 过滤空物品脏数据 -->
70
+            AND involved_items IS NOT NULL AND involved_items != ''
71
+        GROUP BY involved_items
72
+        ORDER BY itemNum DESC
73
+    </select>
74
+
75
+    <select id="countSeizureStatsType" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="com.sundot.airport.ledger.domain.vo.UnsafeTypeVO">
76
+        SELECT
77
+            event_type AS eventType,
78
+            COUNT(*) AS typeNum
79
+        FROM ledger_unsafe_event
80
+        WHERE
81
+            del_flag = '0'
82
+            AND record_date BETWEEN #{startDate} AND #{endDate}
83
+            <!-- 三级联动筛选 -->
84
+            <if test="deptId != null">AND dept_id = #{deptId}</if>
85
+            <if test="teamId != null">AND team_id = #{teamId}</if>
86
+            <if test="groupId != null">AND group_id = #{groupId}</if>
87
+            <!-- 过滤空类型脏数据 -->
88
+            AND event_type IS NOT NULL AND event_type != ''
89
+        GROUP BY event_type
90
+        ORDER BY typeNum DESC
91
+    </select>
92
+
93
+    <select id="countSeizureStatsPost" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="com.sundot.airport.ledger.domain.vo.UnsafePositionVO">
94
+        SELECT position_id AS positionId, position AS positionName, COUNT(*) AS positionNum
95
+        FROM ledger_unsafe_event
96
+        WHERE
97
+            del_flag = '0'
98
+            AND record_date BETWEEN #{startDate} AND #{endDate}
99
+            <!-- 三级联动筛选 -->
100
+            <if test="deptId != null">AND dept_id = #{deptId}</if>
101
+            <if test="teamId != null">AND team_id = #{teamId}</if>
102
+            <if test="groupId != null">AND group_id = #{groupId}</if>
103
+            <!-- 过滤空岗位脏数据 -->
104
+            AND position IS NOT NULL AND position != ''
105
+        GROUP BY position_id, position
106
+        ORDER BY positionNum DESC
107
+    </select>
59 108
 </mapper>