소스 검색

更改pass-cloud 框架

gaoyu 2 년 전
부모
커밋
eb90852380

+ 21 - 82
AlarmDataStarter/pom.xml

@@ -1,84 +1,23 @@
 <?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">
-    <parent>
-        <artifactId>energy-alarm-starter</artifactId>
-        <groupId>com.persagy.apm</groupId>
-        <version>v4.0.0-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>alarm-data-starter</artifactId>
-
-    <properties>
-        <maven.compiler.source>8</maven.compiler.source>
-        <maven.compiler.target>8</maven.compiler.target>
-    </properties>
-
-    <dependencies>
-        <!-- jackson -->
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-annotations</artifactId>
-            <version>2.11.3</version>
-        </dependency>
-
-        <!-- lombok -->
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <optional>true</optional>
-        </dependency>
-
-        <!-- starter 标配 -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-configuration-processor</artifactId>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-autoconfigure</artifactId>
-        </dependency>
-
-        <!-- feign -->
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-openfeign</artifactId>
-            <version>2.2.6.RELEASE</version>
-        </dependency>
-
-        <!-- hystrix-->
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
-            <version>2.2.1.RELEASE</version>
-        </dependency>
-
-        <!-- fastjson -->
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>fastjson</artifactId>
-            <version>1.2.71</version>
-        </dependency>
-
-        <!--rabbitmq -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-amqp</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-starter-logging</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <!-- lang -->
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-        </dependency>
-    </dependencies>
+<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">
+	<parent>
+		<artifactId>energy-alarm-starter</artifactId>
+		<groupId>com.persagy.apm</groupId>
+		<version>v4.0.0-SNAPSHOT</version>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+
+	<artifactId>alarm-data-starter</artifactId>
+
+	<properties>
+		<maven.compiler.source>8</maven.compiler.source>
+		<maven.compiler.target>8</maven.compiler.target>
+	</properties>
+	<dependencies>
+		<dependency>
+			<groupId>com.persagy</groupId>
+			<artifactId>apm-common</artifactId>
+			<version>v1.3.0-SNAPSHOT</version>
+		</dependency>
+	</dependencies>
 </project>

+ 8 - 7
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/AutoConfiguration.java

@@ -1,6 +1,5 @@
 package com.persagy.apm.energyalarmstarter.alarmdata;
 
-import com.persagy.apm.energyalarmstarter.alarmdata.utils.JacksonMapper;
 import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
 import org.springframework.amqp.support.converter.MessageConverter;
 import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
@@ -9,6 +8,8 @@ import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
 
