预告警单增加问题详细描述
This commit is contained in:
@@ -32,5 +32,11 @@ public interface IWarningLeafletService extends IService<WarningLeaflet> {
|
||||
|
||||
Page<WarningLeafletVO> warningPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam);
|
||||
|
||||
void addFeedback(WarningLeafletParam.WarningLeafletUpdateParam warningLeafletUpdateParam);
|
||||
|
||||
WarningLeafletVO getVOById(String id);
|
||||
|
||||
void updateStatus(String businessKey, Integer status);
|
||||
|
||||
String addLineOverLimitData(RMpPartHarmonicDetailDTO rMpPartHarmonicDetailDTO);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.supervision.service.leaflet.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
@@ -7,6 +8,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.bpm.api.BpmProcessFeignClient;
|
||||
import com.njcn.bpm.enums.BpmTaskStatusEnum;
|
||||
import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.harmonic.pojo.dto.RMpPartHarmonicDetailDTO;
|
||||
import com.njcn.supervision.enums.FlowStatusEnum;
|
||||
@@ -15,8 +19,10 @@ import com.njcn.supervision.enums.ProblemTypeEnum;
|
||||
import com.njcn.supervision.mapper.leaflet.WarningLeafletMapper;
|
||||
import com.njcn.supervision.pojo.param.leaflet.WarningLeafletParam;
|
||||
import com.njcn.supervision.pojo.po.leaflet.WarningLeaflet;
|
||||
import com.njcn.supervision.pojo.po.survey.SupervisionGeneralSurveyPlanPO;
|
||||
import com.njcn.supervision.pojo.vo.leaflet.WarningLeafletVO;
|
||||
import com.njcn.supervision.service.leaflet.IWarningLeafletService;
|
||||
import com.njcn.supervision.service.survey.SupervisionGeneralSurveyPlanPOService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
@@ -24,10 +30,15 @@ import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -40,11 +51,22 @@ import java.util.stream.Collectors;
|
||||
* @since 2024-05-21
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper, WarningLeaflet> implements IWarningLeafletService {
|
||||
@Resource
|
||||
private UserFeignClient userFeignClient;
|
||||
@Resource
|
||||
private DicDataFeignClient dicDataFeignClient;
|
||||
@Resource
|
||||
private BpmProcessFeignClient bpmProcessFeignClient;
|
||||
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
@Lazy
|
||||
@Resource
|
||||
private SupervisionGeneralSurveyPlanPOService supervisionGeneralSurveyPlanPOService;
|
||||
|
||||
/**
|
||||
* 预告警单的反馈单对应的流程定义 KEY
|
||||
*/
|
||||
public static final String PROCESS_KEY = "warn_leaflet";
|
||||
|
||||
/**
|
||||
* 不创建工作流,只是创建一个告警单,需要待用户反馈后才会进入流程
|
||||
@@ -81,6 +103,45 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
|
||||
return this.baseMapper.warningPageData(new Page<>(PageFactory.getPageNum(warningLeafletQueryParam), PageFactory.getPageSize(warningLeafletQueryParam)), warningLeafletVOQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addFeedback(WarningLeafletParam.WarningLeafletUpdateParam warningLeafletUpdateParam) {
|
||||
WarningLeaflet warningLeaflet = this.baseMapper.selectById(warningLeafletUpdateParam.getId());
|
||||
warningLeaflet.setTakeStep(warningLeafletUpdateParam.getTakeStep());
|
||||
warningLeaflet.setReportPath(warningLeafletUpdateParam.getReportPath());
|
||||
warningLeaflet.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO();
|
||||
bpmProcessInstanceCreateReqDTO.setProcessDefinitionKey(PROCESS_KEY);
|
||||
bpmProcessInstanceCreateReqDTO.setBusinessKey(warningLeaflet.getId());
|
||||
bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(warningLeafletUpdateParam.getStartUserSelectAssignees());
|
||||
bpmProcessInstanceCreateReqDTO.setVariables(processInstanceVariables);
|
||||
String processInstanceId = bpmProcessFeignClient.createProcessInstance(RequestUtil.getUserIndex(), bpmProcessInstanceCreateReqDTO).getData();
|
||||
// 将工作流的编号,更新到流程单中
|
||||
warningLeaflet.setProcessInstanceId(processInstanceId);
|
||||
this.baseMapper.updateById(warningLeaflet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarningLeafletVO getVOById(String id) {
|
||||
WarningLeaflet warningLeaflet = this.getById(id);
|
||||
WarningLeafletVO vo = new WarningLeafletVO();
|
||||
BeanUtil.copyProperties(warningLeaflet,vo);
|
||||
if(warningLeaflet.getProblemType().equals(ProblemTypeEnum.SITE_TEST.getCode())){
|
||||
String problemId = warningLeaflet.getProblemId();
|
||||
//查询谐波普测,获取该普测计划上传的文件
|
||||
SupervisionGeneralSurveyPlanPO generalSurveyPlanPO = supervisionGeneralSurveyPlanPOService.getById(problemId);
|
||||
vo.setProblemPath(generalSurveyPlanPO.getFilePath());
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(String businessKey, Integer status) {
|
||||
this.lambdaUpdate().set(WarningLeaflet::getStatus, status).eq(WarningLeaflet::getId, businessKey).update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WarningLeafletVO> alarmPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) {
|
||||
QueryWrapper<WarningLeafletVO> warningLeafletVOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
Reference in New Issue
Block a user