Merge branch 'spectrogram' into dev

dev
huangfeng 3 months ago
commit e825c6a654

@ -0,0 +1,17 @@
DROP TABLE IF EXISTS `ied_dl_record`;
CREATE TABLE `ied_dl_record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`config_id` int(11) DEFAULT NULL,
`remote_path` varchar(200) DEFAULT NULL COMMENT '源路径',
`filename` varchar(200) DEFAULT NULL COMMENT '文件名',
`path` varchar(200) DEFAULT NULL COMMENT '本地路径',
`create_time` datetime DEFAULT NULL,
`d_time` datetime DEFAULT NULL,
`dev_id` int(11) DEFAULT NULL COMMENT '装置ID',
`type_id` int(11) DEFAULT NULL COMMENT '类型id',
`data` mediumtext,
PRIMARY KEY (`id`),
KEY `idxDev` (`dev_id`,`d_time`),
KEY `idxConfig` (`config_id`,`d_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List; import java.util.List;
@RestController @RestController
@ -66,15 +67,28 @@ public class IedDlController extends BasicController {
@GetMapping("listDownload") @GetMapping("listDownload")
@ApiOperation("查询下载记录列表") @ApiOperation("查询下载记录列表")
public Response<Page<IedDlRecord>> list(@ApiParam("类型") @RequestParam(value = "configId", required = false) Integer configId, public Response<Page<IedDlRecord>> list(@ApiParam("配置Id") @RequestParam(value = "configId", required = false) Integer configId,
@ApiParam("devId") @RequestParam(value = "devId", required = false) Integer devId,
@ApiParam("开始时间") @RequestParam(value = "startTime", required = false) Date startTime,
@ApiParam("结束时间") @RequestParam(value = "endTime", required = false) Date endTime,
@ApiParam("页码") @RequestParam(value = "pageNum", required = false) Integer pageNum, @ApiParam("页码") @RequestParam(value = "pageNum", required = false) Integer pageNum,
@ApiParam("每页数量") @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception { @ApiParam("每页数量") @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
pageNum = this.initPageNum(pageNum); pageNum = this.initPageNum(pageNum);
pageSize = this.initPageSize(pageSize); pageSize = this.initPageSize(pageSize);
Page<IedDlRecord> result = recordService.list(configId, pageNum, pageSize); Page<IedDlRecord> result = recordService.list(configId, devId, startTime, endTime, pageNum, pageSize);
return Response.success(result); return Response.success(result);
} }
@PostMapping("rebuildData")
@ApiOperation("rebuildData")
public Response<String> rebuildData(@Validated @NotNull(message = "id不能为空!") Integer id) throws Exception {
if (id == null) {
throw new BusinessException("id不能为空!");
}
recordService.rebuildData(id);
return Response.success("OK");
}
@GetMapping("listFiles") @GetMapping("listFiles")
@ApiOperation("查询文件和目录") @ApiOperation("查询文件和目录")
public Response<List<FileInformation>> listFiles(Integer iedId, String path) throws Exception { public Response<List<FileInformation>> listFiles(Integer iedId, String path) throws Exception {

@ -1,6 +1,6 @@
package com.xydl.cac.entity; package com.xydl.cac.entity;
import com.fasterxml.jackson.annotation.JsonInclude; import com.xydl.cac.model.spectrogram.SpectrogramModel;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -11,7 +11,6 @@ import lombok.NoArgsConstructor;
import javax.persistence.*; import javax.persistence.*;
import java.util.Date; import java.util.Date;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data @Data
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
@ -42,11 +41,29 @@ public class IedDlRecord {
@Column(name = "filename") @Column(name = "filename")
private String filename; private String filename;
@ApiModelProperty("采集时间")
@Column(name = "d_time")
private Date dTime;
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
@Column(name = "create_time") @Column(name = "create_time")
private Date createTime; private Date createTime;
@ApiModelProperty("devId")
@Column(name = "dev_id")
private Integer devId;
@ApiModelProperty("typeId")
@Column(name = "type_id")
private Integer typeId;
@ApiModelProperty("解析后数据")
@Column(name = "data")
private String data;
@Transient @Transient
IedDlConfig config; IedDlConfig config;
@Transient
SpectrogramModel model;
} }

@ -13,10 +13,13 @@ 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";
public static String Text = "text"; public static String Text = "text";
public static String DateTime = "datetime"; public static String DateTime = "datetime";
public static String Miss = "miss"; public static String Miss = "miss";
} }

@ -10,6 +10,7 @@ import com.xydl.cac.repository.*;
import com.xydl.cac.service.DataService; import com.xydl.cac.service.DataService;
import com.xydl.cac.service.IedDlRecordService; import com.xydl.cac.service.IedDlRecordService;
import com.xydl.cac.socket.WebSocketServer; import com.xydl.cac.socket.WebSocketServer;
import com.xydl.cac.spectrogram.SpectrogramHandler;
import com.xydl.cac.util.DateUtil; import com.xydl.cac.util.DateUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -33,6 +34,7 @@ public class IEDCollectService {
WebSocketServer _webSocketServer; WebSocketServer _webSocketServer;
BizConfig _bizConfig; BizConfig _bizConfig;
WarningRepository _warningRepository; WarningRepository _warningRepository;
SpectrogramHandler _spectrogramHandler;
String folder = "/record"; String folder = "/record";
HashMap<Integer, String> eqmidTimeMap = new HashMap<>(); HashMap<Integer, String> eqmidTimeMap = new HashMap<>();
@ -42,7 +44,7 @@ public class IEDCollectService {
IedDlRecordService dlRecordService, DataService dataService, IedDlRecordService dlRecordService, DataService dataService,
String xml, IcdIed ied, String xml, IcdIed ied,
WebSocketServer webSocketServer, BizConfig bizConfig, WebSocketServer webSocketServer, BizConfig bizConfig,
WarningRepository warningRepository) { WarningRepository warningRepository, SpectrogramHandler spectrogramHandler) {
_configRepository = configRepository; _configRepository = configRepository;
_attRepository = attRepository; _attRepository = attRepository;
_instRepository = instRepository; _instRepository = instRepository;
@ -54,6 +56,7 @@ public class IEDCollectService {
_webSocketServer = webSocketServer; _webSocketServer = webSocketServer;
_bizConfig = bizConfig; _bizConfig = bizConfig;
_warningRepository = warningRepository; _warningRepository = warningRepository;
_spectrogramHandler = spectrogramHandler;
iecClient = new IecClient(); iecClient = new IecClient();
} }
@ -216,16 +219,19 @@ public class IEDCollectService {
&& matchContain(filename, config.getContain())) { && matchContain(filename, config.getContain())) {
IedDlRecord record = new IedDlRecord(); IedDlRecord record = new IedDlRecord();
record.setConfigId(config.getId()); record.setConfigId(config.getId());
record.setDevId(config.getDevId());
record.setTypeId(config.getSensor().getTypeId());
record.setFilename(filename); record.setFilename(filename);
record.setRemotePath(config.getPath() + filename); record.setRemotePath(config.getPath() + filename);
boolean exist = _dlRecordService.exist(record); boolean exist = _dlRecordService.exist(record);
if (!exist) { if (!exist) {
String localFilePath = localPath + "/" + filename; String relativePath = localPath + "/" + filename;
iecClient.getFile(record.getRemotePath(), _bizConfig.getDatapath() + localFilePath, config.getTodel()); String localFullPath = _bizConfig.getDatapath() + relativePath;
record.setPath(_bizConfig.getDataNginxPath() + localFilePath); iecClient.getFile(record.getRemotePath(), localFullPath, config.getTodel());
record.setCreateTime(new Date()); record.setPath(_bizConfig.getDataNginxPath() + relativePath);
_dlRecordService.add(record);
log.info("采集到" + record.getRemotePath()); log.info("采集到" + record.getRemotePath());
_spectrogramHandler.processFile(record);
_dlRecordService.add(record);
} }
} }
} }

