Browse Source

具体化人脸属性异常信息

fllmoyu 5 years ago
parent
commit
fb21b17f89

+ 1 - 1
common/src/main/java/com/jpsoft/smart/modules/base/service/PersonDeviceFilterLogService.java

@@ -27,7 +27,7 @@ public interface PersonDeviceFilterLogService {
      * @param libMatInfoListJson
      * @param matchPersonInfo
      */
-    void deviceInsertFilterLog(String deviceNo, BigDecimal temperature, JSONObject faceImageJson, JSONObject libMatInfoListJson, JSONObject matchPersonInfo, Date date);
+    void deviceInsertFilterLog(String deviceNo, BigDecimal temperature, JSONObject faceImageJson, JSONObject libMatInfoListJson, JSONObject matchPersonInfo, Date date,Integer maskFlag);
 
     Page<PersonDeviceFilterLog> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize, boolean count, List<Sort> sortList);
 

+ 1 - 1
common/src/main/java/com/jpsoft/smart/modules/base/service/PersonDeviceLogService.java

@@ -29,7 +29,7 @@ public interface PersonDeviceLogService {
      * @param libMatInfoListJson
      * @param matchPersonInfo
      */
-    void deviceInsertLog(String deviceNo, BigDecimal temperature, JSONObject faceImageJson, JSONObject libMatInfoListJson, JSONObject matchPersonInfo, Date date);
+    void deviceInsertLog(String deviceNo, BigDecimal temperature, JSONObject faceImageJson, JSONObject libMatInfoListJson, JSONObject matchPersonInfo, Date date,Integer maskFlag);
     Page<PersonDeviceLog> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize,boolean count, List<Sort> sortList);
     List<PersonDeviceLog> findByPersonAndDate(Long personId,Date startDate,Date endDate);
     Page<PersonDeviceLog> simplePageSearch(Map<String, Object> searchParams, int pageNum, int pageSize,boolean count, List<Sort> sortList);

+ 4 - 3
common/src/main/java/com/jpsoft/smart/modules/base/service/impl/PersonDeviceFilterLogServiceImpl.java

@@ -61,7 +61,7 @@ public class PersonDeviceFilterLogServiceImpl implements PersonDeviceFilterLogSe
     }
 
     @Override
