| | |
| | | import android.widget.Toast;
|
| | |
|
| | | import cn.com.basic.face.base.BaseApplication;
|
| | | import cn.com.basic.face.discern.common.CommonVariables;
|
| | | import cn.com.basic.face.discern.query.condition.CheckInQueryCondition;
|
| | | import cn.com.basic.face.discern.query.item.PhoneCallQueryItem;
|
| | | import cn.com.basic.face.fragment.CheckInFragment;
|
| | | import cn.com.basic.face.util.AppApi;
|
| | |
| | | return instance;
|
| | | }
|
| | |
|
| | | public void add(RequestParams params) {
|
| | | public void add(RequestParams params, final String visitReasonId) {
|
| | | if (!BaseApplication.deviceAvailable) {
|
| | | return;
|
| | | }
|
| | | params.setUri(AppApi.BASE_URL +AppApi.VISIT_ADD);
|
| | | x.http().post(params, new BaseCommonCallBack() {
|
| | | @Override
|
| | | public void success() {
|
| | | Toast.makeText(BaseApplication.getInstance(),"添加成功", Toast.LENGTH_SHORT).show();
|
| | | CheckInFragment.getInstance().resetForm();
|
| | | if (visitReasonId == null || "".equals(visitReasonId)) {
|
| | | DictionaryMng.getInstance().loadVisitReasonList();
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | public void findCheckInLeftList(final boolean isVisitorList, final boolean isSortByDept, String searchText) {
|
| | | RequestParams params = new RequestParams(AppApi.BASE_URL +AppApi.Query.REGISTER_QUERY);
|
| | | if (isVisitorList) {
|
| | | params.addBodyParameter(VisitorQueryCondition.FieldNames.notCompanyId, BaseApplication.getInstance().getDevice().getCompanyId());
|
| | | } else {
|
| | | params.addBodyParameter(VisitorQueryCondition.FieldNames.companyId, BaseApplication.getInstance().getDevice().getCompanyId());
|
| | | public void findCheckInLeftList(final boolean isVisitorList, final boolean isSortByDept, String searchText, final int pageNum, final boolean append) {
|
| | | if (!BaseApplication.deviceAvailable) {
|
| | | return;
|
| | | }
|
| | | params.addBodyParameter(VisitorQueryCondition.FieldNames.name, searchText);
|
| | | RequestParams params = new RequestParams(AppApi.BASE_URL +AppApi.Query.CHECK_IN_QUERY);
|
| | | if (isVisitorList) {
|
| | | params.addBodyParameter(CheckInQueryCondition.FieldNames.visitorCompanyId, BaseApplication.getInstance().getDevice().getDeviceCompanyId());
|
| | | } else {
|
| | | params.addBodyParameter(CheckInQueryCondition.FieldNames.employeeCompanyId, BaseApplication.getInstance().getDevice().getDeviceCompanyId());
|
| | | }
|
| | | params.addBodyParameter(CheckInQueryCondition.FieldNames.username, searchText);
|
| | | params.addBodyParameter(CommonVariables.Page.PAGE_NUM, pageNum+"");
|
| | | params.addBodyParameter(CommonVariables.Page.PAGE_SIZE, "5");
|
| | | x.http().post(params, new BaseCommonCallBack() {
|
| | | public void success() {
|
| | | List<CheckInQueryItem> list = getList(CheckInQueryItem.class);
|
| | |
| | | allItems.add(item);
|
| | | prev = name;
|
| | | }
|
| | | if (isVisitorList) {
|
| | | CheckInFragment.getInstance().get_fragment_check_in_left_visitor().show(allItems);
|
| | | if (hasMorePages()) {
|
| | | allItems.add(CommonVariables.Page.hasMorePages);
|
| | | } else {
|
| | | CheckInFragment.getInstance().get_fragment_check_in_left_interviewee().show(allItems);
|
| | | if (getPageNum() > 1) {
|
| | | allItems.add(CommonVariables.Page.reachBottom);
|
| | | } else {
|
| | | if (allItems.size() > 0) {
|
| | | allItems.add(CommonVariables.Page.reachBottom);
|
| | | } else {
|
| | | allItems.add(CommonVariables.Page.noMorePage);
|
| | | }
|
| | | }
|
| | | }
|
| | | if (isVisitorList) {
|
| | | CheckInFragment.getInstance().get_fragment_check_in_left_visitor().show(allItems, append);
|
| | | } else {
|
| | | CheckInFragment.getInstance().get_fragment_check_in_left_interviewee().show(allItems, isSortByDept, append);
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | private void sort(List<CheckInQueryItem> list, final boolean sortedByDept) {
|
| | | if (!BaseApplication.deviceAvailable) {
|
| | | return;
|
| | | }
|
| | | Collections.sort(list, new Comparator<CheckInQueryItem>() {
|
| | | @Override
|
| | | public int compare(CheckInQueryItem t1, CheckInQueryItem t2) {
|