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 17e9b49..b845e09 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 @@ -54,7 +54,7 @@ public class LessonPlanController { Integer wordSize = addLessonPlanReqVO.getWordSize(); try { if (redisTemplate.opsForValue().get(LessonPlanConstant.buildGeneratePlanContent(studentId)) != null) { - throw new RuntimeException("学案正常生成中"); + throw new RuntimeException("学案正在生成,请耐心等待"); } taskExecutor.execute(() -> lessonPlanService.generateLessonPlans(studentId, unitId, wordSize)); return Response.success("生成学案成功,请等待 10 分钟"); 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 aefc8f0..ad603fa 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 @@ -5,6 +5,7 @@ import com.yinlihupo.enlish.service.constant.LessonPlanConstant; import com.yinlihupo.enlish.service.domain.dataobject.*; import com.yinlihupo.enlish.service.domain.mapper.*; import com.yinlihupo.enlish.service.model.bo.Sentence; +import com.yinlihupo.enlish.service.model.bo.Word; import com.yinlihupo.enlish.service.service.LessonPlansService; import com.yinlihupo.enlish.service.utils.DifyClient; import com.yinlihupo.enlish.service.utils.StringToPlanMapUtil; @@ -55,7 +56,7 @@ public class LessonPlansServiceImpl implements LessonPlansService { public void generateLessonPlans(Integer studentId, Integer unitId, Integer wordSize) { String key = LessonPlanConstant.buildGeneratePlanContent(studentId); redisTemplate.opsForValue().set(key, studentId); - redisTemplate.expire( key, 12, TimeUnit.MINUTES); + redisTemplate.expire(key, 7, TimeUnit.MINUTES); log.info("开始生成计划"); List vocabularyBankDOS = vocabularyBankDOMapper.selectVocabularyBankDOAllByUnitId(unitId); @@ -249,7 +250,7 @@ public class LessonPlansServiceImpl implements LessonPlansService { List checkList, int day, GradeDO gradeDO, UnitDO unitDO, Integer studentId) throws Exception { - String title = gradeDO.getTitle() + " " + unitDO.getTitle() + " " + "第" + day + "天" + studentId; + String title = gradeDO.getTitle() + " " + unitDO.getTitle() + " " + "第" + day + "天"; Map data = new HashMap<>(); data.put("title", title); data.put("syncVocabList", syncVocabList); @@ -259,13 +260,16 @@ public class LessonPlansServiceImpl implements LessonPlansService { data.put("checkListAns", checkList); // 中译英 - List drillRound1 = new ArrayList<>(syncVocabList); + List list = syncVocabList.stream().map(vocabularyBankDO -> Word.builder().title(vocabularyBankDO.getWord()).definition(vocabularyBankDO.getDefinition()).build()).toList(); + list.forEach(word -> word.setTitle(" ")); + + List drillRound1 = new ArrayList<>(list); Collections.shuffle(drillRound1); data.put("drillRound1", drillRound1); - List drillRound2 = new ArrayList<>(syncVocabList); + List drillRound2 = new ArrayList<>(list); Collections.shuffle(drillRound2); data.put("drillRound2", drillRound2); - List drillRound3 = new ArrayList<>(syncVocabList); + List drillRound3 = new ArrayList<>(list); Collections.shuffle(drillRound3); data.put("drillRound3", drillRound3); @@ -274,8 +278,10 @@ public class LessonPlansServiceImpl implements LessonPlansService { mixedDrill.addAll(syncVocabList); mixedDrill.addAll(gapVocabList); mixedDrill.addAll(reviewVocabList); - Collections.shuffle(mixedDrill); - data.put("mixedDrill", mixedDrill); + List mixedList = new ArrayList<>(mixedDrill.stream().map(vocabularyBankDO -> Word.builder().title(vocabularyBankDO.getWord()).definition(vocabularyBankDO.getDefinition()).build()).toList()); + mixedList.forEach(word -> word.setDefinition(" ")); + Collections.shuffle(mixedList); + data.put("mixedDrill", mixedList); // 文章 A log.info("生成文章 A 中文开始"); diff --git a/enlish-service/src/main/resources/templates/tem_study_plan_v6.docx b/enlish-service/src/main/resources/templates/tem_study_plan_v6.docx index 4b48921..508397f 100644 Binary files a/enlish-service/src/main/resources/templates/tem_study_plan_v6.docx and b/enlish-service/src/main/resources/templates/tem_study_plan_v6.docx differ