diff --git a/src/main/java/com/nis/domain/dashboard/NtcRadiusReport.java b/src/main/java/com/nis/domain/dashboard/NtcRadiusReport.java index cb836f0b7..067344c5f 100644 --- a/src/main/java/com/nis/domain/dashboard/NtcRadiusReport.java +++ b/src/main/java/com/nis/domain/dashboard/NtcRadiusReport.java @@ -1,14 +1,20 @@ package com.nis.domain.dashboard; +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlTransient; + import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.google.gson.annotations.SerializedName; +import com.nis.domain.Page; import com.nis.util.excel.ExcelField; import com.wordnik.swagger.annotations.ApiModelProperty; -public class NtcRadiusReport { +public class NtcRadiusReport implements Serializable { + private static final long serialVersionUID = -1434148698159286062L; // @JsonInclude(value = Include.NON_NULL) // @ApiModelProperty(value = "接入IP", required = true) @ExcelField(title = "ip_address_control", sort = 2) @@ -40,6 +46,8 @@ public class NtcRadiusReport { protected String searchNasIp; protected String searchAccount; protected String groupType; + + protected Page page; public String getNasIp() { return nasIp; @@ -146,5 +154,17 @@ public class NtcRadiusReport { public void setGroupType(String groupType) { this.groupType = groupType; } + @JsonIgnore + @XmlTransient + public Page getPage() { + if (page == null) { + page = new Page(); + } + return page; + } + public Page setPage(Page page) { + this.page = page; + return page; + } } diff --git a/src/main/java/com/nis/domain/dashboard/PageDashboard.java b/src/main/java/com/nis/domain/dashboard/PageDashboard.java new file mode 100644 index 000000000..e897d4875 --- /dev/null +++ b/src/main/java/com/nis/domain/dashboard/PageDashboard.java @@ -0,0 +1,637 @@ +/** + * Copyright © 2012-2014 JeeSite All rights reserved. + */ +package com.nis.domain.dashboard; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.servlet.support.RequestContext; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.nis.util.Configurations; +import com.nis.util.Constants; +import com.nis.util.CookieUtil; + +/** + * 分页类 + * @author ThinkGem + * @version 2013-7-2 + * @param + */ +public class PageDashboard { + + private int pageNo = 1; // 当前页码 + private int pageSize = Integer.valueOf(Configurations.getIntProperty("page.pageSize", 30)); // 页面大小,设置为“-1”表示不进行分页(分页无效) + + private long count;// 总记录数,设置为“-1”表示不查询总数 + private int first;// 首页索引 +// private int last;// 尾页索引 + private int prev;// 上一页索引 + private int next;// 下一页索引 + + + private boolean firstPage;//是否是第一页 + private boolean lastPage;//是否是最后一页 + +// private int length = 8;// 显示页面长度 +// private int slider = 1;// 前后显示页面长度 + + private List list = new ArrayList(); + + private String orderBy = ""; // 标准查询有效, 实例: updatedate desc, name asc + + private String fields;//制定资源的字段 + + private String where; + private String alias; + private String funcName = "page"; // 设置点击页码调用的js函数名称,默认为page,在一页有多个分页对象时使用。 + + private String funcParam = ""; // 函数的附加参数,第三个参数值。 + + private String message = ""; // 设置提示消息,显示在“共n条”之后 + + private RequestContext requestContext; + + private int maxExportSize=Constants.MAX_EXPORT_SIZE; + + public PageDashboard() { + this.pageSize = -1; + } + + /** + * 构造方法 + * @param request 传递 repage 参数,来记住页码 + * @param response 用于设置 Cookie,记住页码 + */ + public PageDashboard(HttpServletRequest request, HttpServletResponse response){ + this(request, response, Integer.valueOf(Configurations.getIntProperty("page.pageSize", 30))); + } + public PageDashboard(HttpServletRequest request, HttpServletResponse response,String alias){ + + this(request, response, Integer.valueOf(Configurations.getIntProperty("page.pageSize", 30)),alias); + } + + public PageDashboard(HttpServletRequest request, HttpServletResponse response, int defaultPageSize,String alias){ + this.setAlias(alias); + this.initPage(request, response, defaultPageSize); + } + public PageDashboard(HttpServletRequest request, HttpServletResponse response, int defaultPageSize){ + this.initPage(request, response, defaultPageSize); + } + private void initPage(HttpServletRequest request, HttpServletResponse response, int defaultPageSize){ + try { + + this.requestContext = new RequestContext(request); + + // 设置页码参数(传递repage参数,来记住页码) + String no = request.getParameter("pageNo"); + if (StringUtils.isNotBlank(no)) { + if (StringUtils.isNumeric(no)){ + CookieUtil.addCookie(response, "pageNo", no); + this.setPageNo(Integer.parseInt(no)); + }else if (request.getParameter("repage")!=null){ + no = CookieUtil.getValue(request, "pageNo"); + if (StringUtils.isNumeric(no)){ + this.setPageNo(Integer.parseInt(no)); + } + } + } + + // 设置页面大小参数(传递repage参数,来记住页码大小) + String size = ""; + if(defaultPageSize==-1){ + size = "-1"; + }else{ + size = request.getParameter("pageSize"); + + } + if (StringUtils.isNotBlank(size)) { + + if (StringUtils.isNumeric(size) || size.equals("-1")){ + CookieUtil.addCookie(response, "pageSize", size); + this.setPageSize(Integer.parseInt(size)); + } else if (request.getParameter("repage")!=null){ + size = CookieUtil.getValue(request, "pageSize"); + if (StringUtils.isNumeric(size)){ + this.setPageSize(Integer.parseInt(size)); + } + } + } else { + this.pageSize = defaultPageSize; + } + + String fields = request.getParameter("fields"); + if (StringUtils.isNotBlank(fields)){ + this.setFields(fields); + } + + // 设置排序参数 + String orderBy = request.getParameter("orderBy"); + if (StringUtils.isNotBlank(orderBy)){ + this.setOrderBy(orderBy); + } + + this.setWhere(getWhere(request)); + + + } catch (Exception e) { + e.printStackTrace(); + } + } + /** + * + * @Title: getWhere + * @Description: TODO(抽取where查询条件) + * @param @param request + * @param @return 入参 + * @return String 返回类型 + * @author (darnell) + * @throws + * @date 2016年8月17日 上午9:28:21 + * @version V1.0 + * wx:日期格式的数据用日期格式化函数格式化,带空格的数据加上引号 + */ + private String getWhere(HttpServletRequest request) { + String format=Constants.SEARCH_DATEFORMAT; + SimpleDateFormat sdf=new SimpleDateFormat(format); + Map requestMap = request.getParameterMap(); + StringBuilder whereBuilder = new StringBuilder(512); + for(String paramName : request.getParameterMap().keySet()) { + if (requestMap.get(paramName)!=null&¶mName.startsWith("search_")&&StringUtils.isNotBlank(requestMap.get(paramName)[0])) { + String clomn=paramName.substring("search_".length()); + String value=requestMap.get(paramName)[0].trim(); + boolean isDate=false; + try { + sdf.parse(value); + isDate=true; + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if(clomn.endsWith("_start")){ + clomn=clomn.substring(0,clomn.lastIndexOf("_start")); + if(StringUtils.isNotBlank(alias)) whereBuilder.append(alias.trim()+"."); + whereBuilder.append(clomn).append(">="); + if(isDate){ + whereBuilder.append("date_format('") + .append(value).append("','%Y-%m-%d %H:%i:%S')"); + }else if(value.indexOf(" ")>-1){ + whereBuilder.append("'").append(requestMap.get(paramName)[0]).append("'"); + }else{ + whereBuilder.append(requestMap.get(paramName)[0]); + } + whereBuilder.append(" and "); + }else if(clomn.endsWith("_end")){ + clomn=clomn.substring(0,clomn.lastIndexOf("_end")); + if(StringUtils.isNotBlank(alias)) whereBuilder.append(alias.trim()+"."); + whereBuilder.append(clomn).append("<="); + if(isDate){ + whereBuilder.append("DATE_FORMAT('") + .append(value).append("','%Y-%m-%d %H:%i:%S')"); + }else if(value.indexOf(" ")>-1){ + whereBuilder.append("'").append(requestMap.get(paramName)[0]).append("'"); + }else{ + whereBuilder.append(requestMap.get(paramName)[0]); + } + whereBuilder.append(" and "); + }else{ + if(StringUtils.isNotBlank(alias)) whereBuilder.append(alias.trim()+"."); + whereBuilder.append(clomn).append("="); + if(isDate){ + whereBuilder.append("date_format('") + .append(value).append("','%Y-%m-%d %H:%i:%S')"); + }else if(value.indexOf(" ")>-1){ + whereBuilder.append("'").append(requestMap.get(paramName)[0]).append("'"); + }else{ + whereBuilder.append(requestMap.get(paramName)[0]); + } + whereBuilder.append(" and "); + } + + } + } + if (whereBuilder.length() > 0) { + whereBuilder.delete(whereBuilder.lastIndexOf(" and "), whereBuilder.length()); + } + return whereBuilder.toString(); + } + + + /** + * 构造方法 + * @param pageNo 当前页码 + * @param pageSize 分页大小 + */ + public PageDashboard(int pageNo, int pageSize) { + this(pageNo, pageSize, 0); + } + + /** + * 构造方法 + * @param pageNo 当前页码 + * @param pageSize 分页大小 + * @param count 数据条数 + */ + public PageDashboard(int pageNo, int pageSize, long count) { + this(pageNo, pageSize, count, new ArrayList()); + } + + /** + * 构造方法 + * @param pageNo 当前页码 + * @param pageSize 分页大小 + * @param count 数据条数 + * @param list 本页数据对象列表 + */ + public PageDashboard(int pageNo, int pageSize, long count, List list) { + this.setCount(count); + this.setPageNo(pageNo); + this.pageSize = pageSize; + this.list = list; + } + + /** + * 初始化参数 + */ + public void initialize(){ + + //1 + this.first = 1; + + //首页 + if (this.pageNo <= 1) { + this.pageNo = this.first; + this.firstPage=true; + } + + //最后一页 + if(list.size()= this.pageSize) { + this.next = this.pageNo + 1; + } +// 上一页 + if (pageNo > 1) { + this.prev = this.pageNo - 1; + } else { + this.prev = this.first; + } + + //2 + if (this.pageNo < this.first) {// 如果当前页小于首页 + this.pageNo = this.first; + } + + + } + + /** + * 默认输出当前分页标签 + *
${page}
+ */ + @Override + public String toString() { + + + if(list != null && list.isEmpty()&&pageNo<=1) { + return "
  "+requestContext.getMessage("noneData")+"
"; + } + + + StringBuilder sb = new StringBuilder(); + + sb.append("
  • "+requestContext.getMessage("firstPage")+"
  • \n"); + if (pageNo == first) {// 如果是首页 + sb.append("
  • « "+requestContext.getMessage("previousPage")+"
  • \n"); + } else { + sb.append("
  • « "+requestContext.getMessage("previousPage")+"
  • \n"); + } + + sb.append("
  • "+pageNo+"
  • \n"); + +// 最后一页 未铺满 集合不为空 + if (list != null && !list.isEmpty()&&list.size()"+requestContext.getMessage("nextPage")+" »\n"); + }else if(pageNo>1&&list.isEmpty()){ + sb.append("
  • "+requestContext.getMessage("nextPage")+" »
  • \n"); + }else { + sb.append("
  • " + + ""+requestContext.getMessage("nextPage")+" »
  • \n"); + } + + + sb.insert(0,"
      \n").append("
    \n"); + + sb.append("
    "); + + return sb.toString(); + } + + /** + * 获取分页HTML代码 + * @return + */ + @JsonIgnore + public String getHtml(){ + return toString(); + } + + + /** + * 获取设置总数 + * @return + */ + public long getCount() { + return count; + } + + /** + * 设置数据总数 + * @param count + */ + public void setCount(long count) { + this.count = count; + if (pageSize >= count){ + pageNo = 1; + } + } + + /** + * 获取当前页码 + * @return + */ + public int getPageNo() { + return pageNo; + } + + /** + * 设置当前页码 + * @param pageNo + */ + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + + /** + * 获取页面大小 + * @return + */ + public int getPageSize() { + return pageSize; + } + + /** + * 设置页面大小(最大500) + * @param pageSize + */ + public void setPageSize(int pageSize) { + if (pageSize == -1 || pageSize > 0 ) { + this.pageSize = pageSize; + } else { + this.pageSize = Integer.valueOf(Configurations.getIntProperty("page.pageSize", 30)); + } + } + + /** + * 首页索引 + * @return + */ + @JsonIgnore + public int getFirst() { + return first; + } + + + /** + * 是否为第一页 + * @return + */ + @JsonIgnore + public boolean isFirstPage() { + return firstPage; + } + + /** + * 是否为最后一页 + * @return + */ + @JsonIgnore + public boolean isLastPage() { + return lastPage; + } + + + /** + * @return where + */ + @JsonIgnore + public String getWhere() { + return where; + } + + /** + * @param where 要设置的 where + */ + public void setWhere(String where) { + this.where = where; + } + + /** + * 上一页索引值 + * @return + */ + @JsonIgnore + public int getPrev() { + if (isFirstPage()) { + return pageNo; + } else { + return pageNo - 1; + } + } + + /** + * 下一页索引值 + * @return + */ + @JsonIgnore + public int getNext() { + if (isLastPage()) { + return pageNo; + } else { + return pageNo + 1; + } + } + + /** + * 获取本页数据对象列表 + * @return List + */ + public List getList() { + return list; + } + + /** + * 设置本页数据对象列表 + * @param list + */ + public PageDashboard setList(List list) { + this.list = list; + initialize(); + return this; + } + + /** + * 获取查询排序字符串 + * @return + */ + @JsonIgnore + public String getOrderBy() { + // SQL过滤,防止注入 + String reg = "(?:')|(?:--)|(/\\*(?:.|[\\n\\r])*?\\*/)|" + + "(\\b(select|update|and|or|delete|insert|trancate|char|into|substr|ascii|declare|exec|count|master|into|drop|execute)\\b)"; + Pattern sqlPattern = Pattern.compile(reg, Pattern.CASE_INSENSITIVE); + if (sqlPattern.matcher(orderBy).find()) { + return ""; + } + return orderBy; + } + + /** + * 设置查询排序,标准查询有效, 实例: updatedate desc, name asc + */ + public void setOrderBy(String orderBy) { + this.orderBy = orderBy; + } + + + + /** + * @return fields 字段属性查询,拼接用,分隔 + */ + @JsonIgnore + public String getFields() { + return fields; + } + + /** + * @param fields 要设置的 fields + */ + public void setFields(String fields) { + this.fields = fields; + } + + /** + * 获取点击页码调用的js函数名称 + * function ${page.funcName}(pageNo){location="${ctx}/list-${category.id}${urlSuffix}?pageNo="+i;} + * @return + */ + @JsonIgnore + public String getFuncName() { + return funcName; + } + + /** + * 设置点击页码调用的js函数名称,默认为page,在一页有多个分页对象时使用。 + * @param funcName 默认为page + */ + public void setFuncName(String funcName) { + this.funcName = funcName; + } + + /** + * 获取分页函数的附加参数 + * @return + */ + @JsonIgnore + public String getFuncParam() { + return funcParam; + } + @JsonIgnore + public int getMaxExportSize() { + return maxExportSize; + } + public void setMaxExportSize(int maxExportSize) { + this.maxExportSize = maxExportSize; + } + /** + * 设置分页函数的附加参数 + * @return + */ + public void setFuncParam(String funcParam) { + this.funcParam = funcParam; + } + + /** + * 设置提示消息,显示在“共n条”之后 + * @param message + */ + public void setMessage(String message) { + this.message = message; + } + + /** + * 分页是否有效 + * @return this.pageSize==-1 + */ + @JsonIgnore + public boolean isDisabled() { + return this.pageSize==-1; + } + + /** + * 是否进行总数统计 + * @return this.count==-1 + */ + @JsonIgnore + public boolean isNotCount() { + return this.count==-1; + } + + /** + * 获取 Hibernate FirstResult + */ + @JsonIgnore + public int getFirstResult(){ + int firstResult = (getPageNo() - 1) * getPageSize(); + if (firstResult >= getCount()) { + firstResult = 0; + } + return firstResult; + } + /** + * 获取 Hibernate MaxResults + */ + @JsonIgnore + public int getMaxResults(){ + return getPageSize(); + } + + /** + * alias + * @return alias + */ + + public String getAlias() { + return alias; + } + + /** + * @param alias the alias to set + */ + public void setAlias(String alias) { + this.alias = alias; + } + +} diff --git a/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsReportController.java b/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsReportController.java index affcc53fd..8593cc1be 100644 --- a/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsReportController.java +++ b/src/main/java/com/nis/web/controller/dashboard/TrafficStatisticsReportController.java @@ -6,16 +6,13 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Properties; -import java.util.Random; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; @@ -28,22 +25,17 @@ import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.nis.domain.Page; import com.nis.domain.PageLog; -import com.nis.domain.SysUser; import com.nis.domain.dashboard.NtcRadiusReport; -import com.nis.domain.log.BaseLogEntity; +import com.nis.domain.dashboard.PageDashboard; import com.nis.domain.maat.LogRecvData; -import com.nis.domain.report.NtcAsnRecord; -import com.nis.domain.report.NtcIpRangeReport; -import com.nis.util.Configurations; import com.nis.util.Constants; import com.nis.util.DateUtils; import com.nis.util.StringUtil; import com.nis.util.httpclient.HttpClientUtil; import com.nis.web.controller.BaseController; -import com.nis.web.security.UserUtils; import net.sf.json.JSONObject; - +@SuppressWarnings("all") @Controller @RequestMapping("${adminPath}/traffic") public class TrafficStatisticsReportController extends BaseController { @@ -64,6 +56,13 @@ public class TrafficStatisticsReportController extends BaseController { Map userJsonList = new HashMap(); Map ipJsonList = new HashMap(); String searchBusinessType = bean.getSearchBusinessType(); + + + PageDashboard page=new PageDashboard(request, response); + int pageSize = page.getPageSize(); + int pageNo = page.getPageNo(); + + if ("2".endsWith(searchBusinessType)) { model.addAttribute("searchBusinessType", 2);// 用户查询 } @@ -77,6 +76,7 @@ public class TrafficStatisticsReportController extends BaseController { String nasIp = bean.getNasIp(); String destUrl = url + "?searchBusinessType=1"; String userUrl = url + "?searchBusinessType=2"; + userUrl+="&pageSize="+pageSize+"&pageNo="+pageNo; String ipUrl = url + "?searchBusinessType=3"; List list = new ArrayList(); List userList = new ArrayList(); @@ -110,7 +110,7 @@ public class TrafficStatisticsReportController extends BaseController { } model.addAttribute("nowTime", DateUtils.getDateTime()); // 用户及IP数据 - String string = HttpClientUtil.get(destUrl); + /*String string = HttpClientUtil.get(destUrl); Gson gson = new GsonBuilder().create(); fromJsonList = gson.fromJson(string, new TypeToken() { }.getType()); @@ -142,8 +142,8 @@ public class TrafficStatisticsReportController extends BaseController { System.out.println( "-------------------:" + nasIpList.size() + "+++" + accountList.size() + "=================="); model.addAttribute("nasIpList", nasIpList); - model.addAttribute("accountList", accountList); - if (StringUtil.isBlank(account) && accountList != null && accountList.size() > 0 + model.addAttribute("accountList", accountList);*/ +/* if (StringUtil.isBlank(account) && accountList != null && accountList.size() > 0 && !"3".equals(searchBusinessType)) { Map accountMap = (Map) accountList.get(0); String firstAccount = ""; @@ -175,26 +175,29 @@ public class TrafficStatisticsReportController extends BaseController { model.addAttribute("ipList", ipList); model.addAttribute("searchNasIp", firstIp); - } + }*/ if ("2".endsWith(searchBusinessType) && !StringUtil.isBlank(account)) { String userString = HttpClientUtil.get(userUrl + "&searchAccount=" + account); // 指定用户 查询 Gson usergson = new GsonBuilder().create(); - userJsonList = usergson.fromJson(userString, new TypeToken() { - }.getType()); - userList = (ArrayList) userJsonList.get("data"); - model.addAttribute("userList", userList); +// userJsonList = usergson.fromJson(userString, new TypeToken() {}.getType()); + LogRecvData fromJson = usergson.fromJson(userString, new TypeToken>(){}.getType()); + page.setList(fromJson.getData().getList()); + List list2 = page.getList(); + model.addAttribute("userList", list2); + model.addAttribute("page", page); model.addAttribute("searchAccount", account); } if ("3".endsWith(searchBusinessType) && !StringUtil.isBlank(nasIp)) { String ipString = HttpClientUtil.get(ipUrl + "&searchNasIp=" + nasIp); // 指定IP查询 Gson ipgson = new GsonBuilder().create(); - ipJsonList = ipgson.fromJson(ipString, new TypeToken() { - }.getType()); - ipList = (ArrayList) ipJsonList.get("data"); - model.addAttribute("ipList", ipList); + LogRecvData fromJson = ipgson.fromJson(ipString, new TypeToken>(){}.getType()); + page.setList(fromJson.getData().getList()); + List list3 = page.getList(); + model.addAttribute("ipList", list3); + model.addAttribute("page", page); model.addAttribute("searchNasIp", nasIp); } } catch (Exception e) { @@ -203,6 +206,86 @@ public class TrafficStatisticsReportController extends BaseController { } return "/dashboard/trafficUserBehavior"; } + /** + * 用户行为查询2 + * + * @param bean + * @param model + * @param request + * @param response + * @return + */ + @RequestMapping("getUserBehaviorList") + public String getUserBehaviorList(@ModelAttribute("log")NtcRadiusReport bean, Model model, HttpServletRequest request, + HttpServletResponse response, RedirectAttributes redirectAttributes) { + Map fromJsonList = new HashMap(); + Map userJsonList = new HashMap(); + Map ipJsonList = new HashMap(); + String searchBusinessType = bean.getSearchBusinessType(); + + + PageDashboard page=new PageDashboard(request, response); + int pageSize = page.getPageSize(); + int pageNo = page.getPageNo(); + String url = Constants.DASHBOARD_URL + Constants.NTC_RADIUS_REPORT; + String statTime = bean.getSearchFoundStartTime(); + String endTime = bean.getSearchFoundEndTime(); + String account = bean.getAccount(); + String nasIp = bean.getNasIp(); + String userUrl = url + "?searchBusinessType=2"; + userUrl+="&pageSize="+pageSize+"&pageNo="+pageNo; + String ipUrl = url + "?searchBusinessType=3"; + ipUrl+="&pageSize="+pageSize+"&pageNo="+pageNo; + try { + if (StringUtil.isBlank(statTime) && StringUtil.isBlank(endTime)) { + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());// 获取到完整的时间 + cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1); + statTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime()); + bean.setSearchFoundStartTime(statTime); + bean.setSearchFoundEndTime(endTime); + statTime = URLEncoder.encode(statTime, "UTF-8"); + endTime = URLEncoder.encode(endTime, "UTF-8"); + String paramUrl = "&searchReportStartTime=" + statTime + "&searchReportEndTime=" + endTime; + userUrl = userUrl + paramUrl; + ipUrl = ipUrl + paramUrl; + } else { + statTime = URLEncoder.encode(statTime, "UTF-8"); + endTime = URLEncoder.encode(endTime, "UTF-8"); + String paramUrl = "&searchReportStartTime=" + statTime + "&searchReportEndTime=" + endTime; + userUrl = userUrl + paramUrl; + ipUrl = ipUrl + paramUrl; + } + if ("2".endsWith(searchBusinessType) && !StringUtil.isBlank(account)) { + + String userString = HttpClientUtil.get(userUrl + "&searchAccount=" + account); + // 指定用户 查询 + Gson usergson = new GsonBuilder().create(); + LogRecvData fromJson = usergson.fromJson(userString, new TypeToken>(){}.getType()); + page.setList(fromJson.getData().getList()); + model.addAttribute("page", page); + model.addAttribute("searchAccount", account); + model.addAttribute("searchBusinessType", 2);// 用户查询 + return "/dashboard/trafficNasIpList"; + } + if ("3".endsWith(searchBusinessType) && !StringUtil.isBlank(nasIp)) { + String ipString = HttpClientUtil.get(ipUrl + "&searchNasIp=" + nasIp); + // 指定IP查询 + Gson ipgson = new GsonBuilder().create(); + LogRecvData fromJson = ipgson.fromJson(ipString, new TypeToken>(){}.getType()); + page.setList(fromJson.getData().getList()); + model.addAttribute("page", page); + model.addAttribute("searchNasIp", nasIp); + model.addAttribute("searchBusinessType", 3);// ip查询 + return "/dashboard/trafficUserList"; + } + } catch (Exception e) { + e.printStackTrace(); + addMessage(redirectAttributes, "error", "request_service_failed"); + } + return null; + } // 用户行为导出 @RequestMapping(value = "userBehaviorExport") diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficNasIpList.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficNasIpList.jsp new file mode 100644 index 000000000..872ed5bf6 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficNasIpList.jsp @@ -0,0 +1,133 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + +<spring:message code="framed_ip"></spring:message> + + + + +
    +

    + ${searchAccount } +

    + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + +
    ${it.nasIp}${it.reportTime}
    +
    ${page}
    +
    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/dashboard/trafficUserBehavior.jsp b/src/main/webapp/WEB-INF/views/dashboard/trafficUserBehavior.jsp index ded2b39c9..b207a3362 100644 --- a/src/main/webapp/WEB-INF/views/dashboard/trafficUserBehavior.jsp +++ b/src/main/webapp/WEB-INF/views/dashboard/trafficUserBehavior.jsp @@ -5,9 +5,10 @@ + <spring:message code="traffic_user_behavior"></spring:message> +<spring:message code="traffic_user_behavior"></spring:message> + + + + +
    +

    + ${searchNasIp } +

    + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + +
    ${it.account}${it.reportTime}
    +
    ${page}
    +
    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/src/main/webapp/static/global/css/layout.css b/src/main/webapp/static/global/css/layout.css index 1c32bf20c..6830b550d 100644 --- a/src/main/webapp/static/global/css/layout.css +++ b/src/main/webapp/static/global/css/layout.css @@ -25,21 +25,21 @@ a:hover,a:focus{outline:none;text-decoration: none;} .about .about-body .about-title h1{ font-size:30px; color: #666; } .about .about-body .about-title .help-block{ color: #cbcbcb; font-size: 20px;} -.about .about-body .about-content{ position: relative; color: #666;line-height: 180%; font-size: 16px; padding-bottom: 200px;} +.about .about-body .about-content{ position: relative; color: #666;line-height: 180%; font-size: 16px; padding-bottom: 0px;} .about .about-body .tree-bg{ background: url('../img/about_tree_bg.png') no-repeat right bottom;} .about .about-body .about-content p{ color: #666; text-indent: 2em; line-height: 180%; font-size: 16px;} /** * 发展历程 */ -.process-timeline{ height: 387px; width: 98%; position: relative; overflow:hidden;margin-right: 25px} -.process-timeline:after{content:"";position:absolute;top:48%;left:0;margin-left:0; overflow:hidden;background:url('../img/development_timeline.png') repeat-x; height:15px; width:98%; display:block} +.process-timeline{ height: 200px; width: 98%; position: relative; overflow:hidden;margin-right: 25px} +.process-timeline:after{content:"";position:absolute;top:45%;left:0;margin-left:0; overflow:hidden;background:url('../img/development_timeline.png') repeat-x; height:15px; width:98%; display:block} .process-timeline .process-body{ position: relative; height: 100%; margin-left: 0; overflow:hidden;} -.process-timeline .process-row{ cursor:move; display: inline-block; width: 150px; float: left; margin-top: 30px; position: relative; height: 300px;overflow:hidden;} -.process-timeline .process-row .process-time{ position: absolute; top: 48.7%; left: 10%; -wekit-top:48.8%;} +.process-timeline .process-row{ cursor:move; display: inline-block; width: 150px; float: left; margin-top: 0px; position: relative; height: 192px;overflow:hidden;} +.process-timeline .process-row .process-time{ position: absolute; top: 45.7%; left: 10%; -wekit-top:48.8%;} .process-timeline .process-row .process-time .time-con{ position: relative; text-align: center; } .process-timeline .process-row .process-time .time-con .pic{position: absolute; } .process-timeline .process-row .process-time .time-con .pic i{ font-size: 100px; color: #666; } -.process-timeline .process-row .process-time .time-con .year{ position: absolute; font-size: 9px; color:#000; padding: 20px 5px 0 5px;margin-left: 5px; overflow:hidden;} +.process-timeline .process-row .process-time .time-con .year{ position: absolute; font-size: 10px; color:#000; padding: 20px 5px 0 5px;margin-left: 5px; overflow:hidden;} .process-timeline .process-row .process-time .time-con .bgcolor{ position: absolute; border-radius: 100%; margin-top: 48px; margin-left: 10px; width: 40px; height: 40px; } .process-timeline .process-row .process-time .time-con .bgcolor.red{ background: red;} @@ -51,7 +51,7 @@ a:hover,a:focus{outline:none;text-decoration: none;} .process-timeline .process-row .process-time .time-con .orange i{ color: #ff9900;} -.process-timeline .process-row .process-noyear { position: absolute; top: 43%; width: 200px; font-size: 16px;margin-left: 20px; overflow:hidden;margin-right:20px} +.process-timeline .process-row .process-noyear { position: absolute; top: 30%; width: auto; font-size: 16px;margin-left: 20px; overflow:hidden;margin-right:20px} .process-timeline .process-row .process-content{padding-bottom: 40px; } .process-timeline .process-row .process-content h2{ font-size: 16px; text-align: center;} .process-timeline .process-row .process-content p{text-indent: 0 !important; font-size: 11px !important; height: 180px;color: #888; white-space:normal; }