预告警单增加问题详细描述
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package com.njcn.bpm.listener.business;
|
||||
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent;
|
||||
import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener;
|
||||
import com.njcn.supervision.api.DeVReportManageFeignClient;
|
||||
import com.njcn.supervision.api.WarningLeafletFeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Component
|
||||
public class BpmWarningLeafletStatusListener extends BpmProcessInstanceStatusEventListener {
|
||||
|
||||
@Resource
|
||||
private WarningLeafletFeignClient warningLeafletFeignClient;
|
||||
|
||||
@Override
|
||||
protected String getProcessDefinitionKey() {
|
||||
return "warn_leaflet";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||
warningLeafletFeignClient.updateStatus(event.getBusinessKey(), event.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.DeVReportManageFeignClientFallbackFactory;
|
||||
import com.njcn.supervision.api.fallback.WarningLeafletFeignClientFallbackFactory;
|
||||
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 = "/warningLeaflet", fallbackFactory = WarningLeafletFeignClientFallbackFactory.class)
|
||||
public interface WarningLeafletFeignClient {
|
||||
|
||||
@GetMapping("/updateStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
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.WarningLeafletFeignClient;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class WarningLeafletFeignClientFallbackFactory implements FallbackFactory<WarningLeafletFeignClient> {
|
||||
@Override
|
||||
public WarningLeafletFeignClient 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 WarningLeafletFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,8 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -75,6 +77,8 @@ public class WarningLeafletParam extends BaseEntity implements Serializable{
|
||||
@ApiModelProperty(value = "问题详细描述")
|
||||
private String issueDetail;
|
||||
|
||||
@ApiModelProperty("发起人自选审批人 Map")
|
||||
private Map<String, List<String>> startUserSelectAssignees;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -100,6 +104,8 @@ public class WarningLeafletParam extends BaseEntity implements Serializable{
|
||||
@NotBlank(message = "处理成效报告不能为空")
|
||||
private String reportPath;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,12 +59,26 @@ public class WarningLeafletVO extends BaseEntity implements Serializable{
|
||||
*/
|
||||
private String takeStep;
|
||||
|
||||
/**
|
||||
* 问题文件
|
||||
*/
|
||||
private String problemPath;
|
||||
|
||||
/**
|
||||
* 问题文件
|
||||
*/
|
||||
private String problemName;
|
||||
|
||||
/**
|
||||
* 处理成效报告
|
||||
*/
|
||||
private String reportPath;
|
||||
|
||||
/**
|
||||
* 处理成效报告
|
||||
*/
|
||||
private String reportName;
|
||||
|
||||
/**
|
||||
* 流程实例的编号
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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