Merge branch 'server_five_xiaoyao' of https://gitea.qinmian.online/five-groups/five-groups-couplet into server_five
# Conflicts: # couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/BreakdownServiceImpl.java # couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/RealTimeDataServiceImpl.javaserver_five_liuyunhu
commit
e8c0690352
|
@ -94,6 +94,7 @@
|
|||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-business</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -9,18 +9,18 @@ import com.couplet.common.domain.request.RealTimeDataRequest;
|
|||
import com.rabbitmq.client.Channel;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.core.*;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
|
@ -33,12 +33,29 @@ import java.util.concurrent.TimeUnit;
|
|||
//@RabbitListener(queues = "vinQueue")
|
||||
public class MsgConsumer {
|
||||
|
||||
// 普通交换机名称
|
||||
public static final String EXCHANGE_NAME = "confirm_exchange";
|
||||
// 队列名称
|
||||
public static final String QUEUE_NAME = "vinQueue";
|
||||
|
||||
public static final String ROUTING_KEY = "key1";
|
||||
|
||||
@Bean
|
||||
public DirectExchange confirmExchange() {
|
||||
return new DirectExchange(EXCHANGE_NAME);
|
||||
}
|
||||
@Bean
|
||||
public Queue confirmQueue() {
|
||||
return QueueBuilder.durable(QUEUE_NAME).build();
|
||||
}
|
||||
@Bean
|
||||
public Binding queueBindingExchange(@Qualifier("confirmQueue") Queue confirmQueue, @Qualifier("confirmExchange") DirectExchange confirmExchange) {
|
||||
return BindingBuilder.bind(confirmQueue).to(confirmExchange).with(ROUTING_KEY);
|
||||
}
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
@Autowired
|
||||
private IncidentMapper incidentMapper;
|
||||
private static final Map<String, Set<Long>> setMap = new HashMap<>();
|
||||
|
||||
|
||||
@RabbitHandler
|
||||
public void realTimeDataConsumer(RealTimeDataRequest realTimeDataRequest, Channel channel, Message message) throws IOException {
|
||||
|
|
|
@ -68,14 +68,15 @@ public class BreakdownServiceImpl extends KeyExpirationEventMessageListener impl
|
|||
//获取过期的key
|
||||
String expireKey = coupletMsgData.toString();
|
||||
redisTemplate.opsForValue().set(String.valueOf(coupletMsgData),JSON.toJSONString(coupletMsgData),10, TimeUnit.MINUTES);
|
||||
|
||||
long timeMillis = System.currentTimeMillis();
|
||||
log.debug("失效+key is:"+ expireKey);
|
||||
log.info("故障事件结束时间:"+timeMillis);
|
||||
log.info("故障事件检测结束.....");
|
||||
|
||||
}
|
||||
long timeMillis = System.currentTimeMillis();
|
||||
log.info("故障事件结束时间:"+timeMillis);
|
||||
log.info("故障事件检测结束.....");
|
||||
log.info("故障事件结束.....");
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,16 +42,10 @@ public class RealTimeDataServiceImpl implements IncidentService {
|
|||
|
||||
log.info("实时数据事件开始.....");
|
||||
|
||||
if (redisTemplate.hasKey("coupletMsgData")){
|
||||
redisTemplate.delete("coupletMsgData");
|
||||
if (RealTimeJudge.isJudge(coupletMsgData.getVin())){
|
||||
log.info("[{}]开始传输实时数据", coupletMsgData.getVin());
|
||||
}
|
||||
// Set<Long> userId = setMap.get(coupletMsgData.getVin());
|
||||
// if (null == userId){
|
||||
// userId = new HashSet<>();
|
||||
// setMap.put(coupletMsgData.getVin(),userId);
|
||||
// }
|
||||
// userId.add(coupletMsgData.getUserId());
|
||||
|
||||
log.info("[{}]开始传输实时数据", coupletMsgData.getVin());
|
||||
|
||||
|
||||
log.info("实时数据事件结束.....");
|
||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -17,15 +17,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
|
|
@ -4,8 +4,6 @@ server:
|
|||
|
||||
# Spring
|
||||
spring:
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
application:
|
||||
# 应用名称
|
||||
name: couplet-job
|
||||
|
@ -17,11 +15,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
Loading…
Reference in New Issue