/**
  * 事件统计-排行-总数
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 事件统计-排行-总数 {status:[true|false],data:1}
  */
 @RequestMapping("event/rank/count")
 public Object eventRankCount(
     @PathVariable int siteId, String subsite, Integer offset, Period span, Date start, Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.eventRankCount(idsite, start, end);
 }
 /**
  * Visit|PV|UV|IP 时段
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 统计数据
  */
 @RequestMapping("visit/span")
 public Object visitSpan(
     @PathVariable int siteId, String subsite, Integer offset, Period span, Date start, Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.visitSpan(idsite, start, end);
 }
 /**
  * 页面排行-标题和链接-总数
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 标题排行
  */
 @RequestMapping("{type:title|url}/rank/count")
 public Object titleurlRankCount(
     @PathVariable int siteId,
     @PathVariable PageRank type,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.titleurlRankCount(idsite, type, start, end);
 }
 /**
  * 事件详细-时段
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param name 事件名称
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 事件详细-趋势 {status:[true|false],data:[{time,date,num,rn,user,ru},...]}
  */
 @RequestMapping("event/name/{name}/span")
 public Object eventNameSpan(
     @PathVariable int siteId,
     @PathVariable String name,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.eventNameSpan(idsite, name, start, end);
 }
 /**
  * 用户忠诚度-访问频次-分布
  *
  * @param siteId 区域ID
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param map 分布格式 如格式 1,2,6,9 表示分布结果 1,2,3-6,7-9,大于9
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 统计数据
  */
 @RequestMapping("visit/frequency/map")
 public Object visitFrequencyMap(
     @PathVariable int siteId,
     @RequestParam String map,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.visitFrequencyMap(idsite, map, start, end);
 }
 /**
  * 分享传播-图点线列表
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param urlId 页面ID
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 分享图点线列表
  */
 @RequestMapping("page/{urlId}/share/map")
 public Object shareMap(
     @PathVariable int siteId,
     @PathVariable String urlId,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.shareMap(idsite, urlId, start, end);
 }
 /**
  * 整站性别-排行
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 分享去向-排行
  */
 @RequestMapping("share/sex/rank/{ranktype:pv|uv}")
 public Object siteSexRank(
     @PathVariable int siteId,
     @PathVariable RankingType ranktype,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.siteSexRank(idsite, ranktype, start, end);
 }
 /**
  * 页面分享-排行
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param limit 分页限制
  * @param skip 分页起始
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 页面分享排行
  */
 @RequestMapping("share/rank/{limit:\\d+}/{skip:\\d+}")
 public Object shareRank(
     @PathVariable int siteId,
     String subsite,
     @PathVariable int limit,
     @PathVariable int skip,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.shareRank(idsite, start, end, limit, skip);
 }
 /**
  * 用户忠诚度-访问页数-排行
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param type 时间类型 view-访问页数|unique-不同页数
  * @param map 分布格式 如格式 1,2,6,9 表示分布结果 1,2,3-6,7-9,大于9
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 统计数据
  */
 @RequestMapping("visit/page/{type:view|unique}/map")
 public Object visitPageMap(
     @PathVariable int siteId,
     @PathVariable VisitPageType type,
     @RequestParam String map,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.visitPageMap(idsite, type, map, start, end);
 }
 /**
  * 访问时间-分布 (服务器时间,浏览器时间)
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param type 时间类型 server-服务器时间|local-浏览器时间
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 统计数据
  */
 @RequestMapping("visit/{type:server|local}/time/map")
 public Object visitTimeMap(
     @PathVariable int siteId,
     @PathVariable TimeType type,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   int days = countDays(Period.day, start, end);
   return service.visitTimeMap(idsite, type, days, start, end);
 }
 /**
  * 站点数据排行-总数 设备品牌、设备型号、网络类型、浏览器、操作系统、APP、分辨率、颜色深度、语言、国家、省份、城市、IP地址、运营商
  *
  * @param ranking 排行类型
  *     brand|model|nettype|browser|system|appname|resolution|depth|lang|country|province|city|ip|isp
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 排行数据-总数
  */
 @RequestMapping(
     "{ranking:brand|model|nettype|browser|system|appname|resolution|depth|lang|country|province|city|ip|isp}/rank/count")
 public Object siteRankCount(
     @PathVariable int siteId,
     @PathVariable Ranking ranking,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.siteRankCount(idsite, ranking, start, end);
 }
 /**
  * 事件统计-趋势
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 事件统计-排行 {status:[true|false],data:[{name,num,rn,user,ru},...]}
  */
 @RequestMapping("event/trend/{period:hour|day|week|month}")
 public Object eventTrend(
     @PathVariable int siteId,
     @PathVariable Period period,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   List<EventTrendValue> list = service.eventTrend(idsite, period, start, end);
   list = fulldata(list, period.getFormat(), period.getField(), start, end, EventTrendValue.class);
   return list;
 }
 /**
  * 页面时间-分布 (服务器时间,浏览器时间)
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param type 时间类型 server-服务器时间|local-浏览器时间
  * @param urlId 页面ID
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 统计数据
  */
 @RequestMapping("page/{urlId}/{type:server|local}/time/map")
 public Object pageTimeMap(
     @PathVariable int siteId,
     @PathVariable String urlId,
     @PathVariable TimeType type,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   int days = countDays(Period.day, start, end);
   return super.mapExclude(
       service.pageTimeMap(idsite, urlId, type, days, start, end), "ip", "rip");
 }
 /**
  * 页面排行-[入口|出口]
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param limit 分页限制
  * @param skip 分页起始
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return [入口|出口]页面
  */
 @RequestMapping("{type:entry|exit}/rank/{ranktype:pv|uv|vt|ip}/{limit:\\d+}/{skip:\\d+}")
 public Object enterexitRank(
     @PathVariable int siteId,
     @PathVariable EnterExit type,
     @PathVariable RankingType ranktype,
     @PathVariable int limit,
     @PathVariable int skip,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.enterexitRank(idsite, type, ranktype, start, end, limit, skip);
 }
 /**
  * 页面排行-标题和链接
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param limit 分页限制
  * @param skip 分页起始
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @return 标题排行
  */
 @RequestMapping("{type:title|url}/rank/{ranktype:vt|uv|pv}/{limit:\\d+}/{skip:\\d+}")
 public Object titleurlRank(
     @PathVariable int siteId,
     @PathVariable PageRank type,
     @PathVariable RankingType ranktype,
     @PathVariable int limit,
     @PathVariable int skip,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.titleurlRank(idsite, type, ranktype, start, end, limit, skip);
 }
 /**
  * 事件详细-趋势
  *
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param name 事件名称
  * @param period 时段周期 [时|日|周|月]
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @param limit 分页限制
  * @param skip 分页起始
  * @return 事件详细-趋势 {status:[true|false],data:[{time,date,num,rn,user,ru},...]}
  */
 @RequestMapping("event/name/{name}/trend/{period:hour|day|week|month}/{limit:\\d+}/{skip:\\d+}")
 public Object eventName(
     @PathVariable int siteId,
     @PathVariable String name,
     @PathVariable Period period,
     @PathVariable int limit,
     @PathVariable int skip,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.eventNameTrend(idsite, name, period, start, end, limit, skip);
 }
 /**
  * 站点数据排行 设备品牌、设备型号、网络类型、浏览器、操作系统、APP、分辨率、颜色深度、语言、国家、省份、城市、IP地址、运营商
  *
  * @param ranking 排行类型
  *     brand|model|nettype|browser|system|appname|resolution|depth|lang|country|province|city|ip|isp
  * @param ranktype 排序类型 按 vt|uv|ip|pv
  * @param siteId 网站ID
  * @param subsite 子站ID
  * @param offset 偏移 0=当天 -1=昨天 1=明天 -2 2 -3...
  * @param span 跨度 [day|week|month|year]
  * @param start 开始时间 ("yyyyMMddHHmmss")
  * @param end 结束时间 ("yyyyMMddHHmmss")
  * @param limit 分页限制
  * @param skip 分页起始
  * @return 排行数据
  */
 @RequestMapping(
     "{ranking:brand|model|nettype|browser|system|appname|resolution|depth|lang|country|province|city|ip|isp}/rank/{ranktype:vt|uv|ip|pv}/{limit:\\d+}/{skip:\\d+}")
 public Object siteRank(
     @PathVariable int siteId,
     @PathVariable Ranking ranking,
     @PathVariable RankingType ranktype,
     @PathVariable int limit,
     @PathVariable int skip,
     String subsite,
     Integer offset,
     Period span,
     Date start,
     Date end) {
   end = timeEnd(end, span, offset);
   start = timeStart(start, span, offset);
   String idsite = getIdSite(siteId, subsite);
   return service.siteRank(idsite, ranking, ranktype, start, end, limit, skip);
 }