暂态事件列表接口调整(新增波形解析时的字段)

This commit is contained in:
guofeihu
2024-08-01 16:33:47 +08:00
parent 279cf7d628
commit c1d351498d
8 changed files with 100 additions and 14 deletions

View File

@@ -20,6 +20,15 @@ public class DataGroupEventVO {
@ApiModelProperty("事件ID") @ApiModelProperty("事件ID")
private String eventId; private String eventId;
@ApiModelProperty("变电站名称")
private String subName;
@ApiModelProperty("监测点ID")
private String lineId;
@ApiModelProperty("监测点名称")
private String lineName;
@ApiModelProperty("项目名称") @ApiModelProperty("项目名称")
private String projectName; private String projectName;
@@ -30,7 +39,7 @@ public class DataGroupEventVO {
private String itemName; private String itemName;
@ApiModelProperty("持续时间") @ApiModelProperty("持续时间")
private Double persistTime; private Double duration;
@ApiModelProperty("发生时刻") @ApiModelProperty("发生时刻")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss.SSS") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss.SSS")
@@ -45,6 +54,6 @@ public class DataGroupEventVO {
private String phaseType; private String phaseType;
@ApiModelProperty("暂降幅值") @ApiModelProperty("暂降幅值")
private Float amplitude; private Float featureAmplitude;
} }

View File

@@ -51,7 +51,7 @@ public class CsLedgerController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/lineTree") @PostMapping("/lineTree")
@ApiOperation("层设备树(监测点层)") @ApiOperation("层设备树(监测点层,根节点为治理设备和便携式设备)")
public HttpResult<List<CsLedgerVO>> lineTree(){ public HttpResult<List<CsLedgerVO>> lineTree(){
String methodDescribe = getMethodDescribe("lineTree"); String methodDescribe = getMethodDescribe("lineTree");
List<CsLedgerVO> list = csLedgerService.getLineTree(); List<CsLedgerVO> list = csLedgerService.getLineTree();
@@ -60,7 +60,7 @@ public class CsLedgerController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/deviceTree") @PostMapping("/deviceTree")
@ApiOperation("层设备树(装置层)") @ApiOperation("层设备树(装置层,根节点为治理设备和便携式设备)")
public HttpResult<List<CsLedgerVO>> getDeviceTree(){ public HttpResult<List<CsLedgerVO>> getDeviceTree(){
String methodDescribe = getMethodDescribe("getDeviceTree"); String methodDescribe = getMethodDescribe("getDeviceTree");
List<CsLedgerVO> list = csLedgerService.getDeviceTree(); List<CsLedgerVO> list = csLedgerService.getDeviceTree();

View File

@@ -78,13 +78,14 @@
<select id="getGroupEventList" resultType="com.njcn.csdevice.pojo.vo.DataGroupEventVO"> <select id="getGroupEventList" resultType="com.njcn.csdevice.pojo.vo.DataGroupEventVO">
select REPLACE(UUID(),'-','') as id, ce.id as eventId, select REPLACE(UUID(),'-','') as id, ce.id as eventId,
w1.item_name as projectName,w4.gc_name as gcName, w1.item_name as projectName,w4.gc_name as gcName,
w4.item_name as itemName,ce.persist_time as persistTime,ce.start_time as startTime, w4.item_name as itemName,ce.persist_time as duration,ce.start_time as startTime,
ce.tag ce.tag,cl.name as lineName,cl.line_id as lineId
from (select id,item_name,state from wl_record where type = 0 and p_id is null) w1 from (select id,item_name,state from wl_record where type = 0 and p_id is null) w1
inner join (select id,p_id,state from wl_record where type = 0 and p_id is not null) w2 on w1.id = w2.p_id inner join (select id,p_id,state from wl_record where type = 0 and p_id is not null) w2 on w1.id = w2.p_id
inner join wl_record_test_data w3 on w2.id = w3.test_item_id inner join wl_record_test_data w3 on w2.id = w3.test_item_id
inner join wl_record w4 on w3.data_id = w4.id inner join wl_record w4 on w3.data_id = w4.id
inner join cs_event ce on w4.dev_id = ce.device_id and w4.line_id = ce.line_id inner join cs_event ce on w4.dev_id = ce.device_id and w4.line_id = ce.line_id
inner join cs_line cl on cl.line_id = ce.line_id
where ce.type = 0 and w1.state = 1 and w2.state = 1 and w4.state = 1 where ce.type = 0 and w1.state = 1 and w2.state = 1 and w4.state = 1
and ce.device_id = #{devId} and ce.line_id = #{lindId} and ce.device_id = #{devId} and ce.line_id = #{lindId}
order by w1.item_name order by w1.item_name

View File

@@ -380,7 +380,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
} }
} }
deviceManagerVo.setDataSetList(dataSetList); deviceManagerVo.setDataSetList(dataSetList);
deviceManagerVo.setTime(csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid()).get(0).getCreateTime()); List<CsLinePO> csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid());
if(!csLinePOS.isEmpty() && csLinePOS.get(0)!=null){
deviceManagerVo.setTime(csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid()).get(0).getCreateTime());
}
} }
} }