@ -0,0 +1,48 @@
package com.xydl.cac.model.spectrogram;
import lombok.Data;
import java.io.DataInputStream;
import java.util.ArrayList;
import java.util.List;
@Data
public class SouthYsp extends SpectrogramModel {
Float version;
Float fileVersion;
Short type;
Long createTime;
String flag;
String name;
Float xInterval;
Float yMax;
String xUnit;
String yUnit;
Integer k;
Integer m;
List<SouthYspChannel> channels = new ArrayList<>();
public void readFrom(DataInputStream dis) throws Exception {
version = readLittleEndianFloat(dis);
fileVersion = readLittleEndianFloat(dis);
type = readLittleEndianShort(dis);
createTime = readLittleEndianLong(dis);
flag = readString(dis, 1);
name = readString(dis, 32);
xInterval = readLittleEndianFloat(dis);
yMax = readLittleEndianFloat(dis);
xUnit = readString(dis, 1);
yUnit = readString(dis, 1);
k = readLittleEndianInt(dis);
m = dis.read();
for (int i = 0; i < m; i++) {
SouthYspChannel channel = new SouthYspChannel();
channel.readFrom(dis);
channels.add(channel);
}
dis.readInt();
for (SouthYspChannel channel : channels) {
channel.readDataFrom(dis, k);
}
}
}

