소스 검색

bug修复

wangxx 1 개월 전
부모
커밋
50d84bbfa1

+ 1 - 1
airport-blocked/src/main/java/com/sundot/airport/blocked/domain/BlockedMissCheckStatistics.java

@@ -173,7 +173,7 @@ public class BlockedMissCheckStatistics extends BaseEntity {
173 173
     private String monthlyAssessment;
174 174
 
175 175
     /** 本月自测有无漏检(0-无,1-有) */
176
-    @Excel(name = "本月自测有无漏检", readConverterExp = "0=无,1=有")
176
+    @Excel(name = "本月自测有无漏检")
177 177
     @ApiModelProperty("本月自测有无漏检 0=无,1=有")
178 178
     private Integer selfTestHasMissCheck;
179 179
 

+ 61 - 17
airport-blocked/src/main/java/com/sundot/airport/blocked/service/impl/BlockedDashboardServiceImpl.java

@@ -334,10 +334,8 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
334 334
     public List<BlockedRankingDTO> getSupervisorRanking(BlockedDashboardQueryDTO queryDTO) {
335 335
         List<BlockedRankingDTO> resultList = blockedDashboardMapper.selectSupervisorRanking(queryDTO);
336 336
         if (CollectionUtil.isNotEmpty(resultList)) {
337
-            // 计算排名
338
-            for (int i = 0; i < resultList.size(); i++) {
339
-                resultList.get(i).setRank(i + 1);
340
-            }
337
+            // 计算并列排名并限制前30条
338
+            return calculateDenseRankingWithLimit(resultList, 30);
341 339
         }
342 340
         return resultList != null ? resultList : Collections.emptyList();
343 341
     }
@@ -352,10 +350,8 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
352 350
     public List<BlockedRankingDTO> getTeamLeaderRanking(BlockedDashboardQueryDTO queryDTO) {
353 351
         List<BlockedRankingDTO> resultList = blockedDashboardMapper.selectTeamLeaderRanking(queryDTO);
354 352
         if (CollectionUtil.isNotEmpty(resultList)) {
355
-            // 计算排名
356
-            for (int i = 0; i < resultList.size(); i++) {
357
-                resultList.get(i).setRank(i + 1);
358
-            }
353
+            // 计算并列排名并限制前30条
354
+            return calculateDenseRankingWithLimit(resultList, 30);
359 355
         }
360 356
         return resultList != null ? resultList : Collections.emptyList();
361 357
     }
@@ -370,10 +366,8 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
370 366
     public List<BlockedRankingDTO> getReviewedUserRanking(BlockedDashboardQueryDTO queryDTO) {
371 367
         List<BlockedRankingDTO> resultList = blockedDashboardMapper.selectReviewedUserRanking(queryDTO);
372 368
         if (CollectionUtil.isNotEmpty(resultList)) {
373
-            // 计算排名
374
-            for (int i = 0; i < resultList.size(); i++) {
375
-                resultList.get(i).setRank(i + 1);
376
-            }
369
+            // 计算并列排名并限制前30条
370
+            return calculateDenseRankingWithLimit(resultList, 30);
377 371
         }
378 372
         return resultList != null ? resultList : Collections.emptyList();
379 373
     }
@@ -521,7 +515,7 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
521 515
         // 3. 批量查询所有部门信息,构建大队ID映射缓存
522 516
         Map<Long, Long> deptToBrigadeMap = buildDeptToBrigadeMap(allDeptIds);
523 517
         
524
-        // 4. 在Java层按大队分组统计
518
+        // 4. 按大队分组统计
525 519
         Map<Long, BlockedCertificateLevelDTO> brigadeMap = new LinkedHashMap<>();
526 520
         
527 521
         for (Map<String, Object> row : rawData) {
@@ -776,6 +770,10 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
776 770
     @Override
777 771
     public List<BlockedRankingDTO> getBrigadeSupervisorRanking(BlockedDashboardQueryDTO queryDTO) {
778 772
         List<BlockedRankingDTO> resultList = blockedDashboardMapper.selectBrigadeSupervisorRanking(queryDTO);
773
+        if (CollectionUtil.isNotEmpty(resultList)) {
774
+            // 计算并列排名并限制前10条
775
+            return calculateDenseRankingWithLimit(resultList, 10);
776
+        }
779 777
         return resultList != null ? resultList : Collections.emptyList();
780 778
     }
781 779
 
@@ -785,14 +783,18 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
785 783
      * 数据筛选:分管班组长不为空
786 784
      * 排行字段:分管班组长
787 785
      * 排行依据:统计记录总数
788
-     * 显示行数:显示前10
786
+     * 显示行数:显示前10条(并列排名)
789 787
      * 
790 788
      * @param queryDTO 查询参数
791
-     * @return 班组排行榜列表(前10
789
+     * @return 班组排行榜列表(前10
792 790
      */
793 791
     @Override
794 792
     public List<BlockedRankingDTO> getBrigadeTeamLeaderRanking(BlockedDashboardQueryDTO queryDTO) {
795 793
         List<BlockedRankingDTO> resultList = blockedDashboardMapper.selectBrigadeTeamLeaderRanking(queryDTO);
794
+        if (CollectionUtil.isNotEmpty(resultList)) {
795
+            // 计算并列排名并限制前10条
796
+            return calculateDenseRankingWithLimit(resultList, 10);
797
+        }
796 798
         return resultList != null ? resultList : Collections.emptyList();
797 799
     }
798 800
 
@@ -802,14 +804,18 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
802 804
      * 数据筛选:被回查人不为空
803 805
      * 排行字段:被回查人
804 806
      * 排行依据:统计记录总数
805
-     * 显示行数:显示前10
807
+     * 显示行数:显示前10条(并列排名)
806 808
      * 
807 809
      * @param queryDTO 查询参数
808
-     * @return 人员排行榜列表(前10
810
+     * @return 人员排行榜列表(前10
809 811
      */
810 812
     @Override
811 813
     public List<BlockedRankingDTO> getBrigadeReviewedUserRanking(BlockedDashboardQueryDTO queryDTO) {
812 814
         List<BlockedRankingDTO> resultList = blockedDashboardMapper.selectBrigadeReviewedUserRanking(queryDTO);
815
+        if (CollectionUtil.isNotEmpty(resultList)) {
816
+            // 计算并列排名并限制前10条
817
+            return calculateDenseRankingWithLimit(resultList, 10);
818
+        }
813 819
         return resultList != null ? resultList : Collections.emptyList();
814 820
     }
815 821
 
@@ -997,4 +1003,42 @@ public class BlockedDashboardServiceImpl implements IBlockedDashboardService {
997 1003
                 return levelCode;
998 1004
         }
999 1005
     }
1006
+
1007
+    /**
1008
+     * 计算并列排名并限制前N条
1009
+     * 并列排名规则:相同totalCount的记录排名相同,下一个不同值的排名紧接其后
1010
+     * 限制规则:只返回排名序号 <= maxRank 的记录
1011
+     *
1012
+     * @param resultList 排行榜数据列表(已按totalCount降序排序)
1013
+     * @param maxRank 最大排名序号(站级30,大队10)
1014
+     * @return 过滤后的排行榜列表
1015
+     */
1016
+    private List<BlockedRankingDTO> calculateDenseRankingWithLimit(List<BlockedRankingDTO> resultList, int maxRank) {
1017
+        if (resultList == null || resultList.isEmpty()) {
1018
+            return resultList;
1019
+        }
1020
+
1021
+        List<BlockedRankingDTO> result = new ArrayList<>();
1022
+        int currentRank = 1;  // 当前排名
1023
+        Integer previousCount = null;  // 上一个记录的totalCount
1024
+
1025
+        for (BlockedRankingDTO item : resultList) {
1026
+            Integer currentCount = item.getTotalCount();
1027
+            
1028
+            // 如果totalCount与上一个不同,更新排名
1029
+            if (previousCount == null || !currentCount.equals(previousCount)) {
1030
+                // 如果当前排名已经超过限制,停止添加
1031
+                if (currentRank > maxRank) {
1032
+                    break;
1033
+                }
1034
+                previousCount = currentCount;
1035
+            }
1036
+            
1037
+            // 设置排名并添加到结果列表
1038
+            item.setRank(currentRank);
1039
+            result.add(item);
1040
+        }
1041
+
1042
+        return result;
1043
+    }
1000 1044
 }

+ 1 - 3
airport-blocked/src/main/java/com/sundot/airport/blocked/service/impl/BlockedMissCheckStatisticsServiceImpl.java

@@ -158,7 +158,6 @@ public class BlockedMissCheckStatisticsServiceImpl implements IBlockedMissCheckS
158 158
                     data.setCreateTime(DateUtils.getNowDate());
159 159
                     blockedMissCheckStatisticsMapper.insertBlockedMissCheckStatistics(data);
160 160
                     successNum++;
161
-                    successMsg.append("<br/>" + successNum + "、被回查人【" + data.getReviewedUserName() + "】、回查日期【" + data.getReviewDate() + "】、漏检时间【" + data.getMissCheckTime() + "】导入成功");
162 161
                 } else if (isUpdateSupport) {
163 162
                     // 更新
164 163
                     BlockedMissCheckStatistics old = existingList.get(0);
@@ -167,7 +166,6 @@ public class BlockedMissCheckStatisticsServiceImpl implements IBlockedMissCheckS
167 166
                     data.setUpdateTime(DateUtils.getNowDate());
168 167
                     blockedMissCheckStatisticsMapper.updateBlockedMissCheckStatistics(data);
169 168
                     successNum++;
170
-                    successMsg.append("<br/>" + successNum + "、被回查人【" + data.getReviewedUserName() + "】、回查日期【" + data.getReviewDate() + "】、漏检时间【" + data.getMissCheckTime() + "】更新成功");
171 169
                 } else {
172 170
                     failureNum++;
173 171
                     failureMsg.append("<br/>" + failureNum + "、被回查人【" + data.getReviewedUserName() + "】、回查日期【" + data.getReviewDate() + "】、漏检时间【" + data.getMissCheckTime() + "】已存在");
@@ -183,7 +181,7 @@ public class BlockedMissCheckStatisticsServiceImpl implements IBlockedMissCheckS
183 181
             failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
184 182
             throw new ServiceException(failureMsg.toString());
185 183
         } else {
186
-            successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
184
+            successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条");
187 185
         }
188 186
         return successMsg.toString();
189 187
     }

+ 1 - 5
airport-blocked/src/main/resources/mapper/blocked/BlockedDashboardMapper.xml

@@ -539,7 +539,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
539 539
             COUNT(1) as count
540 540
         FROM blocked_miss_check_statistics
541 541
         WHERE del_flag = '0'
542
-        AND area_id IS NOT NULL
543 542
         AND miss_check_reason_category IS NOT NULL
544 543
         AND miss_check_reason_category != ''
545 544
         <if test="startTime != null and endTime != null">
@@ -633,7 +632,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
633 632
     </select>
634 633
 
635 634
     <!-- 查询大队开机人员证书分布(用于柱状图) -->
636
-    <!-- 查询大队证书等级分布(按大队) - 返回用户和部门信息,由Java层处理 -->
635
+    <!-- 查询大队证书等级分布(按大队)  -->
637 636
     <select id="selectBrigadeCertificateDistribution" resultType="java.util.HashMap">
638 637
         SELECT 
639 638
             u.user_id,
@@ -646,9 +645,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
646 645
         AND u.status = '0'
647 646
         AND u.qualification_level IS NOT NULL
648 647
         AND u.qualification_level != ''
649
-        <if test="terminalId != null">
650
-            AND d.terminal_id = #{terminalId}
651
-        </if>
652 648
     </select>
653 649
 
654 650
     <!-- 查询两楼每日查堵走势(按大队) -->