09-24-巡检任务更新用户类型,实验任务处理节点进度及回显信息
This commit is contained in:
@ -69,10 +69,9 @@ public class OpsInspectionTask extends BaseEntity {
|
|||||||
private Long personId;
|
private Long personId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 进度
|
* 节点ids
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
private String nodeIds;
|
||||||
private BigDecimal taskProgress;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 1待执行2已延期3执行中4已完成
|
* 状态 1待执行2已延期3执行中4已完成
|
||||||
|
|||||||
@ -74,12 +74,10 @@ public class OpsInspectionTaskBo extends BaseEntity {
|
|||||||
@NotNull(message = "执行人ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotNull(message = "执行人ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
private Long personId;
|
private Long personId;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 进度
|
* 节点ids
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
private String nodeIds;
|
||||||
private BigDecimal taskProgress;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 1待执行2已延期3执行中4已完成
|
* 状态 1待执行2已延期3执行中4已完成
|
||||||
|
|||||||
@ -13,11 +13,12 @@ import org.dromara.common.excel.convert.ExcelDictConvert;
|
|||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||||
|
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,13 +87,20 @@ public class OpsInspectionTaskVo implements Serializable {
|
|||||||
@ExcelProperty(value = "执行人ID")
|
@ExcelProperty(value = "执行人ID")
|
||||||
private Long personId;
|
private Long personId;
|
||||||
|
|
||||||
private OpsUserVo person;
|
private RemoteUserVo person;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 进度
|
* 进度
|
||||||
*/
|
*/
|
||||||
private BigDecimal taskProgress;
|
private BigDecimal taskProgress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点ids
|
||||||
|
*/
|
||||||
|
private String nodeIds;
|
||||||
|
|
||||||
|
private List<OpsInspectionNodeVo> nodes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 1待执行2已延期3执行中4已完成
|
* 状态 1待执行2已延期3执行中4已完成
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.inspection.service.impl;
|
package org.dromara.inspection.service.impl;
|
||||||
|
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
@ -10,10 +11,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.inspection.domain.OpsInspectionNode;
|
||||||
|
import org.dromara.inspection.domain.vo.OpsInspectionNodeVo;
|
||||||
import org.dromara.inspection.domain.vo.OpsInspectionPlanVo;
|
import org.dromara.inspection.domain.vo.OpsInspectionPlanVo;
|
||||||
import org.dromara.inspection.domain.vo.OpsInspectionRecordVo;
|
import org.dromara.inspection.domain.vo.OpsInspectionRecordVo;
|
||||||
|
import org.dromara.inspection.mapper.OpsInspectionNodeMapper;
|
||||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||||
import org.dromara.personnel.service.impl.OpsUserServiceImpl;
|
import org.dromara.personnel.service.impl.OpsUserServiceImpl;
|
||||||
|
import org.dromara.system.api.RemoteUserService;
|
||||||
|
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.dromara.inspection.domain.bo.OpsInspectionTaskBo;
|
import org.dromara.inspection.domain.bo.OpsInspectionTaskBo;
|
||||||
@ -28,10 +34,7 @@ import java.time.LocalDate;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -47,10 +50,12 @@ import java.util.stream.Collectors;
|
|||||||
public class OpsInspectionTaskServiceImpl implements IOpsInspectionTaskService {
|
public class OpsInspectionTaskServiceImpl implements IOpsInspectionTaskService {
|
||||||
|
|
||||||
private final OpsInspectionTaskMapper baseMapper;
|
private final OpsInspectionTaskMapper baseMapper;
|
||||||
|
private final OpsInspectionNodeMapper nodeMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OpsInspectionPlanServiceImpl opsInspectionPlanService;
|
private OpsInspectionPlanServiceImpl opsInspectionPlanService;
|
||||||
@Autowired
|
@DubboReference
|
||||||
private OpsUserServiceImpl opsUserService;
|
private RemoteUserService userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询运维-巡检计划-任务
|
* 查询运维-巡检计划-任务
|
||||||
@ -282,18 +287,57 @@ public class OpsInspectionTaskServiceImpl implements IOpsInspectionTaskService {
|
|||||||
private void buildEcho(List<OpsInspectionTaskVo> taskVos) {
|
private void buildEcho(List<OpsInspectionTaskVo> taskVos) {
|
||||||
//TODO 回显信息
|
//TODO 回显信息
|
||||||
taskVos.forEach(taskVo -> {
|
taskVos.forEach(taskVo -> {
|
||||||
|
LambdaQueryWrapper<OpsInspectionNode> nodeWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
if (taskVo.getPlanId()!=null) {
|
if (taskVo.getPlanId()!=null) {
|
||||||
OpsInspectionPlanVo opsInspectionPlanVo = opsInspectionPlanService.queryById(taskVo.getPlanId());
|
OpsInspectionPlanVo opsInspectionPlanVo = opsInspectionPlanService.queryById(taskVo.getPlanId());
|
||||||
if (opsInspectionPlanVo != null) {
|
if (opsInspectionPlanVo != null) {
|
||||||
taskVo.setPlan(opsInspectionPlanVo);
|
taskVo.setPlan(opsInspectionPlanVo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taskVo.getPersonId()!=null) {
|
if (taskVo.getPersonId()!=null) {
|
||||||
OpsUserVo opsUserVo = opsUserService.queryById(taskVo.getPersonId());
|
List<RemoteUserVo> remoteUserVos = userService.selectListByIds(List.of(taskVo.getPersonId()));
|
||||||
if (opsUserVo != null) {
|
if (remoteUserVos != null && !remoteUserVos.isEmpty()) {
|
||||||
taskVo.setPerson(opsUserVo);
|
taskVo.setPerson(remoteUserVos.getFirst());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//处理进度和节点信息
|
||||||
|
if (taskVo.getNodeIds() != null && !taskVo.getNodeIds().isEmpty()){
|
||||||
|
|
||||||
|
List<String> stringList = Arrays.stream(taskVo.getNodeIds().split(",")).toList();
|
||||||
|
|
||||||
|
nodeWrapper.clear();
|
||||||
|
nodeWrapper.in(OpsInspectionNode::getId, stringList);
|
||||||
|
List<OpsInspectionNodeVo> nodeVoList = nodeMapper.selectVoList(nodeWrapper);
|
||||||
|
|
||||||
|
//处理进度百分比 完成节点 / 总节点 * 100
|
||||||
|
if (nodeVoList != null && !nodeVoList.isEmpty()){
|
||||||
|
//统计完成节点
|
||||||
|
int finishCount = nodeVoList.stream().filter(nodeVo -> nodeVo.getStatus().equals("1")).toList().size();
|
||||||
|
if (finishCount == nodeVoList.size()){
|
||||||
|
taskVo.setTaskProgress(new BigDecimal("100"));
|
||||||
|
}else {
|
||||||
|
taskVo.setTaskProgress(BigDecimal.valueOf(finishCount).divide(BigDecimal.valueOf(nodeVoList.size()), 2, RoundingMode.DOWN).multiply(BigDecimal.valueOf(100.00)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//处理节点列表
|
||||||
|
if (taskVo.getNodeIds() != null && !taskVo.getNodeIds().isEmpty()){
|
||||||
|
|
||||||
|
List<OpsInspectionNodeVo> nodeVos = new ArrayList<>();
|
||||||
|
for (String id : stringList) {
|
||||||
|
OpsInspectionNodeVo nodeVo = nodeMapper.selectVoById(id);
|
||||||
|
if (nodeVo != null) {
|
||||||
|
nodeVos.add(nodeVo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
taskVo.setNodes(nodeVos);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user