普测测试流程
This commit is contained in:
@@ -26,4 +26,6 @@ public interface ISurveyTestService extends IService<SurveyTest> {
|
||||
String cancelSurveyTest(BpmProcessInstanceCancelParam cancelReqVO);
|
||||
|
||||
void updateSurveyTestStatus(String businessKey, Integer status);
|
||||
|
||||
SurveyTestVO getVOById(String id);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -47,18 +48,22 @@ import java.util.*;
|
||||
* @since 2024-05-30
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyPlan> implements ISurveyPlanService {
|
||||
|
||||
private final UserFeignClient userFeignClient;
|
||||
@Resource
|
||||
private UserFeignClient userFeignClient;
|
||||
|
||||
private final BpmProcessFeignClient bpmProcessFeignClient;
|
||||
@Resource
|
||||
private BpmProcessFeignClient bpmProcessFeignClient;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
@Resource
|
||||
private DeptFeignClient deptFeignClient;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
@Resource
|
||||
private LineFeignClient lineFeignClient;
|
||||
|
||||
private final ISurveyTestService surveyTestService;
|
||||
@Resource
|
||||
private ISurveyTestService surveyTestService;
|
||||
|
||||
/**
|
||||
* 预告警单的反馈单对应的流程定义 KEY
|
||||
@@ -98,7 +103,6 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
|
||||
//回显变电站名称
|
||||
if (record.getCustomSubstationFlag() == 0) {
|
||||
//关联台账内的变电站名称
|
||||
// record.setSubstationName(lineFeignClient.getSubstationInfo(record.getSubstation()).getData().getName());
|
||||
String substation = record.getSubstation();
|
||||
String[] subIds = substation.split(StrPool.COMMA);
|
||||
String subName = "";
|
||||
@@ -200,6 +204,7 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
|
||||
surveyTest.setDeptId(surveyPlan.getDeptId());
|
||||
surveyTest.setSubstation(subId);
|
||||
surveyTest.setCustomSubstationFlag(0);
|
||||
surveyTest.setStatus(FlowStatusEnum.UN_TEST.getCode());
|
||||
surveyTestService.save(surveyTest);
|
||||
}
|
||||
}else{
|
||||
@@ -208,6 +213,7 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
|
||||
surveyTest.setDeptId(surveyPlan.getDeptId());
|
||||
surveyTest.setSubstation(surveyPlan.getSubstation());
|
||||
surveyTest.setCustomSubstationFlag(1);
|
||||
surveyTest.setStatus(FlowStatusEnum.UN_TEST.getCode());
|
||||
surveyTestService.save(surveyTest);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.njcn.supervision.service.survey.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -11,14 +13,18 @@ import com.njcn.bpm.enums.BpmTaskStatusEnum;
|
||||
import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
||||
import com.njcn.supervision.mapper.survey.SurveyTestMapper;
|
||||
import com.njcn.supervision.pojo.param.survey.SurveyTestParam;
|
||||
import com.njcn.supervision.pojo.po.survey.SurveyPlan;
|
||||
import com.njcn.supervision.pojo.po.survey.SurveyTest;
|
||||
import com.njcn.supervision.pojo.vo.survey.SurveyPlanVO;
|
||||
import com.njcn.supervision.pojo.vo.survey.SurveyTestVO;
|
||||
import com.njcn.supervision.service.survey.ISurveyPlanService;
|
||||
import com.njcn.supervision.service.survey.ISurveyTestService;
|
||||
import com.njcn.supervision.utils.InstanceUtil;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
@@ -27,6 +33,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -41,12 +48,22 @@ import java.util.Objects;
|
||||
* @since 2024-05-30
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyTest> implements ISurveyTestService {
|
||||
|
||||
private final UserFeignClient userFeignClient;
|
||||
@Resource
|
||||
private UserFeignClient userFeignClient;
|
||||
|
||||
private final BpmProcessFeignClient bpmProcessFeignClient;
|
||||
@Resource
|
||||
private BpmProcessFeignClient bpmProcessFeignClient;
|
||||
|
||||
@Resource
|
||||
private DeptFeignClient deptFeignClient;
|
||||
|
||||
@Resource
|
||||
private LineFeignClient lineFeignClient;
|
||||
|
||||
@Resource
|
||||
private ISurveyPlanService surveyPlanService;
|
||||
|
||||
/**
|
||||
* 预告警单的反馈单对应的流程定义 KEY
|
||||
@@ -72,18 +89,38 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
|
||||
surveyTestVOQueryWrapper.in("supervision_survey_test.Create_By", colleaguesIds)
|
||||
.eq("supervision_survey_test.state", DataStateEnum.ENABLE.getCode())
|
||||
.orderByDesc("supervision_survey_test.Update_Time");
|
||||
return this.baseMapper.surveyTestPage(new Page<>(PageFactory.getPageNum(surveyTestQueryParam), PageFactory.getPageSize(surveyTestQueryParam)), surveyTestVOQueryWrapper);
|
||||
|
||||
Page<SurveyTestVO> surveyTestVOPage = this.baseMapper.surveyTestPage(new Page<>(PageFactory.getPageNum(surveyTestQueryParam), PageFactory.getPageSize(surveyTestQueryParam)), surveyTestVOQueryWrapper);
|
||||
List<SurveyTestVO> records = surveyTestVOPage.getRecords();
|
||||
if (CollectionUtil.isNotEmpty(records)) {
|
||||
for (SurveyTestVO record : records) {
|
||||
//回显部门名称
|
||||
record.setDeptName(deptFeignClient.getDeptById(record.getDeptId()).getData().getName());
|
||||
//回显变电站名称
|
||||
if (record.getCustomSubstationFlag() == 0) {
|
||||
//关联台账内的变电站名称
|
||||
String substation = record.getSubstation();
|
||||
record.setSubstationName(lineFeignClient.getSubstationInfo(substation).getData().getName());
|
||||
} else {
|
||||
record.setSubstationName(record.getSubstation());
|
||||
}
|
||||
}
|
||||
}
|
||||
return surveyTestVOPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String addSurveyTest(SurveyTestParam surveyTestParam) {
|
||||
SurveyTest surveyTest = new SurveyTest();
|
||||
BeanUtils.copyProperties(surveyTestParam, surveyTest);
|
||||
SurveyTest surveyTest = this.getById(surveyTestParam.getId());
|
||||
//没有copy前端所有的字段,仅赋值了test表中需要的几个字段
|
||||
surveyTest.setCompleteTime(surveyTestParam.getCompleteTime());
|
||||
surveyTest.setCompleteBy(surveyTestParam.getCompleteBy());
|
||||
surveyTest.setTestReport(surveyTestParam.getTestReport());
|
||||
surveyTest.setProblemFlag(surveyTestParam.getProblemFlag());
|
||||
surveyTest.setProblemDetail(surveyTestParam.getProblemDetail());
|
||||
surveyTest.setState(DataStateEnum.ENABLE.getCode());
|
||||
surveyTest.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
this.save(surveyTest);
|
||||
this.updateById(surveyTest);
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO();
|
||||
@@ -102,7 +139,7 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
|
||||
public String updateSurveyTest(SurveyTestParam.SurveyTestUpdateParam surveyTestUpdateParam) {
|
||||
SurveyTest surveyTest = this.baseMapper.selectById(surveyTestUpdateParam.getId());
|
||||
//判断是否有权限操作
|
||||
InstanceUtil.judgeUserPower(RequestUtil.getUserIndex(),surveyTest.getCreateBy());
|
||||
InstanceUtil.judgeUserPower(RequestUtil.getUserIndex(), surveyTest.getCreateBy());
|
||||
surveyTestUpdateParam.setStatus(surveyTest.getStatus());
|
||||
surveyTestUpdateParam.setProcessInstanceId(surveyTest.getProcessInstanceId());
|
||||
surveyTestUpdateParam.setHistoryInstanceId(surveyTest.getHistoryInstanceId());
|
||||
@@ -132,7 +169,7 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
|
||||
//准备取消该流程,需要远程调用接口
|
||||
SurveyTest surveyTest = this.baseMapper.selectById(cancelReqVO.getId());
|
||||
//判断是否有权限操作
|
||||
InstanceUtil.judgeUserPower(RequestUtil.getUserIndex(),surveyTest.getCreateBy());
|
||||
InstanceUtil.judgeUserPower(RequestUtil.getUserIndex(), surveyTest.getCreateBy());
|
||||
//取消流程
|
||||
bpmProcessFeignClient.cancelProcessInstanceByStartUser(cancelReqVO);
|
||||
//更新状态
|
||||
@@ -148,4 +185,30 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
|
||||
this.updateById(surveyTest);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurveyTestVO getVOById(String id) {
|
||||
SurveyTest surveyTest = this.baseMapper.selectById(id);
|
||||
SurveyTestVO surveyTestVO = new SurveyTestVO();
|
||||
BeanUtils.copyProperties(surveyTest, surveyTestVO);
|
||||
String planId = surveyTest.getPlanId();
|
||||
SurveyPlan surveyPlan = surveyPlanService.getById(planId);
|
||||
surveyTestVO.setPlanStartTime(surveyPlan.getPlanStartTime());
|
||||
surveyTestVO.setPlanEndTime(surveyPlan.getPlanEndTime());
|
||||
surveyTestVO.setPlanName(surveyPlan.getPlanName());
|
||||
//负责单位
|
||||
surveyTestVO.setDeptName(deptFeignClient.getDeptById(surveyTestVO.getDeptId()).getData().getName());
|
||||
//变电站名称
|
||||
if (surveyTestVO.getCustomSubstationFlag() == 0) {
|
||||
//关联台账内的变电站名称
|
||||
String substation = surveyTestVO.getSubstation();
|
||||
PollutionSubstationDTO data = lineFeignClient.getSubstationInfo(substation).getData();
|
||||
surveyTestVO.setSubstationName(data.getName());
|
||||
surveyTestVO.setVoltageLevel(data.getVoltageLevel());
|
||||
} else {
|
||||
surveyTestVO.setSubstationName(surveyTestVO.getSubstation());
|
||||
surveyTestVO.setVoltageLevel("/");
|
||||
}
|
||||
return surveyTestVO;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user