Commit d018181c authored by 廖旭伟's avatar 廖旭伟

websocket日志

parent c66f89b8
...@@ -6,6 +6,7 @@ import com.mortals.xhx.module.apply.model.MatterApplyDatumQuery; ...@@ -6,6 +6,7 @@ import com.mortals.xhx.module.apply.model.MatterApplyDatumQuery;
import com.mortals.xhx.module.apply.model.MatterApplyEntity; import com.mortals.xhx.module.apply.model.MatterApplyEntity;
import com.mortals.xhx.module.apply.service.MatterApplyDatumService; import com.mortals.xhx.module.apply.service.MatterApplyDatumService;
import com.mortals.xhx.module.apply.service.MatterApplyService; import com.mortals.xhx.module.apply.service.MatterApplyService;
import lombok.extern.slf4j.Slf4j;
import org.java_websocket.client.WebSocketClient; import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake; import org.java_websocket.handshake.ServerHandshake;
import java.net.URI; import java.net.URI;
...@@ -14,6 +15,7 @@ import java.util.HashMap; ...@@ -14,6 +15,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Slf4j
public class CustomerWebSocketClient extends WebSocketClient { public class CustomerWebSocketClient extends WebSocketClient {
private MatterApplyDatumService matterApplyDatumService; private MatterApplyDatumService matterApplyDatumService;
...@@ -65,20 +67,20 @@ public class CustomerWebSocketClient extends WebSocketClient { ...@@ -65,20 +67,20 @@ public class CustomerWebSocketClient extends WebSocketClient {
@Override @Override
public void onOpen(ServerHandshake handshake) { public void onOpen(ServerHandshake handshake) {
System.out.println("连接已建立:"); log.info("连接已建立:");
currentTime1 = System.currentTimeMillis(); currentTime1 = System.currentTimeMillis();
} }
@Override @Override
public void onMessage(String message) { public void onMessage(String message) {
this.close(); this.close();
System.out.println("收到消息: " + message); log.info("收到消息: " + message);
System.out.println("耗时间:"+(System.currentTimeMillis()-currentTime1)); //log.info("耗时间:"+(System.currentTimeMillis()-currentTime1));
System.out.println("ApplyDatumId: " + ApplyDatumId); //System.out.println("ApplyDatumId: " + ApplyDatumId);
JSONObject jsonObject = JSONObject.parseObject(message); JSONObject jsonObject = JSONObject.parseObject(message);
System.out.println("serial_number: " + jsonObject.getLongValue("serial_number")); log.info("serial_number: " + jsonObject.getLongValue("serial_number"));
Long serial_number = jsonObject.getLongValue("serial_number"); Long serial_number = jsonObject.getLongValue("serial_number");
System.out.println("耗时:"+(System.currentTimeMillis()-currentTime)+"毫秒"); log.info("耗时:"+(System.currentTimeMillis()-currentTime)+"毫秒");
if(null != matterApplyDatumService && null != matterApplyService){ if(null != matterApplyDatumService && null != matterApplyService){
MatterApplyDatumEntity datumEntity = matterApplyDatumService.get(serial_number); MatterApplyDatumEntity datumEntity = matterApplyDatumService.get(serial_number);
boolean apply = true; boolean apply = true;
...@@ -141,7 +143,7 @@ public class CustomerWebSocketClient extends WebSocketClient { ...@@ -141,7 +143,7 @@ public class CustomerWebSocketClient extends WebSocketClient {
@Override @Override
public void onClose(int code, String reason, boolean remote) { public void onClose(int code, String reason, boolean remote) {
System.out.println("连接关闭: " + reason); log.info("连接关闭: " + reason);
} }
@Override @Override
......
...@@ -98,7 +98,7 @@ public class SingleApplyreviewService implements IApplicationStartedService { ...@@ -98,7 +98,7 @@ public class SingleApplyreviewService implements IApplicationStartedService {
if(webSocketClient.isOpen()) { if(webSocketClient.isOpen()) {
webSocketClient.setCurrentTime(System.currentTimeMillis()); webSocketClient.setCurrentTime(System.currentTimeMillis());
webSocketClient.send(JSONObject.toJSONString(processUserImage)); webSocketClient.send(JSONObject.toJSONString(processUserImage));
System.out.println("发送消息: " + JSONObject.toJSONString(processUserImage)); log.info("发送消息: " + JSONObject.toJSONString(processUserImage));
} }
try { try {
Thread.sleep(15000); Thread.sleep(15000);
......
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