浏览代码

安保测试统计

chenshudong 4 周之前
父节点
当前提交
3570464ca3

+ 39 - 0
airport-admin/src/main/java/com/sundot/airport/web/controller/ledger/LedgerSecurityTestController.java

@@ -10,6 +10,8 @@ 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.LedgerSecurityTest;
13
+import com.sundot.airport.ledger.domain.vo.LedgerSecurityTestQueryReqVO;
14
+import com.sundot.airport.ledger.domain.vo.LedgerSecurityTestResVO;
13 15
 import com.sundot.airport.ledger.service.ILedgerSecurityTestService;
14 16
 import org.springframework.beans.factory.annotation.Autowired;
15 17
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -47,4 +49,41 @@ public class LedgerSecurityTestController extends BaseController {
47 49
     public AjaxResult getInfo(@PathVariable Long id) {
48 50
         return AjaxResult.success(service.getById(id));
49 51
     }
52
+
53
+    /**
54
+     * 物品分类(员工/小组/班组/部门)
55
+     *
56
+     * @param queryReq 查询参数
57
+     * @return AjaxResult
58
+     */
59
+    @PostMapping("/securityTestItemClassification")
60
+    public AjaxResult securityTestItemClassification(@RequestBody LedgerSecurityTestQueryReqVO queryReq) {
61
+        List<LedgerSecurityTestResVO> seizureQuantityList = service.securityTestItemClassification(queryReq);
62
+        return AjaxResult.success(seizureQuantityList);
63
+    }
64
+
65
+    /**
66
+     * 通过情况(员工/小组/班组/部门)
67
+     *
68
+     * @param queryReq 查询参数
69
+     * @return AjaxResult
70
+     */
71
+    @PostMapping("/securityTestPassingStatus")
72
+    public AjaxResult securityTestPassingStatus(@RequestBody LedgerSecurityTestQueryReqVO queryReq) {
73
+        List<LedgerSecurityTestResVO> seizureQuantityList = service.securityTestPassingStatus(queryReq);
74
+        return AjaxResult.success(seizureQuantityList);
75
+    }
76
+
77
+    /**
78
+     * 区域情况(员工/小组/班组/部门)
79
+     *
80
+     * @param queryReq 查询参数
81
+     * @return AjaxResult
82
+     */
83
+    @PostMapping("/securityTestRegion")
84
+    public AjaxResult securityTestRegion(@RequestBody LedgerSecurityTestQueryReqVO queryReq) {
85
+        List<LedgerSecurityTestResVO> seizureQuantityList = service.securityTestRegion(queryReq);
86
+        return AjaxResult.success(seizureQuantityList);
87
+    }
88
+
50 89
 }

+ 51 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/LedgerSecurityTestQueryReqVO.java

@@ -0,0 +1,51 @@
1
+package com.sundot.airport.ledger.domain.vo;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import lombok.Data;
5
+import org.springframework.format.annotation.DateTimeFormat;
6
+
7
+import java.io.Serializable;
8
+import java.util.Date;
9
+
10
+/**
11
+ * 安保测试记录 统计查询 Req Entity
12
+ *
13
+ */
14
+@Data
15
+public class LedgerSecurityTestQueryReqVO implements Serializable {
16
+
17
+    /**
18
+     * 部门ID
19
+     */
20
+    private Long deptId;
21
+
22
+    /**
23
+     * 班组ID
24
+     */
25
+    private Long teamId;
26
+
27
+    /**
28
+     * 小组ID
29
+     */
30
+    private Long groupId;
31
+
32
+    /**
33
+     * 用户ID
34
+     */
35
+    private Long userId;
36
+
37
+    /**
38
+     * 开始时间
39
+     */
40
+    @JsonFormat(pattern = "yyyy-MM-dd")
41
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
42
+    private Date startDate;
43
+
44
+    /**
45
+     * 结束时间
46
+     */
47
+    @JsonFormat(pattern = "yyyy-MM-dd")
48
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
49
+    private Date endDate;
50
+
51
+}

+ 49 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/vo/LedgerSecurityTestResVO.java

