普测测试流程

This commit is contained in:
2024-06-04 10:51:08 +08:00
parent fd70d53286
commit 78d36fadb7
25 changed files with 262 additions and 47 deletions

View File

@@ -102,7 +102,7 @@ public class DeVReportManageController extends BaseController {
@GetMapping("/updateStatus")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "更改表单状态")
@ApiOperation("更改表单状态")
public HttpResult<Object> updateStatus(String businessKey,Integer status) {
String methodDescribe = getMethodDescribe("updateStatus");
supervisionDevMainReportPOService.updateStatus(businessKey,status);

View File

@@ -81,7 +81,7 @@ public class QuitRunningDeviceController extends BaseController {
@GetMapping("/updateDeviceStatus")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "更新退运装置流程状态")
@ApiOperation("更新退运装置流程状态")
public HttpResult<Object> updateDeviceStatus(String businessKey, Integer status) {
String methodDescribe = getMethodDescribe("updateDeviceStatus");
quitRunningDeviceService.updateDeviceStatus(businessKey, status);
@@ -90,7 +90,7 @@ public class QuitRunningDeviceController extends BaseController {
@GetMapping("/getById")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "根据id获取设备的详细数据")
@ApiOperation("根据id获取设备的详细数据")
public HttpResult<QuitRunningDeviceVO> getById(String id) {
String methodDescribe = getMethodDescribe("getById");
QuitRunningDeviceVO quitRunningDeviceVO = quitRunningDeviceService.getVOById(id);

View File

@@ -83,7 +83,7 @@ public class TempLineController extends BaseController {
}
@GetMapping("/updateStatus")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "更改表单状态")
@ApiOperation("更改表单状态")
public HttpResult<Object> updateStatus(String businessKey,Integer status) {
String methodDescribe = getMethodDescribe("updateStatus");
supervisionTempLineReportService.updateStatus(businessKey,status);

View File

@@ -91,7 +91,7 @@ public class TempLineDebugController extends BaseController {
}
@GetMapping("/updateStatus")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "更改表单状态")
@ApiOperation("更改表单状态")
public HttpResult<Object> updateStatus(String businessKey,Integer status) {
String methodDescribe = getMethodDescribe("updateStatus");
supervisionTempLineDebugPOService.updateStatus(businessKey,status);

View File

@@ -95,7 +95,7 @@ public class WarningLeafletController extends BaseController {
@GetMapping("/getById")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "根据id获取预告警单的详细数据")
@ApiOperation("根据id获取预告警单的详细数据")
public HttpResult<WarningLeafletVO> getById(String id) {
String methodDescribe = getMethodDescribe("getById");
WarningLeafletVO warningLeafletVO = warningLeafletService.getVOById(id);
@@ -105,7 +105,7 @@ public class WarningLeafletController extends BaseController {
@ApiIgnore
@GetMapping("/updateStatus")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "更改表单状态")
@ApiOperation("更改表单状态")
public HttpResult<Object> updateStatus(String businessKey,Integer status) {
String methodDescribe = getMethodDescribe("updateStatus");
warningLeafletService.updateStatus(businessKey,status);

View File

@@ -89,7 +89,7 @@ public class SupervisionPlanController extends BaseController {
}
@GetMapping("/updateStatus")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "更改表单状态")
@ApiOperation("更改表单状态")
public HttpResult<Object> updateStatus(String businessKey,Integer status) {
String methodDescribe = getMethodDescribe("updateStatus");
supervisionPlanPOService.updateStatus(businessKey,status);

View File

@@ -105,7 +105,7 @@ public class GeneralSurveyController extends BaseController {
@GetMapping("/updateStatus")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "更改普测计划状态")
@ApiOperation("更改普测计划状态")
public HttpResult<Object> updateStatus(String businessKey,Integer status) {
String methodDescribe = getMethodDescribe("updateStatus");
supervisionGeneralSurveyPlanPOService.updateStatus(businessKey,status);

View File

@@ -83,7 +83,7 @@ public class SurveyPlanController extends BaseController {
@GetMapping("/updateSurveyPlanStatus")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "更新普测计划流程状态")
@ApiOperation("更新普测计划流程状态")
public HttpResult<Object> updateSurveyPlanStatus(String businessKey, Integer status) {
String methodDescribe = getMethodDescribe("updateSurveyPlanStatus");
surveyPlanService.updateSurveyPlanStatus(businessKey, status);
@@ -92,7 +92,7 @@ public class SurveyPlanController extends BaseController {
@GetMapping("/getById")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "根据id获取普测计划的详细数据")
@ApiOperation("根据id获取普测计划的详细数据")
public HttpResult<SurveyPlanVO> getById(String id) {
String methodDescribe = getMethodDescribe("getById");
SurveyPlanVO surveyPlanVO = surveyPlanService.getVOById(id);

View File

@@ -10,6 +10,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.supervision.pojo.param.survey.SurveyTestParam;
import com.njcn.supervision.pojo.vo.survey.SurveyPlanVO;
import com.njcn.supervision.pojo.vo.survey.SurveyTestVO;
import com.njcn.supervision.service.survey.ISurveyTestService;
import io.swagger.annotations.Api;
@@ -82,7 +83,7 @@ public class SurveyTestController extends BaseController {
@GetMapping("/updateSurveyTestStatus")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "更新普测测试流程状态")
@ApiOperation("更新普测测试流程状态")
public HttpResult<Object> updateSurveyTestStatus(String businessKey, Integer status) {
String methodDescribe = getMethodDescribe("updateSurveyTestStatus");
surveyTestService.updateSurveyTestStatus(businessKey, status);
@@ -90,6 +91,14 @@ public class SurveyTestController extends BaseController {
}
@GetMapping("/getById")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("根据id获取普测计划测试的详细数据")
public HttpResult<SurveyTestVO> getById(String id) {
String methodDescribe = getMethodDescribe("getById");
SurveyTestVO surveyTestVO = surveyTestService.getVOById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, surveyTestVO, methodDescribe);
}
}

View File

@@ -100,7 +100,7 @@ public class UserReportManageController extends BaseController {
@GetMapping("/getById")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "根据id获取用户档案录入的详细数据")
@ApiOperation("根据id获取用户档案录入的详细数据")
public HttpResult<UserReportVO> getById(String id) {
String methodDescribe = getMethodDescribe("getById");
UserReportVO userReportVO = userReportPOService.getVOById(id);
@@ -110,7 +110,7 @@ public class UserReportManageController extends BaseController {
@GetMapping("/updateUserReportStatus")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "更新用户数据流程状态")
@ApiOperation("更新用户数据流程状态")
public HttpResult<Object> updateUserReportStatus(String businessKey, Integer status) {
String methodDescribe = getMethodDescribe("updateUserReportStatus");
userReportPOService.updateUserReportStatus(businessKey, status);
@@ -119,7 +119,7 @@ public class UserReportManageController extends BaseController {
@GetMapping("/updateUserStatus")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "更新干扰源用户状态")
@ApiOperation("更新干扰源用户状态")
public HttpResult<Object> updateUserStatus(String lineId, Integer userStatus) {
String methodDescribe = getMethodDescribe("updateUserStatus");
userReportPOService.updateUserStatus(lineId, userStatus);

View File

@@ -3,8 +3,15 @@
<mapper namespace="com.njcn.supervision.mapper.survey.SurveyTestMapper">
<select id="surveyTestPage" resultType="SurveyTestVO">
SELECT supervision_survey_test.*
SELECT supervision_survey_test.*,
supervision_survey_plan.plan_name planName,
supervision_survey_plan.custom_substation_flag customSubstationFlag,
supervision_survey_plan.substation substation,
supervision_survey_plan.plan_start_time planStartTime,
supervision_survey_plan.plan_end_time planEndTime
FROM supervision_survey_test supervision_survey_test
left join supervision_survey_plan supervision_survey_plan
on supervision_survey_test.plan_id = supervision_survey_plan.id
WHERE ${ew.sqlSegment}
</select>

View File

@@ -26,4 +26,6 @@ public interface ISurveyTestService extends IService<SurveyTest> {
String cancelSurveyTest(BpmProcessInstanceCancelParam cancelReqVO);
void updateSurveyTestStatus(String businessKey, Integer status);
SurveyTestVO getVOById(String id);
}

View File

@@ -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);
}
}

View File

@@ -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;
}
}