wangxx недель назад: 2
Родитель
Сommit
9cceee59c9

+ 50 - 10
airport-ledger/src/main/java/com/sundot/airport/ledger/service/impl/LedgerSyncServiceImpl.java

@@ -211,7 +211,11 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
211
             scoreEventMapper.insert(e);
211
             scoreEventMapper.insert(e);
212
             ins++;
212
             ins++;
213
         }
213
         }
214
-        supervisionMapper.updateSyncFlag();
214
+        // 分批更新 sync_flag,避免锁等待超时
215
+        int updatedRows;
216
+        do {
217
+            updatedRows = supervisionMapper.updateSyncFlag();
218
+        } while (updatedRows > 0);
215
         return new SyncResult(ins, skip, "");
219
         return new SyncResult(ins, skip, "");
216
     }
220
     }
217
 
221
 
@@ -249,7 +253,11 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
249
             scoreEventMapper.insert(e);
253
             scoreEventMapper.insert(e);
250
             ins++;
254
             ins++;
251
         }
255
         }
252
-        interceptionMapper.updateSyncFlag();
256
+        // 分批更新 sync_flag,避免锁等待超时
257
+        int updatedRows;
258
+        do {
259
+            updatedRows = interceptionMapper.updateSyncFlag();
260
+        } while (updatedRows > 0);
253
         return new SyncResult(ins, skip, "");
261
         return new SyncResult(ins, skip, "");
254
     }
262
     }
255
 
263
 
@@ -281,7 +289,11 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
281
             scoreEventMapper.insert(e);
289
             scoreEventMapper.insert(e);
282
             ins++;
290
             ins++;
283
         }
291
         }
284
-        securityTestMapper.updateSyncFlag();
292
+        // 分批更新 sync_flag,避免锁等待超时
293
+        int updatedRows;
294
+        do {
295
+            updatedRows = securityTestMapper.updateSyncFlag();
296
+        } while (updatedRows > 0);
285
         return new SyncResult(ins, skip, "");
297
         return new SyncResult(ins, skip, "");
286
     }
298
     }
287
 
299
 
@@ -313,7 +325,11 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
313
             scoreEventMapper.insert(e);
325
             scoreEventMapper.insert(e);
314
             ins++;
326
             ins++;
315
         }
327
         }
316
-        unsafeEventMapper.updateSyncFlag();
328
+        // 分批更新 sync_flag,避免锁等待超时
329
+        int updatedRows;
330
+        do {
331
+            updatedRows = unsafeEventMapper.updateSyncFlag();
332
+        } while (updatedRows > 0);
317
         return new SyncResult(ins, skip, "");
333
         return new SyncResult(ins, skip, "");
318
     }
334
     }
319
 
335
 
@@ -342,7 +358,11 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
342
             scoreEventMapper.insert(e);
358
             scoreEventMapper.insert(e);
343
             ins++;
359
             ins++;
344
         }
360
         }
345
-        seizureMapper.updateSyncFlag();
361
+        // 分批更新 sync_flag,避免锁等待超时
362
+        int updatedRows;
363
+        do {
364
+            updatedRows = seizureMapper.updateSyncFlag();
365
+        } while (updatedRows > 0);
346
         return new SyncResult(ins, skip, "");
366
         return new SyncResult(ins, skip, "");
347
     }
367
     }
348
 
368
 
@@ -375,7 +395,11 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
375
             scoreEventMapper.insert(e);
395
             scoreEventMapper.insert(e);
376
             ins++;
396
             ins++;
377
         }
397
         }
378
-        rewardApprovalMapper.updateSyncFlag();
398
+        // 分批更新 sync_flag,避免锁等待超时
399
+        int updatedRows;
400
+        do {
401
+            updatedRows = rewardApprovalMapper.updateSyncFlag();
402
+        } while (updatedRows > 0);
379
         return new SyncResult(ins, skip, "");
403
         return new SyncResult(ins, skip, "");
380
     }
404
     }
381
 
405
 
@@ -406,7 +430,11 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
406
             scoreEventMapper.insert(e);
430
             scoreEventMapper.insert(e);
407
             ins++;
431
             ins++;
408
         }
432
         }
