From a4e18b214b80ec7888a9c53e2ef291494dd21078 Mon Sep 17 00:00:00 2001 From: dx <1242347652@qq.com> Date: Tue, 11 Feb 2025 11:20:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnterpriseInspectionsController.java | 1 + .../admin/taskinfo/TaskInfoController.java | 6 --- .../admin/taskinfo/vo/TaskInfoPageReqVO.java | 8 ++++ .../dal/mysql/taskinfo/TaskInfoMapper.java | 20 ++++++++++ .../service/taskinfo/TaskInfoServiceImpl.java | 37 ++++++++++++++++++- 5 files changed, 65 insertions(+), 7 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java index 41c264c..cee971e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java @@ -97,6 +97,7 @@ public class EnterpriseInspectionsController { return success(BeanUtils.toBean(pageResult, EnterpriseInspectionsRespVO.class)); } + @GetMapping("/pcpage") @Operation(summary = "PC端获得企业检查记录表,用于记录与企业相关的环保检查信息。分页") @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java index 3c7b669..8620807 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java @@ -178,12 +178,6 @@ public class TaskInfoController { @PreAuthorize("@ss.hasPermission('system:task-info:query')") public CommonResult> appPage(@Valid TaskInfoPageReqVO pageReqVO) { PageResult pageResult = taskInfoService.getTaskInfoAppPage(pageReqVO); -// AdminUserDO user = adminUserService.getUser(SecurityFrameworkUtils.getLoginUserId()); -// DeptDO dep= deptService.getDept( user.getDeptId()); -// pageResult.getList().forEach(item->{ -// item.setPublishDep(dep.getName()); -// item.setCreateName(adminUserService.getUser(Long.valueOf(item.getCreator())).getRealName()); -// }); return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java index 75f3efa..458f8bc 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java @@ -68,6 +68,14 @@ public class TaskInfoPageReqVO extends PageParam { @Schema(description = "企业集合", example = "1") private List enterpriseInspectionsIdes; + /* + 小程序查询用 + */ + @Schema(description = "任务标签集合", example = "1") + private List tagList; + + @Schema(description = "按时间查询", example = "1") + private Integer selectWeek; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java index 0c8a4ce..6cfda08 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java @@ -36,6 +36,26 @@ public interface TaskInfoMapper extends BaseMapperX { .orderByDesc(TaskInfoDO::getId)); } + default PageResult selectAppPage(TaskInfoPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(TaskInfoDO::getTitle, reqVO.getTitle()) + .eqIfPresent(TaskInfoDO::getTaskNumber, reqVO.getTaskNumber()) + .eqIfPresent(TaskInfoDO::getDescription, reqVO.getDescription()) + .eqIfPresent(TaskInfoDO::getExecCycle, reqVO.getExecCycle()) + .eqIfPresent(TaskInfoDO::getTaskType, reqVO.getTaskType()) + .eqIfPresent(TaskInfoDO::getPriority, reqVO.getPriority()) + .eqIfPresent(TaskInfoDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(TaskInfoDO::getStartDate, reqVO.getStartDate()) + .betweenIfPresent(TaskInfoDO::getEndDate, reqVO.getEndDate()) + .betweenIfPresent(TaskInfoDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(TaskInfoDO::getParentId, reqVO.getParentId()) + .eqIfPresent(TaskInfoDO::getParentType, reqVO.getParentType()) + .eqIfPresent(TaskInfoDO::getTaskStep, reqVO.getTaskStep()) + .eqIfPresent(TaskInfoDO::getTaskTotal, reqVO.getTaskTotal()) + .inIfPresent(TaskInfoDO::getId, reqVO.getTagList()) + .orderByDesc(TaskInfoDO::getId)); + } + diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java index d8ef08d..46f1175 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java @@ -12,12 +12,14 @@ import cn.iocoder.yudao.module.system.dal.mysql.enterprise.EnterpriseMapper; import cn.iocoder.yudao.module.system.dal.mysql.enterpriseinspections.EnterpriseInspectionsMapper; import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper; import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -182,7 +184,40 @@ public class TaskInfoServiceImpl implements TaskInfoService { @Override public PageResult getTaskInfoAppPage(TaskInfoPageReqVO pageReqVO) { - final PageResult taskInfoDOPageResult = taskInfoMapper.selectPage(pageReqVO); + //按标签查询 + if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(TaskTagDO::getTaskId, pageReqVO.getTagList()); + final List taskTagDOS = taskTagMapper.selectList(); + if (taskTagDOS != null && taskTagDOS.size() > 0) { + pageReqVO.setTagList(taskTagDOS.stream().map(TaskTagDO::getTagId).collect(Collectors.toList())); + } + } + + //按时间查询 + if (pageReqVO.getSelectWeek() != null) { + LocalDateTime now = LocalDateTime.now(); + LocalDateTime[] dateList = new LocalDateTime[2]; + + switch (pageReqVO.getSelectWeek()) { + case 1: + dateList[0] = now.minusDays(3); // 三天前 + break; + case 2: + dateList[0] = now.minusWeeks(1); // 一周前 + break; + case 3: + dateList[0] = now.minusMonths(1); // 一月前 + break; + case 4: + dateList[0] = now.minusYears(1); // 一年前 + break; + } + dateList[1] = now; + pageReqVO.setEndDate(dateList); + } + + final PageResult taskInfoDOPageResult = taskInfoMapper.selectAppPage(pageReqVO); if (taskInfoDOPageResult.getList() != null && taskInfoDOPageResult.getList().size() > 0) { taskInfoDOPageResult.getList().forEach(item->{ QueryWrapper wrapper = new QueryWrapper<>();