Example usage for com.liferay.portal.kernel.servlet SessionMessages add

List of usage examples for com.liferay.portal.kernel.servlet SessionMessages add

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.servlet SessionMessages add.

Prototype

public static void add(PortletRequest portletRequest, String key) 

Source Link

Usage

From source file:org.oep.cmon.portlet.ipmslist.action.IPMSListPortlet.java

License:Apache License

/**
 * This is function tiepNhanHoSo// www.  j  av  a2  s  . co m
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 */
public void tiepNhanHoSo(ActionRequest actionRequest, ActionResponse actionResponse) {
    long idHoSo = ParamUtil.getLong(actionRequest, "idHoSo");

    if (idHoSo > 0) {
        // get account can bo
        try {
            //String accountCanBo = PortalUtil.getUser(actionRequest).getEmailAddress();
            long userId = PortalUtil.getUserId(actionRequest);
            TaiKhoanNguoiDung nguoiDung = TaiKhoanNguoiDungLocalServiceUtil.findByTaiKhoanNguoiDungId(userId);
            CongChuc congChuc = CongChucLocalServiceUtil.findByTaiKhoanNguoiDungId(nguoiDung.getId()).get(0);

            //boolean ok = handleMovingUengine(idHoSo, accountCanBo, congChuc);

            /*            JSONObject json = JSONFactoryUtil.createJSONObject();
                        json.put("status", ok);
                         resourceResponse.getWriter().write(json.toString());*/
            HoSoTTHCCong hoSoTTHCC = HoSoTTHCCongLocalServiceUtil.getHoSoTTHCCong(idHoSo);
            ThuTucHanhChinh tthc = ThuTucHanhChinhLocalServiceUtil
                    .fetchThuTucHanhChinh(hoSoTTHCC.getThuTucHanhChinhId());

            // Get kieu ung dung cua thu tuc hanh chinh
            String code = ConfigUtils.getValue("vn.dtt.dlms.code");
            String appCode = WebserviceFactory.getThamSoService().getValue(code);
            DanhMucUngDung ungDung = DanhMucUngDungLocalServiceUtil.getUngDungTheoMa(appCode);

            NhomThuTucHanhChinh nhomTTHC = NhomThuTucHanhChinhLocalServiceUtil
                    .getNhomThuTucHanhChinh(tthc.getNhomThuTucHanhChinhId());
            if (ungDung.getId() == nhomTTHC.getDanhMucUngDungId()) { //in case thu tuc hanh chinh thuoc ve app lai xe

                TichHopLaiXeUtil tichHopLaiXe = new TichHopLaiXeUtil();

                boolean ketquaTichHopLaiXe = tichHopLaiXe.tichHopVoiSoGiaoThong(idHoSo);

                if (!ketquaTichHopLaiXe) {
                    PortletConfig portletConfig = (PortletConfig) actionRequest
                            .getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);
                    SessionMessages.add(actionRequest, portletConfig.getPortletName()
                            + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);

                    actionResponse.setRenderParameter("jspPage",
                            "/html/portlet/ipmslistportlet/LoiTichHopLaiXe.jsp");
                    return;
                }
            }

            Date currentDate = new Date();
            TTHC2CoQuanQuanLy tthc2CoQuanQuanLy = TTHC2CoQuanQuanLyLocalServiceUtil
                    .findByCoQuanAndThuTuc(hoSoTTHCC.getCoQuanTiepNhanId(), hoSoTTHCC.getThuTucHanhChinhId())
                    .get(0);

            long tthcSoNgayXuLy = tthc2CoQuanQuanLy.getSoNgayXyLy();

            CoQuanQuanLy coQuanQuanLy = CoQuanQuanLyLocalServiceUtil
                    .fetchCoQuanQuanLy(hoSoTTHCC.getCoQuanTiepNhanId());

            // Tinh toan ngay hen tra
            Calendar c = Calendar.getInstance();
            c.setTime(currentDate);
            c.add(Calendar.DATE, (int) tthcSoNgayXuLy);
            Date ngayHenTra = c.getTime();

            hoSoTTHCC.setSoNgayXuLy(tthcSoNgayXuLy);

            hoSoTTHCC.setNgayNhanHoSo(currentDate);
            hoSoTTHCC.setNgayHenTraKetQua(ngayHenTra);

            if (hoSoTTHCC.getTrangThaiHoSo() == Constants.TRANGTHAIHOSO.HO_SO_MOI_DANG_KY_TRUC_TUYEN) {
                hoSoTTHCC.setTrangThaiHoSo(Constants.HOSO_TTHC_CONG_TRANG_THAI_HOSO_MOI_TIEP_NHAN);
            } else {
                hoSoTTHCC.setTrangThaiHoSo(Constants.HOSO_TTHC_CONG_TRANG_THAI_HOSO_DANG_XU_LY);
            }

            hoSoTTHCC.setCanBoTiepNhanId(congChuc.getId());

            if (hoSoTTHCC.getMaSoBienNhan() == null || hoSoTTHCC.getMaSoBienNhan().length() == 0) {
                hoSoTTHCC.setMaSoBienNhan(
                        MaSoBienNhanUtil.get(coQuanQuanLy.getMaCapSoBienNhan(), tthc.getMaDNG(), true));
            }

            // save the data
            HoSoTTHCCongLocalServiceUtil.updateHoSoTTHCCong(hoSoTTHCC);

        } catch (PortalException e) {
            e.printStackTrace();
        } catch (SystemException e) {
            e.printStackTrace();
        }
    }

    actionResponse.setRenderParameter("id", ParamUtil.getString(actionRequest, "idHoSo"));
    actionResponse.setRenderParameter("idHoSo", ParamUtil.getString(actionRequest, "idHoSo"));
    actionResponse.setRenderParameter("jspPage",
            "/html/portlet/ipmslistportlet/detailsHoSo/Details_DangKyMoi_choTn.jsp");
}

From source file:org.oep.cmon.portlet.ipmslist.business.FormOfflineBusiness.java

License:Apache License

