Browse Source

小程序任务查询

master
DX 2 months ago
parent
commit
f28803233c
  1. 9
      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/enterpriseinspections/vo/EnterpriseInspectionsPageReqVO.java
  3. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java
  4. 33
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java
  5. 11
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java

9
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java

@ -79,6 +79,15 @@ public class EnterpriseInspectionsController {
return success(BeanUtils.toBean(enterpriseInspections, EnterpriseInspectionsRespVO.class)); return success(BeanUtils.toBean(enterpriseInspections, EnterpriseInspectionsRespVO.class));
} }
@GetMapping("/getEnterpriseInspectionsByTaskId")
@Operation(summary = "根据任务id查询自己偶发")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')")
public CommonResult<EnterpriseInspectionsRespVO> getEnterpriseInspectionsByTaskId(@RequestParam("id") Long id) {
EnterpriseInspectionsDO enterpriseInspections = enterpriseInspectionsService.getEnterpriseInspections(id);
return success(BeanUtils.toBean(enterpriseInspections, EnterpriseInspectionsRespVO.class));
}
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得企业检查记录表,用于记录与企业相关的环保检查信息。分页") @Operation(summary = "获得企业检查记录表,用于记录与企业相关的环保检查信息。分页")
@PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')") @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/enterpriseinspections/vo/EnterpriseInspectionsPageReqVO.java

@ -40,4 +40,10 @@ public class EnterpriseInspectionsPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime; private LocalDateTime[] createTime;
@Schema(description = "任务状态", example = "1")
private Integer inspectionsStatus;
@Schema(description = "按部门")
private Long departmentId;
} }

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java

@ -53,7 +53,8 @@ public interface TaskInfoMapper extends BaseMapperX<TaskInfoDO> {
.eqIfPresent(TaskInfoDO::getTaskStep, reqVO.getTaskStep()) .eqIfPresent(TaskInfoDO::getTaskStep, reqVO.getTaskStep())
.eqIfPresent(TaskInfoDO::getTaskTotal, reqVO.getTaskTotal()) .eqIfPresent(TaskInfoDO::getTaskTotal, reqVO.getTaskTotal())
.inIfPresent(TaskInfoDO::getId, reqVO.getTagList()) .inIfPresent(TaskInfoDO::getId, reqVO.getTagList())
.orderByDesc(TaskInfoDO::getId)); .gtIfPresent(TaskInfoDO::getStatus, 1)
.orderByAsc(TaskInfoDO::getStatus));
} }

33
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java

