@Override public void sessionDestroyed(HttpSessionEvent se) { try { String sessionId = se.getSession().getId(); logger.debug("session destroyed! sessionId = " + sessionId); sessionMap.remove(sessionId); ServiceLocator.getOnlineUserService().deleteOnlineUserBySessionId(sessionId); } catch (Exception ex) { logger.error(ex.getMessage(), ex); } }
@RequestMapping("/viewMenu.do") public String viewMenuAction() { List<Menu> topMenu = new ArrayList<Menu>(); Map<Menu, List<Menu>> childMenus = new HashMap<Menu, List<Menu>>(); String isBoss = (String) this.getSession().getAttribute(Constants.SESSION_CURRENT_USER_IS_BOS); if ("1".equals(isBoss)) { List<Menu> menuList = ServiceLocator.getMenuService().getMenusByScope(ADEConstants.SUBSYSTEM_DEFINITION_ADE); for (Menu menu : menuList) { if (menu.getParentMenu() == null) { topMenu.add(menu); } else { if (childMenus.get(menu.getParentMenu()) != null) { childMenus.get(menu.getParentMenu()).add(menu); } else { List<Menu> childs = new ArrayList<Menu>(); childs.add(menu); childMenus.put(menu.getParentMenu(), childs); } } } } else { List<Role> roleList = (List<Role>) this.getSession().getAttribute(ADEConstants.ADE_SESSION_CURRENT_ROLE); for (Role role : roleList) { if (role != null) { List<Menu> menuList = role.getMenus(); for (Menu menu : menuList) { if (menu.getParentMenu() == null) { topMenu.add(menu); } else { if (childMenus.get(menu.getParentMenu()) != null) { childMenus.get(menu.getParentMenu()).add(menu); } else { List<Menu> childs = new ArrayList<Menu>(); childs.add(menu); childMenus.put(menu.getParentMenu(), childs); } } } } } } this.getRequest().setAttribute("topMenu", topMenu); this.getRequest().setAttribute("childMenus", childMenus); return ADEConstants.ADE_JSP_ROOT + "common/menu"; }
/** * 公告详细信息 * * @param dto * @return */ @RequestMapping("/agency/viewNotice.do") public String viewNotice(SystemDto dto) { Notice notice = service.getNotice(dto.getId()); if (!service.isReadNotice(SpringHelper.getCurrentUser(), notice)) { NoticeReadNote readn = new NoticeReadNote(); readn.setNotice(notice); readn.setReaderId(SpringHelper.getCurrentUser().getId()); readn.setReaderName(SpringHelper.getCurrentUser().getUserName()); readn.setReadTime(new Date()); service.saveNoticeReadNote(readn); } long count = ServiceLocator.getNoticeService().getUnreadCount(SpringHelper.getCurrentUser()); this.getSession().setAttribute(Constants.REQUEST_MESSAGELINK, count); this.getRequest().setAttribute("notice", notice); return COMPANY_PRE_JSP_PATH + "noticeInfo"; }
@RequestMapping("/index.do") public String index() { Company company = SpringHelper.getCurrentCompany(); if (company == null) { throw new ADEException("只有公司身份才能使用考勤系统!"); } User user = ServiceLocator.getUserService().getUser(SpringHelper.getCurrentUser().getId()); Hibernate.initialize(user.getPrincipleDepts()); this.getSession().setAttribute(Constants.SESSION_CURRENT_USER, user); List<Role> roleList = user.getAllRole(ADEConstants.SUBSYSTEM_DEFINITION_ADE); this.getSession().setAttribute(ADEConstants.ADE_SESSION_ROLELIST, roleList); this.getSession().setAttribute("subsystem", ADEConstants.SUBSYSTEM_DEFINITION_ADE); // viewMenuAction(); // return ADEConstants.ADE_JSP_ROOT + "index"; return "forward:/" + ADEConstants.SUBSYSTEM_DEFINITION_ADE + "/listClazzes.do"; }
// 已拨电话清单 @RequestMapping("/agent/listCallHis.do") public String listCallHisAction(AgentCallHisDto dto) { // Agent agent = Struts2Helper.getCurrentAgent(); // if (agent != null) { // dto.setAgentId(agent.getId()); // } Company c = SpringHelper.getCurrentCompany(); if (c != null) { dto.setCompanyId(c.getId()); } User user = SpringHelper.getCurrentUser(); List<User> list = null; if (StringUtils.isEmpty(dto.getDeptId())) { list = CRMHelper.getAccessAgentUsers(user, CRMHelper.isCurrentUserManager()); // 有部门 } else { Dept dept = ServiceLocator.getDeptService().getDept(dto.getDeptId()); list = dept.getAvailableUsers(); } if (StringUtils.isEmpty(dto.getProcessor())) { if (list.size() > 1) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < list.size(); i++) { sb.append("'").append(list.get(i).getId()).append("',"); } dto.setProcessor(sb.substring(0, sb.length() - 1)); } else { dto.setProcessor(user.getId()); } } this.getRequest() .setAttribute("isManager", securityService.hasRole(Role.ROLE_CODE_CRM_MANAGER)); this.getRequest().setAttribute("userlist", list); Pagination pagination = service.queryPage(dto); this.getRequest().setAttribute("pagination", pagination); this.getRequest().setAttribute("dto", dto); return CRMConstants.CRM_JSP_ROOT + "call/callList"; }