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

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

@@ -40,10 +40,10 @@
40 40
         <if test="teamName != null and teamName != ''">AND team_name LIKE CONCAT('%', #{teamName}, '%')</if>
41 41
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
42 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 44
         </if>
45 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 47
         </if>
48 48
         ORDER BY id DESC
49 49
     </select>
@@ -52,5 +52,6 @@
52 52
         update ledger_exam_score
53 53
         set sync_flag = '1'
54 54
         where sync_flag = '0'
55
+        limit 1000
55 56
     </update>
56 57
 </mapper>

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

@@ -43,10 +43,10 @@
43 43
         <if test="personName != null and personName != ''">AND person_name LIKE CONCAT('%', #{personName}, '%')</if>
44 44
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
45 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 47
         </if>
48 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 50
         </if>
51 51
         ORDER BY id DESC
52 52
     </select>

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

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

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

@@ -44,10 +44,10 @@
44 44
         <if test="personName != null and personName != ''">AND person_name LIKE CONCAT('%', #{personName}, '%')</if>
45 45
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
46 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 48
         </if>
49 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 51
         </if>
52 52
         ORDER BY id DESC
53 53
     </select>
@@ -56,5 +56,6 @@
56 56
         update ledger_reward_approval
57 57
         set sync_flag = '1'
58 58
         where sync_flag = '0'
59
+        limit 1000
59 60
     </update>
60 61
 </mapper>

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

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

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

@@ -68,10 +68,10 @@
68 68
         <if test="teamName != null and teamName != ''">AND team_name LIKE CONCAT('%', #{teamName}, '%')</if>
69 69
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
70 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 72
         </if>
73 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 75
         </if>
76 76
         ORDER BY id DESC
77 77
     </select>
@@ -80,6 +80,7 @@
80 80
         update ledger_seizure_stats
81 81
         set sync_flag = '1'
82 82
         where sync_flag = '0'
83
+        limit 1000
83 84
     </update>
84 85
 
85 86
     <select id="countByInspectorAndDateRange" resultType="int">

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

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

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

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

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

@@ -42,10 +42,10 @@
42 42
         <if test="teamName != null and teamName != ''">AND team_name LIKE CONCAT('%', #{teamName}, '%')</if>
43 43
         <if test="syncFlag != null and syncFlag != ''">AND sync_flag = #{syncFlag}</if>
44 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 46
         </if>
47 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 49
         </if>
50 50
         ORDER BY id DESC
51 51
     </select>
@@ -54,5 +54,6 @@
54 54
         update ledger_terminal_bonus
55 55
         set sync_flag = '1'
56 56
         where sync_flag = '0'
57
+        limit 1000
57 58
     </update>
58 59
 </mapper>

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

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