@@ -0,0 +1,49 @@
1
+package com.sundot.airport.ledger.domain.vo;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import lombok.Data;
5
+import org.springframework.format.annotation.DateTimeFormat;
6
+
7
+import java.io.Serializable;
8
+import java.math.BigDecimal;
9
+import java.util.Date;
10
+
11
+/**
12
+ * 安保测试记录 统计查询 Req Entity
13
+ */
14
+@Data
15
+public class LedgerSecurityTestResVO implements Serializable {
16
+
17
+    /**
18
+     * 日期
19
+     */
20
+    @JsonFormat(pattern = "yyyy-MM-dd")
21
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
22
+    private Date recordDate;
23
+
24
+    /**
25
+     * 主键
26
+     */
27
+    private Long id;
28
+
29
+    /**
30
+     * 编码
31
+     */
32
+    private String code;
33
+
34
+    /**
35
+     * 名称
36
+     */
37
+    private String name;
38
+
39
+    /**
40
+     * 数量
41
+     */
42
+    private Integer quantity;
43
+
44
+    /**
45
+     * 比例
46
+     */
47
+    private BigDecimal proportion;
48
+
49
+}

+ 9 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/mapper/LedgerSecurityTestMapper.java

@@ -1,12 +1,21 @@
1 1
 package com.sundot.airport.ledger.mapper;
2 2
 
3 3
 import java.util.List;
4
+
4 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 6
 import com.sundot.airport.ledger.domain.LedgerSecurityTest;
7
+import com.sundot.airport.ledger.domain.vo.LedgerSecurityTestQueryReqVO;
8
+import com.sundot.airport.ledger.domain.vo.LedgerSecurityTestResVO;
6 9
 
7 10
 /**
8 11
  * 安保测试记录Mapper接口
9 12
  */
10 13
 public interface LedgerSecurityTestMapper extends BaseMapper<LedgerSecurityTest> {
11 14
     List<LedgerSecurityTest> selectList(LedgerSecurityTest query);
15
+
16
+    List<LedgerSecurityTestResVO> securityTestItemClassification(LedgerSecurityTestQueryReqVO queryReq);
17
+
18
+    List<LedgerSecurityTestResVO> securityTestPassingStatus(LedgerSecurityTestQueryReqVO queryReq);
19
+
20
+    List<LedgerSecurityTestResVO> securityTestRegion(LedgerSecurityTestQueryReqVO queryReq);
12 21
 }

+ 10 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/service/ILedgerSecurityTestService.java

@@ -1,10 +1,20 @@
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.LedgerSecurityTest;
7
+import com.sundot.airport.ledger.domain.vo.LedgerSecurityTestQueryReqVO;
8
+import com.sundot.airport.ledger.domain.vo.LedgerSecurityTestResVO;
6 9
 
7 10
 public interface ILedgerSecurityTestService extends IService<LedgerSecurityTest> {
8 11
     List<LedgerSecurityTest> selectList(LedgerSecurityTest query);
12
+
9 13
     int batchInsert(List<LedgerSecurityTest> list);
14
+
15
+    List<LedgerSecurityTestResVO> securityTestItemClassification(LedgerSecurityTestQueryReqVO queryReq);
16
+
17
+    List<LedgerSecurityTestResVO> securityTestPassingStatus(LedgerSecurityTestQueryReqVO queryReq);
18
+
19
+    List<LedgerSecurityTestResVO> securityTestRegion(LedgerSecurityTestQueryReqVO queryReq);
10 20
 }

+ 18 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/service/impl/LedgerSecurityTestServiceImpl.java

@@ -1,9 +1,12 @@
1 1
 package com.sundot.airport.ledger.service.impl;
2 2
 
3 3
 import java.util.List;
4
+
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.LedgerSecurityTest;
8
+import com.sundot.airport.ledger.domain.vo.LedgerSecurityTestQueryReqVO;
9
+import com.sundot.airport.ledger.domain.vo.LedgerSecurityTestResVO;
7 10
 import com.sundot.airport.ledger.mapper.LedgerSecurityTestMapper;
