2 Revize 959231fdb2 ... 3df79789c6

Autor SHA1 Zpráva Datum
  sunpanhu 3df79789c6 Merge remote-tracking branch 'origin/master' před 1 měsícem
  sunpanhu dadd0652c2 1.添加"统计通道日级别高峰时段过检率"接口; před 1 měsícem
17 změnil soubory, kde provedl 399 přidání a 2 odebrání
  1. 18 0
      airport-admin/src/main/java/com/sundot/airport/web/controller/ledger/OperationLanePeakThroughputController.java
  2. 16 0
      airport-admin/src/main/java/com/sundot/airport/web/controller/ledger/OperationStationHourlyThroughputController.java
  3. 3 1
      airport-ledger/src/main/java/com/sundot/airport/ledger/domain/OperationLanePeakThroughput.java
  4. 3 0
      airport-ledger/src/main/java/com/sundot/airport/ledger/domain/OperationStationHourlyThroughput.java
  5. 27 0
      airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/AreaFlowVO.java
  6. 29 0
      airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/LaneThroughputReqVO.java
  7. 41 0
      airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/LaneThroughputResVO.java
  8. 30 0
      airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/StationHourlyThroughputGroupResVO.java
  9. 25 0
      airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/StationHourlyThroughputVO.java
  10. 13 0
      airport-ledger/src/main/java/com/sundot/airport/ledger/mapper/OperationLanePeakThroughputMapper.java
  11. 11 0
      airport-ledger/src/main/java/com/sundot/airport/ledger/mapper/OperationStationHourlyThroughputMapper.java
  12. 14 0
      airport-ledger/src/main/java/com/sundot/airport/ledger/service/IOperationLanePeakThroughputService.java
  13. 11 0
      airport-ledger/src/main/java/com/sundot/airport/ledger/service/IOperationStationHourlyThroughputService.java
  14. 25 0
      airport-ledger/src/main/java/com/sundot/airport/ledger/service/impl/OperationLanePeakThroughputServiceImpl.java
  15. 55 0
      airport-ledger/src/main/java/com/sundot/airport/ledger/service/impl/OperationStationHourlyThroughputServiceImpl.java
  16. 52 0
      airport-ledger/src/main/resources/mapper/ledger/OperationLanePeakThroughputMapper.xml
  17. 26 1
      airport-ledger/src/main/resources/mapper/ledger/OperationStationHourlyThroughputMapper.xml

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

@@ -2,6 +2,9 @@ package com.sundot.airport.web.controller.ledger;
2 2
 
3 3
 import java.util.List;
4 4
 import javax.servlet.http.HttpServletResponse;
5
+
6
+import com.sundot.airport.ledger.domain.vo.LaneThroughputReqVO;
7
+import com.sundot.airport.ledger.domain.vo.LaneThroughputResVO;
5 8
 import org.springframework.security.access.prepost.PreAuthorize;
6 9
 import org.springframework.beans.factory.annotation.Autowired;
7 10
 import org.springframework.web.bind.annotation.GetMapping;
@@ -96,4 +99,19 @@ public class OperationLanePeakThroughputController extends BaseController {
96 99
     public AjaxResult remove(@PathVariable Long[] ids) {
97 100
         return toAjax(operationLanePeakThroughputService.deleteOperationLanePeakThroughputByIds(ids));
98 101
     }
102
+
103
+    /**
104
+     * 功能描述:统计通道日级别高峰时段过检率(小组/班组/部门级别)
105
+     *
106
+     * @param LaneThroughputReq 筛选条件
107
+     * @return AjaxResult
108
+     * @method countLanePeakThroughput
109
+     * @author PanHu Sun
110
+     * @date 2026/5/19 15:21
111
+     */
112
+    @PostMapping("/countLanePeakThroughput")
113
+    public AjaxResult countLanePeakThroughput(@RequestBody LaneThroughputReqVO LaneThroughputReq) {
114
+        List<LaneThroughputResVO> lanePeakThroughputList = operationLanePeakThroughputService.countLanePeakThroughput(LaneThroughputReq);
115
+        return success(lanePeakThroughputList);
116
+    }
99 117
 }

+ 16 - 0
airport-admin/src/main/java/com/sundot/airport/web/controller/ledger/OperationStationHourlyThroughputController.java

@@ -2,6 +2,8 @@ package com.sundot.airport.web.controller.ledger;
2 2
 
3 3
 import java.util.List;
4 4
 import javax.servlet.http.HttpServletResponse;
