Quellcode durchsuchen

ledger_unsafe_event表新增字段和导入功能字段数据新增

wangxx vor 4 Wochen
Ursprung
Commit
b1284f3621

+ 10 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/LedgerSeizureStats.java

@@ -37,12 +37,16 @@ public class LedgerSeizureStats extends BaseEntity {
37
     @Excel(name = "工作区域")
37
     @Excel(name = "工作区域")
38
     private String workArea;
38
     private String workArea;
39
 
39
 
40
+    private Long areaId;
41
+
40
     @Excel(name = "安检资格证书等级")
42
     @Excel(name = "安检资格证书等级")
41
     private String qualificationLevel;
43
     private String qualificationLevel;
42
 
44
 
43
     @Excel(name = "岗位")
45
     @Excel(name = "岗位")
44
     private String position;
46
     private String position;
45
 
47
 
48
+    private Long positionId;
49
+
46
     @Excel(name = "小组")
50
     @Excel(name = "小组")
47
     private String groupName;
51
     private String groupName;
48
 
52
 
@@ -154,12 +158,18 @@ public class LedgerSeizureStats extends BaseEntity {
154
     public String getWorkArea() { return workArea; }
158
     public String getWorkArea() { return workArea; }
155
     public void setWorkArea(String workArea) { this.workArea = workArea; }
159
     public void setWorkArea(String workArea) { this.workArea = workArea; }
156
 
160
 
161
+    public Long getAreaId() { return areaId; }
162
+    public void setAreaId(Long areaId) { this.areaId = areaId; }
163
+
157
     public String getQualificationLevel() { return qualificationLevel; }
164
     public String getQualificationLevel() { return qualificationLevel; }
158
     public void setQualificationLevel(String qualificationLevel) { this.qualificationLevel = qualificationLevel; }
165
     public void setQualificationLevel(String qualificationLevel) { this.qualificationLevel = qualificationLevel; }
159
 
166
 
160
     public String getPosition() { return position; }
167
     public String getPosition() { return position; }
161
     public void setPosition(String position) { this.position = position; }
168
     public void setPosition(String position) { this.position = position; }
162
 
169
 
170
+    public Long getPositionId() { return positionId; }
171
+    public void setPositionId(Long positionId) { this.positionId = positionId; }
172
+
163
     public String getGroupName() { return groupName; }
173
     public String getGroupName() { return groupName; }
164
     public void setGroupName(String groupName) { this.groupName = groupName; }
174
     public void setGroupName(String groupName) { this.groupName = groupName; }
165
 
175
 

+ 78 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/LedgerUnsafeEvent.java

@@ -24,18 +24,54 @@ public class LedgerUnsafeEvent extends BaseEntity {
24
     @Excel(name = "事件日期", width = 20, dateFormat = "yyyy-MM-dd")
24
     @Excel(name = "事件日期", width = 20, dateFormat = "yyyy-MM-dd")
25
     private Date recordDate;
25
     private Date recordDate;
26
 
26
 
27
+    @Excel(name = "航班号")
28
+    private String flightNo;
29
+
27
     @Excel(name = "部门名称")
30
     @Excel(name = "部门名称")
28
     private String deptName;
31
     private String deptName;
29
 
32
 
30
     @Excel(name = "队室/班组")
33
     @Excel(name = "队室/班组")
31
     private String teamName;
34
     private String teamName;
32
 
35
 
36
+    @Excel(name = "队室内勤")
37
+    private String teamInternalDuty;
38
+
39
+    @Excel(name = "小组")
40
+    private String groupName;
41
+
42
+    private Long groupId;
43
+
44
+    private Long deptId;
45
+
46
+    private Long teamId;
47
+
33
     @Excel(name = "责任人")
48
     @Excel(name = "责任人")
34
     private String responsibleName;
49
     private String responsibleName;
35
 
50
 
51
+    private Long responsibleId;
52
+
36
     @Excel(name = "事件类型")
53
     @Excel(name = "事件类型")
37
     private String eventType;
54
     private String eventType;
38
 
55
 
56
+    @Excel(name = "涉及物品")
57
+    private String involvedItems;
58
+
59
+    @Excel(name = "岗位")
60
+    private String position;
61
+
62
+    private Long positionId;
63
+
64
+    @Excel(name = "区域")
65
+    private String area;
66
+
67
+    private Long areaId;
68
+
69
+    @Excel(name = "通道号")
70
+    private String channelNo;
71
+
72
+    @Excel(name = "图像")
73
+    private String image;
74
+
39
     @Excel(name = "事件描述")
75
     @Excel(name = "事件描述")
40
     private String eventDesc;
76
     private String eventDesc;
41
 
77
 
@@ -62,18 +98,60 @@ public class LedgerUnsafeEvent extends BaseEntity {
62
     public Date getRecordDate() { return recordDate; }
98
     public Date getRecordDate() { return recordDate; }
63
     public void setRecordDate(Date recordDate) { this.recordDate = recordDate; }
99
     public void setRecordDate(Date recordDate) { this.recordDate = recordDate; }
64
 
100
 
101
+    public String getFlightNo() { return flightNo; }
102
+    public void setFlightNo(String flightNo) { this.flightNo = flightNo; }
103
+
65
     public String getDeptName() { return deptName; }
104
     public String getDeptName() { return deptName; }
66
     public void setDeptName(String deptName) { this.deptName = deptName; }
105
     public void setDeptName(String deptName) { this.deptName = deptName; }
67
 
106
 
68
     public String getTeamName() { return teamName; }
107
     public String getTeamName() { return teamName; }
69
     public void setTeamName(String teamName) { this.teamName = teamName; }
108
     public void setTeamName(String teamName) { this.teamName = teamName; }
70
 
109
 
110
+    public String getTeamInternalDuty() { return teamInternalDuty; }
111
+    public void setTeamInternalDuty(String teamInternalDuty) { this.teamInternalDuty = teamInternalDuty; }
112
+
113
+    public String getGroupName() { return groupName; }
114
+    public void setGroupName(String groupName) { this.groupName = groupName; }
115
+
116
+    public Long getGroupId() { return groupId; }
117
+    public void setGroupId(Long groupId) { this.groupId = groupId; }
118
+
119
+    public Long getDeptId() { return deptId; }
120
+    public void setDeptId(Long deptId) { this.deptId = deptId; }
121
+
122
+    public Long getTeamId() { return teamId; }
123
+    public void setTeamId(Long teamId) { this.teamId = teamId; }
124
+
71
     public String getResponsibleName() { return responsibleName; }
125
     public String getResponsibleName() { return responsibleName; }
72
     public void setResponsibleName(String responsibleName) { this.responsibleName = responsibleName; }
126
     public void setResponsibleName(String responsibleName) { this.responsibleName = responsibleName; }
73
 
127
 
128
+    public Long getResponsibleId() { return responsibleId; }
129
+    public void setResponsibleId(Long responsibleId) { this.responsibleId = responsibleId; }
130
+
74
     public String getEventType() { return eventType; }
131
     public String getEventType() { return eventType; }
75
     public void setEventType(String eventType) { this.eventType = eventType; }
132
     public void setEventType(String eventType) { this.eventType = eventType; }
76
 
133
 
134
+    public String getInvolvedItems() { return involvedItems; }
135
+    public void setInvolvedItems(String involvedItems) { this.involvedItems = involvedItems; }
136
+
137
+    public String getPosition() { return position; }
138
+    public void setPosition(String position) { this.position = position; }
139
+
140
+    public Long getPositionId() { return positionId; }
141
+    public void setPositionId(Long positionId) { this.positionId = positionId; }
142
+
143
+    public String getArea() { return area; }
144
+    public void setArea(String area) { this.area = area; }
145
+
146
+    public Long getAreaId() { return areaId; }
147
+    public void setAreaId(Long areaId) { this.areaId = areaId; }
148
+
149
+    public String getChannelNo() { return channelNo; }
150
+    public void setChannelNo(String channelNo) { this.channelNo = channelNo; }
151
+
152
+    public String getImage() { return image; }
153
+    public void setImage(String image) { this.image = image; }
154
+
77
     public String getEventDesc() { return eventDesc; }
155
     public String getEventDesc() { return eventDesc; }
78
     public void setEventDesc(String eventDesc) { this.eventDesc = eventDesc; }
156
     public void setEventDesc(String eventDesc) { this.eventDesc = eventDesc; }
79
 
157
 

+ 102 - 5
airport-ledger/src/main/java/com/sundot/airport/ledger/service/impl/LedgerCombinedImportServiceImpl.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.extension.service.IService;
4
 import com.baomidou.mybatisplus.extension.service.IService;
5
 import com.sundot.airport.common.core.domain.entity.SysDept;
5
 import com.sundot.airport.common.core.domain.entity.SysDept;
6
 import com.sundot.airport.common.core.domain.entity.SysUser;
6
 import com.sundot.airport.common.core.domain.entity.SysUser;
7
+import com.sundot.airport.system.domain.SysPost;
8
+import com.sundot.airport.system.domain.BasePosition;
7
 import com.sundot.airport.ledger.domain.*;
9
 import com.sundot.airport.ledger.domain.*;
8
 import com.sundot.airport.ledger.domain.LedgerDailyTraining;
10
 import com.sundot.airport.ledger.domain.LedgerDailyTraining;
9
 import com.sundot.airport.ledger.domain.LedgerLeaderDuty;
11
 import com.sundot.airport.ledger.domain.LedgerLeaderDuty;
@@ -18,6 +20,8 @@ import com.sundot.airport.ledger.service.ILedgerDormFireSafetyService;
18
 import com.sundot.airport.ledger.service.ILedgerTrainingIssueService;
20
 import com.sundot.airport.ledger.service.ILedgerTrainingIssueService;
19
 import com.sundot.airport.system.mapper.SysDeptMapper;
21
 import com.sundot.airport.system.mapper.SysDeptMapper;
20
 import com.sundot.airport.system.mapper.SysUserMapper;
22
 import com.sundot.airport.system.mapper.SysUserMapper;
23
+import com.sundot.airport.system.mapper.SysPostMapper;
24
+import com.sundot.airport.system.mapper.BasePositionMapper;
21
 import org.apache.poi.ss.usermodel.*;
25
 import org.apache.poi.ss.usermodel.*;
22
 import org.springframework.beans.factory.annotation.Autowired;
26
 import org.springframework.beans.factory.annotation.Autowired;
23
 import org.springframework.stereotype.Service;
27
 import org.springframework.stereotype.Service;
@@ -60,6 +64,8 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
60
     @Autowired private IScoreEventService scoreEventService;
64
     @Autowired private IScoreEventService scoreEventService;
61
     @Autowired private SysUserMapper sysUserMapper;
65
     @Autowired private SysUserMapper sysUserMapper;
62
     @Autowired private SysDeptMapper sysDeptMapper;
66
     @Autowired private SysDeptMapper sysDeptMapper;
67
+    @Autowired private SysPostMapper sysPostMapper;
68
+    @Autowired private BasePositionMapper basePositionMapper;
63
 
69
 
64
     // 导入缓存(在导入开始时构建,导入结束后释放)
70
     // 导入缓存(在导入开始时构建,导入结束后释放)
65
     private ImportCache importCache;
71
     private ImportCache importCache;
@@ -390,10 +396,44 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
390
             o.setRecordDate(date(c, 0));
396
             o.setRecordDate(date(c, 0));
391
             o.setEventDesc(str(c, 1));
397
             o.setEventDesc(str(c, 1));
392
             o.setEventType(str(c, 2));
398
             o.setEventType(str(c, 2));
393
-            o.setResponsibleName(str(c, 4));
399
+            o.setFlightNo(str(c, 3));
400
+            String responsibleName = str(c, 4);
401
+            o.setResponsibleName(responsibleName);
394
             o.setTeamName(str(c, 5));
402
             o.setTeamName(str(c, 5));
395
-            o.setEvidenceFile(str(c, 10));
396
-            o.setRemark(str(c, 8));
403
+            o.setInvolvedItems(str(c, 6));
404
+            o.setPosition(str(c, 7));
405
+            o.setArea(str(c, 8));
406
+            o.setChannelNo(str(c, 9));
407
+            o.setImage(str(c, 10));
408
+            
409
+            // 使用缓存查找组织信息
410
+            Map<String, Long> orgInfo = resolveOrgInfoByNameWithCache(responsibleName);
411
+            if (!orgInfo.isEmpty()) {
412
+                o.setResponsibleId(orgInfo.get("userId"));
413
+                o.setDeptId(orgInfo.get("deptId"));
414
+                o.setTeamId(orgInfo.get("teamId"));
415
+                o.setGroupId(orgInfo.get("groupId"));
416
+            }
417
+            
418
+            // 根据岗位名称和区域名称查找ID
419
+            if (importCache != null) {
420
+                String positionName = str(c, 7);
421
+                if (positionName != null && !positionName.trim().isEmpty()) {
422
+                    Long positionId = importCache.getPositionIdByName(positionName.trim());
423
+                    if (positionId != null) {
424
+                        o.setPositionId(positionId);
425
+                    }
426
+                }
427
+                
428
+                String areaName = str(c, 8);
429
+                if (areaName != null && !areaName.trim().isEmpty()) {
430
+                    Long areaId = importCache.getAreaIdByName(areaName.trim());
431
+                    if (areaId != null) {
432
+                        o.setAreaId(areaId);
433
+                    }
434
+                }
435
+            }
436
+            
397
             o.setImportBatch(batchNo);
437
             o.setImportBatch(batchNo);
398
             o.setSourceType("1");
438
             o.setSourceType("1");
399
             o.setCreateBy(username);
439
             o.setCreateBy(username);
@@ -448,6 +488,25 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
448
                 o.setTeamId(orgInfo.get("teamId"));
488
                 o.setTeamId(orgInfo.get("teamId"));
449
                 o.setGroupId(orgInfo.get("groupId"));
489
                 o.setGroupId(orgInfo.get("groupId"));
450
             }
490
             }
491
+            
492
+            // 根据岗位名称和工作区域名称查找ID
493
+            if (importCache != null) {
494
+                String positionName = str(c, 7);
495
+                if (positionName != null && !positionName.trim().isEmpty()) {
496
+                    Long positionId = importCache.getPositionIdByName(positionName.trim());
497
+                    if (positionId != null) {
498
+                        o.setPositionId(positionId);
499
+                    }
500
+                }
501
+                
502
+                String areaName = str(c, 4);
503
+                if (areaName != null && !areaName.trim().isEmpty()) {
504
+                    Long areaId = importCache.getAreaIdByName(areaName.trim());
505
+                    if (areaId != null) {
506
+                        o.setAreaId(areaId);
507
+                    }
508
+                }
509
+            }
451
                 
510
                 
452
             o.setImportBatch(batchNo);
511
             o.setImportBatch(batchNo);
453
             o.setSourceType("1");
512
             o.setSourceType("1");
@@ -920,10 +979,15 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
920
     private static class ImportCache {
979
     private static class ImportCache {
921
         private final Map<String, SysUser> userCache;      // Map<昵称, 用户>
980
         private final Map<String, SysUser> userCache;      // Map<昵称, 用户>
922
         private final Map<Long, SysDept> deptCache;        // Map<部门ID, 部门>
981
         private final Map<Long, SysDept> deptCache;        // Map<部门ID, 部门>
982
+        private final Map<String, Long> positionCache;     // Map<岗位名称, 岗位ID>
983
+        private final Map<String, Long> areaCache;         // Map<区域名称, 区域ID>
923
 
984
 
924
-        public ImportCache(Map<String, SysUser> userCache, Map<Long, SysDept> deptCache) {
985
+        public ImportCache(Map<String, SysUser> userCache, Map<Long, SysDept> deptCache,
986
+                          Map<String, Long> positionCache, Map<String, Long> areaCache) {
925
             this.userCache = userCache;
987
             this.userCache = userCache;
926
             this.deptCache = deptCache;
988
             this.deptCache = deptCache;
989
+            this.positionCache = positionCache;
990
+            this.areaCache = areaCache;
927
         }
991
         }
928
 
992
 
929
         public SysUser getUserByNickName(String nickName) {
993
         public SysUser getUserByNickName(String nickName) {
@@ -933,6 +997,14 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
933
         public SysDept getDeptById(Long deptId) {
997
         public SysDept getDeptById(Long deptId) {
934
             return deptCache.get(deptId);
998
             return deptCache.get(deptId);
935
         }
999
         }
1000
+
1001
+        public Long getPositionIdByName(String positionName) {
1002
+            return positionCache.get(positionName);
1003
+        }
1004
+
1005
+        public Long getAreaIdByName(String areaName) {
1006
+            return areaCache.get(areaName);
1007
+        }
936
     }
1008
     }
937
 
1009
 
938
     // ════════════════════════════════════════════════════════════════
1010
     // ════════════════════════════════════════════════════════════════
@@ -1019,8 +1091,33 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
1019
             }
1091
             }
1020
         }
1092
         }
