系统配置

This commit is contained in:
huangzj
2023-07-05 13:54:42 +08:00
parent 1b3013e87a
commit e2a1818dd3
24 changed files with 660 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
package com.njcn.csharmonic.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.CsLedgerFeignClient;
import com.njcn.csdevice.api.CsLineFeignClient;
@@ -154,6 +155,7 @@ public class StableDataServiceImpl implements StableDataService {
@Override
public List<ThdDataVO> queryFisrtCommonStatistical(CommonStatisticalQueryParam commonStatisticalQueryParam) {
Optional.ofNullable(commonStatisticalQueryParam.getDevId()).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.DEVICE_LOSE));
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineByDevId(commonStatisticalQueryParam.getDevId()).getData();
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
@@ -183,8 +185,12 @@ public class StableDataServiceImpl implements StableDataService {
@Override
public List<ThdDataVO> queryCommonStatisticalByTime(CommonStatisticalQueryParam commonStatisticalQueryParam) {
Optional.ofNullable(commonStatisticalQueryParam.getDevId()).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.DEVICE_LOSE));
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineByDevId(commonStatisticalQueryParam.getDevId()).getData();
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
if(CollectionUtil.isEmpty(csLinePOList)){
throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR);
}
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
@@ -211,8 +217,14 @@ public class StableDataServiceImpl implements StableDataService {
@Override
public List<ThdDataVO> queryLineCommonStatistical(CommonStatisticalQueryParam commonStatisticalQueryParam) {
if(CollectionUtil.isEmpty(commonStatisticalQueryParam.getLineList())){
throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR);
}
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineById(commonStatisticalQueryParam.getLineList()).getData();
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
if(CollectionUtil.isEmpty(csLinePOList)){
throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR);
}
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
@@ -226,6 +238,9 @@ public class StableDataServiceImpl implements StableDataService {
vo.setLineId(temp.getLineId());
vo.setPhase(temp.getPhaseType());
String position = csLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
String lineName = csLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getName();
vo.setLineName(lineName);
vo.setPosition(position);
vo.setTime(temp.getTime().atZone(ZoneId.systemDefault()).toLocalDateTime());
vo.setStatMethod(temp.getValueType());