ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ReportController.java
@@ -24,6 +24,7 @@ import io.swagger.annotations.ApiOperation; import io.swagger.models.auth.In; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -384,6 +385,9 @@ } List<ProjectDeptDetailsVO> res = new ArrayList<>(); List<TTask> tasks = taskCleanerService.list(tTaskLambdaQueryWrapper); if(CollectionUtils.isEmpty(tasks)){ return R.ok(res); } List<TTaskDetail> taskDetails = taskDetailService.lambdaQuery().orderByDesc(BaseModel::getCreateTime).list(); List<String> collect = tasks.stream().map(TTask::getProjectId).distinct().collect(Collectors.toList()); List<TProjectDept> projectDepts = projectDeptService.list(); ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java
@@ -20,6 +20,7 @@ import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -63,7 +64,7 @@ // 每一个小时执行一次 // @Scheduled(cron = "0 0 0 * * ?") @Scheduled(fixedRate = 1500000000) // @Scheduled(fixedRate = 1500000000) public void dayOfCreateInspection() { try { @@ -76,6 +77,17 @@ // 创建任务 createInspection(template); }); // 查询前一天为执行的所有任务,改成已超时状态 List<TTask> taskCleanList = taskCleanService.list(Wrappers.lambdaQuery(TTask.class) .like(TTask::getImplementTime, LocalDate.now().minusDays(1)) .eq(TTask::getStatus, 1)); if (!CollectionUtils.isEmpty(taskCleanList)) { taskCleanList.forEach(task -> { task.setStatus(2); }); taskCleanService.updateBatchById(taskCleanList); } } catch (Exception e) { e.printStackTrace(); @@ -124,9 +136,8 @@ continue; } SysUser sysUser = sysUsers.get(0); int taskCount = 0; for (SysUser sysUser : sysUsers) { List<TProjectDept> projectDeptLists = new ArrayList<>(); if(sysUser.getDeptType() == 1){ TProjectDept projectDept = projectDeptService.getById(sysUser.getDeptId()); @@ -223,7 +234,7 @@ // 抽取保洁员 List<TCleaner> tCleaners = randomSelection(cleaners, dayCleanerCount); if(CollectionUtils.isEmpty(tCleaners)){ log.error("没有可抽取的保洁员"); log.error("没有可抽取的保洁员,模板id为:{}",detail.getId()); continue; } if(tCleaners.size() < dayCleanerCount){ @@ -322,7 +333,9 @@ templateCountService.save(templateCount); taskCleanService.saveBatch(tasks); template.setTaskCount(tasks.size()); taskCount = taskCount + tasks.size(); } template.setTaskCount(taskCount); templateService.updateById(template); templateDetailService.updateById(detail); } ruoyi-system/src/main/resources/mapper/system/TLeaveMapper.xml
@@ -43,9 +43,8 @@ <if test="query.auditStatus != null"> and t1.audit_status = #{query.auditStatus} </if> <if test="query.startTime != null and startTime != ''"> and (t1.start_time between #{startTime} and #{endTime}) and (t1.end_time between #{startTime} and #{endTime}) <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> and (t1.start_time between #{query.startTime} and #{query.endTime}) </if> <if test="query.deptIds != null and query.deptIds.size()>0"> AND t2.deptId IN ruoyi-system/src/main/resources/mapper/system/TTaskMapper.xml
@@ -159,7 +159,7 @@ left join sys_user t2 on t1.user_id = t2.user_id left join t_template t3 on t1.template_id = t3.id where 1=1 and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} and t3.id is not null <if test="query.templateIds != null and query.templateIds.size()>0"> AND t1.template_id IN <foreach collection="query.templateIds" separator="," item="id" open="(" close=")"> @@ -171,6 +171,12 @@ <foreach collection="query.patrolInspectorIds" separator="," item="id" open="(" close=")"> #{id} </foreach> </if> <if test="query.templateName != null and query.templateName != ''"> AND t3.template_name like concat('%',#{query.templateName},'%') </if> <if test="query.nickName != null and query.nickName != ''"> AND t2.nick_name like concat('%',#{query.nickName},'%') </if> group by t1.user_id,t1.template_id @@ -183,7 +189,7 @@ left join sys_user t2 on t1.user_id = t2.user_id left join t_template t3 on t1.template_id = t3.id where 1=1 and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} and t3.id is not null <if test="query.templateIds != null and query.templateIds.size()>0"> AND t1.template_id IN <foreach collection="query.templateIds" separator="," item="id" open="(" close=")"> @@ -196,6 +202,12 @@ #{id} </foreach> </if> <if test="query.templateName != null and query.templateName != ''"> AND t3.template_name like concat('%',#{query.templateName},'%') </if> <if test="query.nickName != null and query.nickName != ''"> AND t2.nick_name like concat('%',#{query.nickName},'%') </if> group by t1.user_id,t1.template_id </select>