/** * repeal @Title: repeal @Description: TODO (发布) * * @param @param request * @param @param response * @param @param noticeId * @param @return 设定文件 * @return String 返回类型 * @throws */ @RequestMapping("releaseInfo/{noticeId}") public String releaseInfo( HttpServletRequest request, HttpServletResponse response, @PathVariable Long noticeId) { Infomation infomation = infomationManager.getByObjectId(noticeId); infomation.setStatus(IBSConstants.INFOMATION_PUBLISH); infomationManager.save(infomation); return "redirect:/infomation/listNotice"; }
@RequestMapping("listNotice") public String listNotice( HttpServletRequest request, HttpServletResponse response, Infomation infomation, Integer backPage) { infomationManager.updateValidateInfomation(); Long companyId = (Long) request.getSession().getAttribute(SecurityConstants.USER_COMPANY_ID); PageSearch page = PageUtils.preparePage(request, Infomation.class, true); User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER); page.getFilters() .add(new PropertyFilter(Infomation.class.getName(), "EQL_companyId", companyId.toString())); if (IBSConstants.USER_TYPE_COMPANY_HR == user.getType()) { page.getFilters() .add( new PropertyFilter( Infomation.class.getName(), "EQL_createdBy", user.getObjectId().toString())); } String cp = request.getParameter("c_p"); Integer currPage = 1; if (cp != null && !("").equals(cp)) { currPage = Integer.parseInt(cp); } page.setSortOrder("asc"); page.setSortProperty("createdOn"); page.setCurrentPage(currPage); handleFind(page); List<Infomation> items = page.getList(); request.setAttribute("items", items); request.setAttribute("pageInfomation", page); return "info/listNotice"; }
protected void handleFind(PageSearch page) { page.getFilters() .add( new PropertyFilter( Infomation.class.getName(), "EQI_deleted", ForeverEntity.DELETED_NO + "")); PageSearch result = infomationManager.findList(page); page.setTotalCount(result.getTotalCount()); page.setList(result.getList()); }
@RequestMapping("delBatch") @ResponseBody public String delete(HttpServletRequest request, HttpServletResponse response) { String noticeIds = request.getParameter("noticeIds"); noticeIds = noticeIds.substring(0, noticeIds.length() - 1); String[] noticeid = noticeIds.split(","); int count = 0; for (int i = 0; i < noticeid.length; i++) { Long objectid = Long.parseLong(noticeid[i]); Infomation infomation = infomationManager.getByObjectId(objectid); if (infomation != null) { if (infomation.getStatus() != 1) { continue; } infomationManager.delete(objectid); count = count + 1; } else { continue; } } return String.valueOf(count); }
@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; } }
@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("delete/{noticeId}") public String delete( HttpServletRequest request, HttpServletResponse response, @PathVariable Long noticeId) { infomationManager.delete(noticeId); return "redirect:/infomation/listNotice"; }