|
@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.sun.jna.Memory;
|
|
|
import com.sun.jna.Pointer;
|
|
|
import com.sun.jna.Structure;
|
|
|
import com.yihu.jw.care.dao.face.BaseDeviceFaceRecordDao;
|
|
|
import com.yihu.jw.care.dao.face.BaseDevicePatientFaceDao;
|
|
|
import com.yihu.jw.care.netdevsdk.lib.NetDEVSDKLib;
|
|
|
import com.yihu.jw.care.netdevsdk.lib.NetDEVSDKLib.NETDEV_DEVICE_TYPE_E;
|
|
|
import com.yihu.jw.care.netdevsdk.lib.NetDEVSDKLib.NETDEV_DEVICE_LOGIN_INFO_S;
|
|
@ -41,19 +43,24 @@ import com.yihu.jw.care.netdevsdk.lib.NetDEVSDKLib.NETDEV_ACS_ATTENDANCE_LOG_INF
|
|
|
import com.yihu.jw.care.netdevsdk.lib.NetDEVSDKLib.NETDEV_COMPARE_INFO_S;
|
|
|
import com.yihu.jw.care.netdevsdk.lib.NetDEVSDKLib.NETDEV_FACE_ATTR_S;
|
|
|
import com.yihu.jw.care.netdevsdk.util.Common;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.care.device.BaseDeviceFaceRecordDO;
|
|
|
import com.yihu.jw.entity.care.device.BaseDevicePatientFaceDO;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Profile;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import javax.swing.*;
|
|
|
import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.Vector;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 宇视人脸摄像头sdk
|
|
@ -62,8 +69,16 @@ import java.util.Vector;
|
|
|
@Service
|
|
|
public class NetDevSdkService {
|
|
|
|
|
|
@Autowired
|
|
|
private BaseDevicePatientFaceDao devicePatientFaceDao;
|
|
|
@Autowired
|
|
|
private BaseDeviceFaceRecordDao faceRecordDao;
|
|
|
@Autowired
|
|
|
private BasePatientDao patientDao;
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(NetDevSdkService.class);
|
|
|
|
|
|
// http://zhyzh.gongshu.gov.cn:3001/ 开vpn后可以本地调试
|
|
|
//IP:10.18.50.18 账号admin 密码Admin12345@ HTTP端口80 HTTPS端口 443 RTSP端口 554
|
|
|
private static final int dwPort = 80;//端口号 443
|
|
|
private static final String strUserName = "admin";//用户名
|
|
@ -277,6 +292,252 @@ public class NetDevSdkService {
|
|
|
NetDemo.dwPersonRecognizeMointerID = -1;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 同步人脸数据
|
|
|
*/
|
|
|
public void synPatientFaceRecords(){
|
|
|
List<BaseDevicePatientFaceDO> list = devicePatientFaceDao.findListByType(1);
|
|
|
for (BaseDevicePatientFaceDO faceDO:list){
|
|
|
try {
|
|
|
sysPatientFaceRecord(faceDO);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public String sysPatientFaceRecord(BaseDevicePatientFaceDO faceDO){
|
|
|
String endTime = "";
|
|
|
String idcard = faceDO.getIdcard();
|
|
|
String patient = faceDO.getPatient();
|
|
|
String name = faceDO.getName();
|
|
|
|
|
|
if(null == NetDemo.lpUserID){
|
|
|
return "未登录,请先登录";
|
|
|
}
|
|
|
if (StringUtils.isBlank(idcard)){
|
|
|
return "身份证不能为空";
|
|
|
}
|
|
|
do {
|
|
|
String startTime = faceDO.getSynTime();
|
|
|
if(StringUtils.isBlank(startTime)){
|
|
|
//第一次取当前时间的前30分钟数据
|
|
|
endTime = DateUtil.getStringDate();
|
|
|
startTime = DateUtil.getNextMinute(endTime, -30);
|
|
|
}else{
|
|
|
endTime = DateUtil.getNextMinute(startTime, 30);//采集30分钟后的数据
|
|
|
}
|
|
|
logger.info("startTime="+startTime+",endTime="+endTime);
|
|
|
NETDEV_ALARM_LOG_COND_LIST_S stFindCond = new NETDEV_ALARM_LOG_COND_LIST_S();
|
|
|
stFindCond.dwPageRow = 16;
|
|
|
stFindCond.dwFirstRow = 0;
|
|
|
|
|
|
stFindCond.dwCondSize = 5;
|
|
|
stFindCond.astCondition[0] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[1] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[2] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[3] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[4] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[0].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
|
|
|
stFindCond.astCondition[0].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_GREATER;
|
|
|
Common.stringToByteArray(String.valueOf(Common.date2TimeStamp(startTime, NetDemo.DateFormat)), stFindCond.astCondition[0].szConditionData); //NETDEV_ALARM_SMART_FACE_MATCH_LIST
|
|
|
stFindCond.astCondition[1].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
|
|
|
stFindCond.astCondition[1].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_NO_GREATER;
|
|
|
Common.stringToByteArray(String.valueOf(Common.date2TimeStamp(endTime, NetDemo.DateFormat)), stFindCond.astCondition[1].szConditionData); //NETDEV_ALARM_SMART_FACE_MATCH_LIST
|
|
|
stFindCond.astCondition[2].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
|
|
|
stFindCond.astCondition[2].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_DESC_ORDER;
|
|
|
Common.stringToByteArray("", stFindCond.astCondition[2].szConditionData);
|
|
|
|
|
|
stFindCond.astCondition[3].dwQueryType = 57;
|
|
|
stFindCond.astCondition[3].dwLogicFlag = 0;
|
|
|
//1表示匹配成功
|
|
|
Common.stringToByteArray("1", stFindCond.astCondition[3].szConditionData);
|
|
|
|
|
|
stFindCond.astCondition[4].dwQueryType = 58;
|
|
|
stFindCond.astCondition[4].dwLogicFlag = 0;
|
|
|
Common.stringToByteArray(idcard, stFindCond.astCondition[4].szConditionData);
|
|
|
|
|
|
|
|
|
NETDEV_SMART_ALARM_LOG_RESULT_INFO_S stResultInfo = new NETDEV_SMART_ALARM_LOG_RESULT_INFO_S();
|
|
|
boolean bRet = false;
|
|
|
while(true)
|
|
|
{
|
|
|
Pointer lpFindRecordHandlePointer = NetDemo.netdevsdk.NETDEV_FindFaceRecordDetailList(NetDemo.lpUserID, stFindCond, stResultInfo);
|
|
|
if(lpFindRecordHandlePointer != null)
|
|
|
{
|
|
|
while(true)
|
|
|
{
|
|
|
logger.info("人脸数据stFindCond.dwFirstRow:"+stFindCond.dwFirstRow);
|
|
|
NETDEV_FACE_RECORD_SNAPSHOT_INFO_S stRecordInfo = new NETDEV_FACE_RECORD_SNAPSHOT_INFO_S();
|
|
|
stRecordInfo.stCompareInfo = new NETDEV_FACE_ALARM_CMP_INFO_S();
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage = new NETDEV_FACE_ALARM_SNAP_IMAGE_S();
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stBigImage = new NETDEV_FILE_INFO_S();
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stBigImage.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stBigImage.udwSize = Common.NETDEMO_PICTURE_SIZE;
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage = new NETDEV_FILE_INFO_S();
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.udwSize = Common.NETDEMO_PICTURE_SIZE;
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stArea = new NETDEV_FACE_ALARM_IMAGE_AREA_S();
|
|
|
bRet = NetDemo.netdevsdk.NETDEV_FindNextFaceRecordDetail(lpFindRecordHandlePointer, stRecordInfo);
|
|
|
if(bRet == true)
|
|
|
{
|
|
|
String passTime = Common.timeStamp2Date(String.valueOf(stRecordInfo.udwPassTime),NetDemo.DateFormat);
|
|
|
String strTime = Common.getDate();
|
|
|
//nvr 没有大图 String strFileNameBig = NetDemo.strPicturePath + "_" + "PassTime_"+ stRecordInfo.udwPassTime + "_" + "_" + strTime +"BigImage.jpg";
|
|
|
String strFileNameSmall = NetDemo.strPicturePath + "_" + "PassTime_"+ stRecordInfo.udwPassTime + "_" + strTime +"SmallImage.jpg";
|
|
|
Common.savePicture(stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.pcData, stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.udwSize, strFileNameSmall);
|
|
|
BaseDeviceFaceRecordDO faceRecordDO = new BaseDeviceFaceRecordDO();
|
|
|
faceRecordDO.setPatient(patient);
|
|
|
faceRecordDO.setName(name);
|
|
|
faceRecordDO.setPassTime(passTime);
|
|
|
faceRecordDO.setCreateTime(new Date());
|
|
|
faceRecordDO.setImg(strFileNameSmall);
|
|
|
faceRecordDao.save(faceRecordDO);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
bRet = NetDemo.netdevsdk.NETDEV_FindCloseFaceRecordDetail(lpFindRecordHandlePointer);
|
|
|
if(bRet != true)
|
|
|
{
|
|
|
logger.info("关闭人脸记录详情失败:{}", NetDemo.netdevsdk.NETDEV_GetLastError());
|
|
|
}
|
|
|
if(stResultInfo.udwTotal <= stFindCond.dwFirstRow)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
stFindCond.dwFirstRow += stFindCond.dwPageRow;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
logger.info("查询结束");
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
faceDO.setSynTime(endTime);
|
|
|
devicePatientFaceDao.save(faceDO);
|
|
|
}while (endTime.compareTo(DateUtil.getNextMin(DateUtil.getStringDate(), -30))<0);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新人脸库人员数据
|
|
|
*/
|
|
|
public String updPatientFace(){
|
|
|
if(null == NetDemo.lpUserID){
|
|
|
return "未登录,请先登录";
|
|
|
}
|
|
|
|
|
|
Pointer pPersonLibHandle = NetDemo.netdevsdk.NETDEV_FindPersonLibList(NetDemo.lpUserID);
|
|
|
if(null == pPersonLibHandle){
|
|
|
return "获取人员库列表失败, "+NetDemo.netdevsdk.NETDEV_GetLastError();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
boolean bRet = false;
|
|
|
while(true)
|
|
|
{
|
|
|
NETDEV_LIB_INFO_S stPersonLibInfo = new NETDEV_LIB_INFO_S();
|
|
|
bRet = NetDemo.netdevsdk.NETDEV_FindNextPersonLibInfo(pPersonLibHandle, stPersonLibInfo);
|
|
|
if(false == bRet)
|
|
|
{
|
|
|
logger.info("获取下一个人员库列表失败:{}", NetDemo.netdevsdk.NETDEV_GetLastError());
|
|
|
break;
|
|
|
}
|
|
|
String szName = Common.byteArrayToString(stPersonLibInfo.szName);
|
|
|
NetDemo.mapPersonLib.put(szName, stPersonLibInfo);
|
|
|
logger.info("人脸信息--szName:"+Common.byteArrayToString(stPersonLibInfo.szName));
|
|
|
}
|
|
|
//关闭资源
|
|
|
bRet = NetDemo.netdevsdk.NETDEV_FindClosePersonLibList(pPersonLibHandle);
|
|
|
if(false == bRet)
|
|
|
{
|
|
|
return "关闭人脸库资源失败:"+ NetDemo.netdevsdk.NETDEV_GetLastError();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(NetDemo.mapPersonLib.size()==0){
|
|
|
return "人员库不存在";
|
|
|
}
|
|
|
|
|
|
for (NETDEV_LIB_INFO_S stPersonLibInfo: NetDemo.mapPersonLib.values()){
|
|
|
NETDEV_PERSON_QUERY_INFO_S stQueryInfo = new NETDEV_PERSON_QUERY_INFO_S();
|
|
|
stQueryInfo.udwNum = 0;
|
|
|
stQueryInfo.udwOffset = 0;
|
|
|
stQueryInfo.udwLimit = 16;
|
|
|
NETDEV_BATCH_OPERATE_BASIC_S stQueryResultInfo = new NETDEV_BATCH_OPERATE_BASIC_S();
|
|
|
boolean bRet = false;
|
|
|
while(true)
|
|
|
{
|
|
|
Pointer lpPersonFindHandle = NetDemo.netdevsdk.NETDEV_FindPersonInfoList(NetDemo.lpUserID, stPersonLibInfo.udwID, stQueryInfo, stQueryResultInfo);
|
|
|
if(lpPersonFindHandle == null || stQueryResultInfo.udwTotal == 0)
|
|
|
{
|
|
|
logger.info("获取人员列表失败:{}", NetDemo.netdevsdk.NETDEV_GetLastError());
|
|
|
break;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
stQueryInfo.udwOffset += stQueryInfo.udwLimit;
|
|
|
while(true)
|
|
|
{
|
|
|
NETDEV_PERSON_INFO_S stPersonInfo = new NETDEV_PERSON_INFO_S();
|
|
|
stPersonInfo.stRegionInfo = new NETDEV_REGION_INFO_S();
|
|
|
|
|
|
stPersonInfo.stImageInfo[0] = new NETDEV_IMAGE_INFO_S();
|
|
|
stPersonInfo.stImageInfo[0].stFileInfo = new NETDEV_FILE_INFO_S();
|
|
|
stPersonInfo.stImageInfo[0].stFileInfo.udwSize = 1048576;
|
|
|
stPersonInfo.stImageInfo[0].stFileInfo.pcData = new Memory(stPersonInfo.stImageInfo[0].stFileInfo.udwSize);
|
|
|
stPersonInfo.write();
|
|
|
bRet = NetDemo.netdevsdk.NETDEV_FindNextPersonInfo(lpPersonFindHandle, stPersonInfo);
|
|
|
if(bRet != true)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
String udwPersonID = stPersonInfo.udwPersonID+"";
|
|
|
String szPersonName = Common.byteArrayToString(stPersonInfo.szPersonName);
|
|
|
if(stPersonInfo.udwIdentificationNum > 0){
|
|
|
String szNumber = Common.byteArrayToString(stPersonInfo.stIdentificationInfo[0].szNumber);
|
|
|
BaseDevicePatientFaceDO faceDO = devicePatientFaceDao.findByIdcard(szNumber);
|
|
|
if(faceDO == null){
|
|
|
BasePatientDO patientDO = patientDao.findByIdcard(szNumber);
|
|
|
if(patientDO!=null){
|
|
|
faceDO = new BaseDevicePatientFaceDO();
|
|
|
faceDO.setFaceId(udwPersonID);
|
|
|
faceDO.setIdcard(szNumber);
|
|
|
faceDO.setType(1);
|
|
|
faceDO.setName(szPersonName);
|
|
|
faceDO.setCreateTime(new Date());
|
|
|
faceDO.setPatient(patientDO.getId());
|
|
|
devicePatientFaceDao.save(faceDO);
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
logger.info("人员没有身份证-- udwPersonID:"+udwPersonID
|
|
|
+",szPersonName:"+szPersonName);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//关闭资源
|
|
|
bRet = NetDemo.netdevsdk.NETDEV_FindClosePersonInfoList(lpPersonFindHandle);
|
|
|
if(bRet == false)
|
|
|
{
|
|
|
logger.info("关闭人员列表资源失败:{}", NetDemo.netdevsdk.NETDEV_GetLastError());
|
|
|
}
|
|
|
}
|
|
|
if(stQueryInfo.udwOffset >= stQueryResultInfo.udwTotal)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查找人员库
|
|
|
*/
|
|
@ -492,10 +753,13 @@ public class NetDevSdkService {
|
|
|
stFindCond.dwFirstRow = 0;
|
|
|
if(StringUtils.isBlank(getPersonPassAlarmSource))
|
|
|
{
|
|
|
stFindCond.dwCondSize = 3;
|
|
|
logger.info("没有告警源");
|
|
|
stFindCond.dwCondSize = 5;
|
|
|
stFindCond.astCondition[0] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[1] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[2] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[3] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[4] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[0].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
|
|
|
stFindCond.astCondition[0].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_NO_LESS;
|
|
|
Common.stringToByteArray(String.valueOf(Common.date2TimeStamp(strBeginTime, NetDemo.DateFormat)), stFindCond.astCondition[0].szConditionData); //NETDEV_ALARM_SMART_FACE_MATCH_LIST
|
|
@ -505,6 +769,14 @@ public class NetDevSdkService {
|
|
|
stFindCond.astCondition[2].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
|
|
|
stFindCond.astCondition[2].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_DESC_ORDER;
|
|
|
Common.stringToByteArray("", stFindCond.astCondition[2].szConditionData);
|
|
|
|
|
|
stFindCond.astCondition[3].dwQueryType = 57;
|
|
|
stFindCond.astCondition[3].dwLogicFlag = 0;
|
|
|
Common.stringToByteArray("1", stFindCond.astCondition[3].szConditionData);
|
|
|
|
|
|
stFindCond.astCondition[4].dwQueryType = 58;
|
|
|
stFindCond.astCondition[4].dwLogicFlag = 0;
|
|
|
Common.stringToByteArray("330103193303040742", stFindCond.astCondition[4].szConditionData);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@ -533,8 +805,10 @@ public class NetDevSdkService {
|
|
|
Pointer lpFindRecordHandlePointer = NetDemo.netdevsdk.NETDEV_FindFaceRecordDetailList(NetDemo.lpUserID, stFindCond, stResultInfo);
|
|
|
if(lpFindRecordHandlePointer != null)
|
|
|
{
|
|
|
|
|
|
while(true)
|
|
|
{
|
|
|
logger.info("人脸数据stFindCond.dwFirstRow:"+stFindCond.dwFirstRow);
|
|
|
NETDEV_FACE_RECORD_SNAPSHOT_INFO_S stRecordInfo = new NETDEV_FACE_RECORD_SNAPSHOT_INFO_S();
|
|
|
stRecordInfo.stCompareInfo = new NETDEV_FACE_ALARM_CMP_INFO_S();
|
|
|
stRecordInfo.stCompareInfo.stMemberInfo = new NETDEV_FACE_MEMBER_INFO_S();
|
|
@ -590,7 +864,136 @@ public class NetDevSdkService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 门禁查询出入记录
|
|
|
* 告警记录 //数据量较大,建议采用分页形式展示
|
|
|
* @param strBeginTime
|
|
|
*/
|
|
|
public static void queryAlarmRecord(String strBeginTime,String strEndTime,Integer monitorType) {
|
|
|
if(null == NetDemo.lpUserID)
|
|
|
{
|
|
|
logger.info("未登录,请先登录");
|
|
|
return;
|
|
|
}
|
|
|
if(false == Common.isValidDate(strBeginTime, NetDemo.DateFormat) ||false == Common.isValidDate(strEndTime,NetDemo.DateFormat))
|
|
|
{
|
|
|
logger.info("Please check that the time format is correct.");
|
|
|
return;
|
|
|
}
|
|
|
long get1=Common.date2TimeStamp(strBeginTime,NetDemo.DateFormat);
|
|
|
long get2=Common.date2TimeStamp(strEndTime, NetDemo.DateFormat);
|
|
|
if(get1>get2) {
|
|
|
logger.info(" Start time can not more than end time");
|
|
|
return;
|
|
|
}
|
|
|
NETDEV_ALARM_LOG_COND_LIST_S stFindCond = new NETDEV_ALARM_LOG_COND_LIST_S();
|
|
|
stFindCond.dwPageRow = 16;
|
|
|
stFindCond.dwFirstRow = 0;
|
|
|
stFindCond.dwCondSize = 4;
|
|
|
stFindCond.astCondition[0] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[1] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[2] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[3] = new NETDEV_QUERY_INFO_S();
|
|
|
stFindCond.astCondition[0].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_ALARMTYPE;
|
|
|
stFindCond.astCondition[0].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_EQUAL;
|
|
|
if(monitorType == 0)
|
|
|
{
|
|
|
Common.stringToByteArray("1018", stFindCond.astCondition[0].szConditionData); //NETDEV_ALARM_SMART_FACE_MATCH_LIST
|
|
|
}
|
|
|
else if(monitorType == 1)
|
|
|
{
|
|
|
Common.stringToByteArray("1020", stFindCond.astCondition[0].szConditionData); //NETDEV_ALARM_SMART_FACE_MISMATCH_LIST
|
|
|
}
|
|
|
stFindCond.astCondition[1].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
|
|
|
stFindCond.astCondition[1].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_NO_LESS;
|
|
|
Common.stringToByteArray(String.valueOf(Common.date2TimeStamp(strBeginTime, NetDemo.DateFormat)), stFindCond.astCondition[1].szConditionData);
|
|
|
|
|
|
stFindCond.astCondition[2].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
|
|
|
stFindCond.astCondition[2].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_NO_GREATER;
|
|
|
Common.stringToByteArray(String.valueOf(Common.date2TimeStamp(strEndTime, NetDemo.DateFormat)), stFindCond.astCondition[2].szConditionData);
|
|
|
|
|
|
stFindCond.astCondition[3].dwQueryType = NETDEV_QUERYCOND_TYPE_E.NETDEV_QUERYCOND_TIME;
|
|
|
stFindCond.astCondition[3].dwLogicFlag = NETDEV_QUERYCOND_LOGICTYPE_E.NETDEV_QUERYCOND_LOGIC_DESC_ORDER;
|
|
|
Common.stringToByteArray("", stFindCond.astCondition[3].szConditionData); //NETDEV_ALARM_SMART_FACE_MATCH_LIST
|
|
|
|
|
|
NETDEV_SMART_ALARM_LOG_RESULT_INFO_S stResultInfo = new NETDEV_SMART_ALARM_LOG_RESULT_INFO_S();
|
|
|
boolean bRet = false;
|
|
|
while(true)
|
|
|
{
|
|
|
logger.info("告警记录1");
|
|
|
Pointer lpFindRecordHandlePointer = NetDemo.netdevsdk.NETDEV_FindFaceRecordDetailList(NetDemo.lpUserID, stFindCond, stResultInfo);
|
|
|
if(lpFindRecordHandlePointer != null)
|
|
|
{
|
|
|
while(true)
|
|
|
{
|
|
|
logger.info("人脸数据1");
|
|
|
NETDEV_FACE_RECORD_SNAPSHOT_INFO_S stRecordInfo = new NETDEV_FACE_RECORD_SNAPSHOT_INFO_S();
|
|
|
stRecordInfo.stCompareInfo = new NETDEV_FACE_ALARM_CMP_INFO_S();
|
|
|
stRecordInfo.stCompareInfo.stMemberInfo = new NETDEV_FACE_MEMBER_INFO_S();
|
|
|
stRecordInfo.stCompareInfo.stMemberInfo.stMemberRegionInfo = new NETDEV_FACE_MEMBER_REGION_INFO_S();
|
|
|
stRecordInfo.stCompareInfo.stMemberInfo.stMemberIDInfo = new NETDEV_FACE_MEMBER_ID_INFO_S();
|
|
|
stRecordInfo.stCompareInfo.stMemberInfo.stMemberImageInfo = new NETDEV_FILE_INFO_S();
|
|
|
stRecordInfo.stCompareInfo.stMemberInfo.stMemberImageInfo.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
|
|
|
stRecordInfo.stCompareInfo.stMemberInfo.stMemberImageInfo.udwSize = Common.NETDEMO_PICTURE_SIZE;
|
|
|
stRecordInfo.stCompareInfo.stMemberInfo.stMemberSemiInfo = new NETDEV_FILE_INFO_S();
|
|
|
stRecordInfo.stCompareInfo.stMemberInfo.stMemberSemiInfo.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
|
|
|
stRecordInfo.stCompareInfo.stMemberInfo.stMemberSemiInfo.udwSize = Common.NETDEMO_PICTURE_SIZE;
|
|
|
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage = new NETDEV_FACE_ALARM_SNAP_IMAGE_S();
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stBigImage = new NETDEV_FILE_INFO_S();
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stBigImage.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stBigImage.udwSize = Common.NETDEMO_PICTURE_SIZE;
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage = new NETDEV_FILE_INFO_S();
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.udwSize = Common.NETDEMO_PICTURE_SIZE;
|
|
|
stRecordInfo.stCompareInfo.stSnapshotImage.stArea = new NETDEV_FACE_ALARM_IMAGE_AREA_S();
|
|
|
|
|
|
bRet = NetDemo.netdevsdk.NETDEV_FindNextFaceRecordDetail(lpFindRecordHandlePointer, stRecordInfo);
|
|
|
if(bRet == true)
|
|
|
{
|
|
|
String strTime = Common.getDate();
|
|
|
// if(NetDemo.jComboBoxDeviceType.getSelectedIndex() == 1)
|
|
|
// {
|
|
|
String strFileNameBig = NetDemo.strPicturePath + strTime +"BigImage.jpg";
|
|
|
NETDEV_FILE_INFO_S stFileInfo = new NETDEV_FILE_INFO_S();
|
|
|
stFileInfo.pcData = new Memory(Common.NETDEMO_PICTURE_SIZE);
|
|
|
stFileInfo.udwSize = Common.NETDEMO_PICTURE_SIZE;
|
|
|
bRet = NetDemo.netdevsdk.NETDEV_GetFaceRecordImageInfo(NetDemo.lpUserID, stRecordInfo.udwRecordID, 0, stFileInfo);
|
|
|
if(bRet == true)
|
|
|
{
|
|
|
Common.savePicture(stFileInfo.pcData, stFileInfo.udwSize, strFileNameBig);
|
|
|
}else {
|
|
|
System.out.printf("Get picture failed failed,error code"+NetDemo.netdevsdk.NETDEV_GetLastError());
|
|
|
}
|
|
|
// }
|
|
|
String strFileNameSmall = NetDemo.strPicturePath + strTime +"SmallImage.jpg";
|
|
|
Common.savePicture(stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.pcData, stRecordInfo.stCompareInfo.stSnapshotImage.stSmallImage.udwSize, strFileNameSmall);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
bRet = NetDemo.netdevsdk.NETDEV_FindCloseFaceRecordDetail(lpFindRecordHandlePointer);
|
|
|
if(bRet != true)
|
|
|
{
|
|
|
logger.info("NETDEV_FindCloseFaceRecordDetail failed:"+NetDemo.netdevsdk.NETDEV_GetLastError());
|
|
|
return;
|
|
|
}
|
|
|
if(stFindCond.dwFirstRow >= stResultInfo.udwTotal)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
stFindCond.dwFirstRow += stFindCond.dwPageRow;
|
|
|
}
|
|
|
else
|
|
|
{ String strPicPath = System.getProperty("user.dir").replaceAll("%20"," ") + File.separator +"Picture";
|
|
|
logger.info("Query ended.The path:"+strPicPath);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 门禁查询出入记录 对接设备没有门禁记录
|
|
|
*/
|
|
|
public void searchAccessRecords(String startTime,String endTime,String persionId) {
|
|
|
if(null == NetDemo.lpUserID)
|
|
@ -625,13 +1028,13 @@ public class NetDevSdkService {
|
|
|
Common.stringToByteArray(getendtTime, pstFindCond.astCondition[2].szConditionData);
|
|
|
|
|
|
logger.info("pstFindCond.astCondition.length:"+ pstFindCond.astCondition.length);
|
|
|
if(StringUtils.isNotBlank(persionId)){
|
|
|
//人员id
|
|
|
pstFindCond.astCondition[3]=new NETDEV_QUERY_INFO_S();
|
|
|
pstFindCond.astCondition[3].dwQueryType=79;
|
|
|
pstFindCond.astCondition[3].dwLogicFlag=0;
|
|
|
Common.stringToByteArray(persionId, pstFindCond.astCondition[3].szConditionData);
|
|
|
}
|
|
|
// if(StringUtils.isNotBlank(persionId)){
|
|
|
// //人员id
|
|
|
// pstFindCond.astCondition[3]=new NETDEV_QUERY_INFO_S();
|
|
|
// pstFindCond.astCondition[3].dwQueryType=79;
|
|
|
// pstFindCond.astCondition[3].dwLogicFlag=0;
|
|
|
// Common.stringToByteArray(persionId, pstFindCond.astCondition[3].szConditionData);
|
|
|
// }
|
|
|
|
|
|
NETDEV_BATCH_OPERATE_BASIC_S pstResultInfo=new NETDEV_BATCH_OPERATE_BASIC_S();
|
|
|
pstResultInfo.udwOffset=0;
|