Pārlūkot izejas kodu

10.添加近30天查获数量(总表)接口;
11.添加近30天查获数量(员工/小组/班组/部门)接口;

sunpanhu 4 nedēļas atpakaļ
vecāks
revīzija
4fe7284ae9

+ 33 - 0
airport-admin/src/main/java/com/sundot/airport/web/controller/ledger/LedgerSeizureStatsController.java

@@ -10,6 +10,9 @@ 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.LedgerSeizureStats;
13
+import com.sundot.airport.ledger.domain.vo.CountQueryReqVO;
14
+import com.sundot.airport.ledger.domain.vo.CountSeizureSingleQuantityResVO;
15
+import com.sundot.airport.ledger.domain.vo.CountSeizureTotalQuantityResVO;
13 16
 import com.sundot.airport.ledger.service.ILedgerSeizureStatsService;
14 17
 import org.springframework.beans.factory.annotation.Autowired;
15 18
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -47,4 +50,34 @@ public class LedgerSeizureStatsController extends BaseController {
47 50
     public AjaxResult getInfo(@PathVariable Long id) {
48 51
         return AjaxResult.success(service.getById(id));
49 52
     }
53
+
54
+    /**
55
+     * 功能描述:近30天查获数量(总表)
56
+     *
57
+     * @param countQueryReq 查询参数
58
+     * @return AjaxResult
59
+     * @method countSeizureTotalQuantity
60
+     * @author PanHu Sun
61
+     * @date 2026/5/20 10:32
62
+     */
63
+    @PostMapping("/countSeizureTotalQuantity")
64
+    public AjaxResult countSeizureTotalQuantity(@RequestBody CountQueryReqVO countQueryReq) {
65
+        List<CountSeizureTotalQuantityResVO> seizureQuantityList = service.countSeizureTotalQuantity(countQueryReq);
66
+        return AjaxResult.success(seizureQuantityList);
67
+    }
68
+
69
+    /**
70
+     * 功能描述:近30天查获数量(员工/小组/班组/部门)
71
+     *
72
+     * @param countQueryReq 查询参数
73
+     * @return AjaxResult
74
+     * @method countSeizureTotalQuantity
75
+     * @author PanHu Sun
76
+     * @date 2026/5/20 10:32
77
+     */
78
+    @PostMapping("/countSeizureTotalQuantity")
79
+    public AjaxResult countSeizureSingleQuantity(@RequestBody CountQueryReqVO countQueryReq) {
80
+        List<CountSeizureSingleQuantityResVO> seizureQuantityList = service.countSeizureSingleQuantity(countQueryReq);
81
+        return AjaxResult.success(seizureQuantityList);
82
+    }
50 83
 }

+ 2 - 2
airport-admin/src/main/java/com/sundot/airport/web/controller/ledger/OperationLanePeakThroughputController.java

@@ -3,7 +3,7 @@ package com.sundot.airport.web.controller.ledger;
3 3
 import java.util.List;
4 4
 import javax.servlet.http.HttpServletResponse;
5 5
 
6
-import com.sundot.airport.ledger.domain.vo.LaneThroughputReqVO;
6
+import com.sundot.airport.ledger.domain.vo.CountQueryReqVO;
7 7
 import com.sundot.airport.ledger.domain.vo.LaneThroughputResVO;
8 8
 import org.springframework.security.access.prepost.PreAuthorize;
9 9
 import org.springframework.beans.factory.annotation.Autowired;
