|
|
@ -1129,23 +1129,29 @@ public class HikAccessControlServiceImpl implements IHikAccessControlService { |
|
|
|
/** |
|
|
|
* 调用设备事件 |
|
|
|
*/ |
|
|
|
public void getDeviceCase(String deviceSn,Date startTime,Date endTime) { |
|
|
|
public HikDevResponse getDeviceCase(String deviceSn,Date startTime,Date endTime,Integer dwMinor) { |
|
|
|
HikDevResponse result = new HikDevResponse(); |
|
|
|
Map<String,String> eventMap;// 储存事件信息的map
|
|
|
|
List<Map> list = new ArrayList<>(); |
|
|
|
// 调用获取设备事件长连接
|
|
|
|
HCNetSDK.NET_DVR_ACS_EVENT_COND struAcsEventCond = new HCNetSDK.NET_DVR_ACS_EVENT_COND(); |
|
|
|
struAcsEventCond.read(); |
|
|
|
struAcsEventCond.dwSize = struAcsEventCond.size(); |
|
|
|
struAcsEventCond.dwMajor = 5;// 5代表event事件
|
|
|
|
struAcsEventCond.dwMinor = 0x4b;// 代表刷脸成功
|
|
|
|
struAcsEventCond.dwMinor = dwMinor;// 代表刷脸成功
|
|
|
|
struAcsEventCond.struStartTime = NetDvrTimeUtil.getDvrStruTime(startTime);// ****必须要
|
|
|
|
struAcsEventCond.struEndTime = NetDvrTimeUtil.getDvrStruTime(endTime);// ***必须要
|
|
|
|
struAcsEventCond.write(); |
|
|
|
Pointer ptrStruEventCond = struAcsEventCond.getPointer(); |
|
|
|
Integer longUserId = this.dataCache.getInteger(DataCachePrefixConstant.HIK_REG_USERID + deviceSn); |
|
|
|
log.info(longUserId+""); |
|
|
|
log.info(HCNetSDK.NET_DVR_GET_ACS_EVENT+""); |
|
|
|
log.info(JSONObject.toJSONString(ptrStruEventCond)); |
|
|
|
log.info(JSONObject.toJSONString(struAcsEventCond.size())); |
|
|
|
Integer lHandle = this.hikDevService.NET_DVR_StartRemoteConfig(longUserId,HCNetSDK.NET_DVR_GET_ACS_EVENT,ptrStruEventCond,struAcsEventCond.size(),null,null); |
|
|
|
if (lHandle == -1){ |
|
|
|
System.out.println("建立获取设备事件长连接失败,错误码为"+this.hikDevService.NET_DVR_GetLastError()); |
|
|
|
return; |
|
|
|
return result; |
|
|
|
}else{ |
|
|
|
System.out.println("建立获取设备事件连接成功!"+lHandle); |
|
|
|
} |
|
|
@ -1180,11 +1186,14 @@ public class HikAccessControlServiceImpl implements IHikAccessControlService { |
|
|
|
break; |
|
|
|
}else if (dwState == HCNetSDK.NET_SDK_GET_NEXT_STATUS_SUCCESS){ |
|
|
|
// 获取设备事件成功
|
|
|
|
System.out.println("===============获取设备事件成功======================="); |
|
|
|
eventMap = new HashMap<>(16); |
|
|
|
eventMap.put("employeeNo",StringEncodingUtil.guessEncodingTransformString(struEventCFG.struAcsEventInfo.byEmployeeNo)); |
|
|
|
eventMap.put("cardNo",StringEncodingUtil.guessEncodingTransformString(struEventCFG.struAcsEventInfo.byCardNo)); |
|
|
|
eventMap.put("struTime",NetDvrTimeUtil.getDateStr(NetDvrTimeUtil.getDate(struEventCFG.struTime))); |
|
|
|
// eventList.add(eventMap);
|
|
|
|
// log.info(JSONObject.toJSONString(struEventCFG));
|
|
|
|
list.add(eventMap); |
|
|
|
continue; |
|
|
|
}else if(dwState == HCNetSDK.NET_SDK_NEXT_STATUS__FINISH) { |
|
|
|
// 获取设备事件信息完成
|
|
|
@ -1192,6 +1201,16 @@ public class HikAccessControlServiceImpl implements IHikAccessControlService { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(list.size()>0){ |
|
|
|
result.data(list); |
|
|
|
result.ok("设备事件获取成功!"); |
|
|
|
} |
|
|
|
|
|
|
|
if (!hikDevService.NET_DVR_StopRemoteConfig(lHandle)) { |
|
|
|
result.err("NET_DVR_StopRemoteConfig接口调用失败,错误码:" + hikDevService.NET_DVR_GetLastError()); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|