8 11
 import com.sundot.airport.ledger.service.ILedgerSecurityTestService;
9 12
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,4 +35,19 @@ public class LedgerSecurityTestServiceImpl extends ServiceImpl<LedgerSecurityTes
32 35
         saveBatch(list);
33 36
         return list.size();
34 37
     }
38
+
39
+    @Override
40
+    public List<LedgerSecurityTestResVO> securityTestItemClassification(LedgerSecurityTestQueryReqVO queryReq) {
41
+        return this.baseMapper.securityTestItemClassification(queryReq);
42
+    }
43
+
44
+    @Override
45
+    public List<LedgerSecurityTestResVO> securityTestPassingStatus(LedgerSecurityTestQueryReqVO queryReq) {
46
+        return this.baseMapper.securityTestPassingStatus(queryReq);
47
+    }
48
+
49
+    @Override
50
+    public List<LedgerSecurityTestResVO> securityTestRegion(LedgerSecurityTestQueryReqVO queryReq) {
51
+        return this.baseMapper.securityTestRegion(queryReq);
52
+    }
35 53
 }

+ 57 - 0
airport-ledger/src/main/resources/mapper/ledger/LedgerSecurityTestMapper.xml

@@ -69,4 +69,61 @@
69 69
         ORDER BY id DESC
70 70
     </select>
71 71
 
72
+    <select id="securityTestItemClassification"
73
+            parameterType="com.sundot.airport.ledger.domain.vo.LedgerSecurityTestQueryReqVO"
74
+            resultType="com.sundot.airport.ledger.domain.vo.LedgerSecurityTestResVO">
75
+        select problem_desc name,
76
+        count(1) quantity
77
+        from ledger_security_test
78
+        where del_flag = '0'
79
+        <if test="deptId != null">and dept_id = #{deptId}</if>
80
+        <if test="teamId != null">and team_id = #{teamId}</if>
81
+        <if test="groupId != null">and group_id = #{groupId}</if>
82
+        <if test="userId != null">and tested_id = #{userId}</if>
83
+        <if test="startDate != null and endDate != null">
84
+            and (record_date >= #{startDate}
85
+            and record_date <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
86
+        </if>
87
+        group by problem_desc
88
+        order by count desc
89
+    </select>
90
+
91
+    <select id="securityTestPassingStatus"
92
+            parameterType="com.sundot.airport.ledger.domain.vo.LedgerSecurityTestQueryReqVO"
93
+            resultType="com.sundot.airport.ledger.domain.vo.LedgerSecurityTestResVO">
94
+        select test_result name,
95
+        count(1) quantity
96
+        from ledger_security_test
97
+        where del_flag = '0'
98
+        <if test="deptId != null">and dept_id = #{deptId}</if>
99
+        <if test="teamId != null">and team_id = #{teamId}</if>
100
+        <if test="groupId != null">and group_id = #{groupId}</if>
101
+        <if test="userId != null">and tested_id = #{userId}</if>
102
+        <if test="startDate != null and endDate != null">
103
+            and (record_date >= #{startDate}
104
+            and record_date <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
105
+        </if>
106
+        group by test_result
107
+        order by count desc
108
+    </select>
109
+
110
+    <select id="securityTestRegion"
111
+            parameterType="com.sundot.airport.ledger.domain.vo.LedgerSecurityTestQueryReqVO"
112
+            resultType="com.sundot.airport.ledger.domain.vo.LedgerSecurityTestResVO">
113
+        select region name,
114
+        count(1) quantity
115
+        from ledger_security_test
116
+        where del_flag = '0'
117
+        <if test="deptId != null">and dept_id = #{deptId}</if>
118
+        <if test="teamId != null">and team_id = #{teamId}</if>
119
+        <if test="groupId != null">and group_id = #{groupId}</if>
120
+        <if test="userId != null">and tested_id = #{userId}</if>
121
+        <if test="startDate != null and endDate != null">
122
+            and (record_date >= #{startDate}
123
+            and record_date <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
124
+        </if>
125
+        group by region
126
+        order by count desc
127
+    </select>
128
+
72 129
 </mapper>