Compare commits

...

4 Commits

Author SHA1 Message Date
9f67ff8657 add send alarmutil 2021-01-23 19:59:53 +08:00
d3bd8c007d upgrade Try.java 2021-01-22 16:45:33 +08:00
5394584e07 upgrade Try.java 2021-01-22 16:08:28 +08:00
12cfb28638 upgrade Try.java 2021-01-21 18:03:40 +08:00
2 changed files with 606 additions and 480 deletions

997
pom.xml
View File

@ -1,480 +1,517 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>io.github.ehlxr</groupId> <groupId>io.github.ehlxr</groupId>
<artifactId>budd</artifactId> <artifactId>budd</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>budd</name> <name>budd</name>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!--目标编译的 Java 版本可以通过以下属性指定,不用配置 maven-compiler-plugin 插件--> <!--目标编译的 Java 版本可以通过以下属性指定,不用配置 maven-compiler-plugin 插件-->
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<spring.version>5.2.6.RELEASE</spring.version> <spring.version>5.2.6.RELEASE</spring.version>
<servlet.version>2.5</servlet.version> <servlet.version>2.5</servlet.version>
<mybatis.version>3.2.7</mybatis.version> <mybatis.version>3.2.7</mybatis.version>
<mybatis.spring.version>1.1.1</mybatis.spring.version> <mybatis.spring.version>1.1.1</mybatis.spring.version>
<mybatis.generator.core.version>1.4.0</mybatis.generator.core.version> <mybatis.generator.core.version>1.4.0</mybatis.generator.core.version>
<file_encoding>utf-8</file_encoding> <file_encoding>utf-8</file_encoding>
<jdk.verion>1.8</jdk.verion> <jdk.verion>1.8</jdk.verion>
<powermock.version>1.7.1</powermock.version> <powermock.version>1.7.1</powermock.version>
<kotlin.version>1.3.61</kotlin.version> <kotlin.version>1.3.61</kotlin.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.jcraft</groupId> <groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId> <artifactId>jsch</artifactId>
<version>0.1.53</version> <version>0.1.53</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bouncycastle</groupId> <groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId> <artifactId>bcprov-jdk16</artifactId>
<version>1.46</version> <version>1.46</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.13.1</version> <version>4.13.1</version>
<!-- <scope>test</scope> --> <!-- <scope>test</scope> -->
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-logging</groupId> <groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId> <artifactId>commons-logging</artifactId>
<version>1.1.3</version> <version>1.1.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.shiro</groupId> <groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId> <artifactId>shiro-core</artifactId>
<version>1.4.2</version> <version>1.4.2</version>
</dependency> </dependency>
<!-- spring begin--> <!-- spring begin-->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId> <artifactId>spring-core</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId> <artifactId>spring-beans</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId> <artifactId>spring-context</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId> <artifactId>spring-web</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId> <artifactId>spring-oxm</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId> <artifactId>spring-tx</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId> <artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId> <artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId> <artifactId>spring-aop</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId> <artifactId>spring-context-support</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId> <artifactId>spring-test</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId> <artifactId>spring-jms</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId> <artifactId>spring-expression</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<!-- spring end--> <!-- spring end-->
<dependency> <dependency>
<groupId>commons-codec</groupId> <groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
<version>1.6</version> <version>1.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.sf.json-lib</groupId> <groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId> <artifactId>json-lib</artifactId>
<version>2.4</version> <version>2.4</version>
<classifier>jdk15</classifier> <classifier>jdk15</classifier>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.caucho</groupId> <groupId>com.caucho</groupId>
<artifactId>hessian</artifactId> <artifactId>hessian</artifactId>
<version>4.0.38</version> <version>4.0.38</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>redis.clients</groupId> <groupId>redis.clients</groupId>
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
<version>2.8.0</version> <version>2.8.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version> <version>8.0.16</version>
</dependency> </dependency>
<!-- servlet --> <!-- servlet -->
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId> <artifactId>servlet-api</artifactId>
<version>${servlet.version}</version> <version>${servlet.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- mybatis start --> <!-- mybatis start -->
<dependency> <dependency>
<groupId>org.mybatis</groupId> <groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId> <artifactId>mybatis</artifactId>
<version>${mybatis.version}</version> <version>${mybatis.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mybatis</groupId> <groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId> <artifactId>mybatis-spring</artifactId>
<version>${mybatis.spring.version}</version> <version>${mybatis.spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mybatis.generator</groupId> <groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId> <artifactId>mybatis-generator-core</artifactId>
<version>${mybatis.generator.core.version}</version> <version>${mybatis.generator.core.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>c3p0</groupId> <groupId>c3p0</groupId>
<artifactId>c3p0</artifactId> <artifactId>c3p0</artifactId>
<version>0.9.1.2</version> <version>0.9.1.2</version>
</dependency> </dependency>
<!-- mybatis end --> <!-- mybatis end -->
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>4.5.2</version> <version>4.5.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId> <artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.1.6</version> <version>3.1.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId> <artifactId>cxf-rt-transports-http</artifactId>
<version>3.1.6</version> <version>3.1.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.activemq</groupId> <groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId> <artifactId>activemq-all</artifactId>
<version>5.13.3</version> <version>5.13.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.xbean</groupId> <groupId>org.apache.xbean</groupId>
<artifactId>xbean-spring</artifactId> <artifactId>xbean-spring</artifactId>
<version>4.5</version> <version>4.5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.5</version> <version>2.5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.powermock</groupId> <groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId> <artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version> <version>${powermock.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.powermock</groupId> <groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId> <artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version> <version>${powermock.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.reactivex</groupId> <groupId>io.reactivex</groupId>
<artifactId>rxjava</artifactId> <artifactId>rxjava</artifactId>
<version>1.3.0</version> <version>1.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.reactivex.rxjava2</groupId> <groupId>io.reactivex.rxjava2</groupId>
<artifactId>rxjava</artifactId> <artifactId>rxjava</artifactId>
<version>2.1.8</version> <version>2.1.8</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>28.2-jre</version> <version>28.2-jre</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jodd</groupId> <groupId>org.jodd</groupId>
<artifactId>jodd-props</artifactId> <artifactId>jodd-props</artifactId>
<version>3.6.1</version> <version>3.6.1</version>
</dependency> </dependency>
<!--<dependency>--> <!--<dependency>-->
<!-- <groupId>cn.ceres.did</groupId>--> <!-- <groupId>cn.ceres.did</groupId>-->
<!-- <artifactId>did-sdk</artifactId>--> <!-- <artifactId>did-sdk</artifactId>-->
<!-- <version>1.0-SNAPSHOT</version>--> <!-- <version>1.0-SNAPSHOT</version>-->
<!--</dependency>--> <!--</dependency>-->
<!--<dependency>--> <!--<dependency>-->
<!-- <groupId>cn.enncloud.ceres</groupId>--> <!-- <groupId>cn.enncloud.ceres</groupId>-->
<!-- <artifactId>ceres</artifactId>--> <!-- <artifactId>ceres</artifactId>-->
<!-- <version>1.1.0-SNAPSHOT</version>--> <!-- <version>1.1.0-SNAPSHOT</version>-->
<!--</dependency>--> <!--</dependency>-->
<dependency> <dependency>
<groupId>org.jetbrains.kotlin</groupId> <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId> <artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version> <version>${kotlin.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jetbrains.kotlin</groupId> <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId> <artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version> <version>${kotlin.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.rabbitmq</groupId> <groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId> <artifactId>amqp-client</artifactId>
<version>4.8.0</version> <version>4.8.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.hbase</groupId> <groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId> <artifactId>hbase-client</artifactId>
<version>1.3.5</version> <version>1.3.5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId> <artifactId>jackson-annotations</artifactId>
<version>2.10.3</version> <version>2.10.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
<version>2.10.3</version> <version>2.10.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.squareup.okhttp3</groupId> <groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId> <artifactId>okhttp</artifactId>
<version>3.14.7</version> <version>3.14.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.vavr</groupId> <groupId>io.vavr</groupId>
<artifactId>vavr</artifactId> <artifactId>vavr</artifactId>
<version>0.10.3</version> <version>0.10.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>pl.touk</groupId> <groupId>pl.touk</groupId>
<artifactId>throwing-function</artifactId> <artifactId>throwing-function</artifactId>
<version>1.3</version> <version>1.3</version>
</dependency> </dependency>
</dependencies>
<build> <dependency>
<finalName>budd</finalName> <artifactId>did-sdk</artifactId>
<pluginManagement> <groupId>io.github.ehlxr</groupId>
<plugins> <version>1.0.2-SNAPSHOT</version>
<!-- mybatis-generator 插件; Run AS——>Maven Build… ——>在Goals框中输入mybatis-generator:generate --> </dependency>
<plugin> </dependencies>
<groupId>org.mybatis.generator</groupId> <build>
<artifactId>mybatis-generator-maven-plugin</artifactId> <finalName>budd</finalName>
<version>${mybatis.generator.core.version}</version> <pluginManagement>
<configuration> <plugins>
<verbose>true</verbose> <!-- mybatis-generator 插件; Run AS——>Maven Build… ——>在Goals框中输入mybatis-generator:generate -->
<overwrite>true</overwrite> <plugin>
</configuration> <groupId>org.mybatis.generator</groupId>
<dependencies> <artifactId>mybatis-generator-maven-plugin</artifactId>
<dependency> <version>${mybatis.generator.core.version}</version>
<groupId>mysql</groupId> <configuration>
<artifactId>mysql-connector-java</artifactId> <verbose>true</verbose>
<version>8.0.16</version> <overwrite>true</overwrite>
</dependency> </configuration>
</dependencies> <dependencies>
</plugin> <dependency>
<groupId>mysql</groupId>
<!-- 指定JDK编译版本 --> <artifactId>mysql-connector-java</artifactId>
<!--<plugin>--> <version>8.0.16</version>
<!-- <groupId>org.apache.maven.plugins</groupId>--> </dependency>
<!-- <artifactId>maven-compiler-plugin</artifactId>--> </dependencies>
<!-- <configuration>--> </plugin>
<!-- <source>${jdk.verion}</source>-->
<!-- <target>${jdk.verion}</target>--> <!-- 指定JDK编译版本 -->
<!-- <encoding>${file_encoding}</encoding>--> <!--<plugin>-->
<!-- </configuration>--> <!-- <groupId>org.apache.maven.plugins</groupId>-->
<!--</plugin>--> <!-- <artifactId>maven-compiler-plugin</artifactId>-->
<!-- <configuration>-->
<!-- jetty 服务器; Maven build... -> jetty:run --> <!-- <source>${jdk.verion}</source>-->
<plugin> <!-- <target>${jdk.verion}</target>-->
<groupId>org.mortbay.jetty</groupId> <!-- <encoding>${file_encoding}</encoding>-->
<artifactId>jetty-maven-plugin</artifactId> <!-- </configuration>-->
<version>8.1.15.v20140411</version> <!--</plugin>-->
<configuration>
<webApp> <!-- jetty 服务器; Maven build... -> jetty:run -->
<contextPath>/usefull-code</contextPath> <plugin>
</webApp> <groupId>org.mortbay.jetty</groupId>
<stopKey>exit</stopKey> <artifactId>jetty-maven-plugin</artifactId>
<stopPort>9090</stopPort> <version>8.1.15.v20140411</version>
<scanIntervalSeconds>1</scanIntervalSeconds> <configuration>
<connectors> <webApp>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> <contextPath>/usefull-code</contextPath>
<port>8080</port> </webApp>
<maxIdleTime>60000</maxIdleTime> <stopKey>exit</stopKey>
</connector> <stopPort>9090</stopPort>
</connectors> <scanIntervalSeconds>1</scanIntervalSeconds>
<requestLog implementation="org.eclipse.jetty.server.NCSARequestLog"> <connectors>
<filename>target/access.log</filename> <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<retainDays>90</retainDays> <port>8080</port>
<append>false</append> <maxIdleTime>60000</maxIdleTime>
<extended>false</extended> </connector>
<logTimeZone>GMT+8:00</logTimeZone> </connectors>
</requestLog> <requestLog implementation="org.eclipse.jetty.server.NCSARequestLog">
<!-- <systemProperties> <systemProperty> <name>productionMode</name> <filename>target/access.log</filename>
<value>${productionMode}</value> </systemProperty> </systemProperties> --> <retainDays>90</retainDays>
</configuration> <append>false</append>
</plugin> <extended>false</extended>
<!-- 生成javadoc文档包的插件 --> <logTimeZone>GMT+8:00</logTimeZone>
<plugin> </requestLog>
<groupId>org.apache.maven.plugins</groupId> <!-- <systemProperties> <systemProperty> <name>productionMode</name>
<artifactId>maven-javadoc-plugin</artifactId> <value>${productionMode}</value> </systemProperty> </systemProperties> -->
<version>2.10.2</version> </configuration>
<configuration> </plugin>
<aggregate>true</aggregate> <!-- 生成javadoc文档包的插件 -->
</configuration> <plugin>
<executions> <groupId>org.apache.maven.plugins</groupId>
<execution> <artifactId>maven-javadoc-plugin</artifactId>
<id>attach-javadocs</id> <version>2.10.2</version>
<goals> <configuration>
<goal>jar</goal> <aggregate>true</aggregate>
</goals> </configuration>
</execution> <executions>
</executions> <execution>
</plugin> <id>attach-javadocs</id>
<!-- 生成sources源码包的插件 --> <goals>
<plugin> <goal>jar</goal>
<groupId>org.apache.maven.plugins</groupId> </goals>
<artifactId>maven-source-plugin</artifactId> </execution>
<version>2.1.2</version> </executions>
<executions> </plugin>
<execution> <!-- 生成sources源码包的插件 -->
<id>attach-sources</id> <plugin>
<phase>verify</phase> <groupId>org.apache.maven.plugins</groupId>
<goals> <artifactId>maven-source-plugin</artifactId>
<goal>jar-no-fork</goal> <version>2.1.2</version>
</goals> <executions>
</execution> <execution>
</executions> <id>attach-sources</id>
</plugin> <phase>verify</phase>
</plugins> <goals>
</pluginManagement> <goal>jar-no-fork</goal>
<plugins> </goals>
<plugin> </execution>
<groupId>org.jetbrains.kotlin</groupId> </executions>
<artifactId>kotlin-maven-plugin</artifactId> </plugin>
<version>${kotlin.version}</version> </plugins>
<executions> </pluginManagement>
<execution> <plugins>
<id>compile</id> <plugin>
<phase>compile</phase> <groupId>org.jetbrains.kotlin</groupId>
<goals> <artifactId>kotlin-maven-plugin</artifactId>
<goal>compile</goal> <version>${kotlin.version}</version>
</goals> <executions>
</execution> <execution>
<execution> <id>compile</id>
<id>test-compile</id> <phase>compile</phase>
<phase>test-compile</phase> <goals>
<goals> <goal>compile</goal>
<goal>test-compile</goal> </goals>
</goals> </execution>
</execution> <execution>
</executions> <id>test-compile</id>
<configuration> <phase>test-compile</phase>
<jvmTarget>1.8</jvmTarget> <goals>
</configuration> <goal>test-compile</goal>
</plugin> </goals>
<!--<plugin>--> </execution>
<!-- <groupId>org.apache.maven.plugins</groupId>--> </executions>
<!-- <artifactId>maven-compiler-plugin</artifactId>--> <configuration>
<!-- <executions>--> <jvmTarget>1.8</jvmTarget>
<!-- <execution>--> </configuration>
<!-- <id>compile</id>--> </plugin>
<!-- <phase>compile</phase>--> <!--<plugin>-->
<!-- <goals>--> <!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <goal>compile</goal>--> <!-- <artifactId>maven-compiler-plugin</artifactId>-->
<!-- </goals>--> <!-- <executions>-->
<!-- </execution>--> <!-- <execution>-->
<!-- <execution>--> <!-- <id>compile</id>-->
<!-- <id>testCompile</id>--> <!-- <phase>compile</phase>-->
<!-- <phase>test-compile</phase>--> <!-- <goals>-->
<!-- <goals>--> <!-- <goal>compile</goal>-->
<!-- <goal>testCompile</goal>--> <!-- </goals>-->
<!-- </goals>--> <!-- </execution>-->
<!-- </execution>--> <!-- <execution>-->
<!-- </executions>--> <!-- <id>testCompile</id>-->
<!--</plugin>--> <!-- <phase>test-compile</phase>-->
</plugins> <!-- <goals>-->
<defaultGoal>compile</defaultGoal> <!-- <goal>testCompile</goal>-->
</build> <!-- </goals>-->
</project> <!-- </execution>-->
<!-- </executions>-->
<!--</plugin>-->
</plugins>
<defaultGoal>compile</defaultGoal>
</build>
<repositories>
<repository>
<id>github</id>
<url>https://git.ehlxr.me/ehlxr/maven-repository/raw/branch/main</url>
<!--<url>https://raw.githubusercontent.com/ehlxr/maven-repository/main</url>-->
</repository>
</repositories>
<!--<repositories>-->
<!-- <repository>-->
<!-- &lt;!&ndash;-->
<!-- 需要在 setting.xml 中配置认证信息-->
<!-- <servers>-->
<!-- <server>-->
<!-- <id>github</id>-->
<!-- <username>ehlxr</username>-->
<!-- <password>${env.GITHUB_MVN_TOKEN}</password>-->
<!-- </server>-->
<!-- </servers>-->
<!-- &ndash;&gt;-->
<!-- <id>github</id>-->
<!-- <url>https://maven.pkg.github.com/ehlxr/mvn-repository</url>-->
<!-- <releases>-->
<!-- <enabled>true</enabled>-->
<!-- </releases>-->
<!-- <snapshots>-->
<!-- <enabled>true</enabled>-->
<!-- </snapshots>-->
<!-- </repository>-->
<!--</repositories>-->
</project>

View File

@ -0,0 +1,89 @@
/*
* The MIT License (MIT)
*
* Copyright © 2020 xrv <xrg@live.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package io.github.ehlxr.utils;
import com.google.common.collect.ImmutableMap;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;
/**
* 预警信息发送工具类
*
* @author ehlxr
* @since 2020-12-23 17:47.
*/
public class SendAlarmUtil {
private static String dingtalkUrl;
public static void init(String dingtalkUrl) {
Objects.requireNonNull(dingtalkUrl, "dingtalkUrl not allow null");
SendAlarmUtil.dingtalkUrl = dingtalkUrl;
}
/**
* 异步发送预警信息
*
* @param msg 预警信息
* @param action {@link BiConsumer} 完成后回调函数式接口
*/
public static void send(String msg, BiConsumer<? super String, ? super Throwable> action) {
// String msg = String.format("%s\ntraceid: %s", msg, MDC.get(Constants.LOG_TRACE_ID));
CompletableFuture.supplyAsync(() -> {
Objects.requireNonNull(dingtalkUrl, "SendAlarmUtil not init.");
return HttpUtil.post(dingtalkUrl,
JsonUtils.obj2String(ImmutableMap.of("msgtype", "text",
"text", ImmutableMap.of("content", msg))));
}
).whenCompleteAsync(action);
}
/**
* 异步发送预警信息
*
* @param message 预警信息
*/
public static void send(String message) {
send(message, (u, t) -> {
});
}
public static void main(String[] args) throws InterruptedException {
Try.of(() -> SendAlarmUtil.init(dingtalkUrl))
.trap(System.out::println)
.run();
send("dsfsdf",
(t, u) -> System.out.println("send exception message to dingtalk result " + t + ". " + u));
System.out.println("000000");
Thread.sleep(2000);
}
}