5
+
6
+import com.sundot.airport.ledger.domain.vo.StationHourlyThroughputGroupResVO;
5 7
 import org.springframework.security.access.prepost.PreAuthorize;
6 8
 import org.springframework.beans.factory.annotation.Autowired;
7 9
 import org.springframework.web.bind.annotation.GetMapping;
@@ -96,4 +98,18 @@ public class OperationStationHourlyThroughputController extends BaseController {
96 98
     public AjaxResult remove(@PathVariable Long[] ids) {
97 99
         return toAjax(operationStationHourlyThroughputService.deleteOperationStationHourlyThroughputByIds(ids));
98 100
     }
101
+
102
+    /**
103
+     * 功能描述:统计站级时间段人流量
104
+     *
105
+     * @return AjaxResult
106
+     * @method countLanePeakThroughput
107
+     * @author PanHu Sun
108
+     * @date 2026/5/19 15:21
109
+     */
110
+    @GetMapping("/countStationHourlyThroughput")
111
+    public AjaxResult countStationHourlyThroughput() {
112
+        List<StationHourlyThroughputGroupResVO> StationHourlyThroughputList = operationStationHourlyThroughputService.countStationHourlyThroughput();
113
+        return success(StationHourlyThroughputList);
114
+    }
99 115
 }

+ 3 - 1
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/OperationLanePeakThroughput.java

@@ -1,6 +1,8 @@
1 1
 package com.sundot.airport.ledger.domain;
2 2
 
3 3
 import java.math.BigDecimal;
4
+import java.util.Date;
5
+
4 6
 import com.baomidou.mybatisplus.annotation.IdType;
5 7
 import com.baomidou.mybatisplus.annotation.TableId;