/**
 * This is function doiChieuHoSoRequest/* w w w  .  ja va 2 s. co m*/
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void doiChieuHoSoRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    String HosotthcCongId = ParamUtil.getString(actionRequest, "HosotthcCongId");
    try {
        boolean isSuccess = true;
        List<FileDinhKem> liFileUploadsIserviceAllGiaiDoan1 = ConvertUtil.convertFromObjectToFileDinhKem(
                FileDinhKemLocalServiceUtil.findFileDinhKemByHoSoTTHCCongIdGiaiDoan1NopOnline(
                        ConvertUtil.convertToLong(HosotthcCongId)));
        for (FileDinhKem fileUpload : liFileUploadsIserviceAllGiaiDoan1) {
            try {
                TaiLieuChungThuc taiLieuChungThuc = ConvertUtil
                        .getTaiLieuChungThucFromNoiLuuTruTaiLieuId(fileUpload);
                if (taiLieuChungThuc != null) {
                    long taiLieuChungThucId = taiLieuChungThuc.getId();
                    int doiChieu = ParamUtil.getInteger(actionRequest, "doiChieu_" + taiLieuChungThucId);

                    if (doiChieu == org.oep.cmon.portlet.mapping.utils.Constaints.Document.chuaDoiChieu) {
                        taiLieuChungThuc.setHieuLucTuNgay(null);
                        taiLieuChungThuc.setHieuLucDenNgay(null);
                    } else {
                        String tuNgay = ParamUtil.getString(actionRequest, "tuNgay_" + taiLieuChungThucId);
                        String denNgay = ParamUtil.getString(actionRequest, "denNgay_" + taiLieuChungThucId);
                        Date tuNgayDate = null;
                        Date denNgayDate = null;
                        if (Validator.isNotNull(tuNgay)) {
                            tuNgayDate = org.oep.cmon.admin.portlet.util.ConvertUtil.parseStringToDate(tuNgay);
                        }
                        if (Validator.isNotNull(denNgay)) {
                            denNgayDate = org.oep.cmon.admin.portlet.util.ConvertUtil
                                    .parseStringToDate(denNgay);

                            if (tuNgayDate.compareTo(denNgayDate) > 0) {
                                SessionErrors.add(actionRequest, "errorHieuLuc");
                                isSuccess = false;
                                break;
                            }
                        }
                        taiLieuChungThuc.setHieuLucTuNgay(tuNgayDate);
                        taiLieuChungThuc.setHieuLucDenNgay(denNgayDate);
                    }
                    taiLieuChungThuc.setTrangThai(doiChieu);
                    TaiLieuChungThucLocalServiceUtil.updateTaiLieuChungThuc(taiLieuChungThuc);
                }
            } catch (Exception es) {
                es.printStackTrace();
            }
        }
        if (isSuccess) {
            actionRequest.setAttribute("doi_chieu_completed", "doi_chieu_completed");
            SessionMessages.add(actionRequest, "doi_chieu_completed");
        }
    } catch (Exception es) {
        SessionErrors.add(actionRequest, "errorDoiChieuHoSo");
    }

    actionResponse.setRenderParameter("transactionKeyword",
            ParamUtil.getString(actionRequest, "transactionKeyword"));
    actionResponse.setRenderParameter("statusHS", ParamUtil.getString(actionRequest, "statusHS"));
    actionResponse.setRenderParameter("backUrl", ParamUtil.getString(actionRequest, "backUrl"));
    actionResponse.setRenderParameter("transType", ParamUtil.getString(actionRequest, "transType"));
    actionResponse.setRenderParameter("HosotthcCongId", HosotthcCongId);
    actionResponse.setRenderParameter("jspPage",
            "/html/portlet/ipmslistportlet/offline/doiChieuHoSoChiTiet.jsp");
}

From source file:org.oep.cmon.portlet.ipmslist.business.FormOfflineBusiness.java

License:Apache License

/**
 * This is function doiChieuHoSoDoanhNghiepRequest
 * Version: 1.0//from   www . j  a v  a 2 s  .  c o  m
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void doiChieuHoSoDoanhNghiepRequest(ActionRequest actionRequest, ActionResponse actionResponse)
        throws Exception {
    String HosotthcCongId = ParamUtil.getString(actionRequest, "HosotthcCongId");
    try {
        List<FileDinhKem> liFileUploadsIserviceAllGiaiDoan1 = ConvertUtil.convertFromObjectToFileDinhKem(
                FileDinhKemLocalServiceUtil.findFileDinhKemByHoSoTTHCCongIdGiaiDoan1NopOnline(
                        ConvertUtil.convertToLong(HosotthcCongId)));
        String fileDinhKemId = "";
        FileDinhKem fileDinhKem = null;
        for (FileDinhKem fileUpload : liFileUploadsIserviceAllGiaiDoan1) {
            fileDinhKemId = ParamUtil.getString(actionRequest, String.valueOf(fileUpload.getId()));
            try {
                fileDinhKem = FileDinhKemLocalServiceUtil.fetchFileDinhKem(fileUpload.getId());
                if (fileDinhKem != null) {
                    if (fileDinhKemId.trim().length() > 0) {
                        fileDinhKem.setDaDoiChieu(1);// File nay da doi chieu.
                    } else {
                        fileDinhKem.setDaDoiChieu(0);// File nay da doi chieu.
                    }
                    FileDinhKemLocalServiceUtil.updateFileDinhKem(fileDinhKem);
                }
            } catch (Exception es) {
                es.printStackTrace();
            }
        }
        SessionMessages.add(actionRequest, "doi_chieu_completed");
        actionRequest.setAttribute("doi_chieu_completed", "doi_chieu_completed");
    } catch (Exception es) {
        SessionErrors.add(actionRequest, "erorDoiChieuHoSo");
    }

    actionResponse.setRenderParameter("transactionKeyword",
            ParamUtil.getString(actionRequest, "transactionKeyword"));
    actionResponse.setRenderParameter("statusHS", ParamUtil.getString(actionRequest, "statusHS"));
    actionResponse.setRenderParameter("transType", ParamUtil.getString(actionRequest, "transType"));
    actionResponse.setRenderParameter("HosotthcCongId", HosotthcCongId);
    actionResponse.setRenderParameter("jspPage",
            "/html/portlet/ipmslistportlet/company/doiChieuHoSoChiTiet.jsp");
}

From source file:org.oep.cmon.portlet.ipmslist.business.FormOfflineBusiness.java

License:Apache License

/**
 * This is function traHoSoRequest/*from ww w . j  a va 2 s .c  om*/
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void traHoSoRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    User user = PortalUtil.getUser(actionRequest);
    String searchKeyWord = ParamUtil.getString(actionRequest, "transactionKeyword");
    String HosotthcCongId = ParamUtil.getString(actionRequest, "HosotthcCongId");
    String trangThaiHoSo = ParamUtil.getString(actionRequest, "trangThaiHoSo");
    String ghiChu = ParamUtil.getString(actionRequest, "ghiChu");
    String statusHS = ParamUtil.getString(actionRequest, "statusHS");
    String cqqlId = ParamUtil.getString(actionRequest, "cqqlId");

    try {
        if (HosotthcCongId.trim().length() > 0) {
            HoSoTTHCCong hoSoTTHCCong = HoSoTTHCCongLocalServiceUtil
                    .fetchHoSoTTHCCong(ConvertUtil.convertToLong(HosotthcCongId));
            TaiKhoanNguoiDung taiKhoanNguoiDung = ConvertUtil.findTaiKhoanNguoiDungByUserID(user.getUserId());
            List<CongChuc> liChucs = CongChucLocalServiceUtil
                    .findByTaiKhoanNguoiDungId(taiKhoanNguoiDung.getId());
            if (liChucs.size() > 0) {
                CongChuc congChuc = liChucs.get(0);
                ChucVu chucVu = ConvertUtil.findChucVuByTaiKhoanNguoiDungID(taiKhoanNguoiDung.getId(),
                        ConvertUtil.convertToLong(cqqlId));
                hoSoTTHCCong.setCanBoTraKetQuaId(congChuc.getId());
                hoSoTTHCCong.setChucVuCanBoTraKetQua(chucVu.getTen());
            }

            hoSoTTHCCong.setTrangThaiHoSo(5); // Day la trang thai da tra ho so.
            hoSoTTHCCong.setGhiChu(ghiChu);
            hoSoTTHCCong.setNgaySua(new Date());
            hoSoTTHCCong.setNgayTraKetQua(new Date());
            hoSoTTHCCong.setNguoiSua(user.getEmailAddress());

            HoSoTTHCCongLocalServiceUtil.updateHoSoTTHCCong(hoSoTTHCCong);
            List<FileDinhKem> liFileUploads = ConvertUtil
                    .convertFromObjectToFileDinhKem(FileDinhKemLocalServiceUtil
                            .findFileDinhKemByHoSoTTHCCongIdAndGiaiDoan(hoSoTTHCCong.getId(), 3));
            String traKetQuaId = "";
            FileDinhKem fileDinhKem = null;
            for (FileDinhKem fileUpload : liFileUploads) {
                traKetQuaId = ParamUtil.getString(actionRequest, fileUpload.getId() + "_trachocongdan");
                if (traKetQuaId.trim().length() > 0) {
                    try {
                        fileDinhKem = FileDinhKemLocalServiceUtil
                                .fetchFileDinhKem(ConvertUtil.convertToLong(traKetQuaId));
                        fileDinhKem.setDaTra(1);// File nay tra lai cho cong dan.
                        FileDinhKemLocalServiceUtil.updateFileDinhKem(fileDinhKem);
                    } catch (Exception es) {
                        es.printStackTrace();
                    }
                }
            }
            SessionMessages.add(actionRequest, "update_ho_so_completed");
        }
    } catch (Exception es) {
        SessionErrors.add(actionRequest, "erorUpdateFormForm");
    }

    actionResponse.setRenderParameter("transactionKeyword", searchKeyWord);
    actionResponse.setRenderParameter("statusHS", statusHS);
    actionResponse.setRenderParameter("transType", trangThaiHoSo);
    actionResponse.setRenderParameter("HosotthcCongId", HosotthcCongId);
    actionResponse.setRenderParameter("ghiChu", ghiChu);
    actionResponse.setRenderParameter("jspPage", "/html/portlet/ipmslistportlet/offline/traKetQua.jsp");
}

