|
@@ -61,6 +61,7 @@ public final class EventSearch {
|
|
|
@Nullable
|
|
|
public static List<Object> searchAllEvent(int lUserID , AdminUserService adminUserService, StudentAttendanceService studentAttendanceService, FileApi fileApi) throws UnsupportedEncodingException, InterruptedException {
|
|
|
int i = 0; //事件条数
|
|
|
+ int previousI = -1;
|
|
|
HCNetSDK.NET_DVR_ACS_EVENT_COND struAcsEventCond = new HCNetSDK.NET_DVR_ACS_EVENT_COND();
|
|
|
struAcsEventCond.read();
|
|
|
struAcsEventCond.dwSize = struAcsEventCond.size();
|
|
@@ -76,9 +77,9 @@ public final class EventSearch {
|
|
|
struAcsEventCond.struStartTime.dwMinute = 0;
|
|
|
struAcsEventCond.struStartTime.dwSecond = 0;
|
|
|
//结束时间
|
|
|
- struAcsEventCond.struEndTime.dwYear = yesterday.getYear();;
|
|
|
- struAcsEventCond.struEndTime.dwMonth = yesterday.getMonthValue();
|
|
|
- struAcsEventCond.struEndTime.dwDay = yesterday.getDayOfMonth();
|
|
|
+ struAcsEventCond.struEndTime.dwYear = LocalDate.now().getYear();
|
|
|
+ struAcsEventCond.struEndTime.dwMonth = LocalDate.now().getMonthValue();
|
|
|
+ struAcsEventCond.struEndTime.dwDay = LocalDate.now().getDayOfMonth();
|
|
|
struAcsEventCond.struEndTime.dwHour = 23;
|
|
|
struAcsEventCond.struEndTime.dwMinute = 59;
|
|
|
struAcsEventCond.struEndTime.dwSecond = 59;
|
|
@@ -98,14 +99,18 @@ public final class EventSearch {
|
|
|
struAcsEventCfg.write();
|
|
|
Pointer ptrStruEventCfg = struAcsEventCfg.getPointer();
|
|
|
while (true) {
|
|
|
- System.out.println("i=" + i);
|
|
|
+// System.out.println("i=" + i);
|
|
|
int dwEventSearch = AcsService.hCNetSDK.NET_DVR_GetNextRemoteConfig(m_lSearchEventHandle, ptrStruEventCfg, struAcsEventCfg.size());
|
|
|
- if (dwEventSearch <= -1) {
|
|
|
- System.out.println("NET_DVR_GetNextRemoteConfig接口调用失败,错误码:" + AcsService.hCNetSDK.NET_DVR_GetLastError());
|
|
|
- }
|
|
|
+// if (dwEventSearch <= -1) {
|
|
|
+// System.out.println("NET_DVR_GetNextRemoteConfig接口调用失败,错误码:" + AcsService.hCNetSDK.NET_DVR_GetLastError());
|
|
|
+// }
|
|
|
if (dwEventSearch == HCNetSDK.NET_SDK_GET_NEXT_STATUS_NEED_WAIT) {
|
|
|
System.out.println("配置等待....");
|
|
|
- Thread.sleep(10);
|
|
|
+ try {
|
|
|
+ Thread.sleep(10);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
continue;
|
|
|
} else if (dwEventSearch == HCNetSDK.NET_SDK_NEXT_STATUS__FINISH) {
|
|
|
System.out.println("获取事件完成");
|
|
@@ -116,22 +121,6 @@ public final class EventSearch {
|
|
|
} else if (dwEventSearch == HCNetSDK.NET_SDK_GET_NEXT_STATUS_SUCCESS) {
|
|
|
StudentAttendanceDO attendance =new StudentAttendanceDO();
|
|
|
struAcsEventCfg.read();
|
|
|
- //获取的事件信息通过struAcsEventCfg结构体进行解析,
|
|
|
- //System.out.println(i + "获取事件成功, 报警主类型:" + Integer.toHexString(struAcsEventCfg.dwMajor) + "报警次类型:" + Integer.toHexString(struAcsEventCfg.dwMinor) + "卡号:" + new String(struAcsEventCfg.struAcsEventInfo.byCardNo).trim());
|
|
|
- /**
|
|
|
- * 工号有两个字段,dwEmployeeNo表示工号,当值为0时,表示无效,解析byEmployeeNo参数
|
|
|
- */
|
|
|
- System.out.println("工号:"+struAcsEventCfg.struAcsEventInfo.dwEmployeeNo);
|
|
|
- /* System.out.println("工号2:"+new String(struAcsEventCfg.struAcsEventInfo.byEmployeeNo));
|
|
|
- //人脸温度数据,需要设备和支持测温功能
|
|
|
- System.out.println("人脸温度:" + struAcsEventCfg.struAcsEventInfo.fCurrTemperature + "是否异常:" + struAcsEventCfg.struAcsEventInfo.byIsAbnomalTemperature);
|
|
|
- //口罩功能,需要设备支持此功能 0-保留,1-未知,2-不戴口罩,3-戴口罩
|
|
|
- System.out.println("是否带口罩:"+struAcsEventCfg.struAcsEventInfo.byMask);*/
|
|
|
- System.out.println("刷卡时间:年:"+struAcsEventCfg.struTime.dwYear+" 月:"+struAcsEventCfg.struTime.dwMonth+" 日:"+struAcsEventCfg.struTime.dwDay+
|
|
|
- " 时:"+struAcsEventCfg.struTime.dwHour+" 分:"+struAcsEventCfg.struTime.dwMinute+" 秒:"+struAcsEventCfg.struTime.dwSecond);
|
|
|
- System.out.println("刷卡信息:"+new String(struAcsEventCfg.struAcsEventInfo.byCardNo));
|
|
|
-
|
|
|
-
|
|
|
//打卡人脸信息
|
|
|
String photoUrl = null;
|
|
|
if (struAcsEventCfg.dwPicDataLen > 0 || struAcsEventCfg.pPicData != null) {
|
|
@@ -242,10 +231,13 @@ public final class EventSearch {
|
|
|
studentAttendanceService.updateStudentAttendance(BeanUtils.toBean(ST, StudentAttendanceSaveReqVO.class));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
i++;
|
|
|
- continue;
|
|
|
}
|
|
|
+ if(i == previousI){
|
|
|
+ System.out.println("发现相同的 i = " + i + ",停止循环");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ previousI = i;
|
|
|
}
|
|
|
i = 0;
|
|
|
if (!AcsService.hCNetSDK.NET_DVR_StopRemoteConfig(m_lSearchEventHandle)) {
|