xuxiuxi
2017-08-11 5f12988a77d078a5e5155c9a301e45bfd288d7e5
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,10 +40,11 @@
            addItem(returnItem, requestItem, cameraInOrOut);
        }
        removeTimeoutItemAndShow();
        limitItemsToN();
    }
    public void addItem(SurveillanceQueryItem returnItem, SurveillanceQueryItem requestItem, String cameraInOrOut) {
        if (!CommonVariables.FACE_SERVER) {
        if (!CommonVariables.FACE_SERVER && !CommonVariables.EMULATOR) {
            RtspFaceNative.setFaceLabel(Integer.parseInt(cameraInOrOut), requestItem.getStTrackId(), returnItem.getVisitorType()==null?"":returnItem.getVisitorType().substring(0,
                    returnItem.getVisitorType().length() > 3 ? 3 : returnItem.getVisitorType().length()
                    ));
@@ -57,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) {