From source file:org.oep.cmon.portlet.ipmslist.business.FormOfflineBusiness.java

License:Apache License

/**
 * This is function traHoSoDoanhNghiepRequest
 * Version: 1.0//from   ww w  .  ja  v  a2 s .c  o  m
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void traHoSoDoanhNghiepRequest(ActionRequest actionRequest, ActionResponse actionResponse)
        throws Exception {
    User user = PortalUtil.getUser(actionRequest);
    String searchKeyWord = ParamUtil.getString(actionRequest, "transactionKeyword");
    String HosotthcCongId = ParamUtil.getString(actionRequest, "HosotthcCongId");
    String trangThaiHoSo = ParamUtil.getString(actionRequest, "trangThaiHoSo");
    String ghiChu = ParamUtil.getString(actionRequest, "ghiChu");
    String statusHS = ParamUtil.getString(actionRequest, "statusHS");
    String cqqlId = ParamUtil.getString(actionRequest, "cqqlId");

    try {
        if (HosotthcCongId.trim().length() > 0) {
            HoSoTTHCCong hoSoTTHCCong = HoSoTTHCCongLocalServiceUtil
                    .fetchHoSoTTHCCong(ConvertUtil.convertToLong(HosotthcCongId));
            TaiKhoanNguoiDung taiKhoanNguoiDung = ConvertUtil.findTaiKhoanNguoiDungByUserID(user.getUserId());
            List<CongChuc> liChucs = CongChucLocalServiceUtil
                    .findByTaiKhoanNguoiDungId(taiKhoanNguoiDung.getId());
            if (liChucs.size() > 0) {
                CongChuc congChuc = liChucs.get(0);
                ChucVu chucVu = ConvertUtil.findChucVuByTaiKhoanNguoiDungID(taiKhoanNguoiDung.getId(),
                        ConvertUtil.convertToLong(cqqlId));
                hoSoTTHCCong.setCanBoTraKetQuaId(congChuc.getId());
                hoSoTTHCCong.setChucVuCanBoTraKetQua(chucVu.getTen());
            }

            hoSoTTHCCong.setTrangThaiHoSo(5); // Day la trang thai da tra ho so.
            hoSoTTHCCong.setGhiChu(ghiChu);
            hoSoTTHCCong.setNgaySua(new Date());
            hoSoTTHCCong.setNgayTraKetQua(new Date());
            hoSoTTHCCong.setNguoiSua(user.getEmailAddress());

            HoSoTTHCCongLocalServiceUtil.updateHoSoTTHCCong(hoSoTTHCCong);
            List<FileDinhKem> liFileUploads = ConvertUtil
                    .convertFromObjectToFileDinhKem(FileDinhKemLocalServiceUtil
                            .findFileDinhKemByHoSoTTHCCongIdAndGiaiDoan(hoSoTTHCCong.getId(), 3));
            String traKetQuaId = "";
            FileDinhKem fileDinhKem = null;
            for (FileDinhKem fileUpload : liFileUploads) {
                traKetQuaId = ParamUtil.getString(actionRequest, fileUpload.getId() + "_trachocongdan");
                if (traKetQuaId.trim().length() > 0) {
                    try {
                        fileDinhKem = FileDinhKemLocalServiceUtil
                                .fetchFileDinhKem(ConvertUtil.convertToLong(traKetQuaId));
                        fileDinhKem.setDaTra(1);// File nay tra lai cho cong dan.
                        FileDinhKemLocalServiceUtil.updateFileDinhKem(fileDinhKem);
                    } catch (Exception es) {
                        es.printStackTrace();
                    }
                }
            }
            SessionMessages.add(actionRequest, "update_ho_so_completed");
        }
    } catch (Exception es) {
        SessionErrors.add(actionRequest, "erorUpdateFormForm");
    }

    actionResponse.setRenderParameter("transactionKeyword", searchKeyWord);
    actionResponse.setRenderParameter("statusHS", statusHS);
    actionResponse.setRenderParameter("transType", trangThaiHoSo);
    actionResponse.setRenderParameter("HosotthcCongId", HosotthcCongId);
    actionResponse.setRenderParameter("ghiChu", ghiChu);
    actionResponse.setRenderParameter("jspPage", "/html/portlet/ipmslistportlet/company/traKetQua.jsp");
}

From source file:org.oep.cmon.portlet.ipmslist.business.FormOfflineBusiness.java

License:Apache License

/**
 * This is function addHoSoRequest/*from  w ww  .  j a va2s.  c  om*/
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void addHoSoRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    String transactionKeyword = ParamUtil.getString(actionRequest, "transactionKeyword").trim();
    String transType = ParamUtil.getString(actionRequest, "transType").trim();
    String statusHS = ParamUtil.getString(actionRequest, "statusHS").trim();

    actionResponse.setRenderParameter("jspPage", "/html/portlet/ipmslistportlet/offline/inputHoSo.jsp");
    actionResponse.setRenderParameter("transactionKeyword", transactionKeyword);
    actionResponse.setRenderParameter("transType", transType);
    actionResponse.setRenderParameter("statusHS", statusHS);

    long hoSoThuTucHanhChinhCongId = 0;
    User user = PortalUtil.getUser(actionRequest);
    String searchKeyWord = ParamUtil.getString(actionRequest, "searchKeyWord");
    String _searchKeyWord = ParamUtil.getString(actionRequest, "_searchKeyWord");
    String idQuyTrinh = ParamUtil.getString(actionRequest, "idQuyTrinh");
    String idCongDan = ParamUtil.getString(actionRequest, "idCongDan");
    String coQuanTiepNhanTen = ParamUtil.getString(actionRequest, "coQuanTiepNhanTen");
    String coQuanTiepNhanId = ParamUtil.getString(actionRequest, "coQuanTiepNhanId");
    String tenQuyTrinh = ParamUtil.getString(actionRequest, "tenQuyTrinh");
    String tenCongDan = ParamUtil.getString(actionRequest, "tenCongDan");
    String diaChiThuongTruCongDan = ParamUtil.getString(actionRequest, "diaChiThuongTruCongDan");
    String cmndCongDan = ParamUtil.getString(actionRequest, "cmndCongDan");
    String ngaySinhCongDan = ParamUtil.getString(actionRequest, "ngaySinhCongDan");
    String ngayNopHoSo = ParamUtil.getString(actionRequest, "ngayNopHoSo");
    String ngayTraHoSo = ParamUtil.getString(actionRequest, "ngayTraHoSo");
    String soDienThoaiCongDan = ParamUtil.getString(actionRequest, "soDienThoaiCongDan")
            .replace("soDienThoaiCongDan", "").trim();

    if (validationData(soDienThoaiCongDan, actionRequest)) {
        try {
            hoSoThuTucHanhChinhCongId = CounterLocalServiceUtil.increment(CMON_HOSOTTHCCONG_SEQUENCE);
            HoSoTTHCCong hoSoTTHCCong = new HoSoTTHCCongClp();
            hoSoTTHCCong.setId(hoSoThuTucHanhChinhCongId);
            String maSoHoSo = getMaHoSoSo(getMaQuyTrinh(ConvertUtil.convertToLong(idQuyTrinh)), false);
            hoSoTTHCCong.setMaSoHoSo(maSoHoSo);//"MAHOSOODAY"
            hoSoTTHCCong.setNgayNopHoSo(new Date());
            hoSoTTHCCong.setTenCoQuanTiepNhan(coQuanTiepNhanTen);
            hoSoTTHCCong.setTenThuTucHanhChinh(tenQuyTrinh);

            TaiKhoanNguoiDung taiKhoanNguoiDung = ConvertUtil.findTaiKhoanNguoiDungByUserID(user.getUserId());
            List<CongChuc> liChucs = CongChucLocalServiceUtil
                    .findByTaiKhoanNguoiDungId(taiKhoanNguoiDung.getId());
            if (liChucs.size() > 0) {
                CongChuc congChuc = liChucs.get(0);
                ChucVu chucVu = ConvertUtil.findChucVuByTaiKhoanNguoiDungID(taiKhoanNguoiDung.getId(),
                        ConvertUtil.convertToLong(coQuanTiepNhanId));

                hoSoTTHCCong.setCanBoTiepNhanId(congChuc.getId());
                hoSoTTHCCong.setTenCanBoTiepNhan(congChuc.getHoVaTen());
                hoSoTTHCCong.setCanBoXuLyHienThoiId(congChuc.getId());
                hoSoTTHCCong.setTenCanBoXuLyHienThoi(congChuc.getHoVaTen());
                hoSoTTHCCong.setChucVuCanBoTiepNhan(chucVu.getTen());
            }

            if (tenCongDan.trim().length() == 0) {
                hoSoTTHCCong.setHoTenNguoiNopHoSo(" ");
            } else {
                hoSoTTHCCong.setHoTenNguoiNopHoSo(tenCongDan);
            }

            hoSoTTHCCong.setDiaChiThuongTruNguoiNop(diaChiThuongTruCongDan);
            hoSoTTHCCong.setSoDienThoaiCoDinhNguoiNop(soDienThoaiCongDan);
            hoSoTTHCCong.setSoDienThoaiDiDongNguoiNop(soDienThoaiCongDan);

            hoSoTTHCCong.setTrangThaiHoSo(1);
            hoSoTTHCCong.setDaXoa(0);
            hoSoTTHCCong.setNguoiTao(user.getEmailAddress());
            hoSoTTHCCong.setNgayTao(new Date());
            hoSoTTHCCong.setNguoiSua(user.getEmailAddress());

            //            hoSoTTHCCong.setNgayNopHoSo(ConvertUtil.parseStringToDate(ngayNopHoSo));
            hoSoTTHCCong.setNgayNopHoSo(new Date());
            hoSoTTHCCong.setNgayNhanHoSo(ConvertUtil.parseStringToDate(ngayNopHoSo));
            hoSoTTHCCong.setNgayHenNopHoSoGoc(ConvertUtil.parseStringToDate(ngayNopHoSo));
            hoSoTTHCCong.setNgayHenTraKetQua(ConvertUtil.parseStringToDate(ngayTraHoSo));

            hoSoTTHCCong.setNgaySua(new Date());
            hoSoTTHCCong.setThuTucHanhChinhId(ConvertUtil.convertToLong(idQuyTrinh));
            hoSoTTHCCong.setCongDanNopId(ConvertUtil.convertToLong(idCongDan));
            hoSoTTHCCong.setCoQuanTiepNhanId(ConvertUtil.convertToLong(coQuanTiepNhanId));
            //hoSoTTHCCong.setDiaChiThuongTruNguoiNopId(0);                                                    
            hoSoTTHCCong.setSoDienThoaiDiDongNguoiNop(soDienThoaiCongDan);
            hoSoTTHCCong.setLoaiHoSo(1); // 0: online;    1: off
            hoSoTTHCCong.setMaSoBienNhan("");
            hoSoTTHCCong.setTenBangChuaHoSo("CMON_HOSOTTHCCONG");
            hoSoTTHCCong.setChuSoHuu(tenCongDan);

            // Get gropu dich vu cong id
            ThuTucHanhChinh thuTuc = ThuTucHanhChinhLocalServiceUtil
                    .getThuTucHanhChinh(Long.parseLong(idQuyTrinh));

            long dvcGroupId = thuTuc.getNhomThuTucHanhChinhId();

            NhomThuTucHanhChinh nhomDvc = NhomThuTucHanhChinhLocalServiceUtil
                    .fetchNhomThuTucHanhChinh(dvcGroupId);
            long appId = nhomDvc.getDanhMucUngDungId();

            // Get applcation code
            DanhMucUngDung app = DanhMucUngDungLocalServiceUtil.getDanhMucUngDung(appId);

            String maUngDung = app.getMa();
            hoSoTTHCCong.setMaUngDung(maUngDung);

            HoSoTTHCCongLocalServiceUtil.addHoSoTTHCCong(hoSoTTHCCong);

            // Create empty array
            List<FileDinhKem> fileUpLoadLst = new ArrayList<FileDinhKem>();

            if (actionRequest.getPortletSession().getAttribute(DATA_UPLOAD_FILE) != null) {
                List<FileDinhKem> listResultBefore = (ArrayList<FileDinhKem>) actionRequest.getPortletSession()
                        .getAttribute(DATA_UPLOAD_FILE);
                TaiLieuChungThuc taiLieuChungThuc = null;
                for (FileDinhKem fileUpload : listResultBefore) {
                    fileUpload.setId(CounterLocalServiceUtil.increment(FILE_UPLOAD_SEQUENCE));
                    fileUpload.setHoSoTTHCCongId(hoSoTTHCCong.getId());
                    try {
                        FileDinhKemLocalServiceUtil.addFileDinhKem(fileUpload);
                    } catch (Exception es) {
                        es.printStackTrace();
                    }
                    try {
                        taiLieuChungThuc = TaiLieuChungThucLocalServiceUtil
                                .fetchTaiLieuChungThuc(fileUpload.getNoiLuuTruTaiLieuId());
                        taiLieuChungThuc.setHoSoTTHCCId(hoSoTTHCCong.getId());
                        TaiLieuChungThucLocalServiceUtil.updateTaiLieuChungThuc(taiLieuChungThuc);
                    } catch (Exception es) {
                    }
                }

                // Added by Nam
                fileUpLoadLst = listResultBefore;
                //actionRequest.getPortletSession().removeAttribute(DATA_UPLOAD_FILE);
            }

            // Goi khoi tao quy trinh trong uengine.
            ComUtils comUtils = new ComUtils();
            comUtils.tiepNhanHoSo(actionRequest, hoSoTTHCCong);

            // Add by BinhNT End

            actionResponse.setRenderParameter("maSoHoSo", hoSoTTHCCong.getMaSoHoSo());
            actionResponse.setRenderParameter("HosotthcCongId", String.valueOf(hoSoTTHCCong.getId()));
            SessionMessages.add(actionRequest, "add_ho_so_completed");
        } catch (Exception es) {
            SessionErrors.add(actionRequest, "erorAddForm");
            try {
                HoSoTTHCCongLocalServiceUtil.deleteHoSoTTHCCong(hoSoThuTucHanhChinhCongId);
                FileDinhKemLocalServiceUtil.deleteByHoSoThuTucHanhChinhId(hoSoThuTucHanhChinhCongId);
            } catch (Exception es1) {
                es1.printStackTrace();
            }
            es.printStackTrace();
        }
    }
    actionResponse.setRenderParameter("searchKeyWord", searchKeyWord);
    actionResponse.setRenderParameter("idQuyTrinh", idQuyTrinh);
    actionResponse.setRenderParameter("idCongDan", idCongDan);
    actionResponse.setRenderParameter("searchKeyWord", searchKeyWord);
    actionResponse.setRenderParameter("_searchKeyWord", _searchKeyWord);
    actionResponse.setRenderParameter("ngayTraHoSo", ngayTraHoSo);
    if (soDienThoaiCongDan.trim().length() > 0) {
        actionResponse.setRenderParameter("soDienThoaiCongDan", soDienThoaiCongDan);
    }
}

