public void handleMessage(Message msg) {
          if (!Thread.currentThread().isInterrupted()) {
            switch (msg.what) {
              case 1234:
                String str_content = "";
                File file = new File(zw_path);
                if (file.exists()) {
                  byte[] bytes = null;
                  try {
                    bytes = FileUtil.getBytesFromFile(file);
                  } catch (IOException e) {
                    e.printStackTrace();
                  }
                  str_content = Base64.encodeToString(bytes, Base64.DEFAULT);
                  getFlowFormElements.SaveArchiveData(
                      Detail_xzfwsh_chakantabs_MainActivity.this,
                      3000,
                      ArcStepID,
                      infofile.WFID().get(),
                      infofile.WFStepID().get(),
                      infoFile.infoUsername().get(),
                      infofile.infoUserType().get(),
                      str_content);
                }

                break;
              default:
                break;
            }
          }
        }
 private void getDatasFromInterface() {
   getFlowFormElements.getFlowFormElements(
       Detail_xzfwsh_chakantabs_MainActivity.this,
       1,
       infofile.infoUsername().get(),
       infofile.infoUserType().get(),
       FlowID,
       WFID,
       Integer.valueOf(infoFile.CurNode().get()).intValue());
 }
  private void initFilePath() {

    File file = new File(zw_path);
    if (!file.exists()) {
      file.mkdir();
    }
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒");
    Date curDate = new Date(System.currentTimeMillis()); // 获取当前时间
    String str = formatter.format(curDate);
    zw_path = zw_path + infoFile.infoUsername().get() + str + ".doc";
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.xzfw_xzfwsh_tabs_main);
    infofile = new InfoFile_(this);
    FlowID = infofile.FlowID().get();
    WFID = infofile.WFID().get();
    endTime = infofile.endTime().get();
    Title = infofile.Title().get();
    statusOfShenhe = infofile.statusOfSHENHE().get();
    WFStepID = infofile.WFStepID().get();

    InitTextView();
    getDatasFromInterface();

    // 生成广播处理
    receive = new receive();
    // 实例化过滤器并设置要过滤的广播
    IntentFilter intentFilter = new IntentFilter("com.kinggrid.iappoffice.save");
    intentFilter.addAction("checkSuccess");
    // 注册广播
    this.registerReceiver(receive, intentFilter);
  }
        @Override
        protected void handlerLoginInfo(Context context, HandleResult handleResult, int paramInt) {
          switch (paramInt) {
            case 1:
              // if (handleResult.getiSuccess() != null
              // && handleResult.getiSuccess().equals("success")) {
              getBrowseUser.getBrowseUser(Detail_xzfwsh_chakantabs_MainActivity.this, 1, WFID);
              // }
              if (handleResult.isSelPeople()) {
                ll_checkpeople.setVisibility(View.VISIBLE);
                ll_checkpeople1.setOnClickListener(
                    new OnClickListener() {

                      @Override
                      public void onClick(View v) {
                        Detail_xzfwsh_chakantabs_MainActivity.this.startActivityForResult(
                            new Intent(
                                Detail_xzfwsh_chakantabs_MainActivity.this,
                                PeopleCheck_Activity.class),
                            3000);
                      }
                    });
              }
              break;
            case 1000:
              if (handleResult.getiSuccess() != null
                  && handleResult.getiSuccess().equals("success")) {
                datas = handleResult.getDatas();
                infoFile.edit().TypeOfLast().put(1000).apply();
                if (!datas.getFlowAction().equals("BranchSel")) {
                  Intent intent = new Intent();
                  intent.setClass(
                      Detail_xzfwsh_chakantabs_MainActivity.this, FirstNextStepActivity.class);
                  Bundle bundle = new Bundle();
                  bundle.putString("stepName", datas.getFlowDescript());
                  bundle.putString("checkCode", datas.getCheckCode());
                  bundle.putString("checkName", datas.getCheckName());
                  bundle.putString("NextStepID", datas.getNextStepID());
                  intent.putExtras(bundle);
                  startActivity(intent);
                  // Detail_xzfwsh_chakantabs_MainActivity.this.finish();
                } else {
                  Intent intent = new Intent();
                  intent.setClass(
                      Detail_xzfwsh_chakantabs_MainActivity.this, SecondNextStepActivity.class);
                  infofile
                      .edit()
                      .FlowStepID()
                      .put(Integer.valueOf(datas.getNextStepID()).intValue())
                      .apply();
                  startActivity(intent);
                  // Detail_xzfwsh_chakantabs_MainActivity.this.finish();
                }
              }
              break;
            case 2000:
              if (handleResult.getiSuccess() != null
                  && handleResult.getiSuccess().equals("success")) {
                FileUtil.writeBase64StringToFile(handleResult.getContent(), zw_path);
                hasDownZW = true;
                if (iAppOffice != null) {
                  IAppOfficeUtil.OpenOfficeFile(iAppOffice, zw_path);
                }
              }
              break;
            case 3000:
              if (handleResult.getiSuccess() != null
                  && handleResult.getiSuccess().equals("success")) {
                ArcStepID = handleResult.getArcStepID();
                infoFile.edit().ArcStepID().put(ArcStepID).apply();
              }
              break;
            default:
              break;
          }
        }
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.back:
       this.finish();
       break;
     case R.id.ll1:
       DatePickDialog.showDateCheckDialog(this, tv_1, true);
       break;
     case R.id.btn_ty:
       Constants.shouwenOrfawen = 2000;
       Constants.passOrNot = 1;
       Constants.ShenHeYiJian = edt_shyj.getText().toString();
       Constants.userName = cxry_username.toString();
       Constants.userCode = cxry_usercode.toString();
       getFlowFormElements.GetCheckNextStepInfo(
           this,
           1000,
           FlowID,
           infofile.WFID().get(),
           0,
           infofile.CurNode().get() + "",
           "1",
           0,
           infofile.infoUsername().get());
       break;
     case R.id.btn_bty:
       Constants.shouwenOrfawen = 2000;
       Constants.passOrNot = 0;
       Constants.ShenHeYiJian = edt_shyj.getText().toString();
       Constants.userName = cxry_username.toString();
       Constants.userCode = cxry_usercode.toString();
       getFlowFormElements.GetCheckNextStepInfo(
           this,
           1000,
           FlowID,
           infofile.WFID().get(),
           0,
           infofile.CurNode().get() + "",
           "0",
           0,
           infofile.infoUsername().get());
       break;
     case R.id.btn_th:
       showInfo();
       break;
     case R.id.btn_ckzw:
       if (hasDownZW) {
         IAppOfficeUtil.OpenOfficeFile(iAppOffice, zw_path);
       } else {
         getFlowFormElements.LoadArchiveData(
             Detail_xzfwsh_chakantabs_MainActivity.this,
             2000,
             0,
             ArcStepID,
             infofile.WFID().get(),
             infofile.WFStepID().get());
       }
       // FileUtil.writeBase64StringToFile(
       // handleResult.getContent(), zw_path);
       // if (iAppOffice != null) {
       // IAppOfficeUtil.OpenOfficeFile(iAppOffice, zw_path);
       // }
       break;
     default:
       break;
   }
 }
  private void InitTextView() {
    infoFile = new InfoFile_(this);
    zw_path =
        Environment.getExternalStorageDirectory()
            + "/OADownFile/"
            + infoFile.infoUsername().get()
            + "/";
    tv_1 = (TextView) findViewById(R.id.tv_1);
    edt_tgbt = (EditText) findViewById(R.id.edt_tgbt);
    edt_shyj = (EditText) findViewById(R.id.edt_shyj);
    edt_tgbt.setEnabled(false);
    textView1 = (TextView) findViewById(R.id.tv_a);
    textView2 = (TextView) findViewById(R.id.tv_b);
    textView3 = (TextView) findViewById(R.id.tv_c);
    tv_llry = (TextView) findViewById(R.id.tv_llry);
    btn_ty = (Button) findViewById(R.id.btn_ty);
    btn_bty = (Button) findViewById(R.id.btn_bty);
    btn_th = (Button) findViewById(R.id.btn_th);
    btn_ckzw = (Button) findViewById(R.id.btn_ckzw);
    tv_gwbt = (TextView) findViewById(R.id.tv_gwbt);
    tv_gwbt.setText(infofile.Title().get());
    ll_btn = (LinearLayout) findViewById(R.id.ll_btn);
    ll_checkpeople = (LinearLayout) findViewById(R.id.ll_checkpeople);
    ll_checkpeople1 = (LinearLayout) findViewById(R.id.ll_checkpeople1);
    ll_textup1 = (LinearLayout) findViewById(R.id.ll_textup1);
    btn_ty.setOnClickListener(this);
    btn_bty.setOnClickListener(this);
    btn_th.setOnClickListener(this);
    btn_ckzw.setOnClickListener(this);
    textView1.setOnClickListener(new txListener(0));
    textView2.setOnClickListener(new txListener(1));
    textView3.setOnClickListener(new txListener(2));
    back = (ImageView) findViewById(R.id.back);
    back.setOnClickListener(this);
    tv_1.setText(endTime);
    edt_tgbt.setText(Title);
    if (statusOfShenhe.equals("1000")) {
      ll_textup1.setVisibility(View.VISIBLE);
      btn_ty.setVisibility(View.VISIBLE);
      btn_bty.setVisibility(View.VISIBLE);
      btn_th.setVisibility(View.VISIBLE);
    } else {
      ll_textup1.setVisibility(View.GONE);
      btn_ty.setVisibility(View.GONE);
      btn_bty.setVisibility(View.GONE);
      btn_th.setVisibility(View.GONE);
    }

    File file = new File(Environment.getExternalStorageDirectory() + "/OADownFile/");
    if (!file.exists()) {
      file.mkdir();
    }
    File file1 = new File(zw_path);
    if (!file1.exists()) {
      file1.mkdir();
    }
    initFilePath();
    iAppOffice = IAppOfficeUtil.getInstance(this);
    if (iAppOffice == null) {
      // btn_qczw.setClickable(false);
      Toast.makeText(this, "请正确安装wps应用!", Toast.LENGTH_SHORT).show();
    } else {
      // btn_qczw.setClickable(true);
    }
    infofile.edit().ArcStepID().put(0).apply(); // 初始化公文ID
  }