|
|
|
@@ -133,18 +133,38 @@ public class DaHua implements IHardwareEquipment { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 添加或修改用户 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
|
|
|
|
public boolean addOrEditPersion(UserFaceInfo userFaceInfo){ |
|
|
|
this.login(info.getIp(),info.getPort(),info.getUsername(),info.getPassword()); |
|
|
|
//查询用户 |
|
|
|
String employeeNo = userFaceInfo.getEmployeeNo(); |
|
|
|
int recordNo = this.findRecordNo(employeeNo); |
|
|
|
if(recordNo != 0){//编辑 |
|
|
|
if(this.updateUserCard(userFaceInfo) && this.updateUserFace(employeeNo,userFaceInfo.getImageBytes())){ |
|
|
|
return true; |
|
|
|
} |
|
|
|
}else{//添加 |
|
|
|
if(this.addUserCard(userFaceInfo) && this.updateUserFace(employeeNo,userFaceInfo.getImageBytes())){ |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
this.logout(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 添加人脸 |
|
|
|
* @param userId |
|
|
|
* @param imageBytes |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public boolean addUserFace(String userId,byte[] imageBytes){ |
|
|
|
this.login(info.getIp(),info.getPort(),info.getUsername(),info.getPassword()); |
|
|
|
private boolean addUserFace(String userId,byte[] imageBytes){ |
|
|
|
Memory memory = ToolKits.readPictureBytes(imageBytes); |
|
|
|
boolean b = GateModule.addFaceInfo(userId, memory); |
|
|
|
//退出登录 |
|
|
|
this.logout(); |
|
|
|
return b; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -154,12 +174,9 @@ public class DaHua implements IHardwareEquipment { |
|
|
|
* @param imageBytes |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public boolean updateUserFace(String userId,byte[] imageBytes){ |
|
|
|
this.login(info.getIp(),info.getPort(),info.getUsername(),info.getPassword()); |
|
|
|
private boolean updateUserFace(String userId,byte[] imageBytes){ |
|
|
|
Memory memory = ToolKits.readPictureBytes(imageBytes); |
|
|
|
boolean b = GateModule.modifyFaceInfo(userId, memory); |
|
|
|
//退出登录 |
|
|
|
this.logout(); |
|
|
|
return b; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -168,7 +185,7 @@ public class DaHua implements IHardwareEquipment { |
|
|
|
* @param userFaceInfo |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public boolean addUserCard(UserFaceInfo userFaceInfo){ |
|
|
|
private boolean addUserCard(UserFaceInfo userFaceInfo){ |
|
|
|
String employeeNo = userFaceInfo.getEmployeeNo(); |
|
|
|
String employeeName = userFaceInfo.getEmployeeName(); |
|
|
|
String startTime = userFaceInfo.getStartTime(); |
|
|
|
@@ -176,8 +193,6 @@ public class DaHua implements IHardwareEquipment { |
|
|
|
String cardNo = userFaceInfo.getCardNo(); |
|
|
|
this.login(info.getIp(),info.getPort(),info.getUsername(),info.getPassword()); |
|
|
|
boolean b = GateModule.insertCard(cardNo, employeeNo, employeeName, "", 0, 0, 0, 0, 1, startTime, endTime); |
|
|
|
//退出登录 |
|
|
|
this.logout(); |
|
|
|
return b; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -186,7 +201,7 @@ public class DaHua implements IHardwareEquipment { |
|
|
|
* @param userFaceInfo |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public boolean updateUserCard(UserFaceInfo userFaceInfo){ |
|
|
|
private boolean updateUserCard(UserFaceInfo userFaceInfo){ |
|
|
|
|
|
|
|
String employeeNo = userFaceInfo.getEmployeeNo(); |
|
|
|
String employeeName = userFaceInfo.getEmployeeName(); |
|
|
|
@@ -198,8 +213,6 @@ public class DaHua implements IHardwareEquipment { |
|
|
|
int recordNo = this.findRecordNo(employeeNo); |
|
|
|
|
|
|
|
boolean b = GateModule.modifyCard(recordNo,cardNo, employeeNo, employeeName, "", 0, 0, 0, 0, 1, startTime, endTime); |
|
|
|
//退出登录 |
|
|
|
this.logout(); |
|
|
|
return b; |
|
|
|
} |
|
|
|
|
|
|
|
|