From source file:org.oep.cmon.portlet.ipmslist.business.FormOfflineBusiness.java

License:Apache License

/**
 * This is function addHoSoDoanhNghiepRequest
 * Version: 1.0/*from w w w  .  j ava  2 s . c  o  m*/
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void addHoSoDoanhNghiepRequest(ActionRequest actionRequest, ActionResponse actionResponse)
        throws Exception {
    String transactionKeyword = ParamUtil.getString(actionRequest, "transactionKeyword").trim();
    String transType = ParamUtil.getString(actionRequest, "transType").trim();
    String statusHS = ParamUtil.getString(actionRequest, "statusHS").trim();

    actionResponse.setRenderParameter("jspPage", "/html/portlet/ipmslistportlet/company/inputHoSo.jsp");
    actionResponse.setRenderParameter("transactionKeyword", transactionKeyword);
    actionResponse.setRenderParameter("transType", transType);
    actionResponse.setRenderParameter("statusHS", statusHS);

    long hoSoThuTucHanhChinhCongId = 0;
    User user = PortalUtil.getUser(actionRequest);
    String searchKeyWord = ParamUtil.getString(actionRequest, "searchKeyWord");
    String _searchKeyWord = ParamUtil.getString(actionRequest, "_searchKeyWord");
    String idQuyTrinh = ParamUtil.getString(actionRequest, "idQuyTrinh");
    String idCongDan = ParamUtil.getString(actionRequest, "idCongDan");
    String idCongDanNop = ParamUtil.getString(actionRequest, "idCongDanNop");
    String coQuanTiepNhanTen = ParamUtil.getString(actionRequest, "coQuanTiepNhanTen");
    String coQuanTiepNhanId = ParamUtil.getString(actionRequest, "coQuanTiepNhanId");
    String tenQuyTrinh = ParamUtil.getString(actionRequest, "tenQuyTrinh");
    String tenCongDanCty = ParamUtil.getString(actionRequest, "tenCongDan");
    String tenCongDan = ParamUtil.getString(actionRequest, "tenCongDanNop");
    String diaChiThuongTruCongDan = ParamUtil.getString(actionRequest, "diaChiThuongTruCongDan");
    String diaChiThuongTruCongDanNop = ParamUtil.getString(actionRequest, "diaChiThuongTruCongDanNop");
    String maSoDoanhNghiep = ParamUtil.getString(actionRequest, "maSoDoanhNghiep");
    String maSoThueDoanhNghiep = ParamUtil.getString(actionRequest, "maSoThueDoanhNghiep");
    String ngayNopHoSo = ParamUtil.getString(actionRequest, "ngayNopHoSo");
    String ngayTraHoSo = ParamUtil.getString(actionRequest, "ngayTraHoSo");
    String soDienThoaiCongDan = ParamUtil.getString(actionRequest, "soDienThoaiCongDan")
            .replace("soDienThoaiCongDan", "").trim();

    if (validationData(soDienThoaiCongDan, actionRequest)) {
        try {
            hoSoThuTucHanhChinhCongId = CounterLocalServiceUtil.increment(CMON_HOSOTTHCCONG_SEQUENCE);
            HoSoTTHCCong hoSoTTHCCong = new HoSoTTHCCongClp();
            hoSoTTHCCong.setId(hoSoThuTucHanhChinhCongId);

            String maSoHoSo = getMaHoSoSo(getMaQuyTrinh(ConvertUtil.convertToLong(idQuyTrinh)), false);
            hoSoTTHCCong.setMaSoHoSo(maSoHoSo);//"MAHOSOODAY"

            hoSoTTHCCong.setNgayNopHoSo(new Date());
            hoSoTTHCCong.setTenCoQuanTiepNhan(coQuanTiepNhanTen);
            hoSoTTHCCong.setTenThuTucHanhChinh(tenQuyTrinh);

            TaiKhoanNguoiDung taiKhoanNguoiDung = ConvertUtil.findTaiKhoanNguoiDungByUserID(user.getUserId());
            List<CongChuc> liChucs = CongChucLocalServiceUtil
                    .findByTaiKhoanNguoiDungId(taiKhoanNguoiDung.getId());
            if (liChucs.size() > 0) {
                CongChuc congChuc = liChucs.get(0);
                ChucVu chucVu = ConvertUtil.findChucVuByTaiKhoanNguoiDungID(taiKhoanNguoiDung.getId(),
                        ConvertUtil.convertToLong(coQuanTiepNhanId));

                hoSoTTHCCong.setCanBoTiepNhanId(congChuc.getId());
                hoSoTTHCCong.setTenCanBoTiepNhan(congChuc.getHoVaTen());
                hoSoTTHCCong.setCanBoXuLyHienThoiId(congChuc.getId());
                hoSoTTHCCong.setTenCanBoXuLyHienThoi(congChuc.getHoVaTen());
                hoSoTTHCCong.setChucVuCanBoTiepNhan(chucVu.getTen());
            }

            // Lay ma doanh nghiep.
            DoanhNghiep doanhNghiep = DoanhNghiepLocalServiceUtil.findByMaDoanhNghiep(maSoDoanhNghiep);
            if (doanhNghiep != null) {
                hoSoTTHCCong.setDoiTuongCanXuLyId(doanhNghiep.getId());
            }

            hoSoTTHCCong.setHoTenNguoiNopHoSo(tenCongDan);
            hoSoTTHCCong.setDiaChiThuongTruNguoiNop(diaChiThuongTruCongDanNop);
            hoSoTTHCCong.setSoDienThoaiCoDinhNguoiNop(soDienThoaiCongDan);
            hoSoTTHCCong.setSoDienThoaiDiDongNguoiNop(soDienThoaiCongDan);

            hoSoTTHCCong.setTrangThaiHoSo(1);
            hoSoTTHCCong.setDaXoa(0);
            hoSoTTHCCong.setNguoiTao(user.getEmailAddress());
            hoSoTTHCCong.setNgayTao(new Date());
            hoSoTTHCCong.setNguoiSua(user.getEmailAddress());

            //            hoSoTTHCCong.setNgayNopHoSo(ConvertUtil.parseStringToDate(ngayNopHoSo));
            hoSoTTHCCong.setNgayNopHoSo(new Date());
            hoSoTTHCCong.setNgayNhanHoSo(ConvertUtil.parseStringToDate(ngayNopHoSo));
            hoSoTTHCCong.setNgayHenNopHoSoGoc(ConvertUtil.parseStringToDate(ngayNopHoSo));
            hoSoTTHCCong.setNgayHenTraKetQua(ConvertUtil.parseStringToDate(ngayTraHoSo));

            hoSoTTHCCong.setNgaySua(new Date());
            hoSoTTHCCong.setThuTucHanhChinhId(ConvertUtil.convertToLong(idQuyTrinh));
            hoSoTTHCCong.setCongDanNopId(ConvertUtil.convertToLong(idCongDanNop));
            hoSoTTHCCong.setCoQuanTiepNhanId(ConvertUtil.convertToLong(coQuanTiepNhanId));
            hoSoTTHCCong.setSoDienThoaiDiDongNguoiNop(soDienThoaiCongDan);
            hoSoTTHCCong.setLoaiHoSo(1); // 0: online;    1: off
            hoSoTTHCCong.setMaSoBienNhan("");
            hoSoTTHCCong.setTenBangChuaHoSo("CMON_HOSOTTHCCONG");
            hoSoTTHCCong.setChuSoHuu(tenCongDanCty);

            // Get gropu dich vu cong id
            ThuTucHanhChinh thuTuc = ThuTucHanhChinhLocalServiceUtil
                    .getThuTucHanhChinh(Long.parseLong(idQuyTrinh));

            long dvcGroupId = thuTuc.getNhomThuTucHanhChinhId();

            NhomThuTucHanhChinh nhomDvc = NhomThuTucHanhChinhLocalServiceUtil
                    .fetchNhomThuTucHanhChinh(dvcGroupId);
            long appId = nhomDvc.getDanhMucUngDungId();

            // Get applcation code
            DanhMucUngDung app = DanhMucUngDungLocalServiceUtil.getDanhMucUngDung(appId);

            String maUngDung = app.getMa();
            hoSoTTHCCong.setMaUngDung(maUngDung);

            HoSoTTHCCongLocalServiceUtil.addHoSoTTHCCong(hoSoTTHCCong);

            // Create empty array
            List<FileDinhKem> fileUpLoadLst = new ArrayList<FileDinhKem>();

            if (actionRequest.getPortletSession().getAttribute(DATA_UPLOAD_FILE) != null) {
                List<FileDinhKem> listResultBefore = (ArrayList<FileDinhKem>) actionRequest.getPortletSession()
                        .getAttribute(DATA_UPLOAD_FILE);
                TaiLieuChungThuc taiLieuChungThuc = null;
                for (FileDinhKem fileUpload : listResultBefore) {
                    fileUpload.setId(CounterLocalServiceUtil.increment(FILE_UPLOAD_SEQUENCE));
                    fileUpload.setHoSoTTHCCongId(hoSoTTHCCong.getId());
                    try {
                        FileDinhKemLocalServiceUtil.addFileDinhKem(fileUpload);
                    } catch (Exception es) {
                        es.printStackTrace();
                    }
                    try {
                        taiLieuChungThuc = TaiLieuChungThucLocalServiceUtil
                                .fetchTaiLieuChungThuc(fileUpload.getNoiLuuTruTaiLieuId());
                        taiLieuChungThuc.setHoSoTTHCCId(hoSoTTHCCong.getId());
                        TaiLieuChungThucLocalServiceUtil.updateTaiLieuChungThuc(taiLieuChungThuc);
                    } catch (Exception es) {
                        es.printStackTrace();
                    }
                }

                // Added by Nam
                fileUpLoadLst = listResultBefore;
                //actionRequest.getPortletSession().removeAttribute(DATA_UPLOAD_FILE);
            }

            // Goi khoi tao quy trinh trong uengine.
            ComUtils comUtils = new ComUtils();
            comUtils.tiepNhanHoSo(actionRequest, hoSoTTHCCong);

            // Add by BinhNT End

            actionResponse.setRenderParameter("maSoHoSo", hoSoTTHCCong.getMaSoHoSo());
            actionResponse.setRenderParameter("HosotthcCongId", String.valueOf(hoSoTTHCCong.getId()));
            SessionMessages.add(actionRequest, "add_ho_so_completed");
        } catch (Exception es) {
            SessionErrors.add(actionRequest, "erorAddForm");
            try {
                HoSoTTHCCongLocalServiceUtil.deleteHoSoTTHCCong(hoSoThuTucHanhChinhCongId);
                FileDinhKemLocalServiceUtil.deleteByHoSoThuTucHanhChinhId(hoSoThuTucHanhChinhCongId);
            } catch (Exception es1) {
                es1.printStackTrace();
            }
            es.printStackTrace();
        }
    }
    actionResponse.setRenderParameter("searchKeyWord", searchKeyWord);
    actionResponse.setRenderParameter("idQuyTrinh", idQuyTrinh);
    actionResponse.setRenderParameter("idCongDan", idCongDan);
    actionResponse.setRenderParameter("idCongDanNop", idCongDanNop);
    actionResponse.setRenderParameter("searchKeyWord", searchKeyWord);
    actionResponse.setRenderParameter("ngayTraHoSo", ngayTraHoSo);
    actionResponse.setRenderParameter("_searchKeyWord", _searchKeyWord);
    if (soDienThoaiCongDan.trim().length() > 0) {
        actionResponse.setRenderParameter("soDienThoaiCongDan", soDienThoaiCongDan);
    }
}

