Browse Source

#app历史数据,历史告警查询

zhongwei
yang_shj 5 months ago
parent
commit
c18220a7f3
  1. 52
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/history/vo/HistoricalCurveVo.java
  2. 32
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/history/vo/HistoryProjectAlarmVo.java
  3. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java
  4. 61
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/controller/HistoryController.java
  5. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/AlarmService.java
  6. 17
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/PointService.java
  7. 50
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/impl/AlarmServiceImpl.java
  8. 101
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/impl/PointServiceImpl.java

52
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/history/vo/HistoricalCurveVo.java

@ -0,0 +1,52 @@
package com.hnac.hzims.operational.history.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author ysj
*/
@Data
@ApiModel(value = "历史告警数据查询")
public class HistoricalCurveVo {
@ApiModelProperty(value = "第一个点位")
private String firstAttrId;
@ApiModelProperty(value = "第二个点位")
private String secondAttrId;
@ApiModelProperty(value = "第三个点位")
private String thirdlyAttrId;
@ApiModelProperty(value = "第四个点位")
private String fourthAttrId;
@ApiModelProperty(value = "第五个点位")
private String fifthAttrId;
@ApiModelProperty(value = "第五个点位")
private LocalDateTime startTime;
@ApiModelProperty(value = "第五个点位")
private LocalDateTime endTime;
@ApiModelProperty(value = "厂组点/设备")
private Integer dimension;
@ApiModelProperty(value = "维度 :0-10秒 、 1-1分钟 、2-5分钟 .....")
private Integer intervalType;
@ApiModelProperty(value = "是否分页")
private Boolean isPage;
@ApiModelProperty(value = "页码")
private Integer current;
@ApiModelProperty(value = "页码条数")
private Integer pageSize;
}

32
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/history/vo/HistoryProjectAlarmVo.java

