Sfoglia il codice sorgente

lapi接受数据修改

M墨鱼—_mo 5 anni fa
parent
commit
19b82497d9

+ 3 - 2
lapi/src/main/java/com/jpsoft/smart/lapi/LapiApplication.java

@@ -3,6 +3,7 @@ package com.jpsoft.smart.lapi;
 import com.jpsoft.smart.lapi.handler.HeartReportHandler;
 import com.jpsoft.smart.lapi.handler.ParseRequestHandler;
 import com.jpsoft.smart.lapi.handler.PersonVerificationHandler;
+import com.jpsoft.smart.lapi.handler.TextDecodeHandler;
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
@@ -50,10 +51,10 @@ public class LapiApplication implements CommandLineRunner {
                 .childHandler(new ChannelInitializer(){
                     @Override
                     protected void initChannel(Channel channel) throws Exception {
-//				channel.pipeline().addLast(textDecodeHandler);
+//				channel.pipeline().addLast(new TextDecodeHandler());
 //				channel.pipeline().addLast(new HttpRequestDecoder());
                         channel.pipeline().addLast(new HttpServerCodec());
-                        channel.pipeline().addLast(new HttpObjectAggregator(2048));
+                        channel.pipeline().addLast(new HttpObjectAggregator(2048*10000));
                         channel.pipeline().addLast(new ParseRequestHandler());
                         channel.pipeline().addLast(heartReportHandler);
                         channel.pipeline().addLast(personVerificationHandler);

+ 2 - 1
lapi/src/main/java/com/jpsoft/smart/lapi/handler/ParseRequestHandler.java

@@ -43,7 +43,8 @@ public class ParseRequestHandler extends SimpleChannelInboundHandler<FullHttpReq
 
             ctx.fireChannelRead(heartReportInfo);
         }
-        else if(request.uri().contains("PersonVerification")) {
+        else if(request.uri().contains("Notifications")) {
+            log.warn("PersonVerification"+request.uri());
             PersonVerification personVerification = new PersonVerification();
             personVerification.setUri(request.uri());
 

+ 8 - 0
lapi/src/main/java/com/jpsoft/smart/lapi/handler/PersonVerificationHandler.java

@@ -17,7 +17,15 @@ import java.util.Date;
 public class PersonVerificationHandler extends SimpleChannelInboundHandler<PersonVerification> {
     @Override
     protected void channelRead0(ChannelHandlerContext channelHandlerContext, PersonVerification personVerification) throws Exception {
+        log.warn(personVerification.toString());
         JSONObject jsonObject = personVerification.getJsonObject();
+
+        log.warn("DeviceCode"+jsonObject.getStr("DeviceCode"));
+        log.warn(jsonObject.toString());
+      //  JSONObject faceJson = jsonObject.get("FaceInfoList");
+        log.warn("FaceInfoList" +jsonObject.getStr("FaceInfoList"));
+        JSONObject faceJson = new JSONObject(jsonObject.getStr("FaceInfoList").substring(1,jsonObject.getStr("FaceInfoList").length()-1));
+        log.warn("faceJson"+faceJson);
         long timestamp = jsonObject.getLong("Timestamp");
 
         Date date = new Date(timestamp);