|
@@ -2,8 +2,6 @@ package com.tzld.piaoquan.recommend.server.common.base;
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
import com.google.gson.GsonBuilder;
|
|
|
-import com.tzld.piaoquan.recommend.server.util.JSONUtils;
|
|
|
-import lombok.Data;
|
|
|
import lombok.Getter;
|
|
|
import lombok.NoArgsConstructor;
|
|
|
|
|
@@ -18,6 +16,7 @@ public class ItemFeature {
|
|
|
|
|
|
/**
|
|
|
* 有多个标题,暂时不会用到所以先不处理
|
|
|
+ *
|
|
|
* @since 2023-12-05
|
|
|
*/
|
|
|
private String title;
|
|
@@ -41,32 +40,32 @@ public class ItemFeature {
|
|
|
private UserActionFeature month3_cnt_features;
|
|
|
|
|
|
|
|
|
- public void setVideoId(String key){
|
|
|
- if(key == null){
|
|
|
+ public void setVideoId(String key) {
|
|
|
+ if (key == null) {
|
|
|
this.videoId = "0";
|
|
|
} else {
|
|
|
this.videoId = key;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void setUpId(String key){
|
|
|
- if(key == null){
|
|
|
+ public void setUpId(String key) {
|
|
|
+ if (key == null) {
|
|
|
this.upId = "0";
|
|
|
} else {
|
|
|
this.upId = key;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void setTags(String key){
|
|
|
- if(key == null){
|
|
|
+ public void setTags(String key) {
|
|
|
+ if (key == null) {
|
|
|
this.tags = "0";
|
|
|
} else {
|
|
|
this.tags = key;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void setTitle(String key){
|
|
|
- if(key == null){
|
|
|
+ public void setTitle(String key) {
|
|
|
+ if (key == null) {
|
|
|
this.title = "0";
|
|
|
} else {
|
|
|
this.title = key;
|
|
@@ -74,28 +73,28 @@ public class ItemFeature {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void setDay1_cnt_features(UserActionFeature feature){
|
|
|
+ public void setDay1_cnt_features(UserActionFeature feature) {
|
|
|
this.day1_cnt_features = feature;
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void setDay3_cnt_features(UserActionFeature feature){
|
|
|
+ public void setDay3_cnt_features(UserActionFeature feature) {
|
|
|
this.day3_cnt_features = feature;
|
|
|
|
|
|
}
|
|
|
|
|
|
- public void setDay7_cnt_features(UserActionFeature feature){
|
|
|
+ public void setDay7_cnt_features(UserActionFeature feature) {
|
|
|
this.day7_cnt_features = feature;
|
|
|
|
|
|
}
|
|
|
|
|
|
- public void setMonth3_cnt_features(UserActionFeature feature){
|
|
|
- this.month3_cnt_features= feature;
|
|
|
+ public void setMonth3_cnt_features(UserActionFeature feature) {
|
|
|
+ this.month3_cnt_features = feature;
|
|
|
|
|
|
}
|
|
|
|
|
|
public void setTitleLength(String key) {
|
|
|
- if(key == null){
|
|
|
+ if (key == null) {
|
|
|
this.titleLength = "0";
|
|
|
} else {
|
|
|
this.titleLength = key;
|
|
@@ -104,7 +103,7 @@ public class ItemFeature {
|
|
|
|
|
|
|
|
|
public void setDaysSinceUpload(String key) {
|
|
|
- if(key == null){
|
|
|
+ if (key == null) {
|
|
|
this.daysSinceUpload = "0";
|
|
|
} else {
|
|
|
this.daysSinceUpload = key;
|
|
@@ -112,7 +111,7 @@ public class ItemFeature {
|
|
|
}
|
|
|
|
|
|
public void setPlayLength(String key) {
|
|
|
- if(key == null){
|
|
|
+ if (key == null) {
|
|
|
this.playLength = "0";
|
|
|
} else {
|
|
|
this.playLength = key;
|
|
@@ -120,7 +119,7 @@ public class ItemFeature {
|
|
|
}
|
|
|
|
|
|
public void setTotalTime(String key) {
|
|
|
- if(key == null){
|
|
|
+ if (key == null) {
|
|
|
this.totalTime = "0";
|
|
|
} else {
|
|
|
this.totalTime = key;
|
|
@@ -131,10 +130,28 @@ public class ItemFeature {
|
|
|
return this.videoId;
|
|
|
}
|
|
|
|
|
|
- public String getValue(){
|
|
|
+ public String getValue() {
|
|
|
Gson gson = new GsonBuilder().serializeSpecialFloatingPointValues().create();
|
|
|
return gson.toJson(this);
|
|
|
}
|
|
|
|
|
|
+ public static ItemFeature defaultInstance(String videoId) {
|
|
|
+ ItemFeature feature = new ItemFeature();
|
|
|
+ feature.setDay1_cnt_features(null);
|
|
|
+ feature.setDay3_cnt_features(null);
|
|
|
+ feature.setDay7_cnt_features(null);
|
|
|
+ feature.setDaysSinceUpload(null);
|
|
|
+ feature.setMonth3_cnt_features(null);
|
|
|
+ feature.setPlayLength(null);
|
|
|
+ feature.setTags(null);
|
|
|
+ feature.setTitle(null);
|
|
|
+ feature.setTitleLength(null);
|
|
|
+ feature.setTotalTime(null);
|
|
|
+ feature.setUpId(null);
|
|
|
+ feature.setVideoId(videoId);
|
|
|
+
|
|
|
+ return feature;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|