| | |
| | | import com.basic.security.manager.IdentityManager; |
| | | import com.basic.security.manager.OrgManager; |
| | | import com.basic.security.manager.PersonIdentityManager; |
| | | import com.basic.security.manager.PersonManager; |
| | | import com.basic.security.manager.VisitManager; |
| | | import com.basic.security.model.ModelAdapter; |
| | | import com.basic.security.model.Org; |
| | |
| | | import com.basic.security.utils.DateEditUtil1; |
| | | import com.basic.security.utils.DateEditUtilForValidTime; |
| | | import com.basic.security.utils.DateUtil; |
| | | import com.basic.security.utils.RUtils; |
| | | import com.basic.security.utils.ResolutionAdaptation; |
| | | import com.basic.security.utils.ToastUtil; |
| | | import com.basic.security.widget.MyTextView; |
| | |
| | | import org.androidannotations.annotations.AfterViews; |
| | | import org.androidannotations.annotations.Click; |
| | | import org.androidannotations.annotations.EFragment; |
| | | import org.androidannotations.annotations.TextChange; |
| | | import org.androidannotations.annotations.UiThread; |
| | | import org.androidannotations.annotations.ViewById; |
| | | |
| | |
| | | |
| | | @Click |
| | | public void save() { |
| | | mainActivity().fragment_person_manage.savePerson(); |
| | | savePerson(); |
| | | FaceListFragment.treeAdapter.clearUI(); |
| | | } |
| | | |
| | | public void savePerson() { |
| | | mainActivity().fragment_person_manage.savePerson(); |
| | | if (mainActivity().currentFragment != mainActivity().fragment_person_manage) { |
| | | mainActivity().fragment_person_manage.selectedPerson(null); |
| | | } else { |
| | | ModelAdapter selectedPerson = mainActivity().fragment_person_manage.selectedPerson(); |
| | | // System.out.println("FaceDetailFragment.savePerson name=" + selectedPerson.getString(Person.name) + " idcard=" + selectedPerson.getString(Person.id_card_number)); |
| | | mainActivity().fragment_person_manage.selectedPerson(selectedPerson); |
| | | } |
| | | } |
| | | |
| | | @Click |
| | | public void tempSave() { |
| | | mainActivity().fragment_person_manage.savePerson(); |
| | | savePerson(); |
| | | } |
| | | |
| | | @Click |
| | |
| | | mainActivity().fragment_person_manage.giveUpSave(); |
| | | } |
| | | |
| | | public void updateIdentityListUI(ModelAdapter person) { |
| | | private void updateIdentityListUI(ModelAdapter person) { |
| | | checkedPerson = person; |
| | | if (checkedPerson == null) { |
| | | checkThisDevice(); |
| | |
| | | showIdentityList(); |
| | | } |
| | | |
| | | public void updateIdentityListUI2(ModelAdapter person) { |
| | | checkedPerson = person; |
| | | if (checkedPerson == null) { |
| | | checkThisDevice(); |
| | | checkedIdentityMapByPerson.clear(); |
| | | } else { |
| | | setDevice(checkedPerson.getString("all_device")); |
| | | checkedIdentityMapByPerson.clear(); |
| | | checkedIdentityMapByPerson.putAll(PersonIdentityManager.findIdentityMapByPersonId(person.getString(Person.id))); |
| | | } |
| | | showIdentityList(); |
| | | @TextChange(RUtils.R_id_name_input) |
| | | public void name_inputTextChanged() { |
| | | name.setText(name_input.getText()); |
| | | } |
| | | |
| | | public void updateIdentityListUI1(ModelAdapter person) { |
| | | checkedPerson = person; |
| | | if (checkedPerson == null) { |
| | | checkThisDevice(); |
| | | } else { |
| | | setDevice(checkedPerson.getString("all_device")); |
| | | } |
| | | showIdentityList(); |
| | | @TextChange(RUtils.R_id_idcard_number_input) |
| | | public void idcard_number_inputTextChanged() { |
| | | idcard_number.setText(idcard_number_input.getText()); |
| | | } |
| | | |
| | | @TextChange(RUtils.R_id_phone_input) |
| | | public void phone_inputTextChanged() { |
| | | phone.setText(phone_input.getText()); |
| | | } |
| | | |
| | | @TextChange(RUtils.R_id_student_id_input) |
| | | public void student_id_inputTextChanged() { |
| | | student_id.setText(student_id_input.getText()); |
| | | } |
| | | |
| | | @UiThread |
| | |
| | | return true; |
| | | } |
| | | |
| | | public String aboutDevice() { |
| | | if (clusterDevices.isChecked()) { |
| | | return "1"; |
| | | } |
| | | if (thisDevice.isChecked()) { |
| | | return "0"; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public int getIdentitySize() { |
| | | return checkedIdentityMapByPerson.values().size(); |
| | | } |
| | | |
| | | @Click |
| | | public void next() { |
| | | int position = identity_list.getFirstVisiblePosition(); |
| | |
| | | position += 2; |
| | | } |
| | | identity_list.setSelection(position); |
| | | } |
| | | |
| | | public void notifyDataSetChanged() { |
| | | } |
| | | |
| | | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
| | |
| | | student_id_input.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | public void updateDetailUI(ModelAdapter person) { |
| | | private void updateDetailUI(ModelAdapter person) { |
| | | mainActivity().runOnUiThread(() -> { |
| | | try { |
| | | scrollView.fullScroll(ScrollView.FOCUS_UP); |
| | |
| | | guest_visit_valid_time_row.setVisibility(View.GONE); |
| | | guest_visit_status_row.setVisibility(View.GONE); |
| | | student_id_input.setVisibility(View.GONE); |
| | | student_id_input.setText(""); |
| | | student_id.setText(""); |
| | | name.setText(""); |
| | | name_input.setText(""); |
| | | idcard_number.setText(""); |
| | | idcard_number_input.setText(""); |
| | | phone.setText(""); |
| | | phone_input.setText(""); |
| | | guest_visit_valid_time.setText(""); |
| | | if (person != null) { |
| | | setViewVisisble(person); |
| | | if ("访客注册".equals(person.getString(Person.sign_up_method))) { |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // guest_visit_status_row.setVisibility(View.VISIBLE); |
| | | // try { |
| | | // String dbGuestVisitStatus = person.getString(Person.guest_visit_status); |
| | | // if (dbGuestVisitStatus != null) { |
| | | // for (int i = 0; i < guestVisitStatusArray.length; i++) { |
| | | // String guestVisitStatus = guestVisitStatusArray[i]; |
| | | // if (dbGuestVisitStatus.equals(guestVisitStatus)) { |
| | | // guest_visit_status.setSelection(i); |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | } |
| | | } |
| | | FaceDetailFragment.this.person = person; |
| | | show_name_in_put.setVisibility(View.GONE); |
| | | show_phone_in_put.setVisibility(View.GONE); |
| | | show_id_in_put.setVisibility(View.GONE); |
| | | idcard_number.setTextColor(Color.parseColor("#FFFFFFFF")); |
| | |
| | | name.setText1(person.getString("name")); |
| | | phone.setText(person.getString("phone")); |
| | | idcard_number.setText(person.getString("id_card_number")); |
| | | byte[] blob = person.getBlob("camera_image_path"); |
| | | if (blob != null) { |
| | | if (blob.length != 0) { |
| | | Bitmap bitmap = BitmapFactory.decodeByteArray(blob, 0, blob.length); |
| | | face.setImageBitmap(bitmap); |
| | | } |
| | | } else { |
| | | face.setImageResource(com.basic.security.utils.RUtils.R_drawable_u1280); |
| | | } |
| | | register_type.setText(person.getString("sign_up_method")); |
| | | String lastTime = VisitManager.getLastVisitTime(person.getId()); |
| | | if (TextUtils.isEmpty(lastTime)) { |
| | |
| | | showTextOrEditText(verify_status); |
| | | } |
| | | face.setVisibility(View.VISIBLE); |
| | | byte[] blob = person.getBlob("camera_image_path"); |
| | | if (blob != null) { |
| | | try { |
| | | if (blob.length != 0) { |
| | | Bitmap bitmap = BitmapFactory.decodeByteArray(blob, 0, blob.length); |
| | | face.setImageBitmap(bitmap); |
| | | } |
| | | } catch (Exception e) { |
| | | face.setImageResource(com.basic.security.utils.RUtils.R_drawable_u1280); |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | face.setImageResource(com.basic.security.utils.RUtils.R_drawable_u1280); |
| | | } |
| | | try { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Long sign_up_time = Long.parseLong(person.getString("sign_up_time")); |
| | |
| | | } else { |
| | | last_visit_time.setText(DateUtil.formatTime(Long.parseLong(lastTime), "yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | } |
| | | |
| | | name_input.setVisibility(View.GONE); |
| | | idcard_number_input.setVisibility(View.GONE); |
| | | phone_input.setVisibility(View.GONE); |
| | | show_name_in_put.setVisibility(View.GONE); |
| | | show_id_in_put.setVisibility(View.GONE); |
| | | if (person != null) { |
| | | show_name_in_put.setVisibility(View.VISIBLE); |
| | | show_id_in_put.setVisibility(View.VISIBLE); |
| | | show_phone_in_put.setVisibility(View.VISIBLE); |
| | | } |
| | | if (person != null && "已经验证身份证".equals(person.getString(Person.verify_status))) { |
| | | show_name_in_put.setVisibility(View.GONE); |
| | | show_id_in_put.setVisibility(View.GONE); |
| | | } |
| | | if (person == null) { |
| | | show_name_in_put.setVisibility(View.GONE); |
| | | show_id_in_put.setVisibility(View.GONE); |
| | | show_phone_in_put.setVisibility(View.GONE); |
| | | name_input.setVisibility(View.GONE); |
| | | idcard_number_input.setVisibility(View.GONE); |
| | | phone_input.setVisibility(View.GONE); |
| | | } |
| | | if (person != null) { |
| | | byte[] blob = person.getBlob("camera_image_path"); |
| | | if (blob != null) { |
| | | if (blob.length != 0) { |
| | | Bitmap bitmap = BitmapFactory.decodeByteArray(blob, 0, blob.length); |
| | | face.setImageBitmap(bitmap); |
| | | } |
| | | } else { |
| | | face.setImageResource(com.basic.security.utils.RUtils.R_drawable_u1280); |
| | | } |
| | | name.setText(person.getString(Person.name)); |
| | | name_input.setText(person.getString(Person.name)); |
| | | idcard_number.setText(person.getString(Person.id_card_number)); |
| | | idcard_number_input.setText(person.getString(Person.id_card_number)); |
| | | phone.setText(person.getString(Person.phone)); |
| | | phone_input.setText(person.getString(Person.phone)); |
| | | |
| | | if (!TextUtils.isEmpty(person.getString(Person.name))) { |
| | | name.setVisibility(View.VISIBLE); |
| | | name_input.setVisibility(View.GONE); |
| | | } |
| | | |
| | | if (!TextUtils.isEmpty(person.getString(Person.id_card_number))) { |
| | | idcard_number.setVisibility(View.VISIBLE); |
| | | idcard_number_input.setVisibility(View.GONE); |
| | | } |
| | | |
| | | if (!TextUtils.isEmpty(person.getString(Person.phone))) { |
| | | phone.setVisibility(View.VISIBLE); |
| | | phone_input.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | if (person != null |
| | | // && Constants.TRUE.equals(person.getString(Model.newModel)) |
| | | ) { |
| | | if (!"未验证身份证".equals(person.getString("verify_status"))) { |
| | | if (name_input.getText().toString().length() == 0) { |
| | | name_input.setVisibility(View.VISIBLE); |
| | | } |
| | | if (idcard_number_input.getText().toString().length() == 0) { |
| | | idcard_number_input.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | if (phone_input.getText().toString().length() == 0) { |
| | | phone_input.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | if (name_input.getVisibility() == View.VISIBLE) { |
| | | name.setVisibility(View.GONE); |
| | | } |
| | | if (idcard_number_input.getVisibility() == View.VISIBLE) { |
| | | idcard_number.setVisibility(View.GONE); |
| | | } |
| | | if (person != null && "未验证身份证".equals(person.getString(Person.verify_status))) { |
| | | idcard_number.setText("请在刷卡区验证身份证"); |
| | | idcard_number.setTextColor(Color.parseColor("#4BA6AD")); |
| | | show_name_in_put.setVisibility(View.GONE); |
| | | show_id_in_put.setVisibility(View.GONE); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | showNameInPut = false; |
| | | name_input.setVisibility(View.GONE); |
| | | name.setVisibility(View.VISIBLE); |
| | | name.setText1(person.getString("name")); |
| | | // name.setText1(person.getString("name")); |
| | | show_name_in_put.setVisibility(View.VISIBLE); |
| | | } |
| | | if (TextUtils.isEmpty(person.getString("id_card_number"))) { |
| | |
| | | } |
| | | |
| | | public boolean detailMessageIsComplete() { |
| | | ModelAdapter person = mainActivity().fragment_person_manage.selectedPerson; |
| | | ModelAdapter person = mainActivity().fragment_person_manage.selectedPerson(); |
| | | if (person != null) { |
| | | String name = person.getString("name"); |
| | | String id_card_number = person.getString("id_card_number"); |
| | |
| | | } |
| | | |
| | | public String getInPutName() { |
| | | ModelAdapter person = mainActivity().fragment_person_manage.selectedPerson; |
| | | if ("1".equals(person.getString("auto_init"))) { |
| | | return "系统管理员"; |
| | | String nameTextStr = name.getText().toString(); |
| | | String nameInputStr = name_input.getText().toString(); |
| | | if (nameInputStr.length() == 0) { |
| | | return nameTextStr; |
| | | } else { |
| | | return nameInputStr; |
| | | } |
| | | if (!TextUtils.isEmpty(verify_status) && (TextUtils.equals(verify_status, "已经验证身份证") |
| | | || TextUtils.equals(verify_status, "未验证身份证"))) { |
| | | if (mainActivity().fragment_person_manage.needIdCardInfo()) { |
| | | return name.getText().toString().trim(); |
| | | } |
| | | return person.getString("name"); |
| | | } |
| | | if ((!TextUtils.isEmpty(verify_status) && TextUtils.equals(verify_status, "不需要验证身份证")) || |
| | | TextUtils.isEmpty(verify_status) |
| | | ) { |
| | | if (showNameInPut) { |
| | | return name_input.getText().toString().trim(); |
| | | } |
| | | return name.getText().toString().trim(); |
| | | } |
| | | return name.getText().toString().trim(); |
| | | } |
| | | |
| | | public String getInPutIdCardNumber() { |
| | | ModelAdapter person = mainActivity().fragment_person_manage.selectedPerson; |
| | | if (!TextUtils.isEmpty(verify_status) && (TextUtils.equals(verify_status, "已经验证身份证") || TextUtils.equals(verify_status, "未验证身份证"))) { |
| | | if (mainActivity().fragment_person_manage.needIdCardInfo()) { |
| | | return idcard_number.getText().toString().trim(); |
| | | } |
| | | return person.getString("id_card_number"); |
| | | } |
| | | if ((!TextUtils.isEmpty(verify_status) && TextUtils.equals(verify_status, "不需要验证身份证")) |
| | | || TextUtils.isEmpty(verify_status) |
| | | ) { |
| | | if (showIdCardInPut) { |
| | | return idcard_number_input.getText().toString().trim(); |
| | | } |
| | | return idcard_number.getText().toString().trim(); |
| | | } |
| | | return idcard_number.getText().toString().trim(); |
| | | String nameInputStr = idcard_number_input.getText().toString(); |
| | | return nameInputStr; |
| | | } |
| | | |
| | | public String getInPutPhoneNumber() { |
| | | if (showPhoneInPut) { |
| | | return phone_input.getText().toString().trim(); |
| | | } else { |
| | | return phone.getText().toString().trim(); |
| | | } |
| | | return phone_input.getText().toString().trim(); |
| | | } |
| | | |
| | | public void nameRequired(boolean required) { |
| | | if (required) { |
| | | // System.out.println("FaceDetailFragment.nameRequired " + FrameUtil.getFrames() + " " + required); |
| | | // System1.out.println("FaceDetailFragment.nameRequired " + FrameUtil.getFrames() + " " + required); |
| | | face_detail_name_need.setVisibility(View.VISIBLE); |
| | | } else { |
| | | face_detail_name_need.setVisibility(View.INVISIBLE); |
| | |
| | | face_detail_id_need.setVisibility(View.VISIBLE); |
| | | } else { |
| | | face_detail_id_need.setVisibility(View.INVISIBLE); |
| | | } |
| | | } |
| | | |
| | | public void updateData(String personId) { |
| | | BaseApplication.getApplication().executorService.execute(() -> { |
| | | try { |
| | | ModelAdapter selectedPerson = PersonManager.findPersonById(personId); |
| | | if (selectedPerson != null) { |
| | | updateDataUI(selectedPerson); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @UiThread |
| | | public void updateDataUI(ModelAdapter selectedPerson) { |
| | | try { |
| | | if (showNameInPut) { |
| | | name_input.setText(selectedPerson.getString("name")); |
| | | } else { |
| | | name.setText1(selectedPerson.getString("name")); |
| | | } |
| | | if (showIdCardInPut) { |
| | | idcard_number_input.setText(selectedPerson.getString("id_card_number")); |
| | | } else { |
| | | idcard_number.setText(selectedPerson.getString("id_card_number")); |
| | | } |
| | | if (showPhoneInPut) { |
| | | phone_input.setText(selectedPerson.getString("phone")); |
| | | } else { |
| | | phone.setText(selectedPerson.getString("phone")); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public String getGuestVisitValid() { |
| | | try { |
| | | return DateEditUtil1.sdf.parse(guest_visit_valid_time.getText().toString()).getTime() + ""; |
| | | String guest_visit_valid_timeStr = guest_visit_valid_time.getText().toString(); |
| | | if (!TextUtils.isEmpty(guest_visit_valid_timeStr)) { |
| | | return DateEditUtil1.sdf.parse(guest_visit_valid_timeStr).getTime() + ""; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | System.out.println("FaceDetailFragment.getGuestVisitValid Error:" + e.getMessage()); |
| | | } |
| | | return ""; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public void showPersonDetail(ModelAdapter selectedPerson) { |
| | | updateDetailUI(selectedPerson); |
| | | updateIdentityListUI(selectedPerson); |
| | | } |
| | | |
| | | public class IdentityAdapter extends CommonAdapter<ModelAdapter> { |
| | | public IdentityAdapter(Context context, int layoutId, List<ModelAdapter> datas) { |
| | | super(context, layoutId, datas); |