功能优化

1.优化界面描述显示;
2.新增测试项暂态事件
This commit is contained in:
xy
2024-12-06 15:24:31 +08:00
parent 3df2bedaa6
commit 8a0e0d8c08
16 changed files with 269 additions and 92 deletions

View File

@@ -139,7 +139,6 @@ public class CslineController extends BaseController {
@PostMapping("/getById")
@ApiOperation("根据监测点id获取监测点详情")
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true)
@ApiIgnore
public HttpResult<CsLinePO> getById(@RequestParam String lineId) {
String methodDescribe = getMethodDescribe("getById");
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();

View File

@@ -246,6 +246,5 @@ public class WlRecordController extends BaseController {
List<WlRecord> result = wlRecordService.getWlAssByWlId(wlId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -9,7 +9,6 @@ import com.njcn.csdevice.service.ICsDataSetService;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -40,7 +39,7 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
.in(CsDataSet::getType, Arrays.asList(0,2))
.eq(CsDataSet::getStoreFlag,1)
.and(i->i.eq(CsDataSet::getDataType,"Stat").or().isNull(CsDataSet::getDataType))
.orderByAsc(CsDataSet::getType,CsDataSet::getClDev)
.orderByAsc(CsDataSet::getIdx)
.list();
}

View File

@@ -382,47 +382,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
}
} else {
CsDataSet item = dataSet.get(0);
//准实时数据
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
dataSetVO.setId(item.getId());
dataSetVO.setName("准实时数据");
dataSetVO.setType("rt");
dataSetList.add(dataSetVO);
deviceManagerVo.setDataLevel(item.getDataLevel());
//历史数据tab
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
dataSetVo2.setId(item.getId());
dataSetVo2.setName("历史统计数据");
dataSetVo2.setType("history");
dataSetList.add(dataSetVo2);
deviceManagerVo.setDataLevel(item.getDataLevel());
//趋势数据tab
DeviceManagerVO.DataSetVO dataSetVo3 = new DeviceManagerVO.DataSetVO();
dataSetVo3.setId(item.getId());
dataSetVo3.setName("历史趋势");
dataSetVo3.setType("trenddata");
dataSetList.add(dataSetVo3);
//下面这些tab仅仅只限于设备监控的便携式设备才会有
if(DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType())){
//实时数据tab
DeviceManagerVO.DataSetVO dataSetVo4 = new DeviceManagerVO.DataSetVO();
dataSetVo4.setId(item.getId());
dataSetVo4.setName("实时数据");
dataSetVo4.setType("realtimedata");
dataSetList.add(dataSetVo4);
//暂态事件tab
DeviceManagerVO.DataSetVO dataSetVo5 = new DeviceManagerVO.DataSetVO();
dataSetVo5.setId(item.getId());
dataSetVo5.setName("暂态事件");
dataSetVo5.setType("event");
dataSetList.add(dataSetVo5);
//测试项tab
DeviceManagerVO.DataSetVO dataSetVo6 = new DeviceManagerVO.DataSetVO();
dataSetVo6.setId(item.getId());
dataSetVo6.setName("测试项记录");
dataSetVo6.setType("items");
dataSetList.add(dataSetVo6);
boolean isPortableDevice = DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType());
addDataSet(dataSetList, item, "最新数据", "rt");
addDataSet(dataSetList, item, "历史统计数据", "history");
addDataSet(dataSetList, item, "历史趋势", "trenddata");
if (isPortableDevice) {
// 便携式设备特有的数据集
addDataSet(dataSetList, item, "实时数据", "realtimedata");
addDataSet(dataSetList, item, "暂态事件", "event");
addDataSet(dataSetList, item, "测试项日志", "items");
}
deviceManagerVo.setDataLevel(item.getDataLevel());
}
deviceManagerVo.setDataSetList(dataSetList);
List<CsLinePO> csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid());
@@ -432,6 +402,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
}
}
private void addDataSet(List<DeviceManagerVO.DataSetVO> dataSetList, CsDataSet item, String name, String type) {
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
dataSetVO.setId(item.getId());
dataSetVO.setName(name);
dataSetVO.setType(type);
dataSetList.add(dataSetVO);
}
@Override
public void updateSoftInfoBynDid(String nDid, String id, Integer module) {
boolean result;

View File

@@ -16,16 +16,15 @@ import com.njcn.csdevice.pojo.param.CsLedgerParam;
import com.njcn.csdevice.pojo.po.*;
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
import com.njcn.csdevice.service.*;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.redis.utils.RedisUtil;
import com.njcn.system.api.AreaFeignClient;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.pojo.po.Area;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@@ -40,15 +39,12 @@ import java.util.stream.Collectors;
@AllArgsConstructor
public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> implements ICsLedgerService {
private final ICsEngineeringUserService csEngineeringUserService;
private final AreaFeignClient areaFeignClient;
private final RedisUtil redisUtil;
private final AppTopologyDiagramMapper appTopologyDiagramMapper;
private final AppProjectMapper appProjectMapper;
private final CsEngineeringMapper csEngineeringMapper;
private final CsLinePOService csLinePOService;
private final DicDataFeignClient dicDataFeignClient;
private final FileStorageUtil fileStorageUtil;
private final RoleEngineerDevService roleEngineerDevService;
private final CsDevModelRelationService csDevModelRelationService;
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
@@ -77,17 +73,29 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
List<String> device = roleEngineerDevService.getDevice();
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
peek(
temp->{
CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(temp.getId());
temp.setComFlag(csEquipmentDeliveryPO.getRunStatus());
temp.setType("device");
}
).
sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
.map(CsLedgerVO::getId)
.distinct()
.collect(Collectors.toMap(
Function.identity(),
csEquipmentDeliveryMapper::selectById
));
List<CsLedgerVO> deviceList = allList.stream()
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
.peek(item -> {
CsEquipmentDeliveryPO po = poMap.get(item.getId());
item.setComFlag(po.getRunStatus());
item.setNDId(po.getNdid());
item.setType("device");
})
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
.sorted(Comparator.comparing(CsLedgerVO::getSort))
.collect(Collectors.toList());
List<CsLedgerVO> finalLineList = allList.stream()
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
.sorted(Comparator.comparing(CsLedgerVO::getSort))
@@ -185,17 +193,28 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
List<String> device = roleEngineerDevService.getDevice();
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
peek(
temp->{
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(temp.getId());
temp.setComFlag(po.getRunStatus());
temp.setNDId(po.getNdid());
temp.setType("device");
}
).
sorted(Comparator.comparing(CsLedgerVO::getSort))
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
.map(CsLedgerVO::getId)
.distinct()
.collect(Collectors.toMap(
Function.identity(),
csEquipmentDeliveryMapper::selectById
));
List<CsLedgerVO> deviceList = allList.stream()
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
.peek(item -> {
CsEquipmentDeliveryPO po = poMap.get(item.getId());
item.setComFlag(po.getRunStatus());
item.setNDId(po.getNdid());
item.setType("device");
})
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
.sorted(Comparator.comparing(CsLedgerVO::getSort))
.collect(Collectors.toList());
checkDevSetData(deviceList);
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));

