预告警单增加问题详细描述

This commit is contained in:
2024-05-22 16:30:22 +08:00
parent 41e6d2efb8
commit b7e291398b
8 changed files with 212 additions and 3 deletions

View File

@@ -3,10 +3,14 @@ package com.njcn.supervision.controller.leaflet;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.QuitRunningDeviceParam;
import com.njcn.supervision.pojo.vo.device.QuitRunningDeviceVO;
import com.njcn.supervision.pojo.vo.leaflet.WarningLeafletVO;
import com.njcn.harmonic.pojo.dto.RMpPartHarmonicDetailDTO;
import com.njcn.supervision.pojo.param.leaflet.WarningLeafletParam;
import com.njcn.supervision.pojo.vo.leaflet.WarningLeafletVO;
@@ -15,9 +19,14 @@ import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.njcn.web.controller.BaseController;
import springfox.documentation.annotations.ApiIgnore;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -71,5 +80,35 @@ public class WarningLeafletController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@PostMapping("/addFeedback")
@ApiOperation("上传反馈单")
@ApiImplicitParam(name = "warningLeafletUpdateParam", value = "实体参数", required = true)
public HttpResult<Object> addFeedback(@RequestBody @Validated WarningLeafletParam.WarningLeafletUpdateParam warningLeafletUpdateParam) {
String methodDescribe = getMethodDescribe("addFeedback");
warningLeafletService.addFeedback(warningLeafletUpdateParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@GetMapping("/getById")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "根据id获取预告警单的详细数据")
public HttpResult<WarningLeafletVO> getById(String id) {
String methodDescribe = getMethodDescribe("getById");
WarningLeafletVO warningLeafletVO = warningLeafletService.getVOById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, warningLeafletVO, methodDescribe);
}
@ApiIgnore
@GetMapping("/updateStatus")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@Operation(summary = "更改表单状态")
public HttpResult<Object> updateStatus(String businessKey,Integer status) {
String methodDescribe = getMethodDescribe("updateStatus");
warningLeafletService.updateStatus(businessKey,status);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

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

View File

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