|
@@ -0,0 +1,63 @@
|
|
|
|
+package com.persagy.apm.alarmservice.dependency.eqdiagnose.service;
|
|
|
|
+
|
|
|
|
+import com.persagy.apm.alarmservice.dependency.eqdiagnose.client.EqDiagnoseClient;
|
|
|
|
+import com.persagy.apm.alarmservice.dependency.eqdiagnose.model.MonitorIndicatorRecordListItemVO;
|
|
|
|
+import com.persagy.apm.alarmservice.dependency.eqdiagnose.model.QueryMonitorIndicatorRecordDTO;
|
|
|
|
+import com.persagy.apm.common.response.CommonResult;
|
|
|
|
+import com.persagy.apm.common.response.PageList;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
+
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 设备运行诊断服务层
|
|
|
|
+ *
|
|
|
|
+ * @author lixing
|
|
|
|
+ * @version V1.0 2021/9/27 3:03 下午
|
|
|
|
+ **/
|
|
|
|
+@Service
|
|
|
|
+public class EqDiagnoseServiceImpl {
|
|
|
|
+ @Autowired
|
|
|
|
+ private EqDiagnoseClient eqDiagnoseClient;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取监测指标历史采集值
|
|
|
|
+ *
|
|
|
|
+ * @param queryMonitorIndicatorRecordDTO 查询条件
|
|
|
|
+ * @return 监测指标历史采集值 date -> value
|
|
|
|
+ * @author lixing
|
|
|
|
+ * @version V1.0 2021/5/19 3:36 下午
|
|
|
|
+ */
|
|
|
|
+ public Map<Date, String> queryMonitorIndicatorRecord(
|
|
|
|
+ QueryMonitorIndicatorRecordDTO queryMonitorIndicatorRecordDTO) {
|
|
|
|
+ // feign查询
|
|
|
|
+ CommonResult<PageList<MonitorIndicatorRecordListItemVO>> pageListCommonResult =
|
|
|
|
+ eqDiagnoseClient.queryMonitorIndicatorRecord(queryMonitorIndicatorRecordDTO);
|
|
|
|
+
|
|
|
|
+ // 处理查询结果
|
|
|
|
+ if (pageListCommonResult == null) {
|
|
|
|
+ return new HashMap<>(0);
|
|
|
|
+ }
|
|
|
|
+ PageList<MonitorIndicatorRecordListItemVO> content = pageListCommonResult.getContent();
|
|
|
|
+ if (content == null) {
|
|
|
|
+ return new HashMap<>(0);
|
|
|
|
+ }
|
|
|
|
+ List<MonitorIndicatorRecordListItemVO> records = content.getRecords();
|
|
|
|
+ if (CollectionUtils.isEmpty(records)) {
|
|
|
|
+ return new HashMap<>(0);
|
|
|
|
+ }
|
|
|
|
+ return records.stream().collect(
|
|
|
|
+ Collectors.toMap(
|
|
|
|
+ MonitorIndicatorRecordListItemVO::getDate,
|
|
|
|
+ MonitorIndicatorRecordListItemVO::getValue
|
|
|
|
+ )
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+}
|