List of usage examples for java.lang Process Process
public Process()
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
/** * Gi h s cho c quan x l K ton xc nhn h s * * @param fileId//from w w w .ja va 2s .c om * @param deptId * @param userId * @param userName * @param businessId * @param businessName * @return */ public boolean assignFileToDept(Long fileId, Long deptId, Long userId, String userName, Long businessId, String businessName) { boolean bReturn = true; try { Files bo = findById(fileId); DepartmentDAOHE ddhe = new DepartmentDAOHE(); Date dateNow = getSysdate(); Department dept = ddhe.findById(deptId); Long processStatus = bo.getStatus(); bo.setAgencyId(dept.getDeptId()); bo.setAgencyName(dept.getDeptName()); bo.setModifyDate(dateNow); ProcedureDAOHE pdhe = new ProcedureDAOHE(); Procedure pro = pdhe.findById(bo.getFileType()); if (pro != null && pro.getDeadline() != null) { Date dt = DateTimeUtils.getAddDate(dateNow, 0, pro.getDeadline().intValue()); bo.setDeadline(dt); } if (bo.getStatus().equals(Constants.FILE_STATUS.NEW_CREATE) || bo.getStatus().equals(Constants.FILE_STATUS.RECEIVED_REJECT)) { bo.setStatus(Constants.FILE_STATUS.NEW); bo.setDisplayStatus(getFileStatusName(Constants.FILE_STATUS.NEW)); if (processStatus.equals(Constants.FILE_STATUS.RECEIVED_REJECT)) { ProcessDAOHE psdhe = new ProcessDAOHE(); Process p = psdhe.getProcessByAction(fileId, Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, processStatus, Constants.FILE_STATUS.NEW_CREATE); if (p != null) { p.setStatus(bo.getStatus()); p.setLastestComment("Doanh nghip gi Sa i b sung"); getSession().update(p); } } } if (processStatus.equals(Constants.FILE_STATUS.EVALUATED_TO_ADD) || processStatus.equals(Constants.FILE_STATUS.RECEIVED_REJECT_TO_ADD)) { bo.setStatus(Constants.FILE_STATUS.NEW_TO_ADD); bo.setDisplayStatus(getFileStatusName(Constants.FILE_STATUS.NEW_TO_ADD)); //update process ProcessDAOHE psdhe = new ProcessDAOHE(); Process p = psdhe.getProcessByAction(fileId, Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, processStatus, Constants.FILE_STATUS.NEW_CREATE); if (p != null) { p.setStatus(bo.getStatus()); p.setLastestComment("Doanh nghip gi Sa i b sung"); getSession().update(p); } } bo.setSendDate(dateNow); //140623 THIET LAP HAN TIEP NHAN HO SO ResourceBundle rb = ResourceBundle.getBundle("config"); Procedure procedurebo; ProcedureDAOHE procedureDAOHE = new ProcedureDAOHE(); procedurebo = procedureDAOHE.findById(bo.getFileType()); int TN = 0; try { TN = Integer.parseInt(rb.getString(procedurebo.getDescription() + "_TN")); } catch (NumberFormatException ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } if (TN > 0) { bo.setDeadlineReceived(getDateWorkingTime(TN)); } //Hiepvv Set defalt TitleEditATTP = TitleEdit AND ContentsEditATTP = ContentsEdit if (bo.getTitleEdit() != null) { bo.setTitleEditATTP(bo.getTitleEdit()); } if (bo.getContentsEdit() != null) { bo.setContentsEditATTP(bo.getContentsEdit()); } //140623 THIET LAP HAN TIEP NHAN HO SO getSession().update(bo); // gui den cho co quan truoc Process p = new Process(); p.setObjectId(fileId); p.setObjectType(Constants.OBJECT_TYPE.FILES); p.setSendDate(dateNow); p.setSendGroup(businessName); p.setSendGroupId(businessId); p.setSendUserId(userId); p.setSendUser(userName); p.setReceiveDate(dateNow); // String deptCode = rb.getString("deptCode"); if (deptCode == null) { deptCode = "ATTP"; } DepartmentDAOHE dphe = new DepartmentDAOHE(); Department dep = dphe.findByDeptCode(deptCode); if (dep != null) { p.setReceiveGroup(dep.getDeptName()); p.setReceiveGroupId(dep.getDeptId()); } else { p.setReceiveGroup(dept.getDeptName()); p.setReceiveGroupId(dept.getDeptId()); } p.setProcessType(Constants.PROCESS_TYPE.MAIN); //140404 binhnt53 if (bo.getStatus().equals(Constants.FILE_STATUS.NEW) || bo.getStatus().equals(Constants.FILE_STATUS.RECEIVED_REJECT)) { p.setProcessStatus(Constants.FILE_STATUS.NEW); // De xu ly } else { p.setProcessStatus(Constants.FILE_STATUS.NEW_TO_ADD); // De xu ly } // p.setProcessStatus(Constants.FILE_STATUS.NEW); // De xu ly //!140404 binhnt53 // if (lst != null && lst.size() > 0) { //140405 if (bo.getStatus().equals(Constants.FILE_STATUS.EVALUATED_TO_ADD) == true) { p.setStatus(Constants.FILE_STATUS.ASSIGNED); } else { p.setStatus(Constants.FILE_STATUS.NEW_CREATE); } p.setIsActive(Constants.ACTIVE_STATUS.ACTIVE); getSession().save(p); } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 bReturn = false; // log.error(en.getMessage()); } return bReturn; }
From source file:com.viettel.hqmc.DAO.FilesDAO.java
/** * lu lung x l/*from ww w .j a v a2s . c om*/ * * @return */ public String onSaveProcess() { List resultMessage = new ArrayList(); List customInfo = new ArrayList(); String sid = ""; Long staffProcess = 0l; String nameStaffProcess = ""; Long leaderAssignId = 0L; String leaderAssignName = ""; String type = getRequest().getParameter("type"); String lstObjectId = getRequest().getParameter("lstObjectId"); try { ProcessDAOHE pDaoHe = new ProcessDAOHE(); Long fileId; if (lstProcessOnGrid != null && lstProcessOnGrid.size() > 0) { fileId = lstProcessOnGrid.get(0).getObjectId(); Process p; Integer countObj = 1; String[] lstObjectIdSplit = null; if ("2".equals(type)) { lstObjectIdSplit = lstObjectId.split(","); countObj = lstObjectIdSplit.length; } Process processMain; List<Process> processSlave; for (int obj = 0; obj < countObj; obj++) { if ("2".equals(type)) { fileId = Long.parseLong(lstObjectIdSplit[obj]); } processMain = pDaoHe.getProcessMain(getUserId(), getDepartmentId(), fileId, Constants.OBJECT_TYPE.FILES, Constants.PROCESS_TYPE.MAIN); processSlave = pDaoHe.getProcessSalve(getUserId(), getDepartmentId(), fileId, Constants.OBJECT_TYPE.FILES, Constants.PROCESS_TYPE.COOPERATE); for (int i = 0; i < lstProcessOnGrid.size(); i++) { ProcessForm form = lstProcessOnGrid.get(i); if (form.getProcessId() != null) { p = pDaoHe.findById(form.getProcessId()); /* if (Constants.PROCESS_TYPE.PROPOSE.equals(form.getProcessType())) { form.setProcessType(Constants.PROCESS_TYPE.MAIN); } */ p.setProcessType(form.getProcessType()); p.setProcessStatus(Constants.FILE_STATUS.ASSIGNED); p.setSendUser(getUserName()); p.setSendUserId(getUserId()); p.setSendGroup(getDepartmentName()); p.setSendGroupId(getDepartmentId()); p.setStatus(0l); p.setIsActive(1L); getSession().update(p); } else { // Check PROCESS_TYPE.MAIN if (form.getProcessType() == Constants.PROCESS_TYPE.COOPERATE && processMain != null && processMain.getReceiveUserId().equals(form.getReceiveUserId())) { resultMessage.add("3"); resultMessage.add( "Thc hin phn cng x l khng thnh cng: Khng th phn cng X l chnh lm X l phi hp"); jsonDataGrid.setItems(resultMessage); jsonDataGrid.setCustomInfo(customInfo); return GRID_DATA; } // Check PROCESS_TYPE.MAIN if (form.getProcessType() == Constants.PROCESS_TYPE.MAIN && processSlave != null && processSlave.size() > 0) { for (int j = 0; j < processSlave.size(); j++) { if (processSlave.get(j).getSendUserId().equals(form.getReceiveUserId())) { resultMessage.add("3"); resultMessage.add( "Thc hin phn cng x l chnh khng thnh cng: Bn cn xa vai tr x l phi hp trc khi phn x l chnh cho Cn b"); jsonDataGrid.setItems(resultMessage); jsonDataGrid.setCustomInfo(customInfo); return GRID_DATA; } } } ProcessDAOHE psdhe = new ProcessDAOHE(); p = psdhe.getProcessByAction(fileId, Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.ASSIGNED, Constants.FILE_STATUS.NEW_CREATE); if (p != null) { p.setSendUser(getUserName()); leaderAssignName = getUserName(); p.setSendUserId(getUserId()); leaderAssignId = getUserId(); p.setSendGroup(getDepartmentName()); p.setSendGroupId(getDepartmentId()); p.setObjectType(Constants.OBJECT_TYPE.FILES); p.setProcessType(form.getProcessType()); p.setReceiveDate(getSysdate()); p.setReceiveUser(form.getReceiveUser()); nameStaffProcess = form.getReceiveUser(); p.setReceiveUserId(form.getReceiveUserId()); staffProcess = form.getReceiveUserId(); p.setReceiveGroup(form.getReceiveGroup()); p.setReceiveGroupId(form.getReceiveGroupId()); p.setObjectId(fileId); p.setProcessStatus(Constants.FILE_STATUS.ASSIGNED); p.setStatus(0l); p.setIsActive(1L); getSession().update(p); } else { p = new Process(); p.setSendUser(getUserName()); leaderAssignName = getUserName(); p.setSendUserId(getUserId()); leaderAssignId = getUserId(); p.setSendGroup(getDepartmentName()); p.setSendGroupId(getDepartmentId()); p.setObjectType(Constants.OBJECT_TYPE.FILES); p.setProcessType(form.getProcessType()); p.setReceiveDate(getSysdate()); p.setReceiveUser(form.getReceiveUser()); nameStaffProcess = form.getReceiveUser(); p.setReceiveUserId(form.getReceiveUserId()); staffProcess = form.getReceiveUserId(); p.setReceiveGroup(form.getReceiveGroup()); p.setReceiveGroupId(form.getReceiveGroupId()); p.setObjectId(fileId); p.setProcessStatus(Constants.FILE_STATUS.ASSIGNED); p.setStatus(0l); p.setIsActive(1L); getSession().save(p); } } if ("".equals(sid)) { sid = p.getProcessId().toString(); } else { sid = sid + "," + p.getProcessId().toString(); } boolean bReturn = pDaoHe.deleteProcessNotIn(getUserId(), getDepartmentId(), fileId, Constants.OBJECT_TYPE.FILES, sid); if (!bReturn) { resultMessage.add("3"); resultMessage.add("Thc hin phn cng x l khng thnh cng"); jsonDataGrid.setItems(resultMessage); jsonDataGrid.setCustomInfo(customInfo); return GRID_DATA; } Process pWorking = pDaoHe.getWorkingProcess(fileId, Constants.OBJECT_TYPE.FILES, getDepartmentId()); if (pWorking != null) { pWorking.setStatus(Constants.FILE_STATUS.ASSIGNED); getSession().update(pWorking); } else { ProcessDAOHE psdhe = new ProcessDAOHE(); Process pold = psdhe.getProcessByAction(fileId, Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.RECEIVED, Constants.FILE_STATUS.NEW_CREATE); if (pold != null) { pold.setStatus(Constants.FILE_STATUS.ASSIGNED); getSession().update(pold); } } if (fileId != null && fileId.longValue() > -1) { FilesDAOHE fDAOHE = new FilesDAOHE(); Files f = fDAOHE.findById(fileId); if (lstProcessOnGrid.size() > 0) { f.setStatus(Constants.FILE_STATUS.ASSIGNED); if (((f.getStaffProcess() != null && f.getStaffProcess().equals(getUserId()) == false) || f.getStaffProcess() == null) && !staffProcess.equals(0L)) { f.setStaffProcess(staffProcess); f.setNameStaffProcess(nameStaffProcess); } //add lanh dao phan cong vao ho so - 140915 binhnt53 if (f.getLeaderAssignId() == null) { f.setLeaderAssignId(leaderAssignId); f.setLeaderAssignName(leaderAssignName); } } else { f.setStatus(Constants.FILE_STATUS.NEW); } f.setDisplayStatus(FilesDAOHE.getFileStatusName(f.getStatus())); getSession().update(f); fDAOHE.saveStatusFiles(f, "Trng thi hin ti ca h s: ? thc hin phn cng h s m: " + f.getFileCode()); } } } } resultMessage.add("1"); resultMessage.add("Thc hin phn cng x l thnh cng"); } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 resultMessage.add("3"); resultMessage.add("Thc hin phn cng x l khng thnh cng"); } jsonDataGrid.setItems(resultMessage); jsonDataGrid.setCustomInfo(customInfo); return GRID_DATA; }
From source file:com.viettel.hqmc.DAO.FilesDAO.java
/** * ? xut thm nh/*from w ww. ja v a 2 s . co m*/ * * @return */ public String onPropose() { List resultMessage = new ArrayList(); List customInfo = new ArrayList(); HttpServletRequest req = getRequest(); HttpSession session = req.getSession(); viettel.passport.client.UserToken userToken = (viettel.passport.client.UserToken) session .getAttribute("userToken"); try { FilesDAOHE bdhe = new FilesDAOHE(); Long userId = userToken.getUserID(); String userName = userToken.getFullName(); for (int i = 0; i < lstItemOnGrid.size(); i++) { FilesForm form = lstItemOnGrid.get(i); if (form != null) { Files bo = bdhe.getById("fileId", form.getFileId()); if (bo != null && !Constants.FILE_STATUS.PROPOSED.equals(bo.getStatus())) { bo.setStatus(Constants.FILE_STATUS.PROPOSED); bo.setDisplayStatus(FilesDAOHE.getFileStatusName(Constants.FILE_STATUS.PROPOSED)); getSession().update(bo); } String hql = " select count(p)" + " from Process p" + " where p.isActive = 1" + " and p.objectType = ?" + " and p.objectId = ?" + " and p.receiveUserId =?"; Query query = getSession().createQuery(hql); query.setParameter(0, Constants.OBJECT_TYPE.FILES); query.setParameter(1, form.getFileId()); query.setParameter(2, userId); Long count = (Long) query.uniqueResult(); if (count > 0l) { resultMessage.add("3"); resultMessage.add("Bn thc hin ? xut"); } else { Process p = new Process(); p.setIsActive(1L); p.setProcessType(Constants.PROCESS_TYPE.PROPOSE); p.setObjectId(bo.getFileId()); p.setReceiveUserId(userId); p.setReceiveUser(userName); p.setReceiveGroupId(getDepartmentId()); p.setReceiveGroup(getDepartment().getDeptName()); p.setObjectType(Constants.OBJECT_TYPE.FILES); p.setReceiveDate(DateTimeUtils.getDate()); getSession().save(p); } } } resultMessage.add("1"); resultMessage.add("Thc hin ? xut thnh cng"); } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 resultMessage.add("3"); resultMessage.add("Thc hin ? xut khng thnh cng"); } jsonDataGrid.setItems(resultMessage); jsonDataGrid.setCustomInfo(customInfo); return GRID_DATA; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
/** * Tham dinh ho so - chuyen vien//from w ww. j a va2 s .c o m * * @param form * @param deptId ma don vi * @param deptName ten don vi * @param userId ma nguoi dung * @param userName ten nguoi dung * @return */ public boolean onEvaluateOld(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 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)//tra lai tham dinh lai || 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(); if (form.getProductType() != null && form.getProductType() == 1L && form.getLeaderReviewId() != null) {//gui lanh dao tham dinh //150114 binhn53 add check TP k dc tham dinh ho so //new binhnt update 08102015 UsersDAOHE udaohe = new UsersDAOHE(); List<String> lstLeader = new ArrayList<String>(); lstLeader.add(Constants.POSITION.LEADER_OF_STAFF_T); lstLeader.add(Constants.POSITION.GDTT); List<Users> lstUser = udaohe.findLstUserByLstPosition(deptId, lstLeader); //!new binhnt update 08102015 //List<Users> lstUser = udaohe.findLstUserByPosition(deptId, Constants.POSITION.LEADER_OF_STAFF_T);//old 08102015 bbinhnt if (lstUser != null) { for (Users users : lstUser) { if (users.getUserId() != null && form.getLeaderReviewId().equals(users.getUserId())) { return false; } } } //!150114 binhn53 add check TP k dc tham dinh ho so file.setLeaderEvaluateId(form.getLeaderReviewId()); file.setLeaderEvaluateName(form.getLeaderReviewName()); file.setLeaderReviewId(null); file.setLeaderReviewName(null); file.setLeaderApproveId(null); file.setLeaderApproveName(null); } else if (form.getLeaderReviewId() != null) {//gui lanh dao de xem xet file.setLeaderReviewId(form.getLeaderReviewId()); file.setLeaderReviewName(form.getLeaderReviewName()); file.setLeaderEvaluateId(null); file.setLeaderEvaluateName(null); file.setLeaderApproveId(null); file.setLeaderApproveName(null); } else { //new binhnt update 08102015 UsersDAOHE 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); } } file.setStatus(form.getStatus()); // neu tra lai de bo sung -> thiet lap bien have_temp = 1 de biet ma tao ra history khi sua doi if (form.getStatus().equals(Constants.FILE_STATUS.EVALUATED_TO_ADD)) { file.setHaveTemp(1l); } file.setDisplayStatus(getFileStatusName(form.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) { file.setStaffRequest(form.getStaffRequest()); } 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(form.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); if (form.getProductType() != null && form.getProductType() == 1L && file.getLeaderEvaluateId() != null) { newP.setReceiveUserId(file.getLeaderEvaluateId()); newP.setReceiveUser(file.getLeaderEvaluateName()); } else if (file.getLeaderReviewId() != null) { newP.setReceiveUserId(file.getLeaderReviewId()); newP.setReceiveUser(file.getLeaderReviewName()); } 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 { 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(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()); //xa bn ghi temp trc nu c (lu vo vng lu tr) ProcessCommentDAOHE pcdaohe = new ProcessCommentDAOHE(); pcdaohe.updateSetNotLastIsTemp(file.getFileId()); } 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(form.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. } //hieptq update 230415 if ((form.getStatus()).equals(Constants.FILE_STATUS.FEDBACK_TO_EVALUATE)) { 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.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 } 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 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; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
/** * 260214 doi chieu ho so -comparison -binhnt53 * * @param form/* w w w. j av a2s. c o m*/ * @param deptId * @param deptName * @param userId * @param userName * @return */ public boolean onComparison(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 { Long isComparison = form.getIsComparison(); if (isComparison.equals(1L)) { file.setStatus(Constants.FILE_STATUS.COMPARED); file.setDisplayStatus(getFileStatusName(Constants.FILE_STATUS.COMPARED)); form.setStatus(Constants.FILE_STATUS.COMPARED); } else { 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.setObjectId(form.getFileId()); rcbo.setRequestType(Constants.REQUEST_COMMENT_TYPE.TBDC);//-150120 rcbo.setIsLastChange(Constants.ACTIVE_STATUS.ACTIVE);//-150120 //u150119 binhnt53 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 //cap nhat noi dung thong bao - tao noi dung thong bao //update process cu ProcessDAOHE pdhe = new ProcessDAOHE(); if (isComparison.equals(1L)) { Process oldP = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.ALERT_COMPARISON, Constants.FILE_STATUS.NEW_CREATE); if (oldP != null) { oldP.setStatus(form.getStatus()); if (form.getRequestCommentForm() != null) { oldP.setLastestComment(form.getRequestCommentForm().getContent()); } getSession().update(oldP); } else { oldP = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.COMPARED_FAIL, Constants.FILE_STATUS.NEW_CREATE); if (oldP != null) { oldP.setStatus(form.getStatus()); if (form.getRequestCommentForm() != null) { oldP.setLastestComment(form.getRequestCommentForm().getContent()); } getSession().update(oldP); } } } else { Process oldP = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.COMPARED_FAIL, Constants.FILE_STATUS.NEW_CREATE); if (oldP != null) { oldP.setStatus(form.getStatus()); if (form.getRequestCommentForm() != null) { oldP.setLastestComment(form.getRequestCommentForm().getContent()); } getSession().update(oldP); } else { oldP = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.ALERT_COMPARISON, Constants.FILE_STATUS.NEW_CREATE); if (oldP != null) { oldP.setStatus(form.getStatus()); if (form.getRequestCommentForm() != null) { oldP.setLastestComment(form.getRequestCommentForm().getContent()); } getSession().update(oldP); } } } //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); //tim lanh dao phan cong de gui if (isComparison.equals(1L)) { newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); } else { //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()); } 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
/** * Nhp kt qu xem xt//from w w w . ja v a 2s . c o m * * @param form * @param deptId * @param deptName * @param userId * @param userName * @return */ public boolean onReview(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 { // 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.setLeaderStaffRequest(userName + " " + dateTime + ":\n" + form.getLeaderStaffRequest()); file.setDisplayRequest(form.getLeaderStaffRequest()); file.setModifyDate(dateNow); file.setEvaluateAddDate(dateNow); // 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.getLeaderStaffRequest()); getSession().update(p); } else { ProcessDAOHE psdhe = new ProcessDAOHE(); Process 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) { pold.setStatus(form.getStatus()); pold.setLastestComment(form.getLeaderStaffRequest()); getSession().update(pold); } } // Neu co luong thi chay theo luong if (file.getFlowId() != null && file.getFlowId() > 0) { FlowDAOHE fdhe = new FlowDAOHE(); if (Constants.FILE_STATUS.REVIEWED.equals(form.getStatus())) { fdhe.moveDocumentToNextNodeByAction(deptId, deptName, userId, userName, file.getFileId(), "xem xt"); } else { //fdhe.moveDocumentToNextNodeByAction(deptId, deptName, userId, userName, file.getFileId(), "tr li"); //fdhe.moveDocumentToPreviousNode(deptId, deptName, userId, userName, file.getFileId(), file.getPreviousNodeId()); 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); if (form.getStatus().equals(Constants.FILE_STATUS.REVIEWED)) { newP.setReceiveDate(dateNow); newP.setReceiveGroup(file.getAgencyName()); newP.setReceiveGroupId(file.getAgencyId()); } else if (p != null) { if (form.getStatus().equals(Constants.FILE_STATUS.EVALUATED_TO_ADD)) {//140722 - da thong bao yeu cau sdbs 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); //xa bn ghi temp trc nu c (lu vo vng lu tr) updateSetNotLastIsTemp(file.getFileId());// } else { //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.FEDBACK_TO_ADD, Constants.FILE_STATUS.NEW_CREATE); if (pold != null) { newP.setReceiveDate(dateNow); newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveGroupId(pold.getSendGroupId()); newP.setReceiveUser(pold.getSendUser()); newP.setReceiveUserId(pold.getSendUserId()); } else { newP.setReceiveDate(dateNow); newP.setReceiveGroup(p.getSendGroup()); newP.setReceiveGroupId(p.getSendGroupId()); newP.setReceiveUser(p.getSendUser()); newP.setReceiveUserId(p.getSendUserId()); } } } getSession().save(newP); } } else {// Neu khong co luong thi tu xu thoi :-) // Xem xet oke, gui tiep cho cho lanh dao co quan phe duyet 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); if (form.getStatus().equals(Constants.FILE_STATUS.REVIEWED)) { // Gui toi chinh don vi quan ly de phe duyet newP.setReceiveDate(dateNow); newP.setReceiveGroup(file.getAgencyName()); newP.setReceiveGroupId(file.getAgencyId()); } else { if (form.getStatus().equals(Constants.FILE_STATUS.EVALUATED_TO_ADD)) {//140722 - da thong bao yeu cau sdbs newP.setReceiveDate(dateNow); newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); //xa bn ghi temp trc nu c (lu vo vng lu tr) updateSetNotLastIsTemp(file.getFileId());// } if (form.getStatus().equals(Constants.FILE_STATUS.FEDBACK_TO_ADD)) {// Tra lai cho chuyen vien tham dinh 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.FEDBACK_TO_ADD, Constants.FILE_STATUS.NEW_CREATE); if (pold != null) { newP.setReceiveDate(dateNow); newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveGroupId(pold.getSendGroupId()); newP.setReceiveUser(pold.getSendUser()); newP.setReceiveUserId(pold.getSendUserId()); } else { // 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()); } } } if (form.getStatus().equals(Constants.FILE_STATUS.FEDBACK_TO_EVALUATE)) {// Tra lai cho chuyen vien tham dinh 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.setReceiveDate(dateNow); newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveGroupId(pold.getSendGroupId()); newP.setReceiveUser(pold.getSendUser()); newP.setReceiveUserId(pold.getSendUserId()); } else {//141218u binhnt53 update fix loi ho so khi cv tham dinh k dat tra lai cho chuyen vien 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.setReceiveDate(dateNow); newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveGroupId(pold.getSendGroupId()); newP.setReceiveUser(pold.getSendUser()); newP.setReceiveUserId(pold.getSendUserId()); } else 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()); } } } } if (form.getStatus().equals(Constants.FILE_STATUS.REVIEWED_TO_ADD)) { //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.FEDBACK_TO_ADD, Constants.FILE_STATUS.NEW_CREATE); if (pold != null) { newP.setReceiveDate(dateNow); newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveGroupId(pold.getSendGroupId()); newP.setReceiveUser(pold.getSendUser()); newP.setReceiveUserId(pold.getSendUserId()); } else { newP.setReceiveDate(dateNow); 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) { 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(file.getStatus()); evaluationRecords.setMainContentL(file.getLeaderRequest()); getSession().update(evaluationRecords); } } //140721 binhnt if (form.getStatus().equals(Constants.FILE_STATUS.EVALUATED_TO_ADD)) { 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); } //!140721 update(file); } } catch (Exception ex) { LogUtil.addLog(ex);//binhnt sonar a160901 bReturn = false; } return bReturn; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
/** * Ph duyt h s//from w w w . ja v a2 s . c om * * @param form * @param deptId * @param deptName * @param userId * @param userName * @return */ public boolean onApprove(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(); /* REVIEWED = 5L;//? xem xt kt qu REVIEW_TO_ADD = 26L;// xem xt ni dung cv sbs REVIEW_TO_BOSS = 29L;//H s trnh cc trng xem xt APPROVE_TO_LEADER = 30L;//H s cc trng quyt nh APPROVE_TO_ADD ph duyt cng vn sa i b sung. EVALUATE_TO_ADD //Da soan du thao sua doi bo sung */ if (processStatus != null//141225 BINHNT update phan quyen ho so tham dinh && (processStatus.equals(Constants.FILE_STATUS.REVIEWED)//? xem xt kt qu || processStatus.equals(Constants.FILE_STATUS.REVIEW_TO_ADD)//? xem xt ni dung cv sbs || processStatus.equals(Constants.FILE_STATUS.APPROVE_TO_ADD)//? ph duyt ni dung thng bo VT || processStatus.equals(Constants.FILE_STATUS.REVIEW_TO_BOSS)//H s trnh cc trng xem xt || processStatus.equals(Constants.FILE_STATUS.APPROVE_TO_LEADER)//H s cc trng quyt nh || processStatus.equals(Constants.FILE_STATUS.EVALUATE_TO_ADD) //? son d tho sa i b sung || processStatus.equals(Constants.FILE_STATUS.FEDBACK_TO_ADD) //? tr li b sung h s || processStatus.equals(Constants.FILE_STATUS.EVALUATED) //? tr li b sung h s )) { file.setStatus(form.getStatus()); file.setDisplayStatus(getFileStatusName(form.getStatus())); String dateTime = DateTimeUtils.convertDateToString(dateNow, "dd/MM/yyyy HH:mm"); if (!form.getStatus().equals(Constants.FILE_STATUS.APPROVE_TO_ADD)) { file.setLeaderRequest(userName + " " + dateTime + ":\n" + form.getLeaderRequest()); file.setDisplayRequest(form.getLeaderRequest()); } else { file.setLeaderRequest(userName + " " + dateTime + ":\n" + "? ph duyt ni dung cng vn yu cu S?BS"); file.setDisplayRequest("? ph duyt ni dung cng vn yu cu S?BS"); } file.setModifyDate(dateNow); file.setLeaderStaffSignId(userId); file.setLeaderStaffSignName(userName); // 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.getLeaderRequest()); 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.APPROVED)) {//tr v? cho vn th thng bo i chiu newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); //cap nhat noi dung thong bao - tao noi dung thong bao RequestComment rcbo = new RequestComment(); rcbo.setContent(form.getLeaderStaffRequest()); file.setComparisonContent(form.getLeaderStaffRequest()); 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); rcbo.setIsLastChange(Constants.ACTIVE_STATUS.ACTIVE); //150119 binhnt53 update bo sung last change 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); //!binhnt53 update bo sung last change ProcedureDAOHE pdheNew = new ProcedureDAOHE(); Procedure pro = pdheNew.findById(file.getFileType()); //Hiepvv 0803 Khong xet lai phi cho SDBS sau cong bo if (!"01".equals(pro.getCode()) && !"02".equals(pro.getCode()) && !"announcementFile05".equals(pro.getDescription())) { file.setIsFee(0l); //update binhnt // 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."); // } } /* i lung binhnt53 140914 // Phe duyet oke, chuyen ho so xuong cho van thu tra 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); newP.setReceiveDate(dateNow); //lay process cua VT tiep nhan Process pold = pdhe.getProcessByAction(form.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.RECEIVED, Constants.FILE_STATUS.ASSIGNED); if (pold != null) { newP.setReceiveGroup(pold.getSendGroup()); newP.setReceiveGroupId(pold.getSendGroupId()); newP.setReceiveUser(pold.getSendUser()); newP.setReceiveUserId(pold.getSendUserId()); } else { newP.setReceiveUser(deptName); newP.setReceiveUserId(deptId); } 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("YKPD"); getSession().save(rcbo); getSession().save(newP); */ } else { if (form.getStatus().equals(Constants.FILE_STATUS.REVIEWED_TO_ADD)) {//da xem xet yc sdbs //lay process tham dinh ho so tra ve cho chuyen vien tham dinh chinh //gui den chuyen vien xu ly if (oldP != null) { newP.setReceiveGroup(oldP.getSendGroup()); newP.setReceiveGroupId(oldP.getSendGroupId()); } newP.setReceiveUser(file.getNameStaffProcess()); newP.setReceiveUserId(file.getStaffProcess()); //cap nhat noi dung thong bao - tao noi dung thong bao RequestComment rcbo = new RequestComment(); rcbo.setContent(file.getLeaderRequest()); 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); rcbo.setIsLastChange(Constants.ACTIVE_STATUS.ACTIVE); 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 } if (form.getStatus().equals(Constants.FILE_STATUS.APPROVE_TO_ADD)) {//ldc phe duyet noi dung chuyen cho vt gui cong van sdbs if (deptId.equals(file.getAgencyId())) { newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); } else { newP.setReceiveGroup(file.getAgencyName()); newP.setReceiveGroupId(file.getAgencyId()); } //cap nhat noi dung thong bao - tao noi dung thong bao RequestComment rcbo = new RequestComment(); if (file.getLeaderRequest() != null) { rcbo.setContent(form.getLeaderRequest()); } 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); //u150119 binhnt53 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 //tang so ho so di CountNoDAOHE cndaohe = new CountNoDAOHE(); CountNo cnbo = cndaohe.returnCountNoByDeptId(deptId); if (cnbo != null && cnbo.getSendNo() > 0L) { Long nCount = cnbo.getSendNo(); cnbo.setSendNo(nCount + 1); getSession().update(cnbo); } else if (file != null && file.getAgencyId() > 0L) { cnbo = cndaohe.returnCountNoByDeptId(file.getAgencyId()); Long nCount = cnbo.getSendNo(); cnbo.setSendNo(nCount + 1); getSession().update(cnbo); } } if (form.getStatus().equals(Constants.FILE_STATUS.FEDBACK_TO_REVIEW)) {//160406 //lanh dao cuc tu choi phe duyet cong van thong bao sdbs chuyen cho lanh dao phong xem xet lai if (oldP != null) { newP.setReceiveGroup(oldP.getSendGroup()); newP.setReceiveGroupId(oldP.getSendGroupId()); newP.setReceiveUser(oldP.getSendUser()); newP.setReceiveUserId(oldP.getSendUserId()); } //cap nhat noi dung thong bao - tao noi dung thong bao RequestComment rcbo = new RequestComment(); if (file.getLeaderRequest() != null) { rcbo.setContent(form.getLeaderRequest()); } 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); 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 } if (form.getStatus().equals(Constants.FILE_STATUS.REVIEW_TO_BOSS)) {//- luong pho cuc truong gui trinh len lanh dao cuc //- tim cuc truong de gui UsersDAOHE udaohe = new UsersDAOHE(); Users ubo = udaohe.findUserByPosition(deptId, Constants.POSITION.LEADER_CT); if (ubo != null) { newP.setReceiveUser(ubo.getFullName()); newP.setReceiveUserId(ubo.getUserId()); } newP.setReceiveGroup(deptName); newP.setReceiveGroupId(deptId); //cap nhat noi dung thong bao - tao noi dung thong bao RequestComment rcbo = new RequestComment(); if (file.getLeaderRequest() != null) { rcbo.setContent(form.getLeaderRequest()); } 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.TCT);//trinh cuc truong 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 } } getSession().save(newP); update(file); //onCreatePaper(form, deptId, deptName, userId, userName); if (form.getStatus().equals(Constants.FILE_STATUS.APPROVED)) { ProcedureDAOHE pcdaohe = new ProcedureDAOHE(); Procedure procedure = pcdaohe.findById(file.getFileType()); if (procedure != null && procedure.getProcedureId() > 0) { if (!procedure.getDescription().equals(Constants.FILE_DESCRIPTION.ANNOUNCEMENT_FILE01) && !procedure.getDescription() .equals(Constants.FILE_DESCRIPTION.ANNOUNCEMENT_FILE03)) { //sms MessageSmsDAOHE msdhe = new MessageSmsDAOHE(); String msg = "Ho so ma: " + file.getFileCode() + " cua doanh nghiep: " + file.getBusinessName() + " dang trong trang thai: da phe duyet, doanh nghiep luu y dong le phi cap so de duoc cap 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: ph duyt, doanh nghip lu ng l ph cp s c cp bn cng b"; msedhe.saveMessageEmail(userId, file.getUserCreateId(), msge); } } //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); // } } } 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
/** * tiep nhan ho so - vai tro van thu binhnt53 * * @param form/*ww w .j a v a 2s.c o m*/ * @param deptId * @param deptName * @param userId * @param userName * @return */ public boolean onReceivedFile(FilesForm form, Long deptId, String deptName, Long userId, String userName) { boolean bReturn = true; try { Date dateNow = getSysdate(); Files file = findById(form.getFileId()); if (file == null) { bReturn = false; } else { //140404 Long processStatus = file.getStatus(); if (processStatus.equals(Constants.FILE_STATUS.NEW_TO_ADD) || processStatus.equals(Constants.FILE_STATUS.RECEIVED_REJECT_TO_ADD)) {//neu ho so la nop sdbs k tao so if (form.getStatus().equals(Constants.FILE_STATUS.RECEIVED_REJECT)) { file.setStatus(Constants.FILE_STATUS.RECEIVED_REJECT_TO_ADD); file.setDisplayStatus(getFileStatusName(Constants.FILE_STATUS.RECEIVED_REJECT_TO_ADD)); file.setClericalRequest(form.getClericalRequest()); } else { file.setStatus(Constants.FILE_STATUS.RECEIVED_TO_ADD); file.setDisplayStatus(getFileStatusName(Constants.FILE_STATUS.RECEIVED_TO_ADD)); } //file.setReceiveNo(getNewReceiveNo(deptId)); } else if (form.getStatus().equals(Constants.FILE_STATUS.RECEIVED_REJECT)) { file.setStatus(Constants.FILE_STATUS.RECEIVED_REJECT); file.setDisplayStatus(getFileStatusName(Constants.FILE_STATUS.RECEIVED_REJECT)); file.setClericalRequest(form.getClericalRequest()); } else { file.setStatus(Constants.FILE_STATUS.RECEIVED); file.setDisplayStatus(getFileStatusName(Constants.FILE_STATUS.RECEIVED)); if (file.getReceiveNo() == null || file.getReceiveNo().trim().length() == 0) { file.setReceiveNo(getNewReceiveNo(deptId)); } } file.setModifyDate(dateNow); // file.setIsFee(form.getIsFee()); file.setStaffSigningId(userId); file.setStaffSigningName(userName); if (form.getSignDate() == null) { file.setSignDate(dateNow); } else { file.setSignDate(form.getSignDate()); } //140627 UPDATE BO SUNG THOI GIAN HAN CONG BO, PHAN HOI HO SO if (!form.getStatus().equals(Constants.FILE_STATUS.RECEIVED_REJECT)) { file.setReceivedDate(dateNow); ResourceBundle rb = ResourceBundle.getBundle("config"); ProcedureDAOHE procedureDAOHE = new ProcedureDAOHE(); Procedure procedurebo = procedureDAOHE.findById(file.getFileType()); if ("announcement4star".equalsIgnoreCase(procedurebo.getDescription())) { file.setDeadlineApprove(getDateWorkingTime(15)); file.setDeadlineComment(getDateWorkingTime(15)); } else { int CB = 0, PH = 0; try { CB = Integer.parseInt(rb.getString(procedurebo.getDescription() + "_CB")); } catch (NumberFormatException ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } try { PH = Integer.parseInt(rb.getString(procedurebo.getDescription() + "_PH")); } catch (NumberFormatException ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } if (CB > 0) { file.setDeadlineApprove(getDateWorkingTime(CB)); } if (PH > 0) { file.setDeadlineComment(getDateWorkingTime(PH)); } } } ProcessDAOHE psdhe = new ProcessDAOHE(); Process ptmp = psdhe.getProcessByAction(file.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, processStatus, Constants.FILE_STATUS.NEW_CREATE); if (ptmp != null) { if (processStatus.equals(Constants.FILE_STATUS.NEW_TO_ADD)) { if (form.getStatus().equals(Constants.FILE_STATUS.RECEIVED_REJECT)) { ptmp.setStatus(Constants.FILE_STATUS.RECEIVED_REJECT_TO_ADD); } else { ptmp.setStatus(Constants.FILE_STATUS.RECEIVED_TO_ADD); } } else if (form.getStatus().equals(Constants.FILE_STATUS.RECEIVED_REJECT)) { ptmp.setStatus(form.getStatus()); } else { ptmp.setStatus(Constants.FILE_STATUS.RECEIVED); } ptmp.setLastestComment(form.getStaffRequest()); getSession().update(ptmp); } 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); // Neu khong co luong if (file.getStatus().equals(Constants.FILE_STATUS.RECEIVED)) { // Gui toi chinh don vi quan ly de tiep nhan newP.setReceiveDate(dateNow); if (form.getProcessDeptName() != null && form.getProcessDeptId() != null) { newP.setReceiveGroup(form.getProcessDeptName()); newP.setReceiveGroupId(form.getProcessDeptId()); } 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); } else { if (file.getStatus().equals(Constants.FILE_STATUS.RECEIVED_TO_ADD)) { //gui cho chuyen vien tham dinh ho so newP.setReceiveDate(dateNow); //140407 ProcessDAOHE processDAOHE = new ProcessDAOHE(); Process userAction = processDAOHE.findProcessByActionEvaluate(file.getFileId()); if (userAction != null) { newP.setReceiveUser(userAction.getReceiveUser()); newP.setReceiveUserId(userAction.getReceiveUserId()); newP.setReceiveGroup(userAction.getReceiveGroup()); newP.setReceiveGroupId(userAction.getReceiveGroupId()); } 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); } if (file.getStatus().equals(Constants.FILE_STATUS.RECEIVED_REJECT)) { //tu choi tiep nhan newP.setReceiveDate(dateNow); ProcessDAOHE processDAOHE = new ProcessDAOHE();//140407 //Process userAction = processDAOHE.findProcessByActionEvaluate(file.getFileId());//141217u binhnt update thay lai luong tra lai doanh nghiep khi tu choi tiep nhan ho so Process userAction = processDAOHE.getProcessByAction(file.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.NEW, Constants.FILE_STATUS.NEW_CREATE); if (userAction != null) { //141217u binhnt update thay lai luong tra lai doanh nghiep khi tu choi tiep nhan ho so newP.setReceiveUser(userAction.getSendUser()); newP.setReceiveUserId(userAction.getSendUserId()); newP.setReceiveGroup(userAction.getSendGroup()); newP.setReceiveGroupId(userAction.getSendGroupId()); /* newP.setReceiveUser(userAction.getReceiveUser()); newP.setReceiveUserId(userAction.getReceiveUserId()); newP.setReceiveGroup(userAction.getReceiveGroup()); newP.setReceiveGroupId(userAction.getReceiveGroupId()); */ } 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); } if (file.getStatus().equals(Constants.FILE_STATUS.RECEIVED_REJECT_TO_ADD)) {//tu choi tiep nhan sdbs newP.setReceiveDate(dateNow); if (ptmp != null) { //141217u binhnt update thay lai luong tra lai doanh nghiep khi tu choi tiep nhan ho so newP.setReceiveUser(ptmp.getSendUser()); newP.setReceiveUserId(ptmp.getSendUserId()); newP.setReceiveGroup(ptmp.getSendGroup()); newP.setReceiveGroupId(ptmp.getSendGroupId()); } 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); // } getSession().update(file); MessageSmsDAOHE msdhe = new MessageSmsDAOHE(); String msg = "Ho so ma: " + file.getFileCode() + " cua doanh nghiep: " + file.getBusinessName() + " dang trong trang thai: da tiep nhan"; 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: ? tip nhn"; msedhe.saveMessageEmail(userId, file.getUserCreateId(), msge); //send group leader of dept 140915 binhnt53 EmailSmsDAO emdao = new EmailSmsDAO(); emdao.alertLeaderOfStaffAssignFiles(deptId, file.getFileCode(), file.getBusinessName()); // bReturn = true; } } catch (Exception ex) { bReturn = false; LogUtil.addLog(ex);//binhnt sonar a160901 } return bReturn; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
public boolean onReceivedFileToStaff(FilesForm form, Long userId, String userName) { boolean bReturn = true; try {/* w ww. ja v a 2s . c o m*/ Date dateNow = getSysdate(); Files file = findById(form.getFileId()); if (file == null) { bReturn = false; } else { Long processStatus = file.getStatus(); file.setStatus(Constants.FILE_STATUS.RECEIVED_TO_ADD); file.setDisplayStatus(getFileStatusName(Constants.FILE_STATUS.RECEIVED_TO_ADD)); file.setReceivedDate(dateNow); ResourceBundle rb = ResourceBundle.getBundle("config"); ProcedureDAOHE procedureDAOHE = new ProcedureDAOHE(); Procedure procedurebo = procedureDAOHE.findById(file.getFileType()); if ("announcement4star".equalsIgnoreCase(procedurebo.getDescription())) { file.setDeadlineApprove(getDateWorkingTime(15)); file.setDeadlineComment(getDateWorkingTime(15)); } else { int CB = 0, PH = 0; try { CB = Integer.parseInt(rb.getString(procedurebo.getDescription() + "_CB")); } catch (NumberFormatException ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } try { PH = Integer.parseInt(rb.getString(procedurebo.getDescription() + "_PH")); } catch (NumberFormatException ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } if (CB > 0) { file.setDeadlineApprove(getDateWorkingTime(CB)); } if (PH > 0) { file.setDeadlineComment(getDateWorkingTime(PH)); } } ProcessDAOHE psdhe = new ProcessDAOHE(); Process ptmp = psdhe.getProcessByAction(file.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, processStatus, Constants.FILE_STATUS.NEW_CREATE); if (ptmp != null) { if (processStatus.equals(Constants.FILE_STATUS.EVALUATED_TO_ADD)) { ptmp.setStatus(Constants.FILE_STATUS.RECEIVED_TO_ADD); } ptmp.setLastestComment(form.getStaffRequest()); getSession().update(ptmp); } 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(ptmp.getReceiveGroup()); newP.setSendGroupId(ptmp.getReceiveGroupId()); newP.setSendUserId(userId); newP.setSendUser(userName); if (file.getStatus().equals(Constants.FILE_STATUS.RECEIVED_TO_ADD)) { //gui cho chuyen vien tham dinh ho so newP.setReceiveDate(dateNow); //140407 ProcessDAOHE processDAOHE = new ProcessDAOHE(); Process userAction = processDAOHE.findProcessByActionEvaluate(file.getFileId()); if (userAction != null) { newP.setReceiveUser(userAction.getReceiveUser()); newP.setReceiveUserId(userAction.getReceiveUserId()); newP.setReceiveGroup(userAction.getReceiveGroup()); newP.setReceiveGroupId(userAction.getReceiveGroupId()); } else { newP.setReceiveGroup(ptmp.getReceiveGroup()); newP.setReceiveGroupId(ptmp.getReceiveGroupId()); } // newP.setProcessStatus(file.getStatus()); // De xu ly newP.setStatus(0l); // Moi den chua xu ly newP.setIsActive(1l); } getSession().save(newP); getSession().update(file); MessageSmsDAOHE msdhe = new MessageSmsDAOHE(); String msg = "Ho so ma: " + file.getFileCode() + " cua doanh nghiep: " + file.getBusinessName() + " dang trong trang thai: da tiep nhan"; msdhe.saveMessageSMS(userId, file.getUserCreateId(), msg); MessageEmailDAOHE msedhe = new MessageEmailDAOHE(); String msge = "H s m: " + file.getFileCode() + " ca doanh nghip: " + file.getBusinessName() + " ang trong trng thi: ? tip nhn"; msedhe.saveMessageEmail(userId, file.getUserCreateId(), msge); EmailSmsDAO emdao = new EmailSmsDAO(); emdao.alertLeaderOfStaffAssignFiles(ptmp.getReceiveGroupId(), file.getFileCode(), file.getBusinessName()); // bReturn = true; } } catch (Exception ex) { bReturn = false; LogUtil.addLog(ex);//binhnt sonar a160901 } return bReturn; }
From source file:com.viettel.hqmc.DAOHE.FilesDAOHE.java
/** * hieptq update 120114/*from www. j av a 2s .c o m*/ * * @param form * @param deptId * @param deptName * @param userId * @param userName * @param lstObjectId * @return */ public boolean onReceivedMoreFile(FilesForm form, Long deptId, String deptName, Long userId, String userName, String lstObjectId) { boolean bReturn = true; boolean bCheckCount = true; String[] lstObjectIdSplit = lstObjectId.split(","); int countObj = lstObjectIdSplit.length; try {//form.setStatus(Constants.FILE_STATUS.RECEIVED); for (int i = 0; i < countObj; i++) { Long fileId = Long.parseLong(lstObjectIdSplit[i]); Files file = findById(fileId); if (file == null) { bReturn = false; } else { Long processStatus = file.getStatus(); ProcedureDepartmentDAOHE prodepdaohe = new ProcedureDepartmentDAOHE(); List lstCQXL = prodepdaohe.getAllProcedureDepartmentByProcedureId(file.getFileType()); //binhnt update 150918 if ((lstCQXL == null || lstCQXL.size() > 1) && !processStatus.equals(Constants.FILE_STATUS.NEW_TO_ADD)) { bCheckCount = false; continue; } //140404 if (processStatus.equals(Constants.FILE_STATUS.NEW_TO_ADD)) {//neu ho so la nop sdbs k tao so file.setStatus(Constants.FILE_STATUS.RECEIVED_TO_ADD); file.setDisplayStatus(getFileStatusName(Constants.FILE_STATUS.RECEIVED_TO_ADD)); } else { file.setStatus(Constants.FILE_STATUS.RECEIVED); file.setDisplayStatus(getFileStatusName(Constants.FILE_STATUS.RECEIVED)); if (file.getReceiveNo() == null || file.getReceiveNo().trim().length() == 0) { file.setReceiveNo(getNewReceiveNo(deptId)); } } file.setReceivedDate(getSysdate()); file.setStaffSigningId(userId); file.setStaffSigningName(userName); file.setSignDate(getSysdate()); //140627 UPDATE BO SUNG THOI GIAN HAN CONG BO, PHAN HOI HO SO ResourceBundle rb = ResourceBundle.getBundle("config"); Procedure procedurebo; ProcedureDAOHE procedureDAOHE = new ProcedureDAOHE(); procedurebo = procedureDAOHE.findById(file.getFileType()); int CB = 0, PH = 0; try { CB = Integer.parseInt(rb.getString(procedurebo.getDescription() + "_CB")); } catch (NumberFormatException ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } try { PH = Integer.parseInt(rb.getString(procedurebo.getDescription() + "_PH")); } catch (NumberFormatException ex) { LogUtil.addLog(ex);//binhnt sonar a160901 } if (CB > 0) { file.setDeadlineApprove(getDateWorkingTime(CB)); } if (PH > 0) { file.setDeadlineComment(getDateWorkingTime(PH)); } ProcessDAOHE psdhe = new ProcessDAOHE(); Process ptmp = psdhe.getProcessByAction(file.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, processStatus, Constants.FILE_STATUS.NEW_CREATE); if (ptmp != null) { if (processStatus.equals(Constants.FILE_STATUS.NEW_TO_ADD)) { ptmp.setStatus(Constants.FILE_STATUS.RECEIVED_TO_ADD); } else { ptmp.setStatus(Constants.FILE_STATUS.RECEIVED); } getSession().update(ptmp); } Process newP = new Process(); newP.setObjectId(fileId); newP.setObjectType(Constants.OBJECT_TYPE.FILES); newP.setProcessType(Constants.PROCESS_TYPE.MAIN); newP.setSendDate(getSysdate()); newP.setSendGroup(deptName); newP.setSendGroupId(deptId); newP.setSendUserId(userId); newP.setSendUser(userName); if (file.getStatus().equals(Constants.FILE_STATUS.RECEIVED)) { // Gui toi chinh don vi quan ly de tiep nhan newP.setReceiveDate(getSysdate()); if (form != null && form.getProcessDeptName() != null && form.getProcessDeptId() != null) { newP.setReceiveGroup(form.getProcessDeptName()); newP.setReceiveGroupId(form.getProcessDeptId()); } else if (!lstCQXL.isEmpty()) { ProcedureDepartment prodept = (ProcedureDepartment) lstCQXL.get(0); if (prodept != null && prodept.getProcessDeptId() != null && prodept.getProcessDeptName() != null) { newP.setReceiveGroup(prodept.getProcessDeptName()); newP.setReceiveGroupId(prodept.getProcessDeptId()); } } 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); } else {//neu la sdbs gui cho chuyen vien tham dinh ho so if (file.getStatus().equals(Constants.FILE_STATUS.RECEIVED_TO_ADD)) { newP.setReceiveDate(getSysdate()); //140407 ProcessDAOHE processDAOHE = new ProcessDAOHE(); Process userAction = processDAOHE.findProcessByActionEvaluate(file.getFileId()); if (userAction != null) { newP.setReceiveUser(userAction.getReceiveUser()); newP.setReceiveUserId(userAction.getReceiveUserId()); newP.setReceiveGroup(userAction.getReceiveGroup()); newP.setReceiveGroupId(userAction.getReceiveGroupId()); } 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); } if (file.getStatus().equals(Constants.FILE_STATUS.RECEIVED_REJECT)) { //tu choi tiep nhan newP.setReceiveDate(getSysdate()); ProcessDAOHE processDAOHE = new ProcessDAOHE();//140407 Process userAction = processDAOHE.getProcessByAction(file.getFileId(), Constants.Status.ACTIVE, Constants.OBJECT_TYPE.FILES, Constants.FILE_STATUS.NEW, Constants.FILE_STATUS.NEW_CREATE); 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.setProcessStatus(file.getStatus()); // De xu ly newP.setStatus(0l); // Moi den chua xu ly newP.setIsActive(1l); } // Tra lai cho doanh nghiep khong xu ly gi them } getSession().save(newP); getSession().update(file); MessageSmsDAOHE msdhe = new MessageSmsDAOHE(); String msg = "Ho so ma: " + file.getFileCode() + " cua doanh nghiep: " + file.getBusinessName() + " dang trong trang thai: da tiep nhan"; 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: ? tip nhn"; msedhe.saveMessageEmail(userId, file.getUserCreateId(), msge); //send group leader of dept 140915 binhnt53 EmailSmsDAO emdao = new EmailSmsDAO(); emdao.alertLeaderOfStaffAssignFiles(deptId, file.getFileCode(), file.getBusinessName()); bReturn = true; } } } catch (Exception ex) { bReturn = false; LogUtil.addLog(ex);//binhnt sonar a160901 } if (!bCheckCount) { return false; } return bReturn; }