@RequestMapping("saveActivity") public String saveActivity( HttpServletRequest request, HttpServletResponse response, Infomation t) { User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER); t.setType(IBSConstants.HR_NOTICE); t.setCreatedOn(new Date()); t.setCreatedBy(user.getObjectId()); t.setCompanyId(user.getCompanyId()); if (IBSConstants.USER_TYPE_COMPANY_ADMIN != user.getType()) { t.setOrganizationId(user.getOrganizationId()); } t.setTitle(t.getTitle().trim()); t.setContent(UeditorUtils.convertSpace(t.getContent())); if (IBSConstants.PLATFORM_NOTICE_ALL_USER.equals(t.getFaceMember())) { t.setFacePeople(IBSConstants.STATUS_YES); } else { t.setFacePeople(IBSConstants.STATUS_NO); } t = infomationManager.save(t); InfomationNotice delInfomationNotice = new InfomationNotice(); delInfomationNotice.setInfomationId(t.getObjectId()); infomationNoticeManager.deleteBySample(delInfomationNotice); if (IBSConstants.PLATFORM_NOTICE_ALL_USER.equals(t.getFaceMember())) { InfomationNotice infomationNotice = new InfomationNotice(); infomationNotice.setInfomationId(t.getObjectId()); infomationNotice.setAllUser(IBSConstants.PLATFORM_NOTICE_ALL_USER); infomationNotice.setCompanyId(user.getCompanyId()); infomationNoticeManager.save(infomationNotice); } else { String[] members = request.getParameterValues("userId"); for (String memberId : members) { InfomationNotice infomationNotice = new InfomationNotice(); infomationNotice.setUserId(Long.parseLong(memberId)); infomationNotice.setInfomationId(t.getObjectId()); infomationNotice.setCompanyId(user.getCompanyId()); infomationNoticeManager.save(infomationNotice); } } return "redirect:listNotice"; }
@RequestMapping("detail/{noticeId}") public String detail( HttpServletRequest request, HttpServletResponse response, @PathVariable Long noticeId) { Infomation infomation = infomationManager.getByObjectId(noticeId); User user = userManager.getUserByUserId(infomation.getCreatedBy()); infomation.setCreateUserName(user.getUserName()); request.setAttribute("infomation", infomation); InfomationNotice sample = new InfomationNotice(); sample.setInfomationId(noticeId); List<InfomationNotice> notices = infomationNoticeManager.getBySample(sample); request.setAttribute("notices", notices); return getFileBasePath() + "detail"; }
@RequestMapping("edit/{objectId}/{type}") public String saveActivity( HttpServletRequest request, HttpServletResponse response, @PathVariable Long objectId, @PathVariable Integer type) { Infomation infomation = infomationManager.getByObjectId(objectId); infomation.setTitle(infomation.getTitle().trim()); request.setAttribute("infomation", infomation); InfomationNotice sample = new InfomationNotice(); sample.setInfomationId(objectId); List<InfomationNotice> notices = infomationNoticeManager.getBySample(sample); request.setAttribute("notices", notices); if (IBSConstants.HR_ACTIVITY == type) { return getFileBasePath() + "addActivity"; } else if (IBSConstants.HR_NOTICE == type) { return getFileBasePath() + "addNotice"; } else { return "redirect:detail/" + objectId; } }