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

master
wenyu441069198 5 months ago
parent 00238731ba
commit b3e8d5e6f7
  1. 2
      src/main/java/com/teaching/backend/controller/courses/CourseObjectivesController.java
  2. 73
      src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java
  3. BIN
      src/main/resources/templates/courses.docx

@ -67,7 +67,7 @@ public class CourseObjectivesController {
@ApiOperation("查询课程目标内容")
@GetMapping("/list/{id}")
public BaseResponse<List<CourseObjectivesTreeVO>> queryCourseObjectivesTree(@PathVariable String id){
List<CourseObjectivesTreeVO> courseObjectivesTreeVO = courseObjectivesService.queryCourseObjectivesTree(id);
List<CourseObjectivesTreeVO> courseObjectivesTreeVO = courseObjectivesService.queryCourseObjectivesTree(id);
return ResultUtils.success(courseObjectivesTreeVO);
}

@ -41,6 +41,7 @@ import org.springframework.util.ResourceUtils;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@ -56,6 +57,9 @@ import java.util.stream.Collectors;
@Service
public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> implements ICoursesService {
@Autowired
private CourseObjectivesServiceImpl objectivesService;
@Autowired
CoursesMapper coursesMapper;
@ -286,15 +290,70 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
//查询课程通过课程id查--课程简介
Courses courses = this.getById(id);
System.out.println("课程:"+courses);
Map<String,Object> params = new HashMap<String,Object>();
params.put("name",courses.getName());
params.put("code",courses.getCode());
params.put("nature",courses.getNature());
params.put("credit",courses.getCredit());
params.put("classhour",courses.getClasshours());
params.put("description",courses.getDescription());
//准备数据
String course_name = courses.getName();
String course_code = courses.getCode();
String course_nature = courses.getNature();
BigDecimal course_credit = courses.getCredit();
Integer course_classhour = courses.getClasshours();
String course_description = courses.getDescription();
//查询课程目标
List<CourseObjectivesTreeVO> courseObjectivesTreeVO = objectivesService.queryCourseObjectivesTree(id);
System.out.println("课程目标:"+courseObjectivesTreeVO);
//准备数据
//总目标
StringBuilder overall_goal = new StringBuilder();
for (ObjectiveContents content : courseObjectivesTreeVO.get(0).getContents()) {
overall_goal.append(content.getContent());
}
System.out.println(overall_goal);
//分项目标
//知识目标
StringBuilder knowledge_goals = new StringBuilder();
StringBuilder political_goals = new StringBuilder();
StringBuilder value_goals = new StringBuilder();
for (int i = 0; i < courseObjectivesTreeVO.get(0).getCourseObjectivesTrees().size(); i++){
CourseObjectivesTreeVO content = courseObjectivesTreeVO.get(0).getCourseObjectivesTrees().get(i);
//知识目标
if (i == 0){
for (ObjectiveContents c : content.getContents()) {
knowledge_goals.append(c.getContent()).append("\n");
}
}
//思政目标
if (i == 1){
for (ObjectiveContents c : content.getContents()) {
political_goals.append(c.getContent()).append("\n");
}
}
//价值目标
if (i == 2){
for (ObjectiveContents c : content.getContents()) {
value_goals.append(c.getContent()).append("\n");
}
}
}
System.out.println("知识目标:"+knowledge_goals);
System.out.println("思政目标:"+political_goals);
System.out.println("价值目标:"+value_goals);
Map<String,Object> params = new HashMap<String,Object>();
params.put("course_name",course_name);
params.put("course_code",course_code);
params.put("course_nature",course_nature);
params.put("course_credit",course_credit);
params.put("course_classhour",course_classhour);
params.put("course_description",course_description);
//课程目标
params.put("overall_goal", overall_goal);
params.put("knowledge_goals", knowledge_goals);
params.put("political_goals", political_goals);
params.put("value_goals", value_goals);
//根据模板+数据 导出文档
XWPFDocument xwpfDocument = WordExportUtil.exportWord07(templatePath.getPath(), params);

Loading…
Cancel
Save