Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 1 year ago
parent
commit
c067dd503a
  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
  5. 21
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java
  6. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java
  7. 68
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java
  8. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.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) @ApiOperationSupport(order = 160)
@ApiOperation(value = "数据追溯") @ApiOperation(value = "数据追溯")
public R dataBack(@RequestBody DataBackVo vo) { 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") @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); Map<String,Object> dataBack(String faultId);
R dataBackV2(String faultId);
Map<String,Object> monthlyDataBack(DataBackVo vo); 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.fdp.wrapper.FdpMonitorWrapper;
import com.hnac.hzims.monitor.dto.FdpMonitorBindingDTO; import com.hnac.hzims.monitor.dto.FdpMonitorBindingDTO;
import com.hnac.hzims.monitor.utils.DateUtils; 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.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient; 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.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseInstanceClient; import com.hnac.hzinfo.datasearch.analyse.IAnalyseInstanceClient;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; 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.analyse.vo.AnalyzeInstanceFieldVO;
import com.hnac.hzinfo.datasearch.real.IRealDataSearchClient; import com.hnac.hzinfo.datasearch.real.IRealDataSearchClient;
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO;
import com.xxl.job.core.log.XxlJobLogger; import com.xxl.job.core.log.XxlJobLogger;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; 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.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*; import org.springblade.core.tool.utils.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -113,6 +113,9 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
@Value("${url.updateFaultState_All}") @Value("${url.updateFaultState_All}")
public String updateFaultStateAll; public String updateFaultStateAll;
@Value("${url.getRealByFault}")
public String getRealByFault;
@Value("${hzims.equipment.fdp.fdpReturnValuePath}") @Value("${hzims.equipment.fdp.fdpReturnValuePath}")
public String fdpReturnValuePath; public String fdpReturnValuePath;
@ -805,8 +808,56 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
} }
return vo; 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 @Override
public Map<String, Object> dataBack(String faultId) { public Map<String, Object> dataBack(String faultId) {
//根据故障ID查询监测点列表 //根据故障ID查询监测点列表

21
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/DeviceDataController.java

@ -2,16 +2,21 @@ package com.hnac.hzims.operational.census.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.census.service.DeviceDataService; import com.hnac.hzims.operational.census.service.DeviceDataService;
import com.hnac.hzims.operational.census.vo.RealVo; import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataCondition;
import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataList;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* @author ysj * @author ysj
@ -27,16 +32,14 @@ public class DeviceDataController {
@ApiOperation("实时数据查询") @ApiOperation("实时数据查询")
@PostMapping("/real") @PostMapping("/real")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
public R<RealVo> real(@RequestParam(value = "code") String code, public R<List<FieldsData>> real(@RequestBody RealDataSearchPO search) {
@RequestParam(value = "signages") String signages) { return service.real(search);
return R.data(service.real(code,signages));
} }
@ApiOperation("实时数据查询") @ApiOperation("历史数据查询")
@PostMapping("/history") @PostMapping("/history")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
public R<RealVo> history(@RequestParam(value = "code") String code, public R<HzPage<AnalyzeDataList>> history(AnalyzeDataCondition analyzeDataCondition) {
@RequestParam(value = "signages") String signages) { return service.history(analyzeDataCondition);
return R.data(service.real(code,signages));
} }
} }

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/DeviceDataService.java

@ -2,11 +2,21 @@ package com.hnac.hzims.operational.census.service;
import com.hnac.hzims.operational.census.vo.RealVo; import com.hnac.hzims.operational.census.vo.RealVo;
import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataCondition;
import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataList;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import org.springblade.core.tool.api.R;
import java.util.List;
/** /**
* @author ysj * @author ysj
*/ */
public interface DeviceDataService { public interface DeviceDataService {
RealVo real(String code, String signages); R<List<FieldsData>> real(RealDataSearchPO search);
R<HzPage<AnalyzeDataList>> history(AnalyzeDataCondition analyzeDataCondition);
} }

68
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/DeviceDataServiceImpl.java

@ -2,12 +2,24 @@ package com.hnac.hzims.operational.census.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.esotericsoftware.minlog.Log;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.census.service.DeviceDataService; import com.hnac.hzims.operational.census.service.DeviceDataService;
import com.hnac.hzims.operational.census.vo.RealVo; import com.hnac.hzims.operational.census.vo.RealVo;
import com.hnac.hzinfo.datasearch.PointData;
import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataCondition;
import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataList;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.real.IRealDataSearchClient;
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO;
import com.hnac.hzinfo.sdk.analyse.AnalyseDataSearchClient;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -21,55 +33,37 @@ import java.util.stream.Collectors;
/** /**
* @author ysj * @author ysj
*/ */
@Slf4j
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class DeviceDataServiceImpl implements DeviceDataService { public class DeviceDataServiceImpl implements DeviceDataService {
private final RedisTemplate redisTemplate; private final IRealDataSearchClient realDataSearchClient;
@Value("${hzims.operation.realIdKey}") private final AnalyseDataSearchClient analyseDataSearchClient;
public String real_id_cofig_final;
public String device_cache_cofig_final = "hzims:equipment:emInfo:deviceCode.emInfoList";
/**
* 实时数据
* @param search
* @return
*/
@Override @Override
public RealVo real(String code, String signages) { public R<List<FieldsData>> real(RealDataSearchPO search) {
// 缓存设备数据 try{
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() { return realDataSearchClient.getRealDataByAnalyzeCode(search);
}); }catch (Exception exception){
if(CollectionUtil.isEmpty(devices)){ throw new ServiceException("系统异常!");
throw new ServiceException("不存在设备!");
}
List<EminfoAndEmParamVo> filters = devices.stream().filter(device->device.getEmCode().equals(code)).collect(Collectors.toList());
if(CollectionUtil.isEmpty(filters)){
throw new ServiceException("不存在设备!");
} }
// 设备标识
Map<String,String> point = filters.get(0).getPoint();
if(MapUtils.isEmpty(point)){
throw new ServiceException("设备未绑定模型实列监测点位!");
} }
if(!point.containsKey(signages)){
throw new ServiceException("设备未绑定模型实列监测点位!");
}
// 查找realId数据
RealVo real = new RealVo();
real.setRealId(point.get(signages));
real.setValue(this.getRealMap().get(real.getRealId()));
real.setQuality("0");
return real;
}
/** /**
* 获取实时数据 * 历史数据
* @param analyzeDataCondition
* @return * @return
*/ */
private Map<String, String> getRealMap() { @Override
String json = (String) redisTemplate.opsForValue().get(real_id_cofig_final); public R<HzPage<AnalyzeDataList>> history(AnalyzeDataCondition analyzeDataCondition) {
if(StringUtil.isBlank(json)){ Result<HzPage<AnalyzeDataList>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition);
return null; return R.data(result.getData());
}
return JSONObject.parseObject(json, new TypeReference<Map<String, String>>() {});
} }
} }

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java

