1.无线设备bug修改

This commit is contained in:
2024-09-24 16:40:32 +08:00
parent 35e521365d
commit d3f32fd396
11 changed files with 164 additions and 24 deletions

View File

@@ -52,6 +52,8 @@ public interface DataParam {
String EvtParamPhase = "Evt_Param_Phase";
String EvtParamDepth = "Evt_Param_VVaDepth";
String evtData = "evt_data";
String wlRecordPath = "test/";

View File

@@ -36,7 +36,7 @@ public class DataGroupEventVO {
private String itemName;
@ApiModelProperty("持续时间")
private Double duration;
private Double persistTime;
@ApiModelProperty("发生时刻")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss.SSS")

View File

@@ -154,12 +154,7 @@
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>event-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>access-api</artifactId>
@@ -167,6 +162,13 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>common-device-biz</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>

View File

@@ -19,6 +19,7 @@ import com.njcn.csdevice.enums.LineBaseEnum;
import com.njcn.csdevice.mapper.CsDataArrayMapper;
import com.njcn.csdevice.mapper.CsGroArrMapper;
import com.njcn.csdevice.mapper.CsGroupMapper;
import com.njcn.csdevice.mapper.OverlimitMapper;
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
import com.njcn.csdevice.pojo.param.EnergyBaseParam;
import com.njcn.csdevice.pojo.po.CsDataArray;
@@ -33,15 +34,14 @@ import com.njcn.csdevice.service.ICsDataArrayService;
import com.njcn.csdevice.service.ICsGroupService;
import com.njcn.csdevice.util.InfluxDbParamUtil;
import com.njcn.csdevice.utils.DataChangeUtil;
import com.njcn.csharmonic.api.EventFeignClient;
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.pojo.vo.CsEventVO;
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;
import com.njcn.influx.pojo.dto.EventDataSetDTO;
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
@@ -104,15 +104,13 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
private final EvtDataService evtDataService;
private final EventDetailFeignClient eventDetailFeignClient;
private final DecimalFormat df = new DecimalFormat("#0.00");
private final EleEvtFeignClient eleEvtFeignClient;
private final OverLimitClient overLimitClient;
private final OverlimitMapper overlimitMapper;
private final LineFeignClient lineFeignClient;
private final EventFeignClient eventFeignClient;
private final InfluxDbParamUtil influxDbParamUtil;
@@ -390,9 +388,13 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
return result;
}else if("3".equals(type)){
//传3 则是暂态事件tab页面
Page<DataGroupEventVO> returnpage = new Page<> (commonStatisticalQueryParam.getPageNum(),commonStatisticalQueryParam.getPageSize());
returnpage = this.getBaseMapper().getGroupEventList(returnpage,commonStatisticalQueryParam.getDevId(),commonStatisticalQueryParam.getLineId());
returnpage.getRecords().forEach(temp->{
CsEventUserQueryPage csEventUserQueryPage = new CsEventUserQueryPage();
csEventUserQueryPage.setPageNum(commonStatisticalQueryParam.getPageNum());
csEventUserQueryPage.setPageSize(commonStatisticalQueryParam.getPageSize());
csEventUserQueryPage.setLineId(commonStatisticalQueryParam.getLineId());
Page<DataGroupEventVO> csEventVOPage = eventFeignClient.pageQueryByLineId(csEventUserQueryPage).getData();
csEventVOPage.getRecords().forEach(temp->{
//事件描述、相别、暂降幅值,需要特殊处理赋值
//事件描述
EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData();
@@ -420,11 +422,18 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
}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(), DataParam.EvtParamDepth)).
collect(Collectors.toList());
if(CollectionUtil.isEmpty(evtParamDepth)){
temp.setFeatureAmplitude(null);
}else {
temp.setFeatureAmplitude(evtParamDepth.get(0).getValue().equals("-")?null:Float.parseFloat(evtParamDepth.get(0).getValue()));
}
}
});
return returnpage;
return csEventVOPage;
}
return null;
}
@@ -453,7 +462,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
@Override
public List<ThdDataTdVO> getDeviceTrendData(String devId, String lineId,String groupId) {
List<ThdDataTdVO> data = new ArrayList();
List<Overlimit> overlimits = overLimitClient.getOverLimitByLineIds(Arrays.asList(lineId)).getData();
List<Overlimit> overlimits = overlimitMapper.selectBatchIds(Arrays.asList(lineId));
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(lineId)).getData();
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(devId).collect(Collectors.toList())).getData();
//便携式设备-稳态指标-实时数据-指标

