List of usage examples for java.lang Process Process
public Process()
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
/** * 140815 tra ho so - vai tro van thu - binhnt53 * * @param form/* ww w . j a v a 2 s. c om*/ * @param deptId m n v * @param deptName tn n v * @param userId m tk ng nhp * @param userName tk ng nhp * @return */ public boolean onReturnFiles(FilesForm form, Long deptId, String deptName, Long userId, String userName) { boolean bReturn = true; List<Long> action = new ArrayList(); try { Files file = findById(form.getFileId()); Date dateNow = getSysdate(); if (file == null || file.getFileId() == null) { bReturn = false; } else { //140404 Long processStatus = file.getStatus(); file.setStatus(Constants.FILE_STATUS.GIVE_BACK); file.setDisplayStatus(getFileStatusName(Constants.FILE_STATUS.GIVE_BACK)); // file.setClericalRequest(form.getClericalRequest()); file.setClericalRequest("Vn th ng du s."); file.setModifyDate(dateNow); file.setStaffSigningId(userId); file.setStaffSigningName(userName); if (form.getSignDate() == null) { file.setSignDate(dateNow); } else { file.setSignDate(form.getSignDate()); } //Cap nhat process ProcessDAOHE pdhe = new ProcessDAOHE(); Process ptmp = pdhe.getProcessByAction(file.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, processStatus, Constants.FILE_STATUS.NEW_CREATE); if (ptmp != null) { ptmp.setStatus(Constants.FILE_STATUS.GIVE_BACK); ptmp.setLastestComment(form.getStaffRequest()); getSession().update(ptmp); } if (file.getStatus().equals(Constants.FILE_STATUS.GIVE_BACK)) { Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); // gui toi doanh nghiep nop ho so ProcessDAOHE processDAOHE = new ProcessDAOHE(); action.add(Constants.FILE_STATUS.NEW); Process userAction = processDAOHE.findProcessByAction(file.getFileId(), action); if (userAction != null) { newP.setReceiveUser(userAction.getSendUser()); newP.setReceiveUserId(userAction.getSendUserId()); newP.setReceiveGroup(userAction.getSendGroup()); newP.setReceiveGroupId(userAction.getSendGroupId()); } else { newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); } newP.setReceiveDate(dateNow); newP.setProcessStatus(Constants.FILE_STATUS.GIVE_BACK); // De xu ly newP.setStatus(0L); // ket thuc tra ho so cho doanh nghiep newP.setIsActive(1l); getSession().save(newP); } else { //do nothing } getSession().update(file); MessageSmsDAOHE msdhe = new MessageSmsDAOHE(); String msg = "Ho so ma: " + file.getFileCode() + " cua doanh nghiep: " + file.getBusinessName() + " dang trong trang thai: Da tra ban cong bo"; msdhe.saveMessageSMS(userId, file.getUserCreateId(), msg); //email MessageEmailDAOHE msedhe = new MessageEmailDAOHE(); String msge = "H s m: " + file.getFileCode() + " ca doanh nghip: " + file.getBusinessName() + " ang trong trng thi: ? tr bn cng b"; msedhe.saveMessageEmail(userId, file.getUserCreateId(), msge); // if ("true".equals(ResourceBundleUtil.getString("send_service", "config"))) { // Helper h = new Helper(); // h.sendMs_370(file.getFileId(), msge); // } getSession().update(file);//cap nhat ho so bReturn = true; } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 bReturn = false; } return bReturn; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
/** * Nhp kt qu thm nh SDBS/*www .java2s. c o m*/ * * @param form * @param deptId * @param deptName * @param userId * @param userName * @return */ public boolean onFeedbackEvaluate(FilesForm form, Long deptId, String deptName, Long userId, String userName) { boolean bReturn = true; try { Files file = findById(form.getFileId());//lay thong tin chi tiet ho so Date dateNow = getSysdate(); if (file == null) { bReturn = false; } else { // Cap nhat trang thai ho so file.setStatus(form.getStatus()); file.setDisplayStatus(getFileStatusName(form.getStatus())); // String dateTime = DateTimeUtils.convertDateToString(dateNow, "dd/MM/yyyy HH:mm"); // file.setStaffRequest(userName + " " + dateTime + ":\n" + form.getStaffRequest()); file.setStaffRequest(form.getStaffRequest()); file.setDisplayRequest(form.getStaffRequest()); file.setModifyDate(dateNow); file.setEffectiveDate(form.getEffectiveDate()); // Cap nhat process ProcessDAOHE pdhe = new ProcessDAOHE(); Process p = pdhe.getWorkingProcess(form.getFileId(), Constants.OBJECT_TYPE.FILES, deptId, userId); if (p != null) { p.setStatus(form.getStatus()); p.setLastestComment(form.getStaffRequest()); getSession().update(p); } // Neu co luong thi chay theo luong if (file.getFlowId() != null && file.getFlowId() > 0) { FlowDAOHE fdhe = new FlowDAOHE(); if (Constants.FILE_STATUS.EVALUATED.equals(form.getStatus())) { fdhe.moveDocumentToNextNodeByAction(deptId, deptName, userId, userName, file.getFileId(), "thm nh"); } else { //fdhe.moveDocumentToPreviousNode(deptId, deptName, userId, userName, file.getFileId(), file.getPreviousNodeId()); } } else // Neu khong co luong thi tu xu thoi :-) if (form.getStatus().equals(Constants.FILE_STATUS.EVALUATED)) { // Tham dinh oke, gui tiep cho cho lanh dao don vi review Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); // Gui toi chinh don vi quan ly de xem xet newP.setReceiveDate(dateNow); newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); newP.setProcessStatus(form.getStatus()); // De xu ly newP.setStatus(0l); // Moi den chua xu ly newP.setIsActive(1l); getSession().save(newP); } else { // Tra lai cho doanh nghiep khong xu ly gi them } //insert noi dung tham dinh if (form.getEvaluationRecordsForm() != null) { EvaluationRecordsForm evaluationRecordsForm = new EvaluationRecordsForm(); evaluationRecordsForm.setCreateDate(dateNow); evaluationRecordsForm.setSendDate(file.getSendDate()); evaluationRecordsForm.setBusinessName(file.getBusinessName()); evaluationRecordsForm.setBusinessAddress(file.getBusinessAddress()); evaluationRecordsForm.setProductName(file.getProductName()); evaluationRecordsForm.setLegal(form.getEvaluationRecordsForm().getLegal()); evaluationRecordsForm.setLegalContent(form.getEvaluationRecordsForm().getLegalContent()); evaluationRecordsForm .setFoodSafetyQuality(form.getEvaluationRecordsForm().getFoodSafetyQuality()); evaluationRecordsForm.setFoodSafetyQualityContent( form.getEvaluationRecordsForm().getFoodSafetyQualityContent()); evaluationRecordsForm.setEffectUtility(form.getEvaluationRecordsForm().getEffectUtility()); evaluationRecordsForm .setEffectUtilityContent(form.getEvaluationRecordsForm().getEffectUtilityContent()); evaluationRecordsForm.setFilesStatus(form.getEvaluationRecordsForm().getFilesStatus()); // evaluationRecordsForm.setFilesStatusL(form.getEvaluationRecordsForm().getFilesStatusL()); evaluationRecordsForm.setMainContent(form.getEvaluationRecordsForm().getMainContent()); // evaluationRecordsForm.setMainContentL(form.getEvaluationRecordsForm().getMainContentL()); evaluationRecordsForm.setFirstStaffId(userId); evaluationRecordsForm.setFirstStaffName(userName); evaluationRecordsForm.setSecondStaffId(userId); evaluationRecordsForm.setSecondStaffName(userName); evaluationRecordsForm.setThirdStaffId(userId); evaluationRecordsForm.setThirdStaffName(userName); evaluationRecordsForm.setLeederStaffId(userId); evaluationRecordsForm.setLeederStaffName(userName); evaluationRecordsForm.setFilesId(file.getFileId()); EvaluationRecords evaluationRecordsBo; evaluationRecordsBo = evaluationRecordsForm.convertToEntity(); getSession().save(evaluationRecordsBo); } update(file); } } catch (Exception ex) { bReturn = false; LogUtil.addLog(ex);//binhnt sonar a160901 } return bReturn; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
/** * phe duyet tham dinh/*from w w w .j ava2 s. com*/ * * @param form * @param deptId * @param deptName * @param userId * @param userName * @return */ public boolean onApproveEvaluate(FilesForm form, Long deptId, String deptName, Long userId, String userName) { boolean bReturn = true; try { Files file = findById(form.getFileId()); Date dateNow = getSysdate(); if (file == null) { bReturn = false; } else { file.setStatus(form.getStatus()); file.setDisplayStatus(getFileStatusName(form.getStatus())); String dateTime = DateTimeUtils.convertDateToString(dateNow, "dd/MM/yyyy HH:mm"); file.setLeaderRequest(userName + " " + dateTime + ":\n" + form.getLeaderRequest()); file.setDisplayRequest(form.getLeaderRequest()); file.setModifyDate(dateNow); file.setLeaderStaffSignId(userId); file.setLeaderStaffSignName(userName); // // Cap nhat process // ProcessDAOHE pdhe = new ProcessDAOHE(); Process p = pdhe.getWorkingProcess(form.getFileId(), Constants.OBJECT_TYPE.FILES, deptId, userId); if (p != null) { p.setStatus(form.getStatus()); p.setLastestComment(form.getLeaderRequest()); getSession().update(p); } // Neu khong co luong thi tu xu thoi :-) if (form.getStatus().equals(Constants.FILE_STATUS.APPROVED)) { // Phe duyet oke, chuyen ho so xuong cho chuyen vien de thong bao doi chieu ho so Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); newP.setProcessStatus(form.getStatus()); // De xu ly newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setStatus(0l); // Moi den chua xu ly newP.setIsActive(1l); //lay process tham dinh ho so Process pold = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.ASSIGNED, Constants.FILE_STATUS.EVALUATED); if (pold != null) { newP.setReceiveDate(dateNow); newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveGroupId(pold.getSendGroupId()); newP.setReceiveUser(pold.getReceiveUser()); newP.setReceiveUserId(pold.getReceiveUserId()); } getSession().save(newP); //cap nhat noi dung thong bao - tao noi dung thong bao RequestComment rcbo = new RequestComment(); rcbo.setContent(form.getLeaderRequest()); file.setComparisonContent(form.getLeaderRequest()); file.setIsFee(0L);//bay gio tinh phi giay cong bo rcbo.setCreateBy(userId); rcbo.setCreateDate(dateNow); rcbo.setUserId(userId); rcbo.setUserName(userName); rcbo.setStatus(1L); rcbo.setIsActive(1L); rcbo.setGroupId(deptId); rcbo.setGroupName(deptName); rcbo.setIsLastChange(Constants.ACTIVE_STATUS.ACTIVE); rcbo.setObjectId(form.getFileId()); rcbo.setRequestType(Constants.REQUEST_COMMENT_TYPE.TBDC); //-150120 RequestCommentDAOHE rqdaohe = new RequestCommentDAOHE(); RequestComment lastRQBo = rqdaohe.findLastRequestComment(file.getFileId(), Constants.ACTIVE_STATUS.ACTIVE); if (lastRQBo != null) { rcbo.setLastContent(lastRQBo.getContent()); lastRQBo.setIsLastChange(Constants.ACTIVE_STATUS.DEACTIVE); getSession().update(lastRQBo); } //update binhnt // try { // if ("true".equals(ResourceBundleUtil.getString("send_service", "config"))) { // Helper h = new Helper(); // h.sendMs_340(file.getFileId(), "Ho so ma: " + file.getFileCode() + " Da duoc phe duyet yeu cau nop phi ho so."); // } // } catch (UnsupportedEncodingException ex) { // Logger.getLogger(FilesDAOHE.class.getName()).log(Level.SEVERE, null, ex); // } getSession().save(rcbo); //!cap nhat noi dung thong bao - tao noi dung thong bao //-150120 } else { if (form.getStatus().equals(Constants.FILE_STATUS.FEDBACK_TO_REVIEW)) { // Tra lai cho lanh dao don vi xem xet lai Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); newP.setProcessStatus(form.getStatus()); // De xu ly newP.setStatus(0l); // Moi den chua xu ly newP.setIsActive(1l); // Gui toi chinh don vi quan ly de xem xet if (p != null) { // Gui lai cho chinh nguoi gui newP.setReceiveDate(dateNow); newP.setReceiveGroup(p.getSendGroup()); newP.setReceiveGroupId(p.getSendGroupId()); newP.setReceiveUser(p.getSendUser()); newP.setReceiveUserId(p.getSendUserId()); } getSession().save(newP); } if (form.getStatus().equals(Constants.FILE_STATUS.EVALUATED_TO_ADD)) { // try { // if ("true".equals(ResourceBundleUtil.getString("send_service", "config"))) { // Helper h = new Helper(); // h.sendMs_330(file.getFileId(), "Da gui cong van yeu cau sdbs"); // } // } catch (UnsupportedEncodingException ex) { // Logger.getLogger(FilesDAOHE.class.getName()).log(Level.SEVERE, null, ex); // } // gui tra ho so cho doanh nghiep sua doi bo sung Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); // newP.setReceiveDate(dateNow); newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); newP.setProcessStatus(form.getStatus()); //De xu ly newP.setStatus(0l); //Moi den chua xu ly newP.setIsActive(1l); getSession().save(newP); //xa bn ghi temp trc nu c (lu vo vng lu tr) updateSetNotLastIsTemp(file.getFileId()); try { ResourceBundle rb = ResourceBundle.getBundle("config"); Procedure procedurebo; ProcedureDAOHE procedureDAOHE = new ProcedureDAOHE(); procedurebo = procedureDAOHE.findById(file.getFileType()); int SD = 0; try { SD = Integer.parseInt(rb.getString(procedurebo.getDescription() + "_SD")); } catch (NumberFormatException ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } if (SD > 0) { file.setDeadlineAddition(getDateWorkingTime(SD)); } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } //y kien lanh chuyen thanh y kien cua lanh dao } } if (form.getStatus().equals(Constants.FILE_STATUS.APPROVED)) { // try { // if ("true".equals(ResourceBundleUtil.getString("send_service", "config"))) { // Helper h = new Helper(); // h.sendMs_340(file.getFileId(), "Ho so ma: " + file.getFileCode() + " Da duoc phe duyet yeu cau nop phi ho so."); // } // } catch (UnsupportedEncodingException ex) { // Logger.getLogger(FilesDAOHE.class.getName()).log(Level.SEVERE, null, ex); // } //===============================tao giay cong bo=============== file.setApproveDate(dateNow); ProcedureDAOHE pcdaohe = new ProcedureDAOHE(); Procedure procedure = pcdaohe.findById(file.getFileType()); if (procedure != null && procedure.getProcedureId() > 0) { if (!"12".equals(procedure.getCode())) {//tao giay tiep nhan cong bo if (file.getAnnouncementId() != null) {//Cp giy tip nhn bn cng b hp quy (bn th nht) AnnouncementReceiptPaperForm arpForm = new AnnouncementReceiptPaperForm(); AnnouncementDAOHE announcementHE = new AnnouncementDAOHE(); Announcement announcement = announcementHE.findById(file.getAnnouncementId()); arpForm.setBusinessName(announcement.getBusinessName()); arpForm.setProductName(announcement.getProductName()); arpForm.setManufactureName(announcement.getManufactureName()); arpForm.setEmail(announcement.getBusinessEmail()); arpForm.setFax(announcement.getBusinessFax()); arpForm.setTelephone(announcement.getBusinessTelephone()); arpForm.setNationName(announcement.getNationName()); String strReceiptNo = getNewReceiptNo(file.getAgencyId(), file.getFileType()); arpForm.setReceiptNo(strReceiptNo); if (file.getEffectiveDate() == 3) {//lay ngay ki + 3 nam arpForm.setEffectiveDate(DateUtils.addYears(dateNow, 3)); } else if (file.getEffectiveDate() == 5) {//lay ngay ki + 5 nam arpForm.setEffectiveDate(DateUtils.addYears(dateNow, 5)); } arpForm.setReceiptDate(dateNow); arpForm.setReceiptDeptName(deptName);//ten co quan tiep nhan cong bo arpForm.setMatchingTarget(announcement.getMatchingTarget());//so hieu qui chuan ki thuat arpForm.setSignDate(dateNow);//ngay ki arpForm.setSignerName(userName);//nguoi ki //tao giay tiep nhan try { AnnouncementReceiptPaperDAOHE cthe = new AnnouncementReceiptPaperDAOHE(); if (cthe.isDuplicate(arpForm) == true) { bReturn = false; } else { Long ObjId = arpForm.getAnnouncementReceiptPaperId(); AnnouncementReceiptPaper bo = arpForm.convertToEntity(); if (ObjId == null) { getSession().save(bo); file.setAnnouncementReceiptPaperId(bo.getAnnouncementReceiptPaperId()); //getSession().update(file); } else { getSession().update(bo); file.setAnnouncementReceiptPaperId(bo.getAnnouncementReceiptPaperId()); //getSession().update(file); } } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 bReturn = false; } } //!tao giay tiep nhan } else if (file.getTestRegistrationId() != null) {//Giy xc nhn t yu cu nhp khu ca c quan kim tra Nh nc v? cht lng thc phm nhp khu ConfirmImportSatistPaperForm cispForm = new ConfirmImportSatistPaperForm(); cispForm.setTestAgencyName(form.getTestRegistration().getTestAgency()); cispForm.setTestAdd(form.getTestRegistration().getTestAdd()); cispForm.setExportBusinessName(form.getTestRegistration().getExportBusinessName()); cispForm.setExportBusinessAdd(form.getTestRegistration().getExportBusinessAdd()); cispForm.setExportBusinessMail(form.getTestRegistration().getExportBusinessMail()); cispForm.setExportBusinessTel(form.getTestRegistration().getExportBusinessTel()); cispForm.setExportBusinessFax(form.getTestRegistration().getExportBusinessFax()); cispForm.setExportContractCode(form.getTestRegistration().getExportContractCode()); cispForm.setExportContractDate(form.getTestRegistration().getExportContractDate()); cispForm.setExportLadingCode(form.getTestRegistration().getExportLadingCode()); cispForm.setExportLadingDate(form.getTestRegistration().getExportLadingDate()); cispForm.setExportPort(form.getTestRegistration().getExportPort()); cispForm.setImportBusinessName(form.getTestRegistration().getImportBusinessName()); cispForm.setImportBusinessAddress( form.getTestRegistration().getImportBusinessAddress()); cispForm.setImportBusinessEmail(form.getTestRegistration().getImportBusinessEmail()); cispForm.setImportBusinessTel(form.getTestRegistration().getImportBusinessTel()); cispForm.setImportBusinessFax(form.getTestRegistration().getImportBusinessFax()); cispForm.setImportPort(form.getTestRegistration().getImportPort()); cispForm.setImportDate(form.getTestRegistration().getImportDate()); cispForm.setProductName(form.getTestRegistration().getProductName()); cispForm.setProductDescription(form.getTestRegistration().getProductDescription()); cispForm.setProductCode(form.getTestRegistration().getProductCode()); cispForm.setProductOrigin(form.getTestRegistration().getProductOrigin()); cispForm.setProductAmount(form.getTestRegistration().getProductAmount()); cispForm.setProductWeight(form.getTestRegistration().getProductWeight()); cispForm.setProductValue(form.getTestRegistration().getProductValue()); cispForm.setGatheringAdd(form.getTestRegistration().getGatheringAdd()); cispForm.setTestDate(form.getTestRegistration().getTestDate()); cispForm.setBusinessRepresent(form.getTestRegistration().getBusinessRepresent()); cispForm.setBusinessSignAdd(form.getTestRegistration().getBusinessSignAdd()); cispForm.setBusinessSigndate(form.getTestRegistration().getBusinessSigndate()); cispForm.setAgencyRepresent(form.getTestRegistration().getAgencyRepresent()); cispForm.setAgencySignAdd(form.getTestRegistration().getAgencySignAdd()); cispForm.setAgencySigndate(form.getTestRegistration().getAgencySigndate()); cispForm.setStandardTargetNo(form.getTestRegistration().getStandardTargetNo()); cispForm.setStandardTargetDate(form.getTestRegistration().getStandardTargetDate()); cispForm.setReleaseDocumentNo(form.getTestRegistration().getReleaseDocumentNo()); cispForm.setReleaseDocumentDate(form.getTestRegistration().getReleaseDocumentDate()); try { ConfirmImportSatistPaperDAOHE cthe = new ConfirmImportSatistPaperDAOHE(); if (cthe.isDuplicate(cispForm) == true) { bReturn = false; } else { Long ObjId = cispForm.getConfirmImportSatistPaperId(); if (ObjId == null) { ConfirmImportSatistPaper bo = cispForm.convertToEntity(); getSession().save(bo); file.setConfirmImportSatistPaperId(bo.getConfirmImportSatistPaperId()); //getSession().update(file); } else { ConfirmImportSatistPaper bo = cispForm.convertToEntity(); getSession().update(bo); file.setConfirmImportSatistPaperId(bo.getConfirmImportSatistPaperId()); //getSession().update(file); } } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 bReturn = false; } } } //=======================================end==================== //sms MessageSmsDAOHE msdhe = new MessageSmsDAOHE(); String msg = "Ho so ma: " + file.getFileCode() + " cua doanh nghiep: " + file.getBusinessName() + " dang trong trang thai: da phe duyet"; msdhe.saveMessageSMS(userId, file.getUserCreateId(), msg); //email MessageEmailDAOHE msedhe = new MessageEmailDAOHE(); String msge = "H s m: " + file.getFileCode() + " ca doanh nghip: " + file.getBusinessName() + " ang trong trng thi: ph duyt."; msedhe.saveMessageEmail(userId, file.getUserCreateId(), msge); } update(file); } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 bReturn = false; } return bReturn; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
/** * xem xt thm nh h s./* ww w . j a v a2 s . c o m*/ * * @param form * @param deptId * @param deptName * @param userId * @param userName * @return */ public boolean onReviewEvaluate(FilesForm form, Long deptId, String deptName, Long userId, String userName) { boolean bReturn = true; try { Files file = findById(form.getFileId()); Date dateNow = getSysdate(); if (file == null) { bReturn = false; } else { Long processStatus = file.getStatus();//trang thai ho so truoc khi thay doi Long status = form.getStatus(); if (processStatus != null//141225 BINHNT update phan quyen ho so tham dinh && (processStatus.equals(Constants.FILE_STATUS.EVALUATED)//DA THAM DINH DAT || processStatus.equals(Constants.FILE_STATUS.FEDBACK_TO_REVIEW)//TRA LAI XEM XET LAI || processStatus.equals(Constants.FILE_STATUS.EVALUATE_TO_ADD)//TRA LAI XEM XET LAI || processStatus.equals(Constants.FILE_STATUS.FEDBACK_TO_ADD))) {//DA THAM DINH YEU CA SDBS // Cap nhat trang thai ho so file.setStatus(status); file.setDisplayStatus(getFileStatusName(status)); String dateTime = DateTimeUtils.convertDateToString(dateNow, "dd/MM/yyyy HH:mm"); if (!status.equals(Constants.FILE_STATUS.REVIEW_TO_ADD)) { file.setLeaderStaffRequest( userName + " " + dateTime + ":\n" + form.getLeaderStaffRequest()); file.setDisplayRequest(form.getLeaderStaffRequest()); } else { file.setLeaderStaffRequest("Trng phng xem xt cng vn S?BS"); file.setDisplayRequest("Trng phng xem xt cng vn S?BS"); } file.setModifyDate(dateNow); file.setEvaluateAddDate(dateNow); file.setLeaderApproveName(form.getLeaderApproveName()); file.setLeaderApproveId(form.getLeaderApproveId()); // Cap nhat process ProcessDAOHE pdhe = new ProcessDAOHE(); Process p = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, processStatus, Constants.FILE_STATUS.NEW_CREATE); Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); newP.setProcessStatus(status); // De xu ly newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setStatus(Constants.FILE_STATUS.NEW_CREATE); // Moi den chua xu ly newP.setIsActive(Constants.ACTIVE_STATUS.ACTIVE); newP.setReceiveDate(dateNow); if (status.equals(Constants.FILE_STATUS.REVIEWED)) { // Phe duyet oke, chuyen ho so cho lanh dao phe duyet newP.setReceiveUser(form.getLeaderApproveName()); newP.setReceiveUserId(form.getLeaderApproveId()); newP.setReceiveGroup(file.getAgencyName()); newP.setReceiveGroupId(file.getAgencyId()); } else { if (status.equals(Constants.FILE_STATUS.EVALUATED_TO_ADD)) { //140722 - da thong bao yeu cau sdbs ProcessDAOHE psdhe = new ProcessDAOHE(); Process pold = psdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.NEW, Constants.FILE_STATUS.RECEIVED); if (pold != null) { newP.setReceiveGroupId(pold.getSendGroupId()); newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveUserId(pold.getSendUserId()); newP.setReceiveUser(pold.getSendUser()); } else { newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); } //xa b?n ghi temp tr?c n?u c (lu vo vng lu tr?) updateSetNotLastIsTemp(file.getFileId());// ProcessCommentDAOHE pcdaohe = new ProcessCommentDAOHE(); pcdaohe.updateSetNotLastIsTemp(file.getFileId()); try {//140627 THIET LAP HAN SDBS HO SO ResourceBundle rb = ResourceBundle.getBundle("config"); Procedure procedurebo; ProcedureDAOHE procedureDAOHE = new ProcedureDAOHE(); procedurebo = procedureDAOHE.findById(file.getFileType()); int SD = 0; try { SD = Integer.parseInt(rb.getString(procedurebo.getDescription() + "_SD")); } catch (NumberFormatException ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } if (SD > 0) { file.setDeadlineAddition(getDateWorkingTime(SD)); } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } //!140627 THIET LAP HAN SDBS HO SO //sms MessageSmsDAOHE msdhe = new MessageSmsDAOHE(); String msg = "Ho so ma: " + file.getFileCode() + " cua doanh nghiep: " + file.getBusinessName() + " dang trong trang thai: da thong bao yeu cau sdbs"; msdhe.saveMessageSMS(userId, file.getUserCreateId(), msg); //email MessageEmailDAOHE msedhe = new MessageEmailDAOHE(); String msge = "H s m: " + file.getFileCode() + " ca doanh nghip: " + file.getBusinessName() + " ang trong trng thi: ? thng bo yu cu sa i b sung."; msedhe.saveMessageEmail(userId, file.getUserCreateId(), msge); // try { // if ("true".equals(ResourceBundleUtil.getString("send_service", "config"))) { // Helper h = new Helper(); // h.sendMs_330(file.getFileId(), msge); // } // } catch (UnsupportedEncodingException ex) { // Logger.getLogger(FilesDAOHE.class.getName()).log(Level.SEVERE, null, ex); // } } if (status.equals(Constants.FILE_STATUS.FEDBACK_TO_EVALUATE)) { // Tra lai cho chuyen vien tham dinh if (form.getLeaderStaffRequest() != null) { file.setLeaderStaffRequest( userName + " " + dateTime + ":\n" + form.getLeaderStaffRequest()); } if (p != null) { //lay process tham dinh ho so ProcessDAOHE psdhe = new ProcessDAOHE(); Process pold = psdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.EVALUATED, Constants.FILE_STATUS.NEW_CREATE); if (pold != null) { newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveGroupId(pold.getSendGroupId()); if (file != null && file.getStaffProcess() != null && file.getNameStaffProcess() != null) { newP.setReceiveUser(file.getNameStaffProcess()); newP.setReceiveUserId(file.getStaffProcess()); } else { newP.setReceiveUser(pold.getSendUser()); newP.setReceiveUserId(pold.getSendUserId()); } } else {//141218u binhnt53 fix loi ho so lanh dao phong tra lai voi pold = psdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.FEDBACK_TO_ADD, Constants.FILE_STATUS.NEW_CREATE); if (pold != null) { newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveGroupId(pold.getSendGroupId()); if (file != null && file.getStaffProcess() != null && file.getNameStaffProcess() != null) { newP.setReceiveUser(file.getNameStaffProcess()); newP.setReceiveUserId(file.getStaffProcess()); } else { newP.setReceiveUser(pold.getSendUser()); newP.setReceiveUserId(pold.getSendUserId()); } } else { pold = psdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.ASSIGNED, null); if (pold != null) { newP.setReceiveGroup(pold.getReceiveGroup()); newP.setReceiveGroupId(pold.getReceiveGroupId()); newP.setReceiveUser(pold.getReceiveUser()); newP.setReceiveUserId(pold.getReceiveUserId()); } else if (p != null) {// Gui lai cho chinh nguoi gui newP.setReceiveGroup(p.getSendGroup()); newP.setReceiveGroupId(p.getSendGroupId()); newP.setReceiveUser(p.getSendUser()); newP.setReceiveUserId(p.getSendUserId()); } } } } //hieptq update 080515 // xoa ban ghi lanh dao comment khi bi tra lai RequestCommentDAOHE rcdhe = new RequestCommentDAOHE(); RequestComment rc = rcdhe.findLeaderComment(form.getFileId(), 1l); if (rc != null && !"".equals(rc.getContent())) { rc.setIsActive(0l); getSession().update(rc); } } /* if (form.getStatus().equals(Constants.FILE_STATUS.REVIEWED_TO_ADD)) {//da xem xet yc sdbs newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); newP.setReceiveUser(file.getNameStaffProcess()); newP.setReceiveUserId(file.getStaffProcess()); }*/ if (status.equals(Constants.FILE_STATUS.REVIEW_TO_ADD)) { /* lanh dao phong vao xem xet noi dung thong bao sua doi bo sung chinh sua noi dung luu va gui len lanh dao cuc */ if (form.getIsTypeChange() != null) { file.setIsTypeChange(form.getIsTypeChange());//chuyen loai ho so hay khong } newP.setReceiveUser(form.getLeaderApproveName()); newP.setReceiveUserId(form.getLeaderApproveId()); newP.setReceiveGroup(file.getAgencyName()); newP.setReceiveGroupId(file.getAgencyId()); //cap nhat noi dung thong bao - tao noi dung thong bao RequestComment rcbo = new RequestComment(); if (form.getEvaluationRecordsForm() != null) { String content = ""; if (form.getLeaderStaffRequest() != null && !"null".equals(form.getLeaderStaffRequest())) { content += "* ? kin chung:" + "\n"; content += form.getLeaderStaffRequest() + "\n"; } if (form.getEvaluationRecordsForm().getLegalContentL() != null && !"null".equals(form.getEvaluationRecordsForm().getLegalContentL())) { content += "* V? php ch:" + "\n"; content += form.getEvaluationRecordsForm().getLegalContentL() + "\n"; } if (form.getEvaluationRecordsForm().getFoodSafetyQualityContentL() != null && !"null".equals( form.getEvaluationRecordsForm().getFoodSafetyQualityContentL())) { content += "* V? ch tiu cht lng an ton thc phm:" + "\n"; content += form.getEvaluationRecordsForm().getFoodSafetyQualityContentL() + "\n"; } if (form.getEvaluationRecordsForm().getEffectUtilityContentL() != null && !"null" .equals(form.getEvaluationRecordsForm().getEffectUtilityContentL())) { content += "* V? c ch tc dng, cng dng v hng dn s dng:" + "\n"; content += form.getEvaluationRecordsForm().getEffectUtilityContentL() + "\n"; } if (content != null && !"null".equals(content)) { rcbo.setContent(content); } else { rcbo.setContent("Khng c ni dung."); } } else if (file.getLeaderStaffRequest() != null) { rcbo.setContent(form.getLeaderStaffRequest()); } else { rcbo.setContent("Lnh o phng cha c ni dung."); } rcbo.setCreateBy(userId); rcbo.setCreateDate(dateNow); rcbo.setUserId(userId); rcbo.setUserName(userName); rcbo.setStatus(1L); rcbo.setIsActive(1L); rcbo.setGroupId(deptId); rcbo.setGroupName(deptName); rcbo.setIsLastChange(Constants.ACTIVE_STATUS.ACTIVE); rcbo.setObjectId(form.getFileId()); rcbo.setRequestType(Constants.REQUEST_COMMENT_TYPE.TBSDBS); //-150120 RequestCommentDAOHE rqdaohe = new RequestCommentDAOHE(); RequestComment lastRQBo = rqdaohe.findLastRequestComment(file.getFileId(), Constants.ACTIVE_STATUS.ACTIVE); if (lastRQBo != null) { rcbo.setLastContent(lastRQBo.getContent()); lastRQBo.setIsLastChange(Constants.ACTIVE_STATUS.DEACTIVE); getSession().update(lastRQBo); } getSession().save(rcbo); //!cap nhat noi dung thong bao - tao noi dung thong bao //-150120 //!luu noi dung du thao } } getSession().save(newP); //insert noi dung tham dinh if (form.getEvaluationRecordsForm() != null) { EvaluationRecordsDAOHE evaluationRecordsDAOHE = new EvaluationRecordsDAOHE(); EvaluationRecords evaluationRecords = evaluationRecordsDAOHE.findFilesByFileId(file); if (evaluationRecords != null) { evaluationRecords.setSendDate(file.getSendDate()); evaluationRecords.setLegalL(form.getEvaluationRecordsForm().getLegalL()); evaluationRecords.setLegalContentL(form.getEvaluationRecordsForm().getLegalContentL()); evaluationRecords .setFoodSafetyQualityL(form.getEvaluationRecordsForm().getFoodSafetyQualityL()); evaluationRecords.setFoodSafetyQualityContentL( form.getEvaluationRecordsForm().getFoodSafetyQualityContentL()); evaluationRecords .setEffectUtilityL(form.getEvaluationRecordsForm().getEffectUtilityL()); evaluationRecords.setEffectUtilityContentL( form.getEvaluationRecordsForm().getEffectUtilityContentL()); evaluationRecords.setFilesStatusL(status); evaluationRecords.setMainContentL(form.getLeaderStaffRequest()); getSession().update(evaluationRecords); } insertRequestCommentLeader(file.getFileId(), form, userId, userName, deptId, deptName, dateNow);//binhnt53 150130 } if (p != null) { p.setStatus(status); p.setLastestComment(form.getLeaderStaffRequest()); getSession().update(p); } else { ProcessDAOHE psdhe = new ProcessDAOHE(); Process pFeedbacktoAdd = psdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.FEDBACK_TO_ADD, Constants.FILE_STATUS.NEW_CREATE); if (pFeedbacktoAdd != null) { pFeedbacktoAdd.setStatus(status); pFeedbacktoAdd.setLastestComment(form.getLeaderStaffRequest()); getSession().update(pFeedbacktoAdd); } } // Hiepvv_Home Update Title And Content of File SDBS after announced if (form.getContentsEditATTP() != null && form.getTitleEditATTP() != null && (!"".equals(form.getContentsEditATTP().trim()) || !"".equals(form.getTitleEditATTP().trim())) && (file.getFilesSourceID() != null && file.getFilesSourceID() > 0 && file.getFileSourceCode() != null)) { if (form.getTitleEditATTP() != null) { file.setTitleEditATTP(form.getTitleEditATTP()); } if (form.getContentsEditATTP() != null) { file.setContentsEditATTP(form.getContentsEditATTP()); } } //End Hiepvv update(file); } else { return false; } } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 bReturn = false; } return bReturn; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
public boolean onAssignApproveByCT(FilesForm form, Long deptId, String deptName, Long userId, String userName) { boolean bReturn = true; try {//from w w w .j a v a 2s . c om Files file = findById(form.getFileId()); Date dateNow = getSysdate(); if (file == null) { bReturn = false; } else { Long processStatus = file.getStatus(); file.setStatus(form.getStatus()); file.setDisplayStatus(getFileStatusName(form.getStatus())); String dateTime = DateTimeUtils.convertDateToString(dateNow, "dd/MM/yyyy HH:mm"); file.setLeaderStaffRequest(userName + " " + dateTime + ":\n" + form.getLeaderStaffRequest()); file.setDisplayRequest(form.getLeaderStaffRequest()); file.setModifyDate(dateNow); file.setLeaderApproveName(form.getLeaderApproveName()); file.setLeaderApproveId(form.getLeaderApproveId()); // Cap nhat process ProcessDAOHE pdhe = new ProcessDAOHE(); Process oldP = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, processStatus, Constants.FILE_STATUS.NEW_CREATE); if (oldP != null) { oldP.setStatus(form.getStatus()); oldP.setLastestComment(form.getLeaderStaffRequest()); getSession().update(oldP); } //to process mi vi x l hin ti Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); newP.setProcessStatus(form.getStatus()); // De xu ly newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setStatus(0l); // Moi den chua xu ly newP.setIsActive(1l); newP.setReceiveDate(dateNow); if (form.getStatus().equals(Constants.FILE_STATUS.REVIEWED)) {//tr v? cho vn th thng bo i chiu newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); newP.setReceiveUser(form.getLeaderApproveName()); newP.setReceiveUserId(form.getLeaderApproveId()); //cap nhat noi dung thong bao - tao noi dung thong bao RequestComment rcbo = new RequestComment(); if (file.getLeaderRequest() != null) { rcbo.setContent(form.getLeaderStaffRequest()); } else { rcbo.setContent("Cc trng khng c ni dung."); } rcbo.setCreateBy(userId); rcbo.setCreateDate(dateNow); rcbo.setUserId(userId); rcbo.setUserName(userName); rcbo.setStatus(1L); rcbo.setIsActive(1L); rcbo.setGroupId(deptId); rcbo.setGroupName(deptName); rcbo.setIsLastChange(Constants.ACTIVE_STATUS.ACTIVE); rcbo.setObjectId(form.getFileId()); rcbo.setRequestType(Constants.REQUEST_COMMENT_TYPE.YK);//trinh cuc truong //-150120 RequestCommentDAOHE rqdaohe = new RequestCommentDAOHE(); RequestComment lastRQBo = rqdaohe.findLastRequestComment(file.getFileId(), Constants.ACTIVE_STATUS.ACTIVE); if (lastRQBo != null) { rcbo.setLastContent(lastRQBo.getContent()); lastRQBo.setIsLastChange(Constants.ACTIVE_STATUS.DEACTIVE); getSession().update(lastRQBo); } getSession().save(rcbo); //-150120 //cap nhat noi dung thong bao - tao noi dung thong bao } getSession().save(newP); update(file); } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 bReturn = false; } return bReturn; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
/** * phe duyet xem xet doi chieu//www . j a v a2s .c o m * * @param form * @param deptId * @param deptName * @param userId * @param userName * @return */ public boolean onApproveReviewComparison(FilesForm form, Long deptId, String deptName, Long userId, String userName) { boolean bReturn = true; try { Files file = findById(form.getFileId()); Date dateNow = getSysdate(); if (file == null) { bReturn = false; } else { file.setStatus(form.getStatus()); file.setDisplayStatus(getFileStatusName(form.getStatus())); String dateTime = DateTimeUtils.convertDateToString(dateNow, "dd/MM/yyyy HH:mm"); file.setLeaderRequest(userName + " " + dateTime + ":\n" + form.getLeaderRequest()); file.setDisplayRequest(form.getLeaderRequest()); file.setModifyDate(dateNow); file.setLeaderStaffSignId(userId); file.setLeaderStaffSignName(userName); // Cap nhat process ProcessDAOHE pdhe = new ProcessDAOHE(); Process p = pdhe.getWorkingProcess(form.getFileId(), Constants.OBJECT_TYPE.FILES, deptId, userId); if (p != null) { p.setStatus(form.getStatus()); p.setLastestComment(form.getLeaderRequest()); getSession().update(p); } if (form.getStatus().equals(Constants.FILE_STATUS.APPROVED)) {// Tra lai cho lanh dao don vi xem xet lai file.setIsFee(0L);//bay gio tinh phi giay cong bo //update binhnt // try { // if ("true".equals(ResourceBundleUtil.getString("send_service", "config"))) { // Helper h = new Helper(); // h.sendMs_340(file.getFileId(), "Ho so ma: " + file.getFileCode() + " Da duoc phe duyet yeu cau nop phi ho so."); // } // } catch (UnsupportedEncodingException ex) { // Logger.getLogger(FilesDAOHE.class.getName()).log(Level.SEVERE, null, ex); // } Process pReviewComparison = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.REVIEW_COMPARISON, Constants.FILE_STATUS.NEW_CREATE); if (pReviewComparison != null) { pReviewComparison.setStatus(form.getStatus()); pReviewComparison.setLastestComment(form.getLeaderRequest()); getSession().update(pReviewComparison); } Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); newP.setReceiveDate(dateNow); newP.setProcessStatus(form.getStatus()); // De xu ly newP.setStatus(0l); // Moi den chua xu ly newP.setIsActive(1l); // chuyen xuong van thu tra ho so Process oldP = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.RECEIVED, Constants.FILE_STATUS.ASSIGNED); if (oldP != null) { newP.setReceiveGroup(oldP.getSendGroup()); newP.setReceiveGroupId(oldP.getSendGroupId()); newP.setReceiveUser(oldP.getSendUser()); newP.setReceiveUserId(oldP.getSendUserId()); } getSession().save(newP); //sms MessageSmsDAOHE msdhe = new MessageSmsDAOHE(); String msg = "Ho so ma: " + file.getFileCode() + " cua doanh nghiep: " + file.getBusinessName() + " dang trong trang thai: da phe duyet"; msdhe.saveMessageSMS(userId, file.getUserCreateId(), msg); //email MessageEmailDAOHE msedhe = new MessageEmailDAOHE(); String msge = "H s m: " + file.getFileCode() + " ca doanh nghip: " + file.getBusinessName() + " ang trong trng thi: ph duyt."; msedhe.saveMessageEmail(userId, file.getUserCreateId(), msge); } if (form.getStatus().equals(Constants.FILE_STATUS.FEDBACK_TO_REVIEW)) {// Tra lai cho lanh dao don vi xem xet lai Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); // Gui toi chinh don vi quan ly de xem xet if (p != null) { // Gui lai cho chinh nguoi gui newP.setReceiveDate(dateNow); newP.setReceiveGroup(p.getSendGroup()); newP.setReceiveGroupId(p.getSendGroupId()); newP.setReceiveUser(p.getSendUser()); newP.setReceiveUserId(p.getSendUserId()); } newP.setProcessStatus(form.getStatus()); // De xu ly newP.setStatus(0l); // Moi den chua xu ly newP.setIsActive(1l); getSession().save(newP); } if (form.getStatus().equals(Constants.FILE_STATUS.EVALUATED_TO_ADD)) {// gui tra ho so cho doanh nghiep sua doi bo sung Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); // newP.setReceiveDate(dateNow); newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); newP.setProcessStatus(form.getStatus()); //De xu ly newP.setStatus(0l); //Moi den chua xu ly newP.setIsActive(1l); getSession().save(newP); //xa bn ghi temp trc nu c (lu vo vng lu tr) updateSetNotLastIsTemp(file.getFileId()); try { ResourceBundle rb = ResourceBundle.getBundle("config"); Procedure procedurebo; ProcedureDAOHE procedureDAOHE = new ProcedureDAOHE(); procedurebo = procedureDAOHE.findById(file.getFileType()); int SD = 0; try { SD = Integer.parseInt(rb.getString(procedurebo.getDescription() + "_SD")); } catch (NumberFormatException ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } if (SD > 0) { file.setDeadlineAddition(getDateWorkingTime(SD)); } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } //y kien lanh chuyen thanh y kien cua lanh dao } } update(file); } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 bReturn = false; } return bReturn; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
/** * xem xet doi chieu lanh dao phong//from w w w . j ava 2 s .com * * @param form * @param deptId * @param deptName * @param userId * @param userName * @return */ public boolean onComparisonByLeaderOfStaff(FilesForm form, Long deptId, String deptName, Long userId, String userName) {//db140425 boolean bReturn = true; try { Files file = findById(form.getFileId()); Date dateNow = getSysdate(); if (file == null) { bReturn = false; } else { if (form.getIsComparison().equals(1L)) {//xem xet ok file.setStatus(Constants.FILE_STATUS.REVIEW_COMPARISON); file.setDisplayStatus(getFileStatusName(Constants.FILE_STATUS.REVIEW_COMPARISON)); form.setStatus(Constants.FILE_STATUS.REVIEW_COMPARISON); } else {//xem xet not ok file.setStatus(Constants.FILE_STATUS.COMPARED_FAIL); file.setDisplayStatus(getFileStatusName(Constants.FILE_STATUS.COMPARED_FAIL)); form.setStatus(Constants.FILE_STATUS.COMPARED_FAIL); } file.setModifyDate(dateNow); file.setComparisonContent(form.getComparisonContent()); file.setIsComparison(form.getIsComparison()); //cap nhat noi dung thong bao - tao noi dung thong bao RequestComment rcbo = new RequestComment(); rcbo.setContent(form.getComparisonContent()); rcbo.setCreateBy(userId); rcbo.setCreateDate(dateNow); rcbo.setUserId(userId); rcbo.setUserName(userName); rcbo.setStatus(1L); rcbo.setIsActive(1L); rcbo.setGroupId(deptId); rcbo.setGroupName(deptName); rcbo.setIsLastChange(Constants.ACTIVE_STATUS.ACTIVE); rcbo.setObjectId(form.getFileId()); rcbo.setRequestType(Constants.REQUEST_COMMENT_TYPE.TBDC); //-150120 RequestCommentDAOHE rqdaohe = new RequestCommentDAOHE(); RequestComment lastRQBo = rqdaohe.findLastRequestComment(file.getFileId(), Constants.ACTIVE_STATUS.ACTIVE); if (lastRQBo != null) { rcbo.setLastContent(lastRQBo.getContent()); lastRQBo.setIsLastChange(Constants.ACTIVE_STATUS.DEACTIVE); getSession().update(lastRQBo); } getSession().save(rcbo); //-150120 //!cap nhat noi dung thong bao - tao noi dung thong bao //update process cu ProcessDAOHE pdhe = new ProcessDAOHE(); Process oldP = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.COMPARED, Constants.FILE_STATUS.NEW_CREATE); Process approveFail = null; if (oldP != null) {//truong hop la chuyen vien gui len oldP.setStatus(form.getStatus()); if (form.getRequestCommentForm() != null) { oldP.setLastestComment(form.getRequestCommentForm().getContent()); } getSession().update(oldP); } else {//truong hop lanh dao cuc tra ve approveFail = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.REVIEW_COMPARISON_FAIL, Constants.FILE_STATUS.NEW_CREATE); if (approveFail != null) { approveFail.setStatus(form.getStatus()); if (form.getRequestCommentForm() != null) { approveFail.setLastestComment(form.getRequestCommentForm().getContent()); } getSession().update(approveFail); } } //tao process moi Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); newP.setReceiveDate(dateNow); newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setProcessStatus(form.getStatus()); // De xu ly newP.setStatus(0L); // Moi den chua xu ly newP.setIsActive(1l); newP.setReceiveDate(dateNow); //tim lanh dao co quan de phe duyet if (form.getIsComparison().equals(1L)) { //approveFail = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.REVIEW_COMPARISON_FAIL, Constants.FILE_STATUS.NEW_CREATE); if (approveFail != null) {//neu la lanh dao tra ve - tra lai luon cho lanh dao newP.setReceiveGroup(approveFail.getSendGroup()); newP.setReceiveGroupId(approveFail.getSendGroupId()); newP.setReceiveUser(approveFail.getSendUser()); newP.setReceiveUserId(approveFail.getSendUserId()); } else {//nop len lanh dao cuc - chua ro lanh dao newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); } } else { //tra lai cho chuyen vien de doi chieu Process pold = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.ASSIGNED, Constants.FILE_STATUS.EVALUATED); if (pold != null) { newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveGroupId(pold.getSendGroupId()); newP.setReceiveUser(pold.getReceiveUser()); newP.setReceiveUserId(pold.getReceiveUserId()); } else { newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); } } getSession().save(newP); getSession().update(file); } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 bReturn = false; } return bReturn; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
/** * tao thong bao doi chieu ho so binhnt53 - 140817 * * @param form/*w ww .j ava 2s . c o m*/ * @param deptId * @param deptName * @param userId * @param userName * @return */ public boolean onAlertComparison(FilesForm form, Long deptId, String deptName, Long userId, String userName) { boolean bReturn = true; try { Files file = findById(form.getFileId());//lay thong tin chi tiet ho so Date dateNow = getSysdate(); if (file == null) { bReturn = false; } else { // Cap nhat trang thai ho so Long lastProcess = file.getStatus(); file.setStatus(form.getStatus()); file.setDisplayStatus(getFileStatusName(form.getStatus())); file.setModifyDate(dateNow); // Cap nhat process ProcessDAOHE pdhe = new ProcessDAOHE(); Process oldP = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, lastProcess, Constants.FILE_STATUS.NEW_CREATE); if (oldP != null) { oldP.setStatus(form.getStatus()); if (form.getRequestCommentForm() != null) { oldP.setLastestComment(form.getRequestCommentForm().getContent()); } getSession().update(oldP); } if (form.getStatus().equals(Constants.FILE_STATUS.ALERT_COMPARISON)) { Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); // newP.setReceiveDate(dateNow); // newP.setReceiveGroup(deptName); // newP.setReceiveGroupId(deptId); //tim doanh nghiep Process pReceive = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.NEW, Constants.FILE_STATUS.RECEIVED); if (pReceive != null) { newP.setReceiveUser(pReceive.getSendUser()); newP.setReceiveUserId(pReceive.getSendUserId()); newP.setReceiveGroup(pReceive.getSendGroup()); newP.setReceiveGroupId(pReceive.getSendGroupId()); } newP.setProcessStatus(form.getStatus()); // De xu ly newP.setStatus(0l); // Moi den chua xu ly newP.setIsActive(1l); getSession().save(newP); //tao noi dung thong bao if (form.getComparisonContent() != null && form.getComparisonContent().trim().length() > 0) { //cap nhat noi dung thong bao - tao noi dung thong bao RequestComment rcbo = new RequestComment(); rcbo.setContent(form.getComparisonContent()); file.setComparisonContent(form.getComparisonContent()); rcbo.setCreateBy(userId); rcbo.setCreateDate(dateNow); rcbo.setUserId(userId); rcbo.setUserName(userName); rcbo.setStatus(1L); rcbo.setIsActive(1L); rcbo.setGroupId(deptId); rcbo.setGroupName(deptName); rcbo.setObjectId(form.getFileId()); rcbo.setRequestType(Constants.REQUEST_COMMENT_TYPE.TBDC);//-150120 rcbo.setIsLastChange(Constants.ACTIVE_STATUS.ACTIVE);//-150120 //-150120 RequestCommentDAOHE rqdaohe = new RequestCommentDAOHE(); RequestComment lastRQBo = rqdaohe.findLastRequestComment(file.getFileId(), Constants.ACTIVE_STATUS.ACTIVE); if (lastRQBo != null) { rcbo.setLastContent(lastRQBo.getContent()); lastRQBo.setIsLastChange(Constants.ACTIVE_STATUS.DEACTIVE); getSession().update(lastRQBo); } getSession().save(rcbo); //-150120 //!cap nhat noi dung thong bao - tao noi dung thong bao } } update(file); } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 bReturn = false; } return bReturn; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
public boolean onReviewManyFiles(FilesForm form, Long deptId, String deptName, Long userId, String userName) { boolean bReturn = true; try {/*ww w. j ava2s . c om*/ Files file = findById(form.getFileId()); Date dateNow = getSysdate(); if (file == null) { bReturn = false; } else { Long processStatus = file.getStatus();//trang thai ho so truoc khi thay doi Long status = form.getStatus(); if (processStatus != null//141225 BINHNT update phan quyen ho so tham dinh && (processStatus.equals(Constants.FILE_STATUS.EVALUATED)//DA THAM DINH DAT || processStatus.equals(Constants.FILE_STATUS.FEDBACK_TO_REVIEW)//TRA LAI XEM XET LAI || processStatus.equals(Constants.FILE_STATUS.EVALUATE_TO_ADD)//TRA LAI XEM XET LAI || processStatus.equals(Constants.FILE_STATUS.FEDBACK_TO_ADD))) {//DA THAM DINH YEU CA SDBS // Cap nhat trang thai ho so file.setStatus(status); file.setDisplayStatus(getFileStatusName(status)); String dateTime = DateTimeUtils.convertDateToString(dateNow, "dd/MM/yyyy HH:mm"); if (!status.equals(Constants.FILE_STATUS.REVIEW_TO_ADD)) { file.setLeaderStaffRequest( userName + " " + dateTime + ":\n" + form.getLeaderStaffRequest()); file.setDisplayRequest(form.getLeaderStaffRequest()); } file.setModifyDate(dateNow); file.setEvaluateAddDate(dateNow); file.setLeaderApproveName(form.getLeaderApproveName()); file.setLeaderApproveId(form.getLeaderApproveId()); // Cap nhat process ProcessDAOHE pdhe = new ProcessDAOHE(); Process p = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, processStatus, Constants.FILE_STATUS.NEW_CREATE); Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); newP.setProcessStatus(status); // De xu ly newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setStatus(Constants.FILE_STATUS.NEW_CREATE); // Moi den chua xu ly newP.setIsActive(Constants.ACTIVE_STATUS.ACTIVE); newP.setReceiveDate(dateNow); newP.setReceiveUser(form.getLeaderApproveName()); newP.setReceiveUserId(form.getLeaderApproveId()); newP.setReceiveGroup(file.getAgencyName()); newP.setReceiveGroupId(file.getAgencyId()); getSession().save(newP); if (p != null) { p.setStatus(status); p.setLastestComment(form.getLeaderStaffRequest()); getSession().update(p); } else { Process pFeedbacktoAdd = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.FEDBACK_TO_ADD, Constants.FILE_STATUS.NEW_CREATE); if (pFeedbacktoAdd != null) { pFeedbacktoAdd.setStatus(status); pFeedbacktoAdd.setLastestComment(form.getLeaderStaffRequest()); getSession().update(pFeedbacktoAdd); } } update(file); } else { return false; } } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 bReturn = false; } return bReturn; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
public boolean onEvaluate(FilesForm form, Long deptId, String deptName, Long userId, String userName) { boolean bReturn = true; try {// w ww. j av a2s . c o m Files file = findById(form.getFileId());//lay thong tin chi tiet ho so Date dateNow = getSysdate(); UsersDAOHE udaohe; if (file == null) { bReturn = false; } else// Cap nhat trang thai ho so if ((file.getStatus() != null && form.getStatus() != null)//141225 binhnt update phan quyen ho so tham dinh && (file.getStatus().equals(Constants.FILE_STATUS.ASSIGNED)//da phan cong || file.getStatus().equals(Constants.FILE_STATUS.FEDBACK_TO_EVALUATE)//tra lai tham dinh lai || file.getStatus().equals(Constants.FILE_STATUS.EVALUATED)//tham dinh || file.getStatus().equals(Constants.FILE_STATUS.REVIEW_TO_ADD)// xem xt ni dung cv sbs LDC || file.getStatus().equals(Constants.FILE_STATUS.REVIEWED_TO_ADD)//? xem xt yu cu S?BS LDC || file.getStatus().equals(Constants.FILE_STATUS.APPROVE_TO_ADD)// ph duyt ni dung thng bo VT || file.getStatus().equals(Constants.FILE_STATUS.FEDBACK_TO_ADD)//da tra lai bo sung ho so || file.getStatus().equals(Constants.FILE_STATUS.RECEIVED_TO_ADD))) {//da tiep nhan ho so sdbs Long processStatus = file.getStatus(); file.setStatus(form.getStatus()); /* khi tham dinh ho so cvien thuc hien tham dinh neu la cv chuyen pp hoac truong phong neu la pp chuyen tp hoac ldc */ boolean isReview = false; if (form.getLeaderReviewId() != null) {//gui lanh dao tham dinh udaohe = new UsersDAOHE(); Users uReceive = udaohe.findById(form.getLeaderReviewId()); if (form.getLeaderReviewName() == null || "".equals(form.getLeaderReviewName())) { form.setLeaderReviewName(uReceive.getFullName()); } List<String> lstStaff = new ArrayList<String>(); lstStaff.add(Constants.POSITION.VFA_CV); lstStaff.add(Constants.POSITION.NV); if (udaohe.checkRoleUserOfLst(deptId, userId, lstStaff)) { if (udaohe.checkTruongPhong(form.getLeaderReviewId())) { file.setLeaderReviewId(form.getLeaderReviewId()); file.setLeaderReviewName(form.getLeaderReviewName()); file.setLeaderApproveId(null); file.setLeaderApproveName(null); } else { file.setLeaderEvaluateId(form.getLeaderReviewId()); file.setLeaderEvaluateName(form.getLeaderReviewName()); file.setLeaderReviewId(null); file.setLeaderReviewName(null); file.setLeaderApproveId(null); file.setLeaderApproveName(null); } } else { List<String> lstTP = new ArrayList<String>(); lstTP.add(Constants.POSITION.LEADER_OF_STAFF_T); lstTP.add(Constants.POSITION.GDTT); if (udaohe.checkRoleUserOfLst(deptId, form.getLeaderReviewId(), lstTP)) { file.setLeaderReviewId(form.getLeaderReviewId()); file.setLeaderReviewName(form.getLeaderReviewName()); file.setLeaderApproveId(null); file.setLeaderApproveName(null); } else { file.setLeaderApproveId(form.getLeaderReviewId()); file.setLeaderApproveName(form.getLeaderReviewName()); if (file.getStatus().equals(Constants.FILE_STATUS.EVALUATED)) { file.setStatus(Constants.FILE_STATUS.REVIEWED); } else if (file.getStatus().equals(Constants.FILE_STATUS.FEDBACK_TO_ADD)) { file.setStatus(Constants.FILE_STATUS.REVIEW_TO_ADD); } isReview = true; } } } else { udaohe = new UsersDAOHE(); List<String> lstLeader = new ArrayList<String>(); lstLeader.add(Constants.POSITION.LEADER_OF_STAFF_T); lstLeader.add(Constants.POSITION.GDTT); Users ubo; List<Users> lstLeaderOfDept = udaohe.findLstUserByLstPosition(deptId, lstLeader); if (lstLeaderOfDept != null && lstLeaderOfDept.size() > 0) { ubo = lstLeaderOfDept.get(0); file.setLeaderReviewId(ubo.getUserId()); file.setLeaderReviewName(ubo.getFullName()); file.setLeaderApproveId(null); file.setLeaderApproveName(null); form.setLeaderReviewId(ubo.getUserId()); form.setLeaderReviewName(ubo.getFullName()); } } // neu tra lai de bo sung -> thiet lap bien have_temp = 1 de biet ma tao ra history khi sua doi if (file.getStatus().equals(Constants.FILE_STATUS.EVALUATED_TO_ADD)) { file.setHaveTemp(1l); } file.setDisplayStatus(getFileStatusName(file.getStatus())); // String dateTime = DateTimeUtils.convertDateToString(dateNow, "dd/MM/yyyy HH:mm"); //file.setStaffRequest(userName + " " + dateTime + ":\n" + form.getStaffRequest()); // String prefix = userName + " " + dateTime + ":\n"; if (form.getStaffRequest() != null && form.getStaffRequest().trim().length() > 0) { String strStaffRequest = form.getStaffRequest(); if (strStaffRequest.trim().length() < 1800) {//u 16 07 29 file.setStaffRequest(strStaffRequest.trim()); } } file.setModifyDate(dateNow); if (form.getEffectiveDate() != null) { file.setEffectiveDate(form.getEffectiveDate()); } else { file.setEffectiveDate(Constants.EFFECTIVEDATE.THREE); } file.setIsTypeChange(form.getIsTypeChange()); file.setLastType(form.getLastType()); //Cap nhat process cu ProcessDAOHE pdhe = new ProcessDAOHE(); Process p = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, processStatus, Constants.FILE_STATUS.NEW_CREATE); if (p != null) { p.setStatus(file.getStatus()); p.setLastestComment(form.getStaffRequest()); getSession().update(p); } //!Cap nhat process cu if (form.getStatus().equals(Constants.FILE_STATUS.EVALUATED) || form.getStatus().equals(Constants.FILE_STATUS.FEDBACK_TO_ADD)) { //tham xet dat, tham xet khong dat deu gui len cho to truong to tham xet xem xet Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); newP.setReceiveDate(dateNow); newP.setReceiveUserId(form.getLeaderReviewId()); newP.setReceiveUser(form.getLeaderReviewName()); if (!isReview) { newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); } else { Users leaderApprove = udaohe.findById(file.getLeaderApproveId()); newP.setReceiveGroup(leaderApprove.getDeptName()); newP.setReceiveGroupId(leaderApprove.getDeptId()); } newP.setProcessStatus(file.getStatus()); // De xu ly newP.setStatus(0l); // Moi den chua xu ly newP.setIsActive(1l); getSession().save(newP); } else if (form.getStatus().equals(Constants.FILE_STATUS.EVALUATED_TO_ADD)) { //tao thong bao yeu cau sdbs gui toi doanh nghiep Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); newP.setReceiveDate(dateNow); ProcessDAOHE psdhe = new ProcessDAOHE(); Process pold = psdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.NEW, Constants.FILE_STATUS.RECEIVED); if (pold != null) { newP.setReceiveGroupId(pold.getSendGroupId()); newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveUserId(pold.getSendUserId()); newP.setReceiveUser(pold.getSendUser()); } else { newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); } newP.setProcessStatus(file.getStatus()); //De xu ly newP.setStatus(0l); //Moi den chua xu ly newP.setIsActive(1l); getSession().save(newP); //xa bn ghi temp trc nu c (lu vo vng lu tr) updateSetNotLastIsTemp(file.getFileId()); //xa bn ghi temp trc nu c (lu vo vng lu tr) ProcessCommentDAOHE pcdaohe = new ProcessCommentDAOHE(); pcdaohe.updateSetNotLastIsTemp(file.getFileId()); } else if (form.getStatus().equals(Constants.FILE_STATUS.EVALUATE_TO_ADD)) {//da soan du thao thong bao sdbs ho so /* ho so sau khi da tra lai chuyen vien de soan du thao tb sdbs cv vao tao ban du thao sau khi tao xong luu gui noi dung cho lanh dao phong xem xet */ Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setProcessStatus(file.getStatus()); // De xu ly newP.setStatus(Constants.ACTIVE_STATUS.DEACTIVE);// Moi den chua xu ly-150120 newP.setIsActive(Constants.ACTIVE_STATUS.ACTIVE);//-150120 newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); newP.setReceiveDate(dateNow); if (form.getLeaderReviewId() != null) { newP.setReceiveUserId(form.getLeaderReviewId()); file.setLeaderReviewId(form.getLeaderReviewId()); } if (form.getLeaderReviewName() != null) { newP.setReceiveUser(form.getLeaderReviewName()); file.setLeaderReviewName(form.getLeaderReviewName()); } newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); getSession().save(newP); //cap nhat noi dung thong bao - tao noi dung thong bao RequestComment rcbo = new RequestComment(); if (form.getStaffRequest() != null) { rcbo.setContent(form.getStaffRequest()); } else { rcbo.setContent("Chuyn vin cha c ni dung."); } rcbo.setCreateBy(userId); rcbo.setCreateDate(dateNow); rcbo.setUserId(userId); rcbo.setUserName(userName); rcbo.setStatus(1L); rcbo.setIsActive(1L); rcbo.setGroupId(deptId); rcbo.setGroupName(deptName); rcbo.setObjectId(form.getFileId()); rcbo.setRequestType(Constants.REQUEST_COMMENT_TYPE.TBSDBS);//-150120 rcbo.setIsLastChange(Constants.ACTIVE_STATUS.ACTIVE);//-150120 //!luu noi dung du thao //u150119 binhnt53 update li ni dung thng tin. RequestCommentDAOHE rqdaohe = new RequestCommentDAOHE(); RequestComment lastRQBo = rqdaohe.findLastRequestComment(file.getFileId(), Constants.ACTIVE_STATUS.ACTIVE); if (lastRQBo != null) { rcbo.setLastContent(lastRQBo.getContent()); lastRQBo.setIsLastChange(Constants.ACTIVE_STATUS.DEACTIVE); getSession().update(lastRQBo); } getSession().save(rcbo); //!u150119 binhnt53 update li ni dung thng tin. } else if ((form.getStatus()).equals(Constants.FILE_STATUS.FEDBACK_TO_EVALUATE)) {//hieptq update 230415 Process newP = new Process(); newP.setObjectId(form.getFileId()); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setSendDate(dateNow); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); newP.setProcessStatus(p.getStatus()); // De xu ly newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setStatus(Constants.FILE_STATUS.NEW_CREATE); // Moi den chua xu ly newP.setIsActive(Constants.ACTIVE_STATUS.ACTIVE); newP.setReceiveDate(dateNow); if (p != null) { //lay process tham dinh ho so ProcessDAOHE psdhe = new ProcessDAOHE(); Process pold = psdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.EVALUATED, p.getStatus()); if (pold != null) { newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveGroupId(pold.getSendGroupId()); if (file != null && file.getStaffProcess() != null && file.getNameStaffProcess() != null) { newP.setReceiveUser(file.getNameStaffProcess()); newP.setReceiveUserId(file.getStaffProcess()); } else { newP.setReceiveUser(pold.getSendUser()); newP.setReceiveUserId(pold.getSendUserId()); } } else {//141218u binhnt53 fix loi ho so lanh dao phong tra lai voi pold = psdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.FEDBACK_TO_ADD, p.getStatus()); if (pold != null) { newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveGroupId(pold.getSendGroupId()); if (file != null && file.getStaffProcess() != null && file.getNameStaffProcess() != null) { newP.setReceiveUser(file.getNameStaffProcess()); newP.setReceiveUserId(file.getStaffProcess()); } else { newP.setReceiveUser(pold.getSendUser()); newP.setReceiveUserId(pold.getSendUserId()); } } else if (p != null) {// Gui lai cho chinh nguoi gui newP.setReceiveGroup(p.getSendGroup()); newP.setReceiveGroupId(p.getSendGroupId()); newP.setReceiveUser(p.getSendUser()); newP.setReceiveUserId(p.getSendUserId()); } } } getSession().save(newP); } //insert noi dung tham dinh if (form.getEvaluationRecordsForm() != null) { EvaluationRecordsForm evaRecordForm = new EvaluationRecordsForm(); evaRecordForm.setCreateDate(dateNow); evaRecordForm.setSendDate(file.getSendDate()); evaRecordForm.setBusinessName(file.getBusinessName()); evaRecordForm.setBusinessAddress(file.getBusinessAddress()); evaRecordForm.setProductName(file.getProductName()); evaRecordForm.setLegal(form.getEvaluationRecordsForm().getLegal()); evaRecordForm.setLegalContent(form.getEvaluationRecordsForm().getLegalContent()); evaRecordForm.setFoodSafetyQuality(form.getEvaluationRecordsForm().getFoodSafetyQuality()); evaRecordForm.setFoodSafetyQualityContent( form.getEvaluationRecordsForm().getFoodSafetyQualityContent()); evaRecordForm.setEffectUtility(form.getEvaluationRecordsForm().getEffectUtility()); evaRecordForm .setEffectUtilityContent(form.getEvaluationRecordsForm().getEffectUtilityContent()); evaRecordForm.setFilesStatus(file.getStatus()); evaRecordForm.setMainContent(file.getStaffRequest()); evaRecordForm.setFirstStaffId(userId); evaRecordForm.setFirstStaffName(userName); evaRecordForm.setSecondStaffId(userId); evaRecordForm.setSecondStaffName(userName); evaRecordForm.setThirdStaffId(userId); evaRecordForm.setThirdStaffName(userName); evaRecordForm.setLeederStaffId(userId); evaRecordForm.setLeederStaffName(userName); evaRecordForm.setFilesId(file.getFileId()); EvaluationRecords evaluationRecordsBo; evaluationRecordsBo = evaRecordForm.convertToEntity(); getSession().save(evaluationRecordsBo); insertRequestComment(file.getFileId(), form, userId, userName, deptId, deptName, dateNow);//binhnt53 150130 } else if (form.getEvaluationRecordsFormOnGrid() != null) { EvaluationRecordsFormOnGrid evaRecordForm = new EvaluationRecordsFormOnGrid(); evaRecordForm.setCreateDate(dateNow); evaRecordForm.setSendDate(file.getSendDate()); evaRecordForm.setBusinessName(file.getBusinessName()); evaRecordForm.setBusinessAddress(file.getBusinessAddress()); evaRecordForm.setProductName(file.getProductName()); evaRecordForm.setLegal(form.getEvaluationRecordsFormOnGrid().getLegal()); evaRecordForm.setLegalContent(form.getEvaluationRecordsFormOnGrid().getLegalContent()); evaRecordForm .setFoodSafetyQuality(form.getEvaluationRecordsFormOnGrid().getFoodSafetyQuality()); evaRecordForm.setFoodSafetyQualityContent( form.getEvaluationRecordsFormOnGrid().getFoodSafetyQualityContent()); evaRecordForm.setEffectUtility(form.getEvaluationRecordsFormOnGrid().getEffectUtility()); evaRecordForm.setEffectUtilityContent( form.getEvaluationRecordsFormOnGrid().getEffectUtilityContent()); evaRecordForm.setFilesStatus(file.getStatus()); evaRecordForm.setMainContent(file.getStaffRequest()); evaRecordForm.setFirstStaffId(userId); evaRecordForm.setFirstStaffName(userName); evaRecordForm.setSecondStaffId(userId); evaRecordForm.setSecondStaffName(userName); evaRecordForm.setThirdStaffId(userId); evaRecordForm.setThirdStaffName(userName); evaRecordForm.setLeederStaffId(userId); evaRecordForm.setLeederStaffName(userName); evaRecordForm.setFilesId(file.getFileId()); EvaluationRecords evaluationRecordsBo; evaluationRecordsBo = evaRecordForm.convertToEntity(); getSession().save(evaluationRecordsBo); insertRequestCommentOnGrid(file.getFileId(), form, userId, userName, deptId, deptName, dateNow);//binhnt53 150130 } if (form.getStatus().equals(Constants.FILE_STATUS.EVALUATED_TO_ADD)) {//140721 binhnt try {//140627 THIET LAP HAN SDBS HO SO ResourceBundle rb = ResourceBundle.getBundle("config"); Procedure procedurebo; ProcedureDAOHE procedureDAOHE = new ProcedureDAOHE(); procedurebo = procedureDAOHE.findById(file.getFileType()); int SD = 0; try { SD = Integer.parseInt(rb.getString(procedurebo.getDescription() + "_SD")); } catch (NumberFormatException ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } if (SD > 0) { file.setDeadlineAddition(getDateWorkingTime(SD)); } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } //!140627 THIET LAP HAN SDBS HO SO //sms /* disable send sms binhnt53 150205 MessageSmsDAOHE msdhe = new MessageSmsDAOHE(); String msg = "Ho so ma: " + file.getFileCode() + " cua doanh nghiep: " + file.getBusinessName() + " dang trong trang thai: da thong bao yeu cau sdbs"; msdhe.saveMessageSMS(userId, file.getUserCreateId(), msg); */ //email MessageEmailDAOHE msedhe = new MessageEmailDAOHE(); String msge = "H s m: " + file.getFileCode() + " ca doanh nghip: " + file.getBusinessName() + " ang trong trng thi: ? thng bo yu cu sa i b sung."; msedhe.saveMessageEmail(userId, file.getUserCreateId(), msge); } //!140721 // Hiepvv_Home Update Title And Content of File SDBS after announced if (form.getContentsEditATTP() != null && form.getTitleEditATTP() != null && (!"".equals(form.getContentsEditATTP().trim()) || !"".equals(form.getTitleEditATTP().trim())) && (file.getFilesSourceID() != null && file.getFilesSourceID() > 0 && file.getFileSourceCode() != null)) { if (form.getTitleEditATTP() != null) { file.setTitleEditATTP(form.getTitleEditATTP()); } if (form.getContentsEditATTP() != null) { file.setContentsEditATTP(form.getContentsEditATTP()); } } //End Hiepvv update(file); } else { log.error("Li h thng: Phn quy?n x l h s: " + file.getFileCode()); return false; } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 bReturn = false; } return bReturn; }