瀏覽代碼

现在通道id

wangxx 1 周之前
父節點
當前提交
a307017e35

+ 6 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/LedgerRealtimeInterception.java

@@ -55,6 +55,9 @@ public class LedgerRealtimeInterception extends BaseEntity {
55 55
     @Excel(name = "工作点")
56 56
     private String channelNo;
57 57
 
58
+    //通道id
59
+    private Long channelId;
60
+
58 61
     @Excel(name = "实时质控拦截物品")
59 62
     private String itemName;
60 63
 
@@ -170,4 +173,7 @@ public class LedgerRealtimeInterception extends BaseEntity {
170 173
 
171 174
     public String getSyncFlag() { return syncFlag; }
172 175
     public void setSyncFlag(String syncFlag) { this.syncFlag = syncFlag; }
176
+
177
+    public Long getChannelId() { return channelId; }
178
+    public void setChannelId(Long channelId) { this.channelId = channelId; }
173 179
 }

+ 11 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/LedgerSecurityTest.java

@@ -30,6 +30,9 @@ public class LedgerSecurityTest extends BaseEntity {
30 30
     @Excel(name = "测试通道")
31 31
     private String channel;
32 32
 
33
+    // 通道id
34
+    private Long channelId;
35
+
33 36
     @Excel(name = "部门名称")
34 37
     private String deptName;
35 38
 
@@ -193,4 +196,12 @@ public class LedgerSecurityTest extends BaseEntity {
193 196
 
194 197
     public String getSyncFlag() { return syncFlag; }
195 198
     public void setSyncFlag(String syncFlag) { this.syncFlag = syncFlag; }
199
+
200
+    public Long getChannelId() {
201
+        return channelId;
202
+    }
203
+
204
+    public void setChannelId(Long channelId) {
205
+        this.channelId = channelId;
206
+    }
196 207
 }

+ 6 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/LedgerServicePatrol.java

@@ -45,6 +45,9 @@ public class LedgerServicePatrol extends BaseEntity {
45 45
     @Excel(name = "工作点")
46 46
     private String channelNo;
47 47
 
48
+    // 通道id
49
+    private Long channelId;
50
+
48 51
     @Excel(name = "岗位")
49 52
     private String position;
50 53
 
@@ -188,4 +191,7 @@ public class LedgerServicePatrol extends BaseEntity {
188 191
 
189 192
     public String getSyncFlag() { return syncFlag; }
190 193
     public void setSyncFlag(String syncFlag) { this.syncFlag = syncFlag; }
194
+
195
+    public Long getChannelId() { return channelId; }
196
+    public void setChannelId(Long channelId) { this.channelId = channelId; }
191 197
 }

+ 11 - 0
airport-ledger/src/main/java/com/sundot/airport/ledger/domain/LedgerSupervisionProblem.java

@@ -62,6 +62,9 @@ public class LedgerSupervisionProblem extends BaseEntity {
62 62
     @Excel(name = "工作点")
63 63
     private String channelNo;
64 64
 
65
+    //通道id
66
+    private Long channelId;
67
+
65 68
     @Excel(name = "岗位")
66 69
     private String position;
67 70
 
@@ -200,4 +203,12 @@ public class LedgerSupervisionProblem extends BaseEntity {
200 203
 
201 204
     public String getSyncFlag() { return syncFlag; }
202 205
     public void setSyncFlag(String syncFlag) { this.syncFlag = syncFlag; }
206
+
207
+    public Long getChannelId() {
208
+        return channelId;
209
+    }
210
+
211
+    public void setChannelId(Long channelId) {
212
+        this.channelId = channelId;
213
+    }
203 214
 }

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

@@ -64,6 +64,9 @@ public class LedgerUnsafeEvent extends BaseEntity {
64 64
     @Excel(name = "通道号")
65 65
     private String channelNo;
66 66
 
67
+    //通道id
68
+    private Long channelId;
69
+
67 70
     @Excel(name = "附件")
68 71
     private String image;
69 72
 
@@ -158,4 +161,7 @@ public class LedgerUnsafeEvent extends BaseEntity {
158 161
 
159 162
     public String getSyncFlag() { return syncFlag; }
160 163
     public void setSyncFlag(String syncFlag) { this.syncFlag = syncFlag; }
164
+
165
+    public Long getChannelId() { return channelId; }
166
+    public void setChannelId(Long channelId) { this.channelId = channelId; }
161 167
 }

+ 78 - 7
airport-ledger/src/main/java/com/sundot/airport/ledger/service/impl/LedgerCombinedImportServiceImpl.java

@@ -36,6 +36,7 @@ import java.text.SimpleDateFormat;
36 36
 import java.util.*;
37 37
 import java.util.regex.Matcher;
38 38
 import java.util.regex.Pattern;
39
+import java.util.stream.Collectors;
39 40
 
40 41
 /**
41 42
  * 台账合并Excel一键全量导入实现
@@ -230,6 +231,13 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
230 231
                         o.setAreaId(areaId);
231 232
                     }
232 233
                 }
234
+                String channelNo = o.getChannelNo();
235
+                if (channelNo != null && !channelNo.trim().isEmpty()) {
236
+                    Long channelId = importCache.getChannelIdByName(channelNo.trim());
237
+                    if (channelId != null) {
238
+                        o.setChannelId(channelId);
239
+                    }
240
+                }
233 241
             }
234 242
 
235 243
             o.setImportBatch(batchNo);
@@ -373,6 +381,15 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
373 381
                         o.setAreaId(areaId);
374 382
                     }
375 383
                 }
384
+
385
+                String channelNo = o.getChannelNo();
386
+                if (channelNo != null && !channelNo.trim().isEmpty()) {
387
+                    Long channelId = importCache.getChannelIdByName(channelNo.trim());
388
+                    if (channelId != null) {
389
+                        o.setChannelId(channelId);
390
+                    }
391
+                }
392
+
376 393
             }
377 394
             
378 395
             o.setImportBatch(batchNo);
@@ -442,6 +459,14 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
442 459
                         o.setAreaId(areaId);
443 460
                     }
444 461
                 }
462
+                //通道
463
+                String channelNo = o.getChannelNo();
464
+                if (channelNo != null && !channelNo.trim().isEmpty()) {
465
+                    Long channelId = importCache.getChannelIdByName(channelNo.trim());
466
+                    if (channelId != null) {
467
+                        o.setChannelId(channelId);
468
+                    }
469
+                }
445 470
             }
446 471
             
447 472
             o.setImportBatch(batchNo);
@@ -553,6 +578,16 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
553 578
                         o.setAreaId(areaId);
554 579
                     }
555 580
                 }
581
+
582
+                //通道
583
+                String channelNo = o.getChannel();
584
+                if (channelNo != null && !channelNo.trim().isEmpty()) {
585
+                    Long channelId = importCache.getChannelIdByName(channelNo.trim());
586
+                    if (channelId != null) {
587
+                        o.setChannelId(channelId);
588
+                    }
589
+                }
590
+
556 591
             }
557 592
             
558 593
             o.setImportBatch(batchNo);
@@ -734,6 +769,16 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
734 769
                         o.setAreaId(areaId);
735 770
                     }
736 771
                 }
772
+
773
+                //通道
774
+                String channelNo = o.getChannelNo();
775
+                if (channelNo != null && !channelNo.trim().isEmpty()) {
776
+                    Long channelId = importCache.getChannelIdByName(channelNo.trim());
777
+                    if (channelId != null) {
778
+                        o.setChannelId(channelId);
779
+                    }
780
+                }
781
+
737 782
             }
738 783
             
739 784
             o.setImportBatch(batchNo);
@@ -1239,7 +1284,19 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
1239 1284
 
1240 1285
     private String str(Object[] c, int idx) {
1241 1286
         if (idx >= c.length || c[idx] == null) return null;
1242
-        String s = c[idx].toString().trim();
1287
+        Object value = c[idx];
1288
+        String s;
1289
+        // 处理数字类型,去除 .0 后缀
1290
+        if (value instanceof Double) {
1291
+            Double d = (Double) value;
1292
+            if (d == d.longValue()) {
1293
+                s = String.valueOf(d.longValue());
1294
+            } else {
1295
+                s = d.toString();
1296
+            }
1297
+        } else {
1298
+            s = value.toString().trim();
1299
+        }
1243 1300
         return s.isEmpty() ? null : s;
1244 1301
     }
1245 1302
 
@@ -1372,13 +1429,16 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
1372 1429
         private final Map<Long, SysDept> deptCache;        // Map<部门ID, 部门>
1373 1430
         private final Map<String, Long> positionCache;     // Map<岗位名称, 岗位ID>
1374 1431
         private final Map<String, Long> areaCache;         // Map<区域名称, 区域ID>
1432
+        private final Map<String, Long> channelCache;      // Map<渠道名称, 渠道ID>
1375 1433
 
1376 1434
         public ImportCache(Map<String, SysUser> userCache, Map<Long, SysDept> deptCache,
1377
-                          Map<String, Long> positionCache, Map<String, Long> areaCache) {
1435
+                          Map<String, Long> positionCache, Map<String, Long> areaCache, Map<String, Long> channelCache
1436
+        ) {
1378 1437
             this.userCache = userCache;
1379 1438
             this.deptCache = deptCache;
1380 1439
             this.positionCache = positionCache;
1381 1440
             this.areaCache = areaCache;
1441
+            this.channelCache = channelCache;
1382 1442
         }
1383 1443
 
1384 1444
         public SysUser getUserByNickName(String nickName) {
@@ -1397,6 +1457,10 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
1397 1457
             return areaCache.get(areaName);
1398 1458
         }
1399 1459
 
1460
+        public Long getChannelIdByName(String channelName) {
1461
+            return channelCache.get(channelName);
1462
+        }
1463
+
1400 1464
         public SysDept getDeptByNameAndType(String deptName, String deptType) {
1401 1465
             for (SysDept dept : deptCache.values()) {
1402 1466
                 if (deptName.equals(dept.getDeptName()) && deptType.equals(dept.getDeptType())) {
@@ -1537,19 +1601,26 @@ public class LedgerCombinedImportServiceImpl implements ILedgerCombinedImportSer
1537 1601
         // 构建区域缓存:Map<区域名称, 区域ID>
1538 1602
         // 从base_position表查询position_type='REGIONAL'的区域
1539 1603
         Map<String, Long> areaCache = new HashMap<>();
1540
-        BasePosition queryPosition = new BasePosition();
1541
-        queryPosition.setPositionType("REGIONAL");
1542
-        List<BasePosition> allAreas = basePositionMapper.selectBasePositionList(queryPosition);
1604
+
1605
+        Map<String, Long> channelCache = new HashMap<>();
1606
+        List<BasePosition> allAreas = basePositionMapper.selectBasePositionList(new BasePosition());
1543 1607
         if (allAreas != null) {
1544
-            for (BasePosition area : allAreas) {
1608
+            List<BasePosition> collect = allAreas.stream().filter(area -> "REGIONAL".equals(area.getPositionType())).collect(Collectors.toList());
1609
+            for (BasePosition area : collect) {
1545 1610
                 if (area.getName() != null && !area.getName().trim().isEmpty()) {
1546 1611
                     areaCache.put(area.getName().trim(), area.getId());
1547 1612
                 }
1548 1613
             }
1614
+            List<BasePosition> channel = allAreas.stream().filter(area -> "CHANNEL".equals(area.getPositionType())).collect(Collectors.toList());
1615
+            for (BasePosition post : channel) {
1616
+                if (post.getName() != null && !post.getName().trim().isEmpty()) {
1617
+                    channelCache.put(post.getName().trim(), post.getId());
1618
+                }
1619
+            }
1549 1620
         }
1550 1621
 
1551 1622
         // 创建统一缓存对象
1552
-        this.importCache = new ImportCache(userCache, deptCache, positionCache, areaCache);
1623
+        this.importCache = new ImportCache(userCache, deptCache, positionCache, areaCache,channelCache);
1553 1624
     }
1554 1625
 
1555 1626
     /**