@ -148,6 +148,9 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
@Override @Override
public PageResult<EnterpriseInspectionsDO> getEnterpriseInspectionsPage(EnterpriseInspectionsPageReqVO pageReqVO) { public PageResult<EnterpriseInspectionsDO> getEnterpriseInspectionsPage(EnterpriseInspectionsPageReqVO pageReqVO) {
// final Long userId = getLoginUserId();
//根据企业名称查询
if (pageReqVO.getEnterpriseName() != null) { if (pageReqVO.getEnterpriseName() != null) {
LambdaQueryWrapper<EnterpriseDO> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<EnterpriseDO> wrapper = new LambdaQueryWrapper<>();
wrapper.like(EnterpriseDO::getEnterprisesName, pageReqVO.getEnterpriseName()); wrapper.like(EnterpriseDO::getEnterprisesName, pageReqVO.getEnterpriseName());
@ -158,6 +161,7 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
} }
} }
//根据任务名称查询
if (pageReqVO.getTaskName() != null) { if (pageReqVO.getTaskName() != null) {
LambdaQueryWrapper<TaskInfoDO> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TaskInfoDO> wrapper = new LambdaQueryWrapper<>();
wrapper.like(TaskInfoDO::getTitle, pageReqVO.getTaskName()); wrapper.like(TaskInfoDO::getTitle, pageReqVO.getTaskName());
@ -202,19 +206,15 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
throw exception(ENTERPRISE_NOT_EXISTS); throw exception(ENTERPRISE_NOT_EXISTS);
} }
item.setEnterpriseName(enterpriseDO.getEnterprisesName()); item.setEnterpriseName(enterpriseDO.getEnterprisesName());
//查询执行的最新一条记录
//查询检查记录 final InspectionsLogDO inspectionsLogNew = this.getInspectionsLogNew(item.getId());
QueryWrapper<InspectionsLogDO> inspectionsLogWrapper = new QueryWrapper<>(); if (inspectionsLogNew != null) {
inspectionsLogWrapper.eq("inspections_id", item.getId()); item.setInspectionStatus(inspectionsLogNew.getStatus());
inspectionsLogWrapper.orderByDesc("create_time"); item.setInspectName(inspectionsLogNew.getInspectName());
final List<InspectionsLogDO> inspectionsLogDOS = inspectionsLogMapper.selectList(inspectionsLogWrapper); item.setCooperateWithName(inspectionsLogNew.getCooperateWithName());
if (inspectionsLogDOS != null && inspectionsLogDOS.size() > 0) { item.setExecTime(inspectionsLogNew.getCreateTime());
item.setInspectionStatus(inspectionsLogDOS.get(0).getStatus());
item.setInspectName(inspectionsLogDOS.get(0).getInspectName());
item.setCooperateWithName(inspectionsLogDOS.get(0).getCooperateWithName());
item.setExecTime(inspectionsLogDOS.get(0).getCreateTime());
//根据执法人员id 查询其所属部门 //根据执法人员id 查询其所属部门
final Long userId = Long.valueOf(inspectionsLogDOS.get(0).getCreator()); final Long userId = Long.valueOf(inspectionsLogNew.getCreator());
final AdminUserDO user = adminUserService.getUser(userId); final AdminUserDO user = adminUserService.getUser(userId);
if (user == null) { if (user == null) {
@ -228,7 +228,7 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
//根据执法人员id 查询其所属部门 //根据执法人员id 查询其所属部门
final Long userId = Long.valueOf(item.getUserId()); final Long userId = Long.valueOf(item.getUserId());
final AdminUserDO user = adminUserService.getUser(userId); final AdminUserDO user = adminUserService.getUser(userId);
item.setInspectionStatus(1);
item.setInspectName(user.getRealName()); item.setInspectName(user.getRealName());
if (user == null) { if (user == null) {
@ -238,6 +238,13 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
}); });
} }
if (pageReqVO.getInspectionsStatus() != null) {
final List<EnterpriseInspectionsDO> collect = enterpriseInspectionsDOPageResult.getList().stream().filter(item -> item.getInspectionStatus() == pageReqVO.getInspectionsStatus()).collect(Collectors.toList());
enterpriseInspectionsDOPageResult.setList(collect);
enterpriseInspectionsDOPageResult.setTotal(Long.valueOf(collect.size()));
}
return enterpriseInspectionsDOPageResult; return enterpriseInspectionsDOPageResult;
} }

11
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java

@ -14,6 +14,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper;
import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper; 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -45,6 +46,7 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
*/ */
@Service @Service
@Validated @Validated
@Slf4j
public class TaskInfoServiceImpl implements TaskInfoService { public class TaskInfoServiceImpl implements TaskInfoService {
@Resource @Resource
@ -94,7 +96,11 @@ public class TaskInfoServiceImpl implements TaskInfoService {
EnterpriseInspectionsDO inspection = new EnterpriseInspectionsDO(); EnterpriseInspectionsDO inspection = new EnterpriseInspectionsDO();
inspection.setTaskId(taskInfo.getId()); inspection.setTaskId(taskInfo.getId());
inspection.setEnterpriseId(item); inspection.setEnterpriseId(item);
inspection.setCreator(enterpriseDO.getUserId().toString());
if (enterpriseDO.getUserId() != null) {
inspection.setCreator(enterpriseDO.getUserId().toString());
}
list.add(inspection); list.add(inspection);
}); });
@ -186,9 +192,10 @@ public class TaskInfoServiceImpl implements TaskInfoService {
//按标签查询 //按标签查询
if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) { if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) {
log.info("pageReqVO.getTagList():{}", pageReqVO.getTagList());
LambdaQueryWrapper<TaskTagDO> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TaskTagDO> wrapper = new LambdaQueryWrapper<>();
wrapper.in(TaskTagDO::getTaskId, pageReqVO.getTagList()); wrapper.in(TaskTagDO::getTaskId, pageReqVO.getTagList());
final List<TaskTagDO> taskTagDOS = taskTagMapper.selectList(); final List<TaskTagDO> taskTagDOS = taskTagMapper.selectList(wrapper);
if (taskTagDOS != null && taskTagDOS.size() > 0) { if (taskTagDOS != null && taskTagDOS.size() > 0) {
pageReqVO.setTagList(taskTagDOS.stream().map(TaskTagDO::getTagId).collect(Collectors.toList())); pageReqVO.setTagList(taskTagDOS.stream().map(TaskTagDO::getTagId).collect(Collectors.toList()));
} }

Loading…
Cancel
Save