-    public void deviceInsertFilterLog(String deviceNo, BigDecimal temperature, JSONObject faceImageJson, JSONObject libMatInfoListJson, JSONObject matchPersonInfo, Date date) {
+    public void deviceInsertFilterLog(String deviceNo, BigDecimal temperature, JSONObject faceImageJson, JSONObject libMatInfoListJson, JSONObject matchPersonInfo, Date date,Integer maskFlag) {
 
         try {
 
@@ -91,6 +91,7 @@ public class PersonDeviceFilterLogServiceImpl implements PersonDeviceFilterLogSe
             String recordTimeZons = DateUtil.format(date, "yyyy-MM-dd-HH-mm");
             String timeZones = TimeZonesUtil.getUpperTimeZone(recordTimeZons);
             Integer personId = LApiUtil.getPersonCode(libMatInfoListJson, matchPersonInfo);
+            LApiUtil lApiUtil = new LApiUtil();
             if (personId != 0 && temperature.compareTo(BigDecimal.ZERO) == 1) {
 
 
@@ -106,7 +107,7 @@ public class PersonDeviceFilterLogServiceImpl implements PersonDeviceFilterLogSe
 
                     if (StringUtils.isNotBlank(libMatInfoListJson.getStr("MatchStatus"))) {
                         personDeviceFilterLog.setMatchStatus(libMatInfoListJson.getInt("MatchStatus"));
-                        personDeviceFilterLog.setMatchMsg(LApiUtil.getMatchMsg(libMatInfoListJson.getInt("MatchStatus")));
+                        personDeviceFilterLog.setMatchMsg(lApiUtil.getMatchMsg(libMatInfoListJson.getInt("MatchStatus"),maskFlag,temperature,temperatureConfig));
                         personDeviceFilterLog.setMatchFaceId(libMatInfoListJson.getInt("MatchFaceID"));
                     } else {
                         personDeviceFilterLog.setMatchStatus(0);
@@ -130,7 +131,7 @@ public class PersonDeviceFilterLogServiceImpl implements PersonDeviceFilterLogSe
                     personDeviceFilterLog1.setTemperature(temperature);
                     if (StringUtils.isNotBlank(libMatInfoListJson.getStr("MatchStatus"))) {
                         personDeviceFilterLog1.setMatchStatus(libMatInfoListJson.getInt("MatchStatus"));
-                        personDeviceFilterLog1.setMatchMsg(LApiUtil.getMatchMsg(libMatInfoListJson.getInt("MatchStatus")));
+                        personDeviceFilterLog1.setMatchMsg(lApiUtil.getMatchMsg(libMatInfoListJson.getInt("MatchStatus"),maskFlag,temperature,temperatureConfig));
                         personDeviceFilterLog1.setMatchFaceId(libMatInfoListJson.getInt("MatchFaceID"));
                     } else {
                         personDeviceFilterLog1.setMatchStatus(0);

+ 7 - 2
common/src/main/java/com/jpsoft/smart/modules/base/service/impl/PersonDeviceLogServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.json.JSONObject;
 import com.github.pagehelper.Page;
 import com.github.pagehelper.PageHelper;
 import com.jpsoft.smart.config.OSSConfig;
+import com.jpsoft.smart.config.TemperatureConfig;
 import com.jpsoft.smart.config.WxConfig;
 import com.jpsoft.smart.modules.base.dao.*;
 import com.jpsoft.smart.modules.base.entity.*;
@@ -45,6 +46,9 @@ public class PersonDeviceLogServiceImpl implements PersonDeviceLogService {
     @Autowired
     private WxConfig wxConfig;
 
+    @Autowired
+    private TemperatureConfig temperatureConfig;
+
     @Autowired
     private WarningPusherService warningPusherService;
 
@@ -63,7 +67,7 @@ public class PersonDeviceLogServiceImpl implements PersonDeviceLogService {
 
 
     @Override
-    public void deviceInsertLog(String deviceNo, BigDecimal temperature, JSONObject faceImageJson, JSONObject libMatInfoListJson, JSONObject matchPersonInfo, Date date) {
+    public void deviceInsertLog(String deviceNo, BigDecimal temperature, JSONObject faceImageJson, JSONObject libMatInfoListJson, JSONObject matchPersonInfo, Date date,Integer maskFlag) {
         String retFileUrl = "";
         try {
 
@@ -93,9 +97,10 @@ public class PersonDeviceLogServiceImpl implements PersonDeviceLogService {
         personDeviceLog.setPersonId(personId);
 
         personDeviceLog.setTemperature(temperature);
+        LApiUtil lApiUtil = new LApiUtil();
         if (StringUtils.isNotBlank(libMatInfoListJson.getStr("MatchStatus"))) {
             personDeviceLog.setMatchStatus(libMatInfoListJson.getInt("MatchStatus"));
-            personDeviceLog.setMatchMsg(LApiUtil.getMatchMsg(libMatInfoListJson.getInt("MatchStatus")));
+            personDeviceLog.setMatchMsg(lApiUtil.getMatchMsg(libMatInfoListJson.getInt("MatchStatus"),maskFlag,temperature,temperatureConfig));
             personDeviceLog.setMatchFaceId(libMatInfoListJson.getInt("MatchFaceID"));
         } else {
             personDeviceLog.setMatchStatus(0);

+ 11 - 2
common/src/main/java/com/jpsoft/smart/modules/common/utils/LApiUtil.java

@@ -2,6 +2,7 @@ package com.jpsoft.smart.modules.common.utils;
 
 import cn.hutool.http.HttpRequest;
 import com.alibaba.fastjson.JSONObject;
+import com.jpsoft.smart.config.TemperatureConfig;
 import com.jpsoft.smart.modules.lapi.channel.LapiChannel;
 import io.netty.handler.codec.http.DefaultHttpRequest;
 import io.netty.handler.codec.http.HttpMethod;
@@ -24,6 +25,7 @@ import java.util.concurrent.TimeUnit;
 public class LApiUtil {
     private final static int TIMEOUT = 10*1000;
 
+
     public static JSONObject postRequest(String url, HashMap map){
         String body = HttpRequest.post(url)
                 .timeout(TIMEOUT)
@@ -114,7 +116,7 @@ public class LApiUtil {
         return dataJson.getJSONObject("Data");
     }
 
-    public static String getMatchMsg(Integer matchStatus){
+    public  String getMatchMsg(Integer matchStatus,Integer maskFlag,BigDecimal temperature,TemperatureConfig temperatureConfig){
         String matchMsg = "";
         if (matchStatus ==1){
             matchMsg = "核验成功";
@@ -130,7 +132,14 @@ public class LApiUtil {
         }
 
         else if (matchStatus == 10){
-            matchMsg = "对比成功,人脸属性异常";
+            if (temperature.compareTo(new BigDecimal(temperatureConfig.getMax())) ==1){
+                matchMsg = "对比成功,体温异常";
+            }else if (maskFlag == 1){
+                matchMsg = "对比成功,未戴口罩";
+            }else {
+                matchMsg = "对比成功,人脸属性异常";
+            }
+
         }
         else {
             matchMsg = "未知匹配消息";

+ 7 - 2
lapi/src/main/java/com/jpsoft/smart/lapi/handler/PersonVerificationHandler.java

@@ -42,6 +42,8 @@ public class PersonVerificationHandler extends SimpleChannelInboundHandler<Perso
         log.warn("人员记录");
         JSONObject jsonObject = personVerification.getJsonObject();
 
+        log.warn(jsonObject.toString());
+
         JSONObject faceJson = new JSONObject(jsonObject.getStr("FaceInfoList").substring(1,jsonObject.getStr("FaceInfoList").length()-1));
 
         Long timestamp = faceJson.getLong("Timestamp");
@@ -59,6 +61,9 @@ public class PersonVerificationHandler extends SimpleChannelInboundHandler<Perso
         //人员温度信息
         BigDecimal temperature = faceJson.getBigDecimal("Temperature");
 
+        //戴口罩状态(0:未开启口罩验证,1:未戴口罩,2:戴口罩)
+        Integer maskFlag = faceJson.getInt("MaskFlag");
+
         //人员抓拍信息
         JSONObject faceImageJson = faceJson.getJSONObject("FaceImage");
 
@@ -84,10 +89,10 @@ public class PersonVerificationHandler extends SimpleChannelInboundHandler<Perso
         log.warn(map.toString());
 
         //记录人员记录
-        personDeviceLogService.deviceInsertLog(deviceNo,temperature,faceImageJson,libMatInfoListJson,matchPersonInfo,date);
+        personDeviceLogService.deviceInsertLog(deviceNo,temperature,faceImageJson,libMatInfoListJson,matchPersonInfo,date,maskFlag);
 
         //记录人员过滤记录
-        personDeviceFilterLogService.deviceInsertFilterLog(deviceNo,temperature,faceImageJson,libMatInfoListJson,matchPersonInfo,date);
+        personDeviceFilterLogService.deviceInsertFilterLog(deviceNo,temperature,faceImageJson,libMatInfoListJson,matchPersonInfo,date,maskFlag);
 
         //记录考勤信息
         try {