Ver código fonte

Merge remote-tracking branch 'origin/V1' into V1

xiao547607 5 anos atrás
pai
commit
44e6c26dbc

+ 7 - 0
common/src/main/java/com/jpsoft/smart/modules/lapi/service/ILapiService.java

@@ -138,6 +138,13 @@ public interface ILapiService {
      */
     Boolean isSuccessAddPerson(PersonInfo personInfo, DeviceInfo deviceInfo, String faceDbId);
 
+    /**
+     * 人员是否成功写入设备
+     * @param
+     * @return
+     */
+    Boolean isPersonImageExist(PersonInfo personInfo, DeviceInfo deviceInfo, String faceDbId);
+
     /**
      * 获取设备的验证规则
      * @param deviceInfoId

+ 42 - 0
common/src/main/java/com/jpsoft/smart/modules/lapi/service/impl/LapiServiceImpl.java

@@ -1,5 +1,6 @@
 package com.jpsoft.smart.modules.lapi.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.google.gson.JsonObject;
@@ -787,6 +788,47 @@ public class LapiServiceImpl implements ILapiService {
         return false;
     }
 
+    @Override
+    public Boolean isPersonImageExist(PersonInfo personInfo, DeviceInfo deviceInfo, String faceDbId) {
+        HashMap map = new HashMap();
+        map.put("Num", 1);
+        map.put("Limit", 3);
+        map.put("Offset", 0);
+        List list = new ArrayList();
+        HashMap map1 = new HashMap();
+        map1.put("QryType", 27);
+        map1.put("QryCondition", 0);
+        map1.put("QryData", personInfo.getId().toString());
+        list.add(map1);
+        map.put("QueryInfos", list);
+        try {
+
+            JSONObject jsonObject = lapiRequest.send(deviceInfo.getDeviceNo(),LApiConstant.ADDPERSON + faceDbId + "/People/Info",HttpMethod.POST, map);
+
+            JSONObject dataJson = jsonObject.getJSONObject("Response");
+            JSONObject response = LApiUtil.getResponse(dataJson);
+            Integer num = response.getInteger("Total");
+            if (num > 0) {
+                JSONObject personList = response.getJSONObject("PersonList");
+
+                JSONArray personInfoList = personList.getJSONArray("PersonInfoList");
+                Map map2 = (Map) personInfoList.get(0);
+
+                Integer imageNum = (Integer) map2.get("ImageNum");
+                if (imageNum>0){
+                    return true;
+                }
+
+            }
+        } catch (Exception e) {
+
+            return false;
+        }
+
+
+        return false;
+    }
+
     @Override
     public Map<String, Object> getDeviceRule(String deviceInfoId) throws Exception {
 

+ 1 - 1
web/src/main/java/com/jpsoft/smart/modules/wechat/controller/WxCpController.java

@@ -7,7 +7,6 @@ import lombok.extern.slf4j.Slf4j;
 import me.chanjar.weixin.cp.api.WxCpService;
 import me.chanjar.weixin.cp.bean.WxCpXmlMessage;
 import me.chanjar.weixin.cp.bean.WxCpXmlOutMessage;
-import me.chanjar.weixin.cp.bean.WxCpXmlOutTextMessage;
 import me.chanjar.weixin.cp.util.crypto.WxCpCryptUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +25,7 @@ public class WxCpController {
     @Autowired
     private WxCpConfig wxCpConfig;
 
+
     @ApiOperation(value = "验证服务器地址的有效性")
     @GetMapping(produces = "text/plain;charset=utf-8")
     @ResponseBody