From 8da7ec1961686057e24af9b98dc0d4753e4f9918 Mon Sep 17 00:00:00 2001 From: dx <1242347652@qq.com> Date: Wed, 26 Feb 2025 08:58:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/system/service/home/HomeServiceImpl.java | 11 ++++++++++- .../main/resources/mapper/taskinfo/TaskInfoMapper.xml | 5 ++--- 2 files changed, 12 insertions(+), 4 deletions(-) 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<HomeListVO> 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 @@ </if> 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 <if test="deptId != null and deptId != ''"> - and e.department_id = #{deptId} and su.real_name is not null + and e.department_id = #{deptId} </if> <if test="deptId == null"> and e.department_id != 100 @@ -97,7 +96,7 @@ <if test="deptId == null"> e.department_id </if> - + order by finishCount </select> <select id="selectEnterpriseNum" resultType="cn.iocoder.yudao.module.system.controller.admin.home.vo.EnterpriseNumVO"> select