@ -1,7 +1,6 @@
package com.hnac.hzims.operational.duty.controller; package com.hnac.hzims.operational.duty.controller;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.util.DateUtils;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
@ -32,7 +31,6 @@ import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -220,10 +218,21 @@ public class ImsDutyMainController extends BladeController {
@GetMapping("/exportDuty") @GetMapping("/exportDuty")
@ApiOperation(value = "导出排班计划") @ApiOperation(value = "导出排班计划")
public void exportTemplate(HttpServletResponse response, Integer year, Integer month, Long deptId) throws IOException { public void exportTemplate(HttpServletResponse response, String time, Long deptId) throws IOException {
Integer year;
Integer month;
if (Func.isEmpty(deptId)) { if (Func.isEmpty(deptId)) {
deptId = Long.valueOf(AuthUtil.getDeptId()); deptId = Long.valueOf(AuthUtil.getDeptId());
} }
if (Func.isEmpty(time)) {
Date date = new Date();
year = date.getYear();
month = date.getMonth()+1;
}else {
String[] split = time.split("-");
year=Integer.valueOf(split[0]);
month=Integer.valueOf(split[1]);
}
List<ImsDutyMainReportExcel> list = imsDutyMainService.getExcelDutyData(year, month, deptId); List<ImsDutyMainReportExcel> list = imsDutyMainService.getExcelDutyData(year, month, deptId);
String deptName = sysClient.getDeptName(deptId).getData(); String deptName = sysClient.getDeptName(deptId).getData();

Loading…
Cancel
Save