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;
}