| | |
| | |
|
| | | import cn.com.basic.face.dialog.CountryDialog;
|
| | | import cn.com.basic.face.dialog.SelectDialog;
|
| | | import cn.com.basic.face.fragment.RegisterFragment;
|
| | | import cn.com.basic.face.fragment.CheckInFragment;
|
| | | import cn.com.basic.face.discern.query.item.VistorTypeQueryItem;
|
| | | import cn.com.basic.face.util.AppApi;
|
| | |
|
| | | import org.xutils.http.RequestParams;
|
| | |
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import cn.com.basic.face.discern.common.BaseCommonCallBack;
|
| | | import cn.com.basic.face.discern.common.CommonVariables;
|
| | | import cn.com.basic.face.discern.entity.Dictionary;
|
| | |
|
| | | public class DictionaryMng extends BaseMng {
|
| | | public class DictionaryMng {
|
| | |
|
| | | public static DictionaryMng instance = new DictionaryMng();
|
| | |
|
| | |
| | | return instance;
|
| | | }
|
| | |
|
| | | public static List<String> nationList = new ArrayList<String>();
|
| | | public static List<String> mCredentialsList = new ArrayList<String>();
|
| | | public static List<String> genderList = new ArrayList<String>();
|
| | | public static List<String> uniqueFirstLetterList = new ArrayList<String>();
|
| | | public static HashMap<String,List<String>> countriesGroupByFirstLetter = new HashMap<String,List<String>>();
|
| | | public static String[] countryWordData = new String[]{};
|
| | | public static List<String> visitReasonList = new ArrayList<String>();
|
| | | public Map<String, String> idMap = new HashMap<String, String>();
|
| | |
|
| | | public String getId(String name) {
|
| | | return idMap.get(name);
|
| | | }
|
| | |
|
| | | public void loadAllDictionaryData() {
|
| | | loadCountries();
|
| | | loadIdTypeList();
|
| | | loadGenderList();
|
| | | loadVisitReasonList();
|
| | | loadVisitorTypeList();
|
| | | }
|
| | |
|
| | | public void loadCountries() {
|
| | |
| | | x.http().get(params, new BaseCommonCallBack() {
|
| | | public void success() {
|
| | | List<Dictionary> items = getList(Dictionary.class);
|
| | | countryWordData = new String[items.size()];
|
| | | int i=0;
|
| | | List<String> uniqueFirstLetterList = new ArrayList<String>();
|
| | | HashMap<String,List<String>> countriesGroupByFirstLetter = new HashMap<String,List<String>>();
|
| | | for (Dictionary item : items) {
|
| | | idMap.put(item.getName(), item.getId()+"");
|
| | | nationList.add(item.getName());
|
| | | String firstLetter = item.getRemark();
|
| | | List list = countriesGroupByFirstLetter.get(firstLetter);
|
| | | if (list == null) {
|
| | |
| | | uniqueFirstLetterList.add(0, firstLetter);
|
| | | }
|
| | | list.add(item.getName());
|
| | | countryWordData[i] = item.getName();
|
| | | i++;
|
| | | }
|
| | | CountryDialog.setCountries(uniqueFirstLetterList, countriesGroupByFirstLetter);
|
| | |
| | | return nameList;
|
| | | }
|
| | |
|
| | | private void loadVisitorTypeList() {
|
| | | RequestParams params = new RequestParams(AppApi.BASEURL+AppApi.VISITOR_TYPE_LIST);
|
| | | x.http().get(params, new BaseCommonCallBack() {
|
| | | public void success() {
|
| | | List<String> mVisitorTypeList = new ArrayList<String>();
|
| | | for (VistorTypeQueryItem item : getList(VistorTypeQueryItem.class)) {
|
| | | mVisitorTypeList.add(item.getLabel());
|
| | | idMap.put(item.getLabel(), item.getId()+"");
|
| | | }
|
| | | SelectDialog.setVisitorTypeList(mVisitorTypeList);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | }
|