瀏覽代碼

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

zhengqiang 5 年之前
父節點
當前提交
7ac7699039

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

@@ -53,6 +53,17 @@ public class LApiUtil {
 
     }
 
+    public static JSONObject putRequest(String url){
+        String body = HttpRequest.put(url).execute().body();
+        JSONObject jsonbody = JSONObject.parseObject(body);
+        return jsonbody;
+    }
+
+    public static JSONObject putRequest(String url,HashMap map){
+        String body = HttpRequest.put(url).body(new JSONObject(map).toJSONString()).execute().body();
+        JSONObject jsonbody = JSONObject.parseObject(body);
+        return jsonbody;
+    }
 
 
 

+ 26 - 0
common/src/main/java/com/jpsoft/smart/modules/constant/LApiConstant.java

@@ -32,4 +32,30 @@ public class LApiConstant {
      */
     public static final String DELETEPERSON = "/LAPI/V1.0/PeopleLibraries/";
 
+    /**
+     * 远程开门
+     */
+    public static final String REMOTEOPENED = "/LAPI/V1.0/PACS/Controller/RemoteOpened";
+
+    /**
+     * 重启设备
+     */
+    public static final String REBOOT = "/LAPI/V1.0/System/Reboot";
+
+    /**
+     * 添加人脸库
+     */
+    public static final String ADDLIBRARY = "/LAPI/V1.0/PeopleLibraries/BasicInfo";
+
+    /**
+     * 删除人脸库
+     */
+    public static final String DELETELIBRARY = "/LAPI/V1.0/PeopleLibraries/";
+
+    /**
+     * 修改设备人脸库名称
+     */
+    public static final String UPDATALIBRARY = "/LAPI/V1.0/PeopleLibraries/BasicInfo";
+
+
 }

+ 58 - 1
common/src/main/java/com/jpsoft/smart/modules/lapi/service/ILapiService.java

@@ -1,8 +1,8 @@
 package com.jpsoft.smart.modules.lapi.service;
 
 import com.jpsoft.smart.modules.base.entity.DeviceInfo;
-import com.jpsoft.smart.modules.base.entity.PersonInfo;
 import com.jpsoft.smart.modules.lapi.vo.LapiMsgResult;
+import com.jpsoft.smart.modules.lapi.vo.LapiResult;
 
 import java.util.List;
 
@@ -51,5 +51,62 @@ public interface ILapiService {
      */
     List<LapiMsgResult> deletePerson(Long id) throws Exception;
 
+    /**
+     * 远程手机开门
+     * @param deviceInfoId
+     * @return
+     * @throws Exception
+     */
+    Boolean phoneOpenDoor(String deviceInfoId) throws Exception;
+
+
+    /**
+     * 重启设备
+     * @param deviceInfoId 设备id
+     * @return
+     */
+    Boolean reBoot(String deviceInfoId) throws Exception;
+
+
+    /**
+     * 添加公司照片库
+     * @param companyInfoId 公司id
+     * @param deviceInfoIds 设备id
+     * @return
+     * @throws Exception
+     */
+    List<LapiResult> addCompanyLib(String companyInfoId, String deviceInfoIds) throws Exception;
+
+
+    /**
+     * 删除公司人脸库
+     * @param deviceInfoId 设备id
+     * @param libraryId 人脸库id
+     * @return
+     * @throws Exception
+     */
+    LapiResult deleteCompanyLib(String deviceInfoId,String libraryId) throws Exception;
+
+
+    /**
+     * 更新公司人脸库名称
+     * @param companyId  公司id
+     * @param deviceInfoId
+     * @param libraryId
+     * @return
+     * @throws Exception
+     */
+    LapiResult updateCompanyLib(String companyId,String deviceInfoId,String libraryId) throws Exception;
+
+    /**
+     * 删除设备上的所有人脸库
+     * @param deviceInfoId
+     * @return
+     * @throws Exception
+     */
+    List<LapiResult> deleteDeviceAllCompanyLib(String deviceInfoId) throws Exception;
+
+
+
 
 }

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

@@ -14,10 +14,7 @@ import com.jpsoft.smart.modules.common.utils.LApiUtil;
 import com.jpsoft.smart.modules.common.utils.OSSUtil;
 import com.jpsoft.smart.modules.constant.LApiConstant;
 import com.jpsoft.smart.modules.lapi.service.ILapiService;