@ -0,0 +1,32 @@
package com.xydl.cac.model.spectrogram;
import lombok.Data;
import java.io.DataInputStream;
import java.util.ArrayList;
import java.util.List;
import static com.xydl.cac.model.spectrogram.SpectrogramModel.readLittleEndianFloat;
@Data
public class SouthYspChannel {
Integer n;
List<YspChannelCrest> crests = new ArrayList<>();
List<Float> data = new ArrayList<>();
public void readFrom(DataInputStream dis) throws Exception {
n = dis.read();
for (int i = 0; i < n; i++) {
YspChannelCrest crest = new YspChannelCrest();
crest.readFrom(dis);
crests.add(crest);
}
}
public void readDataFrom(DataInputStream dis, Integer k) throws Exception {
for (int i = 0; i < k; i++) {
Float v = readLittleEndianFloat(dis);
data.add(v);
}
}
}

@ -0,0 +1,57 @@
package com.xydl.cac.model.spectrogram;
import lombok.Data;
import java.io.DataInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.StandardCharsets;
@Data
public class SpectrogramModel {
// 读取小端序的int4字节
public static int readLittleEndianInt(DataInputStream dis) throws IOException {
byte[] bytes = new byte[4];
dis.readFully(bytes);
return ByteBuffer.wrap(bytes)
.order(ByteOrder.LITTLE_ENDIAN)
.getInt();
}
// 读取小端序的short2字节
public static short readLittleEndianShort(DataInputStream dis) throws IOException {
byte[] bytes = new byte[2];
dis.readFully(bytes);
return ByteBuffer.wrap(bytes)
.order(ByteOrder.LITTLE_ENDIAN)
.getShort();
}
// 读取小端序的long8字节
public static long readLittleEndianLong(DataInputStream dis) throws IOException {
byte[] bytes = new byte[8];
dis.readFully(bytes);
return ByteBuffer.wrap(bytes)
.order(ByteOrder.LITTLE_ENDIAN)
.getLong();
}
// 读取小端序的float4字节
public static float readLittleEndianFloat(DataInputStream dis) throws IOException {
byte[] bytes = new byte[4];
dis.readFully(bytes);
return ByteBuffer.wrap(bytes)
.order(ByteOrder.LITTLE_ENDIAN)
.getFloat();
}
// 读取String
public static String readString(DataInputStream dis, int length) throws IOException {
byte[] bytes = new byte[length];
dis.readFully(bytes);
String str = new String(bytes, StandardCharsets.UTF_8);
return str.replaceAll("\u0000", "");
}
}

