Browse Source

任务统计

master
DX 1 month ago
parent
commit
8da7ec1961
  1. 11
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java
  2. 5
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml

11
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;
}

5
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

Loading…
Cancel
Save