-import com.jpsoft.smart.modules.lapi.vo.AddPersonVo;
-import com.jpsoft.smart.modules.lapi.vo.IdentificationVo;
-import com.jpsoft.smart.modules.lapi.vo.ImageVo;
-import com.jpsoft.smart.modules.lapi.vo.LapiMsgResult;
+import com.jpsoft.smart.modules.lapi.vo.*;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -62,12 +59,12 @@ public class LapiServiceImpl implements ILapiService {
     }
 
     @Override
-    public Boolean keepAlive(String id) throws Exception{
+    public Boolean keepAlive(String id) throws Exception {
         DeviceInfo deviceInfo = deviceInfoService.get(id);
-        if (deviceInfo == null){
+        if (deviceInfo == null) {
             throw new Exception("设备未绑定");
         }
-        JSONObject jsonObject = LApiUtil.GetRequest(deviceInfo.getIpAddress()+":" + deviceInfo.getPort()+LApiConstant.KEEPALIVE);
+        JSONObject jsonObject = LApiUtil.GetRequest(deviceInfo.getIpAddress() + ":" + deviceInfo.getPort() + LApiConstant.KEEPALIVE);
         JSONObject dataJson = jsonObject.getJSONObject("Response");
         return true;
     }
@@ -76,67 +73,67 @@ public class LapiServiceImpl implements ILapiService {
     public List<LapiMsgResult> addPerson(Long id) throws Exception {
 
         PersonInfo personInfo = personInfoService.get(id);
-        if (personInfo == null){
+        if (personInfo == null) {
             throw new Exception("人员不存在");
         }
         List<PersonDeviceRelation> listRelation = personDeviceRelationService.findByPersonId(id);
-        if (listRelation.size()<=0){
+        if (listRelation.size() <= 0) {
             throw new Exception("人员未绑定设备");
         }
         CompanyInfo companyInfo = companyInfoService.get(personInfo.getCompanyId());
         List<DeviceInfo> deviceList = new ArrayList<>();
-        for (PersonDeviceRelation personDeviceRelation:listRelation){
+        for (PersonDeviceRelation personDeviceRelation : listRelation) {
             DeviceInfo deviceInfo = deviceInfoService.get(personDeviceRelation.getDeviceId());
-            if (deviceInfo!=null && !deviceInfo.getDelFlag()){
+            if (deviceInfo != null && !deviceInfo.getDelFlag()) {
                 deviceList.add(deviceInfo);
             }
         }
-        if (deviceList.size()<=0){
+        if (deviceList.size() <= 0) {
             throw new Exception("人员与设备绑定错误");
         }
         List<LapiMsgResult> lapiMsgResults = new ArrayList<>();
-        for (DeviceInfo deviceInfo : deviceList){
-            HashMap<String,Object> map = new HashMap<>();
-            map.put("Num",1L);
-            HashMap<String,Object> map1 = new HashMap<>();
-            map1.put("PersonID",personInfo.getId());
-            map1.put("LastChange",new Date().getTime());
-            map1.put("PersonCode",personInfo.getId().toString());
-            map1.put("PersonName",personInfo.getName()+"_"+personInfo.getId().toString());
-            map1.put("Remarks",companyInfo.getName());
+        for (DeviceInfo deviceInfo : deviceList) {
+            HashMap<String, Object> map = new HashMap<>();
+            map.put("Num", 1L);
+            HashMap<String, Object> map1 = new HashMap<>();
+            map1.put("PersonID", personInfo.getId());
+            map1.put("LastChange", new Date().getTime());
+            map1.put("PersonCode", personInfo.getId().toString());
+            map1.put("PersonName", personInfo.getName() + "_" + personInfo.getId().toString());
+            map1.put("Remarks", companyInfo.getName());
 
             //TimeTemplateNum 首字符必须大写
-            map1.put("TimeTemplateNum",0L);
+            map1.put("TimeTemplateNum", 0L);
 
-            map1.put("IdentificationNum",1L);
-            HashMap<String,Object> map2 = new HashMap<>();
+            map1.put("IdentificationNum", 1L);
+            HashMap<String, Object> map2 = new HashMap<>();
             List listMap2 = new ArrayList();
             listMap2.add(map2);
-            map2.put("Type",0L);
-            map2.put("Number",personInfo.getIdCard());
-            map1.put("IdentificationList",listMap2);
-            map1.put("ImageNum",1L);
-
-            HashMap<String,Object> map3 = new HashMap<>();
-            map3.put("FaceID",personInfo.getId());
-            map3.put("Name",personInfo.getId()+".jpg");
-            map3.put("Size",OSSUtil.downloadToBase64(personInfo.getFaceImageUrl()).length());
-            map3.put("Data",OSSUtil.downloadToBase64(personInfo.getFaceImageUrl()));
+            map2.put("Type", 0L);
+            map2.put("Number", personInfo.getIdCard());
+            map1.put("IdentificationList", listMap2);
+            map1.put("ImageNum", 1L);
+
+            HashMap<String, Object> map3 = new HashMap<>();
+            map3.put("FaceID", personInfo.getId());
+            map3.put("Name", personInfo.getId() + ".jpg");
+            map3.put("Size", OSSUtil.downloadToBase64(personInfo.getFaceImageUrl()).length());
+            map3.put("Data", OSSUtil.downloadToBase64(personInfo.getFaceImageUrl()));
             List listMap3 = new ArrayList();
             listMap3.add(map3);
-            map1.put("ImageList",listMap3);
+            map1.put("ImageList", listMap3);
             List listMap1 = new ArrayList();
             listMap1.add(map1);
-            map.put("PersonInfoList",listMap1);
+            map.put("PersonInfoList", listMap1);
 
 
-            try{
+            try {
                 //获取人员人脸库id
-                String faceDbId = getFaceDbId(deviceInfo,companyInfo.getName());
-                JSONObject jsonObject = LApiUtil.PostRequest(deviceInfo.getIpAddress()+":"+deviceInfo.getPort()+LApiConstant.ADDPERSON+faceDbId+"/People",map);
+                String faceDbId = getFaceDbId(deviceInfo, companyInfo.getName());
+                JSONObject jsonObject = LApiUtil.PostRequest(deviceInfo.getIpAddress() + ":" + deviceInfo.getPort() + LApiConstant.ADDPERSON + faceDbId + "/People", map);
                 JSONObject dataJson = jsonObject.getJSONObject("Response");
                 JSONObject response = LApiUtil.getResponse(dataJson);
-                if (dataJson.getInteger("ResponseCode") ==0 && dataJson.getInteger("StatusCode") == 0){
+                if (dataJson.getInteger("ResponseCode") == 0 && dataJson.getInteger("StatusCode") == 0) {
                     LapiMsgResult lapiMsgResult = new LapiMsgResult();
                     lapiMsgResult.setPersonName(personInfo.getName());
                     lapiMsgResult.setSuccess(true);
@@ -144,7 +141,7 @@ public class LapiServiceImpl implements ILapiService {
                     lapiMsgResults.add(lapiMsgResult);
                 }
 
-            }catch (Exception e){
+            } catch (Exception e) {
 
                 log.error(e.getMessage());
                 LapiMsgResult lapiMsgResult = new LapiMsgResult();
@@ -163,65 +160,65 @@ public class LapiServiceImpl implements ILapiService {
     }
 
     @Override
-    public String getFaceDbId(DeviceInfo deviceInfo, String companyName) throws Exception{
-        if (StringUtils.isBlank(companyName)){
+    public String getFaceDbId(DeviceInfo deviceInfo, String companyName) throws Exception {
+        if (StringUtils.isBlank(companyName)) {
             throw new Exception("公司名称为空");
         }
         String faceDbId = "";
-        JSONObject jsonObject = LApiUtil.GetRequest(deviceInfo.getIpAddress()+":" + deviceInfo.getPort()+LApiConstant.GETFACEDB);
+        JSONObject jsonObject = LApiUtil.GetRequest(deviceInfo.getIpAddress() + ":" + deviceInfo.getPort() + LApiConstant.GETFACEDB);
         JSONObject dataJson = jsonObject.getJSONObject("Response");
         JSONObject response = LApiUtil.getResponse(dataJson);
         List listData = response.getJSONArray("LibList");
-        if (listData.size()<=0){
+        if (listData.size() <= 0) {
             throw new Exception("设备没有配置人脸库");
         }
-        for (int i =0;i<listData.size();i++){
+        for (int i = 0; i < listData.size(); i++) {
             JSONObject jsonObject1 = (JSONObject) JSONArray.toJSON(listData.get(i));
             String name = jsonObject1.getString("Name");
-            if (StringUtils.isNotBlank(name) && companyName.equals(name)){
+            if (StringUtils.isNotBlank(name) && companyName.equals(name)) {
                 faceDbId = jsonObject1.getString("ID");
             }
         }
         //人员所属的公司库不存在,保存到默认库
-        if (StringUtils.isBlank(faceDbId)){
+        if (StringUtils.isBlank(faceDbId)) {
             faceDbId = deviceInfo.getDefaultFaceLibraryId();
         }
         return faceDbId;
     }
 
     @Override
-    public List<LapiMsgResult> deletePerson(Long id) throws Exception{
+    public List<LapiMsgResult> deletePerson(Long id) throws Exception {
 
         PersonInfo personInfo = personInfoService.get(id);
-        if (personInfo == null){
+        if (personInfo == null) {
             throw new Exception("人员不存在");
         }
         List<PersonDeviceRelation> listRelation = personDeviceRelationService.findByPersonId(id);
-        if (listRelation.size()<=0){
+        if (listRelation.size() <= 0) {
             throw new Exception("人员未绑定设备");
         }
         CompanyInfo companyInfo = companyInfoService.get(personInfo.getCompanyId());
         List<DeviceInfo> deviceList = new ArrayList<>();
-        for (PersonDeviceRelation personDeviceRelation:listRelation){
+        for (PersonDeviceRelation personDeviceRelation : listRelation) {
             DeviceInfo deviceInfo = deviceInfoService.get(personDeviceRelation.getDeviceId());
-            if (deviceInfo!=null && !deviceInfo.getDelFlag()){
+            if (deviceInfo != null && !deviceInfo.getDelFlag()) {
                 deviceList.add(deviceInfo);
             }
         }
-        if (deviceList.size()<=0){
+        if (deviceList.size() <= 0) {
             throw new Exception("人员与设备绑定错误");
         }
 
         List<LapiMsgResult> lapiMsgResults = new ArrayList<>();
-        for (DeviceInfo deviceInfo : deviceList){
+        for (DeviceInfo deviceInfo : deviceList) {
 
-            try{
+            try {
                 //获取人员人脸库id
-                String faceDbId = getFaceDbId(deviceInfo,companyInfo.getName());
-                JSONObject jsonObject = LApiUtil.DeletRequest(deviceInfo.getIpAddress()+":"+deviceInfo.getPort()+LApiConstant.DELETEPERSON+faceDbId+"/People/"+personInfo.getId()+"?LastChange="+new Date().getTime());
+                String faceDbId = getFaceDbId(deviceInfo, companyInfo.getName());
+                JSONObject jsonObject = LApiUtil.DeletRequest(deviceInfo.getIpAddress() + ":" + deviceInfo.getPort() + LApiConstant.DELETEPERSON + faceDbId + "/People/" + personInfo.getId() + "?LastChange=" + new Date().getTime());
                 JSONObject dataJson = jsonObject.getJSONObject("Response");
                 JSONObject response = LApiUtil.getResponse(dataJson);
-                if (dataJson.getInteger("ResponseCode") ==0 && dataJson.getInteger("StatusCode") == 0){
+                if (dataJson.getInteger("ResponseCode") == 0 && dataJson.getInteger("StatusCode") == 0) {
                     LapiMsgResult lapiMsgResult = new LapiMsgResult();
                     lapiMsgResult.setPersonName(personInfo.getName());
                     lapiMsgResult.setSuccess(true);
@@ -229,7 +226,7 @@ public class LapiServiceImpl implements ILapiService {
                     lapiMsgResults.add(lapiMsgResult);
                 }
 
-            }catch (Exception e){
+            } catch (Exception e) {
 
                 log.error(e.getMessage());
                 LapiMsgResult lapiMsgResult = new LapiMsgResult();
@@ -246,4 +243,205 @@ public class LapiServiceImpl implements ILapiService {
 
         return lapiMsgResults;
     }
+
+    @Override
+    public Boolean phoneOpenDoor(String deviceInfoId) throws Exception {
+        DeviceInfo deviceInfo = deviceInfoService.get(deviceInfoId);
+        if (deviceInfo == null) {
+            throw new Exception("设备不存在");
+        }
+        if (deviceInfo.getDelFlag()) {
+            throw new Exception("设备已删除");
+        }
+
+        JSONObject jsonObject = LApiUtil.putRequest(deviceInfo.getIpAddress() + ":" + deviceInfo.getPort() + LApiConstant.REMOTEOPENED);
+        JSONObject dataJson = jsonObject.getJSONObject("Response");
+        JSONObject response = LApiUtil.getResponse(dataJson);
+        return true;
+    }
+
+    @Override
+    public Boolean reBoot(String deviceInfoId) throws Exception {
+        DeviceInfo deviceInfo = deviceInfoService.get(deviceInfoId);
+        if (deviceInfo == null) {
+            throw new Exception("设备不存在");
+        }
+        if (deviceInfo.getDelFlag()) {
+            throw new Exception("设备已删除");
+        }
+        JSONObject jsonObject = LApiUtil.putRequest(deviceInfo.getIpAddress() + ":" + deviceInfo.getPort() + LApiConstant.REBOOT);
+        JSONObject dataJson = jsonObject.getJSONObject("Response");
+        JSONObject response = LApiUtil.getResponse(dataJson);
+        return true;
+    }
+
+    @Override
+    public List<LapiResult> addCompanyLib(String companyInfoId, String deviceInfoIds) throws Exception {
+        CompanyInfo companyInfo = companyInfoService.get(companyInfoId);
+        if (companyInfo == null) {
+            throw new Exception("公司不存在");
+        }
+        if (StringUtils.isBlank(deviceInfoIds)) {
+            throw new Exception("请选择设备");
+        }
+        List<String> idList = Arrays.asList(deviceInfoIds.split(","));
+        List<LapiResult> lapiResultList = new ArrayList<>();
+        for (String deviceInfoId : idList) {
+            DeviceInfo deviceInfo = deviceInfoService.get(deviceInfoId);
+            LapiResult lapiResult = new LapiResult();
+            try {
+                if (deviceInfo == null) {
+                    throw new Exception("设备不存在");
+                }
+                String companyLibId = getFaceDbId(deviceInfo, companyInfo.getName());
+                if (StringUtils.isNotBlank(companyLibId) && !companyLibId.equals(deviceInfo.getDefaultFaceLibraryId())) {
+                    throw new Exception("已有人脸库不可重复创建");
+                }
+                HashMap map = new HashMap();
+                map.put("BelongIndex", "");
+                map.put("LastChange", new Date().getTime());
+                map.put("MemberNum", 0);
+                map.put("Name", companyInfo.getName());
+                map.put("Type", 3);
+                JSONObject jsonObject = LApiUtil.PostRequest(deviceInfo.getIpAddress() + ":" + deviceInfo.getPort() + LApiConstant.ADDLIBRARY, map);
+                JSONObject dataJson = jsonObject.getJSONObject("Response");
+                JSONObject response = LApiUtil.getResponse(dataJson);
+                lapiResult.setMsg("添加成功");
+                lapiResult.setSuccess(true);
+                HashMap dataMap = new HashMap<>();
+                dataMap.put("CompanyId", companyInfoId);
+                dataMap.put("CompanyName", companyInfo.getName());
+                dataMap.put("LibraryId", response.getString("ID"));
+                lapiResult.setData(dataMap);
+
+            } catch (Exception e) {
+                log.error(e.getMessage());
+                lapiResult.setMsg(e.getMessage());
+                lapiResult.setSuccess(false);
+                lapiResult.setData("");
+            }
+
+            lapiResultList.add(lapiResult);
+
+
+        }
+
+
+        return lapiResultList;
+    }
+
+    @Override
+    public LapiResult deleteCompanyLib(String deviceInfoId, String libraryId) throws Exception {
+        if (StringUtils.isBlank(deviceInfoId)) {
+            throw new Exception("设备id为空");
+        }
+        if (StringUtils.isBlank(libraryId)) {
+            throw new Exception("人脸库id为空");
+        }
+        DeviceInfo deviceInfo = deviceInfoService.get(deviceInfoId);
+        if (deviceInfo == null) {
+            throw new Exception("设备不存在");
+        }
+
+        LapiResult lapiResult = new LapiResult();
+        try {
+            JSONObject jsonObject = LApiUtil.DeletRequest(deviceInfo.getIpAddress() + ":" + deviceInfo.getPort() + LApiConstant.DELETELIBRARY + libraryId);
+            JSONObject dataJson = jsonObject.getJSONObject("Response");
+            JSONObject response = LApiUtil.getResponse(dataJson);
+            lapiResult.setSuccess(true);
+            lapiResult.setMsg("删除成功");
+            lapiResult.setData("");
+        } catch (Exception e) {
+            lapiResult.setMsg(e.getMessage());
+            lapiResult.setSuccess(false);
+            lapiResult.setData("");
+        }
+
+
+        return lapiResult;
+    }
+
+    @Override
+    public LapiResult updateCompanyLib(String companyId, String deviceInfoId, String libraryId) throws Exception {
+        if (StringUtils.isBlank(companyId)) {
+            throw new Exception("公司id为空");
+        }
+        CompanyInfo companyInfo = companyInfoService.get(companyId);
+        if (companyInfo == null) {
+            throw new Exception("公司不存在");
+        }
+        if (StringUtils.isBlank(deviceInfoId)) {
+            throw new Exception("设备id为空");
+        }
+        if (StringUtils.isBlank(libraryId)) {
+            throw new Exception("人脸库id为空");
+        }
+        DeviceInfo deviceInfo = deviceInfoService.get(deviceInfoId);
+        if (deviceInfo == null) {
+            throw new Exception("设备不存在");
+        }
+        HashMap map = new HashMap();
+        map.put("Num", 1);
+        List list = new ArrayList();
+        HashMap map1 = new HashMap();
+        map1.put("ID", libraryId);
+        map1.put("LastChange", new Date().getTime());
+        map1.put("Name", companyInfo.getName());
+        map1.put("Type", 3);
+        map1.put("BelongIndex", "");
+        list.add(map1);
+        map.put("LibList", list);
+        JSONObject jsonObject = LApiUtil.putRequest(deviceInfo.getIpAddress() + ":" + deviceInfo.getPort() + LApiConstant.UPDATALIBRARY, map);
+        JSONObject dataJson = jsonObject.getJSONObject("Response");
+        JSONObject response = LApiUtil.getResponse(dataJson);
+
+        HashMap dataMap = new HashMap<>();
+        dataMap.put("deviceId", deviceInfo.getId());
+        dataMap.put("deviceName", deviceInfo.getAliasName());
+        LapiResult lapiResult = new LapiResult();
+        lapiResult.setSuccess(true);
+        lapiResult.setMsg("更新成功");
+        lapiResult.setData(dataMap);
+        return lapiResult;
+    }
+
+    @Override
+    public List<LapiResult> deleteDeviceAllCompanyLib(String deviceInfoId) throws Exception {
+        if (StringUtils.isBlank(deviceInfoId)) {
+            throw new Exception("设备id为空");
+        }
+        DeviceInfo deviceInfo = deviceInfoService.get(deviceInfoId);
+        if (deviceInfo == null) {
+            throw new Exception("设备不存在");
+        }
+        JSONObject jsonObject = LApiUtil.GetRequest(deviceInfo.getIpAddress() + ":" + deviceInfo.getPort() + LApiConstant.UPDATALIBRARY);
+        JSONObject dataJson = jsonObject.getJSONObject("Response");
+        JSONObject response = LApiUtil.getResponse(dataJson);
+        List<LibraryVo> list = JSONObject.parseArray(response.getString("LibList"), LibraryVo.class);
+        if (list.size() <= 0) {
+            throw new Exception("设备没有配置人员库");
+        }
+        List<LapiResult> lapiResultList = new ArrayList<>();
+        for (LibraryVo libraryVo : list) {
+            LapiResult lapiResult = new LapiResult();
+            try {
+                JSONObject jsonObject1 = LApiUtil.DeletRequest(deviceInfo.getIpAddress() + ":" + deviceInfo.getPort() + LApiConstant.DELETELIBRARY + libraryVo.getID());
+                JSONObject dataJson1 = jsonObject1.getJSONObject("Response");
+                JSONObject response1 = LApiUtil.getResponse(dataJson1);
+                lapiResult.setSuccess(true);
+                lapiResult.setMsg("删除成功");
+                lapiResult.setData("");
+            } catch (Exception e) {
+                lapiResult.setMsg(e.getMessage());
+                lapiResult.setSuccess(false);
+                lapiResult.setData("");
+            }
+            lapiResultList.add(lapiResult);
+        }
+
+
+        return lapiResultList;
+    }
+
+
 }

+ 16 - 0
common/src/main/java/com/jpsoft/smart/modules/lapi/vo/LapiResult.java

@@ -0,0 +1,16 @@
+package com.jpsoft.smart.modules.lapi.vo;
+
+import lombok.Data;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2020-3-18 11:01
+ */
+@Data
+public class LapiResult {
+    private String msg;
+
+    private boolean success;
+
+    private Object data;
+}

+ 27 - 0
common/src/main/java/com/jpsoft/smart/modules/lapi/vo/LibraryVo.java

@@ -0,0 +1,27 @@
+package com.jpsoft.smart.modules.lapi.vo;
+
+import lombok.Data;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2020-3-18 13:57
+ */
+@Data
+public class LibraryVo {
+
+    private Long ID;
+
+    private Integer Type;
+
+    private Long PersonNum;
+
+    private Long MemberNum;
+
+    private Long FaceNum;
+
+    private Long LaseChange;
+
+    private String name;
+
+    private String BelongIndex;
+}

+ 72 - 0
web/src/test/java/com/jpsoft/smart/LApiTest.java

@@ -3,6 +3,7 @@ package com.jpsoft.smart;
 import com.jpsoft.smart.modules.base.entity.DeviceInfo;
 import com.jpsoft.smart.modules.lapi.service.ILapiService;
 import com.jpsoft.smart.modules.lapi.vo.LapiMsgResult;
+import com.jpsoft.smart.modules.lapi.vo.LapiResult;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -75,4 +76,75 @@ public class LApiTest {
 
     }
 
+    @Test
+    public void testRemoteOpened(){
+        try {
+            Boolean success = lapiService.phoneOpenDoor("4b40b1e3-57b9-4119-828e-9d42d56e5b57");
+            System.out.println(success);
+        } catch (Exception e) {
+            e.printStackTrace();
+            String message = e.getMessage();
+        }
+
+    }
+
+    @Test
+    public void testReBoot(){
+        try {
+            Boolean success = lapiService.phoneOpenDoor("4b40b1e3-57b9-4119-828e-9d42d56e5b57");
+            System.out.println(success);
+        } catch (Exception e) {
+            e.printStackTrace();
+            String message = e.getMessage();
+        }
+
+    }
+
+    @Test
+    public void testAddLibrary(){
+        try {
+            List<LapiResult> list = lapiService.addCompanyLib("c6083ba7-6025-11ea-9760-f0761c318e91","4b40b1e3-57b9-4119-828e-9d42d56e5b57");
+            System.out.println(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+            String message = e.getMessage();
+        }
+
+    }
+
+    @Test
+    public void testDeleteLibrary(){
+        try {
+            LapiResult lapiResult = lapiService.deleteCompanyLib("4b40b1e3-57b9-4119-828e-9d42d56e5b57","1584502940");
+            System.out.println(lapiResult);
+        } catch (Exception e) {
+            e.printStackTrace();
+            String message = e.getMessage();
+        }
+
+    }
+    @Test
+    public void testUpdateCompanyLib(){
+        try {
+            LapiResult lapiResult = lapiService.updateCompanyLib("c6083ba7-6025-11ea-9760-f0761c318e91","4b40b1e3-57b9-4119-828e-9d42d56e5b57","1584429125");
+            System.out.println(lapiResult);
+        } catch (Exception e) {
+            e.printStackTrace();
+            String message = e.getMessage();
+        }
+
+    }
+
+    @Test
+    public void testDeleteDeviceAllCompanyLib(){
+        try {
+            List<LapiResult> list = lapiService.deleteDeviceAllCompanyLib("4b40b1e3-57b9-4119-828e-9d42d56e5b57");
+            System.out.println(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+            String message = e.getMessage();
+        }
+
+    }
+
 }