🎨 添加默认时间,放开时间参数, 注释调整
This commit is contained in:
parent
fa704d791f
commit
d8d2e04b3b
|
@ -24,8 +24,15 @@ public class FaceInfoParam implements Serializable {
|
|||
*/
|
||||
private String faceURL;
|
||||
|
||||
/**
|
||||
* 人脸库类型 <br>
|
||||
* [blackFD#名单库,staticFD#静态库]
|
||||
*/
|
||||
private String faceLibType = "blackFD";
|
||||
|
||||
/**
|
||||
* 人脸库ID, 最大长度为63字节,多个人脸库用逗号隔开
|
||||
*/
|
||||
@JSONField(name = "FDID")
|
||||
private String FDID = "1";
|
||||
|
||||
|
|
|
@ -15,15 +15,31 @@ import java.io.Serializable;
|
|||
@Setter
|
||||
public class SearchFaceInfoParam implements Serializable {
|
||||
|
||||
/**
|
||||
* 搜索起始位置 默认从0开始
|
||||
*/
|
||||
private Integer searchResultPosition = 0;
|
||||
|
||||
/**
|
||||
* 本次查询条数, 单次搜索范围为1-500条, 设备默认返回1-500条
|
||||
*/
|
||||
private Integer maxResults = 30;
|
||||
|
||||
/**
|
||||
* 人脸库类型 <br>
|
||||
* [blackFD#名单库,staticFD#静态库]
|
||||
*/
|
||||
private String faceLibType = "blackFD";
|
||||
|
||||
/**
|
||||
* 人脸库ID, 最大长度为63字节,多个人脸库用逗号隔开
|
||||
*/
|
||||
@JSONField(name = "FDID")
|
||||
private String FDID = "1";
|
||||
|
||||
/**
|
||||
* 人员工号,以人为中心方式,下发人脸前需要先下发人员工号,人脸绑定在工号上
|
||||
*/
|
||||
@JSONField(name = "FPID")
|
||||
private String FPID;
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package net.javase.hksup.starter.model;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
@ -19,10 +16,23 @@ import java.util.List;
|
|||
@Builder
|
||||
public class UserInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* 工号 (人员ID)
|
||||
*/
|
||||
private String employeeNo;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 人员类型
|
||||
* <p>
|
||||
* [normal#普通人(主人),visitor#来宾(访客),blackList#黑名单人,maintenance#维护人员(包括保洁、维修人员 等),patient#病患]
|
||||
* <p>
|
||||
* 维护人员需要在任意时间都能进入房间
|
||||
*/
|
||||
@Builder.Default
|
||||
private String userType = "normal";
|
||||
|
||||
|
@ -36,22 +46,44 @@ public class UserInfo implements Serializable {
|
|||
@JSONField(name = "RightPlan")
|
||||
private List<RightPlan> rightPlan;
|
||||
|
||||
/**
|
||||
* 人脸图片对应的人员性别
|
||||
* <p>
|
||||
* [male#男,female#女,unknown#未知]
|
||||
*/
|
||||
@Builder.Default
|
||||
private String gender = "male";
|
||||
|
||||
/**
|
||||
* 是否关门延迟
|
||||
*/
|
||||
@Builder.Default
|
||||
private Boolean localUIRight = false;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class Valid {
|
||||
/**
|
||||
* ture有 有效期, false长期有效
|
||||
*/
|
||||
private Boolean enable = true;
|
||||
|
||||
/**
|
||||
* 有效期起始时间
|
||||
*/
|
||||
private String beginTime = "2023-01-01T00:00:00";
|
||||
|
||||
private String endTime = "2050-12-30T23:59:59";
|
||||
/**
|
||||
* 有效期结束时间
|
||||
*/
|
||||
private String endTime = "2037-12-31T23:59:59";
|
||||
|
||||
/**
|
||||
* 时间类型[local#设备本地时间,UTC#UTC时间]
|
||||
*/
|
||||
private String timeType = "local";
|
||||
|
||||
}
|
||||
|
@ -62,8 +94,17 @@ public class UserInfo implements Serializable {
|
|||
@AllArgsConstructor
|
||||
public static class RightPlan {
|
||||
|
||||
/**
|
||||
* 门编号(锁ID)
|
||||
*/
|
||||
private Integer doorNo;
|
||||
|
||||
/**
|
||||
* 计划模板编号
|
||||
* 同个门不同计划模板采用权限或的方式处理
|
||||
* <p>
|
||||
* 默认计划模板编号: 65535-7*24小时生效 | 65534-周一到周五24小时生效 | 65533-周六周日24小时生效
|
||||
*/
|
||||
private String planTemplateNo = "1";
|
||||
|
||||
public RightPlan(Integer doorNo) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.javase.hksup.starter.model;
|
|||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -17,8 +18,14 @@ import java.util.List;
|
|||
@Setter
|
||||
public class UserInfoDetail implements Serializable {
|
||||
|
||||
/**
|
||||
* 删除模式 <br> [all#删除所有,byEmployeeNo#按工号]
|
||||
*/
|
||||
private String mode;
|
||||
|
||||
/**
|
||||
* 人员ID列表
|
||||
*/
|
||||
@JSONField(name = "EmployeeNoList")
|
||||
private List<EmployeeNo> employeeNoList;
|
||||
|
||||
|
@ -27,6 +34,9 @@ public class UserInfoDetail implements Serializable {
|
|||
@AllArgsConstructor
|
||||
public static class EmployeeNo {
|
||||
|
||||
/**
|
||||
* 工号
|
||||
*/
|
||||
private String employeeNo;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,7 @@ import net.javase.hksup.starter.model.UserInfoDetail;
|
|||
import net.javase.hksup.starter.sdk.HCISUPCMS;
|
||||
import net.javase.hksup.starter.utils.SystemUtil;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
|
@ -37,6 +35,8 @@ public class CmsServer {
|
|||
|
||||
private CmsServerCallback callback = null;
|
||||
|
||||
private static final int DEFAULT_TIMEOUT = 5000;
|
||||
|
||||
public CmsServer(HkSupSdkProperties supSdkProperties, ApplicationContext applicationContext) {
|
||||
this.supSdkProperties = supSdkProperties;
|
||||
this.applicationContext = applicationContext;
|
||||
|
@ -49,7 +49,7 @@ public class CmsServer {
|
|||
*/
|
||||
private boolean createSDKInstance() {
|
||||
if (hciSupCms == null) {
|
||||
String libPath = libPath();
|
||||
String libPath = supSdkProperties.libPath();
|
||||
synchronized (HCISUPCMS.class) {
|
||||
String strDllPath = "";
|
||||
try {
|
||||
|
@ -79,7 +79,7 @@ public class CmsServer {
|
|||
throw new RuntimeException("Load CMS SDK fail!");
|
||||
}
|
||||
}
|
||||
String libPath = libPath();
|
||||
String libPath = supSdkProperties.libPath();
|
||||
if (SystemUtil.isWindows()) {
|
||||
HCISUPCMS.BYTE_ARRAY ptrByteArrayCrypto = new HCISUPCMS.BYTE_ARRAY(256);
|
||||
String strPathCrypto = libPath + "libeay32.dll"; //Linux版本是libcrypto.so库文件的路径
|
||||
|
@ -125,7 +125,7 @@ public class CmsServer {
|
|||
hciSupCms.NET_ECMS_SetSDKLocalCfg(5, ptrByteArrayCom.getPointer());
|
||||
|
||||
}
|
||||
hciSupCms.NET_ECMS_SetLogToFile(3, logPath(), false);
|
||||
hciSupCms.NET_ECMS_SetLogToFile(3, supSdkProperties.logPath(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -386,8 +386,9 @@ public class CmsServer {
|
|||
*
|
||||
* @param loginID 登录设备句柄ID
|
||||
* @param param 人脸数据
|
||||
* @param timeout 超时时间 单位ms
|
||||
*/
|
||||
public String addFacePicInfo(int loginID, FaceInfoParam param) {
|
||||
public String addFacePicInfo(int loginID, FaceInfoParam param, int timeout) {
|
||||
HCISUPCMS.NET_EHOME_PTXML_PARAM m_struParam2 = new HCISUPCMS.NET_EHOME_PTXML_PARAM();
|
||||
m_struParam2.read();
|
||||
//透传URL,不同功能对应不同的URL,完整协议报文说明需要参考ISAPI协议文档
|
||||
|
@ -415,7 +416,7 @@ public class CmsServer {
|
|||
HCISUPCMS.BYTE_ARRAY ptrOutByte2 = new HCISUPCMS.BYTE_ARRAY(iOutSize2);
|
||||
m_struParam2.pOutBuffer = ptrOutByte2.getPointer();
|
||||
m_struParam2.dwOutSize = iOutSize2;
|
||||
m_struParam2.dwRecvTimeOut = 5000; //接收超时时间,单位毫秒
|
||||
m_struParam2.dwRecvTimeOut = timeout;
|
||||
m_struParam2.write();
|
||||
if (!hciSupCms.NET_ECMS_ISAPIPassThrough(loginID, m_struParam2)) {
|
||||
log.info("下发门禁人脸失败,NET_ECMS_ISAPIPassThrough failed,error:{}", hciSupCms.NET_ECMS_GetLastError());
|
||||
|
@ -429,6 +430,27 @@ public class CmsServer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发门禁人脸图片数据 默认5s
|
||||
*
|
||||
* @param loginID 登录设备句柄ID
|
||||
* @param param 人脸数据
|
||||
* @return 响应结果
|
||||
*/
|
||||
public String addFacePicInfo(int loginID, FaceInfoParam param) {
|
||||
return addFacePicInfo(loginID, param, DEFAULT_TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发门禁人脸图片数据, 返回boolean结果
|
||||
*
|
||||
* @param loginID 登录设备句柄ID
|
||||
* @param param 人脸数据
|
||||
*/
|
||||
public boolean addFacePicInfoF(int loginID, FaceInfoParam param, int timeout) {
|
||||
return Optional.ofNullable(addFacePicInfo(loginID, param, timeout)).isPresent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发门禁人脸图片数据, 返回boolean结果
|
||||
*
|
||||
|
@ -436,7 +458,7 @@ public class CmsServer {
|
|||
* @param param 人脸数据
|
||||
*/
|
||||
public boolean addFacePicInfoF(int loginID, FaceInfoParam param) {
|
||||
return Optional.ofNullable(addFacePicInfo(loginID, param)).isPresent();
|
||||
return addFacePicInfoF(loginID, param, DEFAULT_TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -444,8 +466,10 @@ public class CmsServer {
|
|||
*
|
||||
* @param loginID 登录设备句柄ID
|
||||
* @param param 人脸数据
|
||||
* @param timeout 超时 单位ms
|
||||
* @return 响应内容
|
||||
*/
|
||||
public String modifyFacePicInfo(int loginID, FaceInfoParam param) {
|
||||
public String modifyFacePicInfo(int loginID, FaceInfoParam param, int timeout) {
|
||||
HCISUPCMS.NET_EHOME_PTXML_PARAM m_struParam2 = new HCISUPCMS.NET_EHOME_PTXML_PARAM();
|
||||
m_struParam2.read();
|
||||
// 透传URL,不同功能对应不同的URL,完整协议报文说明需要参考ISAPI协议文档
|
||||
|
@ -473,7 +497,7 @@ public class CmsServer {
|
|||
HCISUPCMS.BYTE_ARRAY ptrOutByte2 = new HCISUPCMS.BYTE_ARRAY(iOutSize2);
|
||||
m_struParam2.pOutBuffer = ptrOutByte2.getPointer();
|
||||
m_struParam2.dwOutSize = iOutSize2;
|
||||
m_struParam2.dwRecvTimeOut = 5000; //接收超时时间,单位毫秒
|
||||
m_struParam2.dwRecvTimeOut = timeout; //接收超时时间,单位毫秒
|
||||
m_struParam2.write();
|
||||
if (!hciSupCms.NET_ECMS_ISAPIPassThrough(loginID, m_struParam2)) {
|
||||
log.info("修改门禁人脸失败,NET_ECMS_ISAPIPassThrough failed,error:" + hciSupCms.NET_ECMS_GetLastError());
|
||||
|
@ -487,6 +511,27 @@ public class CmsServer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门禁人脸图片数据
|
||||
*
|
||||
* @param loginID 登录设备句柄ID
|
||||
* @param param 人脸数据
|
||||
* @return 响应内容
|
||||
*/
|
||||
public String modifyFacePicInfo(int loginID, FaceInfoParam param) {
|
||||
return modifyFacePicInfo(loginID, param, DEFAULT_TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门禁人脸图片数据, 返回boolean结果
|
||||
*
|
||||
* @param loginID 登录设备句柄ID
|
||||
* @param param 人脸数据
|
||||
*/
|
||||
public boolean modifyFacePicInfoF(int loginID, FaceInfoParam param, int timeout) {
|
||||
return Optional.ofNullable(modifyFacePicInfo(loginID, param, timeout)).isPresent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门禁人脸图片数据, 返回boolean结果
|
||||
*
|
||||
|
@ -494,7 +539,7 @@ public class CmsServer {
|
|||
* @param param 人脸数据
|
||||
*/
|
||||
public boolean modifyFacePicInfoF(int loginID, FaceInfoParam param) {
|
||||
return Optional.ofNullable(modifyFacePicInfo(loginID, param)).isPresent();
|
||||
return modifyFacePicInfoF(loginID, param, DEFAULT_TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -502,8 +547,9 @@ public class CmsServer {
|
|||
*
|
||||
* @param loginID 登录设备句柄ID
|
||||
* @param employeeNo 人员工号,按照指定人员删除关联人脸图片
|
||||
* @return 响应结果
|
||||
*/
|
||||
public String deleteFacePicInfo(int loginID, String employeeNo) {
|
||||
public String deleteFacePicInfo(int loginID, String employeeNo, int timeout) {
|
||||
HCISUPCMS.NET_EHOME_PTXML_PARAM m_struParam2 = new HCISUPCMS.NET_EHOME_PTXML_PARAM();
|
||||
m_struParam2.read();
|
||||
//透传URL,不同功能对应不同的URL,完整协议报文说明需要参考ISAPI协议文档
|
||||
|
@ -538,7 +584,7 @@ public class CmsServer {
|
|||
HCISUPCMS.BYTE_ARRAY ptrOutByte2 = new HCISUPCMS.BYTE_ARRAY(iOutSize2);
|
||||
m_struParam2.pOutBuffer = ptrOutByte2.getPointer();
|
||||
m_struParam2.dwOutSize = iOutSize2;
|
||||
m_struParam2.dwRecvTimeOut = 5000; //接收超时时间,单位毫秒
|
||||
m_struParam2.dwRecvTimeOut = timeout; //接收超时时间,单位毫秒
|
||||
m_struParam2.write();
|
||||
if (!hciSupCms.NET_ECMS_ISAPIPassThrough(loginID, m_struParam2)) {
|
||||
log.info("删除门禁人脸失败,NET_ECMS_ISAPIPassThrough failed,error:{}", hciSupCms.NET_ECMS_GetLastError());
|
||||
|
@ -552,6 +598,27 @@ public class CmsServer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除人脸图片数据
|
||||
*
|
||||
* @param loginID 登录设备句柄ID
|
||||
* @param employeeNo 人员工号,按照指定人员删除关联人脸图片
|
||||
* @return 响应结果
|
||||
*/
|
||||
public String deleteFacePicInfo(int loginID, String employeeNo) {
|
||||
return deleteFacePicInfo(loginID, employeeNo, DEFAULT_TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除人脸图片数据
|
||||
*
|
||||
* @param loginID 登录设备句柄ID
|
||||
* @param employeeNo 人员工号,按照指定人员删除关联人脸图片
|
||||
*/
|
||||
public boolean deleteFacePicInfoF(int loginID, String employeeNo, int timeout) {
|
||||
return Optional.ofNullable(deleteFacePicInfo(loginID, employeeNo, timeout)).isPresent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除人脸图片数据
|
||||
*
|
||||
|
@ -559,7 +626,7 @@ public class CmsServer {
|
|||
* @param employeeNo 人员工号,按照指定人员删除关联人脸图片
|
||||
*/
|
||||
public boolean deleteFacePicInfoF(int loginID, String employeeNo) {
|
||||
return Optional.ofNullable(deleteFacePicInfo(loginID, employeeNo)).isPresent();
|
||||
return deleteFacePicInfoF(loginID, employeeNo, DEFAULT_TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -567,8 +634,10 @@ public class CmsServer {
|
|||
*
|
||||
* @param loginID 登录设备句柄ID
|
||||
* @param employeeNo 人员工号,按照指定人员查询关联人脸图片
|
||||
* @param timeout 超时 单位ms
|
||||
* @return 响应结果
|
||||
*/
|
||||
public String searchFacePicInfo(int loginID, String employeeNo) {
|
||||
public String searchFacePicInfo(int loginID, String employeeNo, int timeout) {
|
||||
HCISUPCMS.NET_EHOME_PTXML_PARAM m_struParam2 = new HCISUPCMS.NET_EHOME_PTXML_PARAM();
|
||||
m_struParam2.read();
|
||||
//透传URL,不同功能对应不同的URL,完整协议报文说明需要参考ISAPI协议文档
|
||||
|
@ -612,26 +681,15 @@ public class CmsServer {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* lib根目录
|
||||
* 查询门禁人脸图片
|
||||
*
|
||||
* @param loginID 登录设备句柄ID
|
||||
* @param employeeNo 人员工号,按照指定人员查询关联人脸图片
|
||||
* @return 响应结果
|
||||
*/
|
||||
private String libPath() {
|
||||
String libPath = supSdkProperties.getLibPath();
|
||||
if (!StringUtils.hasText(libPath)) {
|
||||
return SystemUtil.userDir() + File.separator + "lib" + File.separator;
|
||||
}
|
||||
return libPath.endsWith(File.separator) ? libPath : libPath + File.separator;
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志根目录
|
||||
*/
|
||||
private String logPath() {
|
||||
String logPath = supSdkProperties.getSdkLogPath();
|
||||
return StringUtils.hasText(logPath) ?
|
||||
logPath :
|
||||
SystemUtil.userDir() + File.separator + "EHomeSDKLog";
|
||||
public String searchFacePicInfo(int loginID, String employeeNo) {
|
||||
return searchFacePicInfo(loginID, employeeNo, DEFAULT_TIMEOUT);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,10 +7,19 @@ package net.javase.hksup.starter.service;
|
|||
*/
|
||||
public interface CmsServerCallback {
|
||||
|
||||
/**
|
||||
* 启动前
|
||||
*/
|
||||
void preStart();
|
||||
|
||||
/**
|
||||
* 启动完成后
|
||||
*/
|
||||
void finishStart();
|
||||
|
||||
/**
|
||||
* 停止后
|
||||
*/
|
||||
void finishStop();
|
||||
|
||||
}
|
||||
|
|
|
@ -7,9 +7,7 @@ import net.javase.hksup.starter.sdk.HCISUPCMS;
|
|||
import net.javase.hksup.starter.sdk.HCISUPSS;
|
||||
import net.javase.hksup.starter.utils.SystemUtil;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -53,7 +51,7 @@ public class SsServer {
|
|||
* 根据不同操作系统选择不同的库文件和库路径
|
||||
*/
|
||||
private boolean createSDKInstance() {
|
||||
String libPath = libPath();
|
||||
String libPath = hkSupSdkProperties.libPath();
|
||||
if (hCEhomeSS == null) {
|
||||
synchronized (HCISUPSS.class) {
|
||||
String strDllPath = "";
|
||||
|
@ -81,7 +79,7 @@ public class SsServer {
|
|||
throw new RuntimeException("Load SS SDK fail");
|
||||
}
|
||||
}
|
||||
String libPath = libPath();
|
||||
String libPath = hkSupSdkProperties.libPath();
|
||||
if (SystemUtil.isWindows()) {
|
||||
String strPathCrypto = libPath + "libeay32.dll"; //Linux版本是libcrypto.so库文件的路径
|
||||
int iPathCryptoLen = strPathCrypto.getBytes().length;
|
||||
|
@ -165,7 +163,7 @@ public class SsServer {
|
|||
|
||||
}
|
||||
//启用SDK写日志
|
||||
boolean logToFile = hCEhomeSS.NET_ESS_SetLogToFile(3, logPath(), false);
|
||||
boolean logToFile = hCEhomeSS.NET_ESS_SetLogToFile(3, hkSupSdkProperties.logPath(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -353,25 +351,4 @@ public class SsServer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* lib根目录
|
||||
*/
|
||||
private String libPath() {
|
||||
String libPath = hkSupSdkProperties.getLibPath();
|
||||
if (!StringUtils.hasText(libPath)) {
|
||||
return SystemUtil.userDir() + File.separator + "lib" + File.separator;
|
||||
}
|
||||
return libPath.endsWith(File.separator) ? libPath : libPath + File.separator;
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志根目录
|
||||
*/
|
||||
private String logPath() {
|
||||
String logPath = hkSupSdkProperties.getSdkLogPath();
|
||||
return StringUtils.hasText(logPath) ?
|
||||
logPath :
|
||||
SystemUtil.userDir() + File.separator + "EHomeSDKLog";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user