状态统一管理,舍弃单独监听器
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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.BusinessCommonFeignClientFallbackFactory;
|
||||
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 = "/supervision", fallbackFactory = BusinessCommonFeignClientFallbackFactory.class)
|
||||
public interface BusinessCommonFeignClient {
|
||||
|
||||
/**
|
||||
* 根据流程key,业务id去实时更新流程状态
|
||||
* @param processKey 流程定义key
|
||||
* @param businessId 业务id
|
||||
* @param status 目标状态
|
||||
*/
|
||||
@GetMapping("/updateProcessStatus")
|
||||
HttpResult<Object> updateProcessStatus(@RequestParam("processKey") String processKey,@RequestParam("businessId") String businessId, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
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 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 = "/deVReport", fallbackFactory = DeVReportManageFeignClientFallbackFactory.class)
|
||||
public interface DeVReportManageFeignClient {
|
||||
|
||||
@GetMapping("/updateStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
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.GeneralSurveyFeignClientFallbackFactory;
|
||||
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 = "/generalSurvey", fallbackFactory = GeneralSurveyFeignClientFallbackFactory.class)
|
||||
public interface GeneralSurveyFeignClient {
|
||||
|
||||
@GetMapping("/updateStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
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.SupervisionPlanFeignClientFallbackFactory;
|
||||
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 = "/superPlan", fallbackFactory = SupervisionPlanFeignClientFallbackFactory.class)
|
||||
public interface SupervisionPlanFeignClient {
|
||||
|
||||
@GetMapping("/updateStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
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.SurveyPlanFeignClientFallbackFactory;
|
||||
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 = "/surveyPlan", fallbackFactory = SurveyPlanFeignClientFallbackFactory.class)
|
||||
public interface SurveyPlanFeignClient {
|
||||
|
||||
@GetMapping("/updateSurveyPlanStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
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.SurveyPlanFeignClientFallbackFactory;
|
||||
import com.njcn.supervision.api.fallback.SurveyTestFeignClientFallbackFactory;
|
||||
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 = "/surveyTest", fallbackFactory = SurveyTestFeignClientFallbackFactory.class)
|
||||
public interface SurveyTestFeignClient {
|
||||
|
||||
@GetMapping("/updateSurveyTestStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
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 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 = "/tempLinedebug", fallbackFactory = TempLineDebugFeignClientFallbackFactory.class)
|
||||
public interface TempLineDebugFeignClient {
|
||||
|
||||
@GetMapping("/updateStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
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.TempLineFeignClientFallbackFactory;
|
||||
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 = "/tempLine", fallbackFactory = TempLineFeignClientFallbackFactory.class)
|
||||
public interface TempLineFeignClient {
|
||||
|
||||
@GetMapping("/updateStatus")
|
||||
HttpResult<Object> updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,24 +1,18 @@
|
||||
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);
|
||||
|
||||
@GetMapping("/isTestRunStartOrEnd")
|
||||
void isTestRunStartOrEnd();
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
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.UserReportFeignClientFallbackFactory;
|
||||
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 = "/userReport", fallbackFactory = UserReportFeignClientFallbackFactory.class)
|
||||
public interface UserReportFeignClient {
|
||||
|
||||
@GetMapping("/updateUserReportStatus")
|
||||
HttpResult<Object> updateUserReportStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
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.UserReportNoramlFeignClientFallbackFactory;
|
||||
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 = "/userReportNormal", fallbackFactory = UserReportNoramlFeignClientFallbackFactory.class)
|
||||
public interface UserReportNormalFeignClient {
|
||||
|
||||
@GetMapping("/updateUserReportNormalStatus")
|
||||
HttpResult<Object> updateUserReportNormalStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status);
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -3,17 +3,18 @@ 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.api.BusinessCommonFeignClient;
|
||||
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> {
|
||||
public class BusinessCommonFeignClientFallbackFactory implements FallbackFactory<BusinessCommonFeignClient> {
|
||||
@Override
|
||||
public WarningLeafletFeignClient create(Throwable throwable) {
|
||||
public BusinessCommonFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
@@ -21,9 +22,9 @@ public class WarningLeafletFeignClientFallbackFactory implements FallbackFactory
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new WarningLeafletFeignClient() {
|
||||
return new BusinessCommonFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
public HttpResult<Object> updateProcessStatus(String processKey,String businessId, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
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.DeVReportManageFeignClient;
|
||||
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 DeVReportManageFeignClientFallbackFactory implements FallbackFactory<DeVReportManageFeignClient> {
|
||||
@Override
|
||||
public DeVReportManageFeignClient 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 DeVReportManageFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
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.GeneralSurveyFeignClient;
|
||||
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 GeneralSurveyFeignClientFallbackFactory implements FallbackFactory<GeneralSurveyFeignClient> {
|
||||
@Override
|
||||
public GeneralSurveyFeignClient 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 GeneralSurveyFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新普测计划流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
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.SupervisionPlanFeignClient;
|
||||
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 SupervisionPlanFeignClientFallbackFactory implements FallbackFactory<SupervisionPlanFeignClient> {
|
||||
@Override
|
||||
public SupervisionPlanFeignClient 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 SupervisionPlanFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新退运装置数据流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
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.SurveyPlanFeignClient;
|
||||
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 SurveyPlanFeignClientFallbackFactory implements FallbackFactory<SurveyPlanFeignClient> {
|
||||
@Override
|
||||
public SurveyPlanFeignClient 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 SurveyPlanFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新普测计划流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
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.SurveyTestFeignClient;
|
||||
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 SurveyTestFeignClientFallbackFactory implements FallbackFactory<SurveyTestFeignClient> {
|
||||
@Override
|
||||
public SurveyTestFeignClient 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 SurveyTestFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新退运装置数据流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
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.TempLineDebugFeignClient;
|
||||
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 TempLineDebugFeignClientFallbackFactory implements FallbackFactory<TempLineDebugFeignClient> {
|
||||
@Override
|
||||
public TempLineDebugFeignClient 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 TempLineDebugFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
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.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 TempLineFeignClientFallbackFactory implements FallbackFactory<TempLineFeignClient> {
|
||||
@Override
|
||||
public TempLineFeignClient 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 TempLineFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -3,18 +3,13 @@ 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> {
|
||||
@@ -28,11 +23,6 @@ public class TempLineRunTestFeignClientFallbackFactory implements FallbackFactor
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new TempLineRunTestFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isTestRunStartOrEnd() {
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
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.UserReportFeignClient;
|
||||
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 UserReportFeignClientFallbackFactory implements FallbackFactory<UserReportFeignClient> {
|
||||
@Override
|
||||
public UserReportFeignClient 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 UserReportFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateUserReportStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新用户数据流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
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.UserReportNormalFeignClient;
|
||||
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 UserReportNoramlFeignClientFallbackFactory implements FallbackFactory<UserReportNormalFeignClient> {
|
||||
@Override
|
||||
public UserReportNormalFeignClient 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 UserReportNormalFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Object> updateUserReportNormalStatus(String businessKey, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "更新用户数据流程状态", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user