Example #1
0
  @RequestMapping("enter")
  @ResponseBody
  public void enter(
      String functionId, String url, HttpSession session, HttpServletRequest request) {
    Date enterTime = (Date) session.getAttribute("enterTime");
    Date nowTime = new Date();
    String currentUrl = (String) session.getAttribute("currentUrl");
    String currentFunction = (String) session.getAttribute("currentFunction");
    String nextUrl = (String) session.getAttribute("nextUrl");
    String nextFunction = (String) session.getAttribute("nextFunction");
    if (currentUrl == null) {
      session.setAttribute("currentUrl", request.getHeader("Referer"));
    }
    session.setAttribute("previousUrl", currentUrl);
    session.setAttribute("currentUrl", nextUrl);
    session.setAttribute("nextUrl", url);

    session.setAttribute("previousFunction", currentFunction);
    session.setAttribute("currentFunction", nextFunction);
    session.setAttribute("nextFunction", functionId);

    MemberEntity principal = (MemberEntity) SecurityUtils.getSubject().getPrincipal();
    if (principal != null) {
      MemberLogEntity log = new MemberLogEntity();
      log.setMemberNo(principal.getMemberNo());
      log.setMemberName(principal.getName());
      log.setNowPage(nextUrl);
      log.setNextpage(url);
      log.setPrePage(currentUrl);

      MemberFunctionEntity function = functionService.getFunction(nextFunction);
      if (function != null) {
        log.setNowName(function.getTitle());
      }

      function = functionService.getFunction(functionId);
      if (function != null) {
        log.setNextName(function.getTitle());
      }

      function = functionService.getFunction(currentFunction);
      if (function != null) {
        log.setPreName(function.getTitle());
      }

      log.setCallTime(enterTime);
      log.setIp(getIpAddr(request));
      if (enterTime != null) {
        long waitTime = (nowTime.getTime() - enterTime.getTime()) / 1000;
        log.setWaitTime(waitTime + "");
      }
      logService.addLog(log);
    }
    session.setAttribute("enterTime", nowTime);
  }
Example #2
0
 /**
  * 左侧菜单
  *
  * @param map
  * @return
  */
 @RequestMapping("menu")
 public String ToMenu(HttpServletRequest request, ModelMap map) {
   HttpSession session = request.getSession(false);
   if (session.getAttribute("userinfo") == null) {
     return LOGIN;
   }
   SupervisorPrincipal userBean = (SupervisorPrincipal) session.getAttribute("userinfo");
   if (userBean.getMember() != null && userBean.getAccount() == null) {
     MemberTypeEnum type = userBean.getMember().getType();
     int flag = 0;
     if (MemberTypeEnum.DAWP.equals(type)) {
       flag = 1;
     } else {
       flag = 2;
     }
     List<MemberFunctionModel> list = functionService.queryFunctions(flag);
     map.put("list", list);
   } else if (userBean.getMember() != null && userBean.getAccount() != null) {
     List<MemberFunctionModel> list = roleService.getRoleFunctions(userBean.getAccount().getId());
     map.put("list", list);
   }
   if (userBean.getMember() != null) {
     Long transMessageCount =
         CometServiceImpl.getCount(
             MessageChannel.MEMBER_TRANS_MESSAGE_COUNT + userBean.getMember().getMemberNo());
     Long sysMessageCount =
         CometServiceImpl.getCount(
             MessageChannel.MEMBER_SYSTEM_MESSAGE_COUNT + userBean.getMember().getMemberNo());
     Long tenderMessageCount =
         CometServiceImpl.getCount(
             MessageChannel.MEMBER_TENDER_MESSAGE_COUNT + userBean.getMember().getMemberNo());
     Long contractMessageCount =
         CometServiceImpl.getCount(
             MessageChannel.MEMBER_CONTRACT_MESSAGE_COUNT + userBean.getMember().getMemberNo());
     Long payMessageCount =
         CometServiceImpl.getCount(
             MessageChannel.MEMBER_PAY_MESSAGE_COUNT + userBean.getMember().getMemberNo());
     if (tenderMessageCount <= 0) {
       String key =
           MessageChannel.MEMBER_TENDER_MESSAGE_COUNT + userBean.getMember().getMemberNo();
       List<String> userKeys = CometServiceImpl.get(MessageChannel.MEMBER_READTENDER_MESSAGE_KEYS);
       Long totalCount = CometServiceImpl.getCount(MessageChannel.MEMBER_TENDER_MESSAGE_COUNT);
       if (userKeys != null && userKeys.size() > 0) {
         if (!userKeys.contains(key)) {
           CometServiceImpl.setCount(key, totalCount);
           tenderMessageCount = totalCount;
         }
       } else {
         CometServiceImpl.setCount(key, totalCount);
         tenderMessageCount = totalCount;
       }
     }
     map.put("transMessageCount", transMessageCount);
     map.put("sysMessageCount", sysMessageCount);
     map.put("tenderMessageCount", tenderMessageCount);
     map.put("contractMessageCount", contractMessageCount);
     map.put("payMessageCount", payMessageCount);
   }
   return "site/menu";
 }