Commit ca22ba1b authored by 杨翌文's avatar 杨翌文

tijiao

parent 65d30f1a
...@@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; ...@@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource; import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.listener.PatternTopic; import org.springframework.data.redis.listener.PatternTopic;
...@@ -38,11 +37,10 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter; ...@@ -38,11 +37,10 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
import redis.clients.jedis.JedisPoolConfig; import redis.clients.jedis.JedisPoolConfig;
import com.hdp.customerservice.websocket.*; import com.hdp.customerservice.websocket.IMWebSocketEndpoint;
import com.hdp.pi.wechat.Subscriber; import com.hdp.pi.wechat.Subscriber;
@PropertySource(value="classpath:application.${model}.properties") @ComponentScan("com.hdp")
@ComponentScan
@EnableAutoConfiguration @EnableAutoConfiguration
@EnableWebMvc @EnableWebMvc
@EnableWebSocket @EnableWebSocket
......
...@@ -57,7 +57,7 @@ public final class IMManager { ...@@ -57,7 +57,7 @@ public final class IMManager {
newUserMessage.entCode=e.entCode; newUserMessage.entCode=e.entCode;
newUserMessage.openId=e.openId; newUserMessage.openId=e.openId;
try { try {
queue.put(e); queue.put(newUserMessage);
} catch (InterruptedException e1) { } catch (InterruptedException e1) {
} }
} }
...@@ -65,19 +65,21 @@ public final class IMManager { ...@@ -65,19 +65,21 @@ public final class IMManager {
public static void broadcast(AbstractMessage message){ public static void broadcast(AbstractMessage message){
String m = JSONObject.toJSONString(message); String m = JSONObject.toJSONString(message);
for (Waiter waiter : waiters) { for (Waiter waiter : waiters) {
/*if(waiter == null || if(waiter == null ||
message.entCode == null || message.entCode == null ||
waiter.entCode == null || waiter.entCode == null ||
waiter.entCode.intValue() != message.entCode.intValue()){//没有客服 waiter.entCode.intValue() != message.entCode.intValue()){//没有客服
continue; continue;
}*/ }
Session session= waiter.session; Session session= waiter.session;
/*if(session == null || !session.isOpen()){ if(session == null || !session.isOpen()){
return; return;
}*/ }
try { try {
session.getBasicRemote().sendText(m); session.getAsyncRemote().sendText(m);
session.getAsyncRemote().flushBatch();
} catch (IOException e1) { } catch (IOException e1) {
e1.printStackTrace();
} }
} }
} }
...@@ -89,7 +91,7 @@ public final class IMManager { ...@@ -89,7 +91,7 @@ public final class IMManager {
waiters.remove(w); waiters.remove(w);
} }
static{ static{
for(int i=0;i<poolSize;i++){ for(int i=0;i<1;i++){
pool.execute(new Runnable() {//消息发射器 pool.execute(new Runnable() {//消息发射器
public void hand(){ public void hand(){
AbstractMessage e=queue.poll(); AbstractMessage e=queue.poll();
......
...@@ -2,8 +2,6 @@ package com.hdp.customerservice.websocket; ...@@ -2,8 +2,6 @@ package com.hdp.customerservice.websocket;
import java.io.IOException; import java.io.IOException;
import javax.servlet.http.HttpSession;
import javax.websocket.EndpointConfig;
import javax.websocket.OnClose; import javax.websocket.OnClose;
import javax.websocket.OnError; import javax.websocket.OnError;
import javax.websocket.OnMessage; import javax.websocket.OnMessage;
...@@ -13,14 +11,7 @@ import javax.websocket.server.ServerEndpoint; ...@@ -13,14 +11,7 @@ import javax.websocket.server.ServerEndpoint;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.WebSocketMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.WebSocketHandlerDecorator;
import com.hdp.customerservice.model.WorksEntity;
import com.hdp.customerservice.websocket.model.Waiter; import com.hdp.customerservice.websocket.model.Waiter;
@ServerEndpoint(value="/im"/*,configurator=GetHttpSessionConfigurator.class*/) @ServerEndpoint(value="/im"/*,configurator=GetHttpSessionConfigurator.class*/)
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<context:property-placeholder <context:property-placeholder
ignore-resource-not-found="true" ignore-resource-not-found="true"
location="classpath*:/application.development.properties" /> location="classpath*:/application.${mode}.properties" />
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init"
...@@ -68,11 +68,16 @@ ...@@ -68,11 +68,16 @@
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" /> <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" />
<bean id="securityFilter" class="com.hdp.pi.security.filter.SecurityFilter"> <bean id="securityFilter" class="com.hdp.pi.security.filter.SecurityFilter">
<property name="debug" value="true"/> <property name="debug" value="${app.debug}"/>
<property name="whiteList"> <property name="whiteList">
<list> <list>
<value>.wxpai.cn</value> <value>.wxpai.cn</value>
</list> </list>
</property>
<property name="excludes">
<list>
<value>/v1.0/internal</value>
</list>
</property> </property>
<property name="maxAge" value="7200" /> <property name="maxAge" value="7200" />
</bean> </bean>
......
...@@ -7,11 +7,13 @@ redis.channel = __http_weixin__ ...@@ -7,11 +7,13 @@ redis.channel = __http_weixin__
#mysql database setting #mysql database setting
jdbc.driver=com.mysql.jdbc.Driver jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/customerservice?autoReconnect=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8 jdbc.url=jdbc:mysql://121.199.42.240:3306/picrm?autoReconnect=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8
jdbc.username=root jdbc.username=future
jdbc.password=liuwensheng jdbc.password=future123456
jdbc.pool.maxActive=20 jdbc.pool.maxActive=20
jdbc.pool.initialSize=1 jdbc.pool.initialSize=1
jdbc.pool.minIdle=1 jdbc.pool.minIdle=1
jpa.showsql=true jpa.showsql=false
app.debug = true
...@@ -2,5 +2,17 @@ redis.host = 46826d8cc18c11e4.m.cnhza.kvstore.aliyuncs.com ...@@ -2,5 +2,17 @@ redis.host = 46826d8cc18c11e4.m.cnhza.kvstore.aliyuncs.com
redis.port = 6379 redis.port = 6379
redis.pass = 46826d8cc18c11e4:xQUFLhOctr8b3ZA2RTFQ redis.pass = 46826d8cc18c11e4:xQUFLhOctr8b3ZA2RTFQ
redis.idle = 1 redis.idle = 1
redis.maxAtive= 20 redis.maxActive= 20
redis.channel = __http_monitor__ redis.channel = __http_weixin__
\ No newline at end of file
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://rdsefzzbf7bv6j3.mysql.rds.aliyuncs.com/piscrm?autoReconnect=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8
jdbc.username=future
jdbc.password=future123456
jdbc.pool.maxActive=50
jdbc.pool.initialSize=20
jdbc.pool.minIdle=10
jpa.showsql=false
app.debug = false
\ No newline at end of file
...@@ -2,5 +2,17 @@ redis.host = 10.161.177.181 ...@@ -2,5 +2,17 @@ redis.host = 10.161.177.181
redis.port = 6379 redis.port = 6379
redis.pass = future123456 redis.pass = future123456
redis.idle = 1 redis.idle = 1
redis.maxAtive= 20 redis.maxActive= 20
redis.channel = __http_monitor__ redis.channel = __http_weixin__
\ No newline at end of file
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://121.199.42.240:3306/sandbox?autoReconnect=true&zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8
jdbc.username=future
jdbc.password=future123456
jdbc.pool.maxActive=20
jdbc.pool.initialSize=1
jdbc.pool.minIdle=1
jpa.showsql=false
app.debug = true
\ 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