@ -0,0 +1,32 @@
package com.hnac.hzims.operational.history.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
@ApiModel(value = "历史告警数据查询")
public class HistoryProjectAlarmVo {
@ApiModelProperty(value = "站点编号")
private String projectId;
@ApiModelProperty(value = "维度")
private Integer dimension;
@ApiModelProperty(value = "主键Id")
private String id;
@ApiModelProperty(value = "告警类型")
private Integer soeType;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java

@ -62,7 +62,7 @@ public class CentralMonitorController extends BladeController {
@GetMapping("/communications")
@ApiOperation("查询通讯告警图表数据")
@ApiOperationSupport(order = 4)
public R<List<PointDataVo>> communications(String roleId,Date start,@RequestParam Date end){
public R<List<PointDataVo>> communications(String roleId,Date start,Date end){
return R.data(monitorService.communications(roleId,start,end));
}
}

61
hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/controller/HistoryController.java

@ -4,11 +4,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.history.service.AlarmService;
import com.hnac.hzims.operational.history.service.PointService;
import com.hnac.hzims.operational.history.vo.HistoricalCurveVo;
import com.hnac.hzims.operational.history.vo.HistoryProjectAlarmVo;
import com.hnac.hzinfo.dataconfig.entity.Device;
import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryCondition;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@ -16,7 +20,9 @@ import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import javax.management.Query;
import java.util.List;
import java.util.Map;
/**
* @author ysj
@ -32,24 +38,57 @@ public class HistoryController extends BladeController {
private final AlarmService alarmService;
@PostMapping("/alarm")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "告警数据查询", notes = "根据站点查询数据")
public R<IPage<SoeData>> alarm(@RequestBody SoeQueryCondition soeQueryCondition) {
return R.data(alarmService.alarm(soeQueryCondition));
@GetMapping("/projectAlarm")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "站点告警数据", notes = "查询站点告警数据")
public R<Map<String, Object>> projectAlarm(HistoryProjectAlarmVo alarm, Query query) {
return R.data(alarmService.projectAlarm(alarm,query));
}
@GetMapping("/projectFacDevice")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "站点厂租点", notes = "根据站点id查询厂组点信息")
public R<List<Device>> projectFacDevice(@RequestParam(value = "projectId") String projectId) {
return R.data(pointService.projectFacDevice(projectId));
@ApiOperation(value = "站点厂组", notes = "根据站点id查询厂组信息")
public R<List<FacDeviceVO>> projectFacDevice(@RequestParam(value = "projectId") String projectId,
@RequestParam(value = "attrName",required = false) String attrName) {
return R.data(pointService.projectFacDevice(projectId,attrName));
}
@GetMapping("/projectFacDeviceAttr")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "站点厂租点", notes = "根据厂组Id查询厂组点信息")
public R<List<FacDeviceAttrVO>> projectFacDeviceAttr(@RequestParam(value = "facDeviceId") String facDeviceId,
@RequestParam(value = "attrName",required = false) String attrName) {
return R.data(pointService.projectFacDeviceAttr(facDeviceId,attrName));
}
@GetMapping("/projectDeviceInstance")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "站点虚拟设备息", notes = "根据站点id查询虚拟设备")
public R<List<DeviceInstanceVO>> projectDeviceInstance(@RequestParam(value = "projectId") String projectId) {
return R.data(pointService.projectDeviceInstance(projectId));
public R<List<DeviceInstanceVO>> projectDeviceInstance(@RequestParam(value = "projectId") String projectId,
@RequestParam(value = "attrName",required = false) String attrName) {
return R.data(pointService.projectDeviceInstance(projectId,attrName));
}
@GetMapping("/projectDeviceInstanceAttr")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "设备点位信息", notes = "根据设备编号查询点位")
public R<List<DeviceInstanceAttrVO>> projectDeviceInstanceAttr(@RequestParam(value = "deviceCode") String deviceCode,
@RequestParam(value = "attrName",required = false) String attrName) {
return R.data(pointService.projectDeviceInstanceAttr(deviceCode,attrName));
}
@PostMapping("/historicalCurve")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "查询历史数据曲线图", notes = "获取历史数据折线图数据")
public R<Map<String, Object>> historicalCurve(HistoricalCurveVo curve) {
return R.data(pointService.historicalCurve(curve));
}
@PostMapping("/attrStatistics")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "历史数据统计", notes = "获取历史数据统计数据")
public R<Map<String, Object>> attrStatistics(HistoricalCurveVo curve) {
return R.data(pointService.attrStatistics(curve));
}
}
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/AlarmService.java

@ -1,8 +1,14 @@
package com.hnac.hzims.operational.history.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.history.vo.HistoryProjectAlarmVo;
import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryCondition;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import javax.management.Query;
import java.util.List;
import java.util.Map;
/**
* @author ysj
@ -10,5 +16,5 @@ import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryCondition;
public interface AlarmService {
IPage<SoeData> alarm(SoeQueryCondition soeQueryCondition);
Map<String, Object> projectAlarm(HistoryProjectAlarmVo alarm, Query query);
}

17
hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/PointService.java

@ -1,13 +1,17 @@
package com.hnac.hzims.operational.history.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.history.vo.HistoricalCurveVo;
import com.hnac.hzinfo.dataconfig.entity.Device;
import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryCondition;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceVO;
import java.util.List;
import java.util.Map;
/**
* @author ysj
@ -15,8 +19,15 @@ import java.util.List;
public interface PointService {
List<Device> projectFacDevice(String projectId);
List<FacDeviceVO> projectFacDevice(String projectId, String attrName);
List<FacDeviceAttrVO> projectFacDeviceAttr(String facDeviceId, String attrName);
List<DeviceInstanceVO> projectDeviceInstance(String projectId);
}
List<DeviceInstanceVO> projectDeviceInstance(String projectId,String attrName);
List<DeviceInstanceAttrVO> projectDeviceInstanceAttr(String deviceCode, String attrName);
Map<String, Object> historicalCurve(HistoricalCurveVo curve);
Map<String, Object> attrStatistics(HistoricalCurveVo curve);
}

50
hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/impl/AlarmServiceImpl.java

@ -1,21 +1,17 @@
package com.hnac.hzims.operational.history.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.history.service.AlarmService;
import com.hnac.hzinfo.dataconfig.entity.Device;
import com.hnac.hzinfo.datasearch.soe.ISoeClient;
import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryCondition;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzims.operational.history.vo.HistoryProjectAlarmVo;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.soe.SoeDataClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.stereotype.Service;
import java.util.List;
import javax.management.Query;
import java.util.HashMap;
import java.util.Map;
/**
* @author ysj
@ -25,21 +21,31 @@ import java.util.List;
@AllArgsConstructor
public class AlarmServiceImpl implements AlarmService {
private final ISoeClient soeClient;
private final SoeDataClient soeClient;
private final DeviceClient deviceClient;
/**
* 查询站点告警数据
* @param alarm
* @param query
* @return
*/
@Override
public IPage<SoeData> alarm(SoeQueryCondition soeQueryCondition) {
IPage<SoeData> page = new Page<>(soeQueryCondition.getPage(), soeQueryCondition.getLimit());
Result<HzPage<SoeData>> result = soeClient.getByTypeAndTimeRangeOfPage(soeQueryCondition);
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData())){
return page;
public Map<String, Object> projectAlarm(HistoryProjectAlarmVo alarm, Query query) {
Result<Map<String, Object>> result = soeClient.getDeviceSoeData(
alarm.getProjectId(),
alarm.getDimension(),
alarm.getId(),
alarm.getSoeType(),
alarm.getStartTime(),
alarm.getEndTime(),
query
);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new HashMap<>();
}
page.setPages(result.getData().getCurrent());
page.setSize(result.getData().getSize());
page.setTotal(result.getData().getTotal());
page.setRecords(result.getData().getRecords());
return page;
return result.getData();
}
}

