perf: 调整谱图文件类型判断

dev
huangfeng 2 months ago
parent 3c2442c353
commit a6b1def256

@ -13,8 +13,6 @@ public class Constants {
public static final Integer Server = 1;
public static final Integer Client = 0;
public static final Integer TypeYSP = 1;
public static String Float = "float";
public static String Int = "int";
public static String Varchar = "varchar";

@ -2,9 +2,9 @@ package com.xydl.cac.spectrogram;
import com.xydl.cac.config.BizConfig;
import com.xydl.cac.entity.IedDlRecord;
import com.xydl.cac.entity.constants.Constants;
import com.xydl.cac.entity.ModevType;
import com.xydl.cac.model.spectrogram.SouthYsp;
import com.xydl.cac.util.DataUtil;
import com.xydl.cac.service.ModevTypeService;
import com.xydl.cac.util.DateUtil;
import com.xydl.cac.util.JSONUtil;
import lombok.extern.slf4j.Slf4j;
@ -21,6 +21,8 @@ public class SpectrogramHandler {
BizConfig bizConfig;
@Resource
ProcessorYsp processorYsp;
@Resource
ModevTypeService modevTypeService;
public void processFile(IedDlRecord record) {
if (record.getTypeId() == null) {
@ -28,8 +30,10 @@ public class SpectrogramHandler {
}
String localFilePath = record.getPath().replaceFirst(bizConfig.getDataNginxPath(), bizConfig.getDatapath());
try {
ModevType modevType = modevTypeService.detail(record.getTypeId());
// 油色谱谱图
if (record.getTypeId() == Constants.TypeYSP) {
if (modevType.getMc().contains("油色谱")) {
SouthYsp model = processorYsp.process(localFilePath);
String json = JSONUtil.object2Json(model);
record.setData(json);
@ -41,6 +45,8 @@ public class SpectrogramHandler {
} catch (Exception ignore) {
}
log.info("解析油色谱谱图文件成功");
} else if (modevType.getMc().contains("局部放电")) {
} else {
log.error("缺少该类型" + record.getTypeId() + "的谱图处理模块");
}
@ -58,10 +64,13 @@ public class SpectrogramHandler {
return;
}
try {
if (Constants.TypeYSP == record.getTypeId()) {
ModevType modevType = modevTypeService.detail(record.getTypeId());
if (modevType.getMc().contains("油色谱")) {
SouthYsp model = JSONUtil.json2Object(record.getData(), SouthYsp.class);
record.setModel(model);
record.setData(null);
} else if (modevType.getMc().contains("局部放电")) {
}
} catch (Exception ex) {
log.error("谱图数据data内容存在异常, typeId=" + record.getTypeId() + ", devId=" + record.getDevId()

Loading…
Cancel
Save