Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 1 year ago
parent
commit
a3d43d1ea1
  1. 51
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/dto/FdpFaultRealDataDTO.java
  2. 9
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultRealDataVO.java
  3. 35
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java

51
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/dto/FdpFaultRealDataDTO.java

@ -0,0 +1,51 @@
package com.hnac.hzims.fdp.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* 模型VO
*
* @author tangyu
* @created 2023-07-03 17:38
**/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FdpFaultRealDataDTO {
private static final long serialVersionUID = 1L;
/**
* 监测点ID
*/
@ApiModelProperty("监测点ID")
private String monitorId;
@ApiModelProperty("监测点名称")
private String name;
@ApiModelProperty("位置")
private String ord;
@ApiModelProperty("单代表对应一个实时数据,多代表对应一组实时数据")
private String multi;
@ApiModelProperty("数据的物模型id")
private String instance;
@ApiModelProperty("数据的物模型属性:如果multi是“多”,则包含该字符串起始的所有属性")
private String identifier;
@ApiModelProperty("物模型是否开机:无法获取当作开机处理")
private Boolean powerOn;
@ApiModelProperty("获取的实时数据如果MULTI是“单”则为数值,MULTI是“多”则为数组")
private List<String> real;
@ApiModelProperty("获取的实时数据如果MULTI是“单”则为数值,MULTI是“多”则为数组")
private List<String> realIdentifier;
@ApiModelProperty("获取的实时数据如果MULTI是“单”则为数值,MULTI是“多”则为数组")
private List<String> realName;
@ApiModelProperty("实时数据时间,如果MULTI是“单”则为数值,MULTI是“多”则为数组")
private List<Date> realTime;
}

9
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultRealDataVO.java

@ -6,7 +6,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* 模型VO
@ -41,7 +40,11 @@ public class FdpFaultRealDataVO {
private Boolean powerOn;
@ApiModelProperty("获取的实时数据如果MULTI是“单”则为数值,MULTI是“多”则为数组")
private List<String> real;
private String real;
@ApiModelProperty("获取的实时数据如果MULTI是“单”则为数值,MULTI是“多”则为数组")
private String realIdentifier;
@ApiModelProperty("获取的实时数据如果MULTI是“单”则为数值,MULTI是“多”则为数组")
private String realName;
@ApiModelProperty("实时数据时间,如果MULTI是“单”则为数值,MULTI是“多”则为数组")
private List<Date> realTime;
private Date realTime;
}

35
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java

@ -13,6 +13,7 @@ import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.fdp.constants.DeviceInstanceTypeConstant;
import com.hnac.hzims.fdp.dto.FdpFaultRealDataDTO;
import com.hnac.hzims.fdp.dto.FdpMonitorDTO;
import com.hnac.hzims.fdp.dto.FdpMonitorExtendDTO;
import com.hnac.hzims.fdp.dto.FdpTaskDTO;
@ -816,38 +817,28 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
FdpHttpResponseVo fdpHttpResponseVo = JSONObject.parseObject(post, new TypeReference<FdpHttpResponseVo>() {});
if (1==fdpHttpResponseVo.getSuccess()) {
if (Func.isNotEmpty(fdpHttpResponseVo.getData())) {
List<FdpFaultRealDataVO> list = JSONObject.parseObject(fdpHttpResponseVo.getData(), new TypeReference<List<FdpFaultRealDataVO>>() {});
List<FdpFaultRealDataDTO> list = JSONObject.parseObject(fdpHttpResponseVo.getData(), new TypeReference<List<FdpFaultRealDataDTO>>() {});
if (CollectionUtil.isEmpty(list)){
return R.success("暂无数据,请稍后重试");
}
List<FdpFaultRealDataVO> res =new ArrayList<>();
for (FdpFaultRealDataVO fdpFaultRealDataVO : list) {
if (null!=fdpFaultRealDataVO.getReal()){
for (int i = 0; i < fdpFaultRealDataVO.getReal().size(); i++ ) {
for (FdpFaultRealDataDTO fdpFaultRealDataDTO : list) {
if (null!=fdpFaultRealDataDTO.getReal()){
for (int i = 0; i < fdpFaultRealDataDTO.getReal().size(); i++ ) {
FdpFaultRealDataVO dataVO=new FdpFaultRealDataVO();
BeanUtils.copyProperties(fdpFaultRealDataVO,dataVO);
String real = fdpFaultRealDataVO.getReal().get(i);
Date time = fdpFaultRealDataVO.getRealTime().get(i);
dataVO.setReal(Arrays.asList(real));
dataVO.setRealTime(Arrays.asList(time));
BeanUtils.copyProperties(fdpFaultRealDataDTO,dataVO);
dataVO.setReal(fdpFaultRealDataDTO.getReal().get(i));
dataVO.setRealTime(fdpFaultRealDataDTO.getRealTime().get(i));
dataVO.setRealName(fdpFaultRealDataDTO.getRealName().get(i));
dataVO.setRealIdentifier(fdpFaultRealDataDTO.getRealIdentifier().get(i));
res.add(dataVO);
}
}else {
res.add(fdpFaultRealDataVO);
FdpFaultRealDataVO dataVO=new FdpFaultRealDataVO();
BeanUtils.copyProperties(fdpFaultRealDataDTO,dataVO);
res.add(dataVO);
}
}
// JSONObject jsonParams = JSONObject.parseObject(fdpHttpResponseVo.getData());
// list=list.stream().map(s -> {
// if ("单".equals(s.getMulti())) {
// if (null == s.getReal()) {
// s.setReal(new ArrayList<>().toString());
// } else {
// String real = jsonParams.get("real").toString();
// s.setReal(Arrays.asList(Double.valueOf(real)).toString());
// }
// }
// return s;
// }).collect(Collectors.toList());
return R.data(res);
}
return R.success("暂无数据,请稍后重试");

Loading…
Cancel
Save