1021
 
1093
 
1094
+        // 构建岗位缓存:Map<岗位名称, 岗位ID>
1095
+        Map<String, Long> positionCache = new HashMap<>();
1096
+        List<SysPost> allPosts = sysPostMapper.selectPostAll();
1097
+        if (allPosts != null) {
1098
+            for (SysPost post : allPosts) {
1099
+                if (post.getPostName() != null && !post.getPostName().trim().isEmpty()) {
1100
+                    positionCache.put(post.getPostName().trim(), post.getPostId());
1101
+                }
1102
+            }
1103
+        }
1104
+
1105
+        // 构建区域缓存:Map<区域名称, 区域ID>
1106
+        // 从base_position表查询position_type='REGIONAL'的区域
1107
+        Map<String, Long> areaCache = new HashMap<>();
1108
+        BasePosition queryPosition = new BasePosition();
1109
+        queryPosition.setPositionType("REGIONAL");
1110
+        List<BasePosition> allAreas = basePositionMapper.selectBasePositionList(queryPosition);
1111
+        if (allAreas != null) {
1112
+            for (BasePosition area : allAreas) {
1113
+                if (area.getName() != null && !area.getName().trim().isEmpty()) {
1114
+                    areaCache.put(area.getName().trim(), area.getId());
1115
+                }
1116
+            }
1117
+        }
1118
+
1022
         // 创建统一缓存对象