View File

@@ -2,6 +2,7 @@ package com.njcn.csdevice.service.impl;
import cn.hutool.core.util.IdUtil;
import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
@@ -12,9 +13,11 @@ import com.njcn.csdevice.constant.DataParam;
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.csdevice.mapper.PortableOfflLogMapper;
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
import com.njcn.csdevice.pojo.po.PortableOfflLog;
import com.njcn.csdevice.pojo.po.WlRecord;
import com.njcn.csdevice.service.CsLinePOService;
import com.njcn.csdevice.service.IPortableOfflLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.csdevice.param.UploadDataParam;
@@ -53,6 +56,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.Instant;
@@ -99,6 +103,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
private final MqttPublisher publisher;
private final PortableOffMainLogService portableOffMainLogService;
private final IWlRecordService wlRecordService;
private final CsLinePOService csLinePOService;
@Override
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
@@ -175,6 +180,10 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
@Transactional(rollbackFor = {Exception.class})
public void importEquipment(UploadDataParam uploadDataParam){
String lineId = uploadDataParam.getLineId();
//获取监测点信息
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CsLinePO::getLineId,lineId).eq(CsLinePO::getStatus,1);
CsLinePO po = csLinePOService.getOne(queryWrapper);
String cdid = uploadDataParam.getLineId().substring(uploadDataParam.getLineId().length() - 1);
//第一步解析redcord.bin文件获取监测点序号做校验
List<MultipartFile> record = uploadDataParam.getFiles().stream().filter(
@@ -304,25 +313,22 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
//插入测试项
WlRecord wlRecord = new WlRecord();
wlRecord.setId(IdUtil.fastSimpleUUID());
wlRecord.setItemName("基础数据");
wlRecord.setGcName("补召数据");
wlRecord.setItemName("补召");
wlRecord.setGcName("补召");
wlRecord.setDevId(csEquipmentDeliveryDTO.getId());
wlRecord.setLineId(lineId);
// wlRecord.setStatisticalInterval();
// wlRecord.setPt();
// wlRecord.setCt();
// wlRecord.setPt1();
// wlRecord.setCt1();
// wlRecord.setVoltageLevel();
// wlRecord.setCapacitySscb();
// wlRecord.setCapacitySscmin();
// wlRecord.setCapacitySt();
// wlRecord.setCapacitySi();
// wlRecord.setVolConType();
// wlRecord.setCurConSel();
wlRecord.setStatisticalInterval(po.getLineInterval());
wlRecord.setPt(po.getPtRatio().intValue());
wlRecord.setCt(po.getCtRatio().intValue());
//电压等级
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(channelVol(new Float(po.getVolGrade())) + "kV","Dev_Voltage_Stand").getData();
wlRecord.setVoltageLevel(Objects.isNull(dictData)?null:dictData.getId());
//电压接线方式
wlRecord.setVolConType(getVolConType(po.getConType()));
wlRecord.setStartTime(instantMin.atZone(ZoneId.systemDefault()).toLocalDateTime());
wlRecord.setEndTime(instantMax.atZone(ZoneId.systemDefault()).toLocalDateTime());
// wlRecord.setLocation();
wlRecord.setType(1);
wlRecord.setState(DataStateEnum.ENABLE.getCode());
wlRecordService.lambdaUpdate().set(WlRecord::getState,DataStateEnum.DELETED.getCode())
@@ -562,4 +568,40 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
}
return s1;
}
/**
* 处理电压
* @param vol
* @return
*/
public String channelVol(Float vol) {
BigDecimal value = new BigDecimal(vol);
BigDecimal noZeros = value.stripTrailingZeros();
return noZeros.toPlainString();
}
// 0-星型, 1-角型, 2-V型
// star-星型、Star_Triangle-星三角、Open_Delta-开口三角
public String getVolConType(Integer volConType) {
String result = null;
String dictDataCode = null;
switch (volConType) {
case 0:
dictDataCode = "star";
break;
case 1:
dictDataCode = "Star_Triangle";
break;
case 2:
dictDataCode = "Open_Delta";
break;
default:
break;
}
if (!Objects.isNull(dictDataCode)) {
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(dictDataCode,"Dev_Connect").getData();
result = dictData.getId();
}
return Objects.isNull(result)?null:result;
}
}

View File

@@ -529,7 +529,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
lambdaQueryWrapper.eq(WlRecord::getLineId,param.getLineId())
.between(WlRecord::getStartTime,param.getItemStartTime(),param.getItemEndTime())
.eq(WlRecord::getType,1)
.eq(WlRecord::getState,1).orderByDesc(WlRecord::getStartTime);
.eq(WlRecord::getState,1)
.orderByDesc(WlRecord::getStartTime);
if (Objects.equals(param.getDataSource(),0)) {
lambdaQueryWrapper.eq(WlRecord::getItemName,"补召");
} else if (Objects.equals(param.getDataSource(),1)) {
lambdaQueryWrapper.eq(WlRecord::getItemName,"在线监测");
}
List<WlRecord> list = this.list(lambdaQueryWrapper);
if (CollUtil.isNotEmpty(list)) {
list.forEach(item->{