浏览代码

更改配置

gaoyu 2 年之前
父节点
当前提交
417a40112f

+ 161 - 149
pom.xml

@@ -1,164 +1,176 @@
 <?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.2.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>
+    <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>
+    </repositories>
 
 
-	<dependencies>
-		<dependency>
-			<groupId>org.projectlombok</groupId>
-			<artifactId>lombok</artifactId>
-			<optional>true</optional>
-		</dependency>
-		<!-- 项目启动 -->
-		<dependency>
-			<groupId>com.persagy</groupId>
-			<artifactId>apm-server</artifactId>
-			<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>
-			<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>
+    <dependencies>
+       	<dependency>
+		  <groupId>org.springframework</groupId>
+		  <artifactId>spring-core</artifactId>
+		  <version>5.3.4</version>
+		</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>integrated-config-client</artifactId>
-			<exclusions>
-				<exclusion>
-					<artifactId>xstream</artifactId>
-					<groupId>com.thoughtworks.xstream</groupId>
-				</exclusion>
-			</exclusions>
-		</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>
 
-		<!-- 日志 -->
-		<dependency>
-			<groupId>com.persagy</groupId>
-			<artifactId>integrated-log-spring-boot-starter</artifactId>
-		</dependency>
+        <!-- swagger -->
+        <dependency>
+            <groupId>com.persagy</groupId>
+            <artifactId>integrated-swagger2-spring-boot-starter</artifactId>
+        </dependency>
 
-		<!-- feign -->
-		<dependency>
-			<groupId>com.persagy</groupId>
-			<artifactId>integrated-ribbon-spring-boot-starter</artifactId>
-		</dependency>
+        <!-- 数学逻辑运算解析库-->
+        <dependency>
+            <groupId>com.googlecode.aviator</groupId>
+            <artifactId>aviator</artifactId>
+            <version>5.2.5</version>
+        </dependency>
 
-		<!-- swagger -->
-		<dependency>
-			<groupId>com.persagy</groupId>
-			<artifactId>integrated-swagger2-spring-boot-starter</artifactId>
-		</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>com.googlecode.aviator</groupId>
-			<artifactId>aviator</artifactId>
-			<version>5.2.5</version>
-		</dependency>
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis</artifactId>
+            <version>3.5.6</version>
+        </dependency>
 
-		<dependency>
-			<groupId>com.persagy</groupId>
-			<artifactId>apm-mybatis</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>com.persagy.apm</groupId>
-			<artifactId>alarm-data-starter</artifactId>
-			<version>v2.0.0-SNAPSHOT</version>
-		</dependency>
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.4.18</version>
+        </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>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>
 </project>

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

@@ -0,0 +1,41 @@
+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 - 1
src/main/java/com/persagy/apm/alarmservice/dependency/eqdiagnose/client/fallback/EqDiagnoseClientFallbackFactory.java

@@ -1,7 +1,7 @@
 package com.persagy.apm.alarmservice.dependency.eqdiagnose.client.fallback;
 
 import com.persagy.apm.alarmservice.dependency.eqdiagnose.client.EqDiagnoseClient;
-import feign.hystrix.FallbackFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
 import org.springframework.stereotype.Component;
 
 /**

+ 1 - 1
src/main/java/com/persagy/apm/alarmservice/dependency/rwd/client/fallback/DmpRwdClientFallbackFactory.java

@@ -1,7 +1,7 @@
 package com.persagy.apm.alarmservice.dependency.rwd.client.fallback;
 
 import com.persagy.apm.alarmservice.dependency.rwd.client.DmpRwdClient;
-import feign.hystrix.FallbackFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
 import org.springframework.stereotype.Component;
 
 /**

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

@@ -1,7 +1,7 @@
 package com.persagy.apm.alarmservice.dependency.saasweb.client.fallback;
 
 import com.persagy.apm.alarmservice.dependency.saasweb.client.SaasWebClient;
-import feign.hystrix.FallbackFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
 import org.springframework.stereotype.Component;
 
 /**

+ 2 - 4
src/main/java/com/persagy/apm/dmpalarm/client/PhysicalWorldFallBackFactory.java

@@ -1,13 +1,11 @@
 package com.persagy.apm.dmpalarm.client;
 
-import org.springframework.stereotype.Component;
-
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.apm.dmpalarm.criteria.JsonCriteria;
 import com.persagy.apm.dmpalarm.web.PagedResponse;
-
-import feign.hystrix.FallbackFactory;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
 
 /**
  * @description:

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

@@ -1,16 +1,15 @@
 package com.persagy.apm.dmpalarm.config;
 
-import java.util.Collections;
-import java.util.HashMap;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
 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;
 
 /**
  * 动态表名
@@ -21,6 +20,7 @@ public class MybatisPlusTableNameConfig {
 	@SuppressWarnings("serial")
 	@Bean
 	public PaginationInterceptor paginationInterceptor() {
+
 		PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
 		DynamicTableNameParser dynamicTableNameParser = new DynamicTableNameParser();
 		dynamicTableNameParser.setTableNameHandlerMap(new HashMap<String, ITableNameHandler>(2) {

+ 37 - 11
src/main/resources/bootstrap.yml

@@ -1,6 +1,13 @@
 server:
   port:
     9977
+paas:
+  nacos:
+    ip: develop.persagy.com
+    port: 80
+    namespace: standard-dev
+    username: nacos
+    password: nacos
 
 spring:
   application:
@@ -32,8 +39,31 @@ spring:
     username: ${persagy.rabbitmq.username}
     password: ${persagy.rabbitmq.password}
     virtual-host: ${persagy.rabbitmq.virtual-host}
-
-feign: 
+  cloud:
+    nacos:
+      config:
+        server-addr: ${paas.nacos.ip}:${paas.nacos.port}
+        file-extension: yml
+        namespace: ${persagy.nacos.namespace}
+        shared-configs:
+          - dataId: mysql.yml
+            refresh: true
+            group: DEFAULT_GROUP
+          - dataId: rabbitmq.yml
+            refresh: true
+            group: DEFAULT_GROUP
+        enabled: true
+        username: ${paas.nacos.username}
+        password: ${paas.nacos.password}
+        configLongPollTimeout: 6000
+      discovery:
+        username: ${paas.nacos.username}
+        password: ${paas.nacos.password}
+        server-addr: ${paas.nacos.ip}:${paas.nacos.port}
+        namespace: ${paas.nacos.namespace}
+        metadata: # 元数据,用于权限服务实时获取各个服务的所有接口
+          management.context-path: ${server.servlet.context-path:}${spring.mvc.servlet.path:}${management.endpoints.web.base-path:}
+feign:
   compression:
     response:
       # feign返回结果不压缩
@@ -61,13 +91,8 @@ integrated:
 # 不打印sql
 mybatis-plus:
   configuration:
-#    log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
+    #    log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
-
-eureka:
-  client:
-    register-with-eureka: ${REGISTER_WITH_EUREKA:true}
-
 # com.persagy包的日志等级为info
 logging:
   config: classpath:logback-spring.xml
@@ -75,7 +100,8 @@ logging:
     com:
       persagy: info
 dynamic:
-    not-url: /alarm/comment,/alarm/config,/alarm/event,/alarm/item,/alarm/log,/alarm/record,/alarm/target
-    db:
-      name: energy_alarm
+  not-url: /alarm/comment,/alarm/config,/alarm/event,/alarm/item,/alarm/log,/alarm/record,/alarm/target
+  db:
+    name: energy_alarm
+