View File

@@ -33,7 +33,9 @@ import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
import com.njcn.csharmonic.pojo.vo.ThdDataTdVO; import com.njcn.csharmonic.pojo.vo.ThdDataTdVO;
import com.njcn.csharmonic.pojo.vo.ThdDataVO; import com.njcn.csharmonic.pojo.vo.ThdDataVO;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.api.OverLimitClient; import com.njcn.device.pq.api.OverLimitClient;
import com.njcn.device.pq.pojo.vo.LineDetailVO;
import com.njcn.event.api.EventDetailFeignClient; import com.njcn.event.api.EventDetailFeignClient;
import com.njcn.event.pojo.po.RmpEventDetailPO; import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.influx.pojo.bo.CommonQueryParam; import com.njcn.influx.pojo.bo.CommonQueryParam;
@@ -111,6 +113,8 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
private final OverLimitClient overLimitClient; private final OverLimitClient overLimitClient;
private final LineFeignClient lineFeignClient;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public List<CsGroupVO> getGroupData(String dataSet) { public List<CsGroupVO> getGroupData(String dataSet) {
@@ -374,9 +378,15 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
temp.setPhaseType(evtParamPhase.get(0).getValue()+(Objects.isNull(evtParamPhase.get(0).getUnit())?"":evtParamPhase.get(0).getUnit())); temp.setPhaseType(evtParamPhase.get(0).getValue()+(Objects.isNull(evtParamPhase.get(0).getUnit())?"":evtParamPhase.get(0).getUnit()));
} }
} }
//变电站名称
List<LineDetailVO.Detail> lineDetailVOS = lineFeignClient.getLineDetailByIds(Arrays.asList(temp.getLineId())).getData();
if(!lineDetailVOS.isEmpty()){
temp.setSubName(lineDetailVOS.get(0).getSubName());
}
//暂降幅值 //暂降幅值
List<RmpEventDetailPO> eventDetails = eventDetailFeignClient.getEventDetailByIdsList(Arrays.asList(temp.getEventId())).getData(); List<RmpEventDetailPO> eventDetails = eventDetailFeignClient.getEventDetailByIdsList(Arrays.asList(temp.getEventId())).getData();
if(eventDetails !=null && !eventDetails.isEmpty()) temp.setAmplitude(PubUtils.floatRound(2, eventDetails.get(0).getFeatureAmplitude().floatValue())); if(eventDetails !=null && !eventDetails.isEmpty()) temp.setFeatureAmplitude(PubUtils.floatRound(2, eventDetails.get(0).getFeatureAmplitude().floatValue()));
}); });
return returnpage; return returnpage;
} }

View File

