|
|
@@ -1,11 +1,13 @@
|
|
1
|
1
|
package com.sundot.airport.blocked.service.impl;
|
|
2
|
2
|
|
|
3
|
3
|
import cn.hutool.core.collection.CollectionUtil;
|
|
4
|
|
-import com.sundot.airport.blocked.dto.BlockedAreaDistributionDTO;
|
|
5
|
|
-import com.sundot.airport.blocked.dto.BlockedBrigadeCertificateDistributionDTO;
|
|
|
4
|
+import com.sundot.airport.blocked.dto.BlockedAreaBlockedDTO;
|
|
|
5
|
+import com.sundot.airport.blocked.dto.BlockedAreaDistributionResultDTO;
|
|
|
6
|
+import com.sundot.airport.blocked.dto.BlockedAreaLuggageDTO;
|
|
6
|
7
|
import com.sundot.airport.blocked.dto.BlockedBrigadeRateStatsDTO;
|
|
7
|
8
|
import com.sundot.airport.blocked.dto.BlockedBrigadeStatsDTO;
|
|
8
|
9
|
import com.sundot.airport.blocked.dto.BlockedCertificateDistributionDTO;
|
|
|
10
|
+import com.sundot.airport.blocked.dto.BlockedCertificateLevelDTO;
|
|
9
|
11
|
import com.sundot.airport.blocked.dto.BlockedCertificateLevelDistributionDTO;
|
|
10
|
12
|
import com.sundot.airport.blocked.dto.BlockedDailyBrigadeLuggageStatsDTO;
|
|
11
|
13
|
import com.sundot.airport.blocked.dto.BlockedDailyBrigadeRateStatsDTO;
|
|
|
@@ -38,6 +40,7 @@ import org.springframework.stereotype.Service;
|
|
38
|
40
|
import java.math.BigDecimal;
|
|
39
|
41
|
import java.util.Collections;
|
|
40
|
42
|
import java.util.List;
|
|
|
43
|
+import java.util.stream.Collectors;
|
|
41
|
44
|
|
|
42
|
45
|
/**
|
|
43
|
46
|
* 查堵大屏Service业务层处理
|
|
|
@@ -194,18 +197,55 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
|
|
194
|
197
|
@Override
|
|
195
|
198
|
public List<BlockedItemDistributionDTO> getItemDistribution(BlockedDashboardQueryDTO queryDTO) {
|
|
196
|
199
|
List<BlockedItemDistributionDTO> resultList = blockedDashboardMapper.selectItemDistribution(queryDTO);
|
|
|
200
|
+ if (resultList != null && !resultList.isEmpty()) {
|
|
|
201
|
+ // 计算总数
|
|
|
202
|
+ long totalCount = resultList.stream().mapToLong(item -> item.getCount() != null ? item.getCount() : 0).sum();
|
|
|
203
|
+ // 计算百分比
|
|
|
204
|
+ if (totalCount > 0) {
|
|
|
205
|
+ resultList.forEach(item -> {
|
|
|
206
|
+ long count = item.getCount() != null ? item.getCount() : 0;
|
|
|
207
|
+ double percentage = Math.round(count * 10000.0 / totalCount) / 100.0;
|
|
|
208
|
+ item.setPercentage(java.math.BigDecimal.valueOf(percentage));
|
|
|
209
|
+ });
|
|
|
210
|
+ }
|
|
|
211
|
+ }
|
|
197
|
212
|
return resultList != null ? resultList : Collections.emptyList();
|
|
198
|
213
|
}
|
|
199
|
214
|
|
|
200
|
215
|
/**
|
|
201
|
|
- * 查询区域查堵数据分布(用于双轴图表)
|
|
|
216
|
+ * 查询区域查堵数据分布(双轴图表)
|
|
202
|
217
|
*
|
|
203
|
218
|
* @param queryDTO 查询参数
|
|
204
|
|
- * @return 区域查堵数据分布统计
|
|
|
219
|
+ * @return 区域查堵数据分布统计结果
|
|
205
|
220
|
*/
|
|
206
|
221
|
@Override
|
|
207
|
|
- public BlockedAreaDistributionDTO getAreaDistribution(BlockedDashboardQueryDTO queryDTO) {
|
|
208
|
|
- return blockedDashboardMapper.selectAreaDistribution(queryDTO);
|
|
|
222
|
+ public BlockedAreaDistributionResultDTO getAreaDistribution(BlockedDashboardQueryDTO queryDTO) {
|
|
|
223
|
+ BlockedAreaDistributionResultDTO result = new BlockedAreaDistributionResultDTO();
|
|
|
224
|
+
|
|
|
225
|
+ // 查询过检行李数(柱状图数据)
|
|
|
226
|
+ List<BlockedAreaLuggageDTO> luggageList = blockedDashboardMapper.selectAreaLuggageDistribution(queryDTO);
|
|
|
227
|
+ result.setLuggageDataList(luggageList != null ? luggageList : Collections.emptyList());
|
|
|
228
|
+
|
|
|
229
|
+ // 查询查堵件数(折线图数据)
|
|
|
230
|
+ List<BlockedAreaBlockedDTO> blockedList = blockedDashboardMapper.selectAreaBlockedDistribution(queryDTO);
|
|
|
231
|
+ result.setBlockedDataList(blockedList != null ? blockedList : Collections.emptyList());
|
|
|
232
|
+
|
|
|
233
|
+ // 提取大队名称列表
|
|
|
234
|
+ if (luggageList != null && !luggageList.isEmpty()) {
|
|
|
235
|
+ List<String> brigadeNames = luggageList.stream()
|
|
|
236
|
+ .map(BlockedAreaLuggageDTO::getBrigadeName)
|
|
|
237
|
+ .collect(Collectors.toList());
|
|
|
238
|
+ result.setBrigadeNames(brigadeNames);
|
|
|
239
|
+ } else if (blockedList != null && !blockedList.isEmpty()) {
|
|
|
240
|
+ List<String> brigadeNames = blockedList.stream()
|
|
|
241
|
+ .map(BlockedAreaBlockedDTO::getBrigadeName)
|
|
|
242
|
+ .collect(Collectors.toList());
|
|
|
243
|
+ result.setBrigadeNames(brigadeNames);
|
|
|
244
|
+ } else {
|
|
|
245
|
+ result.setBrigadeNames(Collections.emptyList());
|
|
|
246
|
+ }
|
|
|
247
|
+
|
|
|
248
|
+ return result;
|
|
209
|
249
|
}
|
|
210
|
250
|
|
|
211
|
251
|
/**
|
|
|
@@ -343,6 +383,18 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
|
|
343
|
383
|
@Override
|
|
344
|
384
|
public List<BlockedItemLocationDistributionDTO> getItemLocationDistribution(BlockedDashboardQueryDTO queryDTO) {
|
|
345
|
385
|
List<BlockedItemLocationDistributionDTO> resultList = blockedDashboardMapper.selectItemLocationDistribution(queryDTO);
|
|
|
386
|
+ if (resultList != null && !resultList.isEmpty()) {
|
|
|
387
|
+ // 计算总数
|
|
|
388
|
+ long totalCount = resultList.stream().mapToLong(item -> item.getCount() != null ? item.getCount() : 0).sum();
|
|
|
389
|
+ // 计算百分比
|
|
|
390
|
+ if (totalCount > 0) {
|
|
|
391
|
+ resultList.forEach(item -> {
|
|
|
392
|
+ long count = item.getCount() != null ? item.getCount() : 0;
|
|
|
393
|
+ double percentage = Math.round(count * 10000.0 / totalCount) / 100.0;
|
|
|
394
|
+ item.setPercentage(java.math.BigDecimal.valueOf(percentage));
|
|
|
395
|
+ });
|
|
|
396
|
+ }
|
|
|
397
|
+ }
|
|
346
|
398
|
return resultList != null ? resultList : Collections.emptyList();
|
|
347
|
399
|
}
|
|
348
|
400
|
|
|
|
@@ -355,6 +407,18 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
|
|
355
|
407
|
@Override
|
|
356
|
408
|
public List<BlockedMissCheckReasonDistributionDTO> getMissCheckReasonDistribution(BlockedDashboardQueryDTO queryDTO) {
|
|
357
|
409
|
List<BlockedMissCheckReasonDistributionDTO> resultList = blockedDashboardMapper.selectMissCheckReasonDistribution(queryDTO);
|
|
|
410
|
+ if (resultList != null && !resultList.isEmpty()) {
|
|
|
411
|
+ // 计算总数
|
|
|
412
|
+ long totalCount = resultList.stream().mapToLong(item -> item.getCount() != null ? item.getCount() : 0).sum();
|
|
|
413
|
+ // 计算百分比
|
|
|
414
|
+ if (totalCount > 0) {
|
|
|
415
|
+ resultList.forEach(item -> {
|
|
|
416
|
+ long count = item.getCount() != null ? item.getCount() : 0;
|
|
|
417
|
+ double percentage = Math.round(count * 10000.0 / totalCount) / 100.0;
|
|
|
418
|
+ item.setPercentage(java.math.BigDecimal.valueOf(percentage));
|
|
|
419
|
+ });
|
|
|
420
|
+ }
|
|
|
421
|
+ }
|
|
358
|
422
|
return resultList != null ? resultList : Collections.emptyList();
|
|
359
|
423
|
}
|
|
360
|
424
|
|
|
|
@@ -367,6 +431,18 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
|
|
367
|
431
|
@Override
|
|
368
|
432
|
public List<BlockedDifficultyDistributionDTO> getDifficultyDistribution(BlockedDashboardQueryDTO queryDTO) {
|
|
369
|
433
|
List<BlockedDifficultyDistributionDTO> resultList = blockedDashboardMapper.selectDifficultyDistribution(queryDTO);
|
|
|
434
|
+ if (resultList != null && !resultList.isEmpty()) {
|
|
|
435
|
+ // 计算总数
|
|
|
436
|
+ long totalCount = resultList.stream().mapToLong(item -> item.getCount() != null ? item.getCount() : 0).sum();
|
|
|
437
|
+ // 计算百分比
|
|
|
438
|
+ if (totalCount > 0) {
|
|
|
439
|
+ resultList.forEach(item -> {
|
|
|
440
|
+ long count = item.getCount() != null ? item.getCount() : 0;
|
|
|
441
|
+ double percentage = Math.round(count * 10000.0 / totalCount) / 100.0;
|
|
|
442
|
+ item.setPercentage(java.math.BigDecimal.valueOf(percentage));
|
|
|
443
|
+ });
|
|
|
444
|
+ }
|
|
|
445
|
+ }
|
|
370
|
446
|
return resultList != null ? resultList : Collections.emptyList();
|
|
371
|
447
|
}
|
|
372
|
448
|
|
|
|
@@ -380,12 +456,20 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
|
|
380
|
456
|
public List<BlockedCertificateDistributionDTO> getCertificateDistribution(BlockedDashboardQueryDTO queryDTO) {
|
|
381
|
457
|
List<BlockedCertificateDistributionDTO> resultList = blockedDashboardMapper.selectCertificateDistribution(queryDTO);
|
|
382
|
458
|
if (resultList != null && !resultList.isEmpty()) {
|
|
383
|
|
- // 转换证书级别为中文
|
|
384
|
|
- resultList.forEach(item -> {
|
|
385
|
|
- if (item.getCertificateLevel() != null) {
|
|
386
|
|
- item.setCertificateLevel(convertCertificateLevel(item.getCertificateLevel()));
|
|
387
|
|
- }
|
|
388
|
|
- });
|
|
|
459
|
+ // 计算总数
|
|
|
460
|
+ long totalCount = resultList.stream().mapToLong(item -> item.getCount() != null ? item.getCount() : 0).sum();
|
|
|
461
|
+ // 计算百分比
|
|
|
462
|
+ if (totalCount > 0) {
|
|
|
463
|
+ resultList.forEach(item -> {
|
|
|
464
|
+ long count = item.getCount() != null ? item.getCount() : 0;
|
|
|
465
|
+ double percentage = Math.round(count * 10000.0 / totalCount) / 100.0;
|
|
|
466
|
+ item.setPercentage(java.math.BigDecimal.valueOf(percentage));
|
|
|
467
|
+ // 转换证书级别为中文
|
|
|
468
|
+ if (item.getCertificateLevel() != null) {
|
|
|
469
|
+ item.setCertificateLevel(convertCertificateLevel(item.getCertificateLevel()));
|
|
|
470
|
+ }
|
|
|
471
|
+ });
|
|
|
472
|
+ }
|
|
389
|
473
|
}
|
|
390
|
474
|
return resultList != null ? resultList : Collections.emptyList();
|
|
391
|
475
|
}
|
|
|
@@ -397,8 +481,8 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
|
|
397
|
481
|
* @return 大队证书分布统计列表
|
|
398
|
482
|
*/
|
|
399
|
483
|
@Override
|
|
400
|
|
- public List<BlockedBrigadeCertificateDistributionDTO> getBrigadeCertificateDistribution(BlockedDashboardQueryDTO queryDTO) {
|
|
401
|
|
- List<BlockedBrigadeCertificateDistributionDTO> resultList = blockedDashboardMapper.selectBrigadeCertificateDistribution(queryDTO);
|
|
|
484
|
+ public List<BlockedCertificateLevelDTO> getBrigadeCertificateDistribution(BlockedDashboardQueryDTO queryDTO) {
|
|
|
485
|
+ List<BlockedCertificateLevelDTO> resultList = blockedDashboardMapper.selectBrigadeCertificateDistribution(queryDTO);
|
|
402
|
486
|
return resultList != null ? resultList : Collections.emptyList();
|
|
403
|
487
|
}
|
|
404
|
488
|
|
|
|
@@ -537,6 +621,18 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
|
|
537
|
621
|
@Override
|
|
538
|
622
|
public List<BlockedGenderDistributionDTO> getGenderDistribution(BlockedDashboardQueryDTO queryDTO) {
|
|
539
|
623
|
List<BlockedGenderDistributionDTO> resultList = blockedDashboardMapper.selectGenderDistribution(queryDTO);
|
|
|
624
|
+ if (resultList != null && !resultList.isEmpty()) {
|
|
|
625
|
+ // 计算总数
|
|
|
626
|
+ long totalCount = resultList.stream().mapToLong(item -> item.getCount() != null ? item.getCount() : 0).sum();
|
|
|
627
|
+ // 计算百分比
|
|
|
628
|
+ if (totalCount > 0) {
|
|
|
629
|
+ resultList.forEach(item -> {
|
|
|
630
|
+ long count = item.getCount() != null ? item.getCount() : 0;
|
|
|
631
|
+ double percentage = Math.round(count * 10000.0 / totalCount) / 100.0;
|
|
|
632
|
+ item.setPercentage(java.math.BigDecimal.valueOf(percentage));
|
|
|
633
|
+ });
|
|
|
634
|
+ }
|
|
|
635
|
+ }
|
|
540
|
636
|
return resultList != null ? resultList : Collections.emptyList();
|
|
541
|
637
|
}
|
|
542
|
638
|
|
|
|
@@ -551,6 +647,18 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
|
|
551
|
647
|
@Override
|
|
552
|
648
|
public List<BlockedCertificateLevelDistributionDTO> getCertificateLevelDistribution(BlockedDashboardQueryDTO queryDTO) {
|
|
553
|
649
|
List<BlockedCertificateLevelDistributionDTO> resultList = blockedDashboardMapper.selectCertificateLevelDistribution(queryDTO);
|
|
|
650
|
+ if (resultList != null && !resultList.isEmpty()) {
|
|
|
651
|
+ // 计算总数
|
|
|
652
|
+ long totalCount = resultList.stream().mapToLong(item -> item.getCount() != null ? item.getCount() : 0).sum();
|
|
|
653
|
+ // 计算百分比
|
|
|
654
|
+ if (totalCount > 0) {
|
|
|
655
|
+ resultList.forEach(item -> {
|
|
|
656
|
+ long count = item.getCount() != null ? item.getCount() : 0;
|
|
|
657
|
+ double percentage = Math.round(count * 10000.0 / totalCount) / 100.0;
|
|
|
658
|
+ item.setPercentage(java.math.BigDecimal.valueOf(percentage));
|
|
|
659
|
+ });
|
|
|
660
|
+ }
|
|
|
661
|
+ }
|
|
554
|
662
|
return resultList != null ? resultList : Collections.emptyList();
|
|
555
|
663
|
}
|
|
556
|
664
|
|
|
|
@@ -566,12 +674,20 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
|
|
566
|
674
|
public List<BlockedCertificateLevelDistributionDTO> getBrigadePersonnelCertificateBase(BlockedDashboardQueryDTO queryDTO) {
|
|
567
|
675
|
List<BlockedCertificateLevelDistributionDTO> resultList = blockedDashboardMapper.selectBrigadePersonnelCertificateBase(queryDTO);
|
|
568
|
676
|
if (resultList != null && !resultList.isEmpty()) {
|
|
569
|
|
- // 转换证书级别为中文
|
|
570
|
|
- resultList.forEach(item -> {
|
|
571
|
|
- if (item.getCertificateLevel() != null) {
|
|
572
|
|
- item.setCertificateLevel(convertCertificateLevel(item.getCertificateLevel()));
|
|
573
|
|
- }
|
|
574
|
|
- });
|
|
|
677
|
+ // 计算总数
|
|
|
678
|
+ long totalCount = resultList.stream().mapToLong(item -> item.getCount() != null ? item.getCount() : 0).sum();
|
|
|
679
|
+ // 计算百分比
|
|
|
680
|
+ if (totalCount > 0) {
|
|
|
681
|
+ resultList.forEach(item -> {
|
|
|
682
|
+ long count = item.getCount() != null ? item.getCount() : 0;
|
|
|
683
|
+ double percentage = Math.round(count * 10000.0 / totalCount) / 100.0;
|
|
|
684
|
+ item.setPercentage(java.math.BigDecimal.valueOf(percentage));
|
|
|
685
|
+ // 转换证书级别为中文
|
|
|
686
|
+ if (item.getCertificateLevel() != null) {
|
|
|
687
|
+ item.setCertificateLevel(convertCertificateLevel(item.getCertificateLevel()));
|
|
|
688
|
+ }
|
|
|
689
|
+ });
|
|
|
690
|
+ }
|
|
575
|
691
|
}
|
|
576
|
692
|
return resultList != null ? resultList : Collections.emptyList();
|
|
577
|
693
|
}
|
|
|
@@ -587,6 +703,18 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
|
|
587
|
703
|
@Override
|
|
588
|
704
|
public List<BlockedRankingDTO> getSupervisorDistribution(BlockedDashboardQueryDTO queryDTO) {
|
|
589
|
705
|
List<BlockedRankingDTO> resultList = blockedDashboardMapper.selectSupervisorDistribution(queryDTO);
|
|
|
706
|
+ if (resultList != null && !resultList.isEmpty()) {
|
|
|
707
|
+ // 计算总数
|
|
|
708
|
+ long totalCount = resultList.stream().mapToLong(item -> item.getTotalCount() != null ? item.getTotalCount() : 0).sum();
|
|
|
709
|
+ // 计算百分比
|
|
|
710
|
+ if (totalCount > 0) {
|
|
|
711
|
+ resultList.forEach(item -> {
|
|
|
712
|
+ long count = item.getTotalCount() != null ? item.getTotalCount() : 0;
|
|
|
713
|
+ double percentage = Math.round(count * 10000.0 / totalCount) / 100.0;
|
|
|
714
|
+ item.setPercentage(java.math.BigDecimal.valueOf(percentage));
|
|
|
715
|
+ });
|
|
|
716
|
+ }
|
|
|
717
|
+ }
|
|
590
|
718
|
return resultList != null ? resultList : Collections.emptyList();
|
|
591
|
719
|
}
|
|
592
|
720
|
|
|
|
@@ -601,6 +729,18 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
|
|
601
|
729
|
@Override
|
|
602
|
730
|
public List<BlockedOperatingYearsDistributionDTO> getOperatingYearsDistribution(BlockedDashboardQueryDTO queryDTO) {
|
|
603
|
731
|
List<BlockedOperatingYearsDistributionDTO> resultList = blockedDashboardMapper.selectOperatingYearsDistribution(queryDTO);
|
|
|
732
|
+ if (resultList != null && !resultList.isEmpty()) {
|
|
|
733
|
+ // 计算总数
|
|
|
734
|
+ long totalCount = resultList.stream().mapToLong(item -> item.getCount() != null ? item.getCount() : 0).sum();
|
|
|
735
|
+ // 计算百分比
|
|
|
736
|
+ if (totalCount > 0) {
|
|
|
737
|
+ resultList.forEach(item -> {
|
|
|
738
|
+ long count = item.getCount() != null ? item.getCount() : 0;
|
|
|
739
|
+ double percentage = Math.round(count * 10000.0 / totalCount) / 100.0;
|
|
|
740
|
+ item.setPercentage(java.math.BigDecimal.valueOf(percentage));
|
|
|
741
|
+ });
|
|
|
742
|
+ }
|
|
|
743
|
+ }
|
|
604
|
744
|
return resultList != null ? resultList : Collections.emptyList();
|
|
605
|
745
|
}
|
|
606
|
746
|
|