diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/config/SaTokenConfigure.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/config/SaTokenConfigure.java index 8d2bb3a..42db809 100644 --- a/enlish-service/src/main/java/com/yinlihupo/enlish/service/config/SaTokenConfigure.java +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/config/SaTokenConfigure.java @@ -37,6 +37,7 @@ public class SaTokenConfigure implements WebMvcConfigurer { .notMatch("/student/mastery/detail") .notMatch("/unit/list") .notMatch("/vocabulary/list") + .notMatch("/vocabulary/student/detail") .notMatch("/plan/download") .notMatch("/login/**") .check(r -> StpUtil.checkLogin()); diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/controller/LessonPlanController.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/controller/LessonPlanController.java index 971581e..600ed99 100644 --- a/enlish-service/src/main/java/com/yinlihupo/enlish/service/controller/LessonPlanController.java +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/controller/LessonPlanController.java @@ -41,8 +41,9 @@ public class LessonPlanController { public Response generateLessonPlan(@RequestBody AddLessonPlanReqVO addLessonPlanReqVO) { Integer studentId = addLessonPlanReqVO.getStudentId(); Integer unitId = addLessonPlanReqVO.getUnitId(); + Integer wordSize = addLessonPlanReqVO.getWordSize(); try { - taskExecutor.execute(() -> lessonPlanService.generateLessonPlans(studentId, unitId)); + taskExecutor.execute(() -> lessonPlanService.generateLessonPlans(studentId, unitId, wordSize)); return Response.success("生成学案成功,请等待 10 分钟"); } catch (Exception e) { log.error(e.getMessage()); diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/controller/VocabularyController.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/controller/VocabularyController.java index b7bbcf4..ec34f18 100644 --- a/enlish-service/src/main/java/com/yinlihupo/enlish/service/controller/VocabularyController.java +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/controller/VocabularyController.java @@ -1,6 +1,8 @@ package com.yinlihupo.enlish.service.controller; import com.yinlihupo.enlish.service.domain.dataobject.VocabularyBankDO; +import com.yinlihupo.enlish.service.model.vo.vocabulary.FindStudentWordDetailReqVO; +import com.yinlihupo.enlish.service.model.vo.vocabulary.FindStudentWordDetailRspVO; import com.yinlihupo.enlish.service.model.vo.vocabulary.FindWordTitleReqVO; import com.yinlihupo.enlish.service.model.vo.vocabulary.FindWordTitleRspVO; import com.yinlihupo.enlish.service.service.VocabularyService; @@ -30,4 +32,11 @@ public class VocabularyController { .build(); return Response.success(findWordTitleRspVO); } + + @PostMapping("student/detail") + @ApiOperationLog(description = "查询学生单词详情") + public Response findStudentWordDetail(@RequestBody FindStudentWordDetailReqVO vo) { + return Response.success(vocabularyService.findStudentWordDetail(vo.getId())); + } + } diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/mapper/WordMasteryLogDOMapper.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/mapper/WordMasteryLogDOMapper.java index 67d78e8..202c4fd 100644 --- a/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/mapper/WordMasteryLogDOMapper.java +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/domain/mapper/WordMasteryLogDOMapper.java @@ -20,4 +20,8 @@ public interface WordMasteryLogDOMapper { List selectByStudentIdAndLimitTime(@Param("studentId") Integer studentId); List selectAllByStudentId(@Param("studentId") Integer studentId); + + Integer selectMasteryCount(@Param("studentId") Integer studentId); + + Integer selectNotMasteryCount(@Param("studentId") Integer studentId); } \ No newline at end of file diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/model/vo/plan/AddLessonPlanReqVO.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/model/vo/plan/AddLessonPlanReqVO.java index ea61616..7c6a6c9 100644 --- a/enlish-service/src/main/java/com/yinlihupo/enlish/service/model/vo/plan/AddLessonPlanReqVO.java +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/model/vo/plan/AddLessonPlanReqVO.java @@ -13,4 +13,5 @@ public class AddLessonPlanReqVO { private Integer studentId; private Integer unitId; + private Integer wordSize; } diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/model/vo/vocabulary/FindStudentWordDetailReqVO.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/model/vo/vocabulary/FindStudentWordDetailReqVO.java new file mode 100644 index 0000000..c355b33 --- /dev/null +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/model/vo/vocabulary/FindStudentWordDetailReqVO.java @@ -0,0 +1,15 @@ +package com.yinlihupo.enlish.service.model.vo.vocabulary; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@AllArgsConstructor +@NoArgsConstructor +@Data +@Builder +public class FindStudentWordDetailReqVO { + + private Integer id; +} diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/model/vo/vocabulary/FindStudentWordDetailRspVO.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/model/vo/vocabulary/FindStudentWordDetailRspVO.java new file mode 100644 index 0000000..ca51246 --- /dev/null +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/model/vo/vocabulary/FindStudentWordDetailRspVO.java @@ -0,0 +1,27 @@ +package com.yinlihupo.enlish.service.model.vo.vocabulary; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@AllArgsConstructor +@NoArgsConstructor +@Builder +@Data +public class FindStudentWordDetailRspVO { + /** + * 已掌握单词数 + */ + private Integer masteredWordCount; + + /** + * 未掌握单词数 + */ + private Integer unmasteredWordCount; + + /** + * 待审查单词数(推荐使用,简洁通用) + */ + private Integer pendingReviewWordCount; +} diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/LessonPlansService.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/LessonPlansService.java index a9431ed..f06db4f 100644 --- a/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/LessonPlansService.java +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/LessonPlansService.java @@ -5,7 +5,7 @@ import com.yinlihupo.enlish.service.domain.dataobject.LessonPlansDO; import java.util.List; public interface LessonPlansService { - void generateLessonPlans(Integer studentId, Integer unitId); + void generateLessonPlans(Integer studentId, Integer unitId, Integer wordSize); List findLessonPlans(List ids); diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/VocabularyService.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/VocabularyService.java index 41f1a23..10f58ab 100644 --- a/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/VocabularyService.java +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/VocabularyService.java @@ -2,10 +2,13 @@ package com.yinlihupo.enlish.service.service; import com.yinlihupo.enlish.service.domain.dataobject.VocabularyBankDO; +import com.yinlihupo.enlish.service.model.vo.vocabulary.FindStudentWordDetailRspVO; import java.util.List; public interface VocabularyService { List findVocabularyBankDOListById(List ids); + + FindStudentWordDetailRspVO findStudentWordDetail(Integer studentId); } diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/plan/LessonPlansServiceImpl.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/plan/LessonPlansServiceImpl.java index b3c80a7..80b02c8 100644 --- a/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/plan/LessonPlansServiceImpl.java +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/plan/LessonPlansServiceImpl.java @@ -37,15 +37,10 @@ public class LessonPlansServiceImpl implements LessonPlansService { @Resource private DifyArticleClient difyArticleClient; - @Value("${templates.plan.weekday}") - private String planWeekday; - @Value("${templates.plan.weekend}") - private String planWeekend; - @Override @Transactional(rollbackFor = Exception.class) - public void generateLessonPlans(Integer studentId, Integer unitId) { + public void generateLessonPlans(Integer studentId, Integer unitId, Integer wordSize) { List vocabularyBankDOS = vocabularyBankDOMapper.selectVocabularyBankDOAllByUnitId(unitId); UnitDO unitDO = unitDOMapper.selectByPrimaryKey(unitId); GradeUnitDO gradeUnitDO = gradeUnitDOMapper.selectByUnitId(unitId); @@ -58,12 +53,19 @@ public class LessonPlansServiceImpl implements LessonPlansService { int countGap = gapSize / 5; int syncSize = vocabularyBankDOS.size(); - int countSync = syncSize / 5; + wordSize = wordSize <= 0 ? syncSize / 5 : wordSize; int checkTotal = 50; List> weeksSync = new ArrayList<>(); List> weeksGap = new ArrayList<>(); for (int i = 0; i < 5; i++) { - List syncVocabList = vocabularyBankDOS.subList(i * countSync, Math.min((i + 1) * countSync, syncSize)); + List syncVocabList; + if ((i + 1) * wordSize < syncSize) { + syncVocabList = vocabularyBankDOS.subList(i * wordSize, (i + 1) * wordSize); + } else if (i == 4) { + syncVocabList = vocabularyBankDOS.subList(i * wordSize, syncSize); + } else { + syncVocabList = vocabularyBankDOS.subList((syncSize - i) * wordSize, Math.min((syncSize - i + 1) * wordSize, syncSize)); + } List gapVocabList = vocabularyBankListStudentNotMaster.subList(i * countGap, Math.min(i * countGap + countGap, gapSize)); weeksSync.add(syncVocabList); weeksGap.add(gapVocabList); diff --git a/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/vocabulary/VocabularyServiceImpl.java b/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/vocabulary/VocabularyServiceImpl.java index 7e52bb5..9aed2be 100644 --- a/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/vocabulary/VocabularyServiceImpl.java +++ b/enlish-service/src/main/java/com/yinlihupo/enlish/service/service/vocabulary/VocabularyServiceImpl.java @@ -2,6 +2,8 @@ package com.yinlihupo.enlish.service.service.vocabulary; import com.yinlihupo.enlish.service.domain.dataobject.VocabularyBankDO; import com.yinlihupo.enlish.service.domain.mapper.VocabularyBankDOMapper; +import com.yinlihupo.enlish.service.domain.mapper.WordMasteryLogDOMapper; +import com.yinlihupo.enlish.service.model.vo.vocabulary.FindStudentWordDetailRspVO; import com.yinlihupo.enlish.service.service.VocabularyService; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; @@ -14,9 +16,19 @@ public class VocabularyServiceImpl implements VocabularyService { @Resource private VocabularyBankDOMapper vocabularyBankDOMapper; + @Resource + private WordMasteryLogDOMapper wordMasteryLogDOMapper; @Override public List findVocabularyBankDOListById(List ids) { return vocabularyBankDOMapper.selectVocabularyBankDOListByIds(ids); } + + @Override + public FindStudentWordDetailRspVO findStudentWordDetail(Integer studentId) { + Integer wordMastery = wordMasteryLogDOMapper.selectMasteryCount(studentId); + Integer wordNotMastery = wordMasteryLogDOMapper.selectNotMasteryCount(studentId); + Integer total = vocabularyBankDOMapper.selectWordTotal(); + return FindStudentWordDetailRspVO.builder().masteredWordCount(wordMastery).unmasteredWordCount(wordNotMastery).pendingReviewWordCount(total - wordMastery - wordNotMastery).build(); + } } diff --git a/enlish-service/src/main/resources/config/application-dev.yml b/enlish-service/src/main/resources/config/application-dev.yml index 99f6bd8..86fc7de 100644 --- a/enlish-service/src/main/resources/config/application-dev.yml +++ b/enlish-service/src/main/resources/config/application-dev.yml @@ -26,7 +26,7 @@ templates: count: 100 data: C:\project\tess plan: - weekday: C:\project\java\enlish_edu\enlish\enlish-service\src\main\resources\templates\tem_study_plan_v1.docx + weekday: C:\project\java\enlish_edu\enlish\enlish-service\src\main\resources\templates\tem_study_plan_v2.docx weekend: C:\project\java\enlish_edu\enlish\enlish-service\src\main\resources\templates\study_plan_review_v1.docx plan_day: 7 tmp: diff --git a/enlish-service/src/main/resources/mapper/VocabularyBankDOMapper.xml b/enlish-service/src/main/resources/mapper/VocabularyBankDOMapper.xml index 04acfc1..4d5ec67 100644 --- a/enlish-service/src/main/resources/mapper/VocabularyBankDOMapper.xml +++ b/enlish-service/src/main/resources/mapper/VocabularyBankDOMapper.xml @@ -94,7 +94,7 @@ and id in ( select word_id from word_mastery_log - where memory_strength < 0 + where memory_strength <= 0 and student_id = #{studentId} ) ]]> diff --git a/enlish-service/src/main/resources/mapper/WordMasteryLogDOMapper.xml b/enlish-service/src/main/resources/mapper/WordMasteryLogDOMapper.xml index 5250858..4e5c58e 100644 --- a/enlish-service/src/main/resources/mapper/WordMasteryLogDOMapper.xml +++ b/enlish-service/src/main/resources/mapper/WordMasteryLogDOMapper.xml @@ -22,6 +22,7 @@ order by memory_strength desc limit #{limit} + + + + + + + \ No newline at end of file diff --git a/enlish-service/src/main/resources/templates/tem_study_plan_v2.docx b/enlish-service/src/main/resources/templates/tem_study_plan_v2.docx new file mode 100644 index 0000000..4365beb Binary files /dev/null and b/enlish-service/src/main/resources/templates/tem_study_plan_v2.docx differ diff --git a/enlish-service/src/test/java/com/yinlihupo/enlish/service/service/plan/PlanTest.java b/enlish-service/src/test/java/com/yinlihupo/enlish/service/service/plan/PlanTest.java index 371b8eb..02cd806 100644 --- a/enlish-service/src/test/java/com/yinlihupo/enlish/service/service/plan/PlanTest.java +++ b/enlish-service/src/test/java/com/yinlihupo/enlish/service/service/plan/PlanTest.java @@ -13,6 +13,6 @@ public class PlanTest { @Test public void test() { - lessonPlansService.generateLessonPlans(2, 146); + } } diff --git a/enlish-vue/src/api/plan.js b/enlish-vue/src/api/plan.js index b192194..44aa105 100644 --- a/enlish-vue/src/api/plan.js +++ b/enlish-vue/src/api/plan.js @@ -1,9 +1,10 @@ import axios from "@/axios"; -export function generateLessonPlan(studentId, unitId) { +export function generateLessonPlan(studentId, unitId, wordSize = 0) { return axios.post('/plan/generate', { studentId: studentId, - unitId: unitId + unitId: unitId, + wordSize: wordSize }) } diff --git a/enlish-vue/src/api/words.js b/enlish-vue/src/api/words.js index 97cffa7..acdb396 100644 --- a/enlish-vue/src/api/words.js +++ b/enlish-vue/src/api/words.js @@ -4,4 +4,10 @@ export function getWordsListByIds(ids) { return axios.post('/vocabulary/list', { ids: ids }) -} \ No newline at end of file +} + +export function getWordStudentDetail(studentId) { + return axios.post('/vocabulary/student/detail', { + id: studentId + }) +} diff --git a/enlish-vue/src/layouts/components/LessonPlanDialog.vue b/enlish-vue/src/layouts/components/LessonPlanDialog.vue index 3f9b9a4..3932be0 100644 --- a/enlish-vue/src/layouts/components/LessonPlanDialog.vue +++ b/enlish-vue/src/layouts/components/LessonPlanDialog.vue @@ -12,6 +12,9 @@ /> + + +
学生ID:{{ studentId }} @@ -45,6 +48,7 @@ const visible = computed({ const loading = ref(false) const unitId = ref(null) +const wordSize = ref(0) const unitOptions = ref([]) async function fetchUnits() { @@ -63,7 +67,7 @@ async function fetchUnits() { async function handleGenerate() { if (!unitId.value || !props.studentId) return - const res = await generateLessonPlan(Number(props.studentId), Number(unitId.value)) + const res = await generateLessonPlan(Number(props.studentId), Number(unitId.value), Number(wordSize.value)) const d = res?.data if (d.success) { ElMessage.success('生成学案任务已提交,请等待十分钟') diff --git a/enlish-vue/src/pages/student.vue b/enlish-vue/src/pages/student.vue index 13cdf0b..a29a9cb 100644 --- a/enlish-vue/src/pages/student.vue +++ b/enlish-vue/src/pages/student.vue @@ -6,8 +6,7 @@ -
+
学生详情
+
+
学生词汇统计
+ + +
+
学生考试记录
@@ -63,6 +76,7 @@ import { ref, onMounted, computed } from 'vue' import { useRoute } from 'vue-router' import { getStudentDetail, getStudentStudyAnalyze } from '@/api/student' import { getStudentExamHistory } from '@/api/exam' +import { getWordStudentDetail } from '@/api/words' import ExamHistoryChart from '@/layouts/components/student/ExamHistoryChart.vue' import PlanHistoryChart from '@/layouts/components/student/PlanHistoryChart.vue' import WordMasteryHeatmap from '@/layouts/components/student/WordMasteryHeatmap.vue' @@ -74,6 +88,7 @@ const route = useRoute() const history = ref([]) const analyzeLoading = ref(false) const analysisText = ref('') +const wordStat = ref(null) const md = new MarkdownIt({ html: false, linkify: true, @@ -122,8 +137,17 @@ async function fetchStudyAnalyze() { } } +async function fetchWordStat() { + const id = route.params.id + if (!id) return + const res = await getWordStudentDetail(Number(id)) + const d = res.data + wordStat.value = d?.data || null +} + onMounted(() => { fetchDetail() fetchExamHistory() + fetchWordStat() })