|
|
@@ -10,8 +10,10 @@ import com.sundot.airport.common.utils.DateUtils;
|
|
10
|
10
|
import com.sundot.airport.ledger.domain.*;
|
|
11
|
11
|
import com.sundot.airport.ledger.mapper.*;
|
|
12
|
12
|
import com.sundot.airport.ledger.service.ILedgerSyncService;
|
|
|
13
|
+import com.sundot.airport.system.domain.BasePosition;
|
|
13
|
14
|
import com.sundot.airport.system.mapper.SysDeptMapper;
|
|
14
|
15
|
import com.sundot.airport.system.mapper.SysUserMapper;
|
|
|
16
|
+import com.sundot.airport.system.service.IBasePositionService;
|
|
15
|
17
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
16
|
18
|
import org.springframework.stereotype.Service;
|
|
17
|
19
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -62,11 +64,13 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
|
|
62
|
64
|
@Autowired private ScoreIndicatorMapper indicatorMapper;
|
|
63
|
65
|
@Autowired private SysDeptMapper sysDeptMapper;
|
|
64
|
66
|
@Autowired private SysUserMapper sysUserMapper;
|
|
|
67
|
+ @Autowired private IBasePositionService basePositionService;
|
|
65
|
68
|
|
|
66
|
69
|
// ── Dimension ID cache (loaded once) ─────────────────────
|
|
67
|
70
|
private final Map<String, Long> dimCache = new HashMap<>();
|
|
68
|
71
|
private final Map<String, Long> deptCache = new HashMap<>();
|
|
69
|
72
|
private final Map<String, Long> userCache = new HashMap<>();
|
|
|
73
|
+ private final Map<Long, BasePosition> positionCache = new HashMap<>();
|
|
70
|
74
|
|
|
71
|
75
|
// ── Constants: Indicator IDs(与 score.sql 中的显式 ID 对应)─
|
|
72
|
76
|
// dim1 安全防控能力
|
|
|
@@ -127,6 +131,7 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
|
|
127
|
131
|
loadDimCache();
|
|
128
|
132
|
loadDeptCache();
|
|
129
|
133
|
loadUserCache();
|
|
|
134
|
+ loadPositionCache();
|
|
130
|
135
|
StringBuilder sb = new StringBuilder();
|
|
131
|
136
|
int totalIns = 0, totalSkip = 0;
|
|
132
|
137
|
for (String type : Arrays.asList(
|
|
|
@@ -153,6 +158,7 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
|
|
153
|
158
|
loadDimCache();
|
|
154
|
159
|
loadDeptCache();
|
|
155
|
160
|
loadUserCache();
|
|
|
161
|
+ loadPositionCache();
|
|
156
|
162
|
return doSync(ledgerType);
|
|
157
|
163
|
} finally {
|
|
158
|
164
|
// 同步完成后清除缓存
|
|
|
@@ -551,6 +557,19 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
|
|
551
|
557
|
sysUserMapper.selectUserList(new SysUser()).forEach(d -> userCache.put(d.getNickName(), d.getUserId()));
|
|
552
|
558
|
}
|
|
553
|
559
|
|
|
|
560
|
+ /** 缓存所有区域-航站楼关系 */
|
|
|
561
|
+ private void loadPositionCache() {
|
|
|
562
|
+ if (!positionCache.isEmpty()) return;
|
|
|
563
|
+ List<BasePosition> basePositionList = basePositionService.selectBasePositionListTree(new BasePosition());
|
|
|
564
|
+ basePositionList.forEach(terminl -> {
|
|
|
565
|
+ if (terminl.getChildren() != null && !terminl.getChildren().isEmpty()) {
|
|
|
566
|
+ terminl.getChildren().forEach(regional -> {
|
|
|
567
|
+ positionCache.put(((BasePosition) regional).getId(), terminl);
|
|
|
568
|
+ });
|
|
|
569
|
+ }
|
|
|
570
|
+ });
|
|
|
571
|
+ }
|
|
|
572
|
+
|
|
554
|
573
|
/**
|
|
555
|
574
|
* 清除所有缓存
|
|
556
|
575
|
*/
|
|
|
@@ -558,6 +577,7 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
|
|
558
|
577
|
dimCache.clear();
|
|
559
|
578
|
deptCache.clear();
|
|
560
|
579
|
userCache.clear();
|
|
|
580
|
+ positionCache.clear();
|
|
561
|
581
|
indCache.clear();
|
|
562
|
582
|
indicatorNameToIdCache.clear();
|
|
563
|
583
|
}
|
|
|
@@ -705,6 +725,12 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
|
|
705
|
725
|
e.setChannelName(channelNo);
|
|
706
|
726
|
e.setRegionalName(location);
|
|
707
|
727
|
e.setRegionalId(areaId);
|
|
|
728
|
+ // 通过区域查找航站楼
|
|
|
729
|
+ BasePosition terminl = positionCache.get(e.getRegionalId());
|
|
|
730
|
+ if (terminl != null) {
|
|
|
731
|
+ e.setTerminlId(terminl.getId());
|
|
|
732
|
+ e.setTerminlName(terminl.getName());
|
|
|
733
|
+ }
|
|
708
|
734
|
e.setPostId(positionId);
|
|
709
|
735
|
e.setPostName(position);
|
|
710
|
736
|
// 通过人员名称解析组织信息(ID和名称)
|