101
hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/impl/PointServiceImpl.java

@ -1,11 +1,16 @@
package com.hnac.hzims.operational.history.service.impl;
import com.hnac.hzims.operational.history.service.PointService;
import com.hnac.hzims.operational.history.vo.HistoricalCurveVo;
import com.hnac.hzinfo.dataconfig.entity.Device;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.HzFacClient;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceVO;
import com.hnac.hzinfo.sdk.v5.project.ProjectClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -14,8 +19,11 @@ import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author ysj
@ -25,10 +33,14 @@ import java.util.List;
@AllArgsConstructor
public class PointServiceImpl implements PointService {
private final DeviceDataClient deviceDataClient;
private final ProjectClient projectClient;
private final DeviceClient deviceClient;
private final HzFacClient hzFacClient;
/**
* 根据站点查询厂组点信息
@ -36,8 +48,23 @@ public class PointServiceImpl implements PointService {
* @return
*/
@Override
public List<Device> projectFacDevice(String projectId) {
Result<List<Device>> result = deviceClient.facDeviceByProjectId(projectId);
public List<FacDeviceVO> projectFacDevice(String projectId,String attrName) {
Result<List<FacDeviceVO>> result = hzFacClient.facDeviceByProjectId(projectId,attrName);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
return result.getData();
}
/**
* 根据厂组Id查询厂组点信息
* @param facDeviceId
* @param attrName
* @return
*/
@Override
public List<FacDeviceAttrVO> projectFacDeviceAttr(String facDeviceId, String attrName) {
Result<List<FacDeviceAttrVO>> result = hzFacClient.facDeviceAttrList(facDeviceId,attrName);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
@ -50,13 +77,77 @@ public class PointServiceImpl implements PointService {
* @return
*/
@Override
public List<DeviceInstanceVO> projectDeviceInstance(String projectId) {
R<List<DeviceInstanceVO>> result = deviceClient.getOnlineDeviceInstance(projectId);
public List<DeviceInstanceVO> projectDeviceInstance(String projectId,String attrName) {
R<List<DeviceInstanceVO>> result = deviceClient.getOnlineDeviceInstanceSearchName(projectId,attrName);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
return result.getData();
}
/**
* 查询站点厂组/设备点位信息
* @param deviceCode
* @param attrName
* @return
*/
@Override
public List<DeviceInstanceAttrVO> projectDeviceInstanceAttr(String deviceCode, String attrName) {
Result<List<DeviceInstanceAttrVO>> result = deviceClient.getDeviceAttrByName(deviceCode,attrName);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
return result.getData();
}
/**
* 查询历史数据曲线图
* @return
*/
@Override
public Map<String, Object> historicalCurve(HistoricalCurveVo curve) {
Result<Map<String, Object>> result = deviceDataClient.getLineDataByRealId(
curve.getFirstAttrId(),
curve.getSecondAttrId(),
curve.getThirdlyAttrId(),
curve.getFourthAttrId(),
curve.getFifthAttrId(),
curve.getStartTime(),
curve.getEndTime(),
curve.getDimension(),
curve.getIntervalType(),
curve.getIsPage(),
curve.getCurrent(),
curve.getPageSize()
);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new HashMap<>();
}
return result.getData();
}
/**
* 历史数据统计
* @param curve
* @return
*/
@Override
public Map<String, Object> attrStatistics(HistoricalCurveVo curve) {
Result<Map<String, Object>> result = deviceDataClient.getAttrStatistics(curve.getFirstAttrId(),
curve.getSecondAttrId(),
curve.getThirdlyAttrId(),
curve.getFourthAttrId(),
curve.getFifthAttrId(),
curve.getStartTime(),
curve.getEndTime(),
curve.getDimension(),
curve.getIntervalType());
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new HashMap<>();
}
return result.getData();
}
}
}
Loading…
Cancel
Save