6 8
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -51,7 +53,7 @@ public class OperationLanePeakThroughput extends BaseEntity {
51 53
     /** 记录日期 */
52 54
     @JsonFormat(pattern = "yyyy-MM-dd")
53 55
     @Excel(name = "记录日期", width = 20, dateFormat = "yyyy-MM-dd")
54
-    private java.util.Date recordDate;
56
+    private Date recordDate;
55 57
 
56 58
     /** 小时(记录高峰时段,以流量峰值前后半小时计算) */
57 59
     @Excel(name = "小时")

+ 3 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/OperationStationHourlyThroughput.java

@@ -23,6 +23,9 @@ public class OperationStationHourlyThroughput extends BaseEntity {
23 23
     @TableId(type = IdType.AUTO)
24 24
     private Long id;
25 25
 
26
+    /** 区域ID */
27
+    private String areaId;
28
+
26 29
     /** 部门ID */
27 30
     private Long deptId;
28 31
 

+ 27 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/AreaFlowVO.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
+ * 功能描述:单个区域人流量(小时组内的子项)
9
+ *
10
+ * @author PanHu Sun
11
+ * @date 2026/5/19 16:55
12
+ */
13
+@Data
14
+public class AreaFlowVO implements Serializable {
15
+    /**
16
+     * 区域ID
17
+     */
18
+    private String areaId;
19
+    /**
20
+     * 区域名称
21
+     */
22
+    private String areaName;
23
+    /**
24
+     * 当前区域人流量
25
+     */
26
+    private Integer areaFlow;
27
+}

+ 29 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/LaneThroughputReqVO.java

@@ -0,0 +1,29 @@
1
+package com.sundot.airport.ledger.domain.vo;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+
7
+/**
8
+ * 功能描述:统计通道日级别高峰时段过检率 Req Entity
9
+ *
10
+ * @author PanHu Sun
11
+ * @date 2026/5/19 15:25
12
+ */
13
+@Data
14
+public class LaneThroughputReqVO implements Serializable {
15
+    /**
16
+     * 部门ID
17
+     */
18
+    private Long deptId;
19
+
20
+    /**
21
+     * 班组ID
22
+     */
23
+    private Long teamId;
24
+
25
+    /**
26
+     * 小组ID
27
+     */
28
+    private Long groupId;
29
+}

+ 41 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/LaneThroughputResVO.java

@@ -0,0 +1,41 @@
1
+package com.sundot.airport.ledger.domain.vo;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+import java.math.BigDecimal;
7
+import java.util.Date;
8
+
9
+/**
10
+ * 功能描述:统计通道日级别高峰时段过检率 Res Entity
11
+ *
12
+ * @author PanHu Sun
13
+ * @date 2026/5/19 15:27
14
+ */
15
+@Data
16
+public class LaneThroughputResVO implements Serializable {
17
+    /**
18
+     * 日期
19
+     */
20
+    private Date recordDate;
21
+
22
+    /**
23
+     * 分组名称(部门/班组/小组 自动适配)
24
+     */
25
+    private String groupName;
26
+
27
+    /**
28
+     * 总过检人数(湖绿色柱形数据)
29
+     */
30
+    private Integer totalThroughput;
31
+
32
+    /**
33
+     * 总录入条数
34
+     */
35
+    private Integer totalRecord;
36
+
37
+    /**
38
+     * 过检率(保留1位小数)
39
+     */
40
+    private BigDecimal throughputRate;
41
+}

+ 30 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/StationHourlyThroughputGroupResVO.java

@@ -0,0 +1,30 @@
1
+package com.sundot.airport.ledger.domain.vo;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+import java.util.List;
7
+
8
+/**
9
+ * 功能描述:统计通道站级别高峰时段过检率 Res Entity
10
+ *
11
+ * @author PanHu Sun
12
+ * @date 2026/5/19 15:48
13
+ */
14
+@Data
15
+public class StationHourlyThroughputGroupResVO implements Serializable {
16
+    /**
17
+     * 小时(0,1,2...23)
18
+     */
19
+    private String hourOfDay;
20
+
21
+    /**
22
+     * 当前小时 所有区域总人流量
23
+     */
24
+    private Integer totalHourFlow;
25
+
26
+    /**
27
+     * 当前小时 所有区域的人流量列表
28
+     */
29
+    private List<AreaFlowVO> areaList;
30
+}

+ 25 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/StationHourlyThroughputVO.java

@@ -0,0 +1,25 @@
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/19 15:48
12
+ */
13
+@Data
14
+public class StationHourlyThroughputVO implements Serializable {
15
+    // 小时段
16
+    private String hourOfDay;
17
+    // 区域ID
18
+    private String areaId;
19
+    // 区域名称
20
+    private String areaName;
21
+    // 当前区域人流量
22
+    private Integer areaFlow;
23
+    // 当前小时所有区域总人流量
24
+    private Integer totalHourFlow;
25
+}

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

@@ -3,6 +3,8 @@ 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;
7
+import com.sundot.airport.ledger.domain.vo.LaneThroughputResVO;
6 8
 
7 9
 /**
8 10
  * 通道日别高峰时段过检Mapper接口
@@ -15,4 +17,15 @@ public interface OperationLanePeakThroughputMapper extends BaseMapper<OperationL
15 17
      * @return 通道日别高峰时段过检集合
16 18
      */
17 19
     List<OperationLanePeakThroughput> selectOperationLanePeakThroughputList(OperationLanePeakThroughput operationLanePeakThroughput);
20
+
21
+    /**
22
+     * 功能描述:统计近30天过检数据(三级联动筛选)
23
+     *
24
+     * @param queryVO 筛选条件
25
+     * @return List<LaneThroughputStatsVO>
26
+     * @method countLanePeakThroughput
27
+     * @author PanHu Sun
28
+     * @date 2026/5/19 15:31
29
+     */
30
+    List<LaneThroughputResVO> countLanePeakThroughput(LaneThroughputReqVO queryVO);
18 31
 }

+ 11 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/mapper/OperationStationHourlyThroughputMapper.java

@@ -3,6 +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.OperationStationHourlyThroughput;
6
+import com.sundot.airport.ledger.domain.vo.StationHourlyThroughputVO;
6 7
 
7 8
 /**
8 9
  * 站级时间段别总过检Mapper接口
@@ -15,4 +16,14 @@ public interface OperationStationHourlyThroughputMapper extends BaseMapper<Opera
15 16
      * @return 站级时间段别总过检集合
16 17
      */
17 18
     List<OperationStationHourlyThroughput> selectOperationStationHourlyThroughputList(OperationStationHourlyThroughput operationStationHourlyThroughput);
19
+
20
+    /**
21
+     * 功能描述:统计站级时间段人流量
22
+     *
23
+     * @return List<StationHourlyThroughputResVO>
24
+     * @method countStationHourlyThroughput
25
+     * @author PanHu Sun
26
+     * @date 2026/5/19 16:48
27
+     */
28
+    List<StationHourlyThroughputVO> countStationHourlyThroughput();
18 29
 }

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

@@ -1,8 +1,11 @@
1 1
 package com.sundot.airport.ledger.service;
2 2
 
