Exemplo n.º 1
0
  /**
   * 保存日志
   *
   * @param loginUser 登录用户
   * @param ipAddress 用户地址
   * @param logType 日志类型
   */
  public void save(SysUser loginUser, String ipAddress, String logType) {
    SysLog bean = new SysLog();

    bean.setIpAddress(ipAddress);
    bean.setLogType(sysCodeManager.getCodeListByCode(Constants.LOG_TYPE_CODE, logType));
    bean.setUser(loginUser);

    this.save(bean);
  }
Exemplo n.º 2
0
  /**
   * 记录日志
   *
   * @param username
   * @param serviceName
   * @param userIp
   * @param sessionId
   * @param logType
   */
  public void log(
      String username, String serviceName, String userIp, String sessionId, String logType) {
    SysUser user = sysUserManager.getByUsername(username);

    SysLog bean = new SysLog();

    bean.setPageUrl(serviceName);
    bean.setSessionid(sessionId);
    bean.setIpAddress(userIp);
    bean.setEnterTime(DateTimeHelper.getTimestamp());

    bean.setLogType(sysCodeManager.getCodeListByCode(Constants.LOG_TYPE_CODE, logType));
    bean.setUser(user);

    this.save(bean);
  }