+import com.persagy.apm.energyalarmstarter.alarmdata.utils.JacksonMapper;
+
 /**
  * @description: 配置类
  * @author: lixing
@@ -19,12 +20,12 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert
 @Configuration
 @ComponentScan(value = "com.persagy.apm.energyalarmstarter.alarmdata")
 public class AutoConfiguration {
-//    @Bean
-//    public HttpMessageConverters customConverters() {
-//        MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
-//        converter.setObjectMapper(JacksonMapper.nonEmptyMapper);
-//        return new HttpMessageConverters(converter);
-//    }
+    @Bean
+    public HttpMessageConverters customConverters() {
+        MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
+        converter.setObjectMapper(JacksonMapper.nonEmptyMapper);
+        return new HttpMessageConverters(converter);
+    }
 
     // JMS 使用
     @Bean

+ 4 - 2
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/feign/fallback/AlarmClientFallbackFactory.java

@@ -1,9 +1,11 @@
 package com.persagy.apm.energyalarmstarter.alarmdata.feign.fallback;
 
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
 import com.persagy.apm.energyalarmstarter.alarmdata.feign.client.AlarmClient;
-import feign.hystrix.FallbackFactory;
+
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
 
 /**
  * 降级处理

+ 3 - 1
AlarmDataStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmdata/feign/fallback/DicClientFallbackFactory.java

@@ -1,7 +1,9 @@
 package com.persagy.apm.energyalarmstarter.alarmdata.feign.fallback;
 
+import org.springframework.cloud.openfeign.FallbackFactory;
+
 import com.persagy.apm.energyalarmstarter.alarmdata.feign.client.DicClient;
-import feign.hystrix.FallbackFactory;
+
 import lombok.extern.slf4j.Slf4j;
 
 

+ 1 - 62
AlarmEngineStarter/pom.xml

@@ -10,83 +10,22 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>alarm-engine-starter</artifactId>
-    <version>v4.0.0-SNAPSHOT</version>
-
     <properties>
         <maven.compiler.source>8</maven.compiler.source>
         <maven.compiler.target>8</maven.compiler.target>
     </properties>
-
     <dependencies>
-        <!-- jackson -->
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-annotations</artifactId>
-            <version>2.11.3</version>
-        </dependency>
-
-        <!-- lombok -->
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <optional>true</optional>
-        </dependency>
-
-        <!-- starter 标配 -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-configuration-processor</artifactId>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-autoconfigure</artifactId>
-        </dependency>
-
-        <!--rabbitmq -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-amqp</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-starter-logging</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <!-- fastjson -->
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>fastjson</artifactId>
-            <version>1.2.71</version>
-        </dependency>
-
         <!-- netty -->
         <dependency>
             <groupId>io.netty</groupId>
             <artifactId>netty-all</artifactId>
             <version>4.1.42.Final</version>
         </dependency>
-
-        <!-- lang -->
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-        </dependency>
-
         <!-- alarmDataStarter-->
         <dependency>
             <groupId>com.persagy.apm</groupId>
             <artifactId>alarm-data-starter</artifactId>
-            <version>v2.0.0-SNAPSHOT</version>
-        </dependency>
-
-        <!-- apm-common -->
-        <dependency>
-            <groupId>com.persagy</groupId>
-            <artifactId>apm-common</artifactId>
-            <version>v1.2.0-SNAPSHOT</version>
+            <version>v4.0.0-SNAPSHOT</version>
         </dependency>
 
     </dependencies>

+ 3 - 1
AlarmEngineStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmengine/feign/fallback/EnergyAlarmServiceClientFallbackFactory.java

@@ -1,8 +1,10 @@
 package com.persagy.apm.energyalarmstarter.alarmengine.feign.fallback;
 
 import com.persagy.apm.energyalarmstarter.alarmengine.feign.client.EnergyAlarmServiceClient;
-import feign.hystrix.FallbackFactory;
+
 import lombok.extern.slf4j.Slf4j;
+
+import org.springframework.cloud.openfeign.FallbackFactory;
 import org.springframework.stereotype.Component;
 
 /**

+ 11 - 12
AlarmEngineStarter/src/main/java/com/persagy/apm/energyalarmstarter/alarmengine/jms/AlarmEngineMsgHandler.java

@@ -1,9 +1,15 @@
 package com.persagy.apm.energyalarmstarter.alarmengine.jms;
 
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.json.JSONUtil;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.persagy.apm.energyalarmstarter.alarmdata.model.vo.AlarmConfigItem;
 import com.persagy.apm.energyalarmstarter.alarmdata.mq.model.DmpMessage;
@@ -14,18 +20,11 @@ import com.persagy.apm.energyalarmstarter.alarmengine.jms.model.ItemCodeConditio
 import com.persagy.apm.energyalarmstarter.alarmengine.jms.model.ObjConditionInfo;
 import com.persagy.apm.energyalarmstarter.alarmengine.redis.RedisUtil4EngineStater;
 import com.persagy.apm.energyalarmstarter.alarmengine.service.AlarmRecordMsgHandler;
-import io.micrometer.core.instrument.util.JsonUtils;
+
+import cn.hutool.core.collection.CollectionUtil;
 import io.netty.channel.ChannelHandler;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import javax.annotation.Resource;
-
-import org.springframework.util.CollectionUtils;
-
-import java.util.*;
 
 /**
  * @description: 报警引擎消息处理类

+ 0 - 6
pom.xml

@@ -3,12 +3,6 @@
          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>org.springframework.boot</groupId>
-        <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.4.12</version>
-        <relativePath/> <!-- lookup parent from repository -->
-    </parent>
     <groupId>com.persagy.apm</groupId>
     <artifactId>energy-alarm-starter</artifactId>
     <packaging>pom</packaging>