diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java index a6c8e53..63f07dd 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java @@ -20,7 +20,9 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.time.LocalDateTime; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; +import java.util.stream.Collectors; @Slf4j @Service @@ -98,7 +100,14 @@ public class HomeServiceImpl implements HomeService{ }); } - homeCountResVO.setCompletionRate(homeGroupCountVOS1); + //排序 + final List sortCollect = homeGroupCountVOS1.stream(). + sorted(Comparator.comparing(HomeListVO::getValue).reversed()). + collect(Collectors.toList()); + + log.info("sortCollect:{}", sortCollect); + + homeCountResVO.setCompletionRate(sortCollect); return homeCountResVO; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml index 8b72d43..28271b1 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml @@ -68,7 +68,6 @@ SUM(CASE WHEN il.status = 2 THEN 1 ELSE 0 END) as finishCount, COUNT(DISTINCT ei.id) as execCount, - COUNT(DISTINCT ei.id) AS totalCount , -- 计算每个 user_id 的总数 round( SUM(CASE WHEN il.status = 2 THEN 1 ELSE 0 END) /COUNT(DISTINCT ei.id) * 100,1) as completionRate FROM enterprise_inspections ei @@ -85,7 +84,7 @@ WHERE ei.deleted = 0 AND e.deleted = 0 and ei.status = 2 - and e.department_id = #{deptId} and su.real_name is not null + and e.department_id = #{deptId} and e.department_id != 100 @@ -97,7 +96,7 @@ e.department_id - + order by finishCount