Пример #1
0
  @Override
  public void onResume() {
    super.onResume();

    if (!SystemConfig.isOperate) {
      edOrderTime.setEnabled(false);
    } else {
      edOrderTime.setEnabled(true);
    }
    // 已经是完成的任务
    if ("4".equals(checkStatue)) {
      SystemConfig.isOperate = false;
      TopManager.getInstance().getImbtnTongBu().setEnabled(false);
    }
    // 控制按钮操作性
    if (sContactView != null) {
      sContactView.controlEd();
    }
    setFourDopBtn();
    /**
     * ####################### ============================>>>>>> 【视频协助】 <<<<<<==============
     * #######################
     */
    TopManager.getInstance()
        .xiePeiYuanBtnViedo(
            new xiePeiBtnVideo() {
              @Override
              public void onClick() {
                if (SystemConfig.isOperate) {
                  // 可操作
                  if (registNo != null) {
                    new AsyncTask<Void, Void, CommonResponse>() {
                      @Override
                      protected CommonResponse doInBackground(Void... arg0) {
                        RedioRequest redioRequest = new RedioRequest();
                        redioRequest.setIsXeipei("1");
                        redioRequest.setLossNo("");
                        redioRequest.setNodeType("check");
                        redioRequest.setRegistNo(registNo);
                        redioRequest.setUserCode(SystemConfig.USERLOGINNAME);
                        redioRequest.setIMEI(DeviceUtils.getDeviceId(context));
                        redioRequest.setCerTainCallTime(checkTask.getContacttime());

                        redioRequest.setInsuredPhone(sContactView.getXiePeiViewValue().get(0));
                        redioRequest.setLinkName(sContactView.getXiePeiViewValue().get(1));
                        redioRequest.setLinkPhone(sContactView.getXiePeiViewValue().get(2));
                        redioRequest.setCerTainCallTime(checkTask.getContacttime());
                        if (checkTask.getContacttime() == null
                            || checkTask.getContacttime().equals("")) {
                          CommonResponse result = new CommonResponse();
                          result.setResponseCode("NO");
                          result.setResponseMessage("请联系完客户后在进行视频协助操作!");
                          return result;
                        } else if ("".equals(redioRequest.getInsuredPhone())) {
                          CommonResponse result = new CommonResponse();
                          result.setResponseCode("NO");
                          result.setResponseMessage("请填写被保险人电话,再在进行视频协助操作!");
                          return result;
                        } else {
                          saveData();
                          return RedioHttpService.redioService(
                              redioRequest, context.getString(R.string.http_url));
                        }
                      }

                      @Override
                      protected void onPreExecute() {
                        super.onPreExecute();
                        handler.sendEmptyMessage(ConstantValue.PROGRESS_OPEN);
                      }

                      @Override
                      protected void onPostExecute(CommonResponse result) {
                        if (result != null && "YES".equals(result.getResponseCode())) {
                          handler.sendEmptyMessage(ConstantValue.PROGRESS_CLOSE);
                          Intent hkVideoIntent = new Intent();
                          hkVideoIntent.setClass(context, MPUSDKActivity.class);
                          context.startActivity(hkVideoIntent);
                        } else {
                          handler.sendEmptyMessage(ConstantValue.PROGRESS_CLOSE);
                          // 提示错误信息
                          Message message = Message.obtain();
                          if (result != null) {
                            message.obj = result.getResponseMessage();
                          } else {
                            message.obj = "请求协助失败";
                          }
                          message.what = ConstantValue.ERROE;
                          handler.sendMessage(message);
                        }
                      };
                    }.execute();

                  } else {
                    Toast.showToast(context, "获取报案号失败");
                  }
                }
              }
            });

    // 理赔交互和提交
    TopManager.getInstance()
        .setTopBtnSumbitSurvery(
            new TopBtnSumbitSurvery() {
              @Override
              public void OnclickSumbit() {
                if (SystemConfig.isOperate) {
                  /**
                   * *********************** ============================>>>>>> 【查勘提交】
                   * <<<<<<============== ***********************
                   */
                  // 校验身份证号码是否为空
                  String idCard =
                      DataConfig.tblTaskQuery.getCheckDriver().get(0).getIdentifyNumber();
                  // 判断是否有联系过客户
                  boolean isTakephotos = TblTaskinfo.checkIsTakephotos(registNo);
                  if (isTakephotos) {
                    Toast.showToast(context, "请先在现场拍摄一张照片!");
                  } else if (!CheckSurveyValue.idCardIsNull || !CheckSurveyValue.idCard(idCard)) {
                    new AsyncTask<Void, Void, CommonResponse>() {
                      @Override
                      protected void onPreExecute() {
                        handler.sendEmptyMessage(ConstantValue.PROGRESSSUMBIT_OPEN);
                        TblTaskQuery.insertOrUpdate(
                            SystemConfig.dbhelp.getWritableDatabase(),
                            DataConfig.tblTaskQuery,
                            true,
                            false,
                            false);
                      };

                      @Override
                      protected void onPostExecute(CommonResponse result) {
                        if ("YES".equals(result.getResponseCode())) {
                          handler.sendEmptyMessage(ConstantValue.PROGRESSSUMBIT_CLOSE);
                          Toast.showToastTest(context, "查勘提交成功!");
                          ContentValues values = new ContentValues();
                          values.put("surveytaskstatus", "4");
                          values.put("completetime", result.getHandletime());
                          DBUtils.update(
                              "checktask", values, "registno=?", new String[] {registNo});

                          // 判断是否有上传队列
                          if (CreateZipFile.saveZIPMSG(
                              context,
                              SystemConfig.PHOTO_TEMP,
                              SystemConfig.PHOTO_CLAIMNO,
                              SystemConfig.LOSSNO)) {
                            // 全部清除缓存
                            UiManager.getInstance().clearViewCache();
                            UiManager.getInstance()
                                .changeView(UploadActivity.class, false, null, false);
                            AlarmClockManager.getInstance(context)
                                .remove(CheckTaskAccess.findByRegistno(registNo));
                          } else {
                            // 全部清除缓存
                            UiManager.getInstance().clearViewCache();
                            UiManager.getInstance()
                                .changeView(SurveyTaskActivity.class, false, null, false);
                            AlarmClockManager.getInstance(context)
                                .remove(CheckTaskAccess.findByRegistno(registNo));
                          }
                        } else {
                          handler.sendEmptyMessage(ConstantValue.PROGRESSSUMBIT_CLOSE);
                          Message message = Message.obtain();
                          message.obj = result.getResponseMessage();
                          message.what = ConstantValue.ERROE;
                          handler.sendMessage(message);
                        }
                      };

                      @Override
                      protected CommonResponse doInBackground(Void... params) {
                        DataConfig.tblTaskQuery =
                            TblTaskQuery.getTaskQuery(
                                SystemConfig.dbhelp.getWritableDatabase(),
                                DataConfig.tblTaskQuery.getRegistNo());
                        DataConfig.tblTaskQuery.setSubmitType("submit");
                        return CheckSubmitHttpService.checkSubmitService(
                            DataConfig.tblTaskQuery, context.getString(R.string.http_url));
                      }
                    }.execute();
                  } else {
                    Toast.showToast(context, "驾驶人信息-身份证号码不能为空!");
                  }
                } else {
                  Toast.showToast(context, "不能【查勘提交】,请确定是否“受理任务”或“继续处理”!");
                }
              }

              @Override
              public void OnclickTongBu() {
                if (SystemConfig.isOperate) {
                  /**
                   * *********************** ============================>>>>>> 【查勘同步】
                   * <<<<<<============== ***********************
                   */
                  // 判断是否有联系过客户
                  boolean isTakephotos = TblTaskinfo.checkIsTakephotos(registNo);
                  if (isTakephotos) {
                    Toast.showToast(context, "请先在现场拍摄一张照片!");
                  } else {
                    new AsyncTask<Void, Void, CommonResponse>() {
                      @Override
                      protected void onPreExecute() {
                        handler.sendEmptyMessage(ConstantValue.PROGRESSTONGBU_OPEN);
                        TblTaskQuery.insertOrUpdate(
                            dbHelper.getWritableDatabase(),
                            DataConfig.tblTaskQuery,
                            true,
                            false,
                            false);
                      };

                      @Override
                      protected void onPostExecute(CommonResponse result) {
                        if ("YES".equals(result.getResponseCode())) {
                          handler.sendEmptyMessage(ConstantValue.PROGRESSTONGBU_CLOSE);
                          Toast.showToastTest(context, "同步理赔成功!");
                          CheckTask checkTask = CheckTaskAccess.findByRegistno(registNo);
                          checkTask.setSurveytaskstatus("2");
                          checkTask.setSynchrostatus("synchroApply");
                          List<CheckTask> list = new ArrayList<CheckTask>();
                          list.add(checkTask);
                          CheckTaskAccess.insertOrUpdate(list, true);

                          // 判断是否有上传队列
                          if (CreateZipFile.saveZIPMSG(
                              context,
                              SystemConfig.PHOTO_TEMP,
                              SystemConfig.PHOTO_CLAIMNO,
                              SystemConfig.LOSSNO)) {
                            // 全部清除缓存
                            UiManager.getInstance().clearViewCache();
                            UiManager.getInstance()
                                .changeView(UploadActivity.class, false, null, false);
                            AlarmClockManager.getInstance(context)
                                .remove(CheckTaskAccess.findByRegistno(registNo));

                            // Toast.showToast(context, "开始上传,请稍等...");
                          } else {
                            // 全部清除缓存
                            UiManager.getInstance().clearViewCache();
                            UiManager.getInstance()
                                .changeView(SurveyTaskActivity.class, false, null, false);
                            AlarmClockManager.getInstance(context)
                                .remove(CheckTaskAccess.findByRegistno(registNo));
                          }
                        } else {
                          handler.sendEmptyMessage(ConstantValue.PROGRESSTONGBU_CLOSE);
                          Message message = Message.obtain();
                          message.obj = result.getResponseMessage();
                          message.what = ConstantValue.ERROE;
                          handler.sendMessage(message);
                        }
                      };

                      @Override
                      protected CommonResponse doInBackground(Void... params) {
                        DataConfig.tblTaskQuery =
                            TblTaskQuery.getTaskQuery(
                                SystemConfig.dbhelp.getWritableDatabase(),
                                DataConfig.tblTaskQuery.getRegistNo());
                        DataConfig.tblTaskQuery.setSubmitType("synch");
                        return CheckSubmitHttpService.checkSubmitService(
                            DataConfig.tblTaskQuery, context.getString(R.string.http_url));
                      }
                    }.execute();
                  }
                } else {
                  Toast.showToast(context, "不能【查勘同步】,请确定是否“受理任务”或“继续处理”!");
                }
              }
            });

    // 理赔同步撤销
    TopManager.getInstance()
        .btnTongBuSurveryContinue(
            new TopBtnTongBuSurveryContinue() {
              @Override
              public void onClick() {
                synchCancel();
              }
            });

    taskInfoAdapter = new SurveyTaskInfoAdapter(DataConfig.tblTaskQuery, context);
    taskListView.setAdapter(taskInfoAdapter);
  }
Пример #2
0
 @Override
 public void onPause() {
   saveData();
   super.onPause();
 }