组态相关功能提交
This commit is contained in:
@@ -4,16 +4,13 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.njcn.cloud.enums.app.UserCodeEnum;
|
||||
import com.njcn.cloud.pojo.vo.AdminStatistic.Integrity;
|
||||
import com.njcn.cloud.pojo.vo.AdminStatistic.StaticInfo;
|
||||
import com.njcn.cloud.service.AdminStatistic.DataIntegrityService;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.LineIntegrityClient;
|
||||
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
import com.njcn.device.pq.pojo.vo.DevDetail;
|
||||
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
@@ -80,4 +77,4 @@ public class DataIntegrityServiceImpl implements DataIntegrityService {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
List<CsLedgerVO> getLineTree();
|
||||
|
||||
/**
|
||||
* 终端三层树
|
||||
* 终端三层树
|
||||
* @return
|
||||
*/
|
||||
List<CsLedgerVO> getDeviceTree();
|
||||
|
||||
@@ -39,8 +39,11 @@ public class ZuTaiDTO {
|
||||
@SerializedName("lineId")
|
||||
private String lineId;
|
||||
|
||||
@SerializedName("UIDType")
|
||||
private Boolean uIdType;
|
||||
|
||||
@SerializedName("UID")
|
||||
private List<String> uId;
|
||||
private List<Object> uId;
|
||||
|
||||
@SerializedName("UIDName")
|
||||
private String target;
|
||||
|
||||
@@ -38,12 +38,14 @@ public class ZuTaiNewDTO {
|
||||
private List<String> lineList;
|
||||
private String lineName;
|
||||
@JsonProperty("UID")
|
||||
private List<List<String>> uid;
|
||||
private List<Object> uid;
|
||||
@JsonProperty("UIDNames")
|
||||
|
||||
private List<String> uidNames;
|
||||
private List<String> unit;
|
||||
|
||||
private Boolean uidType;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -135,6 +135,12 @@
|
||||
<artifactId>message-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-system-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -2,18 +2,15 @@ package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.*;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
||||
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||
import com.njcn.csharmonic.enums.CsHarmonicResponseEnum;
|
||||
import com.njcn.csharmonic.pojo.dto.ZuTaiDTO;
|
||||
import com.njcn.csharmonic.pojo.dto.ZuTaiNewDTO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsRtDataVO;
|
||||
@@ -28,7 +25,7 @@ import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.EpdFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -39,7 +36,10 @@ import java.io.InputStreamReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -51,6 +51,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class LineTargetServiceImpl implements ILineTargetService {
|
||||
|
||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||
@@ -109,6 +110,36 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
||||
return dataArrayFeignClient.getDataArray(setList).getData();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<CsRtDataVO> getLineData(String id) {
|
||||
// List<CsRtDataVO> result = new ArrayList<>();
|
||||
// String path = csPagePOService.queryById(id).getPath();
|
||||
// InputStream inputStream = fileStorageUtil.getFileStream(path);
|
||||
// ZuTaiDTO zuTaiDto = analysisJson(inputStream);
|
||||
// zuTaiDto.getJson().forEach(item->{
|
||||
// if (!Objects.isNull(item.getTarget()) && StringUtils.isNotBlank(item.getTarget())){
|
||||
// String targetTag = item.getTarget().split("\\$")[0];
|
||||
// String phasic = item.getTarget().split("\\$")[1];
|
||||
// String dataType = item.getTarget().split("\\$")[2];
|
||||
// if (CollectionUtils.isEmpty(item.getUId()) || ObjectUtil.isNull(item.getLineId())){
|
||||
// throw new BusinessException(CsHarmonicResponseEnum.BIND_TARGET_ERROR);
|
||||
// }
|
||||
// CsDataArray dataArray = dataArrayFeignClient.getDataArrayById(String.valueOf(item.getUId().get(0)),targetTag).getData().get(0);
|
||||
// String targetName = dataArray.getAnotherName();
|
||||
// String dataId = dataArray.getDataId();
|
||||
// String classId = epdFeignClient.selectById(dataId).getData().getClassId();
|
||||
// String clDid = influxDbParamUtil.getClDidByLineId(item.getLineId());
|
||||
// //基础信息
|
||||
// CsRtDataVO vo = getLineRtData(item.getId(),item.getLineId(),influxDbParamUtil.getTableNameByClassId(classId),targetTag,phasic,dataType,targetName,clDid);
|
||||
// //设备状态信息
|
||||
// CsEquipmentDeliveryPO po = equipmentFeignClient.getDevByLineId(item.getLineId()).getData();
|
||||
// vo.setDevStatus(po.getRunStatus());
|
||||
// result.add(vo);
|
||||
// }
|
||||
// });
|
||||
// return result;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<CsRtDataVO> getLineData(String id) {
|
||||
List<CsRtDataVO> result = new ArrayList<>();
|
||||
@@ -116,20 +147,25 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
||||
InputStream inputStream = fileStorageUtil.getFileStream(path);
|
||||
ZuTaiDTO zuTaiDto = analysisJson(inputStream);
|
||||
zuTaiDto.getJson().forEach(item->{
|
||||
if (!Objects.isNull(item.getTarget()) && StringUtils.isNotBlank(item.getTarget())){
|
||||
String targetTag = item.getTarget().split("\\$")[0];
|
||||
String phasic = item.getTarget().split("\\$")[1];
|
||||
String dataType = item.getTarget().split("\\$")[2];
|
||||
if (CollectionUtils.isEmpty(item.getUId()) || ObjectUtil.isNull(item.getLineId())){
|
||||
throw new BusinessException(CsHarmonicResponseEnum.BIND_TARGET_ERROR);
|
||||
if (ObjectUtil.isNotNull(item.getUIdType()) && item.getUIdType()) {
|
||||
Object lastElement = item.getUId().get(item.getUId().size() - 1);
|
||||
String data = String.valueOf(lastElement);
|
||||
//分解出来五个参数 第一个 指标字段 第二个 相别 第三个 数据类型 第四个 influxdb表名 第五个 限值名称
|
||||
String[] tempTable = data.replace("$", "").split("#");
|
||||
//解析指标名称
|
||||
String targetName = "指标名称获取失败";
|
||||
String[] tmepUidName = item.getTarget().split(" / ");
|
||||
if(tmepUidName.length==2) {
|
||||
targetName = tmepUidName[0];
|
||||
}else if (tmepUidName.length==3) {
|
||||
targetName = tmepUidName[0];
|
||||
} else if (tmepUidName.length==4) {
|
||||
targetName = tmepUidName[1];
|
||||
}
|
||||
CsDataArray dataArray = dataArrayFeignClient.getDataArrayById(item.getUId().get(0),targetTag).getData().get(0);
|
||||
String targetName = dataArray.getAnotherName();
|
||||
String dataId = dataArray.getDataId();
|
||||
String classId = epdFeignClient.selectById(dataId).getData().getClassId();
|
||||
String clDid = influxDbParamUtil.getClDidByLineId(item.getLineId());
|
||||
//基础信息
|
||||
CsRtDataVO vo = getLineRtData(item.getId(),item.getLineId(),influxDbParamUtil.getTableNameByClassId(classId),targetTag,phasic,dataType,targetName,clDid);
|
||||
System.out.println(item.getLineId());
|
||||
CsRtDataVO vo = getLineRtData(item.getId(),item.getLineId(),tempTable[3],tempTable[0],Objects.equals(tempTable[1],"T")?"M":tempTable[1],tempTable[2],targetName,clDid);
|
||||
//设备状态信息
|
||||
CsEquipmentDeliveryPO po = equipmentFeignClient.getDevByLineId(item.getLineId()).getData();
|
||||
vo.setDevStatus(po.getRunStatus());
|
||||
@@ -148,7 +184,7 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
||||
ZuTaiNewDTO zuTaiDto = analysisJsonNew(inputStream);
|
||||
|
||||
zuTaiDto.getJson().forEach(item->{
|
||||
if (!CollectionUtils.isEmpty(item.getUidNames())){
|
||||
if (!CollectionUtils.isEmpty(item.getUidNames()) && Objects.isNull(item.getUidType())){
|
||||
for (int i = 0; i < item.getUidNames().size(); i++) {
|
||||
String temp = item.getUidNames().get(i);
|
||||
String targetTag = null;
|
||||
@@ -168,16 +204,21 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
||||
if (CollectionUtils.isEmpty(item.getUid()) || org.springframework.util.StringUtils.isEmpty(item.getLineId())){
|
||||
throw new BusinessException(CsSystemResponseEnum.BIND_TARGET_ERROR);
|
||||
}
|
||||
List<String> tempUid = item.getUid().get(i);
|
||||
String s = tempUid.get(tempUid.size() - 1);
|
||||
String[] tempTable = s.replace("$", "").split("#");
|
||||
result.add(getLineRtDataNew(item.getId(),item.getLineId(),tempTable[3],tempTable[0],tempTable[1],tempTable[2].toUpperCase(),temp,item.getUnit().get(i)));
|
||||
// List<String> tempUid = (List<String>) item.getUid().get(i);
|
||||
|
||||
if (item.getUid().get(i) instanceof List) {
|
||||
List<?> rawList = (List<?>) item.getUid().get(i);
|
||||
List<String> tempUid = rawList.stream()
|
||||
.filter(item2 -> item2 instanceof String)
|
||||
.map(item2 -> (String) item2)
|
||||
.collect(Collectors.toList());
|
||||
String s = tempUid.get(tempUid.size() - 1);
|
||||
String[] tempTable = s.replace("$", "").split("#");
|
||||
result.add(getLineRtDataNew(item.getId(),item.getLineId(),tempTable[3],tempTable[0],Objects.equals(tempTable[1],"T")?"M":tempTable[1],tempTable[2].toUpperCase(),temp,item.getUnit().get(i)));
|
||||
// result.add(getLineRtData(item.getId(),item.getLineId(),tempUid.get(3),tempUid.get(0),tempUid.get(1),tempUid.get(2).toUpperCase(),temp,"%"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
return result;
|
||||
}
|
||||
@@ -231,6 +272,13 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
||||
*/
|
||||
public CsRtDataVO getLineRtData(String id,String lineId, String tableName, String columnName, String phasic, String dataType, String target, String cldId) {
|
||||
CsRtDataVO csRtDataVO = new CsRtDataVO();
|
||||
log.info("---------------------------------------------------------------------------------------------------------------");
|
||||
log.info(lineId);
|
||||
log.info(tableName);
|
||||
log.info(columnName);
|
||||
log.info(phasic);
|
||||
log.info(dataType);
|
||||
log.info(cldId);
|
||||
StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,tableName,columnName,phasic,dataType,cldId);
|
||||
if(Objects.isNull(statisticalDataDTO)){
|
||||
statisticalDataDTO = new StatisticalDataDTO();
|
||||
|
||||
@@ -39,7 +39,7 @@ public class EleEpdPqdServiceImpl extends ServiceImpl<EleEpdPqdMapper, EleEpdPqd
|
||||
|
||||
@Override
|
||||
public List<EleEpdTreeVO> eleEpdChooseTree() {
|
||||
DictData dic = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.CS_DATA_TYPE.getName(), DicDataEnum.EPD.getName()).getData();
|
||||
DictData dic = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.CS_DATA_TYPE.getName(), DicDataEnum.PQD.getName()).getData();
|
||||
LambdaQueryWrapper<EleEpdPqd> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(EleEpdPqd::getDataType, dic.getId()).orderByAsc(EleEpdPqd::getSort);
|
||||
List<EleEpdPqd> list = this.getBaseMapper().selectList(lambdaQueryWrapper);
|
||||
@@ -49,7 +49,7 @@ public class EleEpdPqdServiceImpl extends ServiceImpl<EleEpdPqdMapper, EleEpdPqd
|
||||
map.forEach((key, value) -> {
|
||||
|
||||
EleEpdTreeVO reportTreeVO = new EleEpdTreeVO();
|
||||
reportTreeVO.setName(value.get(0).getOtherName());
|
||||
reportTreeVO.setName(value.get(0).getName());
|
||||
reportTreeVO.setShowName(value.get(0).getShowName());
|
||||
|
||||
//存在1-50次 2-50次情况
|
||||
@@ -57,7 +57,7 @@ public class EleEpdPqdServiceImpl extends ServiceImpl<EleEpdPqdMapper, EleEpdPqd
|
||||
List<EleEpdTreeVO> reHarm = new ArrayList<>();
|
||||
for (int i = value.get(0).getHarmStart(); i <= value.get(0).getHarmEnd(); i++) {
|
||||
EleEpdTreeVO reportTreeCount = new EleEpdTreeVO();
|
||||
reportTreeCount.setName(value.get(0).getOtherName() + "_" + i);
|
||||
reportTreeCount.setName(value.get(0).getName() + "_" + i);
|
||||
reportTreeCount.setShowName(i + "次" + value.get(0).getShowName());
|
||||
reportTreeVO.setFlag(1);
|
||||
assPhase(value, reportTreeCount, reportTreeCount.getName());
|
||||
@@ -65,7 +65,7 @@ public class EleEpdPqdServiceImpl extends ServiceImpl<EleEpdPqdMapper, EleEpdPqd
|
||||
}
|
||||
reportTreeVO.setChildren(reHarm);
|
||||
} else {
|
||||
assPhase(value, reportTreeVO, value.get(0).getOtherName());
|
||||
assPhase(value, reportTreeVO, value.get(0).getName());
|
||||
}
|
||||
tree.add(reportTreeVO);
|
||||
});
|
||||
@@ -89,7 +89,7 @@ public class EleEpdPqdServiceImpl extends ServiceImpl<EleEpdPqdMapper, EleEpdPqd
|
||||
|
||||
} else {
|
||||
List<EleEpdTreeVO> statTree = new ArrayList<>();
|
||||
assStatMethod(item, statTree, key, "T");
|
||||
assStatMethod(item, statTree, key, "M");
|
||||
reportTreeItem.setChildren(statTree);
|
||||
}
|
||||
});
|
||||
@@ -101,6 +101,8 @@ public class EleEpdPqdServiceImpl extends ServiceImpl<EleEpdPqdMapper, EleEpdPqd
|
||||
if (StrUtil.isNotBlank(item.getStatMethod())) {
|
||||
String[] arr = item.getStatMethod().split(",");
|
||||
List<String> stat = Stream.of(arr).collect(Collectors.toList());
|
||||
//根据表id获取表名称
|
||||
String tableName = dicDataFeignClient.getDicDataById(item.getClassId().trim()).getData().getName();
|
||||
if (CollUtil.isNotEmpty(stat)) {
|
||||
stat.forEach(statItem -> {
|
||||
EleEpdTreeVO reportTreeStat = new EleEpdTreeVO();
|
||||
@@ -112,9 +114,9 @@ public class EleEpdPqdServiceImpl extends ServiceImpl<EleEpdPqdMapper, EleEpdPqd
|
||||
tem = "#NO";
|
||||
}
|
||||
if (StrUtil.isNotBlank(twoKey)) {
|
||||
reportTreeStat.setName(STR_TWO + oneKey + STR_ONE + twoKey + STR_ONE + statItem + STR_ONE + item.getClassId().trim() + tem.trim() + STR_TWO);
|
||||
reportTreeStat.setName(STR_TWO + oneKey + STR_ONE + twoKey + STR_ONE + statItem + STR_ONE + tableName + tem.trim() + STR_TWO);
|
||||
} else {
|
||||
reportTreeStat.setName(STR_TWO + oneKey + STR_ONE + statItem + STR_ONE + item.getClassId().trim() + tem.trim() + STR_TWO);
|
||||
reportTreeStat.setName(STR_TWO + oneKey + STR_ONE + statItem + STR_ONE + tableName + tem.trim() + STR_TWO);
|
||||
}
|
||||
|
||||
reportTreeStat.setShowName(statItem);
|
||||
|
||||
Reference in New Issue
Block a user