|
|
@ -41,6 +41,7 @@ import org.springframework.util.ResourceUtils; |
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -56,6 +57,9 @@ import java.util.stream.Collectors; |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> implements ICoursesService { |
|
|
|
public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> implements ICoursesService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private CourseObjectivesServiceImpl objectivesService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
CoursesMapper coursesMapper; |
|
|
|
CoursesMapper coursesMapper; |
|
|
|
|
|
|
|
|
|
|
@ -286,15 +290,70 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl |
|
|
|
//查询课程通过课程id查--课程简介
|
|
|
|
//查询课程通过课程id查--课程简介
|
|
|
|
Courses courses = this.getById(id); |
|
|
|
Courses courses = this.getById(id); |
|
|
|
System.out.println("课程:"+courses); |
|
|
|
System.out.println("课程:"+courses); |
|
|
|
Map<String,Object> params = new HashMap<String,Object>(); |
|
|
|
//准备数据
|
|
|
|
params.put("name",courses.getName()); |
|
|
|
String course_name = courses.getName(); |
|
|
|
params.put("code",courses.getCode()); |
|
|
|
String course_code = courses.getCode(); |
|
|
|
params.put("nature",courses.getNature()); |
|
|
|
String course_nature = courses.getNature(); |
|
|
|
params.put("credit",courses.getCredit()); |
|
|
|
BigDecimal course_credit = courses.getCredit(); |
|
|
|
params.put("classhour",courses.getClasshours()); |
|
|
|
Integer course_classhour = courses.getClasshours(); |
|
|
|
params.put("description",courses.getDescription()); |
|
|
|
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); |
|
|
|
XWPFDocument xwpfDocument = WordExportUtil.exportWord07(templatePath.getPath(), params); |
|
|
|