@@ -16,15 +16,16 @@ import com.njcn.csdevice.param.UploadDataParam;
import com.njcn.csharmonic.api.EventFeignClient; import com.njcn.csharmonic.api.EventFeignClient;
import com.njcn.csharmonic.api.OfflineDataUploadFeignClient; import com.njcn.csharmonic.api.OfflineDataUploadFeignClient;
import com.njcn.csharmonic.offline.constant.OfflineConstant; import com.njcn.csharmonic.offline.constant.OfflineConstant;
import com.njcn.csharmonic.offline.log.vo.NewBodyTaglogbuffer;
import com.njcn.csharmonic.offline.log.vo.NewHeadTaglogbuffer; import com.njcn.csharmonic.offline.log.vo.NewHeadTaglogbuffer;
import com.njcn.csharmonic.offline.log.vo.NewTaglogbuffer; import com.njcn.csharmonic.offline.log.vo.NewTaglogbuffer;
import com.njcn.csharmonic.offline.mincfg.tagComtradeCfg; import com.njcn.csharmonic.offline.mincfg.tagComtradeCfg;
import com.njcn.csharmonic.offline.vo.Response; import com.njcn.csharmonic.offline.vo.Response;
import com.njcn.csharmonic.pojo.po.CsEventPO; import com.njcn.csharmonic.pojo.po.CsEventPO;
import com.njcn.influx.imapper.EvtDataMapper;
import com.njcn.influx.imapper.PqdDataMapper; import com.njcn.influx.imapper.PqdDataMapper;
import com.njcn.influx.pojo.po.cs.EntData;
import com.njcn.influx.pojo.po.cs.PqdData; import com.njcn.influx.pojo.po.cs.PqdData;
import com.njcn.influx.query.InfluxQueryWrapper;
import com.njcn.influx.utils.InfluxDbUtils;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.EleEvtFeignClient; import com.njcn.system.api.EleEvtFeignClient;
@@ -40,6 +41,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -72,6 +74,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
private final PqdDataMapper pqdDataMapper; private final PqdDataMapper pqdDataMapper;
private final EvtDataMapper evtDataMapper;
@Override @Override
public Page<PortableOfflLog> queryPage(BaseParam baseParam) { public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
Page<PortableOfflLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ()); Page<PortableOfflLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
@@ -87,6 +91,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
//获取离线上传对应的字典规则(字典用来控制上传的文件夹名称,其中字典的name代表名称,code代表该文件夹下对应的解析规则且code不能更改) //获取离线上传对应的字典规则(字典用来控制上传的文件夹名称,其中字典的name代表名称,code代表该文件夹下对应的解析规则且code不能更改)
List<DictData> dictDatas = dicDataFeignClient.getDicDataByTypeCode(DataParam.wlRecordUpload).getData(); List<DictData> dictDatas = dicDataFeignClient.getDicDataByTypeCode(DataParam.wlRecordUpload).getData();
List<Response> responses = new ArrayList<>(); List<Response> responses = new ArrayList<>();
//临时cfg解析集合
List<Response> cfgResponse = new ArrayList<>();
//便利每个文件夹 //便利每个文件夹
for(DictData dictData : dictDatas){ for(DictData dictData : dictDatas){
List<MultipartFile> fileList = new ArrayList<>(); List<MultipartFile> fileList = new ArrayList<>();
@@ -105,6 +111,10 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
Object obj = ois.readObject(); Object obj = ois.readObject();
//实际返回的是List<Response> 也即:该文件夹下所有解析的文件对应的结果集 //实际返回的是List<Response> 也即:该文件夹下所有解析的文件对应的结果集
List<Response> response = (List<Response>) obj; List<Response> response = (List<Response>) obj;
//临时记录下cfg结果集(用作log绑定对应的cfg波形文件)
if(OfflineConstant.LOG.equals(dictData.getCode())){
cfgResponse.addAll(response);
}
responses.addAll(response); responses.addAll(response);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@@ -153,7 +163,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
portableOfflLog.setRealCount(pqdData.size()); portableOfflLog.setRealCount(pqdData.size());
if(minFlag){ if(minFlag){
//高频谐波数据入库 //高频谐波数据入库
//pqdDataMapper.insertBatch(pqdData); pqdDataMapper.insertBatch(pqdData);
//min结果集解析入库后就不需要在解析了 //min结果集解析入库后就不需要在解析了
minFlag = false; minFlag = false;
} }
@@ -191,7 +201,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
for(NewTaglogbuffer newTaglogbuffer : newTaglogbuffers){ for(NewTaglogbuffer newTaglogbuffer : newTaglogbuffers){
NewHeadTaglogbuffer newHeadTaglogbuffer = newTaglogbuffer.getNewHeadTaglogbuffer(); NewHeadTaglogbuffer newHeadTaglogbuffer = newTaglogbuffer.getNewHeadTaglogbuffer();
String strId = ""; String strId = "";
String strName = ""; String strName = newHeadTaglogbuffer.getLogCode()+"";
//中断标志 //中断标志
if(DataParam.intrStr.contains(newHeadTaglogbuffer.getLogCode())){ if(DataParam.intrStr.contains(newHeadTaglogbuffer.getLogCode())){
strId = DataParam.intrStrId; strId = DataParam.intrStrId;
@@ -215,6 +225,25 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
csEventPO.setDeviceId(uploadDataParam.getDevId()); csEventPO.setDeviceId(uploadDataParam.getDevId());
csEventPO.setStartTime(newTaglogbuffer.getStart()); csEventPO.setStartTime(newTaglogbuffer.getStart());
csEventPO.setTag(strName); csEventPO.setTag(strName);
String wavePath = null;
//设置波形文件(去cfg结果集里面去找)
for (Response res : cfgResponse) {
tagComtradeCfg sing = (tagComtradeCfg) res.getObj();
Date date = Date.from(newTaglogbuffer.getStart().atZone( ZoneId.systemDefault()).toInstant());
//如果匹配上则需要将当前cfg文件及对应的dat文件上传到comtrade文件夹中
if (sing.getTimeTrigger().compareTo(date) <= 0 && sing.getTimeEnd().compareTo(date) >= 0) {
for(MultipartFile f : uploadDataParam.getFiles()){
String cfg = res.getFilename();
String dat = cfg.substring(0,cfg.lastIndexOf("."))+OfflineConstant.CFG;
String sharPath = OfflineConstant.COMTRADE+"/"+DataParam.wlRecordPath+uploadDataParam.getDevId()+"/"+uploadDataParam.getLineId()+"/"+getFolderName()+"/";
if(f.getOriginalFilename().equals(cfg) || f.getOriginalFilename().equals(dat)){
fileStorageUtil.uploadMultipart(f, sharPath);
wavePath = sharPath;
}
}
}
}
csEventPO.setWavePath(wavePath);
//默认暂态事件 //默认暂态事件
csEventPO.setType(0); csEventPO.setType(0);
csEventPO.setClDid(getClDidByLineId(uploadDataParam.getLineId())); csEventPO.setClDid(getClDidByLineId(uploadDataParam.getLineId()));
@@ -224,8 +253,40 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
csEventPO.setLocation("grid"); csEventPO.setLocation("grid");
csEventPO.setProcess(data1.get(0).getProcess()); csEventPO.setProcess(data1.get(0).getProcess());
csEventPOS.add(csEventPO); csEventPOS.add(csEventPO);
EntData entData = new EntData();
for(NewBodyTaglogbuffer newBodyTaglogbuffer : newTaglogbuffer.getNewBodyTaglogbuffers()){
if(newBodyTaglogbuffer.getParaCode() == 0) entData.setEvtVvadepth(newBodyTaglogbuffer.getParaValue()/65536D);
if(newBodyTaglogbuffer.getParaCode() == 1) entData.setEvtVvatm(newBodyTaglogbuffer.getParaValue()/65536D);
if(newBodyTaglogbuffer.getParaCode() == 5) {
int code = newBodyTaglogbuffer.getParaValue()/65536;
switch (code){
case 0:
entData.setEvtVvaphase("A");
break;
case 1:
entData.setEvtVvaphase("B");
break;
case 2:
entData.setEvtVvaphase("C");
break;
case 3:
entData.setEvtVvaphase("AB");
break;
case 4:
entData.setEvtVvaphase("BC");
break;
case 5:
entData.setEvtVvaphase("CA");
break;
case 6:
entData.setEvtVvaphase("ABC");
break;
}
}
}
evtDataMapper.insertOne(entData);
} }
//eventFeignClient.saveBatchEventList(csEventPOS); eventFeignClient.saveBatchEventList(csEventPOS);
} }
} }
} }

View File

@@ -16,4 +16,6 @@ public interface OfflineConstant {
String CFG = ".cfg"; String CFG = ".cfg";
String DAT = ".dat";
} }

View File

@@ -44,7 +44,7 @@ public class ThdDataTdVO{
@ApiModelProperty(value = "指标名称") @ApiModelProperty(value = "指标名称")
private String showName; private String showName;
@ApiModelProperty(value = "国标限值") @ApiModelProperty(value = "数据")
private List<ThdDataVO> thdDataVOS; private List<ThdDataVO> thdDataVOS;
} }