|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.hnac.hzinfo.inspect.task.service.impl; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.google.common.collect.Lists; |
|
|
|
|
import com.hnac.hzims.common.utils.Condition; |
|
|
|
|
import com.hnac.hzims.safeproduct.Constants; |
|
|
|
|
import com.hnac.hzims.safeproduct.entity.ImsMonCameraInfoEntity; |
|
|
|
|
import com.hnac.hzims.safeproduct.feign.IImsMonCameraInfoClient; |
|
|
|
@ -22,6 +24,7 @@ import com.hnac.hzinfo.inspect.plan.vo.RoutObject;
|
|
|
|
|
import com.hnac.hzinfo.inspect.task.TaskContants; |
|
|
|
|
import com.hnac.hzinfo.inspect.task.TaskContants.ClaimStatusEnum; |
|
|
|
|
import com.hnac.hzinfo.inspect.task.TaskContants.TaskStatusEnum; |
|
|
|
|
import com.hnac.hzinfo.inspect.task.dto.TaskDTO; |
|
|
|
|
import com.hnac.hzinfo.inspect.task.entity.*; |
|
|
|
|
import com.hnac.hzinfo.inspect.task.mapper.TaskMapper; |
|
|
|
|
import com.hnac.hzinfo.inspect.task.mapper.TaskNoUserDataScopeMapper; |
|
|
|
@ -34,6 +37,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.mp.support.BladePage; |
|
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tenant.mp.TenantEntity; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
@ -517,6 +521,41 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<TaskVo> page(TaskDTO taskDTO, Query query) { |
|
|
|
|
TaskEntity request = BeanUtil.copy(taskDTO,TaskEntity.class); |
|
|
|
|
LambdaQueryWrapper<TaskEntity> queryWrapper = Condition.getQueryWrapper(TaskEntity.class,request); |
|
|
|
|
queryWrapper.ge(Func.isNotEmpty(taskDTO.getPlanStartTime()),TaskEntity::getPlanStartTime,taskDTO.getPlanStartTime()); |
|
|
|
|
queryWrapper.le(Func.isNotEmpty(taskDTO.getPlanStartTimeEnd()),TaskEntity::getPlanStartTime,taskDTO.getPlanStartTimeEnd()); |
|
|
|
|
queryWrapper.eq(Func.isNotEmpty(taskDTO.getCreateDept()),TaskEntity::getCreateDept,taskDTO.getCreateDept()); |
|
|
|
|
queryWrapper.eq(Func.isNotEmpty(taskDTO.getStatus()),TaskEntity::getStatus,taskDTO.getStatus()); |
|
|
|
|
queryWrapper.orderByDesc(TaskEntity::getCreateTime); |
|
|
|
|
IPage page = this.page(Condition.getPage(query), queryWrapper); |
|
|
|
|
List<TaskEntity> records = page.getRecords(); |
|
|
|
|
List<TaskVo> taskVos = records.stream().map(task -> { |
|
|
|
|
TaskVo taskVo = BeanUtil.copy(task, TaskVo.class); |
|
|
|
|
// 补充巡检任务人员
|
|
|
|
|
List<TaskUserEntity> taskUserList = taskUserService.list(Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId, task.getId())); |
|
|
|
|
String userIds = taskUserList.stream().filter(Func::isNotEmpty).map(TaskUserEntity::getUserId) |
|
|
|
|
.filter(Func::isNotEmpty).map(String::valueOf).collect(Collectors.joining(",")); |
|
|
|
|
// 获取巡检任务人员名称
|
|
|
|
|
String userNames = taskUserList.stream().filter(Func::isNotEmpty).map(TaskUserEntity::getUserId).filter(Func::isNotEmpty) |
|
|
|
|
.map(UserCache::getUser).map(user -> Optional.ofNullable(user).map(User::getName).orElse("")) |
|
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
|
taskVo.setUserIds(userIds); |
|
|
|
|
taskVo.setUserNames(userNames); |
|
|
|
|
// 获取机器人信息
|
|
|
|
|
if (taskVo.getAutoVideo().equals(PlanContants.InspectTypeEnum.ROBOT.getVal()) && taskUserList.size() == 1) { |
|
|
|
|
if (Func.isNotEmpty(taskUserList.get(0))) { |
|
|
|
|
taskVo.setRobot(robotService.getDetailByUserId(taskUserList.get(0).getUserId())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return taskVo; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
page.setRecords(taskVos); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<TaskVo> getListPage(IPage<TaskVo> page, TaskListQuery task) { |
|
|
|
|
List<TaskVo> re = this.baseMapper.getListPage(page, task); |
|
|
|
|
setVoInfo(re); |
|
|
|
|