1.谐波高级算法远程调用提交
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.njcn.advance.api;
|
||||
|
||||
import com.njcn.advance.api.fallback.EventWaveAnalysisFeignClientFallbackFactory;
|
||||
import com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
@FeignClient(value = ServerInfo.ADVANCE_BOOT,path = "/waveAnalysis",fallbackFactory = EventWaveAnalysisFeignClientFallbackFactory.class,contextId = "waveAnalysis")
|
||||
public interface EventWaveAnalysisFeignClient {
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 波形高级分析
|
||||
* @param eventIndex
|
||||
* @return: com.njcn.common.pojo.response.HttpResult<com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData>
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 14:23
|
||||
*/
|
||||
@PostMapping("analysis")
|
||||
HttpResult<EntityAdvancedData> analysis(@RequestParam("eventIndex") String eventIndex);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.njcn.advance.api.fallback;
|
||||
|
||||
import com.njcn.advance.api.EventWaveAnalysisFeignClient;
|
||||
import com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData;
|
||||
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.utils.EventlEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class EventWaveAnalysisFeignClientFallbackFactory implements FallbackFactory<EventWaveAnalysisFeignClient> {
|
||||
@Override
|
||||
public EventWaveAnalysisFeignClient 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 EventWaveAnalysisFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<EntityAdvancedData> analysis(String eventIndex) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "波形高级分析", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -47,5 +47,7 @@ public interface ServerInfo {
|
||||
|
||||
String CS_ZL_EVENT_BOOT = "zl-event-boot";
|
||||
|
||||
String ADVANCE_BOOT = "advance-boot";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -74,7 +74,8 @@ public class Knife4jSwaggerConfig {
|
||||
"com.njcn.advance.controller",
|
||||
"com.njcn.stat.controller",
|
||||
"com.njcn.rt.controller",
|
||||
"com.njcn.zlevent.controller"
|
||||
"com.njcn.zlevent.controller",
|
||||
"com.njcn.cloud.controller"
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
List<GrantType> grantTypes = new ArrayList<>();
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.njcn.device.pq.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.api.fallback.DeviceTreeClientFallbackFactory;
|
||||
import com.njcn.device.pq.api.fallback.AlarmClientFallbackFactory;
|
||||
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
* @author yzh
|
||||
* @date 2022/9/19
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.DEVICE, path = "/Alarm", fallbackFactory = DeviceTreeClientFallbackFactory.class, contextId = "Alarm")
|
||||
@FeignClient(value = ServerInfo.DEVICE, path = "/Alarm", fallbackFactory = AlarmClientFallbackFactory.class, contextId = "Alarm")
|
||||
public interface AlarmClient {
|
||||
|
||||
/**
|
||||
|
||||
@@ -727,7 +727,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
if(StrUtil.isNotBlank(str)) {
|
||||
String[] split = str.split("_");
|
||||
if("succeed".equals(split[0])){
|
||||
maps.put("succeed", "000000");
|
||||
maps.put("succeed", "1");
|
||||
}else{
|
||||
maps.put("error", split[1]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user