1.录波文件下载处理;
2.装置异常告警事件处理
This commit is contained in:
@@ -15,4 +15,8 @@ public interface EventFeignClient {
|
||||
|
||||
@PostMapping("/analysis")
|
||||
HttpResult<String> analysis(AppEventMessage appEventMessage);
|
||||
|
||||
@PostMapping("/errorEvent")
|
||||
HttpResult<String> insertErrorEvent(AppEventMessage appEventMessage);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.zlevent.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.mq.message.AppEventMessage;
|
||||
import com.njcn.zlevent.api.fallback.EvtErrorClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_ZL_EVENT_BOOT, path = "/csDevErrEvt", fallbackFactory = EvtErrorClientFallbackFactory.class,contextId = "csDevErrEvt")
|
||||
public interface EvtErrorFeignClient {
|
||||
|
||||
@PostMapping("/errorEvent")
|
||||
HttpResult<String> insertErrorEvent(AppEventMessage appEventMessage);
|
||||
|
||||
}
|
||||
@@ -3,14 +3,14 @@ package com.njcn.zlevent.api;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.mq.message.AppEventMessage;
|
||||
import com.njcn.zlevent.api.fallback.EventClientFallbackFactory;
|
||||
import com.njcn.zlevent.api.fallback.WaveClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_ZL_EVENT_BOOT, path = "/wave", fallbackFactory = EventClientFallbackFactory.class,contextId = "wave")
|
||||
@FeignClient(value = ServerInfo.CS_ZL_EVENT_BOOT, path = "/wave", fallbackFactory = WaveClientFallbackFactory.class,contextId = "wave")
|
||||
public interface WaveFeignClient {
|
||||
|
||||
@PostMapping("/analysis")
|
||||
|
||||
@@ -30,6 +30,12 @@ public class EventClientFallbackFactory implements FallbackFactory<EventFeignCli
|
||||
log.error("{}异常,降级处理,异常为:{}","数据解析",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<String> insertErrorEvent(AppEventMessage appEventMessage) {
|
||||
log.error("{}异常,降级处理,异常为:{}","异常事件统计",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.njcn.zlevent.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.mq.message.AppEventMessage;
|
||||
import com.njcn.zlevent.api.EvtErrorFeignClient;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class EvtErrorClientFallbackFactory implements FallbackFactory<EvtErrorFeignClient> {
|
||||
@Override
|
||||
public EvtErrorFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new EvtErrorFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<String> insertErrorEvent(AppEventMessage appEventMessage) {
|
||||
log.error("{}异常,降级处理,异常为:{}","异常事件统计",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.mq.message.AppEventMessage;
|
||||
import com.njcn.zlevent.api.EventFeignClient;
|
||||
import com.njcn.zlevent.api.WaveFeignClient;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -14,16 +15,16 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class WaveClientFallbackFactory implements FallbackFactory<EventFeignClient> {
|
||||
public class WaveClientFallbackFactory implements FallbackFactory<WaveFeignClient> {
|
||||
@Override
|
||||
public EventFeignClient create(Throwable cause) {
|
||||
public WaveFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new EventFeignClient() {
|
||||
return new WaveFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<String> analysis(AppEventMessage appEventMessage) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
@@ -22,6 +23,6 @@ public class FileStreamDto implements Serializable {
|
||||
|
||||
private Integer frameLen;
|
||||
|
||||
private List<Integer> list;
|
||||
private Set<Integer> list;
|
||||
|
||||
}
|
||||
|
||||
@@ -12,8 +12,12 @@ import lombok.Data;
|
||||
@Data
|
||||
public class WaveTimeDto {
|
||||
|
||||
private String fileName;
|
||||
|
||||
private String deviceId;
|
||||
|
||||
private String nDid;
|
||||
|
||||
private String lineId;
|
||||
|
||||
private String startTime;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.njcn.zlevent.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 装置异常事件统计
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-09-12
|
||||
*/
|
||||
@Data
|
||||
@TableName("cs_dev_err_evt")
|
||||
public class CsDevErrEvt {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 设备识别码
|
||||
*/
|
||||
private String ndid;
|
||||
|
||||
/**
|
||||
* 事件发生时间
|
||||
*/
|
||||
private LocalDateTime evtTime;
|
||||
|
||||
/**
|
||||
* 事件code编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user