Commit 548f0d13 authored by chenkai's avatar chenkai

V1.1.0

parent 60403eae
<?xml version="1.0" encoding="UTF-8"?> <?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" <project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<modelVersion>4.0.0</modelVersion> 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>
<groupId>cn.quantgroup</groupId> <groupId>cn.quantgroup</groupId>
<artifactId>fund-manage-sdk</artifactId> <artifactId>quantgroup-fundmanage-sdk</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>1.0.3-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>fund-manage-sdk</name> <name>sdk:fundmanage</name>
<description>fund-manage-sdk project for Spring Boot</description> <description>白条债转SDK</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.test.skip>true</maven.test.skip>
</properties>
<parent> <dependencies>
<groupId>org.springframework.boot</groupId> <dependency>
<artifactId>spring-boot-starter-parent</artifactId> <groupId>com.rabbitmq</groupId>
<version>1.2.7.RELEASE</version> <artifactId>amqp-client</artifactId>
<relativePath/> <!-- lookup parent from repository --> <version>3.6.2</version>
</parent> </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.4.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<configuration>
<aggregate>true</aggregate>
<locale>en_US</locale>
<show>private</show>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies> <profiles>
<dependency> <profile>
<groupId>com.alibaba</groupId> <id>product</id>
<artifactId>fastjson</artifactId> <properties>
<version>1.2.6</version> <profiles.activation>product</profiles.activation>
</dependency> </properties>
<dependency> <build>
<groupId>org.springframework.boot</groupId> <resources>
<artifactId>spring-boot-starter-jdbc</artifactId> <resource>
</dependency> <directory>
<dependency> ${project.basedir}/src/main/resources/config/release
<groupId>org.springframework.boot</groupId> </directory>
<artifactId>spring-boot-starter-aop</artifactId> </resource>
</dependency> </resources>
<dependency> </build>
<groupId>org.springframework.boot</groupId> </profile>
<artifactId>spring-boot-starter-data-jpa</artifactId> <profile>
</dependency> <id>dev</id>
<dependency> <properties>
<groupId>org.springframework.boot</groupId> <profiles.activation>dev</profiles.activation>
<artifactId>spring-boot-starter-data-rest</artifactId> </properties>
</dependency> <build>
<dependency> <resources>
<groupId>org.springframework.boot</groupId> <resource>
<artifactId>spring-boot-starter-integration</artifactId> <directory>
</dependency> ${project.basedir}/src/main/resources/config/dev
<dependency> </directory>
<groupId>org.springframework.boot</groupId> </resource>
<artifactId>spring-boot-starter-mail</artifactId> </resources>
</dependency> </build>
<dependency> </profile>
<groupId>org.springframework.boot</groupId> <profile>
<artifactId>spring-boot-starter-mobile</artifactId> <id>test</id>
</dependency> <properties>
<dependency> <profiles.activation>test</profiles.activation>
<groupId>org.springframework.boot</groupId> </properties>
<artifactId>spring-boot-starter-amqp</artifactId> <build>
</dependency> <resources>
<dependency> <resource>
<groupId>org.springframework.session</groupId> <directory>
<artifactId>spring-session</artifactId> ${project.basedir}/src/main/resources/config/test
<version>1.0.1.RELEASE</version> </directory>
</dependency> </resource>
<!-- <dependency> </resources>
<groupId>org.springframework.cloud</groupId> </build>
<artifactId>spring-cloud-starter-zookeeper-config</artifactId> </profile>
</dependency> <profile>
<dependency> <id>beta</id>
<groupId>org.springframework.cloud</groupId> <properties>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId> <profiles.activation>beta</profiles.activation>
</dependency>--> </properties>
<dependency> <build>
<groupId>org.springframework.boot</groupId> <resources>
<artifactId>spring-boot-starter-redis</artifactId> <resource>
</dependency> <directory>
<dependency> ${project.basedir}/src/main/resources/config/beta
<groupId>org.springframework.boot</groupId> </directory>
<artifactId>spring-boot-starter-web</artifactId> </resource>
</dependency> </resources>
<dependency> </build>
<groupId>mysql</groupId> </profile>
<artifactId>mysql-connector-java</artifactId> </profiles>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.10.Final</version>
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>4.3.10.Final</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.35</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.3.3</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>
<!-- hibernate end -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.5.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.5.3</version>
</dependency>
<dependency>
<groupId>ch.ethz.ganymed</groupId>
<artifactId>ganymed-ssh2</artifactId>
<version>262</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId>
<version>1.46</version>
</dependency>
<dependency>
<groupId>com.github.kstyrc</groupId>
<artifactId>embedded-redis</artifactId>
<version>0.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>3.6.2</version>
</dependency>
<dependency>
<groupId>com.octo.captcha</groupId>
<artifactId>jcaptcha</artifactId>
<version>1.0</version>
<exclusions>
<exclusion>
<groupId>com.jhlabs</groupId>
<artifactId>imaging</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>product</id>
<properties>
<profiles.activation>product</profiles.activation>
</properties>
<build>
<resources>
<resource>
<directory>
${project.basedir}/src/main/resources/config/release
</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>dev</id>
<properties>
<profiles.activation>dev</profiles.activation>
</properties>
<build>
<resources>
<resource>
<directory>
${project.basedir}/src/main/resources/config/dev
</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>test</id>
<properties>
<profiles.activation>test</profiles.activation>
</properties>
<build>
<resources>
<resource>
<directory>
${project.basedir}/src/main/resources/config/test
</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>beta</id>
<properties>
<profiles.activation>beta</profiles.activation>
</properties>
<build>
<resources>
<resource>
<directory>
${project.basedir}/src/main/resources/config/beta
</directory>
</resource>
</resources>
</build>
</profile>
</profiles>
</project> </project>
package cn.quantgroup;
import cn.quantgroup.fundmanage.Constants;
import org.apache.commons.cli.*;
import org.apache.commons.lang.StringUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.orm.jpa.EntityScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.*;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* Created by Rocky on 2016/8/31.
*/
@ComponentScan(basePackages = {"cn.quantgroup.fundmanage"})
@EntityScan(basePackages = {"cn.quantgroup.fundmanage.entity"})
@EnableAutoConfiguration
@EnableJpaRepositories(basePackages = {"cn.quantgroup.fundmanage.repository"})
@PropertySource({"classpath:application.properties", "classpath:fundmanage.properties"})
@EnableTransactionManagement
@EnableScheduling
@EnableAsync
@EnableAspectJAutoProxy
@Configuration
@SpringBootApplication
public class Bootstrap {
public static void parseOptions(String[] args) throws ParseException {
Options opt = new Options();
Option worker = new Option("w", "worker", true, "total workers");
worker.setRequired(true);
Option currentWorker = new Option("cw", "currentWorker", true, "current worker");
currentWorker.setRequired(true);
opt.addOption("h", "help", false, "--worker=totalWorkers --currentWorker=currentWorker")
.addOption(worker)
.addOption(currentWorker);
CommandLineParser parser = new DefaultParser();
CommandLine commandLine = parser.parse(opt, args, true);
if (!commandLine.hasOption("w") || !commandLine.hasOption("cw")) {
throw new ParseException("must with --worker and --currentWorker args specified");
}
String value = commandLine.getOptionValue("worker");
if (StringUtils.isNumeric(value) && StringUtils.isNotEmpty(value)) {
Constants.Concurrent.WORKERS = Long.valueOf(value);
} else {
throw new ParseException("--worker must be a number");
}
value = commandLine.getOptionValue("currentWorker");
if (StringUtils.isNumeric(value) && StringUtils.isNotEmpty(value)) {
Constants.Concurrent.CURRENT_WORKER = Long.valueOf(value);
} else {
throw new ParseException("--currentWoker must be a number");
}
}
public static void main(String[] args) throws ParseException {
// parseOptions(args);
SpringApplication.run(Bootstrap.class, args);
}
}
package cn.quantgroup.fundmanage;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.ConfirmListener;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.sun.deploy.util.StringUtils;
import org.apache.commons.pool2.impl.GenericObjectPool;
/**
* Created by Miraculous on 16/7/3.
*/
public class ChannelPool {
private GenericObjectPool<Channel> pool;
private Connection connection = null;
private void init(ConfirmListener confirmListener) {
try {
PropertyHolder propertyHolder = new PropertyHolder();
String rabbitHost = propertyHolder.getProperty("fundmanage.rabbitmq.host");
int rabbitPort = Integer.parseInt(propertyHolder.getProperty("fundmanage.rabbitmq.port"));
String user = propertyHolder.getProperty("fundmanage.rabbitmq.user");
String password = propertyHolder.getProperty("fundmanage.rabbitmq.password");
String vhost = propertyHolder.getProperty("fundmanage.rabbitmq.vhost");
ConnectionFactory factory = new ConnectionFactory();
factory.setUsername(user);
factory.setPassword(password);
factory.setVirtualHost(vhost);
factory.setHost(rabbitHost);
factory.setPort(rabbitPort);
factory.setAutomaticRecoveryEnabled(true);
factory.setConnectionTimeout(20000);
connection = factory.newConnection();
ChannelPoolFactory cf = new ChannelPoolFactory(connection, confirmListener);
pool = new GenericObjectPool<>(cf);
pool.setMaxTotal(100);
pool.setMaxWaitMillis(30000);
pool.setMaxIdle(8);
pool.setMinIdle(2);
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
private void init(ConfirmListener confirmListener,MQConfig mqConfig) {
try {
PropertyHolder propertyHolder = new PropertyHolder();
String rabbitHost = propertyHolder.getProperty("fundmanage.rabbitmq.host");
int rabbitPort = Integer.parseInt(propertyHolder.getProperty("fundmanage.rabbitmq.port"));
String user = propertyHolder.getProperty("fundmanage.rabbitmq.user");
String password = propertyHolder.getProperty("fundmanage.rabbitmq.password");
String vhost = propertyHolder.getProperty("fundmanage.rabbitmq.vhost");
if(mqConfig.getHost() != null || !"".equals(mqConfig.getHost().trim()) ){
rabbitHost = mqConfig.getHost();
}
if(mqConfig.getPort() < 0){
rabbitPort = mqConfig.getPort();
}
if(mqConfig.getUser() != null || !"".equals(mqConfig.getUser().trim()) ){
user = mqConfig.getUser();
}
if(mqConfig.getPassword() != null || !"".equals(mqConfig.getPassword().trim()) ){
password = mqConfig.getPassword();
}
if(mqConfig.getPassword() != null || !"".equals(mqConfig.getPassword().trim()) ){
password = mqConfig.getPassword();
}
ConnectionFactory factory = new ConnectionFactory();
factory.setUsername(user);
factory.setPassword(password);
factory.setVirtualHost(vhost);
factory.setHost(rabbitHost);
factory.setPort(rabbitPort);
factory.setAutomaticRecoveryEnabled(true);
factory.setConnectionTimeout(20000);
connection = factory.newConnection();
ChannelPoolFactory cf = new ChannelPoolFactory(connection, confirmListener);
pool = new GenericObjectPool<>(cf);
pool.setMaxTotal(100);
pool.setMaxWaitMillis(30000);
pool.setMaxIdle(8);
pool.setMinIdle(2);
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
protected ChannelPool(ConfirmListener confirmableMsgListener) {
init(confirmableMsgListener);
}
protected ChannelPool(ConfirmListener confirmableMsgListener,MQConfig mqConfig) {
init(confirmableMsgListener,mqConfig);
}
public Channel borrowObject() throws Exception {
return pool.borrowObject();
}
public void returnObject(Channel channel) throws Exception {
pool.returnObject(channel);
}
public void close() {
try {
// Pool
pool.close();
//rabbitmq connection
this.connection.close();
} catch (Exception e) {
// logger.error("error:", e);
}
}
}
package cn.quantgroup.fundmanage;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.ConfirmListener;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import org.apache.commons.pool2.BasePooledObjectFactory;
import org.apache.commons.pool2.PooledObject;
import org.apache.commons.pool2.impl.DefaultPooledObject;
/**
* Created by Miraculous on 16/7/3.
*/
public class ChannelPoolFactory extends BasePooledObjectFactory<Channel> {
private Connection connection;
private ConfirmListener confirmListener;
public ChannelPoolFactory(Connection c) {
this(c, null);
}
public ChannelPoolFactory(Connection c, ConfirmListener confirmListener) {
this.connection = c;
this.confirmListener = confirmListener;
}
@Override
public Channel create() throws Exception {
Channel channel = connection.createChannel();
if (this.confirmListener != null) {
channel.addConfirmListener(confirmListener);
}
return channel;
}
@Override
public PooledObject<Channel> wrap(Channel channel) {
return new DefaultPooledObject<>(channel);
}
@Override
public void passivateObject(PooledObject<Channel> p) throws Exception {
super.passivateObject(p);
}
@Override
public boolean validateObject(PooledObject<Channel> p) {
Channel channel = p.getObject();
return channel.isOpen();
}
@Override
public void destroyObject(PooledObject<Channel> p) throws Exception {
p.getObject().close();
}
}
package cn.quantgroup.fundmanage;
import java.util.List;
/**
* Created by Miraculous on 16/6/30.
*/
public class ConfirmableMsg {
private String uniqueId;
private String source;
private String merchantId;
private String phoneNo;
private String contentId;
private List<String> args;
private boolean isEmpty(String arg) {
return arg == null || "".equals(arg);
}
public boolean checkIntegrity() {
return !(isEmpty(merchantId) || isEmpty(phoneNo) ||
isEmpty(contentId) || isEmpty(uniqueId));
}
public ConfirmableMsg(String uniqueId, List<String> args, String contentId, String merchantId, String phoneNo) {
this.args = args;
this.contentId = contentId;
this.merchantId = merchantId;
this.phoneNo = phoneNo;
this.uniqueId = uniqueId;
}
public String getUniqueId() {
return uniqueId;
}
public void setUniqueId(String uniqueId) {
this.uniqueId = uniqueId;
}
public List<String> getArgs() {
return args;
}
public void setArgs(List<String> args) {
this.args = args;
}
public String getContentId() {
return contentId;
}
public void setContentId(String contentId) {
this.contentId = contentId;
}
public String getMerchantId() {
return merchantId;
}
public void setMerchantId(String merchantId) {
this.merchantId = merchantId;
}
public String getPhoneNo() {
return phoneNo;
}
public void setPhoneNo(String phoneNo) {
this.phoneNo = phoneNo;
}
public String getSource() {
return source;
}
protected void setSource(String source) {
this.source = source;
}
}
package cn.quantgroup.fundmanage;
/**
* 常量
*/
public interface Constants {
class Concurrent {
public static Long CURRENT_WORKER;
public static Long WORKERS;
}
}
package cn.quantgroup.fundmanage;
/**
* Created by Rocky on 2016/9/7.
*/
public class MQConfig {
private String host;
private int port;
private String user;
private String password;
private String exchange;
private String vhost;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getVhost() {
return vhost;
}
public void setVhost(String vhost) {
this.vhost = vhost;
}
public String getExchange() {
return exchange;
}
public void setExchange(String exchange) {
this.exchange = exchange;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
}
package cn.quantgroup.fundmanage;
import com.google.gson.Gson;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.ConfirmListener;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Collections;
import java.util.Enumeration;
/**
* Created by Miraculous on 16/6/30.
*/
public class MQSender {
private ChannelPool channelPool;
private String exchangeName;
private static final Gson GSON = new Gson();
private String source;
private static final AMQP.BasicProperties PROPERTIES = new AMQP.BasicProperties.Builder().
contentType("text/plain").contentEncoding("utf8").
deliveryMode(1).expiration("240000").build();
public MQSender() {
this(null);
}
public MQSender(String host,int port,String user,String password,String exchange,String vhost) {
this(null, host, port, user, password, exchange, vhost);
}
public MQSender(ConfirmListener confirmListener,String host,int port,String user,String password,String exchange,String vhost) {
PropertyHolder propertyHolder = new PropertyHolder();
exchangeName = propertyHolder.getProperty("fundmanage.rabbitmq.exchange-name");
MQConfig config = new MQConfig();
config.setHost(host);
config.setPort(port);
config.setUser(user);
config.setPassword(password);
config.setExchange(exchange);
config.setVhost(vhost);
channelPool = new ChannelPool(confirmListener,config);
boolean needBreak = false;
try {
Enumeration<NetworkInterface> enumeration = NetworkInterface.getNetworkInterfaces();
while (enumeration.hasMoreElements()) {
NetworkInterface networkInterface = enumeration.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
for (InetAddress inetAddress : Collections.list(inetAddresses)) {
if (inetAddress.isSiteLocalAddress() && inetAddress.getHostAddress() != null && !inetAddress.getHostAddress().startsWith("127")) {
this.source = inetAddress.getHostAddress();
needBreak = true;
break;
}
}
if (needBreak) {
break;
}
}
} catch (SocketException e) {
this.source = "unknown source";
}
if (null == source) {
source = "unknown source";
}
}
public MQSender(ConfirmListener confirmListener) {
PropertyHolder propertyHolder = new PropertyHolder();
exchangeName = propertyHolder.getProperty("fundmanage.rabbitmq.exchange-name");
channelPool = new ChannelPool(confirmListener);
boolean needBreak = false;
try {
Enumeration<NetworkInterface> enumeration = NetworkInterface.getNetworkInterfaces();
while (enumeration.hasMoreElements()) {
NetworkInterface networkInterface = enumeration.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
for (InetAddress inetAddress : Collections.list(inetAddresses)) {
if (inetAddress.isSiteLocalAddress() && inetAddress.getHostAddress() != null && !inetAddress.getHostAddress().startsWith("127")) {
this.source = inetAddress.getHostAddress();
needBreak = true;
break;
}
}
if (needBreak) {
break;
}
}
} catch (SocketException e) {
this.source = "unknown source";
}
if (null == source) {
source = "unknown source";
}
}
public void sendAndForget(SendAndForgetMsg message) throws Exception {
if (message == null || !message.checkIntegrity()) {
return;
}
message.setSource(source);
String messageStr = GSON.toJson(message);
Channel channel = null;
try {
channel = channelPool.borrowObject();
channel.basicPublish(exchangeName, "send", false, false,
PROPERTIES, messageStr.getBytes("utf8"));
} finally {
if (channel != null) {
channelPool.returnObject(channel);
}
}
}
public void sendConfirmableMessage(ConfirmableMsg message) throws Exception {
if (message == null || !message.checkIntegrity()) {
return;
}
message.setSource(source);
String messageStr = GSON.toJson(message);
Channel channel = null;
try {
channel = channelPool.borrowObject();
channel.basicPublish(exchangeName, "confirmable", false, false,
PROPERTIES, messageStr.getBytes("utf8"));
} finally {
if (channel != null) {
channelPool.returnObject(channel);
}
}
}
public void confirmSmsResult(String merchantId, String uniqueId) throws Exception {
String message = "{\"merchantId\":\"" + merchantId +
"\",\"uniqueId\":\"" + uniqueId + "\"}";
Channel channel = null;
try {
channel = channelPool.borrowObject();
channel.basicPublish(exchangeName, "confirm", false, false,
PROPERTIES, message.getBytes("utf8"));
} finally {
if (channel != null) {
channelPool.returnObject(channel);
}
}
}
}
package cn.quantgroup.fundmanage;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* Created by Miraculous on 16/6/30.
*/
class PropertyHolder {
private Properties properties = new Properties();
public PropertyHolder() {
InputStream stream = null;
try {
stream = PropertyHolder.class.getResourceAsStream("/config.properties");
properties.load(stream);
} catch (IOException e) {
System.out.println("sms can not init, reason: " + e.getMessage());
System.exit(-1);
} finally {
if (null != stream) {
try {
stream.close();
} catch (IOException e) {
// ignore
}
}
}
}
public String getProperty(String propertyName) {
if (!properties.containsKey(propertyName)) {
System.out.println("can not find property with name in sms sdk: " + propertyName);
System.exit(-1);
}
return properties.getProperty(propertyName);
}
}
package cn.quantgroup.fundmanage;
import java.util.List;
/**
* Created by Miraculous on 16/6/30.
*/
public class SendAndForgetMsg {
private String source;
private String merchantId;
private String phoneNo;
private String contentId;
private List<String> args;
private boolean isEmpty(String arg) {
return arg == null || "".equals(arg);
}
public boolean checkIntegrity() {
return !(isEmpty(merchantId) || isEmpty(phoneNo) ||
isEmpty(contentId));
}
public SendAndForgetMsg(List<String> args, String contentId, String merchantId, String phoneNo) {
this.args = args;
this.contentId = contentId;
this.merchantId = merchantId;
this.phoneNo = phoneNo;
}
public List<String> getArgs() {
return args;
}
public void setArgs(List<String> args) {
this.args = args;
}
public String getContentId() {
return contentId;
}
public void setContentId(String contentId) {
this.contentId = contentId;
}
public String getMerchantId() {
return merchantId;
}
public void setMerchantId(String merchantId) {
this.merchantId = merchantId;
}
public String getPhoneNo() {
return phoneNo;
}
public void setPhoneNo(String phoneNo) {
this.phoneNo = phoneNo;
}
public String getSource() {
return source;
}
protected void setSource(String source) {
this.source = source;
}
}
package cn.quantgroup.fundmanage.config.message;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import java.util.UUID;
/**
* Created by evan on 16/9/5.
*/
@Component
public class RabbitMqSend implements RabbitTemplate.ConfirmCallback {
private static final Logger LOGGER = LoggerFactory.getLogger(RabbitMqSend.class);
@Autowired
@Qualifier("rabbitTemplate")
private RabbitTemplate rabbitTemplate;
private static final ObjectMapper MAPPER = new ObjectMapper();
/**
* 构造方法注入
*/
@Autowired
public RabbitMqSend(RabbitTemplate rabbitTemplate) {
this.rabbitTemplate = rabbitTemplate;
rabbitTemplate.setConfirmCallback(this);
}
@Override
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
LOGGER.info(" 回调id:" + correlationData);
if (ack) {
LOGGER.info("消息成功消费");
} else {
LOGGER.info("消息消费失败:" + cause);
}
}
public void sendMsg(String content) {
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
String obj = null;
try {
obj = MAPPER.writeValueAsString(content);
} catch (JsonProcessingException e) {
throw new RuntimeException("序列化json失败");
}
rabbitTemplate.convertAndSend(obj, correlationId);
}
}
package cn.quantgroup.fundmanage.config.rabbitmq;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Created by Rocky on 2016/9/5.
*/
@Configuration
public class RabbitMqConfig {
@Value("${baitiaodebt.rabbitmq.queue.quanarorder}")
private String qunarBTQueue;
@Value("${baitiaodebt.rabbitmq.exchange.quanarorder}")
private String baitiaodebtExchange;
@Value("${rabbitmq.connection.host}")
private String host;
@Value("${rabbitmq.connection.port}")
private Integer port;
@Value("${rabbitmq.connection.user}")
private String user;
@Value("${rabbitmq.connection.password}")
private String password;
@Value("${rabbitmq.connection.virtual-host}")
private String virtualHost;
@Bean
public CachingConnectionFactory cachingConnectionFactory() {
CachingConnectionFactory connectionFactory = new CachingConnectionFactory(host, port);
connectionFactory.setChannelCacheSize(1024);
connectionFactory.setCacheMode(CachingConnectionFactory.CacheMode.CONNECTION);
connectionFactory.setChannelCacheSize(180 * 1000);
connectionFactory.setConnectionCacheSize(1024);
connectionFactory.setUsername(user);
connectionFactory.setPassword(password);
connectionFactory.setVirtualHost(virtualHost);
connectionFactory.setPublisherReturns(false);
connectionFactory.setPublisherConfirms(false);
return connectionFactory;
}
@Bean
public RabbitAdmin rabbitAdmin(CachingConnectionFactory cachingConnectionFactory) {
return new RabbitAdmin(cachingConnectionFactory);
}
@Bean
public DirectExchange directExchange() {
return new DirectExchange(baitiaodebtExchange, true, false);
}
@Bean(name = "rabbitTemplate")
public RabbitTemplate qunarBTRabbitTemplate(CachingConnectionFactory cachingConnectionFactory) {
RabbitTemplate template = new RabbitTemplate(cachingConnectionFactory);
template.setExchange(baitiaodebtExchange);
return template;
}
@Bean(name = "qunarBTQueue")
public Queue qunarBTQueue() { //还款的queue
return new Queue(qunarBTQueue);
}
@Bean(name = "qunarBTQueueBinding")
public Binding bindingQunarBT(RabbitAdmin rabbitAdmin, @Qualifier("qunarBTQueue")Queue qunarBTQueue, DirectExchange directExchange) {
Binding binding = BindingBuilder.bind(qunarBTQueue).to(directExchange).with(qunarBTQueue.getName());
rabbitAdmin.declareBinding(binding);
return binding;
}
}
package cn.quantgroup.fundmanage.model;
/**
* Created by Rocky on 2016/9/6.
*/
public enum BaiTiaoType {
QUNAR_BNAITIAO,
BAITIAO,
LINE_BAITIAO
}
package cn.quantgroup.fundmanage.model;
import java.io.Serializable;
/**
* Created by Miraculous on 15/7/5.
*/
public class JsonResult implements Serializable {
private static final Long SUCCESS_CODE = 0L;
private static final Long ERROR_STATE_CODE = 1L;
private static final Long SUCCESS_BUSSINESS_CODE = 0L;
private static final Long ERROR_BUSSINESS_CODE = 1L;
private static final long serialVersionUID = -1L;
private static final String ZERO_FILL_TEMPLATE = "%04d";
private String msg = "";
// 0成功,1失败
private String code = "0000";
// 业务错误码
private String businessCode = "0000";
private Object data = null;
public JsonResult() {
}
/**
* @param msg
* @param code
* @param data
*/
public JsonResult(String msg, Long code, Object data) {
this.msg = msg;
this.code = String.format(ZERO_FILL_TEMPLATE, code);
this.data = data;
}
public JsonResult(String msg, Long code, Object data, Long businessCode) {
this.msg = msg;
this.code = String.format(ZERO_FILL_TEMPLATE, code);
this.data = data;
this.businessCode = String.format(ZERO_FILL_TEMPLATE, businessCode);
}
/**
* 构造成功的JsonResult
*
* @param msg String
* @param data Object
* @return JsonResult
*/
public static JsonResult buildSuccessResult(String msg, Object data) {
return new JsonResult(msg, SUCCESS_CODE, data, SUCCESS_BUSSINESS_CODE);
}
public static JsonResult buildSuccessResult(String msg, Object data, Long bussinessId) {
return new JsonResult(msg, SUCCESS_CODE, data, bussinessId);
}
/**
* 构造状态不正确的JsonResult
*
* @param msg String
* @param data Object
* @return JsonResult
*/
public static JsonResult buildErrorStateResult(String msg, Object data) {
return new JsonResult(msg, SUCCESS_CODE, data, ERROR_BUSSINESS_CODE);
}
public static JsonResult buildErrorStateResult(String msg, Object data, Long busniessId) {
return new JsonResult(msg, SUCCESS_CODE, data, busniessId);
}
public static JsonResult buildFatalErrorStateResult(String msg, Object data, Long busniessId) {
return new JsonResult(msg, ERROR_STATE_CODE, data, busniessId);
}
public JsonResult(Object data) {
this.data = data;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getBusinessCode() {
return businessCode;
}
public void setBusinessCode(String businessCode) {
this.businessCode = businessCode;
}
@Override
public String toString() {
return "JsonResult{" +
"businessCode='" + businessCode + '\'' +
", code='" + code + '\'' +
", data=" + data +
'}';
}
public boolean isSuccess() {
return "0000".equals(code) && "0000".equals(businessCode);
}
}
package cn.quantgroup.fundmanage.model;
import lombok.Getter;
import lombok.Setter;
import java.sql.Timestamp;
import java.util.List;
/**
* Created by Rocky on 2016/9/5.
*/
@Setter
@Getter
public class LoanOrder {
private Long loanId;
private Long userId;
private String phoneNo;
private Long businessType;
private Double totalAmount;
private Long termNo;
private Long merchantId;
private String goodsInfo;
private List<RepaymentPlan> repaymentPlans;
@Setter
@Getter
public static class RepaymentPlan{
private Long repaymentId;
private Long loanOrderId;
private Long userId;
private Double amount;
private Timestamp deadLine;
}
}
package cn.quantgroup.fundmanage.model;
import lombok.Getter;
import lombok.Setter;
/**
* Created by Rocky on 2016/9/6.
*/
@Setter
@Getter
public class LoanOrderParam {
private LoanOrder oldLoanOrder;
private LoanOrder newLoanOrder;
}
package cn.quantgroup.fundmanage.service.rabbitmq;
import cn.quantgroup.fundmanage.model.BaiTiaoType;
import cn.quantgroup.fundmanage.model.JsonResult;
/**
* Created by Rocky on 2016/9/6.
*/
public interface IRabbitMQ {
JsonResult send(String content,BaiTiaoType type);
}
package cn.quantgroup.fundmanage.service.rabbitmq.impl;
import cn.quantgroup.fundmanage.model.BaiTiaoType;
import cn.quantgroup.fundmanage.model.JsonResult;
import cn.quantgroup.fundmanage.service.rabbitmq.IRabbitMQ;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
/**
* Created by Rocky on 2016/9/6.
*/
@Service
public class RabbitMQImpl implements IRabbitMQ{
private static final Logger LOGGER = LoggerFactory.getLogger(RabbitMQImpl.class);
@Autowired
@Qualifier("rabbitTemplate")
private RabbitTemplate rabbitTemplate;
@Autowired
@Qualifier("qunarBTQueue")
private Queue qunarBTQueue;
private String queueName ;
public JsonResult send(String content,BaiTiaoType type){
queueName= qunarBTQueue.getName();
if(type == BaiTiaoType.QUNAR_BNAITIAO){
queueName= qunarBTQueue.getName();
}
// other baitiao channel-- begin
// other baitiao channel-- end
try{
rabbitTemplate.convertAndSend(queueName, content);
}catch (Exception e){
LOGGER.error(e.getMessage(),e);
return JsonResult.buildErrorStateResult(e.getMessage(),e);
}
return JsonResult.buildSuccessResult("success",null);
}
}
spring.datasource.url=jdbc:mysql://192.168.192.206:3306/fund_manage?useUnicode=true&characterEncoding=UTF8
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.xa.data-source-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
spring.datasource.xa.properties.pinGlobalTxToPhysicalConnection=true
spring.datasource.xa.properties.autoReconnect=true
spring.data.jpa.repositories.enabled=true
spring.jpa.show-sql=true
spring.datasource.maximum-pool-size=100
server.port=8000
server.session-timeout=5184000
security.sessions=never
spring.aop.proxy-target-class=true
multipart.max-file-size=30Mb
multipart.max-request-size=30Mb
spring.datasource.test-while-idle=true
spring.datasource.time-between-eviction-runs-millis=3600000
spring.datasource.validation-query=SELECT 1
fundmanage.rabbitmq.host=192.168.192.153
fundmanage.rabbitmq.port=5672
fundmanage.rabbitmq.user=rabbitadmin
fundmanage.rabbitmq.password=123456
fundmanage.rabbitmq.exchange-name=baitiaodebt_orderinfo
fundmanage.rabbitmq.vhost=baitiao_debt
# rabbitmq
baitiaodebt.rabbitmq.queue.quanarorder=qunar_baitiaodebt
baitiaodebt.rabbitmq.exchange.quanarorder=baitiaodebt_orderinfo
rabbitmq.connection.host=192.168.192.153
rabbitmq.connection.port=5672
rabbitmq.connection.user=rabbitadmin
rabbitmq.connection.password=123456
rabbitmq.connection.virtual-host=baitiao_debt
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d{ISO8601} [%thread] [%-5level] %logger - %msg%n</pattern>
</layout>
</appender>
<!-- <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/home/quant_group/logs/di_ting.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/home/quant_group/logs/fund_manage_sdk.log.%d{yyyy-MM-dd}.bak</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{ISO8601} [%thread] [%-5level] %logger - %msg%n</Pattern>
</layout>
</appender>-->
<logger name="com.atomikos" level="warn"/>
<logger name="org.springframework" level="warn"/>
<logger name="org.hibernate" level="warn"/>
<logger name="org.apache" level="warn"/>
<logger name="ch.qos.logback" level="warn"/>
<root level="INFO">
<appender-ref ref="STDOUT"/>
<!-- <appender-ref ref="FILE"/>-->
</root>
</configuration>
\ No newline at end of file
spring.datasource.url=jdbc:mysql://192.168.192.206:3306/fund_manage?useUnicode=true&characterEncoding=UTF8
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.xa.data-source-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
spring.datasource.xa.properties.pinGlobalTxToPhysicalConnection=true
spring.datasource.xa.properties.autoReconnect=true
spring.data.jpa.repositories.enabled=true
spring.jpa.show-sql=true
spring.datasource.maximum-pool-size=100
server.port=8000
server.session-timeout=5184000
security.sessions=never
spring.aop.proxy-target-class=true
multipart.max-file-size=30Mb
multipart.max-request-size=30Mb
spring.datasource.test-while-idle=true
spring.datasource.time-between-eviction-runs-millis=3600000
spring.datasource.validation-query=SELECT 1
fundmanage.rabbitmq.host=192.168.192.243
fundmanage.rabbitmq.port=5672
fundmanage.rabbitmq.user=rabbit_admin
fundmanage.rabbitmq.password=abc1234
fundmanage.rabbitmq.exchange-name=fundmanage
fundmanage.rabbitmq.vhost=fundmanage
\ No newline at end of file
# rabbitmq
fundmanage.rabbitmq.queue.waiting=waiting_generate
fundmanage.rabbitmq.queue.success=generate_success
fundmanage.rabbitmq.exchange=contract
rabbitmq.connection.host=192.168.192.243
rabbitmq.connection.port=5672
rabbitmq.connection.user=rabbit_admin
rabbitmq.connection.password=abc1234
rabbitmq.connection.virtual-host=/black_hole
rabbitmq.connection.virtual-host.financial=financial_system
rabbitmq.connection.queue.baitiaoOrder=baitiaoOrder
rabbitmq.financial.exchange=fs
fundmanage.stopkey=test
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<!-- 文件输出日志 (文件大小策略进行文件输出,超过指定大小对文件备份)-->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/home/quant_group/logs/fund_manage.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/home/quant_group/logs/fund_manage.log.%d{yyyy-MM-dd}.bak</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{ISO8601} [%thread] [%-5level] %logger - %msg%n</Pattern>
</layout>
</appender>
<!--这里指定logger name 是为jmx设置日志级别做铺垫 -->
<!--<logger name="root">
<level value="INFO" />
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</logger>-->
<logger name="com.atomikos" level="warn"/>
<logger name="org.springframework" level="warn"/>
<logger name="org.hibernate" level="warn"/>
<logger name="org.apache" level="warn"/>
<logger name="ch.qos.logback" level="warn"/>
<root level="info">
<appender-ref ref="FILE"/>
</root>
</configuration>
\ No newline at end of file
spring.datasource.url=jdbc:mysql://192.168.192.206:3306/fund_manage?useUnicode=true&characterEncoding=UTF8
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.xa.data-source-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
spring.datasource.xa.properties.pinGlobalTxToPhysicalConnection=true
spring.datasource.xa.properties.autoReconnect=true
spring.data.jpa.repositories.enabled=true
spring.jpa.show-sql=true
spring.datasource.maximum-pool-size=100
server.port=8000
server.session-timeout=5184000
security.sessions=never
spring.aop.proxy-target-class=true
multipart.max-file-size=30Mb
multipart.max-request-size=30Mb
spring.datasource.test-while-idle=true
spring.datasource.time-between-eviction-runs-millis=3600000
spring.datasource.validation-query=SELECT 1
fundmanage.rabbitmq.host=192.168.192.243
fundmanage.rabbitmq.port=5672
fundmanage.rabbitmq.user=rabbit_admin
fundmanage.rabbitmq.password=abc1234
fundmanage.rabbitmq.exchange-name=sms-control
fundmanage.rabbitmq.vhost=sms
\ No newline at end of file
# rabbitmq
fundmanage.rabbitmq.queue.waiting=waiting_generate
fundmanage.rabbitmq.queue.success=generate_success
fundmanage.rabbitmq.exchange=contract
rabbitmq.connection.host=192.168.192.243
rabbitmq.connection.port=5672
rabbitmq.connection.user=rabbit_admin
rabbitmq.connection.password=abc1234
rabbitmq.connection.virtual-host=/black_hole
rabbitmq.connection.virtual-host.financial=financial_system
rabbitmq.connection.queue.baitiaoOrder=baitiaoOrder
rabbitmq.financial.exchange=fs
fundmanage.stopkey=test
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<!-- 文件输出日志 (文件大小策略进行文件输出,超过指定大小对文件备份)-->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/home/quant_group/logs/fund_manage.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/home/quant_group/logs/fund_manage.log.%d{yyyy-MM-dd}.bak</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{ISO8601} [%thread] [%-5level] %logger - %msg%n</Pattern>
</layout>
</appender>
<!--这里指定logger name 是为jmx设置日志级别做铺垫 -->
<!--<logger name="root">
<level value="INFO" />
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</logger>-->
<logger name="com.atomikos" level="warn"/>
<logger name="org.springframework" level="warn"/>
<logger name="org.hibernate" level="warn"/>
<logger name="org.apache" level="warn"/>
<logger name="ch.qos.logback" level="warn"/>
<root level="info">
<appender-ref ref="FILE"/>
</root>
</configuration>
\ No newline at end of file
spring.datasource.url=jdbc:mysql://192.168.192.206:3306/fund_manage?useUnicode=true&characterEncoding=UTF8
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.xa.data-source-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
spring.datasource.xa.properties.pinGlobalTxToPhysicalConnection=true
spring.datasource.xa.properties.autoReconnect=true
spring.data.jpa.repositories.enabled=true
spring.jpa.show-sql=true
spring.datasource.maximum-pool-size=100
server.port=8000
server.session-timeout=5184000
security.sessions=never
spring.aop.proxy-target-class=true
multipart.max-file-size=30Mb
multipart.max-request-size=30Mb
spring.datasource.test-while-idle=true
spring.datasource.time-between-eviction-runs-millis=3600000
spring.datasource.validation-query=SELECT 1
fundmanage.rabbitmq.host=192.168.192.243
fundmanage.rabbitmq.port=5672
fundmanage.rabbitmq.user=rabbit_admin
fundmanage.rabbitmq.password=abc1234
fundmanage.rabbitmq.exchange-name=sms-control
fundmanage.rabbitmq.vhost=sms
\ No newline at end of file
# rabbitmq
fundmanage.rabbitmq.queue.waiting=waiting_generate
fundmanage.rabbitmq.queue.success=generate_success
fundmanage.rabbitmq.exchange=contract
rabbitmq.connection.host=192.168.192.243
rabbitmq.connection.port=5672
rabbitmq.connection.user=rabbit_admin
rabbitmq.connection.password=abc1234
rabbitmq.connection.virtual-host=/black_hole
rabbitmq.connection.virtual-host.financial=financial_system
rabbitmq.connection.queue.baitiaoOrder=baitiaoOrder
rabbitmq.financial.exchange=fs
fundmanage.stopkey=test
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d{ISO8601} [%thread] [%-5level] %logger - %msg%n</pattern>
</layout>
</appender>
<!-- <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/home/quant_group/logs/di_ting.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/home/quant_group/logs/di_ting.log.%d{yyyy-MM-dd}.bak</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{ISO8601} [%thread] [%-5level] %logger - %msg%n</Pattern>
</layout>
</appender>-->
<logger name="com.atomikos" level="warn"/>
<logger name="org.springframework" level="warn"/>
<logger name="org.hibernate" level="warn"/>
<logger name="org.apache" level="warn"/>
<logger name="ch.qos.logback" level="warn"/>
<root level="INFO">
<appender-ref ref="STDOUT"/>
<!-- <appender-ref ref="FILE"/>-->
</root>
</configuration>
\ No newline at end of file
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