1.創建類
2.設置kibana時區 不需要再+8了
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.io.Serializable;
import java.util.Date;
@Document(indexName = StudentTaskStatusDocument.INDEX_NAME, type = StudentTaskStatusDocument.TYPE)
public class StudentTaskStatusDocument implements Serializable {
public static final String INDEX_NAME = "student_task_status";
public static final String TYPE = "studentTaskStatusDoc";
public static final String ALIAS = "studentTaskStatus";//別名
@Id
private String id;
// 下發時間
@Field(type = FieldType.Date, format=DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss:SSS")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss:SSS",timezone="GMT+8")
private Date creTime;
// 修改時間
@Field(type = FieldType.Date, format=DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss:SSS")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss:SSS",timezone="GMT+8")
private Date modTime;
// 開始做作業BEGIN,標準完成STANDARD_COMPLETION,作業完成COMPLETE
private String taskStatus;
// 佈置作業人id
private String creTaskUser;
// 作業創建者類型:教師TEACHER,家長PARENT,學生自己STUDENT
private String creTaskType;
// 任務id
private String taskId;
// 任務標題
private String taskTitle;
// 作業類型: EXERCISES 練習 TESTFLOW 測試 EXAM 考試
private String taskType;
// 學校id
private String schoolId;
private String schoolName;
// 班級id
private String classId;
private String className;
// 年級
private String gradeLevel;
// 學校id
private String studentId;
private String studentName;
// 學科
private String subjectCode;
// 學習的累積時間
private Integer timeScope;
// 開始做題時間
@Field(type = FieldType.Date, format=DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss:SSS")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss:SSS",timezone="GMT+8")
private Date beginTime;
// 結束做題時間
@Field(type = FieldType.Date, format=DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss:SSS")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss:SSS",timezone="GMT+8")
private Date endTime;
// 版本id
private String versionId;
// 地區id
private String areaId;
// 地區code
private String areaCode;
// 省id
private String provinceId;
// 市id
private String cityId;
// 縣id
private String countyId;
// 平臺id
private String domainId;
private String sessionId;
}