a
554325746@qq.com
2019-12-25 603cb36a5123e46656b06a5deb8d7ac7ff81307f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
package com.basic.security.manager.helper.rm.base;
 
import android.widget.ImageView;
 
import com.basic.security.base.BaseApplication;
import com.basic.security.fragment.UserFragment;
import com.basic.security.manager.BaseSettingManager;
import com.basic.security.manager.DetectResultManager;
import com.basic.security.manager.FaceTitleAndTipsManager;
import com.basic.security.manager.HintDoorAccessManager;
import com.basic.security.manager.PersonIdentityManager;
import com.basic.security.manager.UserManager;
import com.basic.security.model.ModelAdapter;
import com.basic.security.model.Person;
import com.basic.security.utils.Constants;
import com.basic.security.utils.ToastUtil;
import com.basic.security.utils.socket.RelayServerUtil2;
import com.basic.security.utils.socket.outdoor.OutdoorGuestSocketServer;
 
import java.util.List;
 
public class CurrentBasePersonList extends CurrentBaseSignUp {
    protected boolean adminLogin1(ModelAdapter person) {
        UserManager.loginPerson = person;
//        SystemInitManager.showSecondDisplay(mainActivity());
        ToastUtil.show("管理员登入成功!");
        activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                UserManager.setAdminId(currentCompareFeatureResult.personId);
                try {
                    ImageView login_photo = BaseApplication.getApplication().activity.fragment_toolbar.login_photo;
                    login_photo.setImageResource(com.basic.security.utils.RUtils.R_drawable_yuyin);
                    UserManager.setIsBasic(false);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (Constants.indoorOutdoorInOne) {
                    activity.fragment_toolbar.visitor_model();
                } else {
                    activity.fragment_menu.person_manage();
                }
            }
        });
        return true;
    }
 
    public boolean doShowFragment() {
        for (int i = 0; i < detectedResult.facePositions.size(); i++) {
            initCurrentPerson(i);
            if (Constants.USE_GRAY_CAMERA && !currentFacePosition.liveness) {
                FaceTitleAndTipsManager.getFaceTitleMap(currentFacePosition);
                continue;
            }
            if (!currentFacePosition.detectScoreCanRecognize()) {
                adjustFaceTipsForRecognize();
                identityTitle();
                continue;
            }
            if (currentFacePosition.detectScoreCanSignUp()) {
                savePersonToTemporaryTable();
            }
            if (currentPerson == null || "未注册".equals(currentPerson.getString("sign_up_status"))) {
                if (Constants.indoorOutdoorInOne) {
//                    doorAccessS();
                    String denyMessage = HintDoorAccessManager.getNoRegisterHint();
//                    System1.out.println("CurrentBasePersonList.doShowFragment denyMessage="+denyMessage);
                    currentFaceTitleAndTipsS.faceTitle(denyMessage);
                    currentFaceTitleAndTipsS.faceTitle2(denyMessage, true);
                    setDoorAccessMessageS1(denyMessage);
                    currentFaceTitleAndTips.faceTitle(denyMessage);
                    currentFaceTitleAndTips.faceTitle2(denyMessage, true);
                    setDoorAccessMessage1(denyMessage);
                }
                if (currentFacePosition.detectScoreCanSignUp()) {
//                    System1.out.println("CurrentBasePersonList.doShowFragment currentFacePosition.detectScoreCanSignUp()=true");
                    addToNeedSignUpPersonList();
                } else {
                    if (activity.currentFragment == activity.fragment_su_auto_wait_face ||
                            activity.currentFragment == activity.fragment_door_access_result ||
                            activity.currentFragment == activity.fragment_su_auto_wait_admin
                            ) {
                    } else {
                        if (activity.currentFragment == activity.fragment_su_auto_wait_face ||
                                activity.currentFragment == activity.fragment_door_access_result ||
                                activity.currentFragment == activity.fragment_su_auto_wait_admin
                                ) {
                        } else {
                            if (activity.currentFragment == activity.fragment_admin_face_login) {
                            } else {
                                adjustFaceTips();
                            }
                        }
                    }
                }
                identityTitle();
                continue;
            }
            if (currentPerson != null && "已注册".equals(currentPerson.getString("sign_up_status")) && "0".equals(currentPerson.getString(Person.del_flag))) {
                if (activity.currentFragment == activity.fragment_su_auto_wait_face ||
                        activity.currentFragment == activity.fragment_door_access_result
                        ) {
                    currentFaceTitleAndTips.tipsTxt = "";
                    currentFaceTitleAndTipsS.tipsTxt = "";
                }
                if (activity.currentFragment == activity.fragment_user) {
                    if (UserFragment.isChangePhoto) {
                        ToastUtil.show("此人已被注册,不能设置为系统管理员头像");
                    }
                }
                if (doorAccessMode()) {
                    doorAccess();
                } else {
                    currentFaceTitleAndTips.faceTitle("已注册");
                    currentFaceTitleAndTips.faceTitle2("已注册", true);
                }
                if (Constants.indoorOutdoorInOne) {
                    doorAccessS();
                    if (doorAccessAllowedListS.size() > 0) {
                        RelayServerUtil2.open();
                    }
                }
                addVisitRecord(currentFacePosition, doorAccessAllowedList.contains(currentFacePosition) || doorAccessAllowedListS.contains(currentFacePosition) ? "1" : "0");
                if (!"访客注册".equals(currentPerson.getString(Person.sign_up_method))) {
                    identityTitle();
                }
            }
        }
        printFacePositionList();
        if (UserManager.adminLoggedIn()) {
            if (needSignUpPersonList.size() > 0) {
                if (!BaseSettingManager.isDoorAccessOnlyMode()) {
                    signUpPerson();
                }
            }
        }
        if (!UserManager.adminLoggedIn()) {
            if (Constants.indoorOutdoorInOne) {
                if (currentPerson != null && activity.currentFragment == activity.fragment_admin_password_login) {
                    List<String> identityNameByPersonId = PersonIdentityManager.findIdentityNameByPersonId(currentPerson.getId());
                    if (identityNameByPersonId.size() > 0 && identityNameByPersonId.contains("管理员")) {
                        adminLogin1(currentPerson);
                    }
                }
            }
            if (activity.currentFragment == activity.fragment_admin_face_login) {
                if (!Constants.indoorOutdoorInOne) {
                    if (currentPerson != null) {
                        List<String> identityNameByPersonId = PersonIdentityManager.findIdentityNameByPersonId(currentPerson.getId());
                        if (identityNameByPersonId.size() > 0 && identityNameByPersonId.contains("管理员")) {
                            adminLogin();
                        }
                    }
                }
            } else if (activity.currentFragment == activity.fragment_su_auto_wait_face) {
                if (doorAccessDeniedList.size() > 0) {
                    currentFaceTitleAndTips.setFaceTitleRedColor();
                    currentFaceTitleAndTipsS.setFaceTitleRedColor();
                    showFragment(activity.fragment_door_access_result);
                    activity.fragment_door_access_result.refuseOpenDoor();
                } else if (doorAccessAllowedList.size() > 0) {
                    currentFaceTitleAndTips.setFaceTitleGreenColor();
                    currentFaceTitleAndTipsS.setFaceTitleGreenColor();
                    showFragment(activity.fragment_door_access_result);
                    activity.fragment_door_access_result.openDoor();
                    RelayServerUtil2.open();
                    OutdoorGuestSocketServer.setDetectedResult(detectedResult);
                    doorAccessAllowedList.clear();
                    CurrentBase.detectedResult = null;
                    DetectResultManager.detectedResult = null;
                } else if (doorAccessConfirmList.size() > 0) {
                    currentFaceTitleAndTips.setFaceTitleRedColor();
                    currentFaceTitleAndTipsS.setFaceTitleRedColor();
                    showFragment(activity.fragment_door_access_result);
                    activity.fragment_door_access_result.confirmOpenDoor();
                } else if (timeNotReachPersonList.size() > 0) {
                    currentFaceTitleAndTips.setFaceTitleRedColor();
                    currentFaceTitleAndTipsS.setFaceTitleRedColor();
                    showFragment(activity.fragment_door_access_result);
                    activity.fragment_door_access_result.notReachTime();
                    timeNotReachPersonList.clear();
                } else if (needSignUpPersonList.size() > 0) {
                    if (!BaseSettingManager.isDoorAccessOnlyMode()) {
                        signUpPerson();
                    }
                }
            }
        }
        return showFragmentSuccess;
    }
}