Commit 54476527 authored by Administrator's avatar Administrator

创建项目

parent 3972936f
<?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>
<groupId>cn.quant.baa.pay</groupId>
<artifactId>baa-pay</artifactId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>baa-pay-notice</artifactId>
<name>baa-pay-notice</name>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>cn.quant.baa.pay</groupId>
<artifactId>baa-pay-core</artifactId>
<version>1.0.0</version>
</dependency>
<!--quant-->
<dependency>
<groupId>cn.quant.spring.boot</groupId>
<artifactId>quant-spring-boot-starter-web</artifactId>
</dependency>
<!--test-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
<exclusion>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</exclusion>
<exclusion>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.package.name}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<targetPath>${project.build.directory}/classes</targetPath>
<includes>
<include>**/*.yml</include>
<include>**/*.xml</include>
<include>**/*.properties</include>
<include>**/*.txt</include>
</includes>
</resource>
<resource>
<directory>src/main/bin</directory>
<filtering>true</filtering>
<targetPath>${project.build.directory}/bin</targetPath>
<includes>
<include>**/*.sh</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.source}</target>
<encoding>${maven.compiler.encoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>cn.quant.baa.pay.ServerApplication</mainClass>
<layout>ZIP</layout>
</configuration>
</plugin>
<!--<plugin>-->
<!--<artifactId>maven-assembly-plugin</artifactId>-->
<!--<configuration>-->
<!--<appendAssemblyId>false</appendAssemblyId>-->
<!--<descriptors>-->
<!--<descriptor>src/assembly/assembly.xml</descriptor>-->
<!--</descriptors>-->
<!--</configuration>-->
<!--<executions>-->
<!--<execution>-->
<!--<id>make-assembly</id>-->
<!--<phase>package</phase>-->
<!--<goals>-->
<!--<goal>single</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
<!--</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-archetype-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<id>servers</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>target/bin</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
<source>target/${project.package.name}.jar</source>
<outputDirectory>/</outputDirectory>
<destName>${project.package.name}.jar</destName>
</file>
<file>
<source>target/config/application-${spring.profiles.active}.properties</source>
<outputDirectory>/config</outputDirectory>
<destName>application.properties</destName>
</file>
<file>
<source>target/config/logback-spring.xml</source>
<outputDirectory>/config</outputDirectory>
<destName>logback-spring.xml</destName>
</file>
</files>
</assembly>
\ No newline at end of file
#!/bin/sh
JAVA="$JAVA_HOME/bin/java"
JAVAPS="$JAVA_HOME/bin/jps"
if $cygwin
then
KILL=/bin/kill
else
KILL=kill
fi
if readlink -f "$0" > /dev/null 2>&1
then
APP_BIN=$(readlink -f $0)
else
APP_BIN=$(pwd -P)
fi
#APP_HOME=${APP_BIN%'/bin'*}
APP_HOME=${APP_BIN%'/'*}
echo "[INFO]Terminate the server; home=$APP_HOME"
CPS=$(ps -e -opid,cmd | grep -i "^[0-9]* .*/java .*-Dapplication.home.dir=$APP_HOME .*${project.name}.*\.jar" | grep -v "grep" | head -n 1 | awk '{print $1}')
if [ -z "$CPS" ]; then
echo "[INFO]server is not running"
exit 1
else
PSID=${CPS%%" /"*}
if [ $PSID -eq 0 ]; then
echo "[ERROR]Not found PID"
exit 1
else
$KILL -15 $PSID
echo "[INFO]Stopped server; home=$APP_HOME; PID=$PSID"
exit 0
fi
fi
\ No newline at end of file
#!/bin/sh
if [ "$JAVA_HOME" != "" ]; then
JAVA="$JAVA_HOME/bin/java"
else
JAVA=java
fi
echo "JAVA: "$JAVA
if readlink -f "$0" > /dev/null 2>&1
then
BIN_PATH=$(readlink -f $0)
else
BIN_PATH=$(pwd -P)
fi
#APP_HOME=${BIN_PATH%"/bin"*}
APP_HOME=${BIN_PATH%"/"*}
echo "APP_HOME: "$APP_HOME
APP_JAR=$(find "$APP_HOME" -maxdepth 1 -name "${project.name}*\.jar" | head -n 1)
if [ -z "$APP_JAR" ]; then
echo "[ERROR]Not found main jar file"
exit 1
fi
echo "APP_JAR: "$APP_JAR
echo "[INFO]Start the server; home=$APP_HOME"
CPS=$(ps -e -opid,cmd | grep -i "^[0-9]* .*/java .*-Dapplication.home.dir=$APP_HOME .*${project.name}.*\.jar" | grep -v "grep" | head -n 1 | awk '{print $1}')
if [ -n "$CRACKPS" ]; then
echo "[ERROR]Server is running;"
exit 1
else
JAVAOPTS="-Xms512m -Xmx1024m -Xmn256m -Xss1024k"
APPOPTS="-Dfile.encoding=UTF-8 -Dapplication.home.dir=$APP_HOME -Dlogging.config=$APP_HOME/config/logback-spring.xml"
echo "[INFO]Application options: $APPOPTS"
$JAVA $JAVAOPTS $APPOPTS "-jar" $APP_JAR "--spring.config.file=$APP_HOME/config/application.properties" 2>&1 >/dev/null &
#echo $JAVA $JAVAOPTS "-jar" $APP_JAR
exit 0
fi
\ No newline at end of file
CREATE TABLE `optimistic` (
`DESC_TEXT` varchar(400) DEFAULT NULL COMMENT '描述',
`CREATED_BY` varchar(72) NOT NULL COMMENT '创建用户',
`CREATED_DATE` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`MODIFIED_BY` varchar(72) NOT NULL COMMENT '更新用户',
`MODIFIED_DATE` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
`MODIFIED_NO` int(8) NOT NULL DEFAULT '0' COMMENT '更新次数',
`PARTITION_KEY` smallint(4) NOT NULL COMMENT '分区键',
`EXTENDED_FIELD1` varchar(4) DEFAULT NULL,
`EXTENDED_FIELD2` varchar(4) DEFAULT NULL,
`EXTENDED_FIELD3` varchar(4) DEFAULT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
alter table optimistic add `DESC_TEXT` varchar(400) DEFAULT NULL COMMENT '描述';
alter table optimistic add `CREATED_BY` varchar(72) NOT NULL COMMENT '创建用户';
alter table optimistic add `CREATED_DATE` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间';
alter table optimistic add `MODIFIED_BY` varchar(72) NOT NULL COMMENT '更新用户';
alter table optimistic add `MODIFIED_DATE` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间';
alter table optimistic add `MODIFIED_NO` int(8) NOT NULL DEFAULT '0' COMMENT '更新次数';
alter table optimistic add `PARTITION_KEY` smallint(4) NOT NULL COMMENT '分区键';
alter table optimistic add `EXTENDED_FIELD1` varchar(4) DEFAULT NULL;
alter table optimistic add `EXTENDED_FIELD2` varchar(4) DEFAULT NUL;
alter table optimistic add `EXTENDED_FIELD3` varchar(4) DEFAULT NULL;
\ No newline at end of file
package cn.quant.baa.pay;
import cn.quant.spring.util.IdentitySequencer;
import cn.quant.spring.util.ServerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* <p><b>Application VM Option:</b><br/>
* <code>--spring.config.file=${project.build.directory}/target/config/application-dev.properties </code><br/>
* <code>-Dlogging.config=${project.build.directory}/target/config/logback-spring.xml</code></p>
* <p><b>Enable Dubbo Annotation: </b><br/>
* <code>@org.springframework.context.annotation.ImportResource(locations = {"classpath:application-dubbo.xml"})</code></p>
*/
@ComponentScan
@SpringBootApplication
@EnableAutoConfiguration(exclude = {
// DataSourceAutoConfiguration.class,
// DataSourceTransactionManagerAutoConfiguration.class,
// HibernateJpaAutoConfiguration.class
})
@PropertySource(value = {"classpath:config/bootstrap.yml"
, "classpath:config/application.yml"
, "file:${spring.config.file}"})
public class ServerApplication {
@Inject
private ApplicationContext context;
@PostConstruct
private void init() throws Exception {
Environment environment = context.getEnvironment();
IdentitySequencer sequencer = context.getBean(IdentitySequencer.class);
Logger logger = LoggerFactory.getLogger(ServerApplication.class);
logger.info("\n---------------------------------------------------------------------\n" +
"\tWorker Id : {}\n" +
"\tServer IP : {}\n" +
"\tConfig File : {}\n" +
"\tSpring Profiles : {}\n" +
"\tRuntime : {}\n" +
"\n---------------------------------------------------------------------\n"
, sequencer.workerId()
, ServerUtils.getHostAddress()
, environment.getProperty("spring.config.file")
, environment.getActiveProfiles()
, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
}
public static void main(String[] args) {
SpringApplication application = new SpringApplication(ServerApplication.class);
ConfigurableApplicationContext context = application.run(args);
}
}
\ No newline at end of file
package cn.quant.baa.pay;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* Created by hechao included 2020/1/22.
*/
public class ServerServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ServerApplication.class);
}
}
\ No newline at end of file
package cn.quant.baa.pay.config;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.ZonedDateTimeSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.util.List;
/**
* Created by hechao on 2018/6/28.
*/
@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {
private MappingJackson2HttpMessageConverter messageConverter;
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
converters.add(messageConverter);
}
@Bean
public MappingJackson2HttpMessageConverter httpMessageConverter() {
messageConverter = new MappingJackson2HttpMessageConverter();
SimpleModule simpleModule = new SimpleModule();
simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
simpleModule.addSerializer(LocalDateTime.class, LocalDateTimeSerializer.INSTANCE);
simpleModule.addDeserializer(LocalDateTime.class, LocalDateTimeDeserializer.INSTANCE);
simpleModule.addSerializer(LocalDate.class, LocalDateSerializer.INSTANCE);
simpleModule.addDeserializer(LocalDate.class, LocalDateDeserializer.INSTANCE);
simpleModule.addSerializer(ZonedDateTime.class, ZonedDateTimeSerializer.INSTANCE);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(simpleModule);
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
messageConverter.setObjectMapper(objectMapper);
return messageConverter;
}
}
/**
* application configuration
*/
package cn.quant.baa.pay.config;
/**
* dubbo facade interface and dto
*/
package cn.quant.baa.pay.dubbo.facade;
/**
* dubbo service
*/
package cn.quant.baa.pay.dubbo.service;
/**
* application controller dto
*/
package cn.quant.baa.pay.http;
/**
* jpa entity
*/
package cn.quant.baa.pay.jpa.entity;
/**
* jpa repository
*/
package cn.quant.baa.pay.jpa.repository;
/**
* mybatis mapper, entity
*/
package cn.quant.baa.pay.mybatis;
/**
* application controller
*/
package cn.quant.baa.pay.rest;
/**
* application service
*/
package cn.quant.baa.pay.service;
package cn.quant.baa.pay.support;
import org.springframework.data.domain.AuditorAware;
import org.springframework.stereotype.Component;
import java.util.Optional;
/**
* <p><b>Enable Auditor Aware:</b><br/>
* <code>@org.springframework.stereotype.Component("auditorAwareHandler")</code></p>
* Created by hechao included 2017/9/15.
* @see cn.quant.baa.pay.jpa.entity
*/
@Component("auditorAwareHandler")
public class AuditorAwareHandler implements AuditorAware<String> {
@Override
public Optional<String> getCurrentAuditor() {
return Optional.of("SYS");
}
}
\ No newline at end of file
package cn.quant.baa.pay.support;
import cn.quant.spring.ExceptionEnum;
import cn.quant.spring.ServerRuntimeException;
import cn.quant.spring.context.ContextLoader;
import cn.quant.spring.context.ServerApplicationContext;
import cn.quant.spring.http.HttpResponseData;
import cn.quant.spring.web.annotation.JsonpMapping;
import cn.quant.spring.web.support.JsonpResponseAdvice;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.servlet.http.HttpServletRequest;
/**
* <p><b>Enable Exception Advice Annotation:</b><br/>
* <code>@org.springframework.web.bind.annotation.RestControllerAdvice</code>
* </p>
* @date 2018-04-09 11:01
**/
//@RestControllerAdvice
public class ExceptionAdvice {
private static final Logger log = LoggerFactory.getLogger(ExceptionAdvice.class);
@ExceptionHandler(value = Exception.class)
@ResponseBody
public HttpResponseData handlerException(HttpServletRequest request, Exception e) {
log.error("Exception url:{}, error:{}", request.getRequestURI(), e);
String message = e.getMessage();
HttpResponseData responseData = new HttpResponseData(e);
if ((message == null) && ServerRuntimeException.class.isInstance(e)) {
ServerRuntimeException exception = (ServerRuntimeException) e;
ExceptionEnum type = exception.getType();
if (type != null) {
ServerApplicationContext applicationContext = ContextLoader.getCurrentApplicationContext();
message = applicationContext.getMessage(type.MESSAGE_CODE);
responseData.setMessage(message);
responseData.setStatus(type.ERROR_CODE);
}
}
return responseData;
}
}
\ No newline at end of file
package cn.quant.baa.pay.support;
import cn.quant.spring.web.annotation.JsonpMapping;
import cn.quant.spring.web.support.JsonpResponseAdvice;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
* <p><b>Enable Jsonp Annotation:</b><br/>
* <code>@org.springframework.web.bind.annotation.RestControllerAdvice</code></p>
*
* Created by hechao included 2018/7/26.
* @see JsonpMapping
* @see RestControllerAdvice
* @see JsonpResponseAdvice
*/
//@RestControllerAdvice
public class HttpJsonpResponseAdvice extends JsonpResponseAdvice {
}
\ No newline at end of file
/**
* <p>Convert Entity Attribute:<br/>
* <code>annotation {@link javax.persistence.Converter}, interface {@link javax.persistence.AttributeConverter}.</code></P>
* <p>Inject Auditor Aware:<br/>
* <code>annotation {@link org.springframework.stereotype.Component}, interface {@link org.springframework.data.domain.AuditorAware}.</code></P>
*
*/
package cn.quant.baa.pay.support;
debug=true
#Spring
spring.profiles.active=dev
spring.application.name=baa-pay-notice
#Devtool
spring.devtools.restart.enabled=true
spring.devtools.livereload.enabled=true
#Server
server.port=8080
server.servlet.context-path=/
#quant
quant.server.number=1
quant.server.sequencer.operator=TWEPOCH_PLUS
quant.server.sequencer.sequence-bits=8
#Database
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.17.5.17:31548/baa_pay_1.0?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.datasource.username=qa
spring.datasource.password=qatest
spring.datasource.hikari.minimum-idle=1
spring.datasource.hikari.maximum-pool-size=3
spring.datasource.hikari.data-source-properties.cachePrepStmts=true
spring.datasource.hikari.data-source-properties.prepStmtCacheSize=250
spring.datasource.hikari.data-source-properties.prepStmtCacheSqlLimit=2048
spring.datasource.hikari.data-source-properties.useServerPrepStmts=true
#JPA
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.database=MYSQL
quant.baapay.local-cache-expire.time=6000
quant.baapay.local-cache-expire.unit=SECONDS
quant.baapay.local-cache-expire.size=1000
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<dubbo:application name="${dubbo.application.name}"/>
<dubbo:registry address="${dubbo.registry.address}"/>
<dubbo:protocol name="${dubbo.protocol.name}" port="${dubbo.protocol.port}" />
<bean id="testDubboService" class="cn.quant.baa.pay.dubbo.service.TestDubboServiceImpl"></bean>
<dubbo:service protocol="dubbo" interface="cn.quant.baa.pay.dubbo.facade.TestDubboServiceFacade"
ref="testDubboService"
version="${cn.quant.baa.pay.dubbo.facade.TestDubboServiceFacade.version}"
timeout="${cn.quant.baa.pay.dubbo.facade.TestDubboServiceFacade.timeout}" retries="0"/>
</beans>
debug=true
#Spring
spring.profiles.active=pre
spring.application.name=Application
#Devtool
spring.devtools.restart.enabled=true
spring.devtools.livereload.enabled=true
#Server
server.port=8080
server.servlet.context-path=/
#quant
quant.server.number=1
quant.server.sequencer.operator=TWEPOCH_PLUS
quant.server.sequencer.sequence-bits=8
#Database
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/employees?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=111111
spring.datasource.hikari.minimum-idle=1
spring.datasource.hikari.maximum-pool-size=3
spring.datasource.hikari.data-source-properties.cachePrepStmts=true
spring.datasource.hikari.data-source-properties.prepStmtCacheSize=250
spring.datasource.hikari.data-source-properties.prepStmtCacheSqlLimit=2048
spring.datasource.hikari.data-source-properties.useServerPrepStmts=true
#JPA
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.database=MYSQL
#Dubbo
dubbo.application.name=Application
dubbo.registry.address=zookeeper://172.17.15.101:3180?backup=172.17.15.102:3180,172.17.15.103:3180
dubbo.protocol.name=dubbo
dubbo.protocol.port=28080
TestDubboServiceFacade.version=1.0.0
TestDubboServiceFacade.timeout=30000
#Mybatis
#mybatis.mapper-locations=classpath:mapping/*.xml
#mybatis.type-aliases-package=cn.quant.baa.pay.mybatis
\ No newline at end of file
debug=true
#Spring
spring.profiles.active=pro
spring.application.name=Application
#Devtool
spring.devtools.restart.enabled=true
spring.devtools.livereload.enabled=true
#Server
server.port=8080
server.servlet.context-path=/
#quant
quant.server.number=1
quant.server.sequencer.operator=TWEPOCH_PLUS
quant.server.sequencer.sequence-bits=8
#Database
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/employees?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=111111
spring.datasource.hikari.minimum-idle=1
spring.datasource.hikari.maximum-pool-size=3
spring.datasource.hikari.data-source-properties.cachePrepStmts=true
spring.datasource.hikari.data-source-properties.prepStmtCacheSize=250
spring.datasource.hikari.data-source-properties.prepStmtCacheSqlLimit=2048
spring.datasource.hikari.data-source-properties.useServerPrepStmts=true
#JPA
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.database=MYSQL
#Dubbo
dubbo.application.name=Application
dubbo.registry.address=zookeeper://172.17.15.101:3180?backup=172.17.15.102:3180,172.17.15.103:3180
dubbo.protocol.name=dubbo
dubbo.protocol.port=28080
TestDubboServiceFacade.version=1.0.0
TestDubboServiceFacade.timeout=30000
#Mybatis
#mybatis.mapper-locations=classpath:mapping/*.xml
#mybatis.type-aliases-package=cn.quant.baa.pay.mybatis
\ No newline at end of file
debug=true
#Spring
spring.profiles.active=test
spring.application.name=Application
#Devtool
spring.devtools.restart.enabled=true
spring.devtools.livereload.enabled=true
#Server
server.port=8080
server.servlet.context-path=/
#quant
quant.server.number=1
quant.server.sequencer.operator=TWEPOCH_PLUS
quant.server.sequencer.sequence-bits=8
#Database
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/employees?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=111111
spring.datasource.hikari.minimum-idle=1
spring.datasource.hikari.maximum-pool-size=3
spring.datasource.hikari.data-source-properties.cachePrepStmts=true
spring.datasource.hikari.data-source-properties.prepStmtCacheSize=250
spring.datasource.hikari.data-source-properties.prepStmtCacheSqlLimit=2048
spring.datasource.hikari.data-source-properties.useServerPrepStmts=true
#JPA
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.database=MYSQL
#Dubbo
dubbo.application.name=Application
dubbo.registry.address=zookeeper://172.17.15.101:3180?backup=172.17.15.102:3180,172.17.15.103:3180
dubbo.protocol.name=dubbo
dubbo.protocol.port=28080
TestDubboServiceFacade.version=1.0.0
TestDubboServiceFacade.timeout=30000
#Mybatis
#mybatis.mapper-locations=classpath:mapping/*.xml
#mybatis.type-aliases-package=cn.quant.baa.pay.mybatis
\ No newline at end of file
___ _ _ _
/ _ \(_) __ _ _ __ | |__ __ _ ___ / \ _ __ _ __
| | | | |/ _` | '_ \| '_ \ / _` |/ _ \ _____ / _ \ | '_ \| '_ \
| |_| | | (_| | | | | |_) | (_| | (_) |_____/ ___ \| |_) | |_) |
\__\_\_|\__,_|_| |_|_.__/ \__,_|\___/ /_/ \_\ .__/| .__/
|_| |_|
v${project.version}
\ No newline at end of file
# ===================================================================
# Spring Boot configuration.
#
# This configuration will be overriden by the Spring profile you use,
# for example application-dev.yml if you use the "dev" profile.
# ===================================================================
# ===================================================================
# Standard Spring Boot properties.
# Full reference is available at:
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# ==================================================================
server:
servlet:
session:
cookie:
http-only: true
tomcat:
max-http-header-size: 3145728
spring:
jackson:
serialization:
write_dates_as_timestamps: false
indent_output: true
datasource:
hikari:
minimum-idle: 1
maximum-pool-size: 3
data-source-properties:
cachePrepStmts: true
prepStmtCacheSize: 250
prepStmtCacheSqlLimit: 2048
useServerPrepStmts: true
jpa:
show-sql: true
hibernate:
ddl-auto: none
properties:
hibernate.cache.use_query_cache: false
hibernate.cache.use_second_level_cache: false
hibernate.cache.generate_statistics: false
dubbo:
scan: cn.quant.baa.pay.dubbo
thymeleaf:
cache: false
mode: HTML5
prefix: classpath:/templates/
suffix: .html
encoding: UTF-8
servlet:
content-type: text/html
resources:
add-mappings: true
static-locations: classpath:/static/
favicon:
enabled: false
mvc:
throw-exception-if-no-handler-found: true
view:
prefix: classpath:/view/
suffix: .jsp
static-path-pattern: /**
\ No newline at end of file
# ===================================================================
# Spring Boot configuration.
#
# This configuration will be overriden by the Spring profile you use,
# for example application-dev.yml if you use the "dev" profile.
# ===================================================================
# ===================================================================
# Standard Spring Boot properties.
# Full reference is available at:
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# ==================================================================
spring:
quartz:
jdbc:
initialize-schema: never
flyway:
enabled: false
batch:
initialize-schema: never
cloud:
task:
initialize:
enable: false
messages:
basename: i18n/messages
\ No newline at end of file
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.mariadb.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/employees</property>
<!-- JDBC connection pool (use the built-in) -->
<!--
<property name="connection.pool_size">1</property>
-->
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<mapping class="cn.quant.baa.pay.jpa.entity.UserEntity"/>
<!-- Drop and re-create the database schema on startup -->
<!--
<property name="hbm2ddl.auto">update</property>
-->
</session-factory>
</hibernate-configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>
<appender name="ROLLINGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logging.dir}/${project.name}/${project.name}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${logging.dir}/${project.name}/${project.name}.%d{yyyy-MM-dd}-%i.log</fileNamePattern>
<maxHistory>90</maxHistory>
<maxFileSize>512MB</maxFileSize>
<totalSizeCap>10GB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<charset>utf-8</charset>
<Pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}][%p][%t|%logger{1.}|%M|%X{ctime}] - %msg %ex{full}%n</Pattern>
</encoder>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg %ex{full}%n</pattern>
</encoder>
</appender>
<logger name="cn.quant.baa.pay" level="ERROR"/>
<logger name="javax.activation" level="ERROR"/>
<logger name="org.quartz.core" level="ERROR"/>
<logger name="org.quartz.simpl" level="ERROR"/>
<logger name="com.zaxxer.hikari.pool" level="ERROR"/>
<logger name="com.alibaba.dubbo.common.extension" level="ERROR"/>
<logger name="org.apache.zookeeper" level="ERROR"/>
<logger name="org.apache.curator" level="ERROR"/>
<logger name="org.apache.catalina.loader" level="ERROR"/>
<logger name="org.apache.catalina.util" level="ERROR"/>
<logger name="org.apache.catalina.core" level="ERROR"/>
<logger name="org.hibernate.hql" level="ERROR"/>
<logger name="org.hibernate.loader" level="ERROR"/>
<logger name="org.hibernate.type" level="ERROR"/>
<logger name="org.hibernate.persister" level="ERROR"/>
<logger name="org.hibernate.cfg" level="ERROR"/>
<logger name="org.hibernate.mapping" level="ERROR"/>
<logger name="org.hibernate.jpa.event" level="ERROR"/>
<logger name="org.hibernate.validator.internal" level="ERROR"/>
<logger name="org.hibernate.engine.internal" level="ERROR"/>
<logger name="org.hibernate.boot.model" level="ERROR"/>
<logger name="org.hibernate.boot.internal" level="ERROR"/>
<logger name="org.apache.tomcat.util" level="ERROR"/>
<logger name="org.springframework.orm" level="ERROR"/>
<logger name="org.springframework.jmx" level="ERROR"/>
<logger name="org.springframework.jndi" level="ERROR"/>
<logger name="org.springframework.aop" level="ERROR"/>
<logger name="org.springframework.web" level="ERROR"/>
<logger name="org.springframework.context" level="ERROR"/>
<logger name="org.springframework.core" level="ERROR"/>
<logger name="org.springframework.beans" level="ERROR"/>
<logger name="org.springframework.boot.web" level="ERROR"/>
<logger name="org.springframework.boot.actuate" level="ERROR"/>
<logger name="org.springframework.boot.context" level="ERROR"/>
<logger name="org.springframework.boot.autoconfigure.logging" level="ERROR"/>
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE"/>
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="ERROR"/>
<logger name="org.hibernate.engine.QueryParameters" level="ERROR"/>
<logger name="org.hibernate.SQL" level="ERROR" />
<root level="${logging.level}">
<appender-ref ref="STDOUT"/>
<appender-ref ref="ROLLINGFILE"/>
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!--这里的loacation是你连接数据库的jar包,可以从项目依赖里面找-->
<classPathEntry location="e:\repository\mysql\mysql-connector-java\5.1.46\mysql-connector-java-5.1.46.jar"/>
<context id="context">
<!-- 是否生成注释 -->
<commentGenerator>
<property name="suppressDate" value="true"/>
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!-- 数据库连接,数据库版本高的话需要添加时区serverTimezone=GMT%2B8 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1:3306/employees"
userId="root" password="111111" />
<!-- 生成的包名和工程名 -->
<javaModelGenerator targetPackage="cn.quant.baa.pay.jpa.entity.mysql"
targetProject="src/main/java/"/>
<!-- xml映射文件 -->
<sqlMapGenerator targetPackage="mapping"
targetProject="src/main/resources/" />
<!-- mapper接口 -->
<javaClientGenerator targetPackage="cn.quant.baa.pay.mybatis.mapper"
targetProject="src/main/java/" type="XMLMAPPER" />
<!-- 数据库表 以及是否生成example,可以同时生成多个-->
<table tableName="departments" domainObjectName="DepartmentsEntity"
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false" />
</context>
</generatorConfiguration>
\ No newline at end of file
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<context-param>
<param-name/>
<param-value/>
</context-param>
</web-app>
the template files.
\ No newline at end of file
the template files.
\ No newline at end of file
package cn.quant.baa.pay;
import cn.quant.spring.util.IdentitySequencer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* <p><b>JUnit VM Option:</b><br/>
* <code>-Dspring.config.file=${project.build.directory}/target/config/application-dev.properties </code><br/>
* </p>
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ServerApplication.class})
public class TestApplication {
@Autowired
private IdentitySequencer identitySequencer;
@Test
public void idWorker() {
System.out.println(identitySequencer.nextId());
System.currentTimeMillis();
return;
}
}
debug=true debug=true
#Spring #Spring
spring.profiles.active=dev spring.profiles.active=dev
spring.application.name=Application spring.application.name=baa-pay-server
#Devtool #Devtool
spring.devtools.restart.enabled=true spring.devtools.restart.enabled=true
spring.devtools.livereload.enabled=true spring.devtools.livereload.enabled=true
......
{
"info": {
"_postman_id": "9178d052-f509-431b-999f-17276a1c104d",
"name": "baa-pay",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "local",
"item": [
{
"name": "查询支付渠道列表-渠道",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"data\":{\n\t\t\"mch_id\":\"wxd678efh567hg6787\"\n\t\t,\"channel\":\"WXP\"\n\t\t,\"access\":\"JS\"\n\t}\n}"
},
"url": "{{domain}}/merchant/channel/list"
},
"response": []
},
{
"name": "支付下单",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"data\":{\n\t\t\"subject\":\"测试订单1\"\n\t\t,\"mch_id\":\"wxd678efh567hg6787\"\n\t\t,\"chan_id\":\"75772285618946306\"\n\t\t,\"out_trade_no\":\"1111111111111111111111114\"\n\t\t,\"original_amount\":\"110.00\"\n\t\t,\"discounts\":\"10.00\"\n\t\t,\"amount\":\"0.00\"\n\t\t,\"cash_amount\":\"100.00\"\n\t\t,\"credit_amount\":\"0.00\"\n\t\t,\"notify_url\":\"http://127.0.0.1:8080/notifyUrl\"\n\t\t,\"buyer_id\":\"000008\"\n\t\t,\"shop_name\":\"测试店铺\"\n\t\t,\"attach\":\"AAAA-BBBB-1111-2222\"\n\t\t,\"phone_no\":\"13718656985\"\n\t\t,\"address\":\"测试收货地址\"\n\t\t,\"goods_signer\":\"测试员\"\n\t\t,\"goods_detail\":[{\n\t\t\t\"goods_no\":\"111111\"\n\t\t\t,\"goods_name\":\"商品12\"\n\t\t\t,\"quantity\":\"1\"\n\t\t\t,\"price\":\"10.00\"\n\t\t\t,\"discounts\":\"2.5\"\n\t\t\t,\"amount\":\"17.5\"\n\t\t\t,\"attach\":\"---\"\n\t\t\t}]\n\t}\n}"
},
"url": "{{domain}}/transaction/pay"
},
"response": []
},
{
"name": "查询支付渠道列表-ID",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"data\":{\n\t\t\"chan_id\":\"75772285618946306\"\n\t}\n}"
},
"url": "{{domain}}/merchant/channel/one"
},
"response": []
}
]
}
]
}
\ No newline at end of file
...@@ -85,6 +85,7 @@ ...@@ -85,6 +85,7 @@
<module>baa-pay-server</module> <module>baa-pay-server</module>
<module>baa-pay-core</module> <module>baa-pay-core</module>
<module>baa-pay-api</module> <module>baa-pay-api</module>
<module>baa-pay-notice</module>
</modules> </modules>
<build> <build>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment