图表显示日志离线信息
关注公众号:分享电脑学习
回复"百度云盘" 可以免费获取所有学习文档的代码(不定期更新)
云盘目录说明:
tools目录是安装包
res 目录是每一个课件对应的代码和资源等
doc 目录是一些第三方的文档工具
承接上一篇文档《Hive分析统计hour信息》
准备数据库lx_data
创建pom项目
配置pom
<properties>
<spring.version>3.2.1.RELEASE</spring.version>
<mybatis.version>3.1.1</mybatis.version>
<log4j.version>1.2.17</log4j.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.18</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- spring如果需要返回json格式的数据,那么必须引入下面两个包 -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
</dependencies>
创建并配置jdbc.properties
# local
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/lx_data?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true
jdbc.username=root
jdbc.password=
jdbc.minPoolSize=2
jdbc.maxPoolSize=20
jdbc.acquireIncrement=2
jdbc.initialPoolSize=3
jdbc.testConnectionOnCheckout=false
jdbc.idleConnectionTestPeriod=3600
jdbc.maxIdleTime=3600
创建并配置log4j.properties
log4j.rootCategory=info,stdout,fileout
### stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{MM-dd-HH\:mm\:ss} - lx_dataapi - [%t] %-5p [%C\:%L]%x %m%n
### fileout
log4j.appender.fileout=org.apache.log4j.DailyRollingFileAppender
log4j.appender.fileout.File=${catalina.base}/logs/dataapi.log
log4j.appender.fileout.layout=org.apache.log4j.PatternLayout
log4j.appender.fileout.layout.ConversionPattern=%d{MM-dd-HH\:mm\:ss} - lx_dataapi - [%t] %-5p [%C\:%L]%x %m%n
log4j.appender.fileout.DatePattern='.'yyyy-MM-dd
### print the mybatis execute sql
log4j.logger.org.apache.ibatis=DEBUG
log4j.logger.java.sql=DEBUG
创建并配置 ae-mvc.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<description>Spring-web MVC配置</description>
<!-- 这两个类用来启动基于Spring MVC的注解功能,将控制器与方法映射加入到容器中 -->
<mvc:annotation-driven />
<!-- 对所有类进行扫描,以完成Bean创建和自动依赖注入的功能 -->
<context:component-scan base-package="com.wzy.ae.**.controller" />
<!-- 添加静态资源访问 -->
<mvc:resources location="/analyse/" mapping="/analyse/**"/>
<mvc:resources location="/" mapping="/*.html"/>
</beans>
创建并配置 ae-beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:hdp="http://www.springframework.org/schema/hadoop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:oxm="http://www.springframework.org/schema/oxm"
xmlns:p="http://www.springframework.org/schema/p" xmlns:c="http://www.springframework.org/schema/c"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd
" default-autowire="byName">
<!-- 创建jdbc -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
</bean>
<import resource="classpath*:aeConfigContext.xml" /> <!-- ae相关配置信息 -->
<bean id="aeDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${jdbc.driverClassName}"></property>
<property name="jdbcUrl" value="${jdbc.url}"></property>
<property name="user" value="${jdbc.username}"></property>
<property name="password" value="${jdbc.password}"></property>
<property name="minPoolSize" value="${jdbc.minPoolSize}"></property>
<property name="maxPoolSize" value="${jdbc.maxPoolSize}"></property>
<property name="acquireIncrement" value="${jdbc.acquireIncrement}"></property>
<property name="initialPoolSize" value="${jdbc.initialPoolSize}"></property>
<property name="testConnectionOnCheckout" value="${jdbc.testConnectionOnCheckout}"></property>
<property name="idleConnectionTestPeriod" value="${jdbc.idleConnectionTestPeriod}"></property>
<property name="maxIdleTime" value="${jdbc.maxIdleTime}"></property>
</bean>
<bean id="aeSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="aeDataSource" />
<property name="mapperLocations">
<value>classpath*:com/wzy/ae/**/*Mapper.xml</value>
</property>
</bean>
<bean id="aeSqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="aeSqlSessionFactory" />
</bean>
<!-- 具体service bean -->
<bean id="userBehaviorSpeedRateService" class="com.wzy.ae.service.impl.UserBehaviorSpeedRateServiceImpl"></bean>
<!-- 具体service bean结束 -->
<!-- bucket.metric 对应的计算类bean -->
<bean id="user_behavior.active_user_rate" class="com.wzy.ae.calculate.impl.ActiveRateCalculater"/>
<!-- bucket.metric 对应的计算类bean结束 -->
<!-- dao相关bean -->
<bean id="baseDao" abstract="true">
<property name="sqlSessionTemplate" ref="aeSqlSessionTemplate" />
</bean>
<bean id="aeDao" class="com.wzy.ae.dao.mybatis.AEDao" parent="baseDao"></bean>
<bean id="dimensionDao" class="com.wzy.ae.dao.impl.DimensionDaoImpl" parent="baseDao"></bean>
<bean id="dateDimensionDao" class="com.wzy.ae.dao.impl.DateDimensionDaoImpl" parent="baseDao"></bean>
<bean id="platformDimeDao" class="com.wzy.ae.dao.impl.PlatformDimensionDaoImpl" parent="baseDao"></bean>
<bean id="kpiDimeDao" class="com.wzy.ae.dao.impl.KpiDimensionDaoImpl" parent="baseDao"></bean>
<bean id="browserDimeDao" class="com.wzy.ae.dao.impl.BrowserDimensionDaoImpl" parent="baseDao"></bean>
<bean id="locationDimeDao" class="com.wzy.ae.dao.impl.LocationDimensionDaoImpl" parent="baseDao"></bean>
<bean id="inboundDimeDao" class="com.wzy.ae.dao.impl.InboundDimensionDaoImpl" parent="baseDao"></bean>
<bean id="eventDimeDao" class="com.wzy.ae.dao.impl.EventDimensionDaoImpl" parent="baseDao"></bean>
<bean id="currencyTypeDimeDao" class="com.wzy.ae.dao.impl.CurrencyTypeDimensionDaoImpl" parent="baseDao"></bean>
<bean id="paymentTypeDimeDao" class="com.wzy.ae.dao.impl.PaymentTypeDimensionDaoImpl" parent="baseDao"></bean>
<!-- dao相关bean结束 -->
<!-- 共用service bean -->
<bean id = "aeService" class="com.wzy.ae.service.impl.AEServiceImpl">
<property name="aeDao" ref="aeDao"></property>
</bean>
<bean id="dimensionService" class="com.wzy.ae.service.impl.DimensionServiceImpl">
<property name="dimeDao" ref="dimensionDao"></property>
<property name="dateDimeDao" ref="dateDimensionDao"></property>
<property name="platformDimeDao" ref="platformDimeDao"></property>
<property name="kpiDimeDao" ref="kpiDimeDao"></property>
<property name="browserDimeDao" ref="browserDimeDao"></property>
<property name="locationDimeDao" ref="locationDimeDao"></property>
<property name="inboundDimeDao" ref="inboundDimeDao"></property>
<property name="eventDimeDao" ref="eventDimeDao"></property>
<property name="currencyTypeDimeDao" ref="currencyTypeDimeDao"></property>
<property name="paymentTypeDimeDao" ref="paymentTypeDimeDao"></property>
</bean>
<bean class="com.wzy.ae.util.ApplicationContextUtil"/>
<!-- 共用service bean结束 -->
</beans>
创建并配置aeConfigContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:hdp="http://www.springframework.org/schema/hadoop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:oxm="http://www.springframework.org/schema/oxm"
xmlns:p="http://www.springframework.org/schema/p" xmlns:c="http://www.springframework.org/schema/c"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd
">
<!-- bucket metric 参数,定义的是从mysql获取的列名 -->
<util:map id="bucketMetricColumns">
<entry key="user_behavior.active_users" value="active_users"/>
<entry key="user_behavior.active_user_rate" value="active_users,total_users"/>
<entry key="user_behavior.total_users" value="total_users"/>
<entry key="user_behavior.new_users" value="new_users"/>
<entry key="user_behavior.new_user_rate" value="new_users, active_users"/>
<entry key="user_behavior.new_user_speed_rate" value="new_users"/>
<entry key="user_behavior.active_user_speed_rate" value="active_users"/>
<entry key="user_behavior.total_user_speed_rate" value="total_users"/>
<entry key="user_behavior.active_members" value="active_members"/>
<entry key="user_behavior.active_member_rate" value="active_members,total_members"/>
<entry key="user_behavior.total_members" value="total_members"/>
<entry key="user_behavior.new_members" value="new_members"/>
<entry key="user_behavior.new_member_rate" value="new_members, active_members"/>
<entry key="user_behavior.new_member_speed_rate" value="new_members"/>
<entry key="user_behavior.active_member_speed_rate" value="active_members"/>
<entry key="user_behavior.total_member_speed_rate" value="total_members"/>
<entry key="user_behavior.sessions" value="sessions"/>
<entry key="user_behavior.sessions_length" value="sessions_length"/>
<entry key="user_behavior.hourly_sessions" value="hour_00,hour_01,hour_02,hour_03,hour_04,hour_05,hour_06,hour_07,hour_08,hour_09,hour_10,hour_11,hour_11,hour_12,hour_13,hour_14,hour_15,hour_16,hour_17,hour_18,hour_19,hour_20,hour_21,hour_22,hour_23"/>
<entry key="user_behavior.hourly_sessions_length" value="hour_00,hour_01,hour_02,hour_03,hour_04,hour_05,hour_06,hour_07,hour_08,hour_09,hour_10,hour_11,hour_11,hour_12,hour_13,hour_14,hour_15,hour_16,hour_17,hour_18,hour_19,hour_20,hour_21,hour_22,hour_23"/>
<entry key="user_behavior.hourly_active_user" value="hour_00,hour_01,hour_02,hour_03,hour_04,hour_05,hour_06,hour_07,hour_08,hour_09,hour_10,hour_11,hour_11,hour_12,hour_13,hour_14,hour_15,hour_16,hour_17,hour_18,hour_19,hour_20,hour_21,hour_22,hour_23"/>
<entry key="browser.active_users" value="active_users"/>
<entry key="browser.new_users" value="new_users"/>
<entry key="browser.total_users" value="total_users"/>
<entry key="browser.active_members" value="active_members"/>
<entry key="browser.new_members" value="new_members"/>
<entry key="browser.total_members" value="total_members"/>
<entry key="browser.sessions" value="sessions"/>
<entry key="browser.sessions_length" value="sessions_length"/>
<entry key="browser.pv" value="pv"/>
<entry key="location.uv" value="uv"/>
<entry key="location.visit" value="visit"/>
<entry key="location.bounce_number" value="bounce_number"/>
<entry key="depth.view_depth_of_user" value="pv_1,pv_2,pv_3,pv_4,pv_5_10,pv_11_30,pv_31_60,pv_61_plus"/>
<entry key="depth.view_depth_of_session" value="pv_1,pv_2,pv_3,pv_4,pv_5_10,pv_11_30,pv_31_60,pv_61_plus"/>
<entry key="inbound.uv" value="uv"/>
<entry key="inbound.visit" value="visit"/>
<entry key="inbound.bounce_number" value="bounce_number"/>
<entry key="event.times" value="times"/>
<entry key="order.orders" value="orders"/>
<entry key="order.success_orders" value="success_orders"/>
<entry key="order.refund_orders" value="refund_orders"/>
<entry key="order.order_amount" value="order_amount"/>
<entry key="order.revenue_amount" value="revenue_amount"/>
<entry key="order.refund_amount" value="refund_amount"/>
<entry key="order.total_revenue_amount" value="total_revenue_amount"/>
<entry key="order.total_refund_amount" value="total_refund_amount"/>
</util:map>
<!-- bucket metric 返回value参数 结束 -->
<!-- bucket metric query id 参数 -->
<util:map id="bucketMetricQueryId">
<entry key="user_behavior.active_users" value="com.wzy.ae.user.behavior.getUserStats"/>
<entry key="user_behavior.active_user_rate" value="com.wzy.ae.user.behavior.getUserStats"/>
<entry key="user_behavior.total_users" value="com.wzy.ae.user.behavior.getUserStats"/>
<entry key="user_behavior.new_users" value="com.wzy.ae.user.behavior.getUserStats"/>
<entry key="user_behavior.new_user_rate" value="com.wzy.ae.user.behavior.getUserStats"/>
<entry key="user_behavior.new_user_speed_rate" value="userBehaviorSpeedRateService"/>
<entry key="user_behavior.active_user_speed_rate" value="userBehaviorSpeedRateService"/>
<entry key="user_behavior.total_user_speed_rate" value="userBehaviorSpeedRateService"/>
<entry key="user_behavior.active_members" value="com.wzy.ae.user.behavior.getUserStats"/>
<entry key="user_behavior.active_member_rate" value="com.wzy.ae.user.behavior.getUserStats"/>
<entry key="user_behavior.total_members" value="com.wzy.ae.user.behavior.getUserStats"/>
<entry key="user_behavior.new_members" value="com.wzy.ae.user.behavior.getUserStats"/>
<entry key="user_behavior.new_member_rate" value="com.wzy.ae.user.behavior.getUserStats"/>
<entry key="user_behavior.new_member_speed_rate" value="userBehaviorSpeedRateService"/>
<entry key="user_behavior.active_member_speed_rate" value="userBehaviorSpeedRateService"/>
<entry key="user_behavior.total_member_speed_rate" value="userBehaviorSpeedRateService"/>
<entry key="user_behavior.sessions" value="com.wzy.ae.user.behavior.getUserStats"/>
<entry key="user_behavior.sessions_length" value="com.wzy.ae.user.behavior.getUserStats"/>
<entry key="user_behavior.hourly_sessions" value="com.wzy.ae.user.behavior.getHourlyUserStats"/>
<entry key="user_behavior.hourly_sessions_length" value="com.wzy.ae.user.behavior.getHourlyUserStats"/>
<entry key="user_behavior.hourly_active_user" value="com.wzy.ae.user.behavior.getHourlyUserStats" />
<entry key="browser.active_users" value="com.wzy.ae.browser.getBrowserUserStats"/>
<entry key="browser.new_users" value="com.wzy.ae.browser.getBrowserUserStats"/>
<entry key="browser.total_users" value="com.wzy.ae.browser.getBrowserUserStats"/>
<entry key="browser.active_members" value="com.wzy.ae.browser.getBrowserUserStats"/>
<entry key="browser.new_members" value="com.wzy.ae.browser.getBrowserUserStats"/>
<entry key="browser.total_members" value="com.wzy.ae.browser.getBrowserUserStats"/>
<entry key="browser.sessions" value="com.wzy.ae.browser.getBrowserUserStats"/>
<entry key="browser.sessions_length" value="com.wzy.ae.browser.getBrowserUserStats"/>
<entry key="browser.pv" value="com.wzy.ae.browser.getBrowserUserStats"/>
<entry key="location.uv" value="com.wzy.ae.location.getLocationStats" />
<entry key="location.visit" value="com.wzy.ae.location.getLocationStats" />
<entry key="location.bounce_number" value="com.wzy.ae.location.getLocationStats" />
<entry key="depth.view_depth_of_user" value="com.wzy.ae.depth.getActiveUserDepthStats" />
<entry key="depth.view_depth_of_session" value="com.wzy.ae.depth.getSessionDepthStats" />
<entry key="inbound.uv" value="com.wzy.ae.inbound.getInboundStats" />
<entry key="inbound.visit" value="com.wzy.ae.inbound.getInboundStats" />
<entry key="inbound.bounce_number" value="com.wzy.ae.inbound.getInboundStats" />
<entry key="event.times" value="com.wzy.ae.event.getEventStats" />
<entry key="order.orders" value="com.wzy.ae.order.getOrderStats"/>
<entry key="order.success_orders" value="com.wzy.ae.order.getOrderStats"/>
<entry key="order.refund_orders" value="com.wzy.ae.order.getOrderStats"/>
<entry key="order.order_amount" value="com.wzy.ae.order.getOrderStats"/>
<entry key="order.revenue_amount" value="com.wzy.ae.order.getOrderStats"/>
<entry key="order.refund_amount" value="com.wzy.ae.order.getOrderStats"/>
<entry key="order.total_revenue_amount" value="com.wzy.ae.order.getOrderStats"/>
<entry key="order.total_refund_amount" value="com.wzy.ae.order.getOrderStats"/>
</util:map>
<!-- bucket metric query id 参数结束 -->
<!-- bucket metric 参数 -->
<util:map id="bucketMetrics">
<entry key="user_behavior">
<ref local="userBehavior"/>
</entry>
<entry key="browser">
<ref local="browserBucketMetrics"/>
</entry>
<entry key="location">
<ref local="locationBucketMetrics"/>
</entry>
<entry key="depth">
<ref local="depthBucketMetrics"/>
</entry>
<entry key="inbound">
<ref local="inboundBucketMetrics"/>
</entry>
<entry key="event">
<ref local="eventBucketMetrics"/>
</entry>
<entry key="order">
<ref local="orderBucketMetrics"/>
</entry>
</util:map>
<util:set id="orderBucketMetrics">
<value>orders</value>
<value>success_orders</value>
<value>refund_orders</value>
<value>order_amount</value>
<value>revenue_amount</value>
<value>refund_amount</value>
<value>total_revenue_amount</value>
<value>total_refund_amount</value>
</util:set>
<util:set id="eventBucketMetrics">
<value>times</value>
</util:set>
<util:set id="inboundBucketMetrics">
<value>uv</value>
<value>visit</value>
<value>bounce_number</value>
</util:set>
<util:set id="depthBucketMetrics">
<value>view_depth_of_user</value>
<value>view_depth_of_session</value>
</util:set>
<util:set id="locationBucketMetrics">
<value>uv</value>
<value>visit</value>
<value>bounce_number</value>
</util:set>
<util:set id="browserBucketMetrics">
<value>active_users</value>
<value>total_users</value>
<value>new_users</value>
<value>active_members</value>
<value>total_members</value>
<value>new_members</value>
<value>sessions</value>
<value>sessions_length</value>
<value>pv</value>
</util:set>
<util:set id="userBehavior">
<value>active_users</value>
<value>active_user_rate</value>
<value>total_users</value>
<value>new_users</value>
<value>new_user_rate</value>
<value>new_user_speed_rate</value>
<value>active_user_speed_rate</value>
<value>total_user_speed_rate</value>
<value>active_members</value>
<value>active_member_rate</value>
<value>total_members</value>
<value>new_members</value>
<value>new_member_rate</value>
<value>new_member_speed_rate</value>
<value>active_member_speed_rate</value>
<value>total_member_speed_rate</value>
<value>sessions</value>
<value>sessions_length</value>
<value>hourly_sessions</value>
<value>hourly_sessions_length</value>
<value>hourly_active_user</value>
</util:set>
<!-- bucket metric 参数结束-->
<!-- bucket group 参数-->
<util:map id="groupByColumns">
<entry key="user_behavior">
<ref local="commonGroupByColumns"/>
</entry>
<entry key="browser">
<ref local="browserGroupByColumns"/>
</entry>
<entry key="location">
<ref local="locationGroupByColumns"/>
</entry>
<entry key="depth">
<ref local="commonGroupByColumns"/>
</entry>
<entry key="inbound">
<ref local="inboundGroupByColumns"/>
</entry>
<entry key="event">
<ref local="eventGroupByColumns"/>
</entry>
<entry key="order">
<ref local="orderGroupByColumns"/>
</entry>
</util:map>
<util:set id="commonGroupByColumns">
<value>day</value>
<!-- <value>week</value>
<value>month</value>
<value>season</value>
<value>year</value> -->
<value>platform</value>
</util:set>
<util:set id="browserGroupByColumns">
<ref local="commonGroupByColumns"/>
<value>browser</value>
<value>browser_version</value>
</util:set>
<util:set id="locationGroupByColumns">
<ref local="commonGroupByColumns"/>
<value>country</value>
<value>province</value>
<value>city</value>
</util:set>
<util:set id="inboundGroupByColumns">
<ref local="commonGroupByColumns"/>
<value>inbound</value>
</util:set>
<util:set id="eventGroupByColumns">
<ref local="commonGroupByColumns"/>
<value>category</value>
<value>action</value>
</util:set>
<util:set id="orderGroupByColumns">
<ref local="commonGroupByColumns"/>
<value>currency_type</value>
<value>payment_type</value>
</util:set>
<!-- bucket group 参数-->
<util:map id="dimensionTableMapping">
<entry key="date" value="dimension_date"/>
<entry key="browser" value="dimension_browser"/>
<entry key="browser_name" value="dimension_browser"/>
<entry key="platform" value="dimension_platform"/>
<entry key="location" value="dimension_location"></entry>
<entry key="location_country" value="dimension_location"></entry>
<entry key="location_province" value="dimension_location"></entry>
<entry key="location_city" value="dimension_location"></entry>
<entry key="inbound" value="dimension_inbound"></entry>
<entry key="event" value="dimension_event"></entry>
<entry key="currency_type" value="dimension_currency_type"></entry>
<entry key="payment_type" value="dimension_payment_type"></entry>
</util:map>
<util:map id="dimensionColumns">
<entry key="platform" value="id,`platform_name`"/>
<entry key="browser_name" value="distinct `browser_name`"/>
<entry key="location_country" value="distinct `country`"/>
<entry key="location_province" value="distinct `country`, `province`"/>
<entry key="location_city" value="distinct `country`, `province`, `city`"/>
<entry key="inbound" value="`id`, `name`"/>
</util:map>
</beans>
创建包结构
完成web.xml的内容
环境完成后
完成common包中
创建AEConstants
完成model包中的代码
完成util包中的代码
完成calculate包中的代码
完成dao包中的代码
完成service包下面代码
最后再完成controller中的代码
准备页面
运行,访问http://localhost:8080/dataapi/analyse/index.html
出现错误,将jdk版本降下来就行了
spring 3.2不支持1.8编译环境,解决办法就是降为1.7编译环境
spring官网说了,要使用java8,只支持spring 4.X以上版本,而spring的使用最低java要求java5及以上
再次运行就可以了,因为数据是旧的注意日期的选择
代码和数据库已经上传,直接下载就可以运行了