Browse Source

20201218VMQ广播推送

recovery
zy_Java 5 years ago
parent
commit
1e502a2fee
  1. 33
      game/src/main/java/com/ccsens/game/service/ScreenService.java
  2. 44
      game/src/main/resources/application-prodapi.yml
  3. 2
      game/src/main/resources/application.yml
  4. 33
      game/src/main/resources/druid-prodapi.yml
  5. 44
      tall/src/main/resources/application-prodapi.yml
  6. 4
      tall/src/main/resources/application.yml
  7. 33
      tall/src/main/resources/druid-prodapi.yml
  8. 2
      tall/src/main/resources/logback-spring.xml
  9. 20
      util/src/main/java/com/ccsens/util/config/RabbitMQConfig.java
  10. 2
      wisdomcar/src/main/java/com/ccsens/wisdomcar/config/SpringConfig.java
  11. 7
      wisdomcar/src/main/java/com/ccsens/wisdomcar/rabbitMQ/RabbitController.java
  12. 1
      wisdomcar/src/main/resources/application-dev.yml
  13. 4
      wisdomcar/src/main/resources/application.yml

33
game/src/main/java/com/ccsens/game/service/ScreenService.java

@ -167,7 +167,6 @@ public class ScreenService implements IScreenService {
//添加配置信息
saveGameRecord(wpsFilePath,gameRecord);
}
//如果是分组游戏
log.info("添加游戏记录:{}",gameRecord);
//配置表不存在,而且游戏类型默认为分组游戏,默认添加两个分组
@ -1283,13 +1282,13 @@ public class ScreenService implements IScreenService {
visitWpsUrl.setBusinessType(businessType);
visitWpsUrl.setUserId(params.getUserId());
String result = RestTemplateUtil.postBody(PropUtil.gatewayUrl + PropUtil.queryVisitUrls, visitWpsUrl);
log.info("调用tall查看游戏已有配置表:{}",result);
if(StrUtil.isNotEmpty(result)){
List<String> list = JSONUtil.toList(JSONUtil.parseArray(result), String.class);
wpsPath.addAll(list);
}
// wpsPath = tallFeignClient.queryVisitUrls(visitWpsUrl);
// String result = RestTemplateUtil.postBody(PropUtil.gatewayUrl + PropUtil.queryVisitUrls, visitWpsUrl);
// log.info("调用tall查看游戏已有配置表:{}",result);
// if(StrUtil.isNotEmpty(result)){
// List<String> list = JSONUtil.toList(JSONUtil.parseArray(result), String.class);
// wpsPath.addAll(list);
// }
wpsPath = tallFeignClient.queryVisitUrls(visitWpsUrl);
log.info("是否已有创建的游戏配置:{}",wpsPath);
//有配置直接返回
if (CollectionUtil.isNotEmpty(wpsPath)) {
@ -1334,15 +1333,15 @@ public class ScreenService implements IScreenService {
business.setFileSize(tmpFile.length());
business.setOperation(WebConstant.Wps.USER_OPERATION_NEW);
business.setPrivilege(WebConstant.Wps.PROJECT_PRIVILEGE_WRITE);
RestTemplateUtil.postBody(PropUtil.gatewayUrl + PropUtil.saveWpsFile, business);
// tallFeignClient.saveWpsFile(business);
String result1 = RestTemplateUtil.postBody(PropUtil.gatewayUrl + PropUtil.queryVisitUrls, visitWpsUrl);
log.info("调用tall查看游戏已有配置表:{}",result1);
if(StrUtil.isNotEmpty(result1)){
List<String> list = JSONUtil.toList(JSONUtil.parseArray(result1), String.class);
wpsPath.addAll(list);
}
// wpsPath = tallFeignClient.queryVisitUrls(visitWpsUrl);
// RestTemplateUtil.postBody(PropUtil.gatewayUrl + PropUtil.saveWpsFile, business);
tallFeignClient.saveWpsFile(business);
// String result1 = RestTemplateUtil.postBody(PropUtil.gatewayUrl + PropUtil.queryVisitUrls, visitWpsUrl);
// log.info("调用tall查看游戏已有配置表:{}",result1);
// if(StrUtil.isNotEmpty(result1)){
// List<String> list = JSONUtil.toList(JSONUtil.parseArray(result1), String.class);
// wpsPath.addAll(list);
// }
wpsPath = tallFeignClient.queryVisitUrls(visitWpsUrl);
return wpsPath;
}

44
game/src/main/resources/application-prodapi.yml

@ -0,0 +1,44 @@
server:
port: 7050
servlet:
context-path:
spring:
snowflake:
datacenterId: 3
workerId: 3
application:
name: game
datasource:
type: com.alibaba.druid.pool.DruidDataSource
rabbitmq:
host: www.tall.wiki
password: 111111
port: 5672
username: admin
redis:
database: 0
host: www.tall.wiki
jedis:
pool:
max-active: 200
max-idle: 10
max-wait: -1ms
min-idle: 0
password: 'areowqr!@43ef'
port: 6379
timeout: 1000ms
swagger:
enable: true
eureka:
instance:
ip-address: 129.28.149.79
gatewayUrl: https://www.tall.wiki/gateway/
notGatewayUrl: https://www.tall.wiki/
gameMqName: game_status_api
saveWpsFile: tall/v1.0/wps/saveWps
queryVisitUrls: tall/v1.0/wps/visitUrls
getWpsFilePath: tall/v1.0/v1/3rd/getFilePath
file:
qrCode: https://www.tall.wiki/gateway/tall/v1.0/uploads/
openWX: 1

2
game/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: prod
active: prodapi
include: common, util-prod

33
game/src/main/resources/druid-prodapi.yml

@ -0,0 +1,33 @@
spring:
datasource:
druid:
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
driverClassName: com.mysql.cj.jdbc.Driver
dynamicUrl: jdbc:mysql://localhost:3306/${schema}
filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*'
filterName: druidFilter
filterProfileEnable: true
filterUrlPattern: /*
filters: stat,wall
initialSize: 5
maxActive: 20
maxPoolPreparedStatementPerConnectionSize: 20
maxWait: 60000
minEvictableIdleTimeMillis: 300000
minIdle: 5
password: 37080c1f223685592316b02dad8816c019290a476e54ebb638f9aa3ba8b6bdb9
poolPreparedStatements: true
servletLogSlowSql: true
servletLoginPassword: 111111
servletLoginUsername: druid
servletName: druidServlet
servletResetEnable: true
servletUrlMapping: /druid/*
testOnBorrow: false
testOnReturn: false
testWhileIdle: true
timeBetweenEvictionRunsMillis: 60000
url: jdbc:mysql://www.tall.wiki/game?useUnicode=true&characterEncoding=UTF-8
username: root
validationQuery: SELECT 1 FROM DUAL
env: CCSENS_GAME

44
tall/src/main/resources/application-prodapi.yml

@ -0,0 +1,44 @@
server:
port: 7031
servlet:
context-path: /v1.0
spring:
snowflake:
datacenterId: 3
workerId: 3
application:
name: tall
datasource:
type: com.alibaba.druid.pool.DruidDataSource
rabbitmq:
host: www.tall.wiki
password: 111111
port: 5672
username: admin
redis:
database: 0
host: www.tall.wiki
jedis:
pool:
max-active: 200
max-idle: 10
max-wait: -1ms
min-idle: 0
password: 'areowqr!@43ef'
port: 6379
timeout: 1000ms
swagger:
enable: false
eureka:
instance:
ip-address: 129.28.149.79
gatewayUrl: https://www.tall.wiki/gateway/
notGatewayUrl: https://www.tall.wiki/
smsCode: 1
wx:
prefixUrl: https://www.tall.wiki/wxconfigurer-api/
file:
path: /home/cloud/tall/uploads/
domain: https://www.tall.wiki/gateway/tall/v1.0/
imgDomain: https://www.tall.wiki/gateway/tall/v1.0/uploads

4
tall/src/main/resources/application.yml

@ -1,5 +1,5 @@
spring:
profiles:
active: dev
include: util-dev,common
active: prodapi
include: util-prod,common

33
tall/src/main/resources/druid-prodapi.yml

@ -0,0 +1,33 @@
spring:
datasource:
druid:
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
driverClassName: com.mysql.cj.jdbc.Driver
dynamicUrl: jdbc:mysql://127.0.0.1:3306/${schema}
filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*'
filterName: druidFilter
filterProfileEnable: true
filterUrlPattern: /*
filters: stat,wall
initialSize: 5
maxActive: 20
maxPoolPreparedStatementPerConnectionSize: 20
maxWait: 60000
minEvictableIdleTimeMillis: 300000
minIdle: 5
password: 37080c1f223685592316b02dad8816c019290a476e54ebb638f9aa3ba8b6bdb9
poolPreparedStatements: true
servletLogSlowSql: true
servletLoginPassword: 111111
servletLoginUsername: druid
servletName: druidServlet
servletResetEnable: true
servletUrlMapping: /druid/*
testOnBorrow: false
testOnReturn: false
testWhileIdle: true
timeBetweenEvictionRunsMillis: 60000
url: jdbc:mysql://www.tall.wiki/tall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
username: root
validationQuery: SELECT 1 FROM DUAL
env: CCSENS_GAME

2
tall/src/main/resources/logback-spring.xml

@ -9,7 +9,7 @@
<contextName>logback</contextName>
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
<property name="log.path" value="/home/cloud/game/log/" />
<property name="log.path" value="/home/cloud/tall/game/log/" />
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->

20
util/src/main/java/com/ccsens/util/config/RabbitMQConfig.java

@ -1,5 +1,6 @@
package com.ccsens.util.config;
import cn.hutool.core.util.StrUtil;
import com.ccsens.util.PropUtil;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
@ -23,6 +24,8 @@ public class RabbitMQConfig {
private static final String GAME_STATUS_DELAY_SEND_EXCHANGE = "gameStatusDelaySendExchange";
private static final String GAME_STATUS_DELAY_SEND_ROUTING_KEY = "gameStatusDelaySendRoutingKey";
// private static final String GAME_MQ_A = "GAME_MQ_A";
/**消息队列发送*/
public static final String MESSAGE_QUEUE_NAME = "tall_message_1";
@ -31,10 +34,13 @@ public class RabbitMQConfig {
@Bean
public Queue queue_game (){
public Queue queueGame(){
return new Queue(PropUtil.gameMqName);
}
@Bean
public Queue queue(){
return new Queue(RabbitMQ_QUEUE_NAME);
@ -54,12 +60,11 @@ public class RabbitMQConfig {
}
@Bean
public Queue wisdom_car(){
public Queue wisdomCar(){
return new Queue(WISDOM_CAR);
}
// @Bean
// public Queue queueGame(){
// public Queue wisdom_car(){
// return new Queue(GAME_MQ_A);
// }
@ -100,8 +105,11 @@ public class RabbitMQConfig {
}
//将对列绑定到Fanout交换器
@Bean
Binding bindingExchangeA(Queue queue_game, FanoutExchange fanoutExchange) {
return BindingBuilder.bind(queue_game).to(fanoutExchange);
Binding bindingExchangeA(Queue queueGame, FanoutExchange fanoutExchange) {
if(StrUtil.isEmpty(queueGame.getName())){
return null;
}
return BindingBuilder.bind(queueGame).to(fanoutExchange);
}

2
wisdomcar/src/main/java/com/ccsens/wisdomcar/config/SpringConfig.java

@ -116,7 +116,7 @@ public class SpringConfig implements WebMvcConfigurer {
.addResourceLocations("classpath:/META-INF/resources/webjars/");
registry.addResourceHandler("/uploads/**")
.addResourceLocations("file:///home/cloud/game/uploads/");
.addResourceLocations("file:///home/cloud/wisdomcar/uploads/");
//super.addResourceHandlers(registry);
}

7
wisdomcar/src/main/java/com/ccsens/wisdomcar/rabbitMQ/RabbitController.java

@ -37,6 +37,7 @@ public class RabbitController {
public void process(String messageJson) {
logger.info("平车上传消息数据: {}", messageJson);
// return;
try {
OutMessageSet outMessageSet = JSONObject.parseObject(messageJson, OutMessageSet.class);
if (ObjectUtil.isNull(outMessageSet)) {
return;
@ -49,6 +50,7 @@ public class RabbitController {
List<CarRecordMessageDto> carRecordMessageDtoList = new ArrayList<>();
Map<Integer, Long> map = new HashMap<>();
messageSet.forEach(outMessage -> {
CarRecordMessageDto carRecordMessageDto = JSONObject.parseObject(outMessage.getData(), CarRecordMessageDto.class);
if (ObjectUtil.isNull(carRecordMessageDto)) {
return;
@ -91,6 +93,7 @@ public class RabbitController {
carRecordMessageDtoList.add(carRecordMessageDto);
break;
}
});
carRecordMessageDtoList.forEach(carRecordMessageDto -> {
@ -102,7 +105,9 @@ public class RabbitController {
e.printStackTrace();
}
});
} catch (Exception e) {
log.error("平车消息JSON转换异常", e);
}
}
private long getShakeValue(CarRecordMessageDto carRecordMessageDto) {

1
wisdomcar/src/main/resources/application-dev.yml

@ -31,5 +31,6 @@ file:
signUpUrl: https://test.tall.wiki/compete/
domain: https://test.tall.wiki/gateway/mt/
imgDomain: https://test.tall.wiki/gateway/mt/uploads/
#gameMqName: game_status_wisdom
logging:
path:

4
wisdomcar/src/main/resources/application.yml

@ -1,6 +1,6 @@
spring:
profiles:
active: dev
include: common, util-dev
active: prod
include: common, util-prod

Loading…
Cancel
Save