|
@@ -2,16 +2,13 @@ package com.tzld.piaoquan.recommend.server.common.base;
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.GsonBuilder;
|
|
import com.google.gson.GsonBuilder;
|
|
-import com.tzld.piaoquan.recommend.server.util.JSONUtils;
|
|
|
|
-import lombok.Data;
|
|
|
|
import lombok.Getter;
|
|
import lombok.Getter;
|
|
import lombok.NoArgsConstructor;
|
|
import lombok.NoArgsConstructor;
|
|
|
|
|
|
-import java.util.Map;
|
|
|
|
-
|
|
|
|
@Getter
|
|
@Getter
|
|
@NoArgsConstructor
|
|
@NoArgsConstructor
|
|
public class UserFeature {
|
|
public class UserFeature {
|
|
|
|
+
|
|
private String uid;
|
|
private String uid;
|
|
// 当天统计量信息
|
|
// 当天统计量信息
|
|
private UserActionFeature day1_cnt_features;
|
|
private UserActionFeature day1_cnt_features;
|
|
@@ -26,53 +23,53 @@ public class UserFeature {
|
|
private String user_cycle_bucket_30days;
|
|
private String user_cycle_bucket_30days;
|
|
private String user_share_bucket_30days;
|
|
private String user_share_bucket_30days;
|
|
|
|
|
|
- public void setUid(String key){
|
|
|
|
|
|
+ public void setUid(String key) {
|
|
this.uid = key;
|
|
this.uid = key;
|
|
- if(key == null)
|
|
|
|
|
|
+ if (key == null)
|
|
this.uid = "0";
|
|
this.uid = "0";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public void setDay1_cnt_features(UserActionFeature key){
|
|
|
|
|
|
+ public void setDay1_cnt_features(UserActionFeature key) {
|
|
this.day1_cnt_features = key;
|
|
this.day1_cnt_features = key;
|
|
- if(key == null)
|
|
|
|
|
|
+ if (key == null)
|
|
this.day1_cnt_features = new UserActionFeature();
|
|
this.day1_cnt_features = new UserActionFeature();
|
|
}
|
|
}
|
|
|
|
|
|
- public void setDay3_cnt_features(UserActionFeature key){
|
|
|
|
|
|
+ public void setDay3_cnt_features(UserActionFeature key) {
|
|
this.day3_cnt_features = key;
|
|
this.day3_cnt_features = key;
|
|
- if(key == null)
|
|
|
|
|
|
+ if (key == null)
|
|
this.day3_cnt_features = new UserActionFeature();
|
|
this.day3_cnt_features = new UserActionFeature();
|
|
}
|
|
}
|
|
|
|
|
|
- public void setDay7_cnt_features(UserActionFeature key){
|
|
|
|
|
|
+ public void setDay7_cnt_features(UserActionFeature key) {
|
|
this.day7_cnt_features = key;
|
|
this.day7_cnt_features = key;
|
|
- if(key == null)
|
|
|
|
|
|
+ if (key == null)
|
|
this.day7_cnt_features = new UserActionFeature();
|
|
this.day7_cnt_features = new UserActionFeature();
|
|
}
|
|
}
|
|
|
|
|
|
public void setMonth3_cnt_features(UserActionFeature key) {
|
|
public void setMonth3_cnt_features(UserActionFeature key) {
|
|
this.month3_cnt_features = key;
|
|
this.month3_cnt_features = key;
|
|
- if(key == null)
|
|
|
|
|
|
+ if (key == null)
|
|
this.month3_cnt_features = new UserActionFeature();
|
|
this.month3_cnt_features = new UserActionFeature();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public void setUser_cycle_bucket_7days(String key){
|
|
|
|
|
|
+ public void setUser_cycle_bucket_7days(String key) {
|
|
this.user_cycle_bucket_7days = key;
|
|
this.user_cycle_bucket_7days = key;
|
|
- if(key == null)
|
|
|
|
|
|
+ if (key == null)
|
|
this.user_cycle_bucket_7days = "0";
|
|
this.user_cycle_bucket_7days = "0";
|
|
}
|
|
}
|
|
|
|
|
|
- public void setUser_cycle_bucket_30days(String key){
|
|
|
|
|
|
+ public void setUser_cycle_bucket_30days(String key) {
|
|
this.user_cycle_bucket_30days = key;
|
|
this.user_cycle_bucket_30days = key;
|
|
- if(key == null)
|
|
|
|
|
|
+ if (key == null)
|
|
this.user_cycle_bucket_30days = "0";
|
|
this.user_cycle_bucket_30days = "0";
|
|
}
|
|
}
|
|
|
|
|
|
- public void setUser_share_bucket_30days(String key){
|
|
|
|
|
|
+ public void setUser_share_bucket_30days(String key) {
|
|
this.user_share_bucket_30days = key;
|
|
this.user_share_bucket_30days = key;
|
|
- if(key == null)
|
|
|
|
|
|
+ if (key == null)
|
|
this.user_share_bucket_30days = "0";
|
|
this.user_share_bucket_30days = "0";
|
|
}
|
|
}
|
|
|
|
|
|
@@ -81,9 +78,22 @@ public class UserFeature {
|
|
return this.uid;
|
|
return this.uid;
|
|
}
|
|
}
|
|
|
|
|
|
- public String getValue(){
|
|
|
|
|
|
+ public String getValue() {
|
|
Gson gson = new GsonBuilder().serializeSpecialFloatingPointValues().create();
|
|
Gson gson = new GsonBuilder().serializeSpecialFloatingPointValues().create();
|
|
return gson.toJson(this);
|
|
return gson.toJson(this);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static UserFeature defaultInstance(String uid) {
|
|
|
|
+ UserFeature userFeature = new UserFeature();
|
|
|
|
+ userFeature.setUid(uid);
|
|
|
|
+ userFeature.setUser_share_bucket_30days(null);
|
|
|
|
+ userFeature.setUser_cycle_bucket_30days(null);
|
|
|
|
+ userFeature.setUser_cycle_bucket_7days(null);
|
|
|
|
+ userFeature.setMonth3_cnt_features(null);
|
|
|
|
+ userFeature.setDay7_cnt_features(null);
|
|
|
|
+ userFeature.setDay3_cnt_features(null);
|
|
|
|
+ userFeature.setDay1_cnt_features(null);
|
|
|
|
+ return userFeature;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|