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));
}
@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")
@Operation(summary = "获得企业检查记录表,用于记录与企业相关的环保检查信息。分页")
@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)
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::getTaskTotal, reqVO.getTaskTotal())
.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
public PageResult<EnterpriseInspectionsDO> getEnterpriseInspectionsPage(EnterpriseInspectionsPageReqVO pageReqVO) {
// final Long userId = getLoginUserId();
//根据企业名称查询
if (pageReqVO.getEnterpriseName() != null) {
LambdaQueryWrapper<EnterpriseDO> wrapper = new LambdaQueryWrapper<>();
wrapper.like(EnterpriseDO::getEnterprisesName, pageReqVO.getEnterpriseName());
@ -158,6 +161,7 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
}
}
//根据任务名称查询
if (pageReqVO.getTaskName() != null) {
LambdaQueryWrapper<TaskInfoDO> wrapper = new LambdaQueryWrapper<>();
wrapper.like(TaskInfoDO::getTitle, pageReqVO.getTaskName());
@ -202,19 +206,15 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
throw exception(ENTERPRISE_NOT_EXISTS);
}
item.setEnterpriseName(enterpriseDO.getEnterprisesName());
//查询检查记录
QueryWrapper<InspectionsLogDO> inspectionsLogWrapper = new QueryWrapper<>();
inspectionsLogWrapper.eq("inspections_id", item.getId());
inspectionsLogWrapper.orderByDesc("create_time");
final List<InspectionsLogDO> inspectionsLogDOS = inspectionsLogMapper.selectList(inspectionsLogWrapper);
if (inspectionsLogDOS != null && inspectionsLogDOS.size() > 0) {
item.setInspectionStatus(inspectionsLogDOS.get(0).getStatus());
item.setInspectName(inspectionsLogDOS.get(0).getInspectName());
item.setCooperateWithName(inspectionsLogDOS.get(0).getCooperateWithName());
item.setExecTime(inspectionsLogDOS.get(0).getCreateTime());
//查询执行的最新一条记录
final InspectionsLogDO inspectionsLogNew = this.getInspectionsLogNew(item.getId());
if (inspectionsLogNew != null) {
item.setInspectionStatus(inspectionsLogNew.getStatus());
item.setInspectName(inspectionsLogNew.getInspectName());
item.setCooperateWithName(inspectionsLogNew.getCooperateWithName());
item.setExecTime(inspectionsLogNew.getCreateTime());
//根据执法人员id 查询其所属部门
final Long userId = Long.valueOf(inspectionsLogDOS.get(0).getCreator());
final Long userId = Long.valueOf(inspectionsLogNew.getCreator());
final AdminUserDO user = adminUserService.getUser(userId);
if (user == null) {
@ -228,7 +228,7 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
//根据执法人员id 查询其所属部门
final Long userId = Long.valueOf(item.getUserId());
final AdminUserDO user = adminUserService.getUser(userId);
item.setInspectionStatus(1);
item.setInspectName(user.getRealName());
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;
}

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

Loading…
Cancel
Save