Browse Source

消缺管理-数据溯源版本修改

zhongwei
tyty 1 year ago
parent
commit
7a758088c4
  1. 47
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultRealDataVO.java
  2. 3
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpMonitorController.java
  3. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java
  4. 57
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java

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

@ -0,0 +1,47 @@
package com.hnac.hzims.fdp.vo;
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 FdpFaultRealDataVO {
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<Date> realTime;
}

3
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpMonitorController.java

@ -194,7 +194,8 @@ public class FdpMonitorController extends BladeController {
@ApiOperationSupport(order = 160)
@ApiOperation(value = "数据追溯")
public R dataBack(@RequestBody DataBackVo vo) {
return R.data(service.dataBack(vo.getFaultId()));
service.dataBackV2(vo.getFaultId());
return service.dataBackV2(vo.getFaultId());
}
@PostMapping("/monthly/report/dataBack")

2
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java

@ -97,7 +97,7 @@ public interface IFdpMonitorService extends BaseService<FdpMonitorEntity> {
Map<String,Object> dataBack(String faultId);
R dataBackV2(String faultId);
Map<String,Object> monthlyDataBack(DataBackVo vo);
/**

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

@ -40,10 +40,10 @@ import com.hnac.hzims.fdp.vo.*;
import com.hnac.hzims.fdp.wrapper.FdpMonitorWrapper;
import com.hnac.hzims.monitor.dto.FdpMonitorBindingDTO;
import com.hnac.hzims.monitor.utils.DateUtils;
import com.hnac.hzims.util.HttpClientUtils;
import com.hnac.hzims.util.pojo.HttpResponse;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.util.HttpClientUtils;
import com.hnac.hzims.util.pojo.HttpResponse;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseInstanceClient;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
@ -54,7 +54,6 @@ import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeInstanceFieldVO;
import com.hnac.hzinfo.datasearch.real.IRealDataSearchClient;
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -66,6 +65,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@ -113,6 +113,9 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
@Value("${url.updateFaultState_All}")
public String updateFaultStateAll;
@Value("${url.getRealByFault}")
public String getRealByFault;
@Value("${hzims.equipment.fdp.fdpReturnValuePath}")
public String fdpReturnValuePath;
@ -805,8 +808,56 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
}
return vo;
}
@Override
public R dataBackV2(String faultId) {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("faultId", faultId);
String post = HttpRequestUtil.postCallObjectParam(resultMap, getRealByFault, "POST");
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>>() {});
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++ ) {
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));
res.add(dataVO);
}
}else {
res.add(fdpFaultRealDataVO);
}
}
// 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("暂无数据,请稍后重试");
}
return R.fail("智能诊断接口异常,请联系管理员");
}
//此接口已经弃用20230628
@Deprecated
@Override
public Map<String, Object> dataBack(String faultId) {
//根据故障ID查询监测点列表

Loading…
Cancel
Save