Ver código fonte

更新jar包

miaolijing 3 anos atrás
pai
commit
f102e3a0a8

+ 2 - 7
pom.xml

@@ -148,18 +148,13 @@
         <dependency>
             <groupId>com.persagy.apm</groupId>
             <artifactId>alarm-data-starter</artifactId>
-            <version>v1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>com.persagy.apm</groupId>
-            <artifactId>collect-data-starter</artifactId>
-            <version>v1.0.0-SNAPSHOT</version>
+            <version>v2.0.0-SNAPSHOT</version>
         </dependency>
 
         <dependency>
             <groupId>com.persagy.apm</groupId>
             <artifactId>alarm-engine-starter</artifactId>
-            <version>v1.0.0-SNAPSHOT</version>
+            <version>v2.0.0-SNAPSHOT</version>
         </dependency>
 
         <!-- actuator:查询项目状态;项目上线需要把这个包注释掉,不然会有安全风险 -->

+ 1 - 1
src/main/java/com/persagy/apm/diagnose/config/JmsConfig.java

@@ -19,7 +19,7 @@ import java.util.UUID;
  */
 @Slf4j
 @Configuration
-public class JmsConfig {
+public class RabbitConfig {
     @Autowired
     private RabbitTemplate rabbitTemplate;
     /**

+ 25 - 2
src/main/java/com/persagy/apm/diagnose/indicatorrecord/controller/MonitorIndicatorRecordController.java

@@ -4,16 +4,21 @@ import com.persagy.apm.common.response.ApmResponseUpsertVO;
 import com.persagy.apm.common.response.CommonResult;
 import com.persagy.apm.common.response.PageList;
 import com.persagy.apm.common.utils.ResultHelper;
+import com.persagy.apm.diagnose.indicatorcompute.model.ProjectIndicatorCompute;
+import com.persagy.apm.diagnose.indicatorcompute.service.IProjectIndicatorComputeService;
 import com.persagy.apm.diagnose.indicatorrecord.model.ConvertMonitorIndicatorRecordTool;
 import com.persagy.apm.diagnose.indicatorrecord.model.dto.*;
 import com.persagy.apm.diagnose.indicatorrecord.model.vo.MonitorIndicatorRecordItemVO;
 import com.persagy.apm.diagnose.indicatorrecord.model.vo.MonitorIndicatorRecordListItemVO;
 import com.persagy.apm.diagnose.indicatorrecord.service.IMonitorIndicatorRecordService;
 import com.persagy.apm.diagnose.service.EnergyAlarmServiceImpl;
+import com.persagy.apm.diagnose.service.SaasWebServiceImpl;
+import com.persagy.apm.diagnose.service.dto.ProjectDTO;
 import com.persagy.framework.ems.data.pojo.hbase.MonitorIndicatorRecord;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -22,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 监测指标历史记录控制层
@@ -35,8 +41,25 @@ import java.util.List;
 public class MonitorIndicatorRecordController {
     @Autowired
     private IMonitorIndicatorRecordService monitorIndicatorRecordService;
-
-
+    @Autowired
+    private SaasWebServiceImpl saasWebServiceImpl;
+    @Autowired
+    private IProjectIndicatorComputeService projectIndicatorComputeService;
+    @PostMapping("/sendData")
+    public void sendData() throws Exception {
+        //查询项目列表
+        List<ProjectDTO> projectDTOList = saasWebServiceImpl.queryProjectDTOList(null);
+        if (CollectionUtils.isEmpty(projectDTOList)) {
+            return;
+        }
+        Map<String, ProjectIndicatorCompute> projectIdAndProjectCompute = projectIndicatorComputeService.getProjectIdAndProjectCompute();
+        for (ProjectDTO projectDTO : projectDTOList) {
+//            if(!projectDTO.getProjectId().equals("Pj1101060001")){
+//                continue;
+//            }
+            monitorIndicatorRecordService.computeIndicatorData(projectDTO, projectIdAndProjectCompute.get(projectDTO.getProjectId()), null);
+        }
+    }
 
     @ApiOperation(value = "监测指标历史记录列表")
     @PostMapping("/query")

+ 3 - 3
src/main/java/com/persagy/apm/diagnose/indicatorrecord/service/impl/MonitorIndicatorRecordServiceImpl.java

@@ -3,7 +3,7 @@ package com.persagy.apm.diagnose.indicatorrecord.service.impl;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.persagy.apm.diagnose.config.ComputePropertiesConfig;
-import com.persagy.apm.diagnose.config.JmsConfig;
+import com.persagy.apm.diagnose.config.RabbitConfig;
 import com.persagy.apm.diagnose.constant.DiAgnoseConst;
 import com.persagy.apm.diagnose.constant.EnumDataTimeType;
 import com.persagy.apm.diagnose.constant.EnumTimeType;
@@ -87,7 +87,7 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
     @Resource(name = "ZillionDao")
     private CoreDao coredao;
     @Autowired
-    private JmsConfig jmsConfig;
+    private RabbitConfig rabbitConfig;
 
 
     /**
@@ -392,7 +392,7 @@ public class MonitorIndicatorRecordServiceImpl implements IMonitorIndicatorRecor
                 endTime = DateUtils.str2Date(dateListEntry.getKey(), DateUtils.SDFSECOND);
             }
             JSONArray sendArray = CollectDataUtil.batchBuildSendJsonParam(sendTimeKeyAndDataList,alarmItemCode);
-            jmsConfig.sendMsg(sendArray);
+            rabbitConfig.sendMsg(sendArray);
 //          String sentValue = CollectDataUtil.batchBuildSendParam(sendTimeKeyAndDataList,alarmItemCode);
             //AlarmWebSocketServer.sendMsgToClients(projectDTO.getProjectId(), sentValue);
             log.error("指标发送报表服务数据:" + projectDTO.getProjectId()+";"+ sendArray);

+ 3 - 4
src/main/java/com/persagy/apm/diagnose/maintenance/service/impl/ProjectDataRecordServiceImpl.java

@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.persagy.apm.diagnose.config.ComputePropertiesConfig;
-import com.persagy.apm.diagnose.config.JmsConfig;
+import com.persagy.apm.diagnose.config.RabbitConfig;
 import com.persagy.apm.diagnose.constant.DiAgnoseConst;
 import com.persagy.apm.diagnose.constant.EnumDataTimeType;
 import com.persagy.apm.diagnose.indicatorrecord.model.dto.ConfigItemDataSendTimeDTO;
@@ -29,7 +29,6 @@ import com.persagy.apm.energyalarmstarter.alarmdata.model.dto.alarmrecord.QueryA
 import com.persagy.apm.energyalarmstarter.alarmdata.model.dto.alarmrecord.UpdateAlarmRecordDTO;
 import com.persagy.apm.energyalarmstarter.alarmdata.model.vo.AlarmRecordItem;
 import com.persagy.apm.energyalarmstarter.alarmdata.service.AlarmRecordServiceImpl;
-import com.persagy.apm.energyalarmstarter.collectdata.websocket.AlarmWebSocketServer;
 import com.persagy.framework.ems.data.core.enumeration.SpecialOperator;
 import com.persagy.framework.ems.data.mvc.dao.CoreDao;
 import com.persagy.framework.ems.data.pojo.hbase.MonitorIndicatorRecord;
@@ -95,7 +94,7 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
     @Resource(name = "ZillionDao")
     private CoreDao coredao;
     @Autowired
-    private JmsConfig jmsConfig;
+    private RabbitConfig rabbitConfig;
 
     @Override
     @Async("asyncComputeMaintenanceDataExecutor")
@@ -320,7 +319,7 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
                 endTime = com.persagy.apm.diagnose.utils.DateUtils.str2Date(dateListEntry.getKey(), com.persagy.apm.diagnose.utils.DateUtils.SDFSECOND);
             }
             JSONArray sendArray = CollectDataUtil.batchBuildSendJsonParam(sendTimeKeyAndDataList,alarmItemCode);
-            jmsConfig.sendMsg(sendArray);
+            rabbitConfig.sendMsg(sendArray);
 //            String sentValue = CollectDataUtil.batchBuildSendParam(sendTimeKeyAndDataList,alarmItemCode);
          //   AlarmWebSocketServer.sendMsgToClients(projectId, sentValue);
             log.info("设备维保发送数据服务数据:" + projectId+";"+ sendArray);

+ 3 - 5
src/main/java/com/persagy/apm/diagnose/service/NettyAlarmServiceImpl.java

@@ -1,16 +1,14 @@
 package com.persagy.apm.diagnose.service;
 
 import com.alibaba.fastjson.JSONObject;
-import com.persagy.apm.diagnose.maintenance.constant.EnumAlarmCategory;
 import com.persagy.apm.diagnose.maintenance.constant.EnumAlarmItem;
-import com.persagy.apm.diagnose.utils.AlarmResultUtil;
 import com.persagy.apm.diagnose.utils.DmpResultUtil;
 import com.persagy.apm.energyalarmstarter.alarmdata.feign.AlarmUrlParam;
 import com.persagy.apm.energyalarmstarter.alarmdata.feign.DmpResult;
 import com.persagy.apm.energyalarmstarter.alarmdata.model.dto.alarmitem.QueryAlarmItemDTO;
 import com.persagy.apm.energyalarmstarter.alarmdata.model.vo.AlarmItem;
 import com.persagy.apm.energyalarmstarter.alarmdata.service.AlarmItemServiceImpl;
-import com.persagy.apm.energyalarmstarter.alarmengine.service.NettyAlarmService;
+import com.persagy.apm.energyalarmstarter.alarmengine.service.AlarmRecordMsgHandler;
 import lombok.SneakyThrows;
 import org.assertj.core.util.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,7 +19,7 @@ import java.util.Arrays;
 import java.util.List;
 
 @Service
-public class NettyAlarmServiceImpl extends NettyAlarmService {
+public class NettyAlarmServiceImpl extends AlarmRecordMsgHandler {
 
 
     @Autowired
@@ -89,7 +87,7 @@ public class NettyAlarmServiceImpl extends NettyAlarmService {
 
     @SneakyThrows
     @Override
-    protected String getAlarmCategory(AlarmUrlParam urlParam, String itemCode) {
+    public String getAlarmCategory(AlarmUrlParam urlParam, String itemCode) {
         QueryAlarmItemDTO queryAlarmItemDTO = new QueryAlarmItemDTO();
         queryAlarmItemDTO.setCode(Lists.newArrayList(itemCode));
         queryAlarmItemDTO.setGroupCode(urlParam.getGroupCode());

+ 2 - 2
src/main/java/com/persagy/apm/diagnose/service/NettyMessageHandler.java

@@ -1,6 +1,6 @@
 package com.persagy.apm.diagnose.service;
 
-import com.persagy.apm.energyalarmstarter.alarmengine.netty.NettyAlarmMsgBaseHandler;
+import com.persagy.apm.energyalarmstarter.alarmengine.jms.AlarmEngineMsgHandler;
 import org.springframework.stereotype.Component;
 
 /**
@@ -10,6 +10,6 @@ import org.springframework.stereotype.Component;
  * @version V1.0 2021/9/26 4:07 下午
  */
 @Component
-public class NettyMessageHandler extends NettyAlarmMsgBaseHandler {
+public class NettyMessageHandler extends AlarmEngineMsgHandler {
 
 }

+ 0 - 4
src/main/java/com/persagy/apm/diagnose/utils/DmpResultUtil.java

@@ -1,11 +1,7 @@
 package com.persagy.apm.diagnose.utils;
 
 import com.persagy.apm.energyalarmstarter.alarmdata.feign.DmpResult;
-import com.persagy.apm.energyalarmstarter.alarmdata.model.vo.AlarmConfigItem;
 import com.persagy.common.utils.StringUtil;
-import org.apache.poi.ss.formula.functions.T;
-
-import java.util.List;
 
 /**
  * @author admin