3 3
 import java.util.List;
4
+
4 5
 import com.baomidou.mybatisplus.extension.service.IService;
5 6
 import com.sundot.airport.ledger.domain.OperationLanePeakThroughput;
7
+import com.sundot.airport.ledger.domain.vo.LaneThroughputReqVO;
8
+import com.sundot.airport.ledger.domain.vo.LaneThroughputResVO;
6 9
 
7 10
 /**
8 11
  * 通道日别高峰时段过检Service接口
@@ -47,4 +50,15 @@ public interface IOperationLanePeakThroughputService extends IService<OperationL
47 50
      * @return 结果
48 51
      */
49 52
     int deleteOperationLanePeakThroughputById(Long id);
53
+
54
+    /**
55
+     * 功能描述:统计通道日级别高峰时段过检率
56
+     *
57
+     * @param laneThroughputQuery 筛选条件
58
+     * @return List<LaneThroughputStatsVO>
59
+     * @method countLanePeakThroughput
60
+     * @author PanHu Sun
61
+     * @date 2026/5/19 15:29
62
+     */
63
+    List<LaneThroughputResVO> countLanePeakThroughput(LaneThroughputReqVO laneThroughputQuery);
50 64
 }

+ 11 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/service/IOperationStationHourlyThroughputService.java

@@ -3,6 +3,7 @@ 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.OperationStationHourlyThroughput;
6
+import com.sundot.airport.ledger.domain.vo.StationHourlyThroughputGroupResVO;
6 7
 
7 8
 /**
8 9
  * 站级时间段别总过检Service接口
@@ -47,4 +48,14 @@ public interface IOperationStationHourlyThroughputService extends IService<Opera
47 48
      * @return 结果
48 49
      */
49 50
     int deleteOperationStationHourlyThroughputById(Long id);
51
+
52
+    /**
53
+     * 功能描述:统计站级时间段人流量
54
+     *
55
+     * @return List<StationHourlyThroughputGroupResVO> 站级时间段人流量
56
+     * @method countStationHourlyThroughput
57
+     * @author PanHu Sun
58
+     * @date 2026/5/19 16:46
59
+     */
60
+    List<StationHourlyThroughputGroupResVO> countStationHourlyThroughput();
50 61
 }

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

@@ -1,9 +1,15 @@
1 1
 package com.sundot.airport.ledger.service.impl;
2 2
 
3
+import java.util.Collections;
3 4
 import java.util.List;
5
+import java.util.Objects;
6
+
7
+import cn.hutool.core.collection.CollUtil;
4 8
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 9
 import com.sundot.airport.common.utils.DateUtils;
6 10
 import com.sundot.airport.ledger.domain.OperationLanePeakThroughput;
11
+import com.sundot.airport.ledger.domain.vo.LaneThroughputReqVO;
12
+import com.sundot.airport.ledger.domain.vo.LaneThroughputResVO;
7 13
 import com.sundot.airport.ledger.mapper.OperationLanePeakThroughputMapper;
8 14
 import com.sundot.airport.ledger.service.IOperationLanePeakThroughputService;
9 15
 import org.springframework.beans.factory.annotation.Autowired;
@@ -80,4 +86,23 @@ public class OperationLanePeakThroughputServiceImpl extends ServiceImpl<Operatio
80 86
     public int deleteOperationLanePeakThroughputById(Long id) {
81 87
         return operationLanePeakThroughputMapper.deleteById(id);
82 88
     }
89
+
90
+    /**
91
+     * 功能描述:统计通道日级别高峰时段过检率
92
+     *
93
+     * @param laneThroughputQuery 筛选条件
94
+     * @return List<LaneThroughputStatsVO>
95
+     * @method countLanePeakThroughput
96
+     * @author PanHu Sun
97
+     * @date 2026/5/19 15:29
98
+     */
99
+    @Override
100
+    public List<LaneThroughputResVO> countLanePeakThroughput(LaneThroughputReqVO laneThroughputQuery) {
101
+        // 核心逻辑:未选择任何筛选条件,返回空数组
102
+        if (Objects.isNull(laneThroughputQuery.getDeptId()) && Objects.isNull(laneThroughputQuery.getTeamId()) && Objects.isNull(laneThroughputQuery.getGroupId())) {
103
+            return Collections.emptyList();
104
+        }
105
+        List<LaneThroughputResVO> laneThroughputResList = this.baseMapper.countLanePeakThroughput(laneThroughputQuery);
106
+        return CollUtil.emptyIfNull(laneThroughputResList);
107
+    }
83 108
 }