@ -0,0 +1,40 @@
package com.xydl.cac.model.spectrogram;
import lombok.Data;
import java.io.DataInputStream;
import java.util.ArrayList;
import java.util.List;
@Data
public class Ysp extends SpectrogramModel {
Integer code;
Integer length;
Long createTime;
Integer flag;
Float xInterval;
Float yMax;
Integer xUnit;
Integer yUnit;
Integer k;
Integer m;
List<YspChannel> channels = new ArrayList<>();
public void readFrom(DataInputStream dis) throws Exception {
code = dis.read();
length = readLittleEndianInt(dis);
createTime = readLittleEndianLong(dis);
flag = dis.read();
xInterval = readLittleEndianFloat(dis);
yMax = readLittleEndianFloat(dis);
xUnit = dis.read();
yUnit = dis.read();
k = readLittleEndianInt(dis);
m = dis.read();
for (int i = 0; i < m; i++) {
YspChannel channel = new YspChannel();
channel.readFrom(dis, k);
channels.add(channel);
}
}
}

@ -0,0 +1,29 @@
package com.xydl.cac.model.spectrogram;
import lombok.Data;
import java.io.DataInputStream;
import java.util.ArrayList;
import java.util.List;
import static com.xydl.cac.model.spectrogram.SpectrogramModel.readLittleEndianFloat;
@Data
public class YspChannel {
Integer n;
List<YspChannelCrest> crests = new ArrayList<>();
List<Float> data = new ArrayList<>();
public void readFrom(DataInputStream dis, Integer k) throws Exception {
n = dis.read();
for (int i = 0; i < n; i++) {
YspChannelCrest crest = new YspChannelCrest();
crest.readFrom(dis);
crests.add(crest);
}
for (int i = 0; i < k; i++) {
Float v = readLittleEndianFloat(dis);
data.add(v);
}
}
}

@ -0,0 +1,28 @@
package com.xydl.cac.model.spectrogram;
import lombok.Data;
import java.io.DataInputStream;
import static com.xydl.cac.model.spectrogram.SpectrogramModel.*;
@Data
public class YspChannelCrest {
String name;
Integer j;
Float time;
Float startTime;
Float endTime;
Float height;
Float area;
public void readFrom(DataInputStream dis) throws Exception {
name = readString(dis, 10);
j = dis.read();
time = readLittleEndianFloat(dis);
startTime = readLittleEndianFloat(dis);
endTime = readLittleEndianFloat(dis);
height = readLittleEndianFloat(dis);
area = readLittleEndianFloat(dis);
}
}

@ -1,13 +1,20 @@
package com.xydl.cac.service; package com.xydl.cac.service;
import com.xydl.cac.entity.IedDlRecord; import com.xydl.cac.entity.IedDlRecord;
import com.xydl.cac.exception.BusinessException;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import java.util.Date;
public interface IedDlRecordService { public interface IedDlRecordService {
Page<IedDlRecord> list(Integer configId, int pageNum, int pageSize) throws Exception; Page<IedDlRecord> list(Integer configId, Integer devId, Date startTime, Date endTime, int pageNum, int pageSize) throws Exception;
void add(IedDlRecord item); void add(IedDlRecord item);
boolean exist(IedDlRecord item); boolean exist(IedDlRecord item);
void update(IedDlRecord item);
void rebuildData(Integer id) throws BusinessException;
} }