View File

@@ -6,15 +6,21 @@ import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.api.EquipmentFeignClient;
import com.njcn.csdevice.constant.DataParam;
import com.njcn.csdevice.enums.LineBaseEnum;
import com.njcn.csdevice.mapper.CsDeviceUserPOMapper;
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
import com.njcn.csdevice.mapper.CsLinePOMapper;
import com.njcn.csdevice.mapper.WlRecordMapper;
import com.njcn.csdevice.param.WlRecordPageParam;
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
import com.njcn.csdevice.pojo.dto.CsEquipmentProcessDTO;
import com.njcn.csdevice.pojo.param.WlRecordParam;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.csdevice.pojo.po.WlRecord;
import com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo;
@@ -39,6 +45,7 @@ import java.text.DecimalFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -65,6 +72,10 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
private final InfluxDbParamUtil influxDbParamUtil;
private final CsLinePOMapper csLinePOMapper;
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
private final DecimalFormat df = new DecimalFormat(DataParam.DecimalFormatStr);
@Override
@@ -176,6 +187,55 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
@Override
public Object queryPage(WlRecordPageParam wlRecordPageParam) {
//组装tree用于测试项绑定数据页面左侧的搜索树
/* List<RecordAllDevTreeVo> devList = new ArrayList<>();
if(wlRecordPageParam.getIsTrueFlag() == 0){
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(WlRecord::getType,1).eq(WlRecord::getState, DataStateEnum.ENABLE.getCode());
List<WlRecord> wlRecordList = this.list(lambdaQueryWrapper);
if(CollUtil.isNotEmpty(wlRecordList)){
List<String> devIds = wlRecordList.stream().map(WlRecord::getDevId).distinct().collect(Collectors.toList());
List<String> lineIds = wlRecordList.stream().map(WlRecord::getLineId).distinct().collect(Collectors.toList());
List<CsLinePO> csLinePOList = csLinePOMapper.selectBatchIds(lineIds);
Map<String,CsLinePO> csLinePOMap = csLinePOList.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
List<CsEquipmentDeliveryPO> csDevPOList = csEquipmentDeliveryMapper.selectList(new LambdaQueryWrapper<CsEquipmentDeliveryPO>().in(CsEquipmentDeliveryPO::getId,devIds));
Map<String,CsEquipmentDeliveryPO> csDevPOMap = csDevPOList.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
Map<String,List<WlRecord>> devMap = wlRecordList.stream().collect(Collectors.groupingBy(WlRecord::getDevId));
devMap.forEach((devId,list)->{
RecordAllDevTreeVo devTree = new RecordAllDevTreeVo();
devTree.setId(devId);
devTree.setName(csDevPOMap.get(list.get(0).getDevId()).getName());
devTree.setPid("0");
Map<String,List<WlRecord>> lineMap = list.stream().collect(Collectors.groupingBy(WlRecord::getLineId));
List<RecordAllDevTreeVo> csLineList = new ArrayList<>();
lineMap.forEach((lineId,lineList)->{
RecordAllDevTreeVo recordAllDevTreeVo = new RecordAllDevTreeVo();
recordAllDevTreeVo.setId(lineId);
recordAllDevTreeVo.setName(csLinePOMap.get(lineList.get(0).getLineId()).getName());
recordAllDevTreeVo.setPid(devId);
List<RecordAllDevTreeVo> iiList = new ArrayList<>();
lineList.forEach(it->{
RecordAllDevTreeVo ii = new RecordAllDevTreeVo();
ii.setId(it.getId());
ii.setName(it.getStartTime()+"-"+it.getEndTime());
ii.setPid(lineId);
iiList.add(ii);
});
recordAllDevTreeVo.setChildren(iiList);
csLineList.add(recordAllDevTreeVo);
});
devTree.setChildren(csLineList);
devList.add(devTree);
});
}
}*/
List<RecordAllDevTreeVo> recordAllDevTreeVos = this.baseMapper.getRecordAll(wlRecordPageParam);
for (RecordAllDevTreeVo recordAllDevTreeVo : recordAllDevTreeVos){
wlRecordPageParam.setDevId(recordAllDevTreeVo.getId());

View File

@@ -1,9 +1,13 @@
package com.njcn.csharmonic.api;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
import com.njcn.csharmonic.api.fallback.EventFeignClientFallbackFactory;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.pojo.po.CsEventPO;
import com.njcn.csharmonic.pojo.vo.CsEventVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -18,4 +22,7 @@ public interface EventFeignClient {
@PostMapping("/saveBatchEventList")
HttpResult<String> saveBatchEventList(@RequestBody List<CsEventPO> csEventPOS);
@PostMapping("/pageQueryByLineId")
HttpResult<Page<DataGroupEventVO>> pageQueryByLineId(@RequestBody CsEventUserQueryPage csEventUserQueryPage);
}

View File

@@ -1,10 +1,14 @@
package com.njcn.csharmonic.api.fallback;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
import com.njcn.csharmonic.api.EventFeignClient;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.pojo.po.CsEventPO;
import com.njcn.csharmonic.pojo.vo.CsEventVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -30,6 +34,12 @@ public class EventFeignClientFallbackFactory implements FallbackFactory<EventFei
log.error("{}异常,降级处理,异常为:{}","获取当天事件未读消息未读消息",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<Page<DataGroupEventVO>> pageQueryByLineId(CsEventUserQueryPage csEventUserQueryPage) {
log.error("{}异常,降级处理,异常为:{}","根据监测点分页查询暂降事件",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -40,6 +40,9 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
*/
private String deviceId;
@ApiModelProperty(value = "测点id")
private String lineId;
}

View File

@@ -1,10 +1,13 @@
package com.njcn.csharmonic.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
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.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.pojo.po.CsEventPO;
import com.njcn.csharmonic.pojo.vo.CsEventVO;
@@ -33,7 +36,8 @@ import java.util.List;
@RequestMapping("/event")
@Api(tags = "暂降事件")
@AllArgsConstructor
public class EventController extends BaseController {
public class CsEventController extends BaseController {
private final CsEventPOService csEventPOService;
@@ -47,6 +51,17 @@ public class EventController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/pageQueryByLineId")
@ApiOperation("根据监测点分页查询暂降事件")
@ApiImplicitParam(name = "csEventUserQueryPage", value = "暂降事件查询参数", required = true)
public HttpResult<Page<DataGroupEventVO>> pageQueryByLineId(@RequestBody CsEventUserQueryPage csEventUserQueryPage) {
String methodDescribe = getMethodDescribe("queryEventList");
Page<DataGroupEventVO> page = csEventPOService.pageQueryByLineId(csEventUserQueryPage);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/analyseWave")
@ApiOperation("暂态事件波形分析")

View File

@@ -1,5 +1,8 @@
package com.njcn.csharmonic.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.pojo.po.CsEventPO;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -40,5 +43,7 @@ public interface CsEventPOService extends IService<CsEventPO>{
List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam);
Page<DataGroupEventVO> pageQueryByLineId(CsEventUserQueryPage csEventUserQueryPage);
void saveBatchEventList(List<CsEventPO> csEventPOS);
}

View File

@@ -1,14 +1,22 @@
package com.njcn.csharmonic.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.CsLedgerFeignClient;
import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.pojo.vo.CsEventVO;
import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
@@ -119,6 +127,25 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
return list;
}
@Override
public Page<DataGroupEventVO> pageQueryByLineId(CsEventUserQueryPage csEventUserQueryPage) {
Page<DataGroupEventVO> result = new Page<>(csEventUserQueryPage.getPageNum(),csEventUserQueryPage.getPageSize());
DateTime begin = DateUtil.parse(csEventUserQueryPage.getStartTime(), DatePattern.NORM_DATE_PATTERN);
DateTime end = DateUtil.endOfDay(DateUtil.parse(csEventUserQueryPage.getEndTime(), DatePattern.NORM_DATE_PATTERN));
LambdaQueryWrapper<CsEventPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CsEventPO::getLineId,csEventUserQueryPage.getLineId())
.eq(CsEventPO::getType,0).between(CsEventPO::getStartTime,begin,end)
.orderByDesc(CsEventPO::getStartTime);
Page<CsEventPO> page = this.page(new Page<>(csEventUserQueryPage.getPageNum(),csEventUserQueryPage.getPageSize()),lambdaQueryWrapper);
if(CollUtil.isNotEmpty(page.getRecords())){
List<DataGroupEventVO> dataGroupEventVOList = BeanUtil.copyToList(page.getRecords(),DataGroupEventVO.class);
result.setRecords(dataGroupEventVOList);
result.setTotal(page.getTotal());
}
return result;
}
@Override
@Transactional
public void saveBatchEventList(List<CsEventPO> csEventPOS) {