普测测试流程

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

@@ -77,7 +77,7 @@ public class BpmCategoryController extends BaseController {
@GetMapping("/getById")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "获得流程分类")
@ApiOperation("获得流程分类")
@Parameter(name = "id", description = "编号", required = true)
public HttpResult<BpmCategory> getById(String id) {
String methodDescribe = getMethodDescribe("getById");
@@ -101,7 +101,7 @@ public class BpmCategoryController extends BaseController {
@GetMapping("/simpleList")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "获得动态表单的精简列表", description = "用于表单下拉框")
@ApiOperation("获得动态表单的精简列表")
public HttpResult<List<BpmCategory>> getCategorySimpleList() {
String methodDescribe = getMethodDescribe("getCategorySimpleList");
List<BpmCategory> list = categoryService.getCategoryList();

View File

@@ -91,7 +91,7 @@ public class BpmFormController extends BaseController {
@GetMapping("/getById")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "获得动态表单")
@ApiOperation("获得动态表单")
@Parameter(name = "id", description = "编号", required = true)
public HttpResult<BpmForm> getById(String id) {
String methodDescribe = getMethodDescribe("getById");
@@ -101,7 +101,7 @@ public class BpmFormController extends BaseController {
@GetMapping("/simpleList")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "获得动态表单的精简列表", description = "用于表单下拉框")
@ApiOperation("获得动态表单的精简列表")
public HttpResult<List<BpmForm>> getFormSimpleList() {
String methodDescribe = getMethodDescribe("getFormSimpleList");
List<BpmForm> list = formService.getFormList();

View File

@@ -134,7 +134,7 @@ public class BpmModelController extends BaseController {
// @PostMapping("/import")
// @Operation(summary = "导入模型")
// @ApiOperation("导入模型")
// @PreAuthorize("@ss.hasPermission('bpm:model:import')")
// public CommonResult<String> importModel(@Valid BpmModeImportReqVO importReqVO) throws IOException {
// BpmModelCreateReqVO createReqVO = BeanUtils.toBean(importReqVO, BpmModelCreateReqVO.class);
@@ -155,7 +155,7 @@ public class BpmModelController extends BaseController {
//
// @PutMapping("/update-state")
// @Operation(summary = "修改模型的状态", description = "实际更新的部署的流程定义的状态")
// @ApiOperation("修改模型的状态", description = "实际更新的部署的流程定义的状态")
// @PreAuthorize("@ss.hasPermission('bpm:model:update')")
// public CommonResult<Boolean> updateModelState(@Valid @RequestBody BpmModelUpdateStateReqVO reqVO) {
// modelService.updateModelState(reqVO.getId(), reqVO.getState());

View File

@@ -87,7 +87,7 @@ public class BpmProcessDefinitionController extends BaseController {
}
@GetMapping("/list")
@Operation(summary = "获得流程定义列表")
@ApiOperation("获得流程定义列表")
@Parameter(name = "suspensionState", description = "挂起状态", required = true) // 参见 Flowable SuspensionState 枚举
public HttpResult<List<BpmProcessDefinitionInfoVO>> getProcessDefinitionList(Integer suspensionState) {
String methodDescribe = getMethodDescribe("getProcessDefinitionList");
@@ -105,7 +105,7 @@ public class BpmProcessDefinitionController extends BaseController {
}
@GetMapping("/get")
@Operation(summary = "获得流程定义")
@ApiOperation("获得流程定义")
@Parameter(name = "id", description = "流程编号", required = true, example = "1024")
@Parameter(name = "key", description = "流程定义标识", required = true, example = "1024")
public HttpResult<BpmProcessDefinitionInfoVO> getProcessDefinition(

View File

@@ -101,7 +101,7 @@ public class BpmSignController extends BaseController {
@GetMapping("/simpleList")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "获得动态表单的精简列表", description = "用于表单下拉框")
@ApiOperation("获得动态表单的精简列表")
public HttpResult<List<BpmSign>> getSignSimpleList() {
String methodDescribe = getMethodDescribe("getCategorySimpleList");
List<BpmSign> list = bpmSignService.getSignSimpleList();

View File

@@ -0,0 +1,27 @@
package com.njcn.bpm.listener.business;
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
import com.njcn.supervision.api.SurveyTestFeignClient;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
public class BpmSurveyTestStatusListener extends BpmProcessInstanceStatusEventListener {
@Resource
private SurveyTestFeignClient surveyTestFeignClient;
@Override
protected String getProcessDefinitionKey() {
return "survey_test";
}
@Override
protected void onEvent(BpmProcessInstanceStatusEvent event) {
surveyTestFeignClient.updateStatus(event.getBusinessKey(), event.getStatus());
}
}

View File

@@ -0,0 +1,23 @@
package com.njcn.supervision.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.supervision.api.fallback.SurveyPlanFeignClientFallbackFactory;
import com.njcn.supervision.api.fallback.SurveyTestFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 流程实例 Api 接口
*
* @author 芋道源码
*/
@FeignClient(value = ServerInfo.SUPERVISION, path = "/surveyTest", fallbackFactory = SurveyTestFeignClientFallbackFactory.class)
public interface SurveyTestFeignClient {
@GetMapping("/updateSurveyTestStatus")
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
}

View File

@@ -0,0 +1,37 @@
package com.njcn.supervision.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.supervision.api.SurveyTestFeignClient;
import com.njcn.supervision.utils.SupervisionEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author denghuajun
* @version 1.0.0
* @date 2022/3/16
*/
@Slf4j
@Component
public class SurveyTestFeignClientFallbackFactory implements FallbackFactory<SurveyTestFeignClient> {
@Override
public SurveyTestFeignClient create(Throwable throwable) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) throwable.getCause();
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new SurveyTestFeignClient() {
@Override
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
log.error("{}异常,降级处理,异常为:{}", "更新退运装置数据流程状态", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -14,7 +14,8 @@ public enum FlowStatusEnum {
APPROVE(2, "审批通过"),
OPPOSE(3, "审批不通过"),
CANCEL(4, "已取消"),
NO_FEEDBACK(5, "未反馈");
NO_FEEDBACK(5, "未反馈"),
UN_TEST(6, "待测试");
private final Integer code;

View File

@@ -23,6 +23,9 @@ public class SurveyTestParam extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
@NotBlank(message = "索引不能为空")
private String Id;
/**
* 普测计划表id
@@ -88,10 +91,6 @@ public class SurveyTestParam extends BaseEntity implements Serializable {
@EqualsAndHashCode(callSuper = true)
public static class SurveyTestUpdateParam extends SurveyTestParam {
@ApiModelProperty("id")
@NotBlank(message = "索引不能为空")
private String Id;
}

View File

@@ -30,11 +30,52 @@ public class SurveyTestVO extends BaseEntity implements Serializable {
*/
private String planId;
/**
* 普测计划名称
*/
private String planName;
/**
* 0 关联系统内变电站1 用户手动输入变电站
*/
private Integer customSubstationFlag;
/**
* 变电站台账ID或者用户手动输入的变电站名称
*/
private String substation;
/**
* 变电站名称
*/
private String substationName;
/**
* 变电站电压等级
*/
private String voltageLevel;
/**
* 计划开始时间
*/
private LocalDate planStartTime;
/**
* 计划结束时间
*/
private LocalDate planEndTime;
/**
* 负责单位id
*/
private String deptId;
/**
* 负责单位名称
*/
private String deptName;
/**
* 计划完成时间
*/

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