|
|
@@ -18,6 +18,7 @@ import com.sundot.airport.system.mapper.SysUserMapper;
|
|
18
|
18
|
import com.sundot.airport.system.service.IBasePositionService;
|
|
19
|
19
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
20
|
20
|
import org.springframework.stereotype.Service;
|
|
|
21
|
+import org.springframework.transaction.annotation.Propagation;
|
|
21
|
22
|
import org.springframework.transaction.annotation.Transactional;
|
|
22
|
23
|
import org.springframework.util.StringUtils;
|
|
23
|
24
|
|
|
|
@@ -66,6 +67,7 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
|
|
66
|
67
|
@Autowired private ScoreIndicatorMapper indicatorMapper;
|
|
67
|
68
|
@Autowired private SysDeptMapper sysDeptMapper;
|
|
68
|
69
|
@Autowired private SysUserMapper sysUserMapper;
|
|
|
70
|
+ @Autowired private LedgerSyncServiceImpl self;
|
|
69
|
71
|
@Autowired private IBasePositionService basePositionService;
|
|
70
|
72
|
|
|
71
|
73
|
// ── Dimension ID cache (loaded once) ─────────────────────
|
|
|
@@ -140,7 +142,7 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
|
|
140
|
142
|
"supervision_problem", "realtime_interception", "security_test",
|
|
141
|
143
|
"unsafe_event", "seizure_stats", "reward_approval",
|
|
142
|
144
|
"service_patrol", "complaint", "terminal_bonus", "exam_score")) {
|
|
143
|
|
- SyncResult r = doSync(type);
|
|
|
145
|
+ SyncResult r = self.doSyncInNestedTransaction(type);
|
|
144
|
146
|
sb.append(type).append(":+").append(r.getTotalInserted())
|
|
145
|
147
|
.append("/skip").append(r.getTotalSkipped()).append(" ");
|
|
146
|
148
|
totalIns += r.getTotalInserted();
|
|
|
@@ -148,7 +150,6 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
|
|
148
|
150
|
}
|
|
149
|
151
|
return new SyncResult(totalIns, totalSkip, sb.toString());
|
|
150
|
152
|
} finally {
|
|
151
|
|
- // 同步完成后清除缓存
|
|
152
|
153
|
clearCaches();
|
|
153
|
154
|
}
|
|
154
|
155
|
}
|
|
|
@@ -168,6 +169,11 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
|
|
168
|
169
|
}
|
|
169
|
170
|
}
|
|
170
|
171
|
|
|
|
172
|
+ @Transactional(propagation = Propagation.NESTED, rollbackFor = Exception.class)
|
|
|
173
|
+ public SyncResult doSyncInNestedTransaction(String type) {
|
|
|
174
|
+ return doSync(type);
|
|
|
175
|
+ }
|
|
|
176
|
+
|
|
171
|
177
|
// ═════════════════════════════════════════════════════════
|
|
172
|
178
|
// Router
|
|
173
|
179
|
// ═════════════════════════════════════════════════════════
|