设备退运工作流程完成
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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.QuitRunningDeviceFeignClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
* @author hongawen
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/quitRunningDevice", fallbackFactory = QuitRunningDeviceFeignClientFallbackFactory.class)
|
||||
public interface QuitRunningDeviceFeignClient {
|
||||
|
||||
@GetMapping("/updateDeviceStatus")
|
||||
HttpResult<Object> updateDeviceStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -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.QuitRunningDeviceFeignClient;
|
||||
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 QuitRunningDeviceFeignClientFallbackFactory implements FallbackFactory<QuitRunningDeviceFeignClient> {
|
||||
@Override
|
||||
public QuitRunningDeviceFeignClient 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 QuitRunningDeviceFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateDeviceStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新退运装置数据流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,15 @@ public class QuitRunningDeviceVO extends BaseEntity implements Serializable{
|
||||
@ApiModelProperty(value = "设备编号")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("供电公司名称")
|
||||
private String gdName;
|
||||
|
||||
@ApiModelProperty("变电站名称")
|
||||
private String subName;
|
||||
|
||||
@ApiModelProperty("母线名称")
|
||||
private String volName;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@@ -42,6 +51,12 @@ public class QuitRunningDeviceVO extends BaseEntity implements Serializable{
|
||||
@ApiModelProperty(value = "设备类型")
|
||||
private Integer deviceType;
|
||||
|
||||
/**
|
||||
* 设备状态
|
||||
*/
|
||||
@ApiModelProperty(value = "设备状态")
|
||||
private Integer deviceStatus;
|
||||
|
||||
/**
|
||||
* 资产编号
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user