From source file:org.oep.cmon.portlet.ipmslist.business.FormOfflineBusiness.java

License:Apache License

/**
 * This is function addCongDanRequest/*from  w  ww  .  j ava  2  s . com*/
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void addCongDanRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    // Get search keyword, the keyword can either be Ten
    String transactionKeyword = ParamUtil.getString(actionRequest, "transactionKeyword").trim();
    String transType = ParamUtil.getString(actionRequest, "transType").trim();
    String statusHS = ParamUtil.getString(actionRequest, "statusHS").trim();
    actionResponse.setRenderParameter("transactionKeyword", transactionKeyword);
    actionResponse.setRenderParameter("statusHS", statusHS);
    actionResponse.setRenderParameter("transType", transType);
    actionResponse.setRenderParameter("jspPage", "/html/portlet/ipmslistportlet/offline/themCongDan.jsp");

    String searchKeyWord = ParamUtil.getString(actionRequest, "searchKeyWord");
    String _searchKeyWord = ParamUtil.getString(actionRequest, "_searchKeyWord");
    String idQuyTrinh = ParamUtil.getString(actionRequest, "idQuyTrinh");
    String firstName = ParamUtil.getString(actionRequest, "firstName").trim().toUpperCase();
    String middleName = ParamUtil.getString(actionRequest, "middleName").trim().toUpperCase();
    String lastName = ParamUtil.getString(actionRequest, "lastName").trim().toUpperCase();
    String cmnd = ParamUtil.getString(actionRequest, "cmnd").trim();
    String ngaySinh = ParamUtil.getString(actionRequest, "ngaySinh").trim();
    String idGioiTinh = ParamUtil.getString(actionRequest, "idGioiTinh").trim();
    String numberHome = ParamUtil.getString(actionRequest, "numberHome").trim();
    String idTinhHienTai = ParamUtil.getString(actionRequest, "idTinhHienTai").trim();
    String idHuyenHienTai = ParamUtil.getString(actionRequest, "idHuyenHienTai").trim();
    String idXaHienTai = ParamUtil.getString(actionRequest, "idXaHienTai").trim();
    String quocGiaId = ParamUtil.getString(actionRequest, "quocGiaId").trim();
    String phoneNumber = ParamUtil.getString(actionRequest, "phoneNumber").trim();

    if (validationData(firstName, middleName, lastName, cmnd, ngaySinh, idGioiTinh, numberHome, idTinhHienTai,
            idHuyenHienTai, idXaHienTai, actionRequest)) {
        CongDan congDan = new CongDanClp();
        congDan.setId(CounterLocalServiceUtil.increment(CITIZEN_SEQUENCE));
        congDan.setMa(ElectricCodeGeneratorUtil.generateCode(ConvertUtil.convertToLong(idTinhHienTai),
                ConvertUtil.parseStringToDate(ngaySinh)));
        congDan.setHo(firstName);
        congDan.setDem(middleName);
        congDan.setTen(lastName);
        congDan.setNgaySinh(ConvertUtil.parseStringToDate(ngaySinh));
        congDan.setSoCmnd(cmnd);

        // Thiet lap dia chi thuong tru.
        congDan.setDiaChiThuongTru(numberHome);
        congDan.setDiaChiThuongTruTinhId(ConvertUtil.convertToLong(idTinhHienTai));
        congDan.setDiaChiThuongTruHuyenId(ConvertUtil.convertToLong(idHuyenHienTai));
        congDan.setDiaChiThuongTruXaId(ConvertUtil.convertToLong(idXaHienTai));

        // Thiet lap dia chi hien tai.
        congDan.setDiaChiHienNay(numberHome);
        congDan.setDiaChiHienNayTinhId(ConvertUtil.convertToLong(idTinhHienTai));
        congDan.setDiaChiHienNayHuyenId(ConvertUtil.convertToLong(idHuyenHienTai));
        congDan.setDiaChiHienNayXaId(ConvertUtil.convertToLong(idXaHienTai));

        congDan.setGioiTinh(ConvertUtil.convertToInt(idGioiTinh));

        // Added by Nam ( fullName)
        congDan.setTenDayDu(firstName + StringPool.SPACE + middleName + StringPool.SPACE + lastName);
        if (phoneNumber != null) {
            congDan.setDienThoaiCoDinh(phoneNumber);
            congDan.setDienThoaiDiDong(phoneNumber);
        }

        congDan.setNgayTao(new Date());
        congDan.setNgaySua(new Date());
        congDan.setQuocTichId(ConvertUtil.convertToLong(quocGiaId));
        User currentUser = PortalUtil.getUser(actionRequest);

        if (currentUser != null) {
            // Nguoi chung thuc
            congDan.setNguoiTao(currentUser.getEmailAddress());
            congDan.setNguoiSua(currentUser.getEmailAddress());
        } else {
            congDan.setNguoiTao("DUMMY");
            congDan.setNguoiSua("DUMMY");
        }
        congDan.setDaXoa(0);
        try {
            try {
                CongDanLocalServiceUtil.addCongDan(congDan);
            } catch (Exception es) {
            }
            CongDan congDan2 = CongDanLocalServiceUtil.fetchCongDan(congDan.getId());
            if (congDan2 != null) {
                SessionMessages.add(actionRequest, "add_cong_dan_completed");
            }
        } catch (Exception es) {
            SessionErrors.add(actionRequest, "error_add_cong_dan");
            es.printStackTrace();
        }
    }

    if (!SessionErrors.isEmpty(actionRequest)) {
        actionResponse.setRenderParameter("firstName", firstName);
        actionResponse.setRenderParameter("middleName", middleName);
        actionResponse.setRenderParameter("lastName", lastName);
        actionResponse.setRenderParameter("cmnd", cmnd);
        actionResponse.setRenderParameter("ngaySinh", ngaySinh);
        actionResponse.setRenderParameter("idGioiTinh", idGioiTinh);
        actionResponse.setRenderParameter("numberHome", numberHome);
        actionResponse.setRenderParameter("idTinhHienTai", idTinhHienTai);
        actionResponse.setRenderParameter("idHuyenHienTai", idHuyenHienTai);
        actionResponse.setRenderParameter("idXaHienTai", idXaHienTai);
    }
    actionResponse.setRenderParameter("searchKeyWord", searchKeyWord);
    actionResponse.setRenderParameter("_searchKeyWord", _searchKeyWord);
    actionResponse.setRenderParameter("idQuyTrinh", idQuyTrinh);
}

