Exemplo n.º 1
0
  public DonViHanhChinhSoap getDonViHanhChinhTheoUserId(Long userid) {
    try {

      List<TaiKhoanNguoiDung> cList =
          TaiKhoanNguoiDungLocalServiceUtil.findByTaiKhoanNguoiDung(userid, Constants.ACTIVATED);
      if (cList != null && cList.size() > 0) {
        TaiKhoanNguoiDung account = cList.get(0);
        List<CongChuc> congChucs =
            CongChucLocalServiceUtil.findByTaiKhoanNguoiDungId(account.getId());
        long coquanId = 0;
        if (congChucs.size() > 0) {
          coquanId = congChucs.get(0).getCoQuanQuanLyId();
        }

        if (coquanId > 0) {

          CoQuanQuanLy coquan = CoQuanQuanLyLocalServiceUtil.fetchCoQuanQuanLy(coquanId);
          if (coquan != null) {
            long donviId = coquan.getDonViHanhChinhId();
            if (donviId > 0) {
              return getDonViHanhchinhTheoId(donviId);
            }
          }
        }
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return null;
  }
Exemplo n.º 2
0
  public CoQuanQuanLySoap getCoQuanQuanLyTheoUserId(Long liferayUserid) {
    try {

      List<TaiKhoanNguoiDung> cList =
          TaiKhoanNguoiDungLocalServiceUtil.findByTaiKhoanNguoiDung(
              liferayUserid, Constants.ACTIVATED);

      if (cList != null && cList.size() > 0) {
        TaiKhoanNguoiDung account = cList.get(0);
        List<CongChuc> congChucs =
            CongChucLocalServiceUtil.findByTaiKhoanNguoiDungId(account.getId());
        // long coquanId = account.getCoQuanQuanLyId();
        if (congChucs.size() > 0) {
          long coquanId = congChucs.get(0).getCoQuanQuanLyId();
          return CoQuanQuanLySoap.toSoapModel(
              CoQuanQuanLyLocalServiceUtil.fetchCoQuanQuanLy(coquanId));
        }
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return null;
  }