功能优化
1.优化界面描述显示; 2.新增测试项暂态事件
This commit is contained in:
@@ -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