git-svn-id: http://192.168.1.226/svn/proxy@728 454eff88-639b-444f-9e54-f578c98de674
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public <T> List<T> getListBeanOfType(Class<T> requiredType) {
|
| | | public <T> List<T> getList(Class<T> requiredType) {
|
| | | if (data != null) {
|
| | | if (data instanceof JSONArray) {
|
| | | JSONArray jsonArray = (JSONArray) data;
|
| | |
| | | public int getPageNum() {
|
| | | return pageNum;
|
| | | }
|
| | |
|
| | | public boolean hasMorePages() {
|
| | | return getPageNum() < getTotalPages();
|
| | | }
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | | if(BaseApplication.getInstance().networkNotAvailable()) {
|
| | | ResultBean resultBean = AttendanceDao.getInstance().reloadLeftList(searchText, pageNum, append);
|
| | | reloadLeftListAfterReturn(append, AttendanceDao.getInstance().reloadLeftList(searchText, pageNum, append));
|
| | | } else {
|
| | | RequestParams params = new RequestParams(AppApi.BASE_URL + AppApi.Query.ATTENDANCE_QUERY);
|
| | | params.addBodyParameter(AttendanceQueryCondition.FieldNames.username, searchText);
|
| | |
| | | params.addBodyParameter(CommonVariables.Page.PAGE_SIZE, CommonVariables.Page.DEFAULT_PAGE_SIZE);
|
| | | x.http().post(params, new BaseCommonCallBack() {
|
| | | public void success() {
|
| | | List<AttendanceQueryItem> list = getList(AttendanceQueryItem.class);
|
| | | reloadLeftListAfterReturn(append, resultBean);
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | | public void reloadLeftListAfterReturn(boolean append, ResultBean resultBean) {
|
| | | List<AttendanceQueryItem> list = resultBean.getList(AttendanceQueryItem.class);
|
| | | List itemList = new ArrayList();
|
| | | int i = 0;
|
| | | String previewDate = "";
|
| | |
| | | itemList.add(item);
|
| | | i++;
|
| | | }
|
| | | addPageFooter(hasMorePages(), getPageNum(), itemList);
|
| | | addPageFooter(resultBean.hasMorePages(), resultBean.getPageNum(), itemList);
|
| | | AttendanceFragment.getInstance().get_fragment_attendance_left_list_view().show(itemList, append);
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | | public void reloadAttendanceDetail(AttendanceQueryItem item) {
|
| | |
| | |
|
| | | import cn.com.basic.face.base.BaseApplication;
|
| | | import cn.com.basic.face.discern.common.CommonVariables;
|
| | | import cn.com.basic.face.discern.common.ResultBean;
|
| | | import cn.com.basic.face.discern.query.condition.CheckInQueryCondition;
|
| | | import cn.com.basic.face.fragment.CheckInFragment;
|
| | | import cn.com.basic.face.service.sqlite.CheckInDao;
|
| | | import cn.com.basic.face.util.AppApi;
|
| | |
|
| | | import org.xutils.http.RequestParams;
|
| | |
| | | if (!BaseApplication.deviceAvailable) {
|
| | | return;
|
| | | }
|
| | | if (BaseApplication.getInstance().networkAvailable()) {
|
| | | RequestParams params = new RequestParams(AppApi.BASE_URL +AppApi.Query.CHECK_IN_QUERY);
|
| | | String deviceCompanyId = BaseApplication.getInstance().getAndroidDevice().getCompanyId();
|
| | | if (isVisitorList) {
|
| | |
| | | params.addBodyParameter(CommonVariables.Page.PAGE_SIZE, CommonVariables.Page.DEFAULT_PAGE_SIZE);
|
| | | x.http().post(params, new BaseCommonCallBack() {
|
| | | public void success() {
|
| | | List<CheckInQueryItem> list = getList(CheckInQueryItem.class);
|
| | | findCheckInLeftListAfterReturn(resultBean, isVisitorList, isSortByDept, append);
|
| | | }
|
| | | });
|
| | | } else {
|
| | | findCheckInLeftListAfterReturn(CheckInDao.getInstance().findCheckInLeftList(isVisitorList, searchText, pageNum), isVisitorList, isSortByDept, append);
|
| | | }
|
| | | }
|
| | |
|
| | | public void findCheckInLeftListAfterReturn(ResultBean resultBean, boolean isVisitorList, boolean isSortByDept, boolean append) {
|
| | | List<CheckInQueryItem> list = resultBean.getList(CheckInQueryItem.class);
|
| | |
|
| | | List prevList = null;
|
| | | if (append) {
|
| | |
| | | itemList.add(item);
|
| | | prev = name;
|
| | | }
|
| | | addPageFooter(hasMorePages(), getPageNum(), itemList);
|
| | | addPageFooter(resultBean.hasMorePages(), resultBean.getPageNum(), itemList);
|
| | | if (isVisitorList) {
|
| | | CheckInFragment.getInstance().get_fragment_check_in_left_visitor().show(itemList);
|
| | | } else {
|
| | | CheckInFragment.getInstance().get_fragment_check_in_left_interviewee().show(itemList, isSortByDept, append);
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | private void sort(List<CheckInQueryItem> list, final boolean sortedByDept) {
|
| | |
| | | params.addBodyParameter(Device.FieldNames.type, CommonVariables.DeviceType.ANDROID_DEVICE);
|
| | | x.http().post(params, new BaseCommonCallBack() {
|
| | | public void success() {
|
| | | List<Device> devices = resultBean.getListBeanOfType(Device.class);
|
| | | List<Device> devices = resultBean.getList(Device.class);
|
| | | if (devices.size() > 0) {
|
| | | final Device device = devices.get(0);
|
| | | BaseApplication.getInstance().setAndroidDevice(device);
|
| | |
| | | params.addBodyParameter(Device.FieldNames.type, CommonVariables.DeviceType.CAMERA1);
|
| | | x.http().post(params, new BaseCommonCallBack() {
|
| | | public void success() {
|
| | | List<Device> devices = resultBean.getListBeanOfType(Device.class);
|
| | | List<Device> devices = resultBean.getList(Device.class);
|
| | | if (devices.size() > 0) {
|
| | | final Device camera1 = devices.get(0);
|
| | | BaseApplication.getInstance().setCamera1(camera1);
|
| | |
| | | params.addBodyParameter(Device.FieldNames.type, CommonVariables.DeviceType.CAMERA2);
|
| | | x.http().post(params, new BaseCommonCallBack() {
|
| | | public void success() {
|
| | | List<Device> devices = resultBean.getListBeanOfType(Device.class);
|
| | | List<Device> devices = resultBean.getList(Device.class);
|
| | | if (devices.size() > 0) {
|
| | | final Device camera2 = devices.get(0);
|
| | | BaseApplication.getInstance().setCamera2(camera2);
|
| | |
| | | // params.addBodyParameter(Device.FieldNames.type, CommonVariables.DeviceType.ANDROID_DEVICE);
|
| | | // x.http().post(params, new BaseCommonCallBack() {
|
| | | // public void success() {
|
| | | // List<Device> places = resultBean.getListBeanOfType(Device.class);
|
| | | // List<Device> places = resultBean.getList(Device.class);
|
| | | // if (places.size() > 0) {
|
| | | // BaseApplication.getInstance().setAndroidDevice(places.get(0));
|
| | | // } else {
|
| | |
| | | ) {
|
| | | return;
|
| | | }
|
| | | List<Double> percents = resultBean.getListBeanOfType(Double.class);
|
| | | List<Double> percents = resultBean.getList(Double.class);
|
| | | if (percents != null && percents.size() > 0) {
|
| | | double percent = percents.get(0);
|
| | | if (percent >= 70) {
|
| | |
| | | @Override
|
| | | public void success() {
|
| | | try {
|
| | | SurveillanceQueryItemUtil.getInstance().addItems(resultBean.getListBeanOfType(SurveillanceQueryItem.class), bitmapList, cameraInOrOut);
|
| | | SurveillanceQueryItemUtil.getInstance().addItems(resultBean.getList(SurveillanceQueryItem.class), bitmapList, cameraInOrOut);
|
| | | } catch(Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|