配置错误返回修改
This commit is contained in:
parent
0a70a9a7d8
commit
7051ec9f39
@ -19,7 +19,7 @@ public interface FaultRecorderService {
|
|||||||
|
|
||||||
void download(String path, HttpServletResponse httpServletResponse) throws IOException;
|
void download(String path, HttpServletResponse httpServletResponse) throws IOException;
|
||||||
|
|
||||||
Map<String, List<Object>> getDataCurve(String url, String deviceCode) throws IOException;
|
Map<String, List<Object>> getDataCurve(String url, String deviceCode);
|
||||||
|
|
||||||
void updateFdrConfig(SysEquipment sysEquipment);
|
void updateFdrConfig(SysEquipment sysEquipment);
|
||||||
|
|
||||||
|
@ -168,30 +168,31 @@ public class FaultRecorderServiceImpl implements FaultRecorderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, List<Object>> getDataCurve(String url, String deviceCode) throws IOException {
|
public Map<String, List<Object>> getDataCurve(String url, String deviceCode) {
|
||||||
Map<String, List<Object>> resultMap = null;
|
Map<String, List<Object>> resultMap = null;
|
||||||
try (InputStream fileStream = minioViewsServcie.getFileStream(url)) {
|
//根据device Code查询故障录波格式
|
||||||
//根据device Code查询故障录波格式
|
QueryWrapper<SysEquipment> queryWrapper = new QueryWrapper<>();
|
||||||
QueryWrapper<SysEquipment> queryWrapper = new QueryWrapper<>();
|
queryWrapper.eq("CODE", deviceCode);
|
||||||
queryWrapper.eq("CODE", deviceCode);
|
SysEquipment sysEquipment = sysEquipmentMapper.selectOne(queryWrapper);
|
||||||
SysEquipment sysEquipment = sysEquipmentMapper.selectOne(queryWrapper);
|
if (sysEquipment == null) {
|
||||||
if (sysEquipment == null) {
|
throw new ServiceException("设备不存在,请选择正确设备");
|
||||||
throw new ServiceException("设备不存在,请选择正确设备");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isBlank(sysEquipment.getOptions())){
|
if (StringUtils.isBlank(sysEquipment.getOptions())){
|
||||||
throw new ServiceException("请添加设备文件解析配置");
|
throw new ServiceException("请添加设备文件解析配置");
|
||||||
}
|
}
|
||||||
FileParseConfig fileParseConfig = JSON.parseObject(sysEquipment.getOptions(), FileParseConfig.class);
|
FileParseConfig fileParseConfig = JSON.parseObject(sysEquipment.getOptions(), FileParseConfig.class);
|
||||||
FdrFormatVo fdrFormatVo = fileParseConfig.getFdrFormat();
|
FdrFormatVo fdrFormatVo = fileParseConfig.getFdrFormat();
|
||||||
if (fdrFormatVo == null){
|
if (fdrFormatVo == null){
|
||||||
throw new ServiceException("请添加故障录波配置");
|
throw new ServiceException("请添加故障录波配置");
|
||||||
}
|
}
|
||||||
|
try (InputStream fileStream = minioViewsServcie.getFileStream(url)) {
|
||||||
// 解析文件内容
|
// 解析文件内容
|
||||||
resultMap = parseFile(fileStream, fdrFormatVo.getTimeFormat(), fdrFormatVo.getDelimiter(), fdrFormatVo.getValidStartLine());
|
resultMap = parseFile(fileStream, fdrFormatVo.getTimeFormat(), fdrFormatVo.getDelimiter(), fdrFormatVo.getValidStartLine());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
throw new ServiceException("配置解析异常");
|
||||||
}
|
}
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ public interface PlcLogService {
|
|||||||
|
|
||||||
List<FileNode> getDirOrFileList(String fileType, String name, String startTime, String endTime);
|
List<FileNode> getDirOrFileList(String fileType, String name, String startTime, String endTime);
|
||||||
|
|
||||||
Map<String, List<Object>> getDataCurve(String url, String deviceCode) throws IOException;
|
Map<String, List<Object>> getDataCurve(String url, String deviceCode);
|
||||||
|
|
||||||
void updatePlcConfig(SysEquipment sysEquipment);
|
void updatePlcConfig(SysEquipment sysEquipment);
|
||||||
|
|
||||||
|
@ -63,30 +63,31 @@ public class PlcLogsServiceImpl implements PlcLogService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, List<Object>> getDataCurve(String url, String deviceCode) throws IOException {
|
public Map<String, List<Object>> getDataCurve(String url, String deviceCode){
|
||||||
Map<String, List<Object>> resultMap = null;
|
Map<String, List<Object>> resultMap = null;
|
||||||
try (InputStream fileStream = minioViewsServcie.getFileStream(url)) {
|
//根据device Code查询故障录波格式
|
||||||
//根据device Code查询故障录波格式
|
QueryWrapper<SysEquipment> queryWrapper = new QueryWrapper<>();
|
||||||
QueryWrapper<SysEquipment> queryWrapper = new QueryWrapper<>();
|
queryWrapper.eq("CODE", deviceCode);
|
||||||
queryWrapper.eq("CODE", deviceCode);
|
SysEquipment sysEquipment = sysEquipmentMapper.selectOne(queryWrapper);
|
||||||
SysEquipment sysEquipment = sysEquipmentMapper.selectOne(queryWrapper);
|
if (sysEquipment == null) {
|
||||||
if (sysEquipment == null) {
|
throw new ServiceException("设备不存在,请选择正确设备");
|
||||||
throw new ServiceException("设备不存在,请选择正确设备");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isBlank(sysEquipment.getOptions())){
|
if (StringUtils.isBlank(sysEquipment.getOptions())){
|
||||||
throw new ServiceException("请添加设备文件解析配置");
|
throw new ServiceException("请添加设备文件解析配置");
|
||||||
}
|
}
|
||||||
FileParseConfig fileParseConfig = JSON.parseObject(sysEquipment.getOptions(), FileParseConfig.class);
|
FileParseConfig fileParseConfig = JSON.parseObject(sysEquipment.getOptions(), FileParseConfig.class);
|
||||||
FdrFormatVo fdrFormatVo = fileParseConfig.getPlcFormat();
|
FdrFormatVo fdrFormatVo = fileParseConfig.getPlcFormat();
|
||||||
if (fdrFormatVo == null){
|
if (fdrFormatVo == null){
|
||||||
throw new ServiceException("请添加plclog配置");
|
throw new ServiceException("请添加plclog配置");
|
||||||
}
|
}
|
||||||
|
try (InputStream fileStream = minioViewsServcie.getFileStream(url)) {
|
||||||
// 解析文件内容
|
// 解析文件内容
|
||||||
resultMap = parseFile(fileStream, fdrFormatVo.getTimeFormat(), fdrFormatVo.getDelimiter(), fdrFormatVo.getValidStartLine());
|
resultMap = parseFile(fileStream, fdrFormatVo.getTimeFormat(), fdrFormatVo.getDelimiter(), fdrFormatVo.getValidStartLine());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
throw new ServiceException("配置解析异常");
|
||||||
}
|
}
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user