fix:1.添加能谱错误事件类型
This commit is contained in:
parent
43381353b8
commit
0e7d84dbcb
|
@ -5,6 +5,7 @@ import cn.hutool.core.io.FileUtil;
|
|||
import org.jeecg.common.constant.StringConstant;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.modules.eneity.event.SpectrumErrorEvent;
|
||||
import org.jeecg.modules.enums.ErrorEventType;
|
||||
import org.jeecg.modules.enums.ErrorType;
|
||||
import java.io.File;
|
||||
|
||||
|
@ -46,6 +47,7 @@ public class ErrorLogManager {
|
|||
String errorContent = "";
|
||||
//文件名称
|
||||
String fileName = "";
|
||||
if(event.getEventType() == ErrorEventType.STATIC_EVENT.getEventType()){
|
||||
//台站找不到,格式化报错信息
|
||||
if(event.getErrorType().equals(ErrorType.STATION_ERROR)){
|
||||
errorContent = String.format(ErrorType.STATION_ERROR.getContent(),event.getFormatArgs());
|
||||
|
@ -60,6 +62,10 @@ public class ErrorLogManager {
|
|||
}else{
|
||||
fileName = event.getFileName().substring(0,event.getFileName().lastIndexOf(StringConstant.DOT))+SUFFIX;
|
||||
}
|
||||
}else if(event.getEventType() == ErrorEventType.DYNAMIC_EVENT.getEventType()){
|
||||
errorContent = event.getDynamicErrorContent();
|
||||
}
|
||||
|
||||
|
||||
StringBuilder logFilePath = new StringBuilder();
|
||||
logFilePath.append(spectrumPathProperties.getRootPath());
|
||||
|
|
|
@ -1,22 +1,36 @@
|
|||
package org.jeecg.modules.eneity.event;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.jeecg.modules.enums.ErrorEventType;
|
||||
import org.jeecg.modules.enums.ErrorType;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
public class SpectrumErrorEvent {
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
* 0:静态枚举(默认),1:动态内容
|
||||
*/
|
||||
@Setter @Getter
|
||||
private int eventType;
|
||||
|
||||
@Setter @Getter
|
||||
private Date time;
|
||||
|
||||
/**
|
||||
* eventType 为0时内容为静态枚举类型
|
||||
*/
|
||||
@Setter @Getter
|
||||
private ErrorType errorType;
|
||||
|
||||
/**
|
||||
* eventType 为1时内容为动态传入内容
|
||||
*/
|
||||
@Setter @Getter
|
||||
private String dynamicErrorContent;
|
||||
|
||||
@Setter @Getter
|
||||
private String fileName;
|
||||
|
||||
|
@ -25,10 +39,18 @@ public class SpectrumErrorEvent {
|
|||
|
||||
public SpectrumErrorEvent() {}
|
||||
|
||||
public SpectrumErrorEvent(Date time,String dynamicErrorContent,String fileName) {
|
||||
this.time = time;
|
||||
this.dynamicErrorContent = dynamicErrorContent;
|
||||
this.fileName = fileName;
|
||||
this.setEventType(ErrorEventType.DYNAMIC_EVENT.getEventType());
|
||||
}
|
||||
|
||||
public SpectrumErrorEvent(Date time,ErrorType errorType,String fileName) {
|
||||
this.time = time;
|
||||
this.errorType = errorType;
|
||||
this.fileName = fileName;
|
||||
this.setEventType(ErrorEventType.STATIC_EVENT.getEventType());
|
||||
}
|
||||
|
||||
public SpectrumErrorEvent(Date time,ErrorType errorType,String fileName,String... formatArgs) {
|
||||
|
@ -36,6 +58,6 @@ public class SpectrumErrorEvent {
|
|||
this.errorType = errorType;
|
||||
this.fileName = fileName;
|
||||
this.formatArgs = formatArgs;
|
||||
this.setEventType(ErrorEventType.STATIC_EVENT.getEventType());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package org.jeecg.modules.enums;
|
||||
|
||||
/**
|
||||
* 错误事件类型
|
||||
*/
|
||||
public enum ErrorEventType {
|
||||
|
||||
/**
|
||||
* 静态错误事件header、acq等
|
||||
*/
|
||||
STATIC_EVENT(0),
|
||||
/**
|
||||
* 动态错误事件,手动传入
|
||||
*/
|
||||
DYNAMIC_EVENT(1);
|
||||
|
||||
private int eventType;
|
||||
|
||||
ErrorEventType(int eventType) {
|
||||
this.eventType = eventType;
|
||||
}
|
||||
|
||||
public int getEventType(){
|
||||
return this.eventType;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user