This commit is contained in:
iizmg
2020-04-26 12:03:42 +08:00
parent 5917857b14
commit 8e6eba59e0
14 changed files with 408 additions and 93 deletions
+8 -93
View File
@@ -24,21 +24,8 @@
</properties>
<!--子模块 -->
<modules>
<!-- <module>udf-api-server</module>-->
<!-- <module>udf-api-common</module>-->
<!-- <module>udf-api-eit</module>-->
<!-- <module>udf-api-eit-gbom</module>-->
<!-- <module>udf-api-pm-common</module>-->
<!-- <module>udf-api-pm-pqrr</module>-->
<!-- <module>udf-api-windows-server</module>-->
<!-- <module>udf-api-crdn</module>-->
<!-- <module>udf-api-general</module>-->
<!-- <module>udf-api-esb-migration</module>-->
<!-- <module>udf-api-main-data</module>-->
<!-- <module>udf-api-part-base-adv</module>-->
<!-- <module>udf-api-sor</module>-->
<!-- <module>udf-api-rbac</module>-->
<!-- <module>udf-api-pm</module>-->
<module>udf-api-server</module>
<module>udf-api-common</module>
</modules>
<!-- 依赖管理 -->
<dependencyManagement>
@@ -51,84 +38,12 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- &lt;!&ndash; udf-api-part-base-adv &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-api-part-base-adv</artifactId>-->
<!-- <version>${udf-api.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; udf-api-sor &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-api-sor</artifactId>-->
<!-- <version>${udf-api.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; udf-api-pm &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-api-pm</artifactId>-->
<!-- <version>${udf-api.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; udf-api-rbac &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-api-rbac</artifactId>-->
<!-- <version>${udf-api.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; udf-api-main-data &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-api-main-data</artifactId>-->
<!-- <version>${udf-api.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; udf-api-crdn &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-api-crdn</artifactId>-->
<!-- <version>${udf-api.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; udf-api-pm-pqrr &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-api-pm-pqrr</artifactId>-->
<!-- <version>${udf-api.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; udf-api-general &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-api-general</artifactId>-->
<!-- <version>${udf-api.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; udf-api-pm-common &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-api-pm-common</artifactId>-->
<!-- <version>${udf-api.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; udf-api-esb-migration &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-api-esb-migration</artifactId>-->
<!-- <version>${udf-api.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; udf-api-eit-gbom &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-api-eit-gbom</artifactId>-->
<!-- <version>${udf-api.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; udf-api-eit &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-api-eit</artifactId>-->
<!-- <version>${udf-api.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; udf-api-common &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-api-common</artifactId>-->
<!-- <version>${udf-api.version}</version>-->
<!-- </dependency>-->
<!-- udf-api-common -->
<dependency>
<groupId>org.itkk.udf</groupId>
<artifactId>udf-api-common</artifactId>
<version>${udf-api.version}</version>
</dependency>
<!-- udf-starter-core -->
<dependency>
<groupId>org.itkk.udf</groupId>
+78
View File
@@ -0,0 +1,78 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<!-- maven坐标 -->
<artifactId>udf-api-common</artifactId>
<name>udf-api-common</name>
<packaging>jar</packaging>
<url>https://www.itkk.org/</url>
<!-- 父依赖 -->
<parent>
<groupId>org.itkk.udf</groupId>
<artifactId>udf-api</artifactId>
<version>1.0</version>
</parent>
<!-- 依赖 -->
<dependencies>
<!-- udf-starter-core -->
<dependency>
<groupId>org.itkk.udf</groupId>
<artifactId>udf-starter-core</artifactId>
</dependency>
<!-- mysql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- udf-starter-datasource-dynamic -->
<dependency>
<groupId>org.itkk.udf</groupId>
<artifactId>udf-starter-datasource-dynamic</artifactId>
</dependency>
<!-- thymeleaf -->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-thymeleaf</artifactId>-->
<!-- </dependency>-->
<!-- itext7 -->
<!-- <dependency>-->
<!-- <groupId>com.itextpdf</groupId>-->
<!-- <artifactId>itext7-core</artifactId>-->
<!-- <version>${itext7.version}</version>-->
<!-- <type>pom</type>-->
<!-- </dependency>-->
<!-- udf-starter-cache-db -->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-starter-cache-db</artifactId>-->
<!-- </dependency>-->
<!-- udf-starter-queue-db -->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-starter-queue-db</artifactId>-->
<!-- </dependency>-->
<!-- udf-starter-file-db -->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-starter-file-db</artifactId>-->
<!-- </dependency>-->
<!-- udf-starter-process-activiti -->
<!-- <dependency>-->
<!-- <groupId>org.itkk.udf</groupId>-->
<!-- <artifactId>udf-starter-process-activiti</artifactId>-->
<!-- </dependency>-->
</dependencies>
<!-- 构建 -->
<build>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources/</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.jar</exclude>
</excludes>
</resource>
</resources>
</build>
</project>
@@ -0,0 +1,12 @@
package org.itkk.udf.api.common;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* 配置类
*/
@Configuration
public class CommonConfiguration implements WebMvcConfigurer {
}
@@ -0,0 +1,13 @@
package org.itkk.udf.api.common;
/**
* 常量类
*/
public class CommonConstant {
/**
* 私有化构造函数
*/
private CommonConstant() {
}
}
@@ -0,0 +1,20 @@
package org.itkk.udf.api.common;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
/**
* 属性类
*/
@Component
@ConfigurationProperties(prefix = CommonProperties.UDF_API_PROPERTIES)
@Validated
@Data
public class CommonProperties {
/**
* 配置文件前缀
*/
protected static final String UDF_API_PROPERTIES = "org.itkk.udf.api.common.properties";
}
@@ -0,0 +1,16 @@
package org.itkk.udf.api.common;
import lombok.extern.slf4j.Slf4j;
/**
* 工具类
*/
@Slf4j
public class CommonUtil {
/**
* 私有化构造函数
*/
private CommonUtil() {
}
}
+68
View File
@@ -0,0 +1,68 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<!-- maven坐标 -->
<artifactId>udf-api-server</artifactId>
<name>udf-api-server</name>
<packaging>jar</packaging>
<url>https://www.itkk.org/</url>
<!-- 父依赖 -->
<parent>
<groupId>org.itkk.udf</groupId>
<artifactId>udf-api</artifactId>
<version>1.0</version>
</parent>
<!-- 参数 -->
<properties>
<server.port>9000</server.port>
<management.port>8000</management.port>
</properties>
<!-- 依赖 -->
<dependencies>
<!-- udf-api-common -->
<dependency>
<groupId>org.itkk.udf</groupId>
<artifactId>udf-api-common</artifactId>
</dependency>
</dependencies>
<!-- 构建 -->
<build>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources/</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<!-- package -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${springboot.version}</version>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
<configuration>
<encoding>UTF-8</encoding>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
<nonFilteredFileExtension>xls</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,20 @@
package org.itkk.udf.api.server;
import org.apache.ibatis.annotations.Mapper;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
@SpringBootApplication
@ServletComponentScan(basePackages = {"org.itkk"})
@ComponentScan(basePackages = {"org.itkk"})
@MapperScan(basePackages = {"org.itkk"}, annotationClass = Mapper.class)
@EnableAsync
public class UdfApiServerApplication {
public static void main(String[] args) {
SpringApplication.run(UdfApiServerApplication.class, args);
}
}
@@ -0,0 +1,32 @@
# CORS
org.itkk.udf.starter.core.properties.corsAllowedOrigins=http://localhost:8080
# GUAVA CACHE
org.itkk.udf.starter.core.properties.guavaCacheProperties.concurrencyLevel=10
org.itkk.udf.starter.core.properties.guavaCacheProperties.initialCapacity=10
org.itkk.udf.starter.core.properties.guavaCacheProperties.maximumSize=100
org.itkk.udf.starter.core.properties.guavaCacheProperties.expireAfterWrite=10
# LOGGING
logging.file.name=d:/${spring.application.name}/app/application-log/${spring.application.name}_${server.port}_${spring.profiles.active}/base.log
logging.file.max-size=100MB
logging.file.max-history=31
# EXCEPTION
org.itkk.udf.starter.core.properties.outputExceptionStackTrace=true
# DataSource Dynamic
org.itkk.udf.starter.datasource.dynamic.properties.defaultCode=udf
# DataSource Dynamic -- udf
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.code=udf
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.enable=true
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.url=jdbc:mysql://itkk.org:3306/dev_udf?useUnicode=true&useSSL=false&autoReconnect=true
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.username=dev_udf
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.password=123456
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.driverClassName=com.mysql.jdbc.Driver
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.initialSize=1
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.minIdle=1
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.maxActive=2
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.maxWait=5000
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.timeBetweenEvictionRunsMillis=60000
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.minEvictableIdleTimeMillis=30000
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.validationQuery=select 1 from dual
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.testWhileIdle=true
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.testOnBorrow=false
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.testOnReturn=false
@@ -0,0 +1,32 @@
# CORS
org.itkk.udf.starter.core.properties.corsAllowedOrigins=https://itkk.org,https://www.itkk.org,http://itkk.org:81,http://www.itkk.org:81,http://192.168.1.100
# GUAVA CACHE
org.itkk.udf.starter.core.properties.guavaCacheProperties.concurrencyLevel=10
org.itkk.udf.starter.core.properties.guavaCacheProperties.initialCapacity=10
org.itkk.udf.starter.core.properties.guavaCacheProperties.maximumSize=200
org.itkk.udf.starter.core.properties.guavaCacheProperties.expireAfterWrite=10
# LOGGING
logging.file.name=/usr/local/share/${spring.application.name}/app/application-log/${spring.application.name}_${server.port}_${spring.profiles.active}/base.log
logging.file.max-size=100MB
logging.file.max-history=31
# EXCEPTION
org.itkk.udf.starter.core.properties.outputExceptionStackTrace=false
# DataSource Dynamic
org.itkk.udf.starter.datasource.dynamic.properties.defaultCode=udf
# DataSource Dynamic -- udf
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.code=udf
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.enable=true
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.url=jdbc:mysql://itkk.org:3306/dev_prod?useUnicode=true&useSSL=false&autoReconnect=true
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.username=dev_prod
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.password=5ds2c6de54t1fd36e5f
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.driverClassName=com.mysql.jdbc.Driver
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.initialSize=1
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.minIdle=1
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.maxActive=2
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.maxWait=5000
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.timeBetweenEvictionRunsMillis=60000
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.minEvictableIdleTimeMillis=30000
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.validationQuery=select 1 from dual
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.testWhileIdle=true
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.testOnBorrow=false
org.itkk.udf.starter.datasource.dynamic.properties.map.udf.testOnReturn=false
@@ -0,0 +1,49 @@
# HTTP
spring.http.encoding.force=true
# file encoding
spring.mandatory-file-encoding=UTF-8
# INFO
info.build.group=${project.groupId}
info.build.artifact=${project.artifactId}
info.build.version=${project.version}
info.build.name=${spring.application.name}
info.build.env=${spring.profiles.active}
info.build.time=${project.build.date}
info.build.encoding=${project.build.sourceEncoding}
info.build.java.source=${java.version}
info.build.java.target=${java.version}
# SPRING
spring.application.name=${project.name}
# HTTP SERVER
server.port=${server.port}
# compression
server.compression.enabled=true
server.compression.min-response-size=1KB
# MANAGEMENT HTTP SERVER (ManagementServerProperties)
#management.server.address=127.0.0.1
management.server.port=${management.port}
# ENDPOINTS WEB CONFIGURATION (WebEndpointProperties)
management.endpoints.web.exposure.include=*
# ENDPOINT
management.endpoint.health.showDetails=always
management.endpoint.shutdown.enabled=true
management.endpoint.restart.enabled=true
management.endpoint.pause.enabled=true
management.endpoint.resume.enabled=true
# JACKSON
spring.jackson.timeZone=Asia/Shanghai
spring.jackson.serialization.INDENT_OUTPUT=false
spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false
spring.jackson.deserialization.FAIL_ON_UNKNOWN_PROPERTIES=false
spring.jackson.parser.ALLOW_SINGLE_QUOTES=true
spring.jackson.parser.ALLOW_UNQUOTED_CONTROL_CHARS=true
# HTTP FILE UPLOAD
spring.servlet.multipart.max-file-size=1MB
spring.servlet.multipart.max-request-size=1MB
spring.servlet.multipart.resolve-lazily=false
# TASK SCHEDULING
spring.task.scheduling.pool.size=10
# mybatisPlus
mybatisPlus.mapperLocations=classpath*:mapper/*.xml
mybatisPlus.configuration.logImpl=org.itkk.udf.starter.core.trace.TraceMybatisLogImpl
mybatisPlus.configuration.callSettersOnNulls=true
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
echo 'shutdown application begin'
returnCode=`curl -I -s -X POST "http://127.0.0.1:${management.port}/actuator/shutdown"|head -1|cut -d" " -f2`
echo "shutdown status code : $returnCode"
sleep 5
echo 'shutdown application end'
echo 'stop application begin'
PID=$(ps -ef | grep ${project.name}-${project.version}.jar | grep -v grep | awk '{ print $2 }')
if [[ -z "$PID" ]]
then
echo 'application is already stopped'
else
echo 'kill process'
kill -9 $PID
fi
echo 'stop application end'
echo 'bak and copy application begin'
datestr=$(date +%Y_%m_%d_%H_%M_%S)
mv /usr/local/share/${spring.application.name}/app/${project.name}/${project.name}-${project.version}.jar /usr/local/share/${spring.application.name}/app/${project.name}/${project.name}-${project.version}.jar.${datestr}
cp ${project.name}-${project.version}.jar /usr/local/share/${spring.application.name}/app/${project.name}/${project.name}-${project.version}.jar
echo 'bak and copy application end'
echo 'start application begin'
rm -rf nohup.out
nohup java -server -Xms1024m -Xmx1024m -XX:+UseG1GC -jar /usr/local/share/${spring.application.name}/app/${project.name}/${project.name}-${project.version}.jar --spring.profiles.active=prod &
echo 'start application end'
echo 'check service begin'
echo 'sleep 10s begin'
sleep 10
echo 'sleep 10s end'
startedStatus="0";
maxCount=40;
for (( i = 0; i < $maxCount; i++ ));do
returnCode=`curl -I -s "http://127.0.0.1:${management.port}/actuator/info"|head -1|cut -d" " -f2`
if [[ "$returnCode" == "200" ]]
then
startedStatus="1";
break;
else
echo "sleep 2s,count:$i";
sleep 2
fi
done
if [[ "$startedStatus" == "1" ]]
then
echo "service has started";
else
echo "service start fail";
exit 1;
fi
echo 'check service end'
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml" />
<jmxConfigurator />
</configuration>