高级算法特征值,暂降事件范围分析代码提交
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package com.njcn.event.api;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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.event.api.fallback.EventDetailFeignClientFallbackFactory;
|
||||
import com.njcn.event.api.fallback.RmpEventDetailFeignClientFallbackFactory;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||
import com.njcn.event.pojo.vo.GeneralVO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.EVENT,path = "/rmpEventDetail",fallbackFactory = RmpEventDetailFeignClientFallbackFactory.class)
|
||||
public interface RmpEventDetailFeignClient {
|
||||
|
||||
|
||||
/**
|
||||
* 获取暂降事件详细信息
|
||||
* @param eventId 暂态事件id
|
||||
* @author cdf
|
||||
* @date 2023/7/28
|
||||
*/
|
||||
@GetMapping("/queryEventDetailByEventId")
|
||||
HttpResult<RmpEventDetailPO> queryEventDetailByEventId(@RequestParam("eventId")String eventId);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.njcn.event.api.fallback;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.event.api.EventDetailFeignClient;
|
||||
import com.njcn.event.api.RmpEventDetailFeignClient;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||
import com.njcn.event.pojo.vo.GeneralVO;
|
||||
import com.njcn.event.utils.EventlEnumUtil;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @date 2023/07/21
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RmpEventDetailFeignClientFallbackFactory implements FallbackFactory<RmpEventDetailFeignClient> {
|
||||
@Override
|
||||
public RmpEventDetailFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = EventlEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new RmpEventDetailFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<RmpEventDetailPO> queryEventDetailByEventId(String eventId) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "查询暂降明细", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user