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 Server = 1;
public static final Integer Client = 0; public static final Integer Client = 0;
public static final Integer TypeYSP = 1;
public static String Float = "float"; public static String Float = "float";
public static String Int = "int"; public static String Int = "int";
public static String Varchar = "varchar"; public static String Varchar = "varchar";

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

Loading…
Cancel
Save