@ -2,40 +2,55 @@ package com.xydl.cac.service.impl;
import com.xydl.cac.entity.IedDlConfig; import com.xydl.cac.entity.IedDlConfig;
import com.xydl.cac.entity.IedDlRecord; import com.xydl.cac.entity.IedDlRecord;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.repository.IedDlRecordRepository; import com.xydl.cac.repository.IedDlRecordRepository;
import com.xydl.cac.service.IedDlConfigService; import com.xydl.cac.service.IedDlConfigService;
import com.xydl.cac.service.IedDlRecordService; import com.xydl.cac.service.IedDlRecordService;
import com.xydl.cac.spectrogram.SpectrogramHandler;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Optional;
@Service @Service
@Slf4j @Slf4j
@Transactional(rollbackFor = Exception.class)
public class IedDlRecordServiceImpl implements IedDlRecordService { public class IedDlRecordServiceImpl implements IedDlRecordService {
@Resource @Resource
IedDlRecordRepository repository; IedDlRecordRepository repository;
@Resource @Resource
IedDlConfigService configService; IedDlConfigService configService;
@Resource
SpectrogramHandler spectrogramHandler;
@Override @Override
public Page<IedDlRecord> list(Integer configId, int pageNum, int pageSize) throws Exception { public Page<IedDlRecord> list(Integer configId, Integer devId, Date startTime, Date endTime, int pageNum, int pageSize) throws Exception {
PageRequest request = PageRequest.of(pageNum - 1, pageSize); PageRequest request = PageRequest.of(pageNum - 1, pageSize);
Specification<IedDlRecord> specification = (root, query, builder) -> { Specification<IedDlRecord> specification = (root, query, builder) -> {
Predicate predicate = builder.conjunction(); Predicate predicate = builder.conjunction();
if (configId != null) { if (configId != null) {
predicate.getExpressions().add(builder.equal(root.get("configId"), configId)); predicate.getExpressions().add(builder.equal(root.get("configId"), configId));
query.orderBy(builder.desc(root.get("dTime")));
} else if (devId != null) {
predicate.getExpressions().add(builder.equal(root.get("devId"), devId));
query.orderBy(builder.desc(root.get("dTime")));
} else {
query.orderBy(builder.desc(root.get("id")));
}
if (startTime != null) {
predicate.getExpressions().add(builder.greaterThan(root.get("dTime"), startTime));
}
if (endTime != null) {
predicate.getExpressions().add(builder.lessThanOrEqualTo(root.get("dTime"), endTime));
} }
query.orderBy(builder.desc(root.get("id")));
return predicate; return predicate;
}; };
Page<IedDlRecord> result = repository.findAll(specification, request); Page<IedDlRecord> result = repository.findAll(specification, request);
@ -48,6 +63,7 @@ public class IedDlRecordServiceImpl implements IedDlRecordService {
break; break;
} }
} }
spectrogramHandler.jsonToModel(item);
} }
} }
return result; return result;
@ -69,4 +85,20 @@ public class IedDlRecordServiceImpl implements IedDlRecordService {
} }
} }
@Override
public void update(IedDlRecord item) {
repository.save(item);
}
@Override
public void rebuildData(Integer id) throws BusinessException {
Optional<IedDlRecord> optional = repository.findById(id);
if (!optional.isPresent()) {
throw new BusinessException("未找到该记录");
}
IedDlRecord record = optional.get();
spectrogramHandler.processFile(record);
repository.save(record);
}
} }

@ -0,0 +1,34 @@
package com.xydl.cac.spectrogram;
import com.xydl.cac.model.spectrogram.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.io.DataInputStream;
import java.io.FileInputStream;
@Service
@Slf4j
public class ProcessorYsp {
public SouthYsp process(String localFilePath) {
try (DataInputStream dis = new DataInputStream(new FileInputStream(localFilePath))) {
SouthYsp model = this.readOneBlock(dis);
return model;
} catch (Exception e) {
log.error("解析文件失败" + localFilePath, e);
return null;
}
}
private SouthYsp readOneBlock(DataInputStream dis) throws Exception {
SouthYsp model = new SouthYsp();
model.readFrom(dis);
return model;
}
public static void main(String[] args) {
ProcessorYsp processorYsp = new ProcessorYsp();
processorYsp.process("C:/Code/cac/谱图文件/0312B12000042A3840001_203_07_20250113163055.dat");
}
}