409
-        servicePatrolMapper.updateSyncFlag();
433
+        // 分批更新 sync_flag,避免锁等待超时
434
+        int updatedRows;
435
+        do {
436
+            updatedRows = servicePatrolMapper.updateSyncFlag();
437
+        } while (updatedRows > 0);
410
         return new SyncResult(ins, skip, "");
438
         return new SyncResult(ins, skip, "");
411
     }
439
     }
412
 
440
 
@@ -430,7 +458,11 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
430
             scoreEventMapper.insert(e);
458
             scoreEventMapper.insert(e);
431
             ins++;
459
             ins++;
432
         }
460
         }
433
-        complaintMapper.updateSyncFlag();
461
+        // 分批更新 sync_flag,避免锁等待超时
462
+        int updatedRows;
463
+        do {
464
+            updatedRows = complaintMapper.updateSyncFlag();
465
+        } while (updatedRows > 0);
434
         return new SyncResult(ins, skip, "");
466
         return new SyncResult(ins, skip, "");
435
     }
467
     }
436
 
468
 
@@ -455,7 +487,11 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
455
             scoreEventMapper.insert(e);
487
             scoreEventMapper.insert(e);
456
             ins++;
488
             ins++;
457
         }
489
         }
458
-        terminalBonusMapper.updateSyncFlag();
490
+        // 分批更新 sync_flag,避免锁等待超时
491
+        int updatedRows;
492
+        do {
493
+            updatedRows = terminalBonusMapper.updateSyncFlag();
494
+        } while (updatedRows > 0);
459
         return new SyncResult(ins, skip, "");
495
         return new SyncResult(ins, skip, "");
460
     }
496
     }
461
 
497
 
@@ -487,7 +523,11 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
487
             scoreEventMapper.insert(e);
523
             scoreEventMapper.insert(e);
488
             ins++;
524
             ins++;
489
         }
525
         }
490
-        examScoreMapper.updateSyncFlag();
526
+        // 分批更新 sync_flag,避免锁等待超时
527
+        int updatedRows;
528
+        do {
529
+            updatedRows = examScoreMapper.updateSyncFlag();
530
+        } while (updatedRows > 0);
491
         return new SyncResult(ins, skip, "");
531
         return new SyncResult(ins, skip, "");
492
     }
532
     }
493
 
533
 

+ 1 - 0
airport-ledger/src/main/resources/mapper/ledger/LedgerComplaintMapper.xml

@@ -60,5 +60,6 @@
60
         update ledger_complaint
60
         update ledger_complaint
61
         set sync_flag = '1'
61
         set sync_flag = '1'
62
         where sync_flag = '0'
62
         where sync_flag = '0'
63
+        limit 1000
63
     </update>
64
     </update>
64
 </mapper>
65
 </mapper>

+ 3 - 2
airport-ledger/src/main/resources/mapper/ledger/LedgerExamScoreMapper.xml

