冀北监测点试运行功能提交

This commit is contained in:
cdf
2024-05-22 17:50:08 +08:00
parent 7a7ece5acd
commit 5d97d4489e
26 changed files with 789 additions and 60 deletions

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.TempLineDebugFeignClientFallbackFactory;
import com.njcn.supervision.api.fallback.TempLineRunTestFeignClientFallbackFactory;
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 = "/supervisionTempLineRunTest", fallbackFactory = TempLineRunTestFeignClientFallbackFactory.class)
public interface TempLineRunTestFeignClient {
@GetMapping("/updateStatus")
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
}

View File

@@ -0,0 +1,38 @@
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.TempLineFeignClient;
import com.njcn.supervision.api.TempLineRunTestFeignClient;
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 TempLineRunTestFeignClientFallbackFactory implements FallbackFactory<TempLineRunTestFeignClient> {
@Override
public TempLineRunTestFeignClient 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 TempLineRunTestFeignClient() {
@Override
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
log.error("{}异常,降级处理,异常为:{}", "更新流程状态", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,79 @@
package com.njcn.supervision.pojo.param.device;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import com.njcn.web.pojo.annotation.DateTimeStrValid;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author hongawen
* @since 2024-05-21
*/
@Data
public class SupervisionTempLineRunTestParam {
private static final long serialVersionUID = 1L;
private String id;
/**
* 流程实例的编号
*/
private String processInstanceId;
/**
* 在线率
*/
private Float onlineRate;
/**
* 数据完整性
*/
private Float integrityRate;
/**
* 数据符合性
*/
private Float suitRate;
/**
* 1:审批中2审批通过3审批不通过4已取消
*/
private Integer status;
/**
* 状态0-删除 1-正常
*/
private Integer state;
/**
* 0:未试运行 1试运行中 2.试运行成功 3.试运行异常
*/
private Integer testRunState;
/**
* 试运行监测点id集合
*/
@NotEmpty(message = "试运行监测点id集合参数不可为空")
private List<String> lineIds;
@NotBlank(message = "开始时间不可为空")
@DateTimeStrValid(format = "yyyy-MM-dd HH:mm:ss")
private String startTime;
@NotBlank(message = "结束时间不可为空")
@DateTimeStrValid(format = "yyyy-MM-dd HH:mm:ss")
private String endTime;
}

View File

@@ -1,9 +1,8 @@
package com.njcn.supervision.pojo.po.device;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;
@@ -18,12 +17,18 @@ import lombok.Setter;
@Getter
@Setter
@TableName("supervision_temp_line_run_test")
public class SupervisionTempLineRunTest extends BaseEntity {
public class SupervisionTempLineRunTestPO extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId
private String id;
/**
* 监测点编号用于区分监测点唯一编号和监测点主键需要区分目前认为是pq_line表的监测点id
*/
private String lineId;
/**
* 流程实例的编号
*/
@@ -32,17 +37,17 @@ public class SupervisionTempLineRunTest extends BaseEntity {
/**
* 在线率
*/
private Float onlineRate;
private Double onlineRate;
/**
* 数据完整性
*/
private Float integrityRate;
private Double integrityRate;
/**
* 数据符合性
*/
private Float suitRate;
private Double suitRate;
/**
* 1:审批中2审批通过3审批不通过4已取消
@@ -59,5 +64,10 @@ public class SupervisionTempLineRunTest extends BaseEntity {
*/
private Integer testRunState;
/**
* 试运行时间范围
*/
private String testRunTime;
}

View File

@@ -29,4 +29,9 @@ public class SupervisionTempLineDebugVO extends BaseEntity {
* 0:未试运行 1试运行中 2.试运行成功 3.试运行异常
*/
private Integer testRunState;
/**
* 试运行时间范围
*/
private String testRunTime;
}

View File

@@ -0,0 +1,86 @@
package com.njcn.supervision.pojo.vo.device;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
*
* </p>
*
* @author hongawen
* @since 2024-05-21
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = true)
public class SupervisionTempLineRunTestVO extends BaseEntity{
private static final long serialVersionUID = 1L;
private String id;
/**
* 监测点编号用于区分监测点唯一编号和监测点主键需要区分目前认为是pq_line表的监测点id
*/
private String lineId;
/**
* 流程实例的编号
*/
private String processInstanceId;
/**
* 在线率
*/
private Double onlineRate;
/**
* 数据完整性
*/
private Double integrityRate;
/**
* 数据符合性
*/
private Double suitRate;
/**
* 1:审批中2审批通过3审批不通过4已取消
*/
private Integer status;
/**
* 状态0-删除 1-正常
*/
private Integer state;
/**
* 0:未试运行 1试运行中 2.试运行成功 3.试运行异常
*/
private Integer testRunState;
/**
* 试运行时间范围
*/
private String testRunTime;
private String lineName;
private String userName;
private String connectedBus;
private String monitoringTerminalCode;
private String monitoringTerminalName;
private String powerSubstationName;
private String reason;
}

View File

@@ -1,16 +1,27 @@
package com.njcn.supervision.controller.device;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
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.device.SupervisionTempLineReportParam;
import com.njcn.supervision.pojo.param.device.SupervisionTempLineRunTestParam;
import com.njcn.supervision.pojo.vo.device.SupervisionTempLineRunTestVO;
import com.njcn.supervision.service.device.ISupervisionTempLineRunTestService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.njcn.web.controller.BaseController;
/**
* <p>
* 前端控制器
* 监测点试运行前端控制器
* </p>
*
* @author cdf
@@ -23,5 +34,54 @@ public class SupervisionTempLineRunTestController extends BaseController {
private final ISupervisionTempLineRunTestService iSupervisionTempLineRunTestService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType= OperateType.ADD)
@PostMapping("/add")
@ApiOperation("新增监测点试运行")
@ApiImplicitParam(name = "supervisionTempLineRunTestParam", value = "实体参数", required = true)
public HttpResult<Object> addRunTest(@RequestBody @Validated SupervisionTempLineRunTestParam supervisionTempLineRunTestParam){
String methodDescribe = getMethodDescribe("addTempLineReport");
iSupervisionTempLineRunTestService.addRunTest(supervisionTempLineRunTestParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
/**
* 判断是否已经开始试运行,或者试运行结束
* @author cdf
* @date 2024/5/22
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/isTestRunStartOrEnd")
@ApiOperation("每日判断试运行是否结束")
public HttpResult<Object> isTestRunStartOrEnd(){
String methodDescribe = getMethodDescribe("isTestRunStartOrEnd");
iSupervisionTempLineRunTestService.isTestRunStartOrEnd();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPDATE)
@GetMapping("/updateStatus")
@ApiOperation("修改业务审核状态")
public HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status){
String methodDescribe = getMethodDescribe("updateLineRunTestStatus");
iSupervisionTempLineRunTestService.updateStatus(businessKey,status);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getRunTestById")
@ApiOperation("查询试运行详情")
public HttpResult<SupervisionTempLineRunTestVO> getRunTestById(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("getRunTestById");
SupervisionTempLineRunTestVO supervisionTempLineRunTestVO = iSupervisionTempLineRunTestService.getRunTestById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, supervisionTempLineRunTestVO, methodDescribe);
}
}

View File

@@ -2,7 +2,9 @@ package com.njcn.supervision.mapper.device;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTest;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTestPO;
import com.njcn.supervision.pojo.vo.device.SupervisionTempLineRunTestVO;
import org.apache.ibatis.annotations.Param;
/**
* <p>
@@ -12,6 +14,7 @@ import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTest;
* @author hongawen
* @since 2024-05-21
*/
public interface SupervisionTempLineRunTestMapper extends BaseMapper<SupervisionTempLineRunTest> {
public interface SupervisionTempLineRunTestMapper extends BaseMapper<SupervisionTempLineRunTestPO> {
SupervisionTempLineRunTestVO getRunTestInfo(@Param("id")String id);
}

View File

@@ -49,7 +49,8 @@
supervision_temp_line_debug.reason reason,
supervision_temp_line_run_test.process_instance_id process_instanceId,
supervision_temp_line_run_test.`status` `Status`,
IFNULL(supervision_temp_line_run_test.`test_run_state`,0) `testRunState`
IFNULL(supervision_temp_line_run_test.`test_run_state`,0) `testRunState`,
supervision_temp_line_run_test.test_run_time
FROM
supervision_temp_line_debug
inner JOIN supervision_temp_line_report ON supervision_temp_line_report.id = supervision_temp_line_debug.id

View File

@@ -1,5 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.supervision.device.mapper.SupervisionTempLineRunTestMapper">
<mapper namespace="com.njcn.supervision.mapper.device.SupervisionTempLineRunTestMapper">
<select id="getRunTestInfo" resultType="com.njcn.supervision.pojo.vo.device.SupervisionTempLineRunTestVO">
SELECT
supervision_temp_line_report.id id,
supervision_temp_line_report.user_name,
supervision_temp_line_report.connected_bus,
supervision_temp_line_report.monitoring_terminal_code,
supervision_temp_line_report.monitoring_terminal_name,
supervision_temp_line_report.Power_Substation_Name,
supervision_temp_line_report.line_id lineId,
supervision_temp_line_report.line_name lineName,
supervision_temp_line_debug.reason reason,
supervision_temp_line_run_test.process_instance_id process_instanceId,
supervision_temp_line_run_test.`status` `Status`,
IFNULL(supervision_temp_line_run_test.`test_run_state`,0) `testRunState`,
supervision_temp_line_run_test.test_run_time,
supervision_temp_line_run_test.`online_rate` `onlineRate`,
supervision_temp_line_run_test.`integrity_rate` `integrityRate`,
supervision_temp_line_run_test.`suit_rate` `suitRate`
FROM
supervision_temp_line_debug
inner JOIN supervision_temp_line_report ON supervision_temp_line_report.id = supervision_temp_line_debug.id
left join supervision_temp_line_run_test on supervision_temp_line_debug.id = supervision_temp_line_run_test.id
where supervision_temp_line_run_test.id = #{id}
</select>
</mapper>

View File

@@ -2,7 +2,9 @@ package com.njcn.supervision.service.device;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTest;
import com.njcn.supervision.pojo.param.device.SupervisionTempLineRunTestParam;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTestPO;
import com.njcn.supervision.pojo.vo.device.SupervisionTempLineRunTestVO;
/**
* <p>
@@ -12,6 +14,18 @@ import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTest;
* @author hongawen
* @since 2024-05-21
*/
public interface ISupervisionTempLineRunTestService extends IService<SupervisionTempLineRunTest> {
public interface ISupervisionTempLineRunTestService extends IService<SupervisionTempLineRunTestPO> {
Boolean addRunTest(SupervisionTempLineRunTestParam supervisionTempLineRunTestParam);
void isTestRunStartOrEnd();
void updateStatus(String businessKey,Integer status);
SupervisionTempLineRunTestVO getRunTestById(String id);
}

View File

@@ -1,12 +1,45 @@
package com.njcn.supervision.service.device.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.bpm.api.BpmProcessFeignClient;
import com.njcn.bpm.enums.BpmProcessInstanceStatusEnum;
import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.biz.commApi.CommLineClient;
import com.njcn.device.biz.enums.RunFlagEnum;
import com.njcn.device.biz.pojo.dto.LineDTO;
import com.njcn.device.pq.api.LineIntegrityClient;
import com.njcn.device.pq.pojo.dto.LineDataQualityDTO;
import com.njcn.device.pq.pojo.param.LineDataQualityParam;
import com.njcn.supervision.mapper.device.SupervisionTempLineReportMapper;
import com.njcn.supervision.mapper.device.SupervisionTempLineRunTestMapper;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTest;
import com.njcn.supervision.pojo.param.device.SupervisionTempLineRunTestParam;
import com.njcn.supervision.pojo.po.device.QuitRunningDevice;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineReport;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTestPO;
import com.njcn.supervision.pojo.vo.device.SupervisionTempLineRunTestVO;
import com.njcn.supervision.service.device.ISupervisionTempLineRunTestService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* <p>
* 服务实现类
@@ -16,6 +49,146 @@ import org.springframework.stereotype.Service;
* @since 2024-05-21
*/
@Service
public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<SupervisionTempLineRunTestMapper, SupervisionTempLineRunTest> implements ISupervisionTempLineRunTestService {
@RequiredArgsConstructor
public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<SupervisionTempLineRunTestMapper, SupervisionTempLineRunTestPO> implements ISupervisionTempLineRunTestService {
public static final String PROCESS_KEY = "line_run_test";
private final CommLineClient commLineClient;
private final SupervisionTempLineReportMapper supervisionTempLineReportMapper;
private final LineIntegrityClient lineIntegrityClient;
private final BpmProcessFeignClient bpmProcessFeignClient;
@Override
public Boolean addRunTest(SupervisionTempLineRunTestParam supervisionTempLineRunTestParam) {
List<String> ids = supervisionTempLineRunTestParam.getLineIds();
List<SupervisionTempLineReport> supervisionTempLineReportList = supervisionTempLineReportMapper.selectBatchIds(ids);
List<String> lineIds = supervisionTempLineReportList.stream().map(SupervisionTempLineReport::getLineId).collect(Collectors.toList());
List<LineDTO> lineDTOList = commLineClient.getLineDetailBatch(lineIds).getData();
if(lineIds.size()!=lineDTOList.size()){
throw new BusinessException("请联系管理员检查监测点唯一编号是否匹配");
}
//校验
List<SupervisionTempLineRunTestPO> supervisionTempLineRunTestPOList = this.list(new LambdaQueryWrapper<SupervisionTempLineRunTestPO>().in(SupervisionTempLineRunTestPO::getId,ids));
if(CollUtil.isNotEmpty(supervisionTempLineRunTestPOList)){
String msg = assMsg(supervisionTempLineReportList,supervisionTempLineRunTestPOList);
throw new BusinessException(msg);
}
List<SupervisionTempLineRunTestPO> poList = new ArrayList<>();
for(SupervisionTempLineReport item:supervisionTempLineReportList){
SupervisionTempLineRunTestPO supervisionTempLineRunTestPO = new SupervisionTempLineRunTestPO();
supervisionTempLineRunTestPO.setId(item.getId());
supervisionTempLineRunTestPO.setLineId(item.getLineId());
supervisionTempLineRunTestPO.setState(DataStateEnum.ENABLE.getCode());
supervisionTempLineRunTestPO.setStatus(9);
supervisionTempLineRunTestPO.setTestRunState(1);
supervisionTempLineRunTestPO.setSuitRate(0.00);
supervisionTempLineRunTestPO.setOnlineRate(0.00);
supervisionTempLineRunTestPO.setIntegrityRate(0.00);
supervisionTempLineRunTestPO.setTestRunTime(supervisionTempLineRunTestParam.getStartTime()+"--"+supervisionTempLineRunTestParam.getEndTime());
supervisionTempLineRunTestPO.setProcessInstanceId("tem暂无");
poList.add(supervisionTempLineRunTestPO);
}
this.saveBatch(poList);
return true;
}
@Override
public void isTestRunStartOrEnd() {
LocalDateTime time = LocalDateTime.now();
LambdaQueryWrapper<SupervisionTempLineRunTestPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupervisionTempLineRunTestPO::getTestRunState,1).eq(SupervisionTempLineRunTestPO::getState,DataStateEnum.ENABLE.getCode());
List<SupervisionTempLineRunTestPO> supervisionTempLineRunTestPOList = this.list(lambdaQueryWrapper);
List<SupervisionTempLineRunTestPO> usePoList = new ArrayList<>();
for(SupervisionTempLineRunTestPO item : supervisionTempLineRunTestPOList){
String endTime = item.getTestRunTime().split("--")[1];
LocalDateTime end = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
if(end.isBefore(time)){
//结束时间在当前时间之前,则已经执行完试运行,开始组装审核条件
usePoList.add(item);
}
}
if(CollUtil.isNotEmpty(usePoList)){
Map<String,List<SupervisionTempLineRunTestPO>> map = usePoList.stream().collect(Collectors.groupingBy(SupervisionTempLineRunTestPO::getTestRunTime));
map.forEach((key,val)->{
String startTime = key.split("--")[0];
String endTime = key.split("--")[1];
List<String> ids = val.stream().map(SupervisionTempLineRunTestPO::getLineId).collect(Collectors.toList());
LineDataQualityParam lineDataQualityParam = LineDataQualityParam.builder().lineIds(ids).beginTime(startTime).endTime(endTime).build();
List<LineDataQualityDTO> lineDataQualityDTOList = lineIntegrityClient.getLineDataQuality(lineDataQualityParam).getData();
Map<String,LineDataQualityDTO> qualityDTOMap = lineDataQualityDTOList.stream().collect(Collectors.toMap(LineDataQualityDTO::getLineId,Function.identity()));
for(SupervisionTempLineRunTestPO supervisionTempLineRunTestPO : val){
// 发起 BPM 流程
Map<String, Object> processInstanceVariables = new HashMap<>();
BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO();
bpmProcessInstanceCreateReqDTO.setProcessDefinitionKey(PROCESS_KEY);
bpmProcessInstanceCreateReqDTO.setBusinessKey(supervisionTempLineRunTestPO.getId());
bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(new HashMap<String, List<String>>());
bpmProcessInstanceCreateReqDTO.setVariables(processInstanceVariables);
String processInstanceId = bpmProcessFeignClient.createProcessInstance(supervisionTempLineRunTestPO.getCreateBy(),bpmProcessInstanceCreateReqDTO).getData();
// 将工作流的编号,更新到流程单中
SupervisionTempLineRunTestPO po = new SupervisionTempLineRunTestPO();
po.setId(supervisionTempLineRunTestPO.getId());
po.setProcessInstanceId(processInstanceId);
po.setStatus(1);
po.setTestRunState(2);
if(CollUtil.isEmpty(lineDataQualityDTOList)){
po.setOnlineRate(0.00);
po.setIntegrityRate(0.00);
po.setSuitRate(0.00);
}else {
po.setOnlineRate(qualityDTOMap.containsKey(supervisionTempLineRunTestPO.getLineId())?qualityDTOMap.get(supervisionTempLineRunTestPO.getLineId()).getOnlineRate():0.00);
po.setIntegrityRate(qualityDTOMap.containsKey(supervisionTempLineRunTestPO.getLineId())?qualityDTOMap.get(supervisionTempLineRunTestPO.getLineId()).getIntegrityRate():0.00);
po.setSuitRate(qualityDTOMap.containsKey(supervisionTempLineRunTestPO.getLineId())?qualityDTOMap.get(supervisionTempLineRunTestPO.getLineId()).getIntegrityRate():0.00);
}
this.baseMapper.updateById(po);
}
});
}
}
@Override
public void updateStatus(String businessKey, Integer status) {
SupervisionTempLineRunTestPO supervisionTempLineRunTestPO = this.baseMapper.selectById(businessKey);
//如果状态为审批通过
if (status.equals(BpmProcessInstanceStatusEnum.APPROVE.getStatus())) {
//通过,则需要远程将该装置调整为退运
supervisionTempLineRunTestPO.setStatus(status);
}
this.updateById(supervisionTempLineRunTestPO);
}
@Override
public SupervisionTempLineRunTestVO getRunTestById(String id) {
return this.baseMapper.getRunTestInfo(id);
}
private String assMsg(List<SupervisionTempLineReport> supervisionTempLineReportList,List<SupervisionTempLineRunTestPO> supervisionTempLineRunTestPOList){
StringBuilder builder = new StringBuilder();
Map<String,SupervisionTempLineReport> map = supervisionTempLineReportList.stream().collect(Collectors.toMap(SupervisionTempLineReport::getId, Function.identity()));
List<String> ids = supervisionTempLineRunTestPOList.stream().map(SupervisionTempLineRunTestPO::getId).collect(Collectors.toList());
for(String id:ids){
if(map.containsKey(id)){
builder.append(map.get(id).getPowerSubstationName()).append("_").append(map.get(id).getLineName()).append(";");
}
}
return builder.toString();
}
}