@ -0,0 +1,72 @@
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.model.spectrogram.SouthYsp;
import com.xydl.cac.util.DataUtil;
import com.xydl.cac.util.DateUtil;
import com.xydl.cac.util.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
@Service
@Slf4j
public class SpectrogramHandler {
@Resource
BizConfig bizConfig;
@Resource
ProcessorYsp processorYsp;
public void processFile(IedDlRecord record) {
if (record.getTypeId() == null) {
return;
}
String localFilePath = record.getPath().replaceFirst(bizConfig.getDataNginxPath(), bizConfig.getDatapath());
try {
// 油色谱谱图
if (record.getTypeId() == Constants.TypeYSP) {
SouthYsp model = processorYsp.process(localFilePath);
String json = JSONUtil.object2Json(model);
record.setData(json);
record.setCreateTime(new Date());
try {
String str = String.valueOf(model.getCreateTime());
Date dtime = DateUtil.parse(str, "yyyyMMddHHmmss");
record.setDTime(dtime);
} catch (Exception ignore) {
}
log.info("解析油色谱谱图文件成功");
} else {
log.error("缺少该类型" + record.getTypeId() + "的谱图处理模块");
}
} catch (Exception ex) {
log.error("解析谱图文件失败, typeId=" + record.getTypeId() + ", devId=" + record.getDevId()
+ ", file=" + localFilePath, ex);
}
}
public void jsonToModel(IedDlRecord record) {
if (record.getTypeId() == null) {
return;
}
if (record.getData() == null) {
return;
}
try {
if (Constants.TypeYSP == record.getTypeId()) {
SouthYsp model = JSONUtil.json2Object(record.getData(), SouthYsp.class);
record.setModel(model);
record.setData(null);
}
} catch (Exception ex) {
log.error("谱图数据data内容存在异常, typeId=" + record.getTypeId() + ", devId=" + record.getDevId()
+ ", file=" + record.getPath());
}
}
}

@ -9,6 +9,7 @@ import com.xydl.cac.repository.*;
import com.xydl.cac.service.DataService; import com.xydl.cac.service.DataService;
import com.xydl.cac.service.IedDlRecordService; import com.xydl.cac.service.IedDlRecordService;
import com.xydl.cac.socket.WebSocketServer; import com.xydl.cac.socket.WebSocketServer;
import com.xydl.cac.spectrogram.SpectrogramHandler;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -35,6 +36,8 @@ public class AsyncTask {
BizConfig bizConfig; BizConfig bizConfig;
@Resource @Resource
WarningRepository warningRepository; WarningRepository warningRepository;
@Resource
SpectrogramHandler spectrogramHandler;
@Async @Async
public void collectIed(String xml, IcdIed ied, List<Rptparamindex> rptList, List<IedDlConfig> dlList) { public void collectIed(String xml, IcdIed ied, List<Rptparamindex> rptList, List<IedDlConfig> dlList) {
@ -43,7 +46,7 @@ public class AsyncTask {
dlRecordService, dataService, dlRecordService, dataService,
xml, ied, xml, ied,
webSocketServer, bizConfig, webSocketServer, bizConfig,
warningRepository); warningRepository, spectrogramHandler);
iedService.collectAndSave(rptList, dlList); iedService.collectAndSave(rptList, dlList);
} }
} }

@ -88,11 +88,19 @@ public class Client61850Task {
if (CollectionUtils.isEmpty(rptList) && CollectionUtils.isEmpty(dlList)) { if (CollectionUtils.isEmpty(rptList) && CollectionUtils.isEmpty(dlList)) {
return; return;
} }
List<IedDlConfig> dlNewList = new ArrayList<>();
for (IedDlConfig item : dlList) {
List<NSensor> senList = sensorRepository.findByDevId(item.getDevId());
if (!CollectionUtils.isEmpty(senList)) {
item.setSensor(senList.get(0));
dlNewList.add(item);
}
}
List<IcdFile> icdFileList = fileRepository.findAll(); List<IcdFile> icdFileList = fileRepository.findAll();
if (!CollectionUtils.isEmpty(icdFileList)) { if (!CollectionUtils.isEmpty(icdFileList)) {
for (IcdFile icdFile : icdFileList) { for (IcdFile icdFile : icdFileList) {
this.collectIcdFile(icdFile, rptList, dlList); this.collectIcdFile(icdFile, rptList, dlNewList);
} }
} }
} }

Loading…
Cancel
Save