题目日志导出

beetlsql3-dev
Mlxa0324 2 years ago
parent 31fc3e8ab9
commit 65c9a91733

@ -88,7 +88,34 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
public PageQuery<TeacherOpenCourseQuestionLog>queryByConditionQuery(PageQuery query){
PageQuery ret = teacherOpenCourseQuestionLogDao.queryByConditionQuery(query);
queryListAfter(ret.getList());
List<TeacherOpenCourseQuestionLog> list = ret.getList();
queryListAfter(list);
Map<Long, List<Student>> studentMap = new HashMap<>();
if (ObjectUtil.isNotEmpty(list)) {
String studentIds = list.stream().map(TeacherOpenCourseQuestionLog::getStudentId).map(Object::toString).collect(joining(","));
List<Student> studentList = studentDao.getByIds(studentIds);
dictParser(studentList);
if (ObjectUtil.isNotEmpty(studentList)) {
studentMap.putAll(studentList.stream().collect(groupingBy(Student::getStudentId)));
}
list.forEach(item -> {
List<Student> students = studentMap.get(item.getStudentId());
if (ObjectUtil.isNotEmpty(students)) {
Student student = students.get(0);
// 学生编号
item.set("studentSn", student.getStudentSn());
item.set("studentName", student.getStudentName());
SchoolClass schoolClass = student.getSchoolClass();
// 班级
if(null != schoolClass) {
item.set("className", schoolClass.getClassName());
}
}
});
}
return ret;
}

@ -2,6 +2,7 @@ package com.ibeetl.jlw.web;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.jlw.Interceptor.SCoreUser;
import cn.jlw.Interceptor.TStudent;
@ -33,10 +34,8 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;
import java.util.*;
import java.util.stream.Collectors;
import static cn.jlw.util.CacheUserUtil.getStudent;
import static com.ibeetl.admin.core.util.ExcelUtil.convertData;
@ -345,6 +344,45 @@ public class TeacherOpenCourseQuestionLogController {
write(resp, filename,"Sheet1", header.values(), convertData(header.keySet(), maps));
}
/**
*
* @param condition
* @return
*/
@SneakyThrows
@GetMapping(API + "/zyDetailExport.do")
public void zyDetailExport(HttpServletResponse resp, TeacherOpenCourseQuestionLogQuery condition) {
/** 构建表头 */
Map<String, String> header = new LinkedHashMap<>(11);
header.put("studentName", "学生姓名");
header.put("studentSn", "学生学号");
header.put("className", "班级");
header.put("questionStem", "题干");
header.put("questionTypeText", "题型");
header.put("teacherOpenCourseQuestionLogAnswer", "我的选项");
header.put("questionAnswer", "答案");
header.put("studentScore", "得分");
List<TeacherOpenCourseQuestionLog> datas = new ArrayList<>();
PageQuery pageQuery = condition.getPageQuery();
condition.setTeacherOpenCourseQuestionLogStatus(1);
condition.setQuestionLogAddType(FINALLY_SUBMIT);
pageQuery.setPageSize(Integer.MAX_VALUE);
pageQuery.setPageNumber(1L);
PageQuery<TeacherOpenCourseQuestionLog> teacherOpenCourseQuestionLogPageQuery = teacherOpenCourseQuestionLogService.queryByConditionQuery(pageQuery);
if (ObjectUtil.isNotEmpty(teacherOpenCourseQuestionLogPageQuery)) {
datas = teacherOpenCourseQuestionLogPageQuery.getList().stream().filter(item -> null != item.get("studentName")).collect(Collectors.toList());
}
List<Map<String, Object>> maps = BeanCopyUtil.baseEntity2MapWithParallel(datas);
String filename = StrUtil.format("题目日志详情-导出 {}.xlsx", DateUtil.now());
write(resp, filename,"Sheet1", header.values(), convertData(header.keySet(), maps));
}
/**
* : <br>
* LOCK

@ -4,9 +4,14 @@ queryByCondition
select
@pageTag(){
t.*
t.*,
ta.student_name,
ta.student_sn,
tb.class_name
@}
from question_log_summary t
inner join student ta on ta.student_id = t.person_id and ta.student_status = 1
inner join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
where 1=1
@//数据权限该sql语句功能点,如果不考虑数据权限,可以删除此行
and #function("questionLogSummary.query")#
@ -96,9 +101,14 @@ queryByConditionQuery
select
@pageTag(){
t.*
t.*,
ta.student_name,
ta.student_sn,
tb.class_name
@}
from question_log_summary t
inner join student ta on ta.student_id = t.person_id and ta.student_status = 1
inner join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
where 1=1
@if(!isEmpty(questionLogSummaryId)){
and t.question_log_summary_id =#questionLogSummaryId#
@ -356,8 +366,13 @@ getQuestionLogSummaryValues
* 根据不为空的参数进行查询
select t.*
select t.*,
ta.student_name,
ta.student_sn,
tb.class_name
from question_log_summary t
inner join student ta on ta.student_id = t.person_id and ta.student_status = 1
inner join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
where 1=1
@if(!isEmpty(questionLogSummaryId)){
and t.question_log_summary_id =#questionLogSummaryId#
@ -425,8 +440,13 @@ getValuesByQuery
* 根据不为空的参数进行查询
select t.*
select t.*,
ta.student_name,
ta.student_sn,
tb.class_name
from question_log_summary t
inner join student ta on ta.student_id = t.person_id and ta.student_status = 1
inner join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
where 1=1 and #function("questionLogSummary.query")#
@if(!isEmpty(questionLogSummaryId)){
and t.question_log_summary_id =#questionLogSummaryId#
@ -513,8 +533,13 @@ getValuesByQueryNotWithPermission
* 根据不为空的参数进行查询(不包含权限)
select t.*
select t.*,
ta.student_name,
ta.student_sn,
tb.class_name
from question_log_summary t
inner join student ta on ta.student_id = t.person_id and ta.student_status = 1
inner join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
where 1=1
@if(!isEmpty(questionLogSummaryId)){
and t.question_log_summary_id =#questionLogSummaryId#

Loading…
Cancel
Save