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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user