功能优化
1.优化界面描述显示; 2.新增测试项暂态事件
This commit is contained in:
@@ -112,6 +112,10 @@ public class WlRecordParam {
|
||||
@ApiModelProperty("测试项结束时间")
|
||||
private String itemEndTime;
|
||||
|
||||
@ApiModelProperty("数据来源 0:补召 1:在线监测 ")
|
||||
private Integer dataSource;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -12,7 +13,7 @@ import java.time.LocalDateTime;
|
||||
* @date 2023/6/19
|
||||
*/
|
||||
@Data
|
||||
public class DataGroupEventVO {
|
||||
public class DataGroupEventVO {
|
||||
|
||||
@ApiModelProperty("id")
|
||||
private String id;
|
||||
@@ -26,6 +27,12 @@ public class DataGroupEventVO {
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty("装置ID")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("装置名称")
|
||||
private String devName;
|
||||
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ public class RecordVo {
|
||||
@ApiModelProperty("名称")
|
||||
private String itemName;
|
||||
|
||||
@ApiModelProperty("监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty("数据起始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
@@ -246,6 +246,5 @@ public class WlRecordController extends BaseController {
|
||||
List<WlRecord> result = wlRecordService.getWlAssByWlId(wlId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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->{
|
||||
|
||||
@@ -26,4 +26,7 @@ public class DataParam implements Serializable {
|
||||
@ApiModelProperty("数据标志")
|
||||
private String dataLevel;
|
||||
|
||||
@ApiModelProperty("数据来源 0:补召 1:在线监测 ")
|
||||
private Integer dataSource;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
||||
@@ -15,10 +16,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -53,4 +51,15 @@ public class DataController extends BaseController {
|
||||
List<RecordVo> list = dataService.getTestData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventByItem")
|
||||
@ApiOperation("方案数据-》根据测试项获取暂态事件")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||
public HttpResult<List<DataGroupEventVO>> getEventByItem(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getEventByItem");
|
||||
List<DataGroupEventVO> list = dataService.getEventByItem(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -49,4 +50,6 @@ public interface CsEventPOService extends IService<CsEventPO>{
|
||||
void saveBatchEventList(List<CsEventPO> csEventPOS);
|
||||
|
||||
void getFileZip(String eventId,HttpServletResponse response);
|
||||
|
||||
List<DataGroupEventVO> queryEventList(LocalDateTime startDate, LocalDateTime endDate, String lineId);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.csharmonic.service;
|
||||
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
||||
@@ -23,4 +24,9 @@ public interface IDataService {
|
||||
*/
|
||||
List<RecordVo> getTestData(DataParam param);
|
||||
|
||||
/**
|
||||
* 根据测试项id获取时间范围内的暂态事件
|
||||
*/
|
||||
List<DataGroupEventVO> getEventByItem(String id);
|
||||
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -206,6 +207,20 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataGroupEventVO> queryEventList(LocalDateTime startDate, LocalDateTime endDate, String lineId) {
|
||||
List<DataGroupEventVO> dataGroupEventVOList = new ArrayList<>();
|
||||
LambdaQueryWrapper<CsEventPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEventPO::getLineId,lineId)
|
||||
.eq(CsEventPO::getType,0).between(CsEventPO::getStartTime,startDate,endDate)
|
||||
.orderByDesc(CsEventPO::getStartTime);
|
||||
List<CsEventPO> pos = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
if(CollUtil.isNotEmpty(pos)){
|
||||
dataGroupEventVOList = BeanUtil.copyToList(pos,DataGroupEventVO.class);
|
||||
}
|
||||
return dataGroupEventVOList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return WaveDataDTO
|
||||
|
||||
@@ -1,27 +1,38 @@
|
||||
package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.api.WlRecordFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordTemplete;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csdevice.utils.DataChangeUtil;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
import com.njcn.csharmonic.constant.HarmonicConstant;
|
||||
import com.njcn.csharmonic.mapper.CsDataSetMapper;
|
||||
import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
||||
import com.njcn.csharmonic.service.CsEventPOService;
|
||||
import com.njcn.csharmonic.service.IDataService;
|
||||
import com.njcn.csharmonic.util.InfluxDbParamUtil;
|
||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
import com.njcn.influx.service.CommonService;
|
||||
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.influx.service.EvtDataService;
|
||||
import com.njcn.system.api.*;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.system.pojo.po.EleEvtParm;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -49,7 +60,12 @@ public class DataServiceImpl implements IDataService {
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
private final CsDataSetMapper csDataSetMapper;
|
||||
private final WlRecordFeignClient wlRecordFeignClient;
|
||||
private final CsEventPOService csEventPOService;
|
||||
private final DecimalFormat df = new DecimalFormat("#0.00");
|
||||
private final EpdFeignClient epdFeignClient;
|
||||
private final EvtDataService evtDataService;
|
||||
private final EleEvtFeignClient eleEvtFeignClient;
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
@Override
|
||||
public List<RealTimeDataVo> getRealTimeData(DataParam param) {
|
||||
@@ -97,9 +113,78 @@ public class DataServiceImpl implements IDataService {
|
||||
String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(param.getEndTime(), DatePattern.NORM_DATE_PATTERN)),DatePattern.NORM_DATETIME_PATTERN);
|
||||
record.setItemStartTime(beginDay);
|
||||
record.setItemEndTime(endDay);
|
||||
record.setDataSource(param.getDataSource());
|
||||
return wlRecordFeignClient.findDevBaseDataByLineId(record).getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataGroupEventVO> getEventByItem(String id) {
|
||||
List<DataGroupEventVO> result = new ArrayList<>();
|
||||
List<WlRecord> list = wlRecordFeignClient.getWlAssByWlId(id).getData();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
list.forEach(item->{
|
||||
List<DataGroupEventVO> eventList = csEventPOService.queryEventList(item.getStartTime(),item.getEndTime(),item.getLineId());
|
||||
result.addAll(eventList);
|
||||
});
|
||||
}
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
result.forEach(temp->{
|
||||
String lineName = csLineFeignClient.getById(temp.getLineId()).getData().getName();
|
||||
temp.setLineName(lineName);
|
||||
List<CsEquipmentDeliveryDTO> dto = equipmentFeignClient.queryDeviceById(Collections.singletonList(temp.getDeviceId())).getData();
|
||||
if (CollUtil.isNotEmpty(dto)) {
|
||||
String devName = dto.get(0).getName();
|
||||
temp.setDevName(devName);
|
||||
}
|
||||
|
||||
EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData();
|
||||
if(ele!=null){
|
||||
temp.setShowName(ele.getShowName());
|
||||
//相别
|
||||
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData();
|
||||
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
|
||||
for (EleEvtParm eleEvtParm : data1) {
|
||||
EventDataSetDTO eventDataSetDTO = new EventDataSetDTO();
|
||||
BeanUtils.copyProperties(eleEvtParm,eventDataSetDTO);
|
||||
EventDataSetDTO evtData = evtDataService.getEventDataSet(com.njcn.csdevice.constant.DataParam.evtData, temp.getId(), eleEvtParm.getName());
|
||||
if (evtData == null) {
|
||||
eventDataSetDTO.setValue("-");
|
||||
}else {
|
||||
eventDataSetDTO.setValue(Optional.ofNullable(evtData.getValue()).orElse("-"));
|
||||
}
|
||||
eventDataSetDTOS.add(eventDataSetDTO);
|
||||
}
|
||||
List<EventDataSetDTO> evtParamPhase = eventDataSetDTOS.stream().
|
||||
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), com.njcn.csdevice.constant.DataParam.EvtParamPhase)).
|
||||
collect(Collectors.toList());
|
||||
if(CollectionUtil.isEmpty(evtParamPhase)){
|
||||
temp.setPhaseType(null);
|
||||
}else {
|
||||
temp.setPhaseType(evtParamPhase.get(0).getValue()+(Objects.isNull(evtParamPhase.get(0).getUnit())?"":evtParamPhase.get(0).getUnit()));
|
||||
}
|
||||
|
||||
List<EventDataSetDTO> evtParamDepth = eventDataSetDTOS.stream().
|
||||
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), com.njcn.csdevice.constant.DataParam.EvtParamDepth)).
|
||||
collect(Collectors.toList());
|
||||
if(CollectionUtil.isEmpty(evtParamDepth)){
|
||||
temp.setFeatureAmplitude(null);
|
||||
}else {
|
||||
temp.setFeatureAmplitude("-".equals(evtParamDepth.get(0).getValue())?null:Float.parseFloat(evtParamDepth.get(0).getValue()));
|
||||
}
|
||||
List<EventDataSetDTO> evtParmTm = eventDataSetDTOS.stream().
|
||||
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), com.njcn.csdevice.constant.DataParam.EVTPARAMTM)).
|
||||
collect(Collectors.toList());
|
||||
if(CollectionUtil.isEmpty(evtParamDepth)){
|
||||
temp.setPersistTime(null);
|
||||
}else {
|
||||
temp.setPersistTime("-".equals(evtParmTm.get(0).getValue())?null:Double.parseDouble(evtParmTm.get(0).getValue()));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//基础数据
|
||||
public RealTimeDataVo getBaseData(EleEpdPqd item2, String lineId, String dataLevel, String csDataSetLevel,Double pt, Double ct) {
|
||||
RealTimeDataVo vo = new RealTimeDataVo();
|
||||
|
||||
Reference in New Issue
Block a user