+ 55 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/service/impl/OperationStationHourlyThroughputServiceImpl.java

@@ -1,9 +1,18 @@
1 1
 package com.sundot.airport.ledger.service.impl;
2 2
 
3
+import java.util.Collections;
3 4
 import java.util.List;
5
+import java.util.Map;
6
+import java.util.Set;
7
+import java.util.stream.Collectors;
8
+
9
+import cn.hutool.core.collection.CollUtil;
4 10
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 11
 import com.sundot.airport.common.utils.DateUtils;
6 12
 import com.sundot.airport.ledger.domain.OperationStationHourlyThroughput;
13
+import com.sundot.airport.ledger.domain.vo.AreaFlowVO;
14
+import com.sundot.airport.ledger.domain.vo.StationHourlyThroughputGroupResVO;
15
+import com.sundot.airport.ledger.domain.vo.StationHourlyThroughputVO;
7 16
 import com.sundot.airport.ledger.mapper.OperationStationHourlyThroughputMapper;
8 17
 import com.sundot.airport.ledger.service.IOperationStationHourlyThroughputService;
9 18
 import org.springframework.beans.factory.annotation.Autowired;
@@ -80,4 +89,50 @@ public class OperationStationHourlyThroughputServiceImpl extends ServiceImpl<Ope
80 89
     public int deleteOperationStationHourlyThroughputById(Long id) {
81 90
         return operationStationHourlyThroughputMapper.deleteById(id);
82 91
     }
92
+
93
+    /**
94
+     * 功能描述:统计站级时间段人流量
95
+     *
96
+     * @return List<StationHourlyThroughputGroupResVO> 站级时间段人流量
97
+     * @method countStationHourlyThroughput
98
+     * @author PanHu Sun
99
+     * @date 2026/5/19 16:46
100
+     */
101
+    @Override
102
+    public List<StationHourlyThroughputGroupResVO> countStationHourlyThroughput() {
103
+        List<StationHourlyThroughputVO> stationHourlyThroughputList = this.baseMapper.countStationHourlyThroughput();
104
+        if (CollUtil.isEmpty(stationHourlyThroughputList)) {
105
+            return Collections.emptyList();
106
+        }
107
+
108
+        // 1. 预处理:获取区域名称
109
+        Set<String> areaIds = stationHourlyThroughputList.stream().map(StationHourlyThroughputVO::getAreaId).collect(Collectors.toSet());
110
+
111
+        // TODO PanHu Sun 2026/5/19 17:16 待办事项:查询base_position表获取区域名称
112
+
113
+        // 2. 核心:按小时分组 → 组装成前端需要的层级结构
114
+        Map<String, List<StationHourlyThroughputVO>> hourGroupMap = stationHourlyThroughputList.stream().collect(Collectors.groupingBy(StationHourlyThroughputVO::getHourOfDay));
115
+
116
+        return hourGroupMap.entrySet().stream().map(entry -> {
117
+            String hour = entry.getKey();
118
+            List<StationHourlyThroughputVO> hourDataList = entry.getValue();
119
+
120
+            // 构建区域列表
121
+            List<AreaFlowVO> areaList = hourDataList.stream().map(stats -> {
122
+                AreaFlowVO areaFlowVO = new AreaFlowVO();
123
+                areaFlowVO.setAreaId(stats.getAreaId());
124
+                areaFlowVO.setAreaFlow(stats.getAreaFlow());
125
+                return areaFlowVO;
126
+            }).collect(Collectors.toList());
127
+
128
+            // 构建小时分组对象
129
+            StationHourlyThroughputGroupResVO groupVO = new StationHourlyThroughputGroupResVO();
130
+            groupVO.setHourOfDay(hour);
131
+            // 总人流量(取第一条即可,同小时数据总流量一致)
132
+            groupVO.setTotalHourFlow(hourDataList.get(0).getTotalHourFlow());
133
+            // 区域信息
134
+            groupVO.setAreaList(areaList);
135
+            return groupVO;
136
+        }).collect(Collectors.toList());
137
+    }
83 138
 }

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

