Merge remote-tracking branch 'origin/master'

This commit is contained in:
hzj
2024-08-06 13:41:21 +08:00
9 changed files with 107 additions and 13 deletions

View File

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

View File

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

View File

@@ -78,13 +78,14 @@
<select id="getGroupEventList" resultType="com.njcn.csdevice.pojo.vo.DataGroupEventVO">
select REPLACE(UUID(),'-','') as id, ce.id as eventId,
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,
ce.tag
w4.item_name as itemName,ce.persist_time as duration,ce.start_time as startTime,
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
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 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_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
and ce.device_id = #{devId} and ce.line_id = #{lindId}
order by w1.item_name

View File

@@ -380,7 +380,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
}
}
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.ThdDataVO;
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.pojo.vo.LineDetailVO;
import com.njcn.event.api.EventDetailFeignClient;
import com.njcn.event.pojo.po.RmpEventDetailPO;
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 LineFeignClient lineFeignClient;
@Override
@Transactional(rollbackFor = Exception.class)
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()));
}
}
//变电站名称
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();
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;
}

View File

@@ -16,15 +16,16 @@ import com.njcn.csdevice.param.UploadDataParam;
import com.njcn.csharmonic.api.EventFeignClient;
import com.njcn.csharmonic.api.OfflineDataUploadFeignClient;
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.NewTaglogbuffer;
import com.njcn.csharmonic.offline.mincfg.tagComtradeCfg;
import com.njcn.csharmonic.offline.vo.Response;
import com.njcn.csharmonic.pojo.po.CsEventPO;
import com.njcn.influx.imapper.EvtDataMapper;
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.query.InfluxQueryWrapper;
import com.njcn.influx.utils.InfluxDbUtils;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.EleEvtFeignClient;
@@ -33,6 +34,7 @@ import com.njcn.system.pojo.po.DictData;
import com.njcn.system.pojo.po.EleEvtParm;
import com.njcn.web.pojo.param.BaseParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@@ -40,6 +42,8 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -52,6 +56,7 @@ import java.util.stream.Stream;
* @author guofeihu
* @since 2024-07-03
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMapper, PortableOfflLog> implements IPortableOfflLogService {
@@ -72,6 +77,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
private final PqdDataMapper pqdDataMapper;
private final EvtDataMapper evtDataMapper;
@Override
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
Page<PortableOfflLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
@@ -87,6 +94,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
//获取离线上传对应的字典规则(字典用来控制上传的文件夹名称,其中字典的name代表名称,code代表该文件夹下对应的解析规则且code不能更改)
List<DictData> dictDatas = dicDataFeignClient.getDicDataByTypeCode(DataParam.wlRecordUpload).getData();
List<Response> responses = new ArrayList<>();
//临时cfg解析集合
List<Response> cfgResponse = new ArrayList<>();
//便利每个文件夹
for(DictData dictData : dictDatas){
List<MultipartFile> fileList = new ArrayList<>();
@@ -105,6 +114,10 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
Object obj = ois.readObject();
//实际返回的是List<Response> 也即:该文件夹下所有解析的文件对应的结果集
List<Response> response = (List<Response>) obj;
//临时记录下cfg结果集(用作log绑定对应的cfg波形文件)
if(OfflineConstant.COMTRADE.equals(dictData.getCode())){
cfgResponse.addAll(response);
}
responses.addAll(response);
} catch (Exception e) {
e.printStackTrace();
@@ -154,6 +167,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
if(minFlag){
//高频谐波数据入库
//pqdDataMapper.insertBatch(pqdData);
log.info("插入min-pqdData,其长度为:"+pqdData.size());
//min结果集解析入库后就不需要在解析了
minFlag = false;
}
@@ -191,7 +205,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
for(NewTaglogbuffer newTaglogbuffer : newTaglogbuffers){
NewHeadTaglogbuffer newHeadTaglogbuffer = newTaglogbuffer.getNewHeadTaglogbuffer();
String strId = "";
String strName = "";
String strName = newHeadTaglogbuffer.getLogCode()+"";
//中断标志
if(DataParam.intrStr.contains(newHeadTaglogbuffer.getLogCode())){
strId = DataParam.intrStrId;
@@ -215,6 +229,25 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
csEventPO.setDeviceId(uploadDataParam.getDevId());
csEventPO.setStartTime(newTaglogbuffer.getStart());
csEventPO.setTag(strName);
String wavePath = null;
//设置波形文件(去cfg结果集里面去找)
for (Response res : cfgResponse) {
String cfg = res.getFilename();
String dat = cfg.substring(0,cfg.lastIndexOf("."))+OfflineConstant.DAT;
String sharPath = OfflineConstant.COMTRADE+"/"+DataParam.wlRecordPath+uploadDataParam.getDevId()+"/"+uploadDataParam.getLineId()+"/"+getFolderName()+"/";
tagComtradeCfg sing = (tagComtradeCfg) res.getObj();
Date date = Date.from(newTaglogbuffer.getStart().atZone( ZoneId.systemDefault()).toInstant());
//如果匹配上则需要将当前cfg文件及对应的dat文件上传到comtrade文件夹中
if ((sing!= null && sing.getTimeStart()!= null && sing.getTimeEnd() !=null && sing.getTimeTrigger().compareTo(date) <= 0 && sing.getTimeEnd().compareTo(date) >= 0)) {
for(MultipartFile f : uploadDataParam.getFiles()){
if(f.getOriginalFilename().equals(cfg) || f.getOriginalFilename().equals(dat)){
fileStorageUtil.uploadMultipart(f, sharPath);
wavePath = sharPath;
}
}
}
}
csEventPO.setWavePath(wavePath);
//默认暂态事件
csEventPO.setType(0);
csEventPO.setClDid(getClDidByLineId(uploadDataParam.getLineId()));
@@ -224,7 +257,43 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
csEventPO.setLocation("grid");
csEventPO.setProcess(data1.get(0).getProcess());
csEventPOS.add(csEventPO);
EntData entData = new EntData();
entData.setLineId(uploadDataParam.getLineId());
entData.setTime(newTaglogbuffer.getStart().toInstant(ZoneOffset.UTC));
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;
}
}
}
log.info("插入"+entData.toString());
//evtDataMapper.insertOne(entData);
}
log.info("插旗"+csEventPOS.toString());
//eventFeignClient.saveBatchEventList(csEventPOS);
}
}