diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 2edfa9b..5e50896 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,8 +4,13 @@
-
+
+
+
+
+
+
@@ -401,6 +406,7 @@
+
@@ -420,7 +426,7 @@
-
+
1529592741848
@@ -436,7 +442,14 @@
1529593229553
-
+
+ 1734352510160
+
+
+
+ 1734352510160
+
+
@@ -546,30 +559,17 @@
+
-
+
+
diff --git a/pom.xml b/pom.xml
index 9b55150..e10085e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -79,6 +79,12 @@
4.12
test
+
+ junit
+ junit
+ RELEASE
+ test
+
diff --git a/src/main/java/cn/edu/hust/conf/ConfigurationManager.java b/src/main/java/cn/edu/hust/conf/ConfigurationManager.java
index dbae85b..6f09f9d 100644
--- a/src/main/java/cn/edu/hust/conf/ConfigurationManager.java
+++ b/src/main/java/cn/edu/hust/conf/ConfigurationManager.java
@@ -1,75 +1,83 @@
-package cn.edu.hust.conf;
-
-import java.io.InputStream;
-import java.util.Properties;
-
-/**
- * 配置文件管理类
- * 主要的功能:从特定的properties文件中读取相应的key/value
- */
-public class ConfigurationManager {
- private static Properties prop=new Properties();
-
- /**
- * 通过静态代码块加载配置文件
- */
- static{
- try
- {
- //通过类的加载器读取配置文件
- InputStream is=ConfigurationManager.class.getClassLoader().getResourceAsStream("conf.properties");
- //加载配置文件
- prop.load(is);
- }catch(Exception e)
- {
- e.printStackTrace();
- }
- }
-
- /**
- * 通过指定的key获取value
- * @param key
- * @return
- */
- public static String getProperty(String key)
- {
- return prop.getProperty(key);
- }
-
- /**
- * 获取整数变量
- * @param key
- * @return
- */
- public static Integer getInteger(String key)
- {
- String value=getProperty(key);
- try
- {
- Integer result=Integer.valueOf(value);
- return result;
- }
- catch (Exception e)
- {
-
- e.printStackTrace();
- }
- return 0;
- }
-
- /**
- * 获取布尔型
- * @param key
- * @return
- */
- public static Boolean getBoolean(String key)
- {
- String value=getProperty(key);
- if("false".equals(value))
- {
- return false;
- }
- return true;
- }
-
-}
+package cn.edu.hust.conf;//包
+//
+import java.io.InputStream;//申明
+//
+import java.util.Properties;//申明
+//
+//
+ //配置文件管理类
+ //主要的功能:从特定的properties文件中读取相应的key/value
+ //
+public class ConfigurationManager { //
+ // 创建一个静态的Properties对象,用于存储从配置文件中读取的配置信息
+ private static Properties prop = new Properties();// 创建一个静态的Properties对象,用于存储从配置文件中读取的配置信息
+//
+ //
+ // 通过静态代码块加载配置文件
+ //
+ static { //ha
+ try { //dd
+ // 通过类的加载器读取名为"conf.properties"的配置文件
+ InputStream is = ConfigurationManager.class.getClassLoader().getResourceAsStream("conf.properties");//加载
+ // 加载配置文件到Properties对象中
+ prop.load(is);//加载
+ } catch (Exception e)//kuaizai
+ // 捕获加载文件时的异常并打印错误堆栈信息
+ e.printStackTrace();//kuaizai
+ }//对象
+ } //
+//编写过程
+ //编写过程
+ //
+ //通过指定的key获取value
+ // @param key 配置项的key
+ //@return 返回与key对应的value,如果没有则返回null
+ //
+ public static String getProperty(String key) { //
+ // 使用Properties对象的getProperty方法获取指定key的值
+ return prop.getProperty(key); //
+ } //
+//
+ //
+ // 获取整数变量
+ // @param key 配置项的key
+ // @return 返回与key对应的整数值,如果转换失败则返回默认值0
+ //
+ public static Integer getInteger(String key) { //加载
+ // 获取key对应的字符串值
+ String value = getProperty(key);//
+ //
+ try { //
+ // 尝试将字符串值转换为整数
+ Integer result = Integer.valueOf(value);//
+ //
+ return result; //输出结果
+ //
+ } catch (Exception e) { //catch
+ // 捕获转换时的异常并打印错误堆栈信息
+ e.printStackTrace(); //e
+ //
+ }//
+ // 如果转换失败,返回默认值0
+ return 0; //返回值
+ } //
+//
+ //
+ //获取布尔型
+ // @param key 配置项的key
+ // @return 返回与key对应的布尔值,如果值为"false"则返回false,其他情况返回true
+ //
+ public static Boolean getBoolean(String key) { //
+ // 获取key对应的字符串值
+ String value = getProperty(key); //string
+ // 如果值为"false"(不区分大小写),则返回false
+ if ("false".equals(value)) { //错误
+ //返回值
+ return false; //返回错误结果
+ } //
+ // 默认返回true
+ return true; //返回正确
+ }//
+ //
+}//
+//完成
\ No newline at end of file
diff --git a/src/main/java/cn/edu/hust/constant/Constants.java b/src/main/java/cn/edu/hust/constant/Constants.java
index 4ad5a94..ead3d2b 100644
--- a/src/main/java/cn/edu/hust/constant/Constants.java
+++ b/src/main/java/cn/edu/hust/constant/Constants.java
@@ -1,64 +1,128 @@
-package cn.edu.hust.constant;
-
-public class Constants {
- /**
- * 项目配置常量
- */
- public static final String JDBC_DRIVER="jdbc.driver";
- public static final String JDBC_URL="jdbc.url";
- public static final String JDBC_USERNAME="jdbc.username";
- public static final String JDBC_PSSWORD="jdbc.password";
- public static final String JDBC_ACTIVE="jdbc.active";
-
- /**
- * Spark作业相关常量
- */
- public static final String APP_NAME_SESSION="UserVisitAnalyze";
- public static final String SPARK_LOCAL="spark_local";
- public static final String FIELD_SESSIONID="sessionId";
- public static final String FIELD_SERACH_KEYWORDS="searchKeywords";
- public static final String FIELD_CLICK_CATEGORYIDS="clickCategoryIds";
- public static final String FIELD_AGE="age";
- public static final String FIELD_CITY="city";
- public static final String FIELD_SEX="sex";
- public static final String FIELD_PROFESSIONAL="professional";
- public static final String FIELD_VISIT_LENGTH="visitLength";
- public static final String FIELD_STEP_LENGTH="stepLength";
- public static final String FIELD_START_TIME="startTime";
- public static final String FIELD_CATEGORY_ID="categoryId";
- public static final String FIELD_CLICK_CATEGORY="categoryId";
- public static final String FIELD_ORDER_CATEGORY="clickCategory";
- public static final String FIELD_PAY_CATEGORY="orderCategory";
-
- /**
- * Spark任务相关厂常量
- */
- public static final String PARAM_STARTTIME ="startDate";
- public static final String PARAM_ENDTIME ="endDate";
- public static final String PARAM_STARTAGE ="startAge";
- public static final String PARAM_ENDAGE ="endAge";
- public static final String PARAM_PROFESSONALS ="professionals";
- public static final String PARAM_CIYTIES ="cities";
- public static final String PARAM_SEX ="sex";
- public static final String PARAM_SERACH_KEYWORDS="searchKeywords";
- public static final String PARAM_CLICK_CATEGORYIDS="clickCategoryIds";
-
- public static final String SESSION_COUNT = "session_count";
- public static final String TIME_PERIOD_1s_3s = "1s_3s";
- public static final String TIME_PERIOD_4s_6s = "4s_6s";
- public static final String TIME_PERIOD_7s_9s = "7s_9s";
- public static final String TIME_PERIOD_10s_30s = "10s_30s";
- public static final String TIME_PERIOD_30s_60s = "30s_60s";
- public static final String TIME_PERIOD_1m_3m = "1m_3m";
- public static final String TIME_PERIOD_3m_10m = "3m_10m";
- public static final String TIME_PERIOD_10m_30m = "10m_30m";
- public static final String TIME_PERIOD_30m = "30m";
-
- public static final String STEP_PERIOD_1_3 = "1_3";
- public static final String STEP_PERIOD_4_6 = "4_6";
- public static final String STEP_PERIOD_7_9 = "7_9";
- public static final String STEP_PERIOD_10_30 = "10_30";
- public static final String STEP_PERIOD_30_60 = "30_60";
- public static final String STEP_PERIOD_60 = "60";
-
-}
+//开始
+package cn.edu.hust.constant;//申明
+//
+public class Constants { //
+//
+ //
+ // 项目配置常量
+ //这些常量用于存储数据库连接的配置信息
+ //
+ public static final String JDBC_DRIVER="jdbc.driver"; // JDBC驱动类
+ //
+ public static final String JDBC_URL="jdbc.url"; // 数据库连接URL
+ //
+ public static final String JDBC_USERNAME="jdbc.username"; // 数据库用户名
+ //
+ public static final String JDBC_PSSWORD="jdbc.password"; // 数据库密码
+ //
+ public static final String JDBC_ACTIVE="jdbc.active"; // 数据库连接是否活跃
+ //
+//
+ //
+ //Spark作业相关常量
+ // 这些常量用于存储Spark作业相关的配置信息、字段名等
+ //
+ public static final String APP_NAME_SESSION="UserVisitAnalyze"; // Spark应用名称,用于标识作业
+ //
+ public static final String SPARK_LOCAL="spark_local"; // Spark本地模式的配置标识
+ //
+ public static final String FIELD_SESSIONID="sessionId"; // 用户会话ID字段名
+ //
+ public static final String FIELD_SERACH_KEYWORDS="searchKeywords"; // 搜索关键词字段名
+ //
+ public static final String FIELD_CLICK_CATEGORYIDS="clickCategoryIds"; // 点击的分类ID字段名
+ //
+ public static final String FIELD_AGE="age"; // 用户年龄字段名
+ //
+ public static final String FIELD_CITY="city"; // 用户所在城市字段名
+ //
+ public static final String FIELD_SEX="sex"; // 用户性别字段名
+ //
+ public static final String FIELD_PROFESSIONAL="professional"; // 用户职业字段名
+ //
+ public static final String FIELD_VISIT_LENGTH="visitLength"; // 访问时长字段名
+ //
+ public static final String FIELD_STEP_LENGTH="stepLength"; // 访问步长字段名
+ //
+ public static final String FIELD_START_TIME="startTime"; // 会话开始时间字段名
+ //
+ public static final String FIELD_CATEGORY_ID="categoryId"; // 分类ID字段名
+ //
+ public static final String FIELD_CLICK_CATEGORY="categoryId"; // 点击的分类字段名
+ //
+ public static final String FIELD_ORDER_CATEGORY="clickCategory"; // 订单分类字段名
+ //
+ public static final String FIELD_PAY_CATEGORY="orderCategory"; // 支付分类字段名
+//
+ //
+ // Spark任务相关参数常量
+ // 这些常量用于存储Spark任务中的参数名称
+ //
+ public static final String PARAM_STARTTIME ="startDate"; // 起始日期参数
+ //
+ public static final String PARAM_ENDTIME ="endDate"; // 结束日期参数
+ //
+ public static final String PARAM_STARTAGE ="startAge"; // 起始年龄参数
+ //
+ public static final String PARAM_ENDAGE ="endAge"; // 结束年龄参数
+ //
+ public static final String PARAM_PROFESSONALS ="professionals"; // 专业参数
+ //
+ public static final String PARAM_CIYTIES ="cities"; // 城市参数
+ //
+ public static final String PARAM_SEX ="sex"; // 性别参数
+ //
+ public static final String PARAM_SERACH_KEYWORDS="searchKeywords"; // 搜索关键词参数
+ //
+ public static final String PARAM_CLICK_CATEGORYIDS="clickCategoryIds"; // 点击的分类ID参数
+ //
+//
+ //
+ // 会话统计相关常量
+ //用于会话时长或访问步数的统计分类
+ //
+ public static final String SESSION_COUNT = "session_count"; // 会话统计
+ //
+//
+ //
+ // 用户访问时长时间段常量
+ //用于标识用户访问时长的各个时间段
+ //
+ public static final String TIME_PERIOD_1s_3s = "1s_3s"; // 1秒到3秒的时长
+ //
+ public static final String TIME_PERIOD_4s_6s = "4s_6s"; // 4秒到6秒的时长
+ //
+ public static final String TIME_PERIOD_7s_9s = "7s_9s"; // 7秒到9秒的时长
+ //
+ public static final String TIME_PERIOD_10s_30s = "10s_30s"; // 10秒到30秒的时长
+ //
+ public static final String TIME_PERIOD_30s_60s = "30s_60s"; // 30秒到60秒的时长
+ //
+ public static final String TIME_PERIOD_1m_3m = "1m_3m"; // 1分钟到3分钟的时长
+ //
+ public static final String TIME_PERIOD_3m_10m = "3m_10m"; // 3分钟到10分钟的时长
+ //
+ public static final String TIME_PERIOD_10m_30m = "10m_30m"; // 10分钟到30分钟的时长
+ //
+ public static final String TIME_PERIOD_30m = "30m"; // 超过30分钟的时长
+ //
+//
+ //
+ // 用户访问步数时间段常量
+ //用于标识用户的访问步数区间
+ //
+ public static final String STEP_PERIOD_1_3 = "1_3"; // 1步到3步的访问
+ //
+ public static final String STEP_PERIOD_4_6 = "4_6"; // 4步到6步的访问
+ //
+ public static final String STEP_PERIOD_7_9 = "7_9"; // 7步到9步的访问
+ //
+ public static final String STEP_PERIOD_10_30 = "10_30"; // 10步到30步的访问
+ //
+ public static final String STEP_PERIOD_30_60 = "30_60"; // 30步到60步的访问
+ //
+ public static final String STEP_PERIOD_60 = "60"; // 超过60步的访问
+ //
+//
+}//返回
+//完成
diff --git a/src/main/java/cn/edu/hust/util/DateUtils.java b/src/main/java/cn/edu/hust/util/DateUtils.java
index e5f32bb..1bfde96 100644
--- a/src/main/java/cn/edu/hust/util/DateUtils.java
+++ b/src/main/java/cn/edu/hust/util/DateUtils.java
@@ -7,7 +7,7 @@ import java.util.Date;
/**
* 日期时间工具类
- * @author Administrator111
+ * @author Administrator111222
*
*/
public class DateUtils {
diff --git a/src/test/java/cn/edu/hust/conf/ConfigurationManagerTest.java b/src/test/java/cn/edu/hust/conf/ConfigurationManagerTest.java
index 75d3272..932b499 100644
--- a/src/test/java/cn/edu/hust/conf/ConfigurationManagerTest.java
+++ b/src/test/java/cn/edu/hust/conf/ConfigurationManagerTest.java
@@ -1,15 +1,17 @@
-package cn.edu.hust.conf;
-
-
-import org.junit.Test;
-
-public class ConfigurationManagerTest {
- /**
- * 测试配置文件管理类
- */
- @Test
- public void getMethod()
- {
- System.out.println(ConfigurationManager.getProperty("key1"));
- }
-}
+//开始
+package cn.edu.hust.conf; // 导入包:配置管理相关的类
+//
+import org.junit.Test; // 导入JUnit的Test注解,用于标识测试方法
+//
+public class ConfigurationManagerTest { // 定义测试类,测试ConfigurationManager类的功能
+ //
+ //测试配置文件管理类 // 方法注释,表示该方法用于测试配置文件管理类
+ //
+ @Test // 使用JUnit的Test注解,表示该方法为一个测试方法
+ //
+ public void getMethod() // 定义一个测试方法
+ { //
+ System.out.println(ConfigurationManager.getProperty("key1")); // 打印从ConfigurationManager获取key1对应的属性值
+ }//
+}//
+//完成