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;
|
}
|
}
|