diff --git a/mallinkAdmin/src/main/java/com/iformall/UserApplication.java b/mallinkAdmin/src/main/java/com/iformall/UserApplication.java
index f1c776d8b..f72f27524 100644
--- a/mallinkAdmin/src/main/java/com/iformall/UserApplication.java
+++ b/mallinkAdmin/src/main/java/com/iformall/UserApplication.java
@@ -1,6 +1,7 @@
package com.iformall;
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
+import org.rocketmq.starter.annotation.EnableRocketMQ;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -18,6 +19,7 @@ import tk.mybatis.spring.annotation.MapperScan;
@EnableSwagger2
@EnableEncryptableProperties
@EnableAsync
+@EnableRocketMQ
public class UserApplication {
@Value("${fm.exception}")
diff --git a/mallinkAdmin/src/main/resources/application-dev.yml b/mallinkAdmin/src/main/resources/application-dev.yml
index 5c74d058d..6fafe799f 100644
--- a/mallinkAdmin/src/main/resources/application-dev.yml
+++ b/mallinkAdmin/src/main/resources/application-dev.yml
@@ -1,4 +1,6 @@
spring:
+ profiles:
+ include: rabbitMQ
# JDBC
datasource:
url: jdbc:mysql://202.165.179.86:3306/mallinkDev?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false
@@ -51,6 +53,23 @@ spring:
auth: true
starttls:
enable: true
+ rocketmq:
+ nameServer: 127.0.0.1:9876
+ producer:
+ retry-times-when-send-async-failed: 0
+ send-msg-timeout: 300000
+ compress-msg-body-over-howmuch: 4096
+ max-message-size: 4194304
+ retry-another-broker-when-not-store-ok: false
+ retry-times-when-send-failed: 2
+ rabbitmq:
+ host: 202.165.179.86
+ port: 5672
+ username: guest
+ password: guest
+ publisher-confirms: true
+ virtual-host: /
+
aws:
clientRegion: cn-northwest-1
bucketName: iformall-net
diff --git a/mallinkAdmin/src/main/resources/application-prod.yml b/mallinkAdmin/src/main/resources/application-prod.yml
index a7ff32371..4ae7eb723 100644
--- a/mallinkAdmin/src/main/resources/application-prod.yml
+++ b/mallinkAdmin/src/main/resources/application-prod.yml
@@ -1,4 +1,6 @@
spring:
+ profiles:
+ include: rocketMQ
# JDBC
datasource:
url: jdbc:mysql://formalldb.cfqyqflkdlit.rds.cn-northwest-1.amazonaws.com.cn:3306/mallink?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false
diff --git a/mallinkAdmin/src/main/resources/application-test.yml b/mallinkAdmin/src/main/resources/application-test.yml
index a04d8abe4..fe823f7fe 100644
--- a/mallinkAdmin/src/main/resources/application-test.yml
+++ b/mallinkAdmin/src/main/resources/application-test.yml
@@ -1,4 +1,6 @@
spring:
+ profiles:
+ include: rocketMQ
# JDBC
datasource:
url: jdbc:mysql://formalldb.cfqyqflkdlit.rds.cn-northwest-1.amazonaws.com.cn:3306/mallinkTest?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false
diff --git a/mallinkAdmin/src/main/resources/application.yml b/mallinkAdmin/src/main/resources/application.yml
index b7a2d6448..c67f34580 100644
--- a/mallinkAdmin/src/main/resources/application.yml
+++ b/mallinkAdmin/src/main/resources/application.yml
@@ -21,6 +21,23 @@ spring:
cache-names: redis_cache #缓存的名字(可以不指定)
redis:
time-to-live: 60000ms #很重要,缓存的有效时间,以便缓存的过期(单位为毫秒)
+ rocketmq:
+ nameServer: 202.165.179.86:9876
+ producer:
+ retry-times-when-send-async-failed: 0
+ send-msg-timeout: 300000
+ compress-msg-body-over-howmuch: 4096
+ max-message-size: 4194304
+ retry-another-broker-when-not-store-ok: false
+ retry-times-when-send-failed: 2
+ rabbitmq:
+ host: 202.165.179.86
+ port: 5672
+ username: guest
+ password: guest
+ publisher-confirms: true
+ virtual-host: /
+
# @{link} https://github.com/abel533
#Mybatis
diff --git a/mallinkBApi/src/main/java/com/iformall/BApplication.java b/mallinkBApi/src/main/java/com/iformall/BApplication.java
index ef3c776ba..0dabd6ccc 100644
--- a/mallinkBApi/src/main/java/com/iformall/BApplication.java
+++ b/mallinkBApi/src/main/java/com/iformall/BApplication.java
@@ -1,6 +1,7 @@
package com.iformall;
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
+import org.rocketmq.starter.annotation.EnableRocketMQ;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -14,6 +15,7 @@ import tk.mybatis.spring.annotation.MapperScan;
@SpringBootApplication
@MapperScan(basePackages = {"com.iformall.mapper"})
@EnableEncryptableProperties
+@EnableRocketMQ
public class BApplication {
@Value("${fm.exception}")
diff --git a/mallinkBApi/src/main/resources/application.yml b/mallinkBApi/src/main/resources/application.yml
index 0e4588f52..c54a63361 100644
--- a/mallinkBApi/src/main/resources/application.yml
+++ b/mallinkBApi/src/main/resources/application.yml
@@ -12,6 +12,15 @@ spring:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
+ rocketmq:
+ nameServer: 127.0.0.1:9876
+ producer:
+ retry-times-when-send-async-failed: 0
+ send-msg-timeout: 300000
+ compress-msg-body-over-howmuch: 4096
+ max-message-size: 4194304
+ retry-another-broker-when-not-store-ok: false
+ retry-times-when-send-failed: 2
# @{link} https://github.com/abel533
#Mybatis
diff --git a/mallinkCApi/src/main/java/com/iformall/CApplication.java b/mallinkCApi/src/main/java/com/iformall/CApplication.java
index eca6c85b2..d2717e841 100644
--- a/mallinkCApi/src/main/java/com/iformall/CApplication.java
+++ b/mallinkCApi/src/main/java/com/iformall/CApplication.java
@@ -1,6 +1,7 @@
package com.iformall;
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
+import org.rocketmq.starter.annotation.EnableRocketMQ;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -14,6 +15,7 @@ import tk.mybatis.spring.annotation.MapperScan;
@SpringBootApplication
@MapperScan(basePackages = {"com.iformall.mapper"})
@EnableEncryptableProperties
+@EnableRocketMQ
public class CApplication {
@Value("${fm.exception}")
diff --git a/mallinkCApi/src/main/resources/application.yml b/mallinkCApi/src/main/resources/application.yml
index bf31b2046..93efc61c0 100644
--- a/mallinkCApi/src/main/resources/application.yml
+++ b/mallinkCApi/src/main/resources/application.yml
@@ -12,6 +12,15 @@ spring:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
default-property-inclusion: non_null
+ rocketmq:
+ nameServer: 127.0.0.1:9876
+ producer:
+ retry-times-when-send-async-failed: 0
+ send-msg-timeout: 300000
+ compress-msg-body-over-howmuch: 4096
+ max-message-size: 4194304
+ retry-another-broker-when-not-store-ok: false
+ retry-times-when-send-failed: 2
# @{link} https://github.com/abel533
#Mybatis
diff --git a/mallinkMQConsumer/pom.xml b/mallinkMQConsumer/pom.xml
new file mode 100644
index 000000000..ba97fccf5
--- /dev/null
+++ b/mallinkMQConsumer/pom.xml
@@ -0,0 +1,35 @@
+
+
+ 4.0.0
+
+
+ mallink
+ com.iformall
+ 1.0
+
+
+ mallinkMQConsumer
+
+
+
+ com.iformall
+ mallinkService
+ 1.0
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ true
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mallinkMQConsumer/src/main/java/com/iformall/ConsumerApplication.java b/mallinkMQConsumer/src/main/java/com/iformall/ConsumerApplication.java
new file mode 100644
index 000000000..a341691ce
--- /dev/null
+++ b/mallinkMQConsumer/src/main/java/com/iformall/ConsumerApplication.java
@@ -0,0 +1,35 @@
+package com.iformall;
+
+import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
+import org.rocketmq.starter.annotation.EnableRocketMQ;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+import tk.mybatis.spring.annotation.MapperScan;
+
+/**
+ * @author chenkx
+ * @date 2017-12-26
+ */
+@SpringBootApplication
+@MapperScan(basePackages = {"com.iformall.mapper"})
+@EnableSwagger2
+@EnableRocketMQ
+@EnableEncryptableProperties
+public class ConsumerApplication {
+
+ @Value("${fm.exception}")
+ private boolean fmException;
+
+ @Bean
+ public boolean isFmException() {
+ return fmException;
+ }
+
+
+ public static void main(String[] args) {
+ SpringApplication.run(ConsumerApplication.class, args);
+ }
+}
diff --git a/mallinkMQConsumer/src/main/java/com/iformall/config/AwsProperty.java b/mallinkMQConsumer/src/main/java/com/iformall/config/AwsProperty.java
new file mode 100644
index 000000000..0329f1d6d
--- /dev/null
+++ b/mallinkMQConsumer/src/main/java/com/iformall/config/AwsProperty.java
@@ -0,0 +1,52 @@
+package com.iformall.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Stormeye
+ */
+@Component
+@ConfigurationProperties(prefix = "aws")
+public class AwsProperty {
+ // AWS ACCESS KEY
+ private String access;
+
+ private String secret;
+
+ private String clientRegion;
+
+ private String bucketName;
+
+ public String getAccess() {
+ return access;
+ }
+
+ public void setAccess(String access) {
+ this.access = access;
+ }
+
+ public String getSecret() {
+ return secret;
+ }
+
+ public void setSecret(String secret) {
+ this.secret = secret;
+ }
+
+ public String getClientRegion() {
+ return clientRegion;
+ }
+
+ public void setClientRegion(String clientRegion) {
+ this.clientRegion = clientRegion;
+ }
+
+ public String getBucketName() {
+ return bucketName;
+ }
+
+ public void setBucketName(String bucketName) {
+ this.bucketName = bucketName;
+ }
+}
diff --git a/mallinkMQConsumer/src/main/java/com/iformall/config/PayProperty.java b/mallinkMQConsumer/src/main/java/com/iformall/config/PayProperty.java
new file mode 100644
index 000000000..5cb7f4915
--- /dev/null
+++ b/mallinkMQConsumer/src/main/java/com/iformall/config/PayProperty.java
@@ -0,0 +1,24 @@
+package com.iformall.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Stormeye
+ */
+@Component
+@ConfigurationProperties(prefix = "pay")
+public class PayProperty {
+ /**
+ * 真实支付
+ */
+ private boolean real;
+
+ public boolean isReal() {
+ return real;
+ }
+
+ public void setReal(boolean real) {
+ this.real = real;
+ }
+}
diff --git a/mallinkMQConsumer/src/main/java/com/iformall/config/RedisConfig.java b/mallinkMQConsumer/src/main/java/com/iformall/config/RedisConfig.java
new file mode 100644
index 000000000..74c8be49d
--- /dev/null
+++ b/mallinkMQConsumer/src/main/java/com/iformall/config/RedisConfig.java
@@ -0,0 +1,111 @@
+package com.iformall.config;
+
+import com.iformall.domain.po.PushLimit;
+import com.iformall.domain.po.WxScoreRules;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cache.CacheManager;
+import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.cache.RedisCacheConfiguration;
+import org.springframework.data.redis.cache.RedisCacheManager;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+import java.time.Duration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created by Stormeye on 2018/10/1.
+ */
+@Configuration
+@EnableCaching
+public class RedisConfig extends CachingConfigurerSupport {
+
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ //缓存管理器
+ @Bean
+ public CacheManager cacheManager(RedisConnectionFactory connectionFactory) {
+ /*
+ //user信息缓存配置
+ RedisCacheConfiguration userCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofSeconds(10)).disableCachingNullValues().prefixKeysWith("user");
+ Map redisCacheConfigurationMap = new HashMap<>();
+ redisCacheConfigurationMap.put("user", userCacheConfiguration);
+ //初始化一个RedisCacheWriter
+ RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory);
+ // 设置CacheManager的值序列化方式为JdkSerializationRedisSerializer,但其实RedisCacheConfiguration默认就是使用StringRedisSerializer序列化key,JdkSerializationRedisSerializer序列化value,所以以下注释代码为默认实现
+ // ClassLoader loader = this.getClass().getClassLoader();
+ // JdkSerializationRedisSerializer jdkSerializer = new JdkSerializationRedisSerializer(loader);
+ // RedisSerializationContext.SerializationPair