Prechádzať zdrojové kódy

更改pass-cloud框架

gaoyu 2 rokov pred
rodič
commit
d87d9c3a9c
29 zmenil súbory, kde vykonal 302 pridanie a 620 odobranie
  1. 77 170
      pom.xml
  2. 0 41
      src/main/java/com/persagy/apm/ServerApplication.java
  3. 1 2
      src/main/java/com/persagy/apm/alarmservice/common/configuration/PoemsWebConfigurer.java
  4. 7 9
      src/main/java/com/persagy/apm/alarmservice/common/configuration/rabbitmq/RabbitMsgConfig.java
  5. 2 2
      src/main/java/com/persagy/apm/alarmservice/common/jms/JmsSender.java
  6. 1 1
      src/main/java/com/persagy/apm/alarmservice/dependency/eqdiagnose/client/EqDiagnoseClient.java
  7. 19 7
      src/main/java/com/persagy/apm/alarmservice/dependency/rwd/client/DmpRwdClient.java
  8. 1 1
      src/main/java/com/persagy/apm/alarmservice/dependency/rwd/service/DmpRwdServiceImpl.java
  9. 1 1
      src/main/java/com/persagy/apm/alarmservice/dependency/saasweb/client/SaasWebClient.java
  10. 6 6
      src/main/java/com/persagy/apm/alarmservice/dependency/saasweb/service/SaasWebClientWrapper.java
  11. 1 1
      src/main/java/com/persagy/apm/alarmservice/group/alarmrecord/controller/AlarmRecordController.java
  12. 29 18
      src/main/java/com/persagy/apm/alarmservice/group/alarmrecord/service/AlarmRecordWrapper.java
  13. 31 26
      src/main/java/com/persagy/apm/alarmservice/group/alarmrule/service/impl/GroupAlarmRuleServiceImpl.java
  14. 16 9
      src/main/java/com/persagy/apm/alarmservice/group/management/service/impl/GroupManagementServiceImpl.java
  15. 18 9
      src/main/java/com/persagy/apm/alarmservice/group/monitorindicator/service/impl/MonitorIndicatorServiceImpl.java
  16. 17 13
      src/main/java/com/persagy/apm/alarmservice/project/monitorindicatorconfig/service/impl/ProjectMonitorIndicatorConfigServiceImpl.java
  17. 0 27
      src/main/java/com/persagy/apm/dmpalarm/client/PhysicalWorldClient.java
  18. 0 32
      src/main/java/com/persagy/apm/dmpalarm/client/PhysicalWorldFallBackFactory.java
  19. 7 6
      src/main/java/com/persagy/apm/dmpalarm/config/DmpParameterStorage.java
  20. 0 44
      src/main/java/com/persagy/apm/dmpalarm/config/MybatisPlusTableNameConfig.java
  21. 13 26
      src/main/java/com/persagy/apm/dmpalarm/config/WebConfig.java
  22. 2 2
      src/main/java/com/persagy/apm/dmpalarm/criteria/CriteriaUtils.java
  23. 3 3
      src/main/java/com/persagy/apm/dmpalarm/jms/RabbitmqConfig.java
  24. 11 5
      src/main/java/com/persagy/apm/dmpalarm/service/IShardingService.java
  25. 15 12
      src/main/java/com/persagy/apm/dmpalarm/service/impl/AlarmTargetServiceImpl.java
  26. 4 4
      src/main/java/com/persagy/apm/dmpalarm/service/impl/PhysicalWorldServiceImpl.java
  27. 1 5
      src/main/java/com/persagy/apm/dmpalarm/service/impl/ShardingServiceImpl.java
  28. 19 12
      src/main/resources/bootstrap.yml
  29. 0 126
      src/main/resources/logback-spring.xml

+ 77 - 170
pom.xml

@@ -1,176 +1,83 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
 
-    <parent>
-        <groupId>com.persagy</groupId>
-        <artifactId>apm-package</artifactId>
-        <version>v1.3.0-SNAPSHOT</version>
-    </parent>
+	<parent>
+		<groupId>com.persagy</groupId>
+		<artifactId>apm-package</artifactId>
+		<version>v1.3.0-SNAPSHOT</version>
+	</parent>
 
-    <artifactId>dmp-alarm</artifactId>
-    <version>v1.0.0</version>
+	<artifactId>dmp-alarm</artifactId>
+	<version>v1.0.0</version>
 