From source file:org.oep.cmon.portlet.ipmslist.business.FormOfflineBusiness.java

License:Apache License

/**
 * This is function addDoanhNghiepRequest
 * Version: 1.0/*w  ww  .  j  a va  2  s. c  om*/
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void addDoanhNghiepRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    // Get search keyword, the keyword can either be Ten
    String transactionKeyword = ParamUtil.getString(actionRequest, "transactionKeyword").trim();
    String transType = ParamUtil.getString(actionRequest, "transType").trim();
    String statusHS = ParamUtil.getString(actionRequest, "statusHS").trim();
    actionResponse.setRenderParameter("transactionKeyword", transactionKeyword);
    actionResponse.setRenderParameter("statusHS", statusHS);
    actionResponse.setRenderParameter("transType", transType);
    actionResponse.setRenderParameter("jspPage", "/html/portlet/ipmslistportlet/company/themCompany.jsp");

    String searchKeyWord = ParamUtil.getString(actionRequest, "searchKeyWord");
    String _searchKeyWord = ParamUtil.getString(actionRequest, "_searchKeyWord");
    String idQuyTrinh = ParamUtil.getString(actionRequest, "idQuyTrinh");
    String maSoDoanhNghiep = ParamUtil.getString(actionRequest, "maSoDoanhNghiep").trim().toUpperCase();
    String maSothueDoanhNghiep = ParamUtil.getString(actionRequest, "maSothueDoanhNghiep").trim();
    String tenDoanhNghiep = ParamUtil.getString(actionRequest, "tenDoanhNghiep").trim();
    String soGiayPhepDangKyDoanhNghiep = ParamUtil.getString(actionRequest, "soGiayPhepDangKyDoanhNghiep")
            .trim();
    String ngayCapGiayPhepDangKyDoanhNghiep = ParamUtil
            .getString(actionRequest, "ngayCapGiayPhepDangKyDoanhNghiep").trim();
    String tongSoVon = ParamUtil.getString(actionRequest, "tongSoVon").trim();
    String idLoaiDoiTuong = ParamUtil.getString(actionRequest, "idLoaiDoiTuong").trim();
    String numberHome = ParamUtil.getString(actionRequest, "numberHome").trim();
    String idTinhHienTai = ParamUtil.getString(actionRequest, "idTinhHienTai").trim();
    String idHuyenHienTai = ParamUtil.getString(actionRequest, "idHuyenHienTai").trim();
    String idXaHienTai = ParamUtil.getString(actionRequest, "idXaHienTai").trim();
    String quocGiaId = ParamUtil.getString(actionRequest, "quocGiaId").trim();
    String idTrangThai = ParamUtil.getString(actionRequest, "idTrangThai").trim();
    String moTaNganhNgheKinhDoanh = ParamUtil.getString(actionRequest, "moTaNganhNgheKinhDoanh").trim();

    if (validationDataDoanhNghiep(maSoDoanhNghiep, maSothueDoanhNghiep, tenDoanhNghiep,
            soGiayPhepDangKyDoanhNghiep, ngayCapGiayPhepDangKyDoanhNghiep, tongSoVon, idLoaiDoiTuong,
            numberHome, idTinhHienTai, idHuyenHienTai, idXaHienTai, moTaNganhNgheKinhDoanh, quocGiaId,
            idTrangThai, actionRequest)) {
        ICitizenService service = WebserviceFactory.getCmonService();
        DoanhNghiep doanhNghiep = new DoanhNghiepClp();
        doanhNghiep.setId(service.getAutoIncrement());
        doanhNghiep.setMa(maSoDoanhNghiep);
        doanhNghiep.setMaSoThue(maSothueDoanhNghiep);
        doanhNghiep.setTen(tenDoanhNghiep);
        doanhNghiep.setSoGCNDKKD(soGiayPhepDangKyDoanhNghiep);
        doanhNghiep.setNgayCapGCNDKKD(ConvertUtil.parseStringToDate(ngayCapGiayPhepDangKyDoanhNghiep));
        doanhNghiep.setTongSoVon(ConvertUtil.convertToLong(tongSoVon));
        doanhNghiep.setLoaiDoiTuongId(ConvertUtil.convertToLong(idLoaiDoiTuong));
        doanhNghiep.setDiaChiDoanhNghiep(numberHome);
        doanhNghiep.setDiaChiDoanhNghiepTinhId(ConvertUtil.convertToLong(idTinhHienTai));
        doanhNghiep.setDiaChiDoanhNghiepHuyenId(ConvertUtil.convertToLong(idHuyenHienTai));
        doanhNghiep.setDiaChiDoanhNghiepXaId(ConvertUtil.convertToLong(idXaHienTai));
        doanhNghiep.setTrangThaiDoanhNghiepId(ConvertUtil.convertToLong(idTrangThai));
        doanhNghiep.setMoTaNganhNgheKinhDoanh(moTaNganhNgheKinhDoanh);

        doanhNghiep.setNgayTao(new Date());
        doanhNghiep.setNgaySua(new Date());
        doanhNghiep.setQuocGiaId(ConvertUtil.convertToLong(quocGiaId));
        User currentUser = PortalUtil.getUser(actionRequest);

        if (currentUser != null) {
            // Nguoi chung thuc
            doanhNghiep.setNguoiTao(currentUser.getFullName());
            doanhNghiep.setNguoiSua(currentUser.getFullName());
        } else {
            doanhNghiep.setNguoiTao("DUMMY");
            doanhNghiep.setNguoiSua("DUMMY");
        }
        doanhNghiep.setDaXoa(0);
        try {
            try {
                DoanhNghiepLocalServiceUtil.addDoanhNghiep(doanhNghiep);
            } catch (Exception es) {
            }
            DoanhNghiep congDan2 = DoanhNghiepLocalServiceUtil.fetchDoanhNghiep(doanhNghiep.getId());
            if (congDan2 != null) {
                SessionMessages.add(actionRequest, "add_doanh_nghiep_completed");
            }
        } catch (Exception es) {
            SessionErrors.add(actionRequest, "add_doanh_nghiep_error");
            es.printStackTrace();
        }
    }

    if (!SessionErrors.isEmpty(actionRequest)) {
        actionResponse.setRenderParameter("maSoDoanhNghiep", maSoDoanhNghiep);
        actionResponse.setRenderParameter("maSothueDoanhNghiep", maSothueDoanhNghiep);
        actionResponse.setRenderParameter("tenDoanhNghiep", tenDoanhNghiep);
        actionResponse.setRenderParameter("soGiayPhepDangKyDoanhNghiep", soGiayPhepDangKyDoanhNghiep);
        actionResponse.setRenderParameter("ngayCapGiayPhepDangKyDoanhNghiep", ngayCapGiayPhepDangKyDoanhNghiep);
        actionResponse.setRenderParameter("tongSoVon", tongSoVon);
        actionResponse.setRenderParameter("idLoaiDoiTuong", idLoaiDoiTuong);
        actionResponse.setRenderParameter("numberHome", numberHome);
        actionResponse.setRenderParameter("moTaNganhNgheKinhDoanh", moTaNganhNgheKinhDoanh);
        actionResponse.setRenderParameter("idTinhHienTai", idTinhHienTai);
        actionResponse.setRenderParameter("idHuyenHienTai", idHuyenHienTai);
        actionResponse.setRenderParameter("idXaHienTai", idXaHienTai);
        actionResponse.setRenderParameter("quocGiaId", quocGiaId);
        actionResponse.setRenderParameter("idTrangThai", quocGiaId);
    }
    actionResponse.setRenderParameter("searchKeyWord", searchKeyWord);
    actionResponse.setRenderParameter("_searchKeyWord", _searchKeyWord);
    actionResponse.setRenderParameter("idQuyTrinh", idQuyTrinh);
}

