Commit 921a12515e264878af4fe78ae9432aeadc7962d7
1 parent
fea85773
清除多余组件;
Showing
7 changed files
with
6 additions
and
243 deletions
pom.xml
... | ... | @@ -34,23 +34,10 @@ |
34 | 34 | <scope>test</scope> |
35 | 35 | </dependency> |
36 | 36 | <dependency> |
37 | - <groupId>org.springframework.boot</groupId> | |
38 | - <artifactId>spring-boot-starter-websocket</artifactId> | |
39 | - <version>1.5.6.RELEASE</version> | |
40 | - </dependency> | |
41 | - <dependency> | |
42 | 37 | <groupId>org.apache.commons</groupId> |
43 | 38 | <artifactId>commons-pool2</artifactId> |
44 | 39 | <version>2.4.2</version> |
45 | 40 | </dependency> |
46 | - <!--<dependency> | |
47 | - <groupId>org.springframework.boot</groupId> | |
48 | - <artifactId>spring-boot-starter-actuator</artifactId> | |
49 | - </dependency> | |
50 | - <dependency> | |
51 | - <groupId>org.springframework.boot</groupId> | |
52 | - <artifactId>spring-boot-starter-aop</artifactId> | |
53 | - </dependency>--> | |
54 | 41 | |
55 | 42 | <dependency> |
56 | 43 | <groupId>org.springframework.boot</groupId> |
... | ... | @@ -102,11 +89,6 @@ |
102 | 89 | <version>5.0.0</version> |
103 | 90 | </dependency> |
104 | 91 | <dependency> |
105 | - <groupId>org.springframework.boot</groupId> | |
106 | - <artifactId>spring-boot-starter-data-mongodb</artifactId> | |
107 | - </dependency> | |
108 | - | |
109 | - <dependency> | |
110 | 92 | <groupId>org.springframework.data</groupId> |
111 | 93 | <artifactId>spring-data-commons</artifactId> |
112 | 94 | <version>2.1.5.RELEASE</version> | ... | ... |
src/main/java/com/objecteye/config/RabbitmqConfig.java deleted
1 | -package com.objecteye.config; | |
2 | - | |
3 | - | |
4 | -import org.springframework.amqp.core.*; | |
5 | -import org.springframework.beans.factory.annotation.Qualifier; | |
6 | -import org.springframework.context.annotation.Bean; | |
7 | -import org.springframework.context.annotation.Configuration; | |
8 | - | |
9 | - | |
10 | -@Configuration | |
11 | -public class RabbitmqConfig { | |
12 | - public static final String QUEUE_INFORM_LISTENER = "queue_inform_listener"; | |
13 | - | |
14 | - public static final String EXCHANGE_TOPICS_INFORM="exchange_topics_inform"; | |
15 | - | |
16 | - /** | |
17 | - * | |
18 | - * 配置交换机 | |
19 | - * ExchangeBuilder提供了fonout,direct,topic,header的交换机的配置 | |
20 | - * @return | |
21 | - */ | |
22 | - @Bean(EXCHANGE_TOPICS_INFORM) | |
23 | - public Exchange EXCHANGE_TOPICS_INFORM(){ | |
24 | - return ExchangeBuilder.topicExchange(EXCHANGE_TOPICS_INFORM).durable(true).build(); | |
25 | - } | |
26 | - | |
27 | - /** | |
28 | - * 声明队列 | |
29 | - * @return | |
30 | - */ | |
31 | - @Bean(QUEUE_INFORM_LISTENER) | |
32 | - public Queue QUEUE_INFORM_STORE(){ | |
33 | - return new Queue(QUEUE_INFORM_LISTENER); | |
34 | - } | |
35 | - | |
36 | - //绑定队列到交换机 | |
37 | - @Bean | |
38 | - public Binding BINDING_QUEUE_INFORM_STORE(@Qualifier(QUEUE_INFORM_LISTENER) Queue queue, @Qualifier(EXCHANGE_TOPICS_INFORM)Exchange exchange){ | |
39 | - return BindingBuilder.bind(queue).to(exchange).with("inform.#.listener.#").noargs(); | |
40 | - } | |
41 | -} |
src/main/java/com/objecteye/config/Swagger2Config.java
... | ... | @@ -37,9 +37,9 @@ public class Swagger2Config { |
37 | 37 | |
38 | 38 | private ApiInfo apiInfo() { |
39 | 39 | return new ApiInfoBuilder() |
40 | - .title("人像平台后台系统") | |
41 | - .description("人像平台后台模块") | |
42 | - .contact("face") | |
40 | + .title("引擎可视化") | |
41 | + .description("引擎可视化") | |
42 | + .contact("remoteListener") | |
43 | 43 | .version("1.0") |
44 | 44 | .build(); |
45 | 45 | } |
... | ... | @@ -55,17 +55,10 @@ public class Swagger2Config { |
55 | 55 | private List<SecurityContext> securityContexts() { |
56 | 56 | //设置需要登录认证的路径 |
57 | 57 | List<SecurityContext> result = new ArrayList<>(); |
58 | - result.add(getContextByPath("/alarm/.*")); | |
59 | - result.add(getContextByPath("/capture/.*")); | |
60 | - result.add(getContextByPath("/deploy/.*")); | |
61 | - result.add(getContextByPath("/equipment/.*")); | |
62 | - result.add(getContextByPath("/feature/.*")); | |
63 | - result.add(getContextByPath("/location/.*")); | |
64 | - result.add(getContextByPath("/personnel/.*")); | |
65 | - result.add(getContextByPath("/preview/.*")); | |
66 | - result.add(getContextByPath("/record/.*")); | |
58 | + result.add(getContextByPath("/background/.*")); | |
59 | + result.add(getContextByPath("/logListener/.*")); | |
60 | + result.add(getContextByPath("/occupationOfBasicResources/.*")); | |
67 | 61 | result.add(getContextByPath("/user/.*")); |
68 | - result.add(getContextByPath("/areaEquipment/.*")); | |
69 | 62 | return result; |
70 | 63 | } |
71 | 64 | ... | ... |
src/main/java/com/objecteye/utils/RabbbitmqConsumer.java deleted
1 | -package com.objecteye.utils; | |
2 | - | |
3 | -import com.objecteye.config.RabbitmqConfig; | |
4 | -import com.rabbitmq.client.Channel; | |
5 | -import org.slf4j.Logger; | |
6 | -import org.slf4j.LoggerFactory; | |
7 | -import org.springframework.amqp.core.Message; | |
8 | -import org.springframework.amqp.rabbit.annotation.RabbitListener; | |
9 | -import org.springframework.stereotype.Component; | |
10 | - | |
11 | -@Component | |
12 | -public class RabbbitmqConsumer { | |
13 | - | |
14 | - private final static Logger logger = LoggerFactory.getLogger(RabbbitmqConsumer.class); | |
15 | - | |
16 | - @RabbitListener(queues = {RabbitmqConfig.QUEUE_INFORM_LISTENER}) | |
17 | - public void receive_store(String msg, Message message, Channel channel) { | |
18 | - logger.info(msg); | |
19 | - } | |
20 | -} |
src/main/java/com/objecteye/websocket/MyHandshakeInterceptor.java deleted
1 | -package com.objecteye.websocket; | |
2 | - | |
3 | -import org.springframework.http.server.ServerHttpRequest; | |
4 | -import org.springframework.http.server.ServerHttpResponse; | |
5 | -import org.springframework.http.server.ServletServerHttpRequest; | |
6 | -import org.springframework.stereotype.Component; | |
7 | -import org.springframework.web.socket.WebSocketHandler; | |
8 | -import org.springframework.web.socket.server.HandshakeInterceptor; | |
9 | - | |
10 | -import java.util.Map; | |
11 | - | |
12 | -/** | |
13 | - * @Author: lr | |
14 | - * @Date: 2019/9/5 14:32 | |
15 | - * @Version 1.0 | |
16 | - * @Message: | |
17 | - */ | |
18 | -@Component | |
19 | -public class MyHandshakeInterceptor implements HandshakeInterceptor { | |
20 | - @Override | |
21 | - public boolean beforeHandshake(ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse, WebSocketHandler webSocketHandler, Map<String, Object> map) throws Exception { | |
22 | - String deviceId=((ServletServerHttpRequest)serverHttpRequest).getServletRequest().getParameter("deviceId"); | |
23 | - if(deviceId!=null){ | |
24 | - map.put("deviceId",deviceId); | |
25 | - } | |
26 | - return true; | |
27 | - } | |
28 | - | |
29 | - @Override | |
30 | - public void afterHandshake(ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse, WebSocketHandler webSocketHandler, Exception e) { | |
31 | - } | |
32 | -} |
src/main/java/com/objecteye/websocket/MyWebSocketHandler.java deleted
1 | -package com.objecteye.websocket; | |
2 | - | |
3 | -import net.sf.json.JSONObject; | |
4 | -import org.springframework.beans.factory.annotation.Autowired; | |
5 | -import org.springframework.data.redis.core.RedisTemplate; | |
6 | -import org.springframework.stereotype.Component; | |
7 | -import org.springframework.web.socket.CloseStatus; | |
8 | -import org.springframework.web.socket.TextMessage; | |
9 | -import org.springframework.web.socket.WebSocketSession; | |
10 | -import org.springframework.web.socket.handler.TextWebSocketHandler; | |
11 | - | |
12 | - | |
13 | -/** | |
14 | - * @Author: lr | |
15 | - * @Date: 2019/9/3 10:45 | |
16 | - * @Version 1.0 | |
17 | - * @Message: | |
18 | - */ | |
19 | -@Component | |
20 | -public class MyWebSocketHandler extends TextWebSocketHandler { | |
21 | - | |
22 | - @Autowired | |
23 | - private RedisTemplate redisTemplate; | |
24 | - | |
25 | - | |
26 | - | |
27 | - @Override | |
28 | - public void handleTextMessage(WebSocketSession session, TextMessage message) | |
29 | - throws Exception { | |
30 | - super.handleTextMessage(session, message); | |
31 | - } | |
32 | - | |
33 | - /** | |
34 | - * 抓拍数据和报警数据的json格式 | |
35 | - */ | |
36 | - public String getRealData(Object countMsg, Object captureMsg, Object deployAlarmMsg) { | |
37 | - JSONObject jsonObject = new JSONObject(); | |
38 | - boolean isNull = true; | |
39 | - if (countMsg != null) { | |
40 | - isNull = false; | |
41 | - jsonObject.put("countMsg", countMsg); | |
42 | - jsonObject.put("countCode", 0); | |
43 | - } else { | |
44 | - jsonObject.put("countCode", 1); | |
45 | - } | |
46 | - if (captureMsg != null) { | |
47 | - isNull = false; | |
48 | - jsonObject.put("captureMsg", captureMsg); | |
49 | - jsonObject.put("captureCode", 0); | |
50 | - } else { | |
51 | - jsonObject.put("captureCode", 1); | |
52 | - } | |
53 | - if (deployAlarmMsg != null) { | |
54 | - isNull = false; | |
55 | - jsonObject.put("deployAlarmMsg", deployAlarmMsg); | |
56 | - jsonObject.put("deployAlarmCode", 0); | |
57 | - } else { | |
58 | - jsonObject.put("deployAlarmCode", 1); | |
59 | - } | |
60 | - if (isNull) { | |
61 | - return null; | |
62 | - } | |
63 | - return jsonObject.toString(); | |
64 | - } | |
65 | - | |
66 | - | |
67 | - @Override | |
68 | - public void afterConnectionEstablished(WebSocketSession session) { | |
69 | - | |
70 | - } | |
71 | - | |
72 | - //抛出异常后处理 | |
73 | - @Override | |
74 | - public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception { | |
75 | - if (session.isOpen()) { | |
76 | - session.close(); | |
77 | - } | |
78 | - } | |
79 | - | |
80 | - @Override | |
81 | - public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { | |
82 | - if(session.isOpen()){ | |
83 | - session.close(); | |
84 | - } | |
85 | - } | |
86 | -} |
src/main/java/com/objecteye/websocket/WebSocketConfigClass.java deleted
1 | -package com.objecteye.websocket; | |
2 | - | |
3 | -import org.springframework.beans.factory.annotation.Autowired; | |
4 | -import org.springframework.context.annotation.Bean; | |
5 | -import org.springframework.context.annotation.Configuration; | |
6 | -import org.springframework.web.socket.WebSocketHandler; | |
7 | -import org.springframework.web.socket.config.annotation.EnableWebSocket; | |
8 | -import org.springframework.web.socket.config.annotation.WebSocketConfigurer; | |
9 | -import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; | |
10 | - | |
11 | -/** | |
12 | - * @Author: lr | |
13 | - * @Date: 2019/9/3 10:51 | |
14 | - * @Version 1.0 | |
15 | - * @Message: | |
16 | - */ | |
17 | -@Configuration | |
18 | -@EnableWebSocket | |
19 | -public class WebSocketConfigClass implements WebSocketConfigurer { | |
20 | - | |
21 | - @Autowired | |
22 | - private MyHandshakeInterceptor myHandshakeInterceptor; | |
23 | - | |
24 | - @Override | |
25 | - public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { | |
26 | - registry.addHandler(myHandler(),"/ws").setAllowedOrigins("*").addInterceptors(this.myHandshakeInterceptor); | |
27 | - } | |
28 | - | |
29 | - @Bean | |
30 | - public WebSocketHandler myHandler(){ | |
31 | - return new MyWebSocketHandler(); | |
32 | - } | |
33 | -} |