Browse Source

小程序任务查询

master
DX 2 months ago
parent
commit
a4e18b214b
  1. 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java
  2. 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java
  3. 8
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java
  4. 20
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java
  5. 37
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java

1
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')")

6
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<PageResult<TaskInfoRespVO>> appPage(@Valid TaskInfoPageReqVO pageReqVO) {
PageResult<TaskInfoDO> 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));
}

8
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<Long> enterpriseInspectionsIdes;
/*
小程序查询用
*/
@Schema(description = "任务标签集合", example = "1")
private List<Long> tagList;
@Schema(description = "按时间查询", example = "1")
private Integer selectWeek;
}

20
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<TaskInfoDO> {
.orderByDesc(TaskInfoDO::getId));
}
default PageResult<TaskInfoDO> selectAppPage(TaskInfoPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<TaskInfoDO>()
.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));
}

37
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<TaskInfoDO> getTaskInfoAppPage(TaskInfoPageReqVO pageReqVO) {
final PageResult<TaskInfoDO> taskInfoDOPageResult = taskInfoMapper.selectPage(pageReqVO);
//按标签查询
if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) {
LambdaQueryWrapper<TaskTagDO> wrapper = new LambdaQueryWrapper<>();
wrapper.in(TaskTagDO::getTaskId, pageReqVO.getTagList());
final List<TaskTagDO> 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<TaskInfoDO> taskInfoDOPageResult = taskInfoMapper.selectAppPage(pageReqVO);
if (taskInfoDOPageResult.getList() != null && taskInfoDOPageResult.getList().size() > 0) {
taskInfoDOPageResult.getList().forEach(item->{
QueryWrapper<EnterpriseInspectionsDO> wrapper = new QueryWrapper<>();

Loading…
Cancel
Save