|
@@ -2,12 +2,15 @@ package com.jpsoft.smart.lapi.handler;
|
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
import com.jpsoft.smart.lapi.dto.PersonVerification;
|
|
import com.jpsoft.smart.lapi.dto.PersonVerification;
|
|
|
|
+import com.jpsoft.smart.modules.base.service.PersonDeviceLogService;
|
|
import io.netty.channel.ChannelHandler;
|
|
import io.netty.channel.ChannelHandler;
|
|
import io.netty.channel.ChannelHandlerContext;
|
|
import io.netty.channel.ChannelHandlerContext;
|
|
import io.netty.channel.SimpleChannelInboundHandler;
|
|
import io.netty.channel.SimpleChannelInboundHandler;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
|
@@ -15,6 +18,10 @@ import java.util.Date;
|
|
@Component
|
|
@Component
|
|
@ChannelHandler.Sharable
|
|
@ChannelHandler.Sharable
|
|
public class PersonVerificationHandler extends SimpleChannelInboundHandler<PersonVerification> {
|
|
public class PersonVerificationHandler extends SimpleChannelInboundHandler<PersonVerification> {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private PersonDeviceLogService personDeviceLogService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
protected void channelRead0(ChannelHandlerContext channelHandlerContext, PersonVerification personVerification) throws Exception {
|
|
protected void channelRead0(ChannelHandlerContext channelHandlerContext, PersonVerification personVerification) throws Exception {
|
|
log.warn(personVerification.toString());
|
|
log.warn(personVerification.toString());
|
|
@@ -24,14 +31,42 @@ public class PersonVerificationHandler extends SimpleChannelInboundHandler<Perso
|
|
log.warn(jsonObject.toString());
|
|
log.warn(jsonObject.toString());
|
|
// JSONObject faceJson = jsonObject.get("FaceInfoList");
|
|
// JSONObject faceJson = jsonObject.get("FaceInfoList");
|
|
log.warn("FaceInfoList" +jsonObject.getStr("FaceInfoList"));
|
|
log.warn("FaceInfoList" +jsonObject.getStr("FaceInfoList"));
|
|
|
|
+
|
|
|
|
+
|
|
JSONObject faceJson = new JSONObject(jsonObject.getStr("FaceInfoList").substring(1,jsonObject.getStr("FaceInfoList").length()-1));
|
|
JSONObject faceJson = new JSONObject(jsonObject.getStr("FaceInfoList").substring(1,jsonObject.getStr("FaceInfoList").length()-1));
|
|
- log.warn("faceJson"+faceJson);
|
|
|
|
|
|
+ log.warn(faceJson.getStr("FaceImage"));
|
|
|
|
+
|
|
|
|
+ //设备序列号
|
|
|
|
+ String deviceNo = jsonObject.getStr("DeviceCode");
|
|
|
|
+
|
|
|
|
+ //人员温度信息
|
|
|
|
+ BigDecimal temperature = faceJson.getBigDecimal("Temperature");
|
|
|
|
+
|
|
|
|
+ //人员抓拍信息
|
|
|
|
+ JSONObject faceImageJson = faceJson.getJSONObject("FaceImage");
|
|
|
|
+
|
|
|
|
+ //匹配状态信息
|
|
|
|
+ JSONObject libMatInfoListJson = new JSONObject(jsonObject.getStr("LibMatInfoList").substring(1,jsonObject.getStr("LibMatInfoList").length()-1));
|
|
|
|
+
|
|
|
|
+ //匹配人员信息
|
|
|
|
+ JSONObject matchPersonInfo = libMatInfoListJson.getJSONObject("MatchPersonInfo");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ personDeviceLogService.deviceInsertLog(deviceNo,temperature,faceImageJson,libMatInfoListJson,matchPersonInfo);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /*log.warn("faceJson"+faceJson);
|
|
|
|
+ log.warn("FaceImage"+faceImageJson);
|
|
|
|
+ log.warn("LibMatInfoList"+libMatInfoListJson);
|
|
|
|
+ log.warn("MatchPersonInfo"+matchPersonInfo);
|
|
long timestamp = jsonObject.getLong("Timestamp");
|
|
long timestamp = jsonObject.getLong("Timestamp");
|
|
|
|
|
|
Date date = new Date(timestamp);
|
|
Date date = new Date(timestamp);
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
- log.warn("考勤时间:" + sdf.format(date));
|
|
|
|
|
|
+ log.warn("考勤时间:" + sdf.format(date));*/
|
|
}
|
|
}
|
|
}
|
|
}
|