-    <repositories>
-        <repository>
-            <id>snapshot</id>
-            <name>snapshot Repository</name>
-            <url>http://47.93.132.139:8081/nexus/content/repositories/snapshots/</url>
-            <snapshots>
-                <enabled>true</enabled>
-                <updatePolicy>always</updatePolicy>
-            </snapshots>
-        </repository>
-        <repository>
-            <id>persagy</id>
-            <name>persagy Repository</name>
-            <url>http://47.93.132.139:8081/nexus/content/repositories/persagy/</url>
-        </repository>
-        <repository>
-            <id>integrated</id>
-            <name>releases Repository</name>
-            <url>http://47.93.132.139:8081/nexus/content/repositories/integrated/</url>
-        </repository>
-        <repository>
-            <id>persagy2021-yushu-public</id>
-            <name>public</name>
-            <url>https://persagy2021-maven.pkg.coding.net/repository/yushu/public/</url>
-        </repository>
-
-    </repositories>
-
-
-    <dependencies>
-       	<dependency>
-		  <groupId>org.springframework</groupId>
-		  <artifactId>spring-core</artifactId>
-		  <version>5.3.4</version>
+	<repositories>
+		<repository>
+			<id>snapshot</id>
+			<name>snapshot Repository</name>
+			<url>http://47.93.132.139:8081/nexus/content/repositories/snapshots/</url>
+			<snapshots>
+				<enabled>true</enabled>
+				<updatePolicy>always</updatePolicy>
+			</snapshots>
+		</repository>
+		<repository>
+			<id>persagy</id>
+			<name>persagy Repository</name>
+			<url>http://47.93.132.139:8081/nexus/content/repositories/persagy/</url>
+		</repository>
+		<repository>
+			<id>integrated</id>
+			<name>releases Repository</name>
+			<url>http://47.93.132.139:8081/nexus/content/repositories/integrated/</url>
+		</repository>
+	</repositories>
+	<dependencies>
+		<dependency>
+			<groupId>com.persagy</groupId>
+			<artifactId>apm-common</artifactId>
 		</dependency>
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <optional>true</optional>
-        </dependency>
-        <!-- 项目启动 -->
-        <dependency>
-            <groupId>com.persagy</groupId>
-            <artifactId>apm-server</artifactId>
-            <version>v1.3.0-SNAPSHOT</version><!--$NO-MVN-MAN-VER$-->
-            <exclusions>
-                <exclusion>
-                    <artifactId>mybatis</artifactId>
-                    <groupId>org.mybatis</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>poi</artifactId>
-                    <groupId>org.apache.poi</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>poi-ooxml</artifactId>
-                    <groupId>org.apache.poi</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>poi-ooxml-schemas</artifactId>
-                    <groupId>org.apache.poi</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <!-- apm 工具包 -->
-        <dependency>
-            <groupId>com.persagy</groupId>
-            <artifactId>apm-common</artifactId>
-             <version>v1.3.0-SNAPSHOT</version><!--$NO-MVN-MAN-VER$-->
-            <exclusions>
-                <exclusion>
-                    <groupId>com.persagy</groupId>
-                    <artifactId>integrated-redis-spring-boot-starter</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <!-- lang -->
-        <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-        </dependency>
-
-        <!-- gson json,java对象互转 -->
-        <dependency>
-            <groupId>com.google.code.gson</groupId>
-            <artifactId>gson</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.persagy</groupId>
-            <artifactId>starter-cloud</artifactId>
-            <version>1.0.8</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.baomidou</groupId>
-                    <artifactId>mybatis-plus-extension</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>com.persagy</groupId>
-            <artifactId>starter-log</artifactId>
-            <version>1.0.8</version>
-        </dependency>
-
-        <!-- swagger -->
-        <dependency>
-            <groupId>com.persagy</groupId>
-            <artifactId>integrated-swagger2-spring-boot-starter</artifactId>
-        </dependency>
-
-        <!-- 数学逻辑运算解析库-->
-        <dependency>
-            <groupId>com.googlecode.aviator</groupId>
-            <artifactId>aviator</artifactId>
-            <version>5.2.5</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.persagy</groupId>
-            <artifactId>apm-mybatis</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.persagy.apm</groupId>
-            <artifactId>alarm-data-starter</artifactId>
-            <version>v4.0.0-SNAPSHOT</version>
-             <exclusions>
-                <exclusion>
-                    <groupId>org.springframework</groupId>
-  					<artifactId>spring-core</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <dependency>
-            <groupId>org.mybatis</groupId>
-            <artifactId>mybatis</artifactId>
-            <version>3.5.6</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.thoughtworks.xstream</groupId>
-            <artifactId>xstream</artifactId>
-            <version>1.4.18</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.poi</groupId>
-            <artifactId>poi</artifactId>
-            <version>4.1.2</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.poi</groupId>
-            <artifactId>poi-ooxml</artifactId>
-            <version>4.1.2</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.skywalking</groupId>
-            <artifactId>apm-toolkit-logback-1.x</artifactId>
-            <version>8.3.0</version>
-        </dependency>
-    </dependencies>
+		<dependency>
+			<groupId>com.persagy</groupId>
+			<artifactId>apm-mybatis</artifactId>
+			<exclusions>
+				<exclusion>
+					<groupId>com.persagy</groupId>
+					<artifactId>apm-common</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>com.persagy</groupId>
+			<artifactId>apm-server</artifactId>
+			<exclusions>
+				<exclusion>
+					<groupId>com.persagy</groupId>
+					<artifactId>apm-common</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<!-- gson json,java对象互转 -->
+		<dependency>
+			<groupId>com.google.code.gson</groupId>
+			<artifactId>gson</artifactId>
+		</dependency>
+		<!-- 数学逻辑运算解析库-->
+		<dependency>
+			<groupId>com.googlecode.aviator</groupId>
+			<artifactId>aviator</artifactId>
+			<version>5.2.5</version>
+		</dependency>
+		<dependency>
+			<groupId>com.persagy.apm</groupId>
+			<artifactId>alarm-data-starter</artifactId>
+			<version>v4.0.0-SNAPSHOT</version>
+			<exclusions>
+				<exclusion>
+					<groupId>com.persagy</groupId>
+					<artifactId>apm-common</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+	</dependencies>
 </project>

+ 0 - 41
src/main/java/com/persagy/apm/ServerApplication.java

@@ -1,41 +0,0 @@
-package com.persagy.apm;
-
-import cn.hutool.extra.spring.EnableSpringUtil;
-import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
-import com.persagy.log.annotation.EnableControllerLog;
-import lombok.extern.slf4j.Slf4j;
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.boot.Banner;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cache.annotation.EnableCaching;
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.cloud.openfeign.EnableFeignClients;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
-import org.springframework.scheduling.annotation.EnableScheduling;
-
-@EnableCaching(proxyTargetClass = true)
-@EnableFeignClients(basePackages="com.persagy.apm.**.client")
-@EnableControllerLog
-@EnableDiscoveryClient
-@Configuration
-@EnableScheduling
-@MapperScan(value = "com.persagy.apm.**.dao")
-@EnableSpringUtil
-@SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class)
-@EnableAspectJAutoProxy(exposeProxy = true)
-@Slf4j
-public class ServerApplication {
-
-    public static void main(String[] args) {
-
-        try {
-            SpringApplication application = new SpringApplication(com.persagy.ServerApplication.class);
-            application.setBannerMode(Banner.Mode.OFF);
-            application.run(args);
-        } catch (Exception e) {
-            log.error("服务启动异常", e);
-        }
-    }
-}

+ 1 - 2
src/main/java/com/persagy/apm/alarmservice/common/configuration/PoemsWebConfigurer.java

