Browse Source

#app历史数据统计、告警数据查询

zhongwei
yang_shj 5 months ago
parent
commit
6d610662a6
  1. 11
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/history/vo/HistoricalCurveVo.java
  2. 8
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java
  3. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/controller/HistoryController.java
  4. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/impl/PointServiceImpl.java

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

@ -1,9 +1,12 @@
package com.hnac.hzims.operational.history.vo; package com.hnac.hzims.operational.history.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -29,10 +32,14 @@ public class HistoricalCurveVo {
@ApiModelProperty(value = "第五个点位") @ApiModelProperty(value = "第五个点位")
private String fifthAttrId; private String fifthAttrId;
@ApiModelProperty(value = "第五个点位") @ApiModelProperty(value = "开始时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
private LocalDateTime startTime; private LocalDateTime startTime;
@ApiModelProperty(value = "第五个点位") @ApiModelProperty(value = "结束时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
private LocalDateTime endTime; private LocalDateTime endTime;
@ApiModelProperty(value = "厂组点/设备") @ApiModelProperty(value = "厂组点/设备")

8
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java

@ -56,12 +56,12 @@ public class MqttConfigHzims {
mqttConfig.setPassword(mqtt_fdp_password); mqttConfig.setPassword(mqtt_fdp_password);
mqttConfig.setUsername(mqtt_fdp_username); mqttConfig.setUsername(mqtt_fdp_username);
//fdp //fdp
AnalysisSubscribe analysisSubscribe = new AnalysisSubscribe(); /*AnalysisSubscribe analysisSubscribe = new AnalysisSubscribe();
MqttAsyncClient fdpClient = analysisSubscribe.subscribe(mqttConfig, Collections.singletonList("#"), fdpMqttConsumer); MqttAsyncClient fdpClient = analysisSubscribe.subscribe(mqttConfig, Collections.singletonList("#"), fdpMqttConsumer);
log.info(fdpClient.toString()+fdpClient.getClientId()); log.info(fdpClient.toString()+fdpClient.getClientId());
//drools //drools
DroolsSoeSubscribe droolsSoeSubscribe = new DroolsSoeSubscribe(); DroolsSoeSubscribe droolsSoeSubscribe = new DroolsSoeSubscribe();
MqttAsyncClient droolsClient = droolsSoeSubscribe.subscribe(mqttConfig, Collections.singletonList("#"), droolsMqttConsumer); MqttAsyncClient droolsClient = droolsSoeSubscribe(mqttConfig, Collections.singletonList("#"), droolsMqttConsumer);
log.info(droolsClient.toString()+droolsClient.getClientId()); log.info(droolsClient.toString()+droolsClient.getClientId());
//Soe //Soe
SoeSubscribe soeSubscribe = new SoeSubscribe(); SoeSubscribe soeSubscribe = new SoeSubscribe();
@ -74,8 +74,8 @@ public class MqttConfigHzims {
//视频 //视频
SoeSubscribe subscribe = new SoeSubscribe(); SoeSubscribe subscribe = new SoeSubscribe();
MqttAsyncClient videoClient = subscribe.subscribe(mqttConfig, Collections.singletonList("#"), videoMqttConsumer); MqttAsyncClient videoClient = subscribe.subscribe(mqttConfig, Collections.singletonList("#"), videoMqttConsumer);
log.info(videoClient.toString()+videoClient.getClientId()); log.info(videoClient.toString()+videoClient.getClientId());*/
}catch (MqttException e){ }catch (Exception e){
log.error(e.toString()) ; log.error(e.toString()) ;
} }
} }

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

@ -81,14 +81,14 @@ public class HistoryController extends BladeController {
@PostMapping("/historicalCurve") @PostMapping("/historicalCurve")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@ApiOperation(value = "查询历史数据曲线图", notes = "获取历史数据折线图数据") @ApiOperation(value = "查询历史数据曲线图", notes = "获取历史数据折线图数据")
public R<Map<String, Object>> historicalCurve(HistoricalCurveVo curve) { public R<Map<String, Object>> historicalCurve(@RequestBody HistoricalCurveVo curve) {
return R.data(pointService.historicalCurve(curve)); return R.data(pointService.historicalCurve(curve));
} }
@PostMapping("/attrStatistics") @PostMapping("/attrStatistics")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@ApiOperation(value = "历史数据统计", notes = "获取历史数据统计数据") @ApiOperation(value = "历史数据统计", notes = "获取历史数据统计数据")
public R<Map<String, Object>> attrStatistics(HistoricalCurveVo curve) { public R<Map<String, Object>> attrStatistics(@RequestBody HistoricalCurveVo curve) {
return R.data(pointService.attrStatistics(curve)); return R.data(pointService.attrStatistics(curve));
} }
} }

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

@ -133,7 +133,8 @@ public class PointServiceImpl implements PointService {
*/ */
@Override @Override
public Map<String, Object> attrStatistics(HistoricalCurveVo curve) { public Map<String, Object> attrStatistics(HistoricalCurveVo curve) {
Result<Map<String, Object>> result = deviceDataClient.getAttrStatistics(curve.getFirstAttrId(), Result<Map<String, Object>> result = deviceDataClient.getAttrStatistics(
curve.getFirstAttrId(),
curve.getSecondAttrId(), curve.getSecondAttrId(),
curve.getThirdlyAttrId(), curve.getThirdlyAttrId(),
curve.getFourthAttrId(), curve.getFourthAttrId(),

Loading…
Cancel
Save