设备监控右侧新增:趋势数据、实时数据、暂态事件相关接口

This commit is contained in:
guofeihu
2024-07-02 16:42:36 +08:00
parent dfa3cb675a
commit 5385d3163b
7 changed files with 355 additions and 140 deletions

View File

@@ -17,4 +17,10 @@ public interface DataParam {
long FILE_SIZE = 10 * 1024 * 1024;
//便携式设备编码(用于某些业务判断)
String portableDevType = "8b45cf6b7f5266e777d07c166ad5fa77";
//统计类型配置-便携式设备-稳态指标的ID(用于某些业务判断)
String portableDevStatisticalId = "bce2dfdfb46c4d96e92584def276d1c8";
//便携式设备默认统计方式
String portableDevStatisticalMethods = "min";
}

View File

@@ -11,6 +11,8 @@ import com.njcn.csdevice.pojo.param.EnergyBaseParam;
import com.njcn.csdevice.pojo.vo.CsGroupVO;
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
import com.njcn.csdevice.service.ICsGroupService;
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -79,13 +81,36 @@ public class CsGroupController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/deviceDataByType")
@ApiOperation("根据类型查询趋势数据、暂态数据、实时数据")
@ApiImplicitParam(name = "energyBaseParam",required = true)
public HttpResult<Object> deviceDataByType(@RequestBody Map map){
@ApiImplicitParam(name = "commonStatisticalQueryParam",required = true)
public HttpResult<Object> deviceDataByType(@RequestBody CommonStatisticalQueryParam commonStatisticalQueryParam){
String methodDescribe = getMethodDescribe("deviceDataByType");
Object obj = csGroupService.deviceDataByType(map);
Object obj = csGroupService.deviceDataByType(commonStatisticalQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, obj, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getDeviceTrendData")
@ApiOperation("查询实时数据中实时趋势")
@ApiImplicitParams({
@ApiImplicitParam(name = "devId", value = "设备ID", required = true),
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true)
})
public HttpResult<List<ThdDataVO>> getDeviceTrendData(@RequestParam("devId") String devId, @RequestParam(value = "lineId")String lineId){
String methodDescribe = getMethodDescribe("getDeviceTrendData");
List<ThdDataVO> list = csGroupService.getDeviceTrendData(devId,lineId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getDeviceHarmonicSpectrumData")
@ApiOperation("查询实时数据中谐波频谱")
@ApiImplicitParam(name = "commonStatisticalQueryParam",required = true)
public HttpResult<List<ThdDataVO>> getDeviceHarmonicSpectrumData(@RequestBody CommonStatisticalQueryParam commonStatisticalQueryParam){
String methodDescribe = getMethodDescribe("getDeviceHarmonicSpectrumData");
List<ThdDataVO> list = csGroupService.getDeviceHarmonicSpectrumData(commonStatisticalQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/deleteGroup")
@ApiOperation("删除分组")

View File

@@ -6,9 +6,9 @@ import com.njcn.csdevice.pojo.param.EnergyBaseParam;
import com.njcn.csdevice.pojo.po.CsGroup;
import com.njcn.csdevice.pojo.vo.CsGroupVO;
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -42,7 +42,19 @@ public interface ICsGroupService extends IService<CsGroup> {
* 根据类型查询趋势数据、暂态数据、实时数据
* @return
*/
Object deviceDataByType(Map map);
Object deviceDataByType(CommonStatisticalQueryParam commonStatisticalQueryParam);
/**
* 查询实时数据中实时趋势
* @return
*/
List<ThdDataVO> getDeviceTrendData(String devId,String lineId);
/**
* 查询实时数据中实时趋势
* @return
*/
List<ThdDataVO> getDeviceHarmonicSpectrumData(CommonStatisticalQueryParam commonStatisticalQueryParam);
/**
* 删除组信息

View File

@@ -1,6 +1,7 @@
package com.njcn.csdevice.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -10,6 +11,7 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils;
import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.api.EquipmentFeignClient;
import com.njcn.csdevice.constant.DataParam;
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.csdevice.mapper.CsDataArrayMapper;
import com.njcn.csdevice.mapper.CsGroArrMapper;
@@ -26,6 +28,7 @@ import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
import com.njcn.csdevice.service.ICsDataArrayService;
import com.njcn.csdevice.service.ICsGroupService;
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
import com.njcn.event.api.EventDetailFeignClient;
import com.njcn.event.pojo.po.RmpEventDetailPO;
@@ -42,6 +45,8 @@ import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.system.pojo.po.EleEpdPqd;
import com.njcn.system.pojo.po.EleEvtParm;
import com.njcn.system.pojo.vo.CsStatisticalSetVO;
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@@ -49,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@@ -227,43 +233,31 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
}
@Override
public Object deviceDataByType(Map map) {
Object type = map.get("type");
public Object deviceDataByType(CommonStatisticalQueryParam commonStatisticalQueryParam) {
String type = commonStatisticalQueryParam.getType();
if (type == null) throw new BusinessException("type参数缺失");
//传1 则是趋势数据tab页面
if("1".equals(type.toString())){
if("1".equals(type)){
formatQueryParamList(commonStatisticalQueryParam);
List<ThdDataVO> result = new ArrayList();
Object devId = map.get("devId");
Object lineId = map.get("lineId");
Object startTime = map.get("startTime");
Object endTime = map.get("endTime");
Object statisticalId = map.get("statisticalId");
Object valueType = map.get("valueType");
Object frequency = map.get("frequency");
if (devId == null) throw new BusinessException("devId参数缺失");
if (lineId == null) throw new BusinessException("lineId参数缺失");
if (startTime == null) throw new BusinessException("startTime参数缺失");
if (endTime == null) throw new BusinessException("endTime参数缺失");
if (statisticalId == null) throw new BusinessException("statisticalId参数缺失");
if (valueType == null) throw new BusinessException("valueType参数缺失");
if (frequency == null) throw new BusinessException("frequency参数缺失");
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(devId.toString()).collect(Collectors.toList())).getData();
List<String> ids = new ArrayList();
ids.add(lineId.toString());
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(ids).getData();
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(statisticalId.toString()).getData();
if(CollectionUtil.isNotEmpty(data)){
data.forEach(epdPqd->{
String finalFrequency1 = Optional.ofNullable(frequency.toString()).orElse("");
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(commonStatisticalQueryParam.getDevId()).collect(Collectors.toList())).getData();
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(commonStatisticalQueryParam.getLineId())).getData();
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
if(param.getStatisticalId() == null){
continue;
}
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
eleEpdPqds.forEach(epdPqd->{
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
CommonQueryParam commonQueryParam = new CommonQueryParam();
commonQueryParam.setLineId(temp.getLineId());
commonQueryParam.setTableName(getTableNameByClassId(epdPqd.getClassId()));
commonQueryParam.setColumnName(epdPqd.getName()+ finalFrequency1);
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
commonQueryParam.setPhasic(epdPqd.getPhase());
commonQueryParam.setStartTime(startTime.toString());
commonQueryParam.setEndTime(endTime.toString());
commonQueryParam.setDataType(valueType.toString());
commonQueryParam.setStartTime(commonStatisticalQueryParam.getStartTime());
commonQueryParam.setEndTime(commonStatisticalQueryParam.getEndTime());
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
commonQueryParam.setClDid(getClDidByLineId(temp.getLineId()));
return commonQueryParam;
@@ -287,22 +281,54 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
result.addAll(collect1);
});
}
}
return result;
}else if("2".equals(type.toString())){
}else if("2".equals(type)){
//传2 则是实时数据tab页面
}else if("3".equals(type.toString())){
List<ThdDataVO> result = new ArrayList();
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(commonStatisticalQueryParam.getLineId())).getData();
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(commonStatisticalQueryParam.getDevId()).collect(Collectors.toList())).getData();
//便携式设备的稳态指标
CsStatisticalSetVO csStatisticalSetVO = csStatisticalSetFeignClient.queryStatistical(DataParam.portableDevStatisticalId).getData();
List<EleEpdPqd> eleEpdPqds = new ArrayList<>();
csStatisticalSetVO.getSelectedList().forEach(css->{
eleEpdPqds.addAll(css.getEleEpdPqdVOS());
});
eleEpdPqds.forEach(epdPqd->{
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
CommonQueryParam commonQueryParam = new CommonQueryParam();
commonQueryParam.setLineId(temp.getLineId());
commonQueryParam.setTableName(getTableNameByClassId(epdPqd.getClassId()));
commonQueryParam.setColumnName(epdPqd.getName());
commonQueryParam.setPhasic(epdPqd.getPhase());
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType() == null ? DataParam.portableDevStatisticalMethods:commonStatisticalQueryParam.getValueType());
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
commonQueryParam.setClDid(getClDidByLineId(temp.getLineId()));
return commonQueryParam;
}).collect(Collectors.toList());
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtData(commonQueryParams);
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
ThdDataVO vo = new ThdDataVO();
vo.setLineId(temp.getLineId());
vo.setPhase(temp.getPhaseType());
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
vo.setPosition(position);
vo.setTime(temp.getTime());
vo.setStatMethod(temp.getValueType());
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
vo.setStatisticalIndex(epdPqd.getId());
vo.setUnit(epdPqd.getUnit());
vo.setStatisticalName(epdPqd.getName());
vo.setAnotherName(epdPqd.getShowName());
return vo;
}).collect(Collectors.toList());
result.addAll(collect1);
});
return result;
}else if("3".equals(type)){
//传3 则是暂态事件tab页面
Object pageNum = map.get("pageNum");
Object pageSize = map.get("pageSize");
Object devId = map.get("devId");
Object lineId = map.get("lineId");
if (devId == null) throw new BusinessException("devId参数缺失");
if (lineId == null) throw new BusinessException("lineId参数缺失");
if (pageNum == null) throw new BusinessException("pageNum参数缺失");
if (pageSize == null) throw new BusinessException("pageSize参数缺失");
Page<DataGroupEventVO> returnpage = new Page<> (Integer.parseInt(pageNum.toString()),Integer.parseInt(pageSize.toString()));
returnpage = this.getBaseMapper().getGroupEventList(returnpage,devId.toString(),lineId.toString());
Page<DataGroupEventVO> returnpage = new Page<> (commonStatisticalQueryParam.getPageNum(),commonStatisticalQueryParam.getPageSize());
returnpage = this.getBaseMapper().getGroupEventList(returnpage,commonStatisticalQueryParam.getDevId(),commonStatisticalQueryParam.getLineId());
returnpage.getRecords().forEach(temp->{
//事件描述、相别、暂降幅值,需要特殊处理赋值
//事件描述
@@ -320,7 +346,6 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
eventDataSetDTO.setValue("-");
}else {
eventDataSetDTO.setValue(Optional.ofNullable(evtData.getValue()).orElse("-"));
}
eventDataSetDTOS.add(eventDataSetDTO);
}
@@ -334,14 +359,134 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
}
}
//暂降幅值
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()));
//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()));
});
return returnpage;
}
return null;
}
private void formatQueryParamList(CommonStatisticalQueryParam commonStatisticalQueryParam){
List<CommonStatisticalQueryParam> list = new ArrayList<>();
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
for(CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
if(param.getFrequencys() != null && param.getFrequencys().size() > 0){
for (String frequency : param.getFrequencys()){
CommonStatisticalQueryParam cp = new CommonStatisticalQueryParam();
cp.setStatisticalId(param.getStatisticalId());
cp.setFrequency(frequency);
list.add(cp);
}
}else{
CommonStatisticalQueryParam cp = new CommonStatisticalQueryParam();
cp.setStatisticalId(param.getStatisticalId());
list.add(cp);
}
}
commonStatisticalQueryParam.setList(list);
}
}
@Override
public List<ThdDataVO> getDeviceTrendData(String devId, String lineId) {
List<ThdDataVO> result = new ArrayList();
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(lineId)).getData();
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(devId.toString()).collect(Collectors.toList())).getData();
//便携式设备的稳态指标
CsStatisticalSetVO csStatisticalSetVO = csStatisticalSetFeignClient.queryStatistical(DataParam.portableDevStatisticalId).getData();
List<EleEpdPqd> eleEpdPqds = new ArrayList<>();
csStatisticalSetVO.getSelectedList().forEach(css->{
for(EleEpdPqd epdPqd : css.getEleEpdPqdVOS()){
if(epdPqd.getHarmStart() != null && epdPqd.getHarmEnd() != null){
eleEpdPqds.add(epdPqd);
}
}
});
eleEpdPqds.forEach(epdPqd->{
for (int i = epdPqd.getHarmStart().intValue(); i < epdPqd.getHarmEnd().intValue(); i++) {
String index = i+"";
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
CommonQueryParam commonQueryParam = new CommonQueryParam();
commonQueryParam.setLineId(temp.getLineId());
commonQueryParam.setTableName(getTableNameByClassId(epdPqd.getClassId()));
commonQueryParam.setColumnName(epdPqd.getName()+"_"+index);
commonQueryParam.setPhasic(epdPqd.getPhase());
commonQueryParam.setDataType(DataParam.portableDevStatisticalMethods);
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
commonQueryParam.setClDid(getClDidByLineId(temp.getLineId()));
return commonQueryParam;
}).collect(Collectors.toList());
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtData(commonQueryParams);
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
ThdDataVO vo = new ThdDataVO();
vo.setLineId(temp.getLineId());
vo.setPhase(temp.getPhaseType());
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
vo.setPosition(position);
vo.setTime(temp.getTime());
vo.setStatMethod(temp.getValueType());
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
vo.setStatisticalIndex(epdPqd.getId());
vo.setUnit(epdPqd.getUnit());
vo.setStatisticalName(epdPqd.getName());
vo.setAnotherName(epdPqd.getShowName());
vo.setFrequency(index);
return vo;
}).collect(Collectors.toList());
result.addAll(collect1);
}
});
return result;
}
@Override
public List<ThdDataVO> getDeviceHarmonicSpectrumData(CommonStatisticalQueryParam commonStatisticalQueryParam) {
formatQueryParamList(commonStatisticalQueryParam);
List<ThdDataVO> result = new ArrayList();
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(commonStatisticalQueryParam.getDevId()).collect(Collectors.toList())).getData();
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(commonStatisticalQueryParam.getLineId())).getData();
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
if(param.getStatisticalId() == null){
continue;
}
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
eleEpdPqds.forEach(epdPqd->{
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
CommonQueryParam commonQueryParam = new CommonQueryParam();
commonQueryParam.setLineId(temp.getLineId());
commonQueryParam.setTableName(getTableNameByClassId(epdPqd.getClassId()));
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
commonQueryParam.setPhasic(epdPqd.getPhase());
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
commonQueryParam.setClDid(getClDidByLineId(temp.getLineId()));
return commonQueryParam;
}).collect(Collectors.toList());
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtData(commonQueryParams);
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
ThdDataVO vo = new ThdDataVO();
vo.setLineId(temp.getLineId());
vo.setPhase(temp.getPhaseType());
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
vo.setPosition(position);
vo.setTime(temp.getTime());
vo.setStatMethod(temp.getValueType());
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
vo.setStatisticalIndex(epdPqd.getId());
vo.setUnit(epdPqd.getUnit());
vo.setStatisticalName(epdPqd.getName());
vo.setAnotherName(epdPqd.getShowName());
return vo;
}).collect(Collectors.toList());
result.addAll(collect1);
});
}
}
return result;
}
/*表名换成了id本方法做转换*/
private String getTableNameByClassId(String classId){
DictData data = dicDataFeignClient.getDicDataById(classId).getData();

View File

@@ -39,10 +39,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.text.DecimalFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -305,22 +302,23 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
}
//进行时间覆盖
//开始组装查询数据对象
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
//
formatQueryParamList(commonStatisticalQueryParam);
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
if(param.getStatisticalId() == null){
continue;
}
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
for(WlRecord wl : data){
//根据设备ID获取设备基础信息
List<String> ids = new ArrayList();
ids.add(wl.getLineId());
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(ids).getData();
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(wl.getLineId())).getData();
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(wl.getDevId()).collect(Collectors.toList())).getData();
//获取指标下的具体分类指标
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
eleEpdPqds.forEach(epdPqd->{
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
CommonQueryParam commonQueryParam = new CommonQueryParam();
commonQueryParam.setLineId(temp.getLineId());
commonQueryParam.setTableName(getTableNameByClassId(epdPqd.getClassId()));
commonQueryParam.setColumnName(epdPqd.getName()+ frequency);
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
commonQueryParam.setPhasic(epdPqd.getPhase());
commonQueryParam.setStartTime(LocalDateTimeUtil.format(wl.getStartTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
commonQueryParam.setEndTime(LocalDateTimeUtil.format(wl.getEndTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
@@ -348,9 +346,32 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
result.addAll(collect1);
});
}
}
}
return result;
}
private void formatQueryParamList(CommonStatisticalQueryParam commonStatisticalQueryParam){
List<CommonStatisticalQueryParam> list = new ArrayList<>();
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
for(CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
if(param.getFrequencys() != null && param.getFrequencys().size() > 0){
for (String frequency : param.getFrequencys()){
CommonStatisticalQueryParam cp = new CommonStatisticalQueryParam();
cp.setStatisticalId(param.getStatisticalId());
cp.setFrequency(frequency);
list.add(cp);
}
}else{
CommonStatisticalQueryParam cp = new CommonStatisticalQueryParam();
cp.setStatisticalId(param.getStatisticalId());
list.add(cp);
}
}
commonStatisticalQueryParam.setList(list);
}
}
/*表名换成了id本方法做转换*/
private String getTableNameByClassId(String classId){
DictData data = dicDataFeignClient.getDicDataById(classId).getData();

View File

@@ -20,7 +20,6 @@ public class CommonStatisticalQueryParam {
@ApiModelProperty(value = "设备id")
private String DevId;
@ApiModelProperty(value = "指标组id")
@NotBlank(message="指标组id不能为空")
private String statisticalId;
@ApiModelProperty(value = "取值类型MaxMincp95avg")
private String valueType;
@@ -35,9 +34,16 @@ public class CommonStatisticalQueryParam {
private String process;
@ApiModelProperty(value = "用于选择多个指标及谐波次数")
List<CommonStatisticalQueryParam> list;
//用于暂态事件列表分页
@ApiModelProperty(value = "多个谐波次数")
private List<String> frequencys;
private int pageNum;
private int pageSize;
@ApiModelProperty(value = "查询分类:传1 则是趋势数据tab页面,传2 则是实时数据tab页面,传3 则是暂态事件tab页面")
private String type;
@ApiModelProperty(value = "监测点")
private String lineId;
}

View File

@@ -30,7 +30,7 @@ public class ThdDataVO {
private String unit;
private String anotherName;
private String frequency;
private Double statisticalData;