@HandlesEvent(value = "approveResult") @Secure(roles = Roles.EMPLOYMENT_REQUEST_EDIT) public Resolution approveResult() { try { String targetId = context.getRequest().getParameter("targetId"); EmployeeRequest er = empBean.getEmpRequestById(targetId); String approveStatus = context.getRequest().getParameter("approveStatus"); if (approveStatus.equals("N")) er.setApproveResult(ApplicationConstants.APPROVE_FAIL); else if (approveStatus.equals("C")) er.setApproveResult(ApplicationConstants.APPROVE_CONSIDER); else if (approveStatus.equals("Y")) er.setApproveResult(ApplicationConstants.APPROVE_SUCCESS); else er.setApproveResult(ApplicationConstants.APPROVE_UNKNOW); empBean.mergeEmpRequest(er); return new StreamingResolution("text/charset=utf8;", "修改成功"); } catch (Exception e) { e.printStackTrace(); return context.errorResolutionAjax("修改出错", "" + e.getMessage()); } }
@HandlesEvent(value = "updateRequest") @Secure(roles = Roles.EMPLOYMENT_REQUEST_EDIT) public Resolution updateRequest() { try { String updateEvent = context.getRequest().getParameter("update"); String targetId = context.getRequest().getParameter("targetId"); String value = context.getRequest().getParameter("value"); String dateval = context.getRequest().getParameter("dateval"); EmployeeRequest er = empBean.getEmpRequestById(targetId); if (updateEvent.equals(COMMIT_NUM)) er.setCommitNumber(Integer.parseInt(value)); else if (updateEvent.equals(APPROVE_DATE) && dateval != null) er.setApproveDate(HRUtil.parseDate(dateval, "yyyy-MM-dd")); else if (updateEvent.equals(SEND_APPROVE_DATE) && dateval != null) er.setSendApproveDate(HRUtil.parseDate(dateval, "yyyy-MM-dd")); empBean.mergeEmpRequest(er); return new StreamingResolution("text/charset=utf8", "修改成功"); } catch (Exception e) { // e.printStackTrace(); return new StreamingResolution("text/charset=utf8", "修改失败." + e.getMessage()); } }