@@ -40,10 +40,10 @@
40
         <if test="teamName != null and teamName != ''">AND team_name LIKE CONCAT('%', #{teamName}, '%')</if>
40
         <if test="teamName != null and teamName != ''">AND team_name LIKE CONCAT('%', #{teamName}, '%')</if>
41
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
41
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
42
         <if test="params != null and params.beginTime != null and params.beginTime != ''">
42
         <if test="params != null and params.beginTime != null and params.beginTime != ''">
43
-            AND record_date &gt;= #{params.beginTime}
43
+            AND exam_date &gt;= #{params.beginTime}
44
         </if>
44
         </if>
45
         <if test="params != null and params.endTime != null and params.endTime != ''">
45
         <if test="params != null and params.endTime != null and params.endTime != ''">
46
-            AND record_date &lt;= #{params.endTime}
46
+            AND exam_date &lt;= #{params.endTime}
47
         </if>
47
         </if>
48
         ORDER BY id DESC
48
         ORDER BY id DESC
49
     </select>
49
     </select>
@@ -52,5 +52,6 @@
52
         update ledger_exam_score
52
         update ledger_exam_score
53
         set sync_flag = '1'
53
         set sync_flag = '1'
54
         where sync_flag = '0'
54
         where sync_flag = '0'
55
+        limit 1000
55
     </update>
56
     </update>
56
 </mapper>
57
 </mapper>

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

@@ -43,10 +43,10 @@
43
         <if test="personName != null and personName != ''">AND person_name LIKE CONCAT('%', #{personName}, '%')</if>
43
         <if test="personName != null and personName != ''">AND person_name LIKE CONCAT('%', #{personName}, '%')</if>
44
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
44
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
45
         <if test="params != null and params.beginTime != null and params.beginTime != ''">
45
         <if test="params != null and params.beginTime != null and params.beginTime != ''">
46
-            AND record_date &gt;= #{params.beginTime}
46
+            AND start_date &gt;= #{params.beginTime}
47
         </if>
47
         </if>
48
         <if test="params != null and params.endTime != null and params.endTime != ''">
48
         <if test="params != null and params.endTime != null and params.endTime != ''">
49
-            AND record_date &lt;= #{params.endTime}
49
+            AND end_date &lt;= #{params.endTime}
50
         </if>
50
         </if>
51
         ORDER BY id DESC
51
         ORDER BY id DESC
52
     </select>
52
     </select>

+ 1 - 0
airport-ledger/src/main/resources/mapper/ledger/LedgerRealtimeInterceptionMapper.xml

@@ -66,6 +66,7 @@
66
         update ledger_realtime_interception
66
         update ledger_realtime_interception
67
         set sync_flag = '1'
67
         set sync_flag = '1'
68
         where sync_flag = '0'
68
         where sync_flag = '0'
69
+        limit 1000
69
     </update>
70
     </update>
70
 
71
 
71
     <select id="realtimeInterceptionItem"
72
     <select id="realtimeInterceptionItem"

+ 3 - 2
airport-ledger/src/main/resources/mapper/ledger/LedgerRewardApprovalMapper.xml

@@ -44,10 +44,10 @@
44
         <if test="personName != null and personName != ''">AND person_name LIKE CONCAT('%', #{personName}, '%')</if>
44
         <if test="personName != null and personName != ''">AND person_name LIKE CONCAT('%', #{personName}, '%')</if>
45
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
45
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
46
         <if test="params != null and params.beginTime != null and params.beginTime != ''">
46
         <if test="params != null and params.beginTime != null and params.beginTime != ''">
47
-            AND record_date &gt;= #{params.beginTime}
47
+            AND approve_date &gt;= #{params.beginTime}
48
         </if>
48
         </if>
49
         <if test="params != null and params.endTime != null and params.endTime != ''">
49
         <if test="params != null and params.endTime != null and params.endTime != ''">
50
-            AND record_date &lt;= #{params.endTime}
50
+            AND approve_date &lt;= #{params.endTime}
51
         </if>
51
         </if>
52
         ORDER BY id DESC
52
         ORDER BY id DESC
53
     </select>
53
     </select>
@@ -56,5 +56,6 @@
56
         update ledger_reward_approval
56
         update ledger_reward_approval
57
         set sync_flag = '1'
57
         set sync_flag = '1'
58
         where sync_flag = '0'
58
         where sync_flag = '0'
59
+        limit 1000
59
     </update>
60
     </update>
60
 </mapper>
61
 </mapper>

+ 1 - 0
airport-ledger/src/main/resources/mapper/ledger/LedgerSecurityTestMapper.xml

@@ -69,6 +69,7 @@
69
         update ledger_security_test
69
         update ledger_security_test
70
         set sync_flag = '1'
70
         set sync_flag = '1'
71
         where sync_flag = '0'
71
         where sync_flag = '0'
72
+        limit 1000
72
     </update>
73
     </update>
73
 
74
 
74
     <select id="securityTestItemClassification"
75
     <select id="securityTestItemClassification"

+ 3 - 2
airport-ledger/src/main/resources/mapper/ledger/LedgerSeizureStatsMapper.xml

@@ -68,10 +68,10 @@
68
         <if test="teamName != null and teamName != ''">AND team_name LIKE CONCAT('%', #{teamName}, '%')</if>
68
         <if test="teamName != null and teamName != ''">AND team_name LIKE CONCAT('%', #{teamName}, '%')</if>
69
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
69
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
70
         <if test="params != null and params.beginTime != null and params.beginTime != ''">
70
         <if test="params != null and params.beginTime != null and params.beginTime != ''">
71
-            AND (record_date &gt;= #{params.beginTime} OR approve_date &gt;= #{params.beginTime} OR exam_date &gt;= #{params.beginTime})
71
+            AND record_date &gt;= #{params.beginTime}
72
         </if>
72
         </if>
73
         <if test="params != null and params.endTime != null and params.endTime != ''">
73
         <if test="params != null and params.endTime != null and params.endTime != ''">
74
-            AND (record_date &lt;= #{params.endTime} OR approve_date &lt;= #{params.endTime} OR exam_date &lt;= #{params.endTime})
74
+            AND record_date &lt;= #{params.endTime}
75
         </if>
75
         </if>
76
         ORDER BY id DESC
76
         ORDER BY id DESC
77
     </select>
77
     </select>
@@ -80,6 +80,7 @@
80
         update ledger_seizure_stats
80
         update ledger_seizure_stats
81
         set sync_flag = '1'
81
         set sync_flag = '1'
82
         where sync_flag = '0'
82
         where sync_flag = '0'
83
+        limit 1000
83
     </update>
84
     </update>
84
 
85
 
85
     <select id="countByInspectorAndDateRange" resultType="int">
86
     <select id="countByInspectorAndDateRange" resultType="int">

+ 1 - 0
airport-ledger/src/main/resources/mapper/ledger/LedgerServicePatrolMapper.xml

@@ -70,5 +70,6 @@
70
         update ledger_service_patrol
70
         update ledger_service_patrol
71
         set sync_flag = '1'
71
         set sync_flag = '1'
72
         where sync_flag = '0'
72
         where sync_flag = '0'
73
+        limit 1000
73
     </update>
74
     </update>
74
 </mapper>
75
 </mapper>

+ 1 - 0
airport-ledger/src/main/resources/mapper/ledger/LedgerSupervisionProblemMapper.xml

@@ -72,6 +72,7 @@
72
         update ledger_supervision_problem
72
         update ledger_supervision_problem
73
         set sync_flag = '1'
73
         set sync_flag = '1'
74
         where sync_flag = '0'
74
         where sync_flag = '0'
75
+        limit 1000
75
     </update>
76
     </update>
76
 
77
 
77
     <select id="supervisionProblemPosition"
78
     <select id="supervisionProblemPosition"

+ 3 - 2
airport-ledger/src/main/resources/mapper/ledger/LedgerTerminalBonusMapper.xml

@@ -42,10 +42,10 @@
42
         <if test="teamName != null and teamName != ''">AND team_name LIKE CONCAT('%', #{teamName}, '%')</if>
42
         <if test="teamName != null and teamName != ''">AND team_name LIKE CONCAT('%', #{teamName}, '%')</if>
43
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
43
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
44
         <if test="params != null and params.beginTime != null and params.beginTime != ''">
44
         <if test="params != null and params.beginTime != null and params.beginTime != ''">
45
-            AND record_date &gt;= #{params.beginTime}
45
+            AND score_date &gt;= #{params.beginTime}
46
         </if>
46
         </if>
47
         <if test="params != null and params.endTime != null and params.endTime != ''">
47
         <if test="params != null and params.endTime != null and params.endTime != ''">
48
-            AND record_date &lt;= #{params.endTime}
48
+            AND score_date &lt;= #{params.endTime}
49
         </if>
49
         </if>
50
         ORDER BY id DESC
50
         ORDER BY id DESC
51
     </select>
51
     </select>
@@ -54,5 +54,6 @@
54
         update ledger_terminal_bonus
54
         update ledger_terminal_bonus
55
         set sync_flag = '1'
55
         set sync_flag = '1'
56
         where sync_flag = '0'
56
         where sync_flag = '0'
57
+        limit 1000
57
     </update>
58
     </update>
58
 </mapper>
59
 </mapper>

+ 1 - 0
airport-ledger/src/main/resources/mapper/ledger/LedgerUnsafeEventMapper.xml

@@ -63,6 +63,7 @@
63
         update ledger_unsafe_event
63
         update ledger_unsafe_event
64
         set sync_flag = '1'
64
         set sync_flag = '1'
65
         where sync_flag = '0'
65
         where sync_flag = '0'
66
+        limit 1000
66
     </update>
67
     </update>
67
 
68
 
68
     <select id="countSeizureStatsItem" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="com.sundot.airport.ledger.domain.vo.UnsafeItemVO">
69
     <select id="countSeizureStatsItem" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="com.sundot.airport.ledger.domain.vo.UnsafeItemVO">