Browse Source

增加人脸识别日志。

zhengqiang 5 years ago
parent
commit
79e70630a0

+ 20 - 1
lapi/src/main/java/com/jpsoft/smart/lapi/handler/PersonVerificationHandler.java

@@ -6,6 +6,8 @@ import com.jpsoft.smart.modules.base.service.PersonDeviceFilterLogService;
 import com.jpsoft.smart.modules.base.service.PersonDeviceLogService;
 import com.jpsoft.smart.modules.business.service.WorkAttendanceService;
 import com.jpsoft.smart.modules.common.utils.LApiUtil;
+import com.jpsoft.smart.modules.sys.entity.SysLog;
+import com.jpsoft.smart.modules.sys.service.SysLogService;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.SimpleChannelInboundHandler;
@@ -19,6 +21,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.net.SocketAddress;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
@@ -37,9 +40,13 @@ public class PersonVerificationHandler extends SimpleChannelInboundHandler<Perso
     @Autowired
     private WorkAttendanceService workAttendanceService;
 
+    @Autowired
+    private SysLogService sysLogService;
+
     @Override
-    protected void channelRead0(ChannelHandlerContext channelHandlerContext, PersonVerification personVerification) throws Exception {
+    protected void channelRead0(ChannelHandlerContext ctx, PersonVerification personVerification) throws Exception {
         log.warn("人员记录");
+
         JSONObject jsonObject = personVerification.getJsonObject();
 
         JSONObject faceJson = new JSONObject(jsonObject.getStr("FaceInfoList").substring(1,jsonObject.getStr("FaceInfoList").length()-1));
@@ -56,6 +63,18 @@ public class PersonVerificationHandler extends SimpleChannelInboundHandler<Perso
         //设备序列号
         String deviceNo = jsonObject.getStr("DeviceCode");
 
+        new Thread(()->{
+            SysLog sysLog = new SysLog();
+            sysLog.setPointcut(deviceNo);
+            sysLog.setUrl("/LAPI/V1.0/System/Event/Notification/PersonVerification");
+            sysLog.setData("");
+            sysLog.setRemark("收到人脸识别信息");
+            SocketAddress remoteAddress = ctx.channel().remoteAddress();
+            sysLog.setRemoteIp(remoteAddress.toString());
+            sysLog.setCreateTime(new Date());
+            sysLogService.insert(sysLog);
+        }).start();
+
         //人员温度信息
         BigDecimal temperature = faceJson.getBigDecimal("Temperature");