From source file:org.oep.cmon.portlet.mapping.action.MappingPortlet.java

License:Apache License

/**
 * This is function deleteSynch//w  w  w . java2s . c o m
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void deleteSynch(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    Long appid = ParamUtil.getLong(actionRequest, "appid", 0L);
    String table = ParamUtil.getString(actionRequest, "table", "");
    Boolean overwrite = ParamUtil.getBoolean(actionRequest, "overwrite", false);
    boolean error = false;
    if (Validator.isNull(table)) {
        SessionErrors.add(actionRequest, Constaints.Errors.BANG_DNG_ISNULL);
        error = true;
    }
    if (appid.intValue() <= 0) {
        SessionErrors.add(actionRequest, Constaints.Errors.UNGDUNG_DNG_ISNULL);
        error = true;
    }
    if (!error) {
        if (SynchThread.running) {
            SessionMessages.add(actionRequest, Constaints.SYNCH_RUNNING);
        } else {
            DeleteThread thread = new DeleteThread(appid, table, overwrite);
            thread.start();
        }
    } else {
        actionResponse.setRenderParameter("table", table);
        actionResponse.setRenderParameter("appid", appid.toString());
    }

    actionResponse.setRenderParameter("jspPage", "/html/portlet/mapping/synch.jsp");
}