@@ -110,7 +110,7 @@ public class OperationLanePeakThroughputController extends BaseController {
110 110
      * @date 2026/5/19 15:21
111 111
      */
112 112
     @PostMapping("/countLanePeakThroughput")
113
-    public AjaxResult countLanePeakThroughput(@RequestBody LaneThroughputReqVO LaneThroughputReq) {
113
+    public AjaxResult countLanePeakThroughput(@RequestBody CountQueryReqVO LaneThroughputReq) {
114 114
         List<LaneThroughputResVO> lanePeakThroughputList = operationLanePeakThroughputService.countLanePeakThroughput(LaneThroughputReq);
115 115
         return success(lanePeakThroughputList);
116 116
     }

+ 12 - 2
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/LaneThroughputReqVO.java

@@ -5,13 +5,13 @@ import lombok.Data;
5 5
 import java.io.Serializable;
6 6
 
7 7
 /**
8
- * 功能描述:统计通道日级别高峰时段过检率 Req Entity
8
+ * 功能描述:统计查询 Req Entity
9 9
  *
10 10
  * @author PanHu Sun
11 11
  * @date 2026/5/19 15:25
12 12
  */
13 13
 @Data
14
-public class LaneThroughputReqVO implements Serializable {
14
+public class CountQueryReqVO implements Serializable {
15 15
     /**
16 16
      * 部门ID
17 17
      */
@@ -26,4 +26,14 @@ public class LaneThroughputReqVO implements Serializable {
26 26
      * 小组ID
27 27
      */
28 28
     private Long groupId;
29
+
30
+    /**
31
+     * 开始时间
32
+     */
33
+    private String startDate;
34
+
35
+    /**
36
+     * 结束时间
37
+     */
38
+    private String endDate;
29 39
 }

+ 28 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/CountSeizureSingleQuantityResVO.java

@@ -0,0 +1,28 @@
1
+package com.sundot.airport.ledger.domain.vo;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+import java.util.Date;
7
+
8
+/**
9
+ * 功能描述:近30天查获数量(总表)
10
+ *
11
+ * @author PanHu Sun
12
+ * @date 2026/5/20 10:40
13
+ */
14
+@Data
15
+public class CountSeizureSingleQuantityResVO implements Serializable {
16
+    /**
17
+     * 日期(X轴)
18
+     */
19
+    private Date recordDate;
20
+    /**
21
+     * 维度名称:员工名/小组名/班组名/部门名(每条折线)
22
+     */
23
+    private String groupName;
24
+    /**
25
+     * 当日查获数量(Y轴)
26
+     */
27
+    private Integer seizeNum;
28
+}

+ 28 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/CountSeizureTotalQuantityResVO.java

@@ -0,0 +1,28 @@
1
+package com.sundot.airport.ledger.domain.vo;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+import java.util.Date;
7
+
8
+/**
9
+ * 功能描述:近30天查获数量(总表)
10
+ *
11
+ * @author PanHu Sun
12
+ * @date 2026/5/20 10:40
13
+ */
14
+@Data
15
+public class CountSeizureTotalQuantityResVO implements Serializable {
16
+    /**
17
+     * 查获日期
18
+     */
19
+    private Date recordDate;
20
+    /**
21
+     * 分组名称(部门/班组/小组/全量)
22
+     */
23
+    private String groupName;
24
+    /**
25
+     * 当日查获数量
26
+     */
27
+    private Integer seizeQuantity;
28
+}

+ 25 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/mapper/LedgerSeizureStatsMapper.java

@@ -3,6 +3,9 @@ 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.LedgerSeizureStats;
6
+import com.sundot.airport.ledger.domain.vo.CountQueryReqVO;
7
+import com.sundot.airport.ledger.domain.vo.CountSeizureSingleQuantityResVO;
8
+import com.sundot.airport.ledger.domain.vo.CountSeizureTotalQuantityResVO;
6 9
 import org.apache.ibatis.annotations.Param;
7 10
 
8 11
 /**
@@ -14,4 +17,26 @@ public interface LedgerSeizureStatsMapper extends BaseMapper<LedgerSeizureStats>
14 17
     int countByInspectorAndDateRange(@Param("inspectorName") String inspectorName,
15 18
                                      @Param("beginTime")     String beginTime,
16 19
                                      @Param("endTime")       String endTime);
20
+
21
+    /**
22
+     * 功能描述:近30天查获数量(总表)
23
+     *
24
+     * @param query 查询参数
25
+     * @return List<CountSeizureQuantityResVO>
26
+     * @method countSeizureTotalQuantity
27
+     * @author PanHu Sun
28
+     * @date 2026/5/20 11:09
29
+     */
30
+    List<CountSeizureTotalQuantityResVO> countSeizureTotalQuantity(CountQueryReqVO query);
31
+
32
+    /**
33
+     * 功能描述:近30天查获数量(员工/小组/班组/部门)
34
+     *
35
+     * @param query 查询参数
36
+     * @return List<CountSeizureSingleQuantityResVO>
37
+     * @method countSeizureTotalQuantity
38
+     * @author PanHu Sun
39
+     * @date 2026/5/20 11:09
40
+     */
41
+    List<CountSeizureSingleQuantityResVO> countSeizureSingleQuantity(CountQueryReqVO query);
17 42
 }

+ 2 - 2
airport-ledger/src/main/java/com/sundot/airport/ledger/mapper/OperationLanePeakThroughputMapper.java

@@ -3,7 +3,7 @@ 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.OperationLanePeakThroughput;
6
-import com.sundot.airport.ledger.domain.vo.LaneThroughputReqVO;
6
+import com.sundot.airport.ledger.domain.vo.CountQueryReqVO;
7 7
 import com.sundot.airport.ledger.domain.vo.LaneThroughputResVO;
8 8
 
9 9
 /**
@@ -27,5 +27,5 @@ public interface OperationLanePeakThroughputMapper extends BaseMapper<OperationL
27 27
      * @author PanHu Sun
28 28
      * @date 2026/5/19 15:31
29 29
      */
30
-    List<LaneThroughputResVO> countLanePeakThroughput(LaneThroughputReqVO queryVO);
30
+    List<LaneThroughputResVO> countLanePeakThroughput(CountQueryReqVO queryVO);
31 31
 }

+ 25 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/service/ILedgerSeizureStatsService.java

@@ -3,8 +3,33 @@ 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.LedgerSeizureStats;
6
+import com.sundot.airport.ledger.domain.vo.CountQueryReqVO;
7
+import com.sundot.airport.ledger.domain.vo.CountSeizureSingleQuantityResVO;
8
+import com.sundot.airport.ledger.domain.vo.CountSeizureTotalQuantityResVO;
6 9
 
7 10
 public interface ILedgerSeizureStatsService extends IService<LedgerSeizureStats> {
8 11
     List<LedgerSeizureStats> selectList(LedgerSeizureStats query);
9 12
     int batchInsert(List<LedgerSeizureStats> list);
13
+
14
+    /**
15
+     * 功能描述:近30天查获数量(总表)
16
+     *
17
+     * @param countQueryReq 查询参数
18
+     * @return List<CountSeizureQuantityResVO>
19
+     * @method countSeizureTotalQuantity
20
+     * @author PanHu Sun
21
+     * @date 2026/5/20 10:43
22
+     */
23
+    List<CountSeizureTotalQuantityResVO> countSeizureTotalQuantity(CountQueryReqVO countQueryReq);
24
+
25
+    /**
26
+     * 功能描述:近30天查获数量(员工/小组/班组/部门)
27
+     *
28
+     * @param countQueryReq 查询参数
29
+     * @return List<CountSeizureSingleQuantityResVO>
30
+     * @method countSeizureSingleQuantity
31
+     * @author PanHu Sun
32
+     * @date 2026/5/20 10:43
33
+     */
34
+    List<CountSeizureSingleQuantityResVO> countSeizureSingleQuantity(CountQueryReqVO countQueryReq);
10 35
 }

+ 2 - 2
airport-ledger/src/main/java/com/sundot/airport/ledger/service/IOperationLanePeakThroughputService.java

@@ -4,7 +4,7 @@ import java.util.List;
4 4
 
5 5
 import com.baomidou.mybatisplus.extension.service.IService;
6 6
 import com.sundot.airport.ledger.domain.OperationLanePeakThroughput;
7
-import com.sundot.airport.ledger.domain.vo.LaneThroughputReqVO;
7
+import com.sundot.airport.ledger.domain.vo.CountQueryReqVO;
8 8
 import com.sundot.airport.ledger.domain.vo.LaneThroughputResVO;
9 9
 
10 10
 /**
@@ -60,5 +60,5 @@ public interface IOperationLanePeakThroughputService extends IService<OperationL
60 60
      * @author PanHu Sun
61 61
      * @date 2026/5/19 15:29
62 62
      */
63
-    List<LaneThroughputResVO> countLanePeakThroughput(LaneThroughputReqVO laneThroughputQuery);
63
+    List<LaneThroughputResVO> countLanePeakThroughput(CountQueryReqVO laneThroughputQuery);
64 64
 }

+ 36 - 2
airport-ledger/src/main/java/com/sundot/airport/ledger/service/impl/LedgerSeizureStatsServiceImpl.java

@@ -1,9 +1,14 @@
1 1
 package com.sundot.airport.ledger.service.impl;
2 2
 
3 3
 import java.util.List;
4
+
5
+import cn.hutool.core.collection.CollUtil;
4 6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 7
 import com.sundot.airport.common.utils.DateUtils;
6 8
 import com.sundot.airport.ledger.domain.LedgerSeizureStats;
9
+import com.sundot.airport.ledger.domain.vo.CountQueryReqVO;
10
+import com.sundot.airport.ledger.domain.vo.CountSeizureSingleQuantityResVO;
11
+import com.sundot.airport.ledger.domain.vo.CountSeizureTotalQuantityResVO;
7 12
 import com.sundot.airport.ledger.mapper.LedgerSeizureStatsMapper;
8 13
 import com.sundot.airport.ledger.service.ILedgerSeizureStatsService;
9 14
 import org.springframework.beans.factory.annotation.Autowired;
@@ -14,8 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
14 19
  * 查获违规品统计Service实现
15 20
  */
16 21
 @Service
17
-public class LedgerSeizureStatsServiceImpl extends ServiceImpl<LedgerSeizureStatsMapper, LedgerSeizureStats>
18
-        implements ILedgerSeizureStatsService {
22
+public class LedgerSeizureStatsServiceImpl extends ServiceImpl<LedgerSeizureStatsMapper, LedgerSeizureStats> implements ILedgerSeizureStatsService {
19 23
 
20 24
     @Autowired
21 25
     private LedgerSeizureStatsMapper mapper;
@@ -32,4 +36,34 @@ public class LedgerSeizureStatsServiceImpl extends ServiceImpl<LedgerSeizureStat
32 36
         saveBatch(list);
33 37
         return list.size();
34 38
     }
39
+
40
+    /**
41
+     * 功能描述:近30天查获数量(总表)
42
+     *
43
+     * @param countQueryReq 查询参数
44
+     * @return List<CountSeizureQuantityResVO>
45
+     * @method countSeizureTotalQuantity
46
+     * @author PanHu Sun
47
+     * @date 2026/5/20 10:43
48
+     */
49
+    @Override
50
+    public List<CountSeizureTotalQuantityResVO> countSeizureTotalQuantity(CountQueryReqVO countQueryReq) {
51
+        List<CountSeizureTotalQuantityResVO> seizureQuantityResList = this.baseMapper.countSeizureTotalQuantity(countQueryReq);
52
+        return CollUtil.emptyIfNull(seizureQuantityResList);
53
+    }
54
+
55
+    /**
56
+     * 功能描述:近30天查获数量(员工/小组/班组/部门)
57
+     *
58
+     * @param countQueryReq 查询参数
59
+     * @return List<CountSeizureSingleQuantityResVO>
60
+     * @method countSeizureSingleQuantity
61
+     * @author PanHu Sun
62
+     * @date 2026/5/20 10:43
63
+     */
64
+    @Override
65
+    public List<CountSeizureSingleQuantityResVO> countSeizureSingleQuantity(CountQueryReqVO countQueryReq) {
66
+        List<CountSeizureSingleQuantityResVO> seizureQuantityResList = this.baseMapper.countSeizureSingleQuantity(countQueryReq);
67
+        return CollUtil.emptyIfNull(seizureQuantityResList);
68
+    }
35 69
 }

+ 2 - 2
airport-ledger/src/main/java/com/sundot/airport/ledger/service/impl/OperationLanePeakThroughputServiceImpl.java

@@ -8,7 +8,7 @@ import cn.hutool.core.collection.CollUtil;
8 8
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9 9
 import com.sundot.airport.common.utils.DateUtils;
10 10
 import com.sundot.airport.ledger.domain.OperationLanePeakThroughput;
11
-import com.sundot.airport.ledger.domain.vo.LaneThroughputReqVO;
11
+import com.sundot.airport.ledger.domain.vo.CountQueryReqVO;
12 12
 import com.sundot.airport.ledger.domain.vo.LaneThroughputResVO;
13 13
 import com.sundot.airport.ledger.mapper.OperationLanePeakThroughputMapper;
14 14
 import com.sundot.airport.ledger.service.IOperationLanePeakThroughputService;
@@ -97,7 +97,7 @@ public class OperationLanePeakThroughputServiceImpl extends ServiceImpl<Operatio
97 97
      * @date 2026/5/19 15:29
98 98
      */
99 99
     @Override
100
-    public List<LaneThroughputResVO> countLanePeakThroughput(LaneThroughputReqVO laneThroughputQuery) {
100
+    public List<LaneThroughputResVO> countLanePeakThroughput(CountQueryReqVO laneThroughputQuery) {
101 101
         // 核心逻辑:未选择任何筛选条件,返回空数组
102 102
         if (Objects.isNull(laneThroughputQuery.getDeptId()) && Objects.isNull(laneThroughputQuery.getTeamId()) && Objects.isNull(laneThroughputQuery.getGroupId())) {
103 103
             return Collections.emptyList();

+ 65 - 0
airport-ledger/src/main/resources/mapper/ledger/LedgerSeizureStatsMapper.xml

@@ -84,4 +84,69 @@
84 84
           </if>
85 85
     </select>
86 86
 
87
+    <select id="countSeizureTotalQuantity" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="com.sundot.airport.ledger.domain.vo.CountSeizureTotalQuantityResVO">
88
+        SELECT
89
+            record_date AS recordDate,
90
+            <!-- 动态分组名称 -->
91
+            <choose>
92
+                <when test="groupId != null">group_name AS groupName</when>
93
+                <when test="teamId != null">team_name AS groupName</when>
94
+                <when test="deptId != null">dept_name AS groupName</when>
95
+                <otherwise>'站' AS groupName</otherwise>
96
+            </choose>,
97
+            IFNULL(SUM(item_quantity), 0) AS seizeNum
98
+        FROM ledger_seizure_stats
99
+        WHERE
100
+            del_flag = '0'
101
+            <!-- 近30天自然日 -->
102
+            AND record_date >= DATE_SUB(CURDATE(), INTERVAL 29 DAY)
103
+            AND record_date &lt;= CURDATE()
104
+            <!-- 三级动态筛选 -->
105
+            <if test="deptId != null">AND dept_id = #{deptId}</if>
106
+            <if test="teamId != null">AND team_id = #{teamId}</if>
107
+            <if test="groupId != null">AND group_id = #{groupId}</if>
108
+        <!-- 动态分组:重点!全为空时仅按日期分组 -->
109
+        GROUP BY
110
+            <choose>
111
+                <when test="groupId != null">group_id, record_date</when>
112
+                <when test="teamId != null">team_id, record_date</when>
113
+                <when test="deptId != null">dept_id, record_date</when>
114
+                <otherwise>record_date</otherwise>
115
+            </choose>
116
+        ORDER BY record_date ASC
117
+    </select>
118
+
119
+
120
+    <select id="countSeizureSingleQuantity" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="com.sundot.airport.ledger.domain.vo.CountSeizureSingleQuantityResVO">
121
+        SELECT
122
+            record_date AS recordDate,
123
+            <!-- 动态显示维度名称:员工/小组/班组/部门 -->
124
+            <choose>
125
+                <when test="groupId != null">inspector_name AS groupName</when>
126
+                <when test="teamId != null">group_name AS groupName</when>
127
+                <when test="deptId != null">team_name AS groupName</when>
128
+                <otherwise>dept_name AS groupName</otherwise>
129
+            </choose>,
130
+            IFNULL(SUM(item_quantity), 0) AS seizeNum
131
+        FROM ledger_seizure_stats
132
+        WHERE
133
+            del_flag = '0'
134
+            <!-- 近30天自然日 -->
135
+            AND record_date >= DATE_SUB(CURDATE(), INTERVAL 29 DAY)
136
+            AND record_date &lt;= CURDATE()
137
+            <!-- 三级筛选条件 -->
138
+            <if test="deptId != null">AND dept_id = #{deptId}</if>
139
+            <if test="teamId != null">AND team_id = #{teamId}</if>
140
+            <if test="groupId != null">AND group_id = #{groupId}</if>
141
+        <!-- 动态分组,严格层级下钻 -->
142
+        GROUP BY
143
+            <choose>
144
+                <when test="groupId != null">inspector_id, record_date</when>
145
+                <when test="teamId != null">group_id, record_date</when>
146
+                <when test="deptId != null">team_id, record_date</when>
147
+                <otherwise>dept_id, record_date</otherwise>
148
+            </choose>
149
+        ORDER BY record_date ASC
150
+    </select>
151
+
87 152
 </mapper>

+ 1 - 1
airport-ledger/src/main/resources/mapper/ledger/OperationLanePeakThroughputMapper.xml

@@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
49 49
         order by record_date desc, create_time desc
50 50
     </select>
51 51
 
52
-    <select id="countLanePeakThroughput" parameterType="com.sundot.airport.ledger.domain.vo.LaneThroughputReqVO" resultType="com.sundot.airport.ledger.domain.vo.LaneThroughputResVO">
52
+    <select id="countLanePeakThroughput" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="com.sundot.airport.ledger.domain.vo.LaneThroughputResVO">
53 53
         SELECT
54 54
             record_date AS recordDate,
55 55
             <!-- 动态分组名称:小组>班组>部门 -->