private TaiLieuDinhKem getTailieuDinhKemBoiIdStep2(Long chungthucId) {
    // TODO Auto-generated method stub
    log.info("1.step 1 chungthuc Id:" + chungthucId);
    try {
      TaiLieuChungThuc chungThuc =
          TaiLieuChungThucLocalServiceUtil.fetchTaiLieuChungThuc(chungthucId);
      if (chungThuc == null) {
        log.info("2. null objct chungthuc by id");
        chungThuc = TaiLieuChungThucLocalServiceUtil.getTaiLieuChungThuc(chungthucId);
      }
      if (chungThuc != null) {
        DanhMucGiayTo type =
            DanhMucGiayToLocalServiceUtil.fetchDanhMucGiayTo(chungThuc.getDanhMucGiayToId());

        if (type == null) {
          log.info("3. null object  danhmuc by id");
          type = DanhMucGiayToLocalServiceUtil.getDanhMucGiayTo(chungThuc.getDanhMucGiayToId());
        }
        if (type != null) {
          TaiLieuDinhKem dinhKem = new TaiLieuDinhKem(DanhMucGiayToSoap.toSoapModel(type));
          dinhKem.setTailieuChungThuc(TaiLieuChungThucSoap.toSoapModel(chungThuc));
          dinhKem.setUrl(
              WebserviceFactory.getThamSoService().getValue(Constants.ThamSo.DOMAIN)
                  + storage.getURLById(chungThuc.getNoiLuuTruId()));
          return dinhKem;
        }
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      log.info("document-------------error:" + e.getMessage());

      // e.printStackTrace();
    }
    return null;
  }
  public TaiLieuDinhKem getThongTinTaiLieuDinhKem(Long thutucId, Long chungthucId) {
    // TODO Auto-generated method stub
    try {
      TaiLieuChungThuc chungThuc =
          TaiLieuChungThucLocalServiceUtil.getTaiLieuChungThuc(chungthucId);

      if (chungThuc != null) {
        List<ThuTuc2GiayTo> gList =
            ThuTuc2GiayToLocalServiceUtil.getDSTT2GiayTo(
                thutucId, chungThuc.getDanhMucGiayToId(), Constants.STEP.STEP1);
        if (gList != null && gList.size() > 0) {
          DanhMucGiayTo type =
              DanhMucGiayToLocalServiceUtil.getDanhMucGiayTo(chungThuc.getDanhMucGiayToId());
          if (type != null) {
            TaiLieuDinhKem dinhKem = new TaiLieuDinhKem(DanhMucGiayToSoap.toSoapModel(type));
            dinhKem.setTailieuChungThuc(TaiLieuChungThucSoap.toSoapModel(chungThuc));
            dinhKem.setUrl(
                WebserviceFactory.getThamSoService().getValue(Constants.ThamSo.DOMAIN)
                    + storage.getURLById(chungThuc.getNoiLuuTruId()));
            if (gList.get(0).getBatBuoc() == 1) {
              dinhKem.setBatBuoc(true);
            } else {
              dinhKem.setBatBuoc(false);
            }

            return dinhKem;
          }
        }
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block

    }
    return null;
  }
  public TaiLieuDinhKem getPhienBanMoiNhatTheoMa(Long userId, String code) {
    // TODO Auto-generated method stub
    DanhMucGiayTo type = DanhMucGiayToLocalServiceUtil.getGiayToBoiMa(code);
    TaiKhoanNguoiDung account = SharedserviceUtil.getTaiKhoanNguoiDungByLiferayId(userId);
    if (account == null) return null;

    if (type != null) {
      try {
        TaiLieuChungThuc chungThuc =
            TaiLieuChungThucLocalServiceUtil.getCurrentVersion(type.getId(), account.getId());
        if (chungThuc != null) {
          TaiLieuDinhKem dinhKem = new TaiLieuDinhKem(DanhMucGiayToSoap.toSoapModel(type));
          dinhKem.setTailieuChungThuc(TaiLieuChungThucSoap.toSoapModel(chungThuc));
          dinhKem.setUrl(
              WebserviceFactory.getThamSoService().getValue(Constants.ThamSo.DOMAIN)
                  + storage.getURLById(chungThuc.getNoiLuuTruId()));
          return dinhKem;
        }
      } catch (Exception e) {
        // TODO: handle exception
      }
    }

    return null;
  }