浏览代码

同步台账优化

chenshudong 1 周之前
父节点
当前提交
6d76b95689

+ 0 - 16
airport-ledger/src/main/java/com/sundot/airport/ledger/service/impl/LedgerSyncServiceImpl.java

@@ -213,7 +213,6 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
213
 
213
 
214
         for (LedgerSupervisionProblem row : list) {
214
         for (LedgerSupervisionProblem row : list) {
215
             String src = "supervision_problem:" + row.getId();
215
             String src = "supervision_problem:" + row.getId();
216
-            if (existsBySrc(src)) { skip++; continue; }
217
             if (!hasName(row.getInspectedName())) { skip++; continue; }
216
             if (!hasName(row.getInspectedName())) { skip++; continue; }
218
             // 按问题层级选取L3指标和默认分值
217
             // 按问题层级选取L3指标和默认分值
219
             String level = row.getProblemLevel() != null ? row.getProblemLevel() : "";
218
             String level = row.getProblemLevel() != null ? row.getProblemLevel() : "";
@@ -260,7 +259,6 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
260
 
259
 
261
         for (LedgerRealtimeInterception row : list) {
260
         for (LedgerRealtimeInterception row : list) {
262
             String src = "realtime_interception:" + row.getId();
261
             String src = "realtime_interception:" + row.getId();
263
-            if (existsBySrc(src)) { skip++; continue; }
264
             if (!hasName(row.getInspectorName())) { skip++; continue; }
262
             if (!hasName(row.getInspectorName())) { skip++; continue; }
265
             // 取【问题层级】字段,站层级扣1分,部门层级扣0.8分,其它层级跳过
263
             // 取【问题层级】字段,站层级扣1分,部门层级扣0.8分,其它层级跳过
266
             String level = row.getProblemLevel() != null ? row.getProblemLevel() : "";
264
             String level = row.getProblemLevel() != null ? row.getProblemLevel() : "";
@@ -313,7 +311,6 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
313
         
311
         
314
         for (LedgerSecurityTest row : list) {
312
         for (LedgerSecurityTest row : list) {
315
             String src = "security_test:" + row.getId();
313
             String src = "security_test:" + row.getId();
316
-            if (existsBySrc(src)) { skip++; continue; }
317
             if (!"未通过".equals(row.getTestResult())) { skip++; continue; }
314
             if (!"未通过".equals(row.getTestResult())) { skip++; continue; }
318
             if (!hasName(row.getTestedName())) { skip++; continue; }
315
             if (!hasName(row.getTestedName())) { skip++; continue; }
319
             // 取层级字段(scoreIndicator),而不是testType
316
             // 取层级字段(scoreIndicator),而不是testType
@@ -360,7 +357,6 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
360
         
357
         
361
         for (LedgerUnsafeEvent row : list) {
358
         for (LedgerUnsafeEvent row : list) {
362
             String src = "unsafe_event:" + row.getId();
359
             String src = "unsafe_event:" + row.getId();
363
-            if (existsBySrc(src)) { skip++; continue; }
364
             if (!hasName(row.getResponsibleName())) { skip++; continue; }
360
             if (!hasName(row.getResponsibleName())) { skip++; continue; }
365
             String cat = row.getEventType() != null ? row.getEventType() : "";
361
             String cat = row.getEventType() != null ? row.getEventType() : "";
366
             long l3Id; BigDecimal defaultSv;
362
             long l3Id; BigDecimal defaultSv;
@@ -407,7 +403,6 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
407
         
403
         
408
         for (LedgerSeizureStats row : list) {
404
         for (LedgerSeizureStats row : list) {
409
             String src = "seizure_stats:" + row.getId();
405
             String src = "seizure_stats:" + row.getId();
410
-            if (existsBySrc(src)) { skip++; continue; }
411
             if (!hasName(row.getInspectorName())) { skip++; continue; }
406
             if (!hasName(row.getInspectorName())) { skip++; continue; }
412
             String cat = row.getItemCategory() != null ? row.getItemCategory() : "";
407
             String cat = row.getItemCategory() != null ? row.getItemCategory() : "";
413
             long l3Id; BigDecimal sv;
408
             long l3Id; BigDecimal sv;
@@ -455,7 +450,6 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
455
         
450
         
456
         for (LedgerRewardApproval row : list) {
451
         for (LedgerRewardApproval row : list) {
457
             String src = "reward_approval:" + row.getId();
452
             String src = "reward_approval:" + row.getId();
458
-            if (existsBySrc(src)) { skip++; continue; }
459
             if (!hasName(row.getPersonName())) { skip++; continue; }
453
             if (!hasName(row.getPersonName())) { skip++; continue; }
460
             String result = row.getDisposalResult() != null ? row.getDisposalResult() : "";
454
             String result = row.getDisposalResult() != null ? row.getDisposalResult() : "";
461
             long l3Id; BigDecimal sv;
455
             long l3Id; BigDecimal sv;
@@ -499,7 +493,6 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
499
         
493
         
500
         for (LedgerServicePatrol row : list) {
494
         for (LedgerServicePatrol row : list) {
501
             String src = "service_patrol:" + row.getId();
495
             String src = "service_patrol:" + row.getId();
502
-            if (existsBySrc(src)) { skip++; continue; }
503
             if (!hasName(row.getInspectedName())) { skip++; continue; }
496
             if (!hasName(row.getInspectedName())) { skip++; continue; }
504
             String level = row.getProblemLevel() != null ? row.getProblemLevel() : "";
497
             String level = row.getProblemLevel() != null ? row.getProblemLevel() : "";
505
             long l3Id; BigDecimal defaultSv;
498
             long l3Id; BigDecimal defaultSv;
@@ -545,7 +538,6 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
545
         
538
         
546
         for (LedgerComplaint row : list) {
539
         for (LedgerComplaint row : list) {
547
             String src = "complaint:" + row.getId();
540
             String src = "complaint:" + row.getId();
548
-            if (existsBySrc(src)) { skip++; continue; }
549
             if (!hasName(row.getResponsibleName())) { skip++; continue; }
541
             if (!hasName(row.getResponsibleName())) { skip++; continue; }
550
             BigDecimal sv = row.getDeductScore() != null ? row.getDeductScore().negate() : NEG_TWO;
542
             BigDecimal sv = row.getDeductScore() != null ? row.getDeductScore().negate() : NEG_TWO;
551
             ScoreEvent e = buildEvent(dimId, lv2, null, row.getResponsibleName(),
543
             ScoreEvent e = buildEvent(dimId, lv2, null, row.getResponsibleName(),
@@ -585,7 +577,6 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
585
         
577
         
586
         for (LedgerTerminalBonus row : list) {
578
         for (LedgerTerminalBonus row : list) {
587
             String src = "terminal_bonus:" + row.getId();
579
             String src = "terminal_bonus:" + row.getId();
588
-            if (existsBySrc(src)) { skip++; continue; }
589
             if (!hasName(row.getPersonName())) { skip++; continue; }
580
             if (!hasName(row.getPersonName())) { skip++; continue; }
590
             BigDecimal sv = lv3.getScoreValue() != null ? lv3.getScoreValue() : ZERO;
581
             BigDecimal sv = lv3.getScoreValue() != null ? lv3.getScoreValue() : ZERO;
591
             ScoreEvent e = buildEvent(dimId, lv2, lv3, row.getPersonName(),
582
             ScoreEvent e = buildEvent(dimId, lv2, lv3, row.getPersonName(),
@@ -624,7 +615,6 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
624
         
615
         
625
         for (LedgerExamScore row : list) {
616
         for (LedgerExamScore row : list) {
626
             String src = "exam_score:" + row.getId();
617
             String src = "exam_score:" + row.getId();
627
-            if (existsBySrc(src)) { skip++; continue; }
628
             if (!hasName(row.getPersonName())) { skip++; continue; }
618
             if (!hasName(row.getPersonName())) { skip++; continue; }
629
             if (row.getTheoryScore() == null) { skip++; continue; }
619
             if (row.getTheoryScore() == null) { skip++; continue; }
630
             double score = row.getTheoryScore().doubleValue();
620
             double score = row.getTheoryScore().doubleValue();
@@ -807,12 +797,6 @@ public class LedgerSyncServiceImpl implements ILedgerSyncService {
807
         return indCache.computeIfAbsent(id, indicatorMapper::selectById);
797
         return indCache.computeIfAbsent(id, indicatorMapper::selectById);
808
     }
798
     }
809
 
799
 
810
-    private boolean existsBySrc(String sourceLedger) {
811
-        return scoreEventService.count(
812
-                new LambdaQueryWrapper<ScoreEvent>()
813
-                        .eq(ScoreEvent::getSourceLedger, sourceLedger)) > 0;
814
-    }
815
-
816
     private boolean hasName(String name) {
800
     private boolean hasName(String name) {
817
         return StringUtils.hasText(name);
801
         return StringUtils.hasText(name);
818
     }
802
     }