feat: 拆分记录上下文与内容归属并把报告改为结构化
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.guo.learningprogresstracker.dto;
|
||||
|
||||
/**
|
||||
* 学习报告的三段文本(归属-01 / 报告-01)。
|
||||
*
|
||||
* <p>报告的第四部分「按归属分组的碎片」不在此列:它是查看时按当前内容归属实时聚合的视图,不落库。</p>
|
||||
*
|
||||
* @param sessionSummary 会话摘要:这次实际学了什么
|
||||
* @param expectationVerdict 预期达成判断:对照学习预期得出的结论
|
||||
* @param freeSummary 自由总结:用户对本次学习的叙述
|
||||
*/
|
||||
public record ReportSections(String sessionSummary, String expectationVerdict, String freeSummary) {
|
||||
|
||||
/** 三段是否都为空 */
|
||||
public boolean isEmpty() {
|
||||
return isBlank(sessionSummary) && isBlank(expectationVerdict) && isBlank(freeSummary);
|
||||
}
|
||||
|
||||
private static boolean isBlank(String text) {
|
||||
return text == null || text.isBlank();
|
||||
}
|
||||
|
||||
/** 报告落库时的兜底:至少保留一段,避免出现完全空的报告 */
|
||||
public ReportSections orFallbackTo(String fallback) {
|
||||
if (!isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
return new ReportSections(null, null, fallback);
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,38 @@ import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 复习滚动 feed 条目;首页仅使用残片,任务详情仍可同时包含报告和残片
|
||||
* 复习滚动 feed 条目 / 任务记录条目。
|
||||
*
|
||||
* <p>归属-01 之后这里同时承载两个维度,不要混用:</p>
|
||||
* <ul>
|
||||
* <li>{@code taskNum} / {@code taskName} 是<b>内容归属</b>:碎片取它自己的归属任务,
|
||||
* 报告取产生它的会话所属任务(报告按会话生成)。</li>
|
||||
* <li>{@code contextType} / {@code contextNum} 是<b>记录上下文</b>:这条内容产生于哪次学习会话
|
||||
* 或复习行为,用于界面按来源分组。</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Data
|
||||
public class ReviewFeedItem {
|
||||
private Integer id;
|
||||
private String sessionNum;
|
||||
|
||||
/** REPORT | FRAGMENT */
|
||||
private String sourceType;
|
||||
|
||||
/** 内容归属的任务编号;碎片待归类时为 null */
|
||||
private String taskNum;
|
||||
|
||||
private String taskName;
|
||||
private String sourceType; // REPORT | FRAGMENT
|
||||
|
||||
private String content;
|
||||
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
/** 仅碎片有意义:内容归属为空,等待归类 */
|
||||
private boolean pendingOwnership;
|
||||
|
||||
/** 记录上下文类型:SESSION | REVIEW */
|
||||
private String contextType;
|
||||
|
||||
/** 记录上下文编号:学习会话编号或复习行为编号 */
|
||||
private String contextNum;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.guo.learningprogresstracker.dto;
|
||||
|
||||
import com.guo.learningprogresstracker.entity.StudyReportFragmentsEntity;
|
||||
import com.guo.learningprogresstracker.entity.StudyReportsEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 学习报告详情(归属-01:结构化报告)。
|
||||
*
|
||||
* <p>报告由四部分组成,其中前三部分是落库的文本,第四部分是<b>实时聚合</b>出来的视图:</p>
|
||||
* <ol>
|
||||
* <li>会话摘要</li>
|
||||
* <li>预期达成判断</li>
|
||||
* <li>按内容归属分组的碎片 —— 查看时按碎片的<b>当前</b>归属聚合,不落库。
|
||||
* 这样它与标准导图的取材口径始终一致,不会出现「报告说属于甲、导图放在乙」。</li>
|
||||
* <li>自由总结</li>
|
||||
* </ol>
|
||||
*/
|
||||
@Data
|
||||
public class StudyReportDetail {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/** 产生这份报告的会话 */
|
||||
private String sessionNum;
|
||||
|
||||
/** 产生这份报告的会话所属任务(报告按会话生成,这是「这次学习属于哪个任务」) */
|
||||
private String sessionTaskNum;
|
||||
|
||||
private String sessionTaskName;
|
||||
|
||||
/** 会话对应的学习预期 */
|
||||
private String sessionExpectation;
|
||||
|
||||
@Schema(description = "会话摘要:这次实际学了什么")
|
||||
private String sessionSummary;
|
||||
|
||||
@Schema(description = "预期达成判断:对照学习预期得出的结论")
|
||||
private String expectationVerdict;
|
||||
|
||||
@Schema(description = "自由总结:用户对本次学习的叙述")
|
||||
private String freeSummary;
|
||||
|
||||
private java.time.LocalDateTime createdTime;
|
||||
|
||||
@Schema(description = "按当前内容归属分组的碎片")
|
||||
private List<FragmentGroup> fragmentGroups = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 一条碎片按内容归属分组的结果。
|
||||
*/
|
||||
@Data
|
||||
public static class FragmentGroup {
|
||||
|
||||
/** 归属任务编号;null 表示待归类 */
|
||||
private String taskNum;
|
||||
|
||||
private String taskName;
|
||||
|
||||
/** 是否「旁支」:归属不等于本次报告所属会话的任务 */
|
||||
private boolean branch;
|
||||
|
||||
private List<StudyReportFragmentsEntity> fragments = new ArrayList<>();
|
||||
}
|
||||
|
||||
public static StudyReportDetail of(StudyReportsEntity report) {
|
||||
StudyReportDetail detail = new StudyReportDetail();
|
||||
detail.setId(report.getId());
|
||||
detail.setSessionNum(report.getSessionNum());
|
||||
detail.setSessionSummary(report.getSessionSummary());
|
||||
detail.setExpectationVerdict(report.getExpectationVerdict());
|
||||
detail.setFreeSummary(report.getFreeSummary());
|
||||
detail.setCreatedTime(report.getCreatedTime());
|
||||
detail.setSessionExpectation(report.getSessionExpectation());
|
||||
return detail;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.guo.learningprogresstracker.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 删除学习任务的影响范围(归属-01)。
|
||||
*
|
||||
* <p>删除确认弹窗必须分别列出「即将删除」与「即将保留」,避免用户以为删干净了:
|
||||
* 知识碎片会保留下来并进入待归类。</p>
|
||||
*/
|
||||
@Data
|
||||
public class TaskDeletionSummary {
|
||||
|
||||
@Schema(description = "将保留的知识碎片条数(内容归属置空,进入待归类)")
|
||||
private int releasedFragments;
|
||||
|
||||
@Schema(description = "将软删除的学习会话数")
|
||||
private int deletedSessions;
|
||||
|
||||
@Schema(description = "将软删除的学习报告数")
|
||||
private int deletedReports;
|
||||
|
||||
@Schema(description = "将软删除的标准思维导图数")
|
||||
private int deletedMindMaps;
|
||||
|
||||
@Schema(description = "将软删除的回忆记录数")
|
||||
private int deletedRecallRecords;
|
||||
|
||||
@Schema(description = "将软删除的应用场景数")
|
||||
private int deletedApplications;
|
||||
}
|
||||
+2
-2
@@ -9,9 +9,9 @@ import lombok.Data;
|
||||
@Data
|
||||
public class CreateFragmentsRequest {
|
||||
/**
|
||||
* 会话编号
|
||||
* 记录上下文编号:产生这条碎片的学习会话编号(归属-01 起上下文由类型 + 编号共同描述)
|
||||
*/
|
||||
private String sessionNum;
|
||||
private String contextNum;
|
||||
|
||||
/**
|
||||
* 残片内容,学习内容的描述
|
||||
|
||||
+13
-4
@@ -1,13 +1,22 @@
|
||||
package com.guo.learningprogresstracker.dto.request;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* 结束学习会话时提交的学习报告(归属-01 起报告为结构化三段)。
|
||||
*
|
||||
* <p>三段都可为空,但至少要有一段;第四部分「按归属分组的碎片」是实时聚合的视图,不需要提交。</p>
|
||||
*/
|
||||
@Data
|
||||
public class EndedStudySessionRequest {
|
||||
@NotBlank(message = "请填写学习报告内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "会话摘要:这次实际学了什么")
|
||||
private String sessionSummary;
|
||||
|
||||
@Schema(description = "预期达成判断:对照学习预期得出的结论")
|
||||
private String expectationVerdict;
|
||||
|
||||
@Schema(description = "自由总结:用户对本次学习的叙述")
|
||||
private String freeSummary;
|
||||
}
|
||||
|
||||
+8
-4
@@ -1,16 +1,20 @@
|
||||
package com.guo.learningprogresstracker.dto.request;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* 修改知识碎片:只允许改正文与内容归属,记录上下文不可变。
|
||||
*/
|
||||
@Data
|
||||
public class UpdateFragmentsRequest {
|
||||
/**
|
||||
* 残片内容,学习内容的描述
|
||||
* 残片内容(学习内容的描述);为空表示本次不改正文
|
||||
*/
|
||||
@NotBlank(message = "请填写学习内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 内容归属的任务编号;不传表示本次不改归属。
|
||||
* <p>若要清空归属(回到待归类),传空字符串。</p>
|
||||
*/
|
||||
private String ownerTaskNum;
|
||||
}
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.guo.learningprogresstracker.dto.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 修改学习报告的三段文本(归属-01 / 报告-01)。
|
||||
*
|
||||
* <p>不传或传 null 表示本次不改该段;传空字符串表示清空该段。</p>
|
||||
*/
|
||||
@Data
|
||||
public class UpdateStudyReportRequest {
|
||||
|
||||
@Schema(description = "会话摘要:这次实际学了什么")
|
||||
private String sessionSummary;
|
||||
|
||||
@Schema(description = "预期达成判断:对照学习预期得出的结论")
|
||||
private String expectationVerdict;
|
||||
|
||||
@Schema(description = "自由总结:用户对本次学习的叙述")
|
||||
private String freeSummary;
|
||||
}
|
||||
Reference in New Issue
Block a user