1119
         // 创建统一缓存对象
1023
-        this.importCache = new ImportCache(userCache, deptCache);
1120
+        this.importCache = new ImportCache(userCache, deptCache, positionCache, areaCache);
1024
     }
1121
     }
1025
 
1122
 
1026
     /**
1123
     /**

Datei-Diff unterdrückt, da er zu groß ist
+ 3 - 1
airport-ledger/src/main/resources/mapper/ledger/LedgerSeizureStatsMapper.xml


+ 17 - 2
airport-ledger/src/main/resources/mapper/ledger/LedgerUnsafeEventMapper.xml

@@ -5,24 +5,39 @@
5
     <resultMap id="BaseResultMap" type="com.sundot.airport.ledger.domain.LedgerUnsafeEvent">
5
     <resultMap id="BaseResultMap" type="com.sundot.airport.ledger.domain.LedgerUnsafeEvent">
6
         <id property="id" column="id" />
6
         <id property="id" column="id" />
7
         <result property="recordDate" column="record_date" />
7
         <result property="recordDate" column="record_date" />
8
+        <result property="flightNo" column="flight_no" />
8
         <result property="deptName" column="dept_name" />
9
         <result property="deptName" column="dept_name" />
10
+        <result property="deptId" column="dept_id" />
9
         <result property="teamName" column="team_name" />
11
         <result property="teamName" column="team_name" />
12
+        <result property="teamInternalDuty" column="team_internal_duty" />
13
+        <result property="teamId" column="team_id" />
14
+        <result property="groupName" column="group_name" />
15
+        <result property="groupId" column="group_id" />
10
         <result property="responsibleName" column="responsible_name" />
16
         <result property="responsibleName" column="responsible_name" />
17
+        <result property="responsibleId" column="responsible_id" />
11
         <result property="eventType" column="event_type" />
18
         <result property="eventType" column="event_type" />
19
+        <result property="involvedItems" column="involved_items" />
20
+        <result property="position" column="position" />
21
+        <result property="positionId" column="position_id" />
22
+        <result property="area" column="area" />
23
+        <result property="areaId" column="area_id" />
24
+        <result property="channelNo" column="channel_no" />
25
+        <result property="image" column="image" />
12
         <result property="eventDesc" column="event_desc" />
26
         <result property="eventDesc" column="event_desc" />
13
         <result property="resultHandling" column="result_handling" />
27
         <result property="resultHandling" column="result_handling" />
14
         <result property="deductScore" column="deduct_score" />
28
         <result property="deductScore" column="deduct_score" />
15
         <result property="evidenceFile" column="evidence_file" />
29
         <result property="evidenceFile" column="evidence_file" />
16
         <result property="remark" column="remark" />
30
         <result property="remark" column="remark" />
17
         <result property="importBatch" column="import_batch" />
31
         <result property="importBatch" column="import_batch" />
18
-        <result property="sourceType" column="source_type" />        <result property="createBy"   column="create_by"   />
32
+        <result property="sourceType" column="source_type" />
33
+        <result property="createBy"   column="create_by"   />
19
         <result property="createTime" column="create_time" />
34
         <result property="createTime" column="create_time" />
20
         <result property="updateBy"   column="update_by"   />
35
         <result property="updateBy"   column="update_by"   />
21
         <result property="updateTime" column="update_time" />
36
         <result property="updateTime" column="update_time" />
22
     </resultMap>
37
     </resultMap>
23
 
38
 
24
     <sql id="selectVo">
39
     <sql id="selectVo">
25
-        SELECT id, record_date,dept_name,team_name,responsible_name,event_type,event_desc,result_handling,deduct_score,evidence_file,remark,import_batch,source_type, create_by, create_time, update_by, update_time
40
+        SELECT id, record_date, flight_no, dept_name, dept_id, team_name, team_internal_duty, team_id, group_name, group_id, responsible_name, responsible_id, event_type, involved_items, position, position_id, area, area_id, channel_no, image, event_desc, result_handling, deduct_score, evidence_file, remark, import_batch, source_type, create_by, create_time, update_by, update_time
26
         FROM ledger_unsafe_event
41
         FROM ledger_unsafe_event
27
         WHERE del_flag = '0'
42
         WHERE del_flag = '0'
28
     </sql>
43
     </sql>