课程标准-课程目标导出word

master
wenyu441069198 5 months ago
parent 9789bdbfde
commit 12529131ce
  1. 12
      src/main/java/com/teaching/backend/controller/records/LearningRecordsController.java
  2. 2
      src/main/java/com/teaching/backend/model/entity/records/LearningRecords.java
  3. 20
      src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java
  4. 3
      src/main/java/com/teaching/backend/service/impl/records/LearningRecordsServiceImpl.java
  5. BIN
      src/main/resources/img/v2-c57eb7863ec4233f503176ca3f90f8d5_1440w.png
  6. BIN
      src/main/resources/templates/courses.docx

@ -43,13 +43,13 @@ public class LearningRecordsController {
long total = cs.size(); // 总记录数 long total = cs.size(); // 总记录数
Page<LearningRecordsVo> pageInfo = new Page<>(pagenum,pagesize,total); Page<LearningRecordsVo> pageInfo = new Page<>(pagenum,pagesize,total);
pageInfo.setRecords(pageCs); pageInfo.setRecords(pageCs);
System.out.println("总记录数"+pageInfo.getTotal()); // System.out.println("总记录数"+pageInfo.getTotal());
System.out.println("当前页面:"+pagenum); // System.out.println("当前页面:"+pagenum);
System.out.println("当前页面大小:"+pagesize); // System.out.println("当前页面大小:"+pagesize);
System.out.println("当前页面内容:"+pageCs); // System.out.println("当前页面内容:"+pageCs);
System.out.println("页面数:"+pageInfo.getPages()); // System.out.println("页面数:"+pageInfo.getPages());
pageInfo.setPages((int)(Math.ceil((double) total / pagesize)));//设置总页数 pageInfo.setPages((int)(Math.ceil((double) total / pagesize)));//设置总页数
System.out.println(pageInfo.getPages()); // System.out.println(pageInfo.getPages());
return ResultUtils.success(pageInfo); return ResultUtils.success(pageInfo);
} }

@ -60,7 +60,7 @@ public class LearningRecords {
private String download; private String download;
/** /**
*视频学习时长 *视频学习时长
*/ *
private String videoDuration; private String videoDuration;
/** /**

@ -26,6 +26,8 @@ import com.teaching.backend.model.vo.courses.CoursesVO;
import com.teaching.backend.service.courses.ICoursesService; import com.teaching.backend.service.courses.ICoursesService;
import com.teaching.backend.utils.CourseCode; import com.teaching.backend.utils.CourseCode;
import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -123,7 +125,6 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
} else { } else {
throw new BusinessException(ErrorCode.OPERATION_ERROR, "这个课程已经存在了!请联系系统相关人员为您导入课程数据!"); throw new BusinessException(ErrorCode.OPERATION_ERROR, "这个课程已经存在了!请联系系统相关人员为您导入课程数据!");
} }
} }
@Override @Override
@ -341,7 +342,7 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
//总目标 //总目标
StringBuilder overall_goal = new StringBuilder(); StringBuilder overall_goal = new StringBuilder();
for (ObjectiveContents content : courseObjectivesTreeVO.get(0).getContents()) { for (ObjectiveContents content : courseObjectivesTreeVO.get(0).getContents()) {
overall_goal.append(content.getContent()); overall_goal.append("\r\n").append(content.getContent());
} }
System.out.println(overall_goal); System.out.println(overall_goal);
@ -350,24 +351,26 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
StringBuilder knowledge_goals = new StringBuilder(); StringBuilder knowledge_goals = new StringBuilder();
StringBuilder political_goals = new StringBuilder(); StringBuilder political_goals = new StringBuilder();
StringBuilder value_goals = new StringBuilder(); StringBuilder value_goals = new StringBuilder();
for (int i = 0; i < courseObjectivesTreeVO.get(0).getCourseObjectivesTrees().size(); i++){ for (int i = 0; i < courseObjectivesTreeVO.get(0).getCourseObjectivesTrees().size(); i++){
CourseObjectivesTreeVO content = courseObjectivesTreeVO.get(0).getCourseObjectivesTrees().get(i); CourseObjectivesTreeVO content = courseObjectivesTreeVO.get(0).getCourseObjectivesTrees().get(i);
//知识目标 //知识目标
if (i == 0){ if (i == 0){
for (ObjectiveContents c : content.getContents()) { for (ObjectiveContents c : content.getContents()) {
knowledge_goals.append(c.getContent()).append("\n"); knowledge_goals.append("\r\n").append(c.getContent());
} }
} }
//思政目标 //思政目标
if (i == 1){ if (i == 1){
for (ObjectiveContents c : content.getContents()) { for (ObjectiveContents c : content.getContents()) {
political_goals.append(c.getContent()).append("\n"); political_goals.append("\r\n").append(c.getContent());
} }
} }
//价值目标 //价值目标
if (i == 2){ if (i == 2){
for (ObjectiveContents c : content.getContents()) { for (ObjectiveContents c : content.getContents()) {
value_goals.append(c.getContent()).append("\n"); value_goals.append("\r\n").append(c.getContent());
} }
} }
} }
@ -389,8 +392,13 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
params.put("political_goals", political_goals); params.put("political_goals", political_goals);
params.put("value_goals", value_goals); params.put("value_goals", value_goals);
//导出图片
params.put("img","wyii\t");
//根据模板+数据 导出文档 //根据模板+数据 导出文档
XWPFDocument xwpfDocument = WordExportUtil.exportWord07(templatePath.getPath(), params); XWPFDocument xwpfDocument = WordExportUtil.exportWord07(templatePath.getPath(), params);

@ -106,6 +106,7 @@ public class LearningRecordsServiceImpl extends ServiceImpl<LearningRecordsMappe
System.out.println(); System.out.println();
learningRecordsVo.setCoursesName(coursesService.getById(learningRecords.getCoursesId()).getName()); learningRecordsVo.setCoursesName(coursesService.getById(learningRecords.getCoursesId()).getName());
break; break;
} }
//添加观看人数 //添加观看人数
//统计记录表里有多少人查看过这门资源 //统计记录表里有多少人查看过这门资源
@ -142,7 +143,7 @@ public class LearningRecordsServiceImpl extends ServiceImpl<LearningRecordsMappe
learningRecords.setAccessTime(LocalDateTime.now()); learningRecords.setAccessTime(LocalDateTime.now());
//设置默认封面 //设置默认封面
if (learningRecords.getContent() == null || learningRecords.getContent().equals("")){ if (learningRecords.getContent() == null || learningRecords.getContent().equals("")){
learningRecords.setContent("https://teaching-edu123.oss-cn-beijing.aliyuncs.com/Borovets_ZH-CN5914681811_UHD.jpg"); learningRecords.setContent("img/v2-c57eb7863ec4233f503176ca3f90f8d5_1440w.png");
} }
// //添加记录封面 // //添加记录封面
// switch (learningRecords.getType()) { // switch (learningRecords.getType()) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Loading…
Cancel
Save