Просмотр исходного кода

增加大华设备对接

Signed-off-by: haidong <chenloveguitar@qq.com>
doorRight设置
haidong 2 лет назад
Родитель
Сommit
775119758e
1 измененных файлов: 24 добавлений и 1 удалений
  1. +24
    -1
      src/main/java/com/yzx/impl/DaHua.java

+ 24
- 1
src/main/java/com/yzx/impl/DaHua.java Просмотреть файл

@@ -95,6 +95,7 @@ public class DaHua implements IHardwareEquipment {
boolean ret = LoginModule.netsdk.CLIENT_ControlDeviceEx(info.getLoginHandle(),
NetSDKLib.CtrlType.CTRLTYPE_CTRL_ACCESS_OPEN, pointer, null, 10000);
if (!ret) {
System.err.println("开门失败!" + ToolKits.getErrorCodePrint());
return false;
}
@@ -227,6 +228,8 @@ public class DaHua implements IHardwareEquipment {
if(recordNo != 0){
if(GateModule.deleteCardV2(info.getLoginHandle(),recordNo) && GateModule.deleteFaceInfoV2(info.getLoginHandle(),employeeNo)){
return true;
}else{
System.err.println("删除人员失败!" + ToolKits.getErrorCodePrint());
}
}
@@ -242,6 +245,9 @@ public class DaHua implements IHardwareEquipment {
private boolean addUserFace(String userId,byte[] imageBytes){
Memory memory = ToolKits.readPictureBytes(imageBytes);
boolean b = GateModule.addFaceInfoV2(info.getLoginHandle(),userId, memory);
if(!b){
System.err.println("添加人脸失败!" + ToolKits.getErrorCodePrint());
}
return b;
}

@@ -254,6 +260,9 @@ public class DaHua implements IHardwareEquipment {
private boolean updateUserFace(String userId,byte[] imageBytes){
Memory memory = ToolKits.readPictureBytes(imageBytes);
boolean b = GateModule.modifyFaceInfoV2(info.getLoginHandle(),userId, memory);
if(!b){
System.err.println("更新人脸失败!" + ToolKits.getErrorCodePrint());
}
return b;
}

@@ -269,7 +278,9 @@ public class DaHua implements IHardwareEquipment {
String endTime = userFaceInfo.getEndTime();
String cardNo = userFaceInfo.getCardNo();
boolean b = GateModule.insertCardV2(info.getLoginHandle(),cardNo, employeeNo, employeeName, "", 0, 0, 0, 0, 1, startTime, endTime);

if(!b){
System.err.println("添加用户卡失败!" + ToolKits.getErrorCodePrint());
}
return b;
}

@@ -288,6 +299,9 @@ public class DaHua implements IHardwareEquipment {
int recordNo = this.findRecordNo(employeeNo);

boolean b = GateModule.modifyCardV2(info.getLoginHandle(),recordNo,cardNo, employeeNo, employeeName, "", 0, 0, 0, 0, 1, startTime, endTime);
if(!b){
System.err.println("更新用户卡失败!" + ToolKits.getErrorCodePrint());
}
return b;
}

@@ -298,6 +312,7 @@ public class DaHua implements IHardwareEquipment {
NetSDKLib.LLong findHandle = GateModule.findCardV2(this.info.getLoginHandle(), "", employeeNo);
this.info.setFindHandle(findHandle);
if(findHandle.longValue() == 0) {
System.err.println("获取用户卡查询句柄失败!" + ToolKits.getErrorCodePrint());
return 0;
}

@@ -305,6 +320,7 @@ public class DaHua implements IHardwareEquipment {
while(true) {
NetSDKLib.NET_RECORDSET_ACCESS_CTL_CARD[] pstRecord = GateModule.findNextCardV2(this.info.getFindHandle(),nFindCount);
if(pstRecord == null) {
System.err.println("查询用户卡失败!" + ToolKits.getErrorCodePrint());
break;
}

@@ -332,6 +348,7 @@ public class DaHua implements IHardwareEquipment {
NetSDKLib.LLong findHandle = GateModule.findCardV2(this.info.getLoginHandle(), "", "");
this.info.setFindHandle(findHandle);
if(findHandle.longValue() == 0) {
System.err.println("获取用户卡查询句柄失败!" + ToolKits.getErrorCodePrint());
return userFaceInfoList;
}

@@ -339,6 +356,7 @@ public class DaHua implements IHardwareEquipment {
while(true) {
NetSDKLib.NET_RECORDSET_ACCESS_CTL_CARD[] pstRecord = GateModule.findNextCardV2(this.info.getFindHandle(),nFindCount);
if(pstRecord == null) {
System.err.println("查询用户卡失败!" + ToolKits.getErrorCodePrint());
break;
}

@@ -370,6 +388,8 @@ public class DaHua implements IHardwareEquipment {
public boolean clearAllPerson(){
if(GateModule.clearCardV2(this.info.getLoginHandle()) && GateModule.clearFaceInfoV2(this.info.getLoginHandle())){
return true;
}else{
System.err.println("清除所有用户数据失败!" + ToolKits.getErrorCodePrint());
}
return false;
@@ -380,6 +400,9 @@ public class DaHua implements IHardwareEquipment {
public boolean login() {
NetSDKLib.LLong lLong = LoginModule.login2(info.getIp(),info.getPort(),info.getUsername(),info.getPassword());
this.info.setLoginHandle(lLong);
if(lLong.longValue() == 0){
System.err.println("登录失败!" + ToolKits.getErrorCodePrint());
}
return true;
}



Загрузка…
Отмена
Сохранить