09-24-报修,抢修更新用户类型,实验任务处理节点进度及回显信息

This commit is contained in:
2025-09-24 16:49:28 +08:00
parent 4b37434057
commit 77095ac5a2
8 changed files with 112 additions and 41 deletions

View File

@ -64,6 +64,11 @@ public class OpsInspectionTestTask extends BaseEntity {
*/
private Long person;
/**
* 节点IDS
*/
private String nodeIds;
/**
* 状态,1待执行2暂停3失败4执行中5已完成
*/
@ -87,7 +92,7 @@ public class OpsInspectionTestTask extends BaseEntity {
/**
* 进度
*/
private Long progress;
// private Long progress;
/**
* 失败原因

View File

@ -69,6 +69,12 @@ public class OpsInspectionTestTaskBo extends BaseEntity {
@NotNull(message = "执行人员不能为空", groups = { AddGroup.class, EditGroup.class })
private Long person;
/**
* 节点IDS
*/
@NotNull(message = "节点不能为空", groups = { AddGroup.class, EditGroup.class })
private String nodeIds;
/**
* 状态,1待执行2暂停3失败4执行中5已完成
*/
@ -94,7 +100,7 @@ public class OpsInspectionTestTaskBo extends BaseEntity {
/**
* 进度
*/
private Long progress;
// private Long progress;
/**
* 失败原因

View File

@ -8,6 +8,7 @@ import cn.idev.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.personnel.domain.vo.OpsUserVo;
import org.dromara.system.api.domain.vo.RemoteUserVo;
import java.io.Serial;
import java.io.Serializable;
@ -69,7 +70,7 @@ public class OpsInspectionRepairVo implements Serializable {
@ExcelProperty(value = "指派维修人")
private Long sendPerson;
private OpsUserVo sendPersonVo;
private RemoteUserVo sendPersonVo;
/**
* 详细信息

View File

@ -6,6 +6,7 @@ import cn.idev.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.personnel.domain.vo.OpsUserVo;
import org.dromara.system.api.domain.vo.RemoteUserVo;
import java.io.Serial;
import java.io.Serializable;
@ -70,7 +71,7 @@ public class OpsInspectionReportVo implements Serializable {
/**
* 指派维修人
*/
private OpsUserVo sendPersonVo;
private RemoteUserVo sendPersonVo;
/**
* 详细信息

View File

@ -1,5 +1,6 @@
package org.dromara.inspection.domain.vo;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.inspection.domain.OpsInspectionTestTask;
@ -15,7 +16,7 @@ import org.dromara.system.api.domain.vo.RemoteUserVo;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -82,6 +83,16 @@ public class OpsInspectionTestTaskVo implements Serializable {
private RemoteUserVo personInfo;
/**
* 节点IDS
*/
private String nodeIds;
/**
* 节点列表
*/
private List<OpsInspectionNodeVo> nodes;
/**
* 状态,1待执行2暂停3失败4执行中5已完成
*/
@ -112,7 +123,7 @@ public class OpsInspectionTestTaskVo implements Serializable {
* 进度
*/
@ExcelProperty(value = "进度")
private Long progress;
private BigDecimal progress;
/**
* 失败原因

View File

@ -19,6 +19,8 @@ import org.dromara.inspection.service.IOpsInspectionRepairService;
import org.dromara.personnel.domain.vo.OpsUserVo;
import org.dromara.personnel.service.impl.OpsUserServiceImpl;
import org.dromara.resource.api.RemoteFileService;
import org.dromara.system.api.RemoteUserService;
import org.dromara.system.api.domain.vo.RemoteUserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.dromara.inspection.domain.bo.OpsInspectionRepairBo;
@ -48,8 +50,8 @@ public class OpsInspectionRepairServiceImpl implements IOpsInspectionRepairServi
@DubboReference
private RemoteFileService remoteFileService;
@Autowired
private OpsUserServiceImpl opsUserService;
@DubboReference
private RemoteUserService userService;
/**
* 查询运维-巡检-抢修
@ -203,12 +205,13 @@ public class OpsInspectionRepairServiceImpl implements IOpsInspectionRepairServi
continue;
}
OpsUserVo opsUserVo = opsUserService.queryById(vo.getSendPerson());
if (opsUserVo == null){
List<RemoteUserVo> remoteUserVos = userService.selectListByIds(Collections.singletonList(vo.getSendPerson()));
if (remoteUserVos == null || remoteUserVos.isEmpty()){
continue;
}
vo.setSendPersonVo(opsUserVo);
vo.setSendPersonVo(remoteUserVos.getFirst());
//处理分钟数
if (vo.getStatus().equals("3")){
@ -216,13 +219,13 @@ public class OpsInspectionRepairServiceImpl implements IOpsInspectionRepairServi
vo.setMinute(String.valueOf(TimeUnit.MILLISECONDS.toMinutes( time)));
}
opsUserVo = opsUserService.queryById(vo.getCreateBy());
if (opsUserVo != null){
if (opsUserVo.getUserName()!=null) {
vo.setName(opsUserVo.getUserName());
remoteUserVos = userService.selectListByIds(Collections.singletonList(vo.getCreateBy()));
if (remoteUserVos != null&&!remoteUserVos.isEmpty()){
if (remoteUserVos.getFirst().getUserName()!=null) {
vo.setName(remoteUserVos.getFirst().getUserName());
}
if (opsUserVo.getPhone()!=null){
vo.setReportPhone(opsUserVo.getPhone());
if (remoteUserVos.getFirst().getPhonenumber()!=null){
vo.setReportPhone(remoteUserVos.getFirst().getPhonenumber());
}
}

View File

@ -17,6 +17,8 @@ import org.dromara.inspection.domain.vo.OpsInspectionReportRecordVo;
import org.dromara.personnel.domain.vo.OpsUserVo;
import org.dromara.personnel.service.impl.OpsUserServiceImpl;
import org.dromara.resource.api.RemoteFileService;
import org.dromara.system.api.RemoteUserService;
import org.dromara.system.api.domain.vo.RemoteUserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.dromara.inspection.domain.bo.OpsInspectionReportBo;
@ -48,8 +50,8 @@ public class OpsInspectionReportServiceImpl implements IOpsInspectionReportServi
@DubboReference
private RemoteFileService remoteFileService;
@Autowired
private OpsUserServiceImpl opsUserService;
@DubboReference
private RemoteUserService userService;
/**
* 查询运维-巡检-报修
@ -216,20 +218,20 @@ public class OpsInspectionReportServiceImpl implements IOpsInspectionReportServi
continue;
}
OpsUserVo opsUserVo = opsUserService.queryById(vo.getSendPerson());
if (opsUserVo == null){
List<RemoteUserVo> remoteUserVos = userService.selectListByIds(Collections.singletonList(vo.getSendPerson()));
if (remoteUserVos == null || remoteUserVos.isEmpty()){
continue;
}
vo.setSendPersonVo(opsUserVo);
vo.setSendPersonVo(remoteUserVos.getFirst());
opsUserVo = opsUserService.queryById(vo.getCreateBy());
if (opsUserVo != null){
if (opsUserVo.getUserName()!=null) {
vo.setName(opsUserVo.getUserName());
remoteUserVos = userService.selectListByIds(Collections.singletonList(vo.getCreateBy()));
if (remoteUserVos != null && !remoteUserVos.isEmpty()){
if (remoteUserVos.getFirst().getUserName()!=null) {
vo.setName(remoteUserVos.getFirst().getUserName());
}
if (opsUserVo.getPhone()!=null){
vo.setReportPhone(opsUserVo.getPhone());
if (remoteUserVos.getFirst().getPhonenumber()!=null){
vo.setReportPhone(remoteUserVos.getFirst().getPhonenumber());
}
}
}

View File

@ -12,8 +12,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.inspection.domain.OpsInspectionNode;
import org.dromara.inspection.domain.vo.OpsInspectionNodeVo;
import org.dromara.inspection.domain.vo.OpsInspectionTestPlanVo;
import org.dromara.inspection.domain.vo.OpsInspectionTestTaskRecord;
import org.dromara.inspection.mapper.OpsInspectionNodeMapper;
import org.dromara.personnel.domain.vo.OpsUserVo;
import org.dromara.personnel.service.impl.OpsUserServiceImpl;
import org.dromara.system.api.RemoteUserService;
@ -30,10 +33,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.*;
/**
* 运维-巡检-试验任务Service业务层处理
@ -47,6 +47,8 @@ import java.util.Collection;
public class OpsInspectionTestTaskServiceImpl implements IOpsInspectionTestTaskService {
private final OpsInspectionTestTaskMapper baseMapper;
private final OpsInspectionNodeMapper nodeMapper;
@Autowired
private OpsInspectionTestPlanServiceImpl opsInspectionTestPlanService;
@DubboReference
@ -108,7 +110,7 @@ public class OpsInspectionTestTaskServiceImpl implements IOpsInspectionTestTaskS
lqw.eq(bo.getTestPlanId() != null, OpsInspectionTestTask::getTestPlanId, bo.getTestPlanId());
lqw.eq(StringUtils.isNotBlank(bo.getTestSetting()), OpsInspectionTestTask::getTestSetting, bo.getTestSetting());
lqw.eq(bo.getPlanBeginTime() != null, OpsInspectionTestTask::getPlanBeginTime, bo.getPlanBeginTime());
lqw.eq(bo.getProgress() != null, OpsInspectionTestTask::getProgress, bo.getProgress());
// lqw.eq(bo.getProgress() != null, OpsInspectionTestTask::getProgress, bo.getProgress());
lqw.eq(StringUtils.isNotBlank(bo.getFailReason()), OpsInspectionTestTask::getFailReason, bo.getFailReason());
lqw.eq(bo.getFailTime() != null, OpsInspectionTestTask::getFailTime, bo.getFailTime());
lqw.eq(bo.getFailPhase() != null, OpsInspectionTestTask::getFailPhase, bo.getFailPhase());
@ -178,22 +180,62 @@ public class OpsInspectionTestTaskServiceImpl implements IOpsInspectionTestTaskS
* 处理回显信息
*/
private void setValue(List<OpsInspectionTestTaskVo> list){
for (OpsInspectionTestTaskVo opsInspectionTestTaskVo : list) {
if(opsInspectionTestTaskVo.getPerson()!= null){
List<RemoteUserVo> remoteUserVos = userService.selectListByIds(List.of(opsInspectionTestTaskVo.getPerson()));
LambdaQueryWrapper<OpsInspectionNode> nodeWrapper = new LambdaQueryWrapper<>();
for (OpsInspectionTestTaskVo vo : list) {
if(vo.getPerson()!= null){
List<RemoteUserVo> remoteUserVos = userService.selectListByIds(List.of(vo.getPerson()));
if (remoteUserVos != null && !remoteUserVos.isEmpty()){
opsInspectionTestTaskVo.setPersonInfo(remoteUserVos.getFirst());
vo.setPersonInfo(remoteUserVos.getFirst());
}
}
if (opsInspectionTestTaskVo.getTestPlanId() != null){
OpsInspectionTestPlanVo opsInspectionTestPlanVo = opsInspectionTestPlanService.queryById(opsInspectionTestTaskVo.getTestPlanId());
if (vo.getTestPlanId() != null){
OpsInspectionTestPlanVo opsInspectionTestPlanVo = opsInspectionTestPlanService.queryById(vo.getTestPlanId());
if (opsInspectionTestPlanVo != null){
opsInspectionTestTaskVo.setTestPlan(opsInspectionTestPlanVo);
vo.setTestPlan(opsInspectionTestPlanVo);
}
}
//处理节点回显列表
if (vo.getNodeIds() != null && !vo.getNodeIds().isEmpty()){
List<String> stringList = Arrays.stream(vo.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 -> vo.getStatus().equals("1")).toList().size();
if (finishCount == nodeVoList.size()){
vo.setProgress(new BigDecimal("100"));
}else {
vo.setProgress(BigDecimal.valueOf(finishCount).divide(BigDecimal.valueOf(nodeVoList.size()), 2, RoundingMode.DOWN).multiply(BigDecimal.valueOf(100.00)));
}
}
//处理节点列表
if (vo.getNodeIds() != null && !vo.getNodeIds().isEmpty()){
List<OpsInspectionNodeVo> nodeVos = new ArrayList<>();
for (String id : stringList) {
OpsInspectionNodeVo nodeVo = nodeMapper.selectVoById(id);
if (nodeVo != null) {
nodeVos.add(nodeVo);
}
}
vo.setNodes(nodeVos);
}
}
}
}