|
@@ -4,6 +4,8 @@ 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.PersonDeviceFilterLogService;
|
|
import com.jpsoft.smart.modules.base.service.PersonDeviceFilterLogService;
|
|
import com.jpsoft.smart.modules.base.service.PersonDeviceLogService;
|
|
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 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;
|
|
@@ -32,20 +34,16 @@ public class PersonVerificationHandler extends SimpleChannelInboundHandler<Perso
|
|
@Autowired
|
|
@Autowired
|
|
private PersonDeviceFilterLogService personDeviceFilterLogService;
|
|
private PersonDeviceFilterLogService personDeviceFilterLogService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private WorkAttendanceService workAttendanceService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
protected void channelRead0(ChannelHandlerContext channelHandlerContext, PersonVerification personVerification) throws Exception {
|
|
protected void channelRead0(ChannelHandlerContext channelHandlerContext, PersonVerification personVerification) throws Exception {
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
log.warn("人员记录");
|
|
log.warn("人员记录");
|
|
JSONObject jsonObject = personVerification.getJsonObject();
|
|
JSONObject jsonObject = personVerification.getJsonObject();
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
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));
|
|
|
|
|
|
-
|
|
|
|
Long timestamp = faceJson.getLong("Timestamp");
|
|
Long timestamp = faceJson.getLong("Timestamp");
|
|
if (timestamp.toString().length()<13){
|
|
if (timestamp.toString().length()<13){
|
|
double timestampDouble = timestamp * Math.pow(10, 13 - timestamp.toString().length());
|
|
double timestampDouble = timestamp * Math.pow(10, 13 - timestamp.toString().length());
|
|
@@ -55,11 +53,6 @@ public class PersonVerificationHandler extends SimpleChannelInboundHandler<Perso
|
|
log.warn(String.valueOf(timestamp));
|
|
log.warn(String.valueOf(timestamp));
|
|
Date date = new Date(timestamp);
|
|
Date date = new Date(timestamp);
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
//设备序列号
|
|
//设备序列号
|
|
String deviceNo = jsonObject.getStr("DeviceCode");
|
|
String deviceNo = jsonObject.getStr("DeviceCode");
|
|
|
|
|
|
@@ -75,16 +68,14 @@ public class PersonVerificationHandler extends SimpleChannelInboundHandler<Perso
|
|
libMatInfoListJson = new JSONObject(jsonObject.getStr("LibMatInfoList").substring(1,jsonObject.getStr("LibMatInfoList").length()-1));
|
|
libMatInfoListJson = new JSONObject(jsonObject.getStr("LibMatInfoList").substring(1,jsonObject.getStr("LibMatInfoList").length()-1));
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
//匹配人员信息
|
|
//匹配人员信息
|
|
JSONObject matchPersonInfo = new JSONObject();
|
|
JSONObject matchPersonInfo = new JSONObject();
|
|
if (StringUtils.isNotBlank(libMatInfoListJson.getStr("MatchPersonInfo"))){
|
|
if (StringUtils.isNotBlank(libMatInfoListJson.getStr("MatchPersonInfo"))){
|
|
matchPersonInfo = libMatInfoListJson.getJSONObject("MatchPersonInfo");
|
|
matchPersonInfo = libMatInfoListJson.getJSONObject("MatchPersonInfo");
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
log.warn("人员记录写入");
|
|
log.warn("人员记录写入");
|
|
|
|
+
|
|
HashMap map = new HashMap<>();
|
|
HashMap map = new HashMap<>();
|
|
map.put("deviceNo",deviceNo);
|
|
map.put("deviceNo",deviceNo);
|
|
map.put("temperature",temperature);
|
|
map.put("temperature",temperature);
|
|
@@ -92,16 +83,24 @@ public class PersonVerificationHandler extends SimpleChannelInboundHandler<Perso
|
|
map.put("matchPersonInfo",matchPersonInfo);
|
|
map.put("matchPersonInfo",matchPersonInfo);
|
|
log.warn(map.toString());
|
|
log.warn(map.toString());
|
|
|
|
|
|
-
|
|
|
|
//记录人员记录
|
|
//记录人员记录
|
|
personDeviceLogService.deviceInsertLog(deviceNo,temperature,faceImageJson,libMatInfoListJson,matchPersonInfo,date);
|
|
personDeviceLogService.deviceInsertLog(deviceNo,temperature,faceImageJson,libMatInfoListJson,matchPersonInfo,date);
|
|
|
|
|
|
//记录人员过滤记录
|
|
//记录人员过滤记录
|
|
personDeviceFilterLogService.deviceInsertFilterLog(deviceNo,temperature,faceImageJson,libMatInfoListJson,matchPersonInfo,date);
|
|
personDeviceFilterLogService.deviceInsertFilterLog(deviceNo,temperature,faceImageJson,libMatInfoListJson,matchPersonInfo,date);
|
|
|
|
|
|
|
|
+ //记录考勤信息
|
|
|
|
+ try {
|
|
|
|
+ final Integer personId = LApiUtil.getPersonCode(libMatInfoListJson, matchPersonInfo);
|
|
|
|
+ final BigDecimal fTemperature = temperature;
|
|
|
|
+ final Date recordDate = date;
|
|
|
|
|
|
-
|
|
|
|
|
|
+ if(personId!=null && personId!=0) {
|
|
|
|
+ new Thread(() -> workAttendanceService.punchIn(personId.longValue(), fTemperature, recordDate)).start();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex){
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|