@@ -19,8 +19,7 @@ import com.persagy.apm.mybatis.handler.DynamicDataSourceHandler;
  */
 @Configuration
 public class PoemsWebConfigurer implements WebMvcConfigurer {
-
-    @Bean
+	@Bean
     public DynamicDataSourceHandler dynamicDataSourceHandler() {
         return new DynamicDataSourceHandler();
     }

+ 7 - 9
src/main/java/com/persagy/apm/alarmservice/common/configuration/rabbitmq/RabbitMsgConfig.java

@@ -2,10 +2,8 @@ package com.persagy.apm.alarmservice.common.configuration.rabbitmq;
 
 import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
 import org.springframework.amqp.support.converter.MessageConverter;
-import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
 
 /**
  * rabbitmq消息配置
@@ -15,16 +13,16 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert
  **/
 @Configuration
 public class RabbitMsgConfig {
-    @Bean
-    public HttpMessageConverters customConverters() {
-        MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
-        converter.setObjectMapper(JacksonMapper.nonEmptyMapper);
-        return new HttpMessageConverters(converter);
-    }
+//    @Bean
+//    public HttpMessageConverters customConvertersAlarmservice() {
+//        MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
+//        converter.setObjectMapper(JacksonMapper.nonEmptyMapper);
+//        return new HttpMessageConverters(converter);
+//    }
 
     // JMS 使用
     @Bean
-    public MessageConverter customMessageConvert() {
+    public MessageConverter customMessageConvertAlarmservice() {
         return new Jackson2JsonMessageConverter();
     }
 }

+ 2 - 2
src/main/java/com/persagy/apm/alarmservice/common/jms/JmsSender.java

@@ -61,8 +61,8 @@ public class JmsSender {
     private final String objConditionRelRoutingKey = "obj-condition-rel-routing-key";
 
 
-    @Bean
-    public TopicExchange exchange() {
+    @Bean    
+    public TopicExchange exchangeAlarmService() {
         return new TopicExchange(exchange);
     }
 

+ 1 - 1
src/main/java/com/persagy/apm/alarmservice/dependency/eqdiagnose/client/EqDiagnoseClient.java

@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.PostMapping;
  * @author lixing
  * @version V1.0 2021/3/22 2:13 下午
  **/
-@FeignClient(name = FeignClientNameConstants.ENERGY_EQ_RUN_DIAGNOSE, fallbackFactory = EqDiagnoseClientFallbackFactory.class)
+@FeignClient(name = FeignClientNameConstants.ENERGY_EQ_RUN_DIAGNOSE, url="https://bz-develop.persagy.com/energy-eq-run-diagnose/", fallbackFactory = EqDiagnoseClientFallbackFactory.class)
 public interface EqDiagnoseClient {
 
     /**

+ 19 - 7
src/main/java/com/persagy/apm/alarmservice/dependency/rwd/client/DmpRwdClient.java

@@ -1,17 +1,23 @@
 package com.persagy.apm.alarmservice.dependency.rwd.client;
 
+import java.util.List;
+
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.cloud.openfeign.SpringQueryMap;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
 import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.apm.alarmservice.common.constants.FeignClientNameConstants;
 import com.persagy.apm.alarmservice.dependency.rwd.client.fallback.DmpRwdClientFallbackFactory;
+import com.persagy.apm.dmpalarm.criteria.JsonCriteria;
+import com.persagy.apm.dmpalarm.web.PagedResponse;
 import com.persagy.apm.energyalarmstarter.alarmdata.feign.DmpResult;
 import com.persagy.apm.energyalarmstarter.alarmdata.model.dto.common.UrlParamDTO;
-import feign.Headers;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.cloud.openfeign.SpringQueryMap;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 
-import java.util.List;
+import feign.Headers;
 
 /**
  * 物理世界feign客户端
@@ -19,7 +25,7 @@ import java.util.List;
  * @author lixing
  * @version V1.0 2021/3/22 2:13 下午
  **/
-@FeignClient(name = FeignClientNameConstants.DMP_RWD, fallbackFactory = DmpRwdClientFallbackFactory.class)
+@FeignClient(name = FeignClientNameConstants.DMP_RWD, url="https://bz-develop.persagy.com/dmp-rwd/" ,fallbackFactory = DmpRwdClientFallbackFactory.class)
 public interface DmpRwdClient {
 
     /**
@@ -35,5 +41,11 @@ public interface DmpRwdClient {
     @Headers({"Content-Type: application/json"})
     DmpResult<List<JSONObject>> objQuery(
             @SpringQueryMap UrlParamDTO urlParamDTO,  @RequestBody JSONObject jsonObject);
+    
 
+    @PostMapping("rwd/instance/object/query")
+    public PagedResponse<ObjectNode> queryObj(
+            @RequestParam("projectId") String projectId,
+            @RequestParam("groupCode") String groupCode,
+            @RequestBody JsonCriteria criteria);
 }

+ 1 - 1
src/main/java/com/persagy/apm/alarmservice/dependency/rwd/service/DmpRwdServiceImpl.java

@@ -1,6 +1,7 @@
 package com.persagy.apm.alarmservice.dependency.rwd.service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Lists;
 import com.persagy.apm.alarmservice.dependency.rwd.client.DmpRwdClient;
 import com.persagy.apm.alarmservice.group.management.model.equip.dto.QueryEquipDTO;
 import com.persagy.apm.alarmservice.group.management.model.equip.vo.EquipItem;
@@ -8,7 +9,6 @@ import com.persagy.apm.energyalarmstarter.alarmdata.feign.DmpResult;
 import com.persagy.apm.energyalarmstarter.alarmdata.model.dto.common.UrlParamDTO;
 import com.persagy.common.exception.BusinessException;
 import org.apache.commons.lang3.StringUtils;
-import org.assertj.core.util.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;

+ 1 - 1
src/main/java/com/persagy/apm/alarmservice/dependency/saasweb/client/SaasWebClient.java

@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestParam;
  * @author lixing
  * @version V1.0 2021/3/22 2:13 下午
  **/
-@FeignClient(name = FeignClientNameConstants.SAAS_WEB, fallbackFactory = SaasWebClientFallbackFactory.class)
+@FeignClient(name = FeignClientNameConstants.SAAS_WEB, url="https://bz-develop.persagy.com/ems-saas-web/", fallbackFactory = SaasWebClientFallbackFactory.class)
 public interface SaasWebClient {
 
     /**

+ 6 - 6
src/main/java/com/persagy/apm/alarmservice/dependency/saasweb/service/SaasWebClientWrapper.java

@@ -1,5 +1,11 @@
 package com.persagy.apm.alarmservice.dependency.saasweb.service;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -9,12 +15,6 @@ import com.persagy.apm.alarmservice.project.alarmruleobjrel.model.vo.ProjectVO;
 import com.persagy.apm.common.model.dto.PoemsFeignBaseDTO;
 import com.persagy.apm.common.model.vo.SimpleObjVO;
 import com.persagy.apm.common.response.PoemsFeignResponse;
-import org.apache.commons.collections.CollectionUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.List;
 
 /**
  * 运维平台feign客户端包装类

+ 1 - 1
src/main/java/com/persagy/apm/alarmservice/group/alarmrecord/controller/AlarmRecordController.java

@@ -13,7 +13,6 @@ import javax.validation.Valid;
 
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.assertj.core.util.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
@@ -25,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.collect.Lists;
 import com.persagy.apm.alarmservice.group.alarmrecord.enums.EnumAlarmTreatMode;
 import com.persagy.apm.alarmservice.group.alarmrecord.enums.EnumAlarmTreatState;
 import com.persagy.apm.alarmservice.group.alarmrecord.enums.EnumDownloadAlarmListType;

+ 29 - 18
src/main/java/com/persagy/apm/alarmservice/group/alarmrecord/service/AlarmRecordWrapper.java

@@ -1,8 +1,36 @@
 package com.persagy.apm.alarmservice.group.alarmrecord.service;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.FillPatternType;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.xssf.usermodel.XSSFCellStyle;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.persagy.apm.alarmservice.group.alarmrecord.enums.*;
+import com.google.common.collect.Lists;
+import com.persagy.apm.alarmservice.group.alarmrecord.enums.EnumAlarmLevel;
+import com.persagy.apm.alarmservice.group.alarmrecord.enums.EnumAlarmState;
+import com.persagy.apm.alarmservice.group.alarmrecord.enums.EnumAlarmTreatMode;
+import com.persagy.apm.alarmservice.group.alarmrecord.enums.EnumAlarmTreatState;
+import com.persagy.apm.alarmservice.group.alarmrecord.enums.EnumDownloadAlarmListType;
 import com.persagy.apm.alarmservice.group.alarmrecord.model.vo.AlarmRecordItemVO;
 import com.persagy.apm.alarmservice.group.alarmrecord.model.vo.AlarmRecordListItem;
 import com.persagy.apm.alarmservice.group.management.model.equip.vo.EquipItem;
@@ -17,23 +45,6 @@ import com.persagy.apm.energyalarmstarter.alarmdata.model.vo.AlarmRecordItem;
 import com.persagy.apm.energyalarmstarter.alarmdata.service.AlarmItemServiceImpl;
 import com.persagy.apm.energyalarmstarter.alarmdata.service.AlarmRecordServiceImpl;
 import com.persagy.apm.energyalarmstarter.alarmdata.utils.DateUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.FillPatternType;
-import org.apache.poi.ss.usermodel.IndexedColors;
-import org.apache.poi.xssf.usermodel.XSSFCellStyle;
-import org.apache.poi.xssf.usermodel.XSSFRow;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.assertj.core.util.Lists;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
-
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * 报警记录包装类,提供对报警相关字段的转换方法

+ 31 - 26
src/main/java/com/persagy/apm/alarmservice/group/alarmrule/service/impl/GroupAlarmRuleServiceImpl.java

@@ -1,15 +1,43 @@
 package com.persagy.apm.alarmservice.group.alarmrule.service.impl;
 
-import cn.hutool.core.thread.ExecutorBuilder;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.stream.Collectors;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.poi.ss.usermodel.DataFormatter;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.base.CaseFormat;
+import com.google.common.collect.Lists;
 import com.persagy.apm.alarmservice.group.alarmrule.dao.GroupAlarmRuleMapper;
 import com.persagy.apm.alarmservice.group.alarmrule.model.ConvertGroupAlarmRuleTool;
 import com.persagy.apm.alarmservice.group.alarmrule.model.GroupAlarmRule;
-import com.persagy.apm.alarmservice.group.alarmrule.model.dto.*;
+import com.persagy.apm.alarmservice.group.alarmrule.model.dto.AddGroupAlarmRuleDTO;
+import com.persagy.apm.alarmservice.group.alarmrule.model.dto.DeleteGroupAlarmRuleDTO;
+import com.persagy.apm.alarmservice.group.alarmrule.model.dto.GetGroupAlarmRuleDTO;
+import com.persagy.apm.alarmservice.group.alarmrule.model.dto.PageQueryGroupAlarmRuleDTO;
+import com.persagy.apm.alarmservice.group.alarmrule.model.dto.QueryGroupAlarmRuleDTO;
+import com.persagy.apm.alarmservice.group.alarmrule.model.dto.UpdateGroupAlarmRuleDTO;
 import com.persagy.apm.alarmservice.group.alarmrule.service.IGroupAlarmRuleService;
 import com.persagy.apm.alarmservice.group.management.model.equip.dto.QueryEquipDTO;
 import com.persagy.apm.alarmservice.group.management.model.equip.vo.EquipItem;
@@ -33,31 +61,8 @@ import com.persagy.apm.energyalarmstarter.alarmdata.model.vo.AlarmConfigItem;
 import com.persagy.apm.energyalarmstarter.alarmdata.service.AlarmConfigServiceImpl;
 import com.persagy.apm.mybatis.handler.DynamicDataSourceHandler;
 
+import cn.hutool.core.thread.ExecutorBuilder;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang.StringUtils;
-import org.apache.poi.ss.usermodel.DataFormatter;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.assertj.core.util.Lists;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.stream.Collectors;
-
-import javax.servlet.http.HttpServletRequest;
 
 /**
  * 集团报警规则(GroupAlarmRule) service层

+ 16 - 9
src/main/java/com/persagy/apm/alarmservice/group/management/service/impl/GroupManagementServiceImpl.java

@@ -1,5 +1,19 @@
 package com.persagy.apm.alarmservice.group.management.service.impl;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
 import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.Lists;
 import com.persagy.apm.alarmservice.dependency.rwd.service.DmpRwdServiceImpl;
@@ -16,15 +30,8 @@ import com.persagy.apm.alarmservice.group.objgroup.service.IObjGroupService;
 import com.persagy.apm.common.context.poems.PoemsContext;
 import com.persagy.apm.common.model.vo.SimpleObjVO;
 import com.persagy.apm.energyalarmstarter.alarmdata.model.dto.common.UrlParamDTO;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
 
-import java.util.*;
-import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
 
 /**
  * 分组管理service
@@ -157,7 +164,7 @@ public class GroupManagementServiceImpl implements GroupManagementService {
 
         for (String category:categoryObjIdsMap.keySet()) {
             Set<String> objIds = categoryObjIdsMap.get(category);
-            List<String> objIdList = org.assertj.core.util.Lists.newArrayList(objIds);
+            List<String> objIdList = Lists.newArrayList(objIds);
             // 每次查询100条
             List<List<String>> partitions = Lists.partition(objIdList, 100);
             for (List<String> partition : partitions) {

+ 18 - 9
src/main/java/com/persagy/apm/alarmservice/group/monitorindicator/service/impl/MonitorIndicatorServiceImpl.java

@@ -1,5 +1,17 @@
 package com.persagy.apm.alarmservice.group.monitorindicator.service.impl;
 
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -7,6 +19,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.base.CaseFormat;
+import com.google.common.collect.Lists;
 import com.googlecode.aviator.AviatorEvaluator;
 import com.googlecode.aviator.Expression;
 import com.persagy.apm.alarmservice.dependency.eqdiagnose.model.QueryMonitorIndicatorRecordDTO;
@@ -18,7 +31,11 @@ import com.persagy.apm.alarmservice.group.calculatemethod.service.ICalculateMeth
 import com.persagy.apm.alarmservice.group.monitorindicator.dao.MonitorIndicatorMapper;
 import com.persagy.apm.alarmservice.group.monitorindicator.model.ConvertMonitorIndicatorTool;
 import com.persagy.apm.alarmservice.group.monitorindicator.model.MonitorIndicator;
-import com.persagy.apm.alarmservice.group.monitorindicator.model.dto.*;
+import com.persagy.apm.alarmservice.group.monitorindicator.model.dto.AddMonitorIndicatorDTO;
+import com.persagy.apm.alarmservice.group.monitorindicator.model.dto.PageQueryMonitorIndicatorDTO;
+import com.persagy.apm.alarmservice.group.monitorindicator.model.dto.QueryMonitorIndicatorDTO;
+import com.persagy.apm.alarmservice.group.monitorindicator.model.dto.QueryMonitorIndicatorRecordInfoDTO;
+import com.persagy.apm.alarmservice.group.monitorindicator.model.dto.UpdateMonitorIndicatorDTO;
 import com.persagy.apm.alarmservice.group.monitorindicator.model.vo.MonitorIndicatorFormulaItem;
 import com.persagy.apm.alarmservice.group.monitorindicator.model.vo.MonitorIndicatorListItemVO;
 import com.persagy.apm.alarmservice.group.monitorindicator.model.vo.MonitorIndicatorRecordInfoItem;
@@ -31,14 +48,6 @@ import com.persagy.apm.common.context.poems.PoemsContext;
 import com.persagy.apm.common.model.dto.Sort;
 import com.persagy.apm.common.model.vo.GraphItemVO;
 import com.persagy.apm.energyalarmstarter.alarmdata.model.vo.AlarmRecordItem;
-import org.apache.commons.lang.StringUtils;
-import org.assertj.core.util.Lists;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
-
-import java.text.ParseException;
-import java.util.*;
 
 /**
  * 监测指标(MonitorIndicator) service层

+ 17 - 13
src/main/java/com/persagy/apm/alarmservice/project/monitorindicatorconfig/service/impl/ProjectMonitorIndicatorConfigServiceImpl.java

@@ -1,15 +1,26 @@
 package com.persagy.apm.alarmservice.project.monitorindicatorconfig.service.impl;
 
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
 import com.persagy.apm.alarmservice.group.calculatemethod.model.CalculateMethod;
 import com.persagy.apm.alarmservice.group.calculatemethod.model.dto.QueryCalculateMethodDTO;
 import com.persagy.apm.alarmservice.group.calculatemethod.service.ICalculateMethodService;
 import com.persagy.apm.alarmservice.group.management.model.equip.dto.QueryEquipDTO;
 import com.persagy.apm.alarmservice.group.management.model.equip.vo.EquipItem;
-import com.persagy.apm.alarmservice.group.management.model.equip.vo.EquipListItem;
 import com.persagy.apm.alarmservice.group.management.service.GroupManagementService;
 import com.persagy.apm.alarmservice.group.monitorindicator.model.MonitorIndicator;
 import com.persagy.apm.alarmservice.group.monitorindicator.model.dto.QueryMonitorIndicatorDTO;
@@ -17,7 +28,11 @@ import com.persagy.apm.alarmservice.group.monitorindicator.service.IMonitorIndic
 import com.persagy.apm.alarmservice.project.monitorindicatorconfig.dao.ProjectMonitorIndicatorConfigMapper;
 import com.persagy.apm.alarmservice.project.monitorindicatorconfig.model.ConvertProjectMonitorIndicatorConfigTool;
 import com.persagy.apm.alarmservice.project.monitorindicatorconfig.model.ProjectMonitorIndicatorConfig;
-import com.persagy.apm.alarmservice.project.monitorindicatorconfig.model.dto.*;
+import com.persagy.apm.alarmservice.project.monitorindicatorconfig.model.dto.AddProjectMonitorIndicatorConfigDTO;
+import com.persagy.apm.alarmservice.project.monitorindicatorconfig.model.dto.PageQueryProjectMonitorIndicatorConfigDTO;
+import com.persagy.apm.alarmservice.project.monitorindicatorconfig.model.dto.QueryProjectMonitorIndicatorConfigByEquipDTO;
+import com.persagy.apm.alarmservice.project.monitorindicatorconfig.model.dto.QueryProjectMonitorIndicatorConfigDTO;
+import com.persagy.apm.alarmservice.project.monitorindicatorconfig.model.dto.UpdateProjectMonitorIndicatorConfigDTO;
 import com.persagy.apm.alarmservice.project.monitorindicatorconfig.model.vo.ProjectMonitorIndicatorConfigListItemVO;
 import com.persagy.apm.alarmservice.project.monitorindicatorconfig.service.IProjectMonitorIndicatorConfigService;
 import com.persagy.apm.common.constant.enums.BoolEnum;
@@ -25,17 +40,6 @@ import com.persagy.apm.common.constant.enums.ValidEnum;
 import com.persagy.apm.common.context.AppContext;
 import com.persagy.apm.common.context.poems.PoemsContext;
 import com.persagy.apm.common.model.vo.SimpleObjVO;
-import org.apache.commons.lang.StringUtils;
-import org.assertj.core.util.Lists;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
-
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.stream.Collectors;
 
 /**
  * 项目监测指标配置(ProjectMonitorIndicatorConfig) service层

+ 0 - 27
src/main/java/com/persagy/apm/dmpalarm/client/PhysicalWorldClient.java

@@ -1,27 +0,0 @@
-package com.persagy.apm.dmpalarm.client;
-
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.persagy.apm.dmpalarm.criteria.JsonCriteria;
-import com.persagy.apm.dmpalarm.web.PagedResponse;
-
-/**
- * @description: 对接物理世界接口
- * @author: lixing
- * @company: Persagy Technology Co.,Ltd
- * @since: 2020/10/20 5:04 下午
- * @version: V1.0
- **/
-@FeignClient(name = "dmp-rwd", fallbackFactory = PhysicalWorldFallBackFactory.class)
-public interface PhysicalWorldClient {
-
-    @PostMapping("rwd/instance/object/query")
-    public PagedResponse<ObjectNode> queryObj(
-            @RequestParam("projectId") String projectId,
-            @RequestParam("groupCode") String groupCode,
-            @RequestBody JsonCriteria criteria);
-}

+ 0 - 32
src/main/java/com/persagy/apm/dmpalarm/client/PhysicalWorldFallBackFactory.java

@@ -1,32 +0,0 @@
-package com.persagy.apm.dmpalarm.client;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.persagy.apm.dmpalarm.criteria.JsonCriteria;
-import com.persagy.apm.dmpalarm.web.PagedResponse;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.cloud.openfeign.FallbackFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * @description:
- * @author: lixing
- * @company: Persagy Technology Co.,Ltd
- * @since: 2020/10/26 2:04 下午
- * @version: V1.0
- **/
-@Slf4j
-@Component
-public class PhysicalWorldFallBackFactory implements FallbackFactory<PhysicalWorldClient> {
-
-    @Override
-    public PhysicalWorldClient create(Throwable cause) {
-        return new PhysicalWorldClient() {
-            @Override
-            public PagedResponse<ObjectNode> queryObj(String projectId, String groupCode, JsonCriteria criteria) {
-                log.error("物理世界接口请求失败,url: {}, projectId: {}, requestBody: {}", "/instance/object/query", projectId, criteria);
-
-                return null;
-            }
-        };
-    }
-}

+ 7 - 6
src/main/java/com/persagy/apm/dmpalarm/config/DmpParameterStorage.java

@@ -1,19 +1,20 @@
 package com.persagy.apm.dmpalarm.config;
 
-import lombok.Getter;
-import lombok.Setter;
-import org.springframework.web.servlet.ModelAndView;
-import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
-
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.springframework.web.servlet.AsyncHandlerInterceptor;
+import org.springframework.web.servlet.ModelAndView;
+
+import lombok.Getter;
+import lombok.Setter;
+
 /**
  * @author: yaoll
  * @date: 2020-09-22
  * @verison: 1.0
  */
-public class DmpParameterStorage extends HandlerInterceptorAdapter {
+public class DmpParameterStorage implements AsyncHandlerInterceptor {
 
 	private static final ThreadLocal<ParameterData> storage = new ThreadLocal<>();
 

+ 0 - 44
src/main/java/com/persagy/apm/dmpalarm/config/MybatisPlusTableNameConfig.java

@@ -1,44 +0,0 @@
-package com.persagy.apm.dmpalarm.config;
-
-import com.baomidou.mybatisplus.extension.parsers.DynamicTableNameParser;
-import com.baomidou.mybatisplus.extension.parsers.ITableNameHandler;
-import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
-import com.persagy.apm.dmpalarm.utils.UtilsTools;
-import com.persagy.common.utils.StringUtil;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.Collections;
-import java.util.HashMap;
-
-/**
- * 动态表名
- */
-@Configuration
-public class MybatisPlusTableNameConfig {
-
-	@SuppressWarnings("serial")
-	@Bean
-	public PaginationInterceptor paginationInterceptor() {
-
-		PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
-		DynamicTableNameParser dynamicTableNameParser = new DynamicTableNameParser();
-		dynamicTableNameParser.setTableNameHandlerMap(new HashMap<String, ITableNameHandler>(2) {
-			{
-				put("alarm_record", (metaObject, sql, tableName) -> {
-					System.err.println("tableName " + tableName);
-					System.err.println("sql " + sql);
-					System.err.println("metaObject " + metaObject);
-					String myTableName = UtilsTools.myTableNameSuffix.get();
-					if (StringUtil.isNotBlank(myTableName)) {
-						tableName = tableName + "_" + myTableName;
-					}
-					return tableName;
-				});
-			}
-		});
-		paginationInterceptor.setSqlParserList(Collections.singletonList(dynamicTableNameParser));
-		return paginationInterceptor;
-	}
-
-}

+ 13 - 26
src/main/java/com/persagy/apm/dmpalarm/config/WebConfig.java

@@ -1,27 +1,15 @@
 package com.persagy.apm.dmpalarm.config;
 
-import java.util.Iterator;
-import java.util.List;
-
-import javax.annotation.Resource;
-
 import org.springframework.amqp.core.AcknowledgeMode;
 import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
 import org.springframework.amqp.rabbit.connection.ConnectionFactory;
 import org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory;
 import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
-import org.springframework.amqp.support.converter.MessageConverter;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.ApplicationArguments;
-import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
-import com.persagy.apm.dmpalarm.json.JacksonMapper;
-
 /**
  * @author: yaoll
  * @date: 2020-09-22
@@ -29,8 +17,7 @@ import com.persagy.apm.dmpalarm.json.JacksonMapper;
  */
 @Configuration
 public class WebConfig implements WebMvcConfigurer {
-
-	@Bean
+	//@Bean  删除
 	public DmpParameterStorage dmpParameterStorage() {
 		return new DmpParameterStorage();
 	}
@@ -40,18 +27,18 @@ public class WebConfig implements WebMvcConfigurer {
 		// 设置拦截的路径、不拦截的路径、优先级等等
 		registry.addInterceptor(dmpParameterStorage()).addPathPatterns("/**");
 	}
-
-	@Bean
-	public HttpMessageConverters customConverters() {
-		MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
-		converter.setObjectMapper(JacksonMapper.nonEmptyMapper);
-		return new HttpMessageConverters(converter);
-	}
-	// JMS 使用
-	@Bean
-	public MessageConverter customMessageConvert() {
-		return new Jackson2JsonMessageConverter();
-	}
+//删除  与 RabbitMsgConfig 类中此方法重复  与 alarm-data-starter AutoConfiguration 重复
+//	@Bean
+//	public HttpMessageConverters customConverters() {
+//		MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
+//		converter.setObjectMapper(JacksonMapper.nonEmptyMapper);
+//		return new HttpMessageConverters(converter);
+//	}
+	 //JMS 使用 删除同上
+//	@Bean
+//	public MessageConverter customMessageConvert() {
+//		return new Jackson2JsonMessageConverter();
+//	}
 
 	@Bean
 	public RabbitListenerContainerFactory<?> rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {

+ 2 - 2
src/main/java/com/persagy/apm/dmpalarm/criteria/CriteriaUtils.java

@@ -132,8 +132,8 @@ public class CriteriaUtils {
 	public <T> PagedResponse<T> getPagedResponse(JsonCriteria criteria , Class<T> classes , QueryWrapper<T> queryWrapper , BaseMapper<T> baseMapper){
 		PagedResponse<T> pagedResponse = new PagedResponse<>();
 		if (criteria.isOnlyCount()) {
-			Integer count = baseMapper.selectCount(queryWrapper);
-			pagedResponse.setCount(count.longValue());
+			Long count = baseMapper.selectCount(queryWrapper);
+			pagedResponse.setCount(count);
 		} else {
 			Page<T> page = baseMapper.selectPage(new Page<>(criteria.getPage(), criteria.getSize()), queryWrapper);
 			pagedResponse.setCount(page.getTotal());

+ 3 - 3
src/main/java/com/persagy/apm/dmpalarm/jms/RabbitmqConfig.java

@@ -36,8 +36,8 @@ public class RabbitmqConfig {
      */
     private final String alarmConfigQueue = "alarm-config-queue1";
 
-    @Bean
-    public TopicExchange exchange() {
+    @Bean 
+    public TopicExchange exchangeDmpAlarm() {
         return new TopicExchange(exchange);
     }
 
@@ -48,7 +48,7 @@ public class RabbitmqConfig {
 
     @Bean
     public Binding alarmObjBinding() {
-        return BindingBuilder.bind(alarmConfigQueue()).to(exchange()).with(dmpAlarmConfigRoutingKey);
+        return BindingBuilder.bind(alarmConfigQueue()).to(exchangeDmpAlarm()).with(dmpAlarmConfigRoutingKey);
     }
 
     /**

+ 11 - 5
src/main/java/com/persagy/apm/dmpalarm/service/IShardingService.java

@@ -7,14 +7,17 @@ import java.util.List;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.persagy.apm.dmpalarm.model.ShardingEntity;
 import com.persagy.apm.dmpalarm.web.PagedResponse;
+
 /**
  * 分表IShardingService
+ * 
  * @author GaoYu
  *
  */
 public interface IShardingService {
 	/**
 	 * 得到分表之后的表的相关信息 默认排序分表的字段倒序DESC
+	 * 
 	 * @param <T>
 	 * 
 	 * @param tableNamePrefix
@@ -26,23 +29,26 @@ public interface IShardingService {
 
 	/**
 	 * 查询分表后的总数
+	 * 
 	 * @param <T>
 	 * 
 	 * @param tableNamePrefix 分表名称前缀
 	 * @param queryWrapper    查询条件
 	 * @return
 	 */
-	<T> Long selectShardingCount(Class<T> cls, QueryWrapper<T> queryWrapper,Date startTime,Date endTime);
+	<T> Long selectShardingCount(Class<T> cls, QueryWrapper<T> queryWrapper, Date startTime, Date endTime);
 
 	/**
 	 * 查询每一张表分表后的总数
+	 * 
 	 * @param <T>
 	 * 
 	 * @param tableNamePrefix 分表名称前缀
 	 * @param queryWrapper    查询条件
 	 * @return
 	 */
-	<T> List<ShardingEntity> selectShardingGroupTableCount(Class<T> cls, QueryWrapper<T> queryWrapper,Date startTime,Date endTime);
+	<T> List<ShardingEntity> selectShardingGroupTableCount(Class<T> cls, QueryWrapper<T> queryWrapper, Date startTime,
+			Date endTime);
 
 	/**
 	 * 分页查询
@@ -51,12 +57,12 @@ public interface IShardingService {
 	 * @param queryWrapper
 	 * @param pageNo
 	 * @param pageSize
-	 * @param startTime 分表起始
-	 * @param endTime 分表结束
+	 * @param startTime       分表起始
+	 * @param endTime         分表结束
 	 * @return
 	 */
 	<T> PagedResponse<T> selectShardingPageList(Class<T> cls, QueryWrapper<T> queryWrapper, Integer pageNo,
-			Integer pageSize,Date startTime,Date endTime);
+			Integer pageSize, Date startTime, Date endTime);
 
 	/**
 	 * 新增

+ 15 - 12
src/main/java/com/persagy/apm/dmpalarm/service/impl/AlarmTargetServiceImpl.java

@@ -1,5 +1,18 @@
 package com.persagy.apm.dmpalarm.service.impl;
 
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.stream.Collectors;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -14,19 +27,9 @@ import com.persagy.apm.dmpalarm.service.IAlarmTargetService;
 import com.persagy.apm.dmpalarm.utils.DatePatternStyle;
 import com.persagy.apm.dmpalarm.web.MapResponse;
 import com.persagy.apm.dmpalarm.web.PagedResponse;
-import com.persagy.common.utils.DateUtil;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
 
-import javax.annotation.Resource;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.stream.Collectors;
+import cn.hutool.core.date.DateUtil;
+import lombok.extern.slf4j.Slf4j;
 
 /**
  * 报警匹配条件(AlarmTarget) service层

+ 4 - 4
src/main/java/com/persagy/apm/dmpalarm/service/impl/PhysicalWorldServiceImpl.java

@@ -13,7 +13,7 @@ import org.springframework.stereotype.Service;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.collect.Sets;
-import com.persagy.apm.dmpalarm.client.PhysicalWorldClient;
+import com.persagy.apm.alarmservice.dependency.rwd.client.DmpRwdClient;
 import com.persagy.apm.dmpalarm.criteria.JsonCriteria;
 import com.persagy.apm.dmpalarm.service.IPhysicalWorldService;
 import com.persagy.apm.dmpalarm.web.PagedResponse;
@@ -25,7 +25,7 @@ import lombok.extern.slf4j.Slf4j;
 public class PhysicalWorldServiceImpl implements IPhysicalWorldService {
 
     @Resource
-    private PhysicalWorldClient physicalWorldClient;
+    private DmpRwdClient dmpRwdClient;
 
 
     public Set<String> queryObjectIdListByClassCode(
@@ -35,7 +35,7 @@ public class PhysicalWorldServiceImpl implements IPhysicalWorldService {
         JsonCriteria criteria=new JsonCriteria();
         criteria.getCriteria().put("classCode", classCode);
         criteria.getCriteria().put("valid", 1);
-        PagedResponse<ObjectNode> objectNodePagedResponse = physicalWorldClient.queryObj(projectId, groupCode, criteria);
+        PagedResponse<ObjectNode> objectNodePagedResponse = dmpRwdClient.queryObj(projectId, groupCode, criteria);
         log.info("物理世界查询对象返回值:", objectNodePagedResponse == null ? null : objectNodePagedResponse.toString());
         List<ObjectNode> data = objectNodePagedResponse.getData();
         Set<String> objIdList = new HashSet<>();
@@ -64,7 +64,7 @@ public class PhysicalWorldServiceImpl implements IPhysicalWorldService {
         JsonCriteria criteria=new JsonCriteria();
         criteria.getCriteria().put("classCode", classCodes);
         criteria.getCriteria().put("valid", 1);
-        PagedResponse<ObjectNode> objectNodePagedResponse = physicalWorldClient.queryObj(projectId, groupCode, criteria);
+        PagedResponse<ObjectNode> objectNodePagedResponse = dmpRwdClient.queryObj(projectId, groupCode, criteria);
         log.info("物理世界查询对象返回值:", objectNodePagedResponse == null ? null : objectNodePagedResponse.toString());
         List<ObjectNode> data = objectNodePagedResponse.getData();
         Map<String, Set<String>> resultMap = new HashMap<>();

+ 1 - 5
src/main/java/com/persagy/apm/dmpalarm/service/impl/ShardingServiceImpl.java

@@ -24,7 +24,6 @@ import com.baomidou.mybatisplus.core.metadata.TableInfo;
 import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
 import com.baomidou.mybatisplus.core.toolkit.Assert;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
-import com.baomidou.mybatisplus.core.toolkit.ReflectionKit;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.persagy.apm.dmpalarm.dao.ShardingMapper;
 import com.persagy.apm.dmpalarm.model.ShardingEntity;
@@ -37,7 +36,6 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.text.CharSequenceUtil;
-import cn.hutool.json.JSONUtil;
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
@@ -242,14 +240,13 @@ public class ShardingServiceImpl implements IShardingService {
 			Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!");
 			String keyProperty = tableInfo.getKeyProperty();
 			Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!");
-			Object idVal = ReflectionKit.getMethodValue(cls, obj, tableInfo.getKeyProperty());
+			Object idVal = tableInfo.getPropertyValue(obj, tableInfo.getKeyProperty());
 			if (StringUtils.checkValNull(idVal) || Objects.isNull(getById(obj.getClass(), (Serializable) idVal))) {
 				save(obj, time);
 			} else {
 				update(obj, time);
 			}
 		}
-
 	}
 
 	@Override
@@ -339,7 +336,6 @@ public class ShardingServiceImpl implements IShardingService {
 
 	private <T> List<T> handleResultList(Class<T> cls, List<Map<String, Object>> list) {
 		List<T> resultList = new ArrayList<>();
-		JSONUtil.toJsonStr(null, null);
 		for (Map<String, Object> map : list) {
 			Map<String, Object> newMap = new HashMap<>();
 			for (Entry<String, Object> entry : map.entrySet()) {

+ 19 - 12
src/main/resources/bootstrap.yml

@@ -3,9 +3,8 @@ server:
     9977
 paas:
   nacos:
-    ip: develop.persagy.com
-    port: 80
-    namespace: standard-dev
+    ip: 139.155.212.245
+    port: 8080
     username: nacos
     password: nacos
 
@@ -30,8 +29,8 @@ spring:
           continue-on-error: true
           # MYSQL_SCHEMA建议使用默认值。如果有特殊需求,建议在环境变量中配置该值
           url: jdbc:mysql://${persagy.mysql.ip}:${persagy.mysql.port}/${MYSQL_SCHEMA_ALARM_SERVICE:energy_alarm}?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
-          username: ${MYSQL_USERNAME:${spring.datasource.username}}
-          password: ${MYSQL_PASSWORD:${spring.datasource.password}}
+          username: ${persagy.mysql.username}
+          password: ${persagy.mysql.password}
           driver-class-name: com.mysql.cj.jdbc.Driver
   rabbitmq:
     host: ${persagy.rabbitmq.host}
@@ -39,19 +38,25 @@ spring:
     username: ${persagy.rabbitmq.username}
     password: ${persagy.rabbitmq.password}
     virtual-host: ${persagy.rabbitmq.virtual-host}
+  redis:
+    #数据库索引
+    database: ${persagy.redis.database}
+    host: ${persagy.redis.host}
+    port: ${persagy.redis.port}
+    password: ${persagy.redis.password}  
   cloud:
     nacos:
       config:
         server-addr: ${paas.nacos.ip}:${paas.nacos.port}
         file-extension: yml
-        namespace: ${persagy.nacos.namespace}
+        namespace: d38f0226-7c0a-4961-b087-a99591ae10c3
         shared-configs:
           - dataId: mysql.yml
             refresh: true
-            group: DEFAULT_GROUP
           - dataId: rabbitmq.yml
             refresh: true
-            group: DEFAULT_GROUP
+          - dataId: redis.yml
+            refresh: true
         enabled: true
         username: ${paas.nacos.username}
         password: ${paas.nacos.password}
@@ -60,7 +65,7 @@ spring:
         username: ${paas.nacos.username}
         password: ${paas.nacos.password}
         server-addr: ${paas.nacos.ip}:${paas.nacos.port}
-        namespace: ${paas.nacos.namespace}
+        namespace: d38f0226-7c0a-4961-b087-a99591ae10c3
         metadata: # 元数据,用于权限服务实时获取各个服务的所有接口
           management.context-path: ${server.servlet.context-path:}${spring.mvc.servlet.path:}${management.endpoints.web.base-path:}
 feign:
@@ -93,15 +98,17 @@ mybatis-plus:
   configuration:
     #    log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
-# com.persagy包的日志等级为info
 logging:
-  config: classpath:logback-spring.xml
   level:
+    root: info
     com:
-      persagy: info
+      alibaba:
+        nacos: info
 dynamic:
   not-url: /alarm/comment,/alarm/config,/alarm/event,/alarm/item,/alarm/log,/alarm/record,/alarm/target
   db:
     name: energy_alarm
 
 
+
+

+ 0 - 126
src/main/resources/logback-spring.xml

@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration>
-    <contextName>${APP_NAME}</contextName>
-    <springProperty name="APP_NAME" scope="context" source="spring.application.name"/>
-    <springProperty name="LOG_FILE" scope="context" source="logging.file" defaultValue="../logs/${APP_NAME}/application"/>
-    <springProperty name="LOG_POINT_FILE" scope="context" source="logging.file" defaultValue="../logs/${APP_NAME}/point"/>
-    <springProperty name="LOG_AUDIT_FILE" scope="context" source="logging.file" defaultValue="../logs/${APP_NAME}/audit"/>
-    <springProperty name="LOG_MAXFILESIZE" scope="context" source="logback.filesize" defaultValue="100MB"/>
-    <springProperty name="LOG_FILEMAXDAY" scope="context" source="logback.filemaxday" defaultValue="7"/>
-    <springProperty name="LOG_TOTALSIZE" scope="context" source="logback.totalsize" defaultValue="1GB"/>
-    <springProperty name="ServerIP" scope="context" source="spring.cloud.client.ip-address" defaultValue="0.0.0.0"/>
-    <springProperty name="ServerPort" scope="context" source="server.port" defaultValue="0000"/>
-
-    <!-- 彩色日志 -->
-    <!-- 彩色日志依赖的渲染类 -->
-    <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
-    <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
-    <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
-
-    <!-- 彩色日志格式 -->
-    <property name="CONSOLE_LOG_PATTERN"
-              value="[${APP_NAME}:${ServerIP}:${ServerPort}] %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%level){blue} %clr(${PID}){magenta} %clr([%X{traceId}]){yellow} %clr([%thread]){orange} %clr(%logger){cyan} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}" />
-    <property name="CONSOLE_LOG_PATTERN_NO_COLOR" value="[${APP_NAME}:${ServerIP}:${ServerPort}] %d{yyyy-MM-dd HH:mm:ss.SSS} %level ${PID} [%X{traceId}] [%thread] %logger %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}" />
-
-    <!-- 控制台日志 -->
-    <appender name="StdoutAppender" class="ch.qos.logback.core.ConsoleAppender">
-        <withJansi>true</withJansi>
-<!--        <encoder>-->
-<!--            <pattern>${CONSOLE_LOG_PATTERN}</pattern>-->
-<!--            <charset>UTF-8</charset>-->
-<!--        </encoder>-->
-        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
-            <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
-                <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level logger_name:%logger{36} - [%tid] - message:%msg%n</pattern>
-            </layout>
-        </encoder>
-    </appender>
-    <!-- 按照每天生成常规日志文件 -->
-    <appender name="FileAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_FILE}/${APP_NAME}.log</file>
-<!--        <encoder>-->
-<!--            <pattern>${CONSOLE_LOG_PATTERN_NO_COLOR}</pattern>-->
-<!--            <charset>UTF-8</charset>-->
-<!--        </encoder>-->
-        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
-            <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
-                <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level logger_name:%logger{36} - [%tid] - message:%msg%n</pattern>
-            </layout>
-        </encoder>
-        <!-- 基于时间的分包策略 -->
-        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-			<fileNamePattern>${LOG_FILE}/${APP_NAME}.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
-			<!--单文件最大限制-->
-			<maxFileSize>${LOG_MAXFILESIZE}</maxFileSize>
-            <!--保留时间,单位:天-->
-            <maxHistory>${LOG_FILEMAXDAY}</maxHistory>
-            <!-- 日志总大小 -->
-            <totalSizeCap>${LOG_TOTALSIZE}</totalSizeCap>
-        </rollingPolicy>
-        <filter class="ch.qos.logback.classic.filter.LevelFilter">
-            <level>INFO</level>
-        </filter>
-    </appender>
-
-    <appender name="point_log" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_POINT_FILE}/point.log</file>
-        <encoder>
-            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|${APP_NAME}|%msg%n</pattern>
-            <charset>UTF-8</charset>
-        </encoder>
-        <!-- 基于时间的分包策略 -->
-        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-			<fileNamePattern>${LOG_POINT_FILE}/point.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
-			<!--单文件最大限制-->
-			<maxFileSize>${LOG_MAXFILESIZE}</maxFileSize>
-            <!--保留时间,单位:天-->
-            <maxHistory>${LOG_FILEMAXDAY}</maxHistory>
-            <!-- 日志总大小 -->
-            <totalSizeCap>${LOG_TOTALSIZE}</totalSizeCap>
-        </rollingPolicy>
-    </appender>
-
-    <appender name="audit_log" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_AUDIT_FILE}/audit.log</file>
-        <encoder>
-            <pattern>%msg%n</pattern>
-            <charset>UTF-8</charset>
-        </encoder>
-        <!-- 基于时间的分包策略 -->
-        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-			<fileNamePattern>${LOG_AUDIT_FILE}/audit.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
-			<!--单文件最大限制-->
-			<maxFileSize>${LOG_MAXFILESIZE}</maxFileSize>
-            <!--保留时间,单位:天-->
-            <maxHistory>${LOG_FILEMAXDAY}</maxHistory>
-            <!-- 日志总大小 -->
-            <totalSizeCap>${LOG_TOTALSIZE}</totalSizeCap>
-        </rollingPolicy>
-    </appender>
-
-    <appender name="file_async" class="ch.qos.logback.classic.AsyncAppender">
-        <discardingThreshold>0</discardingThreshold>
-        <appender-ref ref="FileAppender"/>
-    </appender>
-    <appender name="point_log_async" class="ch.qos.logback.classic.AsyncAppender">
-        <discardingThreshold>0</discardingThreshold>
-        <appender-ref ref="point_log"/>
-    </appender>
-    <logger name="com.persagy.log.util.PointUtil" level="info" addtivity="false">
-        <appender-ref ref="point_log_async" />
-    </logger>
-    <appender name="audit_log_async" class="ch.qos.logback.classic.AsyncAppender">
-        <discardingThreshold>0</discardingThreshold>
-        <appender-ref ref="audit_log"/>
-    </appender>
-    <logger name="com.persagy.log.service.impl.LoggerAuditServiceImpl" level="debug" addtivity="false">
-        <appender-ref ref="audit_log_async" />
-    </logger>
-	<!-- 剔除eureka client心跳日志 -->
-	<logger name="com.netflix.discovery.shared.resolver.aws.ConfigClusterResolver" level="WARN" />
-	
-    <root level="INFO">
-        <appender-ref ref="StdoutAppender"/>
-        <appender-ref ref="file_async"/>
-    </root>
-</configuration>