From 0abb3d251383bcdf22db67e2b26431b7a7b74148 Mon Sep 17 00:00:00 2001
From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期五, 11 八月 2017 14:30:34 +0800
Subject: [PATCH] bug fix
---
VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/util/SurveillanceQueryItemUtil.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 47 insertions(+), 6 deletions(-)
diff --git a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/util/SurveillanceQueryItemUtil.java b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/util/SurveillanceQueryItemUtil.java
index e90b449..71c0940 100644
--- a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/util/SurveillanceQueryItemUtil.java
+++ b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/util/SurveillanceQueryItemUtil.java
@@ -21,17 +21,17 @@
}
//鎵�鏈夌洃鎺у浘鐗�
- private static List<SurveillanceQueryItem> allItems = new ArrayList<>();
+ public static List<SurveillanceQueryItem> allItems = new ArrayList<>();
//璁垮閫夐」鍗$殑鍒嗙被锛堟湭娉ㄥ唽/浜哄憳绫诲瀷銆佹潵璁跨姸鎬併�佹爣绛剧姸鎬侊級
//鑰冨嫟閫夐」鍗★紙鑰冨嫟浜哄憳绫诲瀷锛氭暀甯堛�佸鐢熴�佸憳宸ワ紝鏉ヨ鐘舵�侊細绛惧埌銆佺閫�锛�
//绗竴琛屾樉绀烘湭娉ㄥ唽锛岀浜岃鏄剧ず鏉ヨ
- private static List<SurveillanceQueryItem> visitorTwoRows = new ArrayList<>();
+ public static List<SurveillanceQueryItem> visitorTwoRows = new ArrayList<>();
//绗竴琛屾樉绀虹鍒帮紝绗簩琛屾樉绀虹閫�
- private static List<SurveillanceQueryItem> attendanceTwoRows = new ArrayList<>();
+ public static List<SurveillanceQueryItem> attendanceTwoRows = new ArrayList<>();
//鏈敞鍐岀殑璁垮鍒楄〃, 閫夋嫨鏃剁敤
- private static List<SurveillanceQueryItem> allUnregisterVisitorTwoRowsForSelect = new ArrayList();
+ public static List<SurveillanceQueryItem> allUnregisterVisitorTwoRowsForSelect = new ArrayList();
//鏈敞鍐岀殑鑰冨嫟鍒楄〃, 閫夋嫨鏃剁敤
- private static List<SurveillanceQueryItem> allUnregisterAttenderTwoRowsForSelect = new ArrayList();
+ public static List<SurveillanceQueryItem> allUnregisterAttenderTwoRowsForSelect = new ArrayList();
public void addItems(List<SurveillanceQueryItem> returnItems, List<SurveillanceQueryItem> requestItems, String cameraInOrOut) {
for ( int i = 0; i < returnItems.size(); i++) {
@@ -40,11 +40,14 @@
addItem(returnItem, requestItem, cameraInOrOut);
}
removeTimeoutItemAndShow();
+ limitItemsToN();
}
public void addItem(SurveillanceQueryItem returnItem, SurveillanceQueryItem requestItem, String cameraInOrOut) {
if (!CommonVariables.FACE_SERVER) {
- RtspFaceNative.setFaceLabel(Integer.parseInt(cameraInOrOut), requestItem.getStTrackId(), returnItem.getVisitorType());
+ RtspFaceNative.setFaceLabel(Integer.parseInt(cameraInOrOut), requestItem.getStTrackId(), returnItem.getVisitorType()==null?"":returnItem.getVisitorType().substring(0,
+ returnItem.getVisitorType().length() > 3 ? 3 : returnItem.getVisitorType().length()
+ ));
}
returnItem.setCreateTime(new Date());
returnItem.setStTrackId(requestItem.getStTrackId());
@@ -55,6 +58,44 @@
allItems.add(0, returnItem);
}
+ private void limitItemsToN() {
+ int max = 25;
+ int unRegisters = 0;
+ int checkIns = 0;
+ int attenderEnter = 0;
+ int attenderExit = 0;
+ List<SurveillanceQueryItem> itemsToRemove = new ArrayList<>();
+ for (int i = 0; i < allItems.size(); i++) {
+ SurveillanceQueryItem item = allItems.get(i);
+ int type = item.getRegisterOrCheckIn();
+ if (type == CommonVariables.Surveillance.VISIT_REGISTER_ITEM_TYPE) {
+ unRegisters++;
+ if (unRegisters > max) {
+ itemsToRemove.add(item);
+ }
+ }
+ if (type == CommonVariables.Surveillance.VISIT_CHECK_IN_ITEM_TYPE) {
+ checkIns++;
+ if (checkIns > max) {
+ itemsToRemove.add(item);
+ }
+ }
+ if (type == CommonVariables.Surveillance.VISIT_ATTENDANCE_IN) {
+ attenderEnter++;
+ if (attenderEnter > max) {
+ itemsToRemove.add(item);
+ }
+ }
+ if (type == CommonVariables.Surveillance.VISIT_ATTENDANCE_OUT) {
+ attenderExit++;
+ if (attenderExit > max) {
+ itemsToRemove.add(item);
+ }
+ }
+ }
+ allItems.removeAll(itemsToRemove);
+ }
+
public List getVisitorTwoRows() {
visitorTwoRows.clear();
for (SurveillanceQueryItem item : allItems) {
--
Gitblit v1.8.0