Преглед на файлове

ledger_channel_pass_rate字段删除和调整、相关代码调整、一键导入功能导入模版调整调整

wangxx преди 2 седмици
родител
ревизия
3bf06cfbe8

+ 1 - 1
airport-admin/src/main/java/com/sundot/airport/web/controller/ledger/LedgerTemplateController.java

@@ -88,7 +88,7 @@ public class LedgerTemplateController extends BaseController {
88 88
         nm.put("channelPassRate", "通道过检率");
89 89
         hm.put("channelPassRate", 2);
90 90
         cm.put("channelPassRate", new String[]{
91
-            "组长","班组","内勤",
91
+            "小组",
92 92
             "2026年1月平均过检率","2026年2月平均过检率","2026年3月平均过检率",
93 93
             "2026年4月平均过检率","2026年5月平均过检率","2026年6月平均过检率",
94 94
             "2026年7月平均过检率","2026年8月平均过检率","2026年9月平均过检率",

+ 21 - 40
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/LedgerChannelPassRate.java

@@ -27,14 +27,16 @@ public class LedgerChannelPassRate extends BaseEntity {
27 27
     @Excel(name = "部门名称")
28 28
     private String deptName;
29 29
 
30
-    @Excel(name = "队室/班组")
30
+    private Long deptId;
31
+
31 32
     private String teamName;
32 33
 
33
-    @Excel(name = "组长")
34
-    private String groupLeader;
34
+    private Long teamId;
35
+
36
+    private Long groupId;
35 37
 
36
-    @Excel(name = "队室内勤")
37
-    private String teamInternalDuty;
38
+    @Excel(name = "小组")
39
+    private String groupName;
38 40
 
39 41
     @Excel(name = "通道号")
40 42
     private String channelNo;
@@ -48,9 +50,6 @@ public class LedgerChannelPassRate extends BaseEntity {
48 50
     @Excel(name = "过检率(%)")
49 51
     private BigDecimal passRate;
50 52
 
51
-    @Excel(name = "备注")
52
-    private String remark;
53
-
54 53
     private String importBatch;
55 54
 
56 55
     @Excel(name = "数据来源")
@@ -59,27 +58,29 @@ public class LedgerChannelPassRate extends BaseEntity {
59 58
     @Excel(name = "同步标志(0=未同步;1=已同步)")
60 59
     private String syncFlag;
61 60
 
62
-   // ID字段
63
-    private Long responsibleId;
64
-    private Long deptId;
65
-    private Long teamId;
66
-    private Long groupId;
67
-    private String groupName;
68
-
69 61
     public Long getId() { return id; }
70 62
     public void setId(Long id) { this.id = id; }
71 63
 
72 64
     public Date getRecordDate() { return recordDate; }
73 65
     public void setRecordDate(Date recordDate) { this.recordDate = recordDate; }
74 66
 
67
+    public String getDeptName() { return deptName; }
68
+    public void setDeptName(String deptName) { this.deptName = deptName; }
69
+
70
+    public Long getDeptId() { return deptId; }
71
+    public void setDeptId(Long deptId) { this.deptId = deptId; }
72
+
75 73
     public String getTeamName() { return teamName; }
76 74
     public void setTeamName(String teamName) { this.teamName = teamName; }
77 75
 
78
-    public String getGroupLeader() { return groupLeader; }
79
-    public void setGroupLeader(String groupLeader) { this.groupLeader = groupLeader; }
76
+    public Long getTeamId() { return teamId; }
77
+    public void setTeamId(Long teamId) { this.teamId = teamId; }
80 78
 
81
-    public String getTeamInternalDuty() { return teamInternalDuty; }
82
-    public void setTeamInternalDuty(String teamInternalDuty) { this.teamInternalDuty = teamInternalDuty; }
79
+    public String getGroupName() { return groupName; }
80
+    public void setGroupName(String groupName) { this.groupName = groupName; }
81
+
82
+    public Long getGroupId() { return groupId; }
83
+    public void setGroupId(Long groupId) { this.groupId = groupId; }
83 84
 
84 85
     public String getChannelNo() { return channelNo; }
85 86
     public void setChannelNo(String channelNo) { this.channelNo = channelNo; }
@@ -93,9 +94,6 @@ public class LedgerChannelPassRate extends BaseEntity {
93 94
     public BigDecimal getPassRate() { return passRate; }
94 95
     public void setPassRate(BigDecimal passRate) { this.passRate = passRate; }
95 96
 
96
-    public String getRemark() { return remark; }
97
-    public void setRemark(String remark) { this.remark = remark; }
98
-
99 97
     public String getImportBatch() { return importBatch; }
100 98
     public void setImportBatch(String importBatch) { this.importBatch = importBatch; }
101 99
 
@@ -105,21 +103,4 @@ public class LedgerChannelPassRate extends BaseEntity {
105 103
     public String getSyncFlag() { return syncFlag; }
106 104
     public void setSyncFlag(String syncFlag) { this.syncFlag = syncFlag; }
107 105
 
108
-    public Long getResponsibleId() { return responsibleId; }
109
-    public void setResponsibleId(Long responsibleId) { this.responsibleId = responsibleId; }
110
-
111
-    public Long getDeptId() { return deptId; }
112
-    public void setDeptId(Long deptId) { this.deptId = deptId; }
113
-
114
-    public Long getTeamId() { return teamId; }
115
-    public void setTeamId(Long teamId) { this.teamId = teamId; }
116
-
117
-    public Long getGroupId() { return groupId; }
118
-    public void setGroupId(Long groupId) { this.groupId = groupId; }
119
-
120
-    public String getDeptName() { return deptName; }
121
-    public void setDeptName(String deptName) { this.deptName = deptName; }
122
-
123
-    public String getGroupName() { return groupName; }
124
-    public void setGroupName(String groupName) { this.groupName = groupName; }
125
-}
106
+}

+ 53 - 24
airport-ledger/src/main/java/com/sundot/airport/ledger/service/impl/LedgerCombinedImportServiceImpl.java

@@ -555,18 +555,17 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
555 555
 
556 556
     /** 7. 通道过检率(pivot表)→ ledger_channel_pass_rate
557 557
      * R1: 大标题行
558
-     * R2: 组长(0) 班组(1) 队室内勤(2) 2026年1月平均过检率(3) 2026年2月...(4) ...
558
+     * R2: 小组(0) 2026年1月平均过检率(1) 2026年2月...(2) ...
559 559
      * 每行展开为多条(每月一条)
560 560
      */
561 561
     private int doChannelPassRate(Sheet sheet, String batchNo, String username) {
562
-        // 读第2行表头(POI 0-indexed = row index 1)
563 562
         Row headerRow = sheet.getRow(1);
564 563
         if (headerRow == null) return 0;
565 564
 
566
-        // 找月份列(从列3开始)
567
-        List<int[]> monthCols = new ArrayList<>(); // [colIndex, parsedDateMs]
565
+        // 找月份列(从列1开始)
566
+        List<int[]> monthCols = new ArrayList<>();
568 567
         Pattern p = Pattern.compile("(\\d{4})年(\\d{1,2})月");
569
-        for (int ci = 3; ci <= headerRow.getLastCellNum(); ci++) {
568
+        for (int ci = 1; ci <= headerRow.getLastCellNum(); ci++) {
570 569
             Cell cell = headerRow.getCell(ci);
571 570
             if (cell == null) continue;
572 571
             String label = formatter.formatCellValue(cell).trim();
@@ -583,44 +582,33 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
583 582
 
584 583
         List<LedgerChannelPassRate> list = new ArrayList<>();
585 584
         for (Object[] c : dataRows(sheet, 2)) {
586
-            String groupLeader = str(c, 0);      // 组长(0)
587
-            String teamName = str(c, 1);         // 班组(1)
588
-            String teamInternalDuty = str(c, 2); // 队室内勤(2)
589
-            
590
-            // 根据组长名称查找组织信息和ID
591
-            Map<String, Object> orgInfo = new HashMap<>();
592
-            if (groupLeader != null && !groupLeader.trim().isEmpty()) {
593
-                orgInfo = resolveOrgInfoByNameWithCache(groupLeader);
594
-            }
595
-            
585
+            String groupName = str(c, 0);
586
+
587
+            // 通过小组名称查找组织信息(TEAMS → MANAGER → BRIGADE)
588
+            Map<String, Object> orgInfo = resolveOrgInfoByGroupName(groupName);
589
+
596 590
             for (int[] mc : monthCols) {
597 591
                 int ci = mc[0];
598 592
                 BigDecimal rate = decimal(c, ci);
599 593
                 if (rate == null) continue;
600 594
                 LedgerChannelPassRate o = new LedgerChannelPassRate();
601
-                o.setGroupLeader(groupLeader);
602
-                o.setTeamName(teamName);
603
-                o.setTeamInternalDuty(teamInternalDuty);
595
+                o.setGroupName(groupName);
604 596
                 o.setPassRate(rate);
605
-                // 用时间戳还原日期
606 597
                 Calendar cal = Calendar.getInstance();
607 598
                 cal.setTimeInMillis((long) mc[1] * 1000);
608 599
                 o.setRecordDate(cal.getTime());
609 600
                 o.setImportBatch(batchNo);
610 601
                 o.setSourceType("1");
611 602
                 o.setCreateBy(username);
612
-                
613
-                // 设置组织ID和名称
603
+
614 604
                 if (!orgInfo.isEmpty()) {
615
-                    o.setResponsibleId((Long) orgInfo.get("userId"));
616 605
                     o.setDeptId((Long) orgInfo.get("deptId"));
617 606
                     o.setDeptName((String) orgInfo.get("deptName"));
618 607
                     o.setTeamId((Long) orgInfo.get("teamId"));
619 608
                     o.setTeamName((String) orgInfo.get("teamName"));
620 609
                     o.setGroupId((Long) orgInfo.get("groupId"));
621
-                    o.setGroupName((String) orgInfo.get("groupName"));
622 610
                 }
623
-                
611
+
624 612
                 list.add(o);
625 613
             }
626 614
         }
@@ -628,6 +616,38 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
628 616
         return list.size();
629 617
     }
630 618
 
619
+    /**
620
+     * 通过小组名称(TEAMS)查找组织信息,向上补齐班组和部门
621
+     */
622
+    private Map<String, Object> resolveOrgInfoByGroupName(String groupName) {
623
+        Map<String, Object> result = new HashMap<>();
624
+        if (groupName == null || groupName.trim().isEmpty() || importCache == null) {
625
+            return result;
626
+        }
627
+        SysDept groupDept = importCache.getDeptByNameAndType(groupName.trim(), DeptType.TEAMS.getCode());
628
+        if (groupDept == null) {
629
+            return result;
630
+        }
631
+        result.put("groupId", groupDept.getDeptId());
632
+        result.put("groupName", groupDept.getDeptName());
633
+
634
+        if (groupDept.getParentId() != null && groupDept.getParentId() != 0) {
635
+            SysDept teamDept = importCache.getDeptById(groupDept.getParentId());
636
+            if (teamDept != null) {
637
+                result.put("teamId", teamDept.getDeptId());
638
+                result.put("teamName", teamDept.getDeptName());
639
+                if (teamDept.getParentId() != null && teamDept.getParentId() != 0) {
640
+                    SysDept brigadeDept = importCache.getDeptById(teamDept.getParentId());
641
+                    if (brigadeDept != null) {
642
+                        result.put("deptId", brigadeDept.getDeptId());
643
+                        result.put("deptName", brigadeDept.getDeptName());
644
+                    }
645
+                }
646
+            }
647
+        }
648
+        return result;
649
+    }
650
+
631 651
     /** 8. 不安全事件 → ledger_unsafe_event
632 652
      * R2: 时间(0) 事件描述(1) 类别(2) 航班号(3) 责任人(4)
633 653
      *     涉及物品(5) 岗位(6) 区域(7) 通道号(8) 附件(9)
@@ -1339,6 +1359,15 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
1339 1359
         public Long getAreaIdByName(String areaName) {
1340 1360
             return areaCache.get(areaName);
1341 1361
         }
1362
+
1363
+        public SysDept getDeptByNameAndType(String deptName, String deptType) {
1364
+            for (SysDept dept : deptCache.values()) {
1365
+                if (deptName.equals(dept.getDeptName()) && deptType.equals(dept.getDeptType())) {
1366
+                    return dept;
1367
+                }
1368
+            }
1369
+            return null;
1370
+        }
1342 1371
     }
1343 1372
 
1344 1373
     // ════════════════════════════════════════════════════════════════

+ 5 - 10
airport-ledger/src/main/resources/mapper/ledger/LedgerChannelPassRateMapper.xml

@@ -11,13 +11,10 @@
11 11
         <result property="teamId" column="team_id" />
12 12
         <result property="groupName" column="group_name" />
13 13
         <result property="groupId" column="group_id" />
14
-        <result property="groupLeader" column="group_leader" />
15
-        <result property="teamInternalDuty" column="team_internal_duty" />
16 14
         <result property="channelNo" column="channel_no" />
17 15
         <result property="totalCount" column="total_count" />
18 16
         <result property="passCount" column="pass_count" />
19 17
         <result property="passRate" column="pass_rate" />
20
-        <result property="remark" column="remark" />
21 18
         <result property="importBatch" column="import_batch" />
22 19
         <result property="sourceType" column="source_type" />
23 20
         <result property="createBy" column="create_by" />
@@ -25,14 +22,12 @@
25 22
         <result property="updateBy" column="update_by" />
26 23
         <result property="updateTime" column="update_time" />
27 24
         <result property="syncFlag" column="sync_flag" />
28
-        <result property="responsibleId" column="responsible_id" />
29 25
     </resultMap>
30 26
 
31 27
     <sql id="selectVo">
32 28
         SELECT id, record_date, dept_name, dept_id, team_name, team_id, group_name, group_id,
33
-               group_leader, team_internal_duty, channel_no, total_count, pass_count, pass_rate,
34
-               remark, import_batch, source_type, create_by, create_time, update_by, update_time, sync_flag,
35
-               responsible_id
29
+               channel_no, total_count, pass_count, pass_rate,
30
+               import_batch, source_type, create_by, create_time, update_by, update_time, sync_flag
36 31
         FROM ledger_channel_pass_rate
37 32
         WHERE del_flag = '0'
38 33
     </sql>
@@ -43,10 +38,10 @@
43 38
         <if test="teamName != null and teamName != ''">AND team_name LIKE CONCAT('%', #{teamName}, '%')</if>
44 39
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
45 40
         <if test="params != null and params.beginTime != null and params.beginTime != ''">
46
-            AND (record_date &gt;= #{params.beginTime} OR approve_date &gt;= #{params.beginTime} OR exam_date &gt;= #{params.beginTime})
41
+            AND record_date &gt;= #{params.beginTime}
47 42
         </if>
48 43
         <if test="params != null and params.endTime != null and params.endTime != ''">
49
-            AND (record_date &lt;= #{params.endTime} OR approve_date &lt;= #{params.endTime} OR exam_date &lt;= #{params.endTime})
44
+            AND record_date &lt;= #{params.endTime}
50 45
         </if>
51 46
         ORDER BY id DESC
52 47
     </select>
@@ -56,4 +51,4 @@
56 51
         set sync_flag = '1'
57 52
         where sync_flag = '0'
58 53
     </update>
59
-</mapper>
54
+</mapper>