@@ -49,4 +49,56 @@ 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">
53
+        SELECT
54
+            record_date AS recordDate,
55
+            <!-- 动态分组名称:小组>班组>部门 -->
56
+            <choose>
57
+                <when test="groupId != null">
58
+                    group_name AS groupName
59
+                </when>
60
+                <when test="teamId != null">
61
+                    team_name AS groupName
62
+                </when>
63
+                <when test="deptId != null">
64
+                    dept_name AS groupName
65
+                </when>
66
+            </choose>,
67
+            SUM(throughput) AS totalThroughput,
68
+            COUNT(*) AS totalRecord,
69
+            <!-- 过检率:分母0返回0.0,保留1位小数 -->
70
+            ROUND(IF(COUNT(*) = 0, 0, SUM(throughput) / COUNT(*)), 1) AS throughputRate
71
+        FROM operation_lane_peak_throughput
72
+        WHERE
73
+            del_flag = '0'
74
+            <!-- 近30天自然日 -->
75
+            AND record_date >= DATE_SUB(CURDATE(), INTERVAL 29 DAY)
76
+            AND record_date &lt;= CURDATE()
77
+            <!-- 三级联动动态筛选 -->
78
+            <if test="deptId != null">
79
+                AND dept_id = #{deptId}
80
+            </if>
81
+            <if test="teamId != null">
82
+                AND team_id = #{teamId}
83
+            </if>
84
+            <if test="groupId != null">
85
+                AND group_id = #{groupId}
86
+            </if>
87
+            <!-- 动态分组:按选中层级+日期分组 -->
88
+        GROUP BY
89
+            <choose>
90
+                <when test="groupId != null">
91
+                    group_id, record_date
92
+                </when>
93
+                <when test="teamId != null">
94
+                    team_id, record_date
95
+                </when>
96
+                <when test="deptId != null">
97
+                    dept_id, record_date
98
+                </when>
99
+            </choose>
100
+        <!-- 按日期升序,大屏展示顺序 -->
101
+        ORDER BY record_date ASC
102
+    </select>
103
+
52 104
 </mapper>

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

@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
6 6
     
7 7
     <resultMap type="OperationStationHourlyThroughput" id="OperationStationHourlyThroughputResult">
8 8
         <id     property="id"              column="id"              />
9
+        <result property="areaId"          column="area_id"         />
9 10
         <result property="deptId"          column="dept_id"         />
10 11
         <result property="deptName"        column="dept_name"       />
11 12
         <result property="teamId"          column="team_id"         />
@@ -26,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
26 27
     </resultMap>
27 28
 
28 29
     <sql id="selectOperationStationHourlyThroughputVo">
29
-        select id, dept_id, dept_name, team_id, team_name, group_id, group_name, 
30
+        select id, area_id, dept_id, dept_name, team_id, team_name, group_id, group_name,
30 31
                lane_id, record_date, hour_of_day, throughput, throughput_rate, remark, 
31 32
                create_by, create_time, update_by, update_time, del_flag
32 33
         from operation_station_hourly_throughput
@@ -36,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
36 37
         <include refid="selectOperationStationHourlyThroughputVo"/>
37 38
         <where>  
38 39
             del_flag = '0'
40
+            <if test="areaId != null and areaId != '' "> and area_id = #{areaId}</if>
39 41
             <if test="deptId != null "> and dept_id = #{deptId}</if>
40 42
             <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
41 43
             <if test="teamId != null "> and team_id = #{teamId}</if>
@@ -49,4 +51,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
49 51
         order by record_date desc, create_time desc
50 52
     </select>
51 53
 
54
+    <select id="countStationHourlyThroughput" resultType="com.sundot.airport.ledger.domain.vo.StationHourlyThroughputVO">
55
+        SELECT
56
+            t.hour_of_day AS hourOfDay,
57
+            t.area_id AS areaId,
58
+            IFNULL(SUM(t.throughput), 0) AS areaFlow,
59
+            t.total_hour_flow AS totalHourFlow
60
+        FROM (
61
+            SELECT
62
+                hour_of_day,
63
+                area_id,
64
+                throughput,
65
+                SUM(throughput) OVER (PARTITION BY hour_of_day) AS total_hour_flow
66
+            FROM operation_station_hourly_throughput
67
+            WHERE
68
+                del_flag = '0'
69
+                AND hour_of_day IS NOT NULL
70
+                AND hour_of_day != ''
71
+            -- 近24小时自动匹配
72
+            AND STR_TO_DATE(CONCAT(record_date, hour_of_day), '%Y%m%d%H') >= DATE_SUB(NOW(), INTERVAL 24 HOUR)
73
+        ) t
74
+        GROUP BY t.hour_of_day, t.area_id
75
+        ORDER BY t.hour_of_day ASC
76
+    </select>
52 77
 </mapper>