系统考证辅导,考后详情

beetlsql3-dev
Mlxa0324
parent 67e86668e1
commit 0cd9cc4b2a

@ -0,0 +1,160 @@
package com.ibeetl.jlw.entity;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.ibeetl.admin.core.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.beetl.sql.annotation.entity.Auto;
import org.beetl.sql.annotation.entity.Table;
import org.beetl.sql.fetch.annotation.Fetch;
import org.beetl.sql.fetch.annotation.FetchSql;
import java.util.List;
/**
* ---
* @author mlx
*/
@Data
@Fetch
@EqualsAndHashCode(callSuper=false)
@SuppressWarnings("ALL")
@Table(name = "general_question_log")
public class GeneralQuestionLogScoreInfo extends BaseEntity {
// BeetlSQL Fetch 对ID有要求这里搞个占位字段
@Auto
private Long generalQuestionLogId ;
/** ========================================================================= */
/** ========== 这部分数据需要通过BeetlSQL来查询才能自动触发FetchSql 注解 ========== */
// 开课题目设置ID
private Long generalQuestionSettingId;
// 学生ID
private Long studentId;
// @FetchOne("studentId")
// @DictDeep
// private Student studentInfo;
/** ========================================================================= */
// 题目总数量
@FetchSql("select count(1) from general_question_log t " +
"where 1 = 1 " +
"and t.general_question_log_status = 1 \n" +
"@if(!isEmpty(studentId)) { \n" +
"and t.student_id = #studentId# \n" +
"@} \n" +
"and t.general_question_setting_id = #generalQuestionSettingId# "
)
private Integer questionTotalCount;
// 答对数量
@FetchSql("select count(1) from general_question_log t " +
"where 1 = 1 " +
"and t.general_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" +
"@if(!isEmpty(studentId)) { \n" +
"and t.student_id = #studentId# \n" +
"@} \n" +
"and t.general_question_setting_id = #generalQuestionSettingId# " +
"and t.general_question_log_answer = t.question_answer "
)
private Integer correctCount;
// 答错数量
@FetchSql("select count(1) from general_question_log t " +
"where t.general_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" +
"@if(!isEmpty(studentId)) { \n" +
"and t.student_id = #studentId# \n" +
"@} \n" +
"and t.general_question_setting_id = #generalQuestionSettingId# " +
"and t.general_question_log_answer != t.question_answer "
)
private Integer wrongCount;
// 总得分
@FetchSql("select sum(IFNULL(t.question_score, 0)) as total_score " +
"from general_question_log t " +
"where t.general_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" +
"@if(!isEmpty(studentId)) { \n" +
"and t.student_id = #studentId# \n" +
"@} \n" +
"and t.general_question_setting_id = #generalQuestionSettingId# " +
"and t.general_question_log_answer = t.question_answer "
)
private float totalScore;
// 正确率 最大100
// 自动计算得到
private float correctRate;
@FetchSql(value = "SELECT t.* " +
"FROM general_question_log t " +
"WHERE t.general_question_log_status = 1 \n" +
"@if(!isEmpty(studentId)) { \n" +
"and t.student_id = #studentId# \n" +
"@} \n" +
"and t.general_question_setting_id = #generalQuestionSettingId# "
)
private List<GeneralQuestionLog> questionLogList;
/**
*
*/
@FetchSql(value = "SELECT max(TIMEDIFF( t.general_question_log_update_time , t.general_question_log_add_time )) as finish_time " +
"FROM general_question_log t " +
"WHERE t.general_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" +
"@if(!isEmpty(studentId)) { \n" +
"and t.student_id = #studentId# \n" +
"@} \n" +
"and t.general_question_setting_id = #generalQuestionSettingId# " +
"AND t.general_question_log_update_time IS NOT NULL "
)
private String finishTime;
// /**
// * 完成用时 的第二种实现
// */
// @FetchSql(value = "SELECT max(ifnull(t.general_question_log_finish_time , 0)) as finish_time " +
// "FROM general_question_log t " +
// "WHERE t.general_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" +
// "@if(!isEmpty(studentId)) { \n" +
// "and t.student_id = #studentId# \n" +
// "@} \n" +
// "and t.general_question_setting_id = #generalQuestionSettingId# " +
// "AND t.general_question_log_update_time IS NOT NULL "
// )
// private String finishTime;
public void setCorrectCount(Integer correctCount) {
this.correctCount = correctCount;
tryCalcCorrectRate();
}
public void setWrongCount(Integer wrongCount) {
this.wrongCount = wrongCount;
tryCalcCorrectRate();
}
public void setQuestionTotalCount(Integer questionTotalCount) {
this.questionTotalCount = questionTotalCount;
tryCalcCorrectRate();
}
/**
*
*/
private void tryCalcCorrectRate() {
if (ObjectUtil.isAllNotEmpty(getCorrectCount(), getWrongCount(), getQuestionTotalCount())) {
// 计算正确率, 取小数点后2位数
// 计算规则:正确率 = 正确数量 / (正确数量 + 错误数量) * 100
this.setCorrectRate(NumberUtil.round(((float)getCorrectCount() / getQuestionTotalCount()) * 100, 2).floatValue());
}
}
}

@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReUtil;
import cn.jlw.util.ToolUtils;
@ -25,10 +26,8 @@ import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum;
import com.ibeetl.jlw.web.query.GeneralQuestionLogQuery;
import com.ibeetl.jlw.web.query.GeneralQuestionSettingQuery;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.beetl.sql.core.SqlId;
import org.beetl.sql.core.engine.PageQuery;
@ -39,6 +38,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ -52,6 +53,7 @@ import static cn.hutool.core.date.DateUnit.SECOND;
import static cn.hutool.core.util.ArrayUtil.join;
import static cn.jlw.util.CacheUserUtil.getStudent;
import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue;
import static com.ibeetl.jlw.enums.QuestionLogAddTypeEnum.FINALLY_SUBMIT;
import static com.ibeetl.jlw.enums.QuestionLogAddTypeEnum.PRE_SUBMIT;
import static com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum.CHAPTER_EXERCISE;
import static java.util.stream.Collectors.groupingBy;
@ -464,11 +466,15 @@ public class GeneralQuestionLogService extends CoreBaseService<GeneralQuestionLo
List<GeneralQuestionLog> updateList = generalQuestionLogDao.getValuesByQueryNotWithPermission(generalQuestionLogQuery);
final Date now = new Date();
// 批量更新分数
// 批量更新分数。支持重复设置分数和评语
updateList.forEach(questionLog -> {
questionLog.setQuestionScore(score);
BigDecimal questionScore = questionLog.getQuestionScore();
questionLog.setStudentScore(score);
questionLog.setGeneralQuestionLogReply(reply);
// 这里不是记录用时,只是记录教师批阅的时间
questionLog.setGeneralQuestionLogUpdateTime(now);
// 是否错题库,也可以用作标记答案是对的错的
questionLog.setIsErrorFavorite(NumberUtil.equals(questionScore, score));
});
updateBatchTemplate(updateList);
@ -522,7 +528,10 @@ public class GeneralQuestionLogService extends CoreBaseService<GeneralQuestionLo
GeneralQuestionLogQuery query = new GeneralQuestionLogQuery();
query.setGeneralQuestionLogUploadFile(absFilePath);
query.setGeneralQuestionSettingId(questionSettingId);
query.setGeneralQuestionLogUpdateTime(new Date());
query.setGeneralQuestionLogStatus(1);
// 附件作业,只有一题,所有默认是全部提交的方式
query.setQuestionLogAddType(FINALLY_SUBMIT);
query.setOrgId(student.getOrgId());
query.setUserId(student.getUserId());
query.setStudentId(student.getStudentId());
@ -834,4 +843,136 @@ public class GeneralQuestionLogService extends CoreBaseService<GeneralQuestionLo
return false;
}
/**
*
* @param request
* @param response
* @param generalQuestionLogQuery
* @param coreUser
*/
public void exportErrorFavorite(HttpServletRequest request, HttpServletResponse response, GeneralQuestionLogQuery generalQuestionLogQuery, CoreUser coreUser) {
if(null == coreUser){
return;
}
HSSFWorkbook workbook = null;
try {
//表头数据
String[] header = {
"通用题目配置", "题目快照", "学生提交的答案", "附件,学生端上传附件", "创建时间", "状态", "学生",
"学生得分", "题型", "分值", "题干", "选项A", "选项B", "选项C", "选项D", "选项E", "答案", "解析",
"是否收藏夹", "是否错题库",
};
String[] headerCode = {
"generalQuestionSettingId", "generalResourcesQuestionSnapshotId", "generalQuestionLogAnswer",
"generalQuestionLogUploadFile", "generalQuestionLogAddTime", "generalQuestionLogStatus",
"studentId", "studentScore", "questionType", "questionScore", "questionStem", "questionOptionA",
"questionOptionB", "questionOptionC", "questionOptionD", "questionOptionE", "questionAnswer",
"questionAnalysis", "isTuck", "isErrorFavorite",
};
//数据内容
List<Map<String, Object>> mapList = getExcelValues(generalQuestionLogQuery);
//内容宽度
Map<String, Object> widthMap = mapList.get(0);
mapList.remove(0);
//声明一个工作簿
workbook = new HSSFWorkbook();
//生成一个表格,设置表格名称为"Sheet1"
HSSFSheet sheet = workbook.createSheet("Sheet1");
//冻结表头
sheet.createFreezePane(0, 1, 0, 1);
//设置默认列宽度为5个字节
sheet.setDefaultColumnWidth(5);
//创建第一行表头
HSSFRow headRow = sheet.createRow(0);
//头部样式
HSSFCellStyle headerStyle = workbook.createCellStyle();
//垂直居中
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居中
headerStyle.setAlignment(HorizontalAlignment.CENTER);
//单元格样式
HSSFCellStyle cellStyle = workbook.createCellStyle();
//垂直居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居左
cellStyle.setAlignment(HorizontalAlignment.CENTER);
//自动换行
cellStyle.setWrapText(true);
//遍历添加表头
for (int i = 0; i < header.length; i++) {
//设置表格特定的列宽度
if (null != widthMap.get(headerCode[i])) {
String width = widthMap.get(headerCode[i]).toString().split("\\.")[0];
Integer w = Integer.parseInt(width) > header[i].length()*3?Integer.parseInt(width):header[i].length()*3;
sheet.setColumnWidth(i, w * 190);
}
//创建一个单元格
HSSFCell cell = headRow.createCell(i);
//创建一个内容对象
HSSFRichTextString text = new HSSFRichTextString(header[i]);
//将内容对象的文字内容写入到单元格中
cell.setCellValue(text);
//设置样式
cell.setCellStyle(headerStyle);
}
//遍历结果集,把内容加入表格
for (int i = 0; i < mapList.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
row.setHeight((short) (50*10));
Map<String, Object> map = mapList.get(i);
for (int j = 0; j < headerCode.length; j++) {
HSSFCell cell = row.createCell(j);
cell.setCellStyle(cellStyle);
HSSFRichTextString text = new HSSFRichTextString(null != map.get(headerCode[j]) ? map.get(headerCode[j]).toString() : " ");
cell.setCellValue(text);
}
}
//准备将Excel的输出流通过response输出到页面下载
//八进制输出流
response.setContentType("application/octet-stream");
//这后面可以设置导出Excel的名称此例中名为student.xls
String fileName = ToolUtils.web2fileName(request,"generalQuestionLog(" + TimeTool.getNowTime("YMD") + ").xls");
response.setHeader("Content-disposition", "attachment;filename="+fileName);
//刷新缓冲
response.flushBuffer();
//workbook将Excel写入到response的输出流中供页面下载
workbook.write(response.getOutputStream());
}catch (Exception e){
e.printStackTrace();
} finally {
try {
if (null != workbook) {
workbook.close();
}
if (null != response && null != response.getOutputStream()) {
response.getOutputStream().close();
}
} catch (Exception e) { }
}
}
}

@ -13,6 +13,7 @@ import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.admin.core.web.JsonReturnCode;
import com.ibeetl.jlw.dao.GeneralResourcesQuestionSnapshotDao;
import com.ibeetl.jlw.entity.FileEntity;
import com.ibeetl.jlw.entity.GeneralQuestionLogScoreInfo;
import com.ibeetl.jlw.entity.GeneralResourcesQuestionSnapshot;
import com.ibeetl.jlw.entity.Student;
import com.ibeetl.jlw.entity.dto.GeneralQuestionTestSimpleInfoDTO;
@ -27,6 +28,7 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.assertj.core.util.Lists;
import org.beetl.sql.core.SQLReady;
import org.beetl.sql.core.SqlId;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
@ -35,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;
import java.io.*;
import java.math.BigDecimal;
import java.util.*;
@ -436,4 +439,31 @@ public class GeneralResourcesQuestionSnapshotService extends CoreBaseService<Gen
dictParser(questionTestSimpleInfo.getList());
return questionTestSimpleInfo;
}
/**
* -
*
*
* @param questionSettingId ID
* @return
*/
public GeneralQuestionLogScoreInfo getScoreInfo(@NotNull(message = "开课题目配置ID不能为空") final Long questionSettingId) {
// 查询学生身份
Student student = getStudent();
Assert.notNull(student, "该接口只能学生访问");
// 给实体类传参数剩下来的交给Fetch 来处理
// 查询符合条件的实体
GeneralQuestionLogScoreInfo scoreInfo = sqlManager.executeQueryOne(
new SQLReady("SELECT " +
"? as general_question_setting_id, " +
"? as student_id ",
questionSettingId, student.getStudentId()
),
GeneralQuestionLogScoreInfo.class
);
dictParser(scoreInfo);
return scoreInfo;
}
}

@ -442,11 +442,11 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
* -
*
*
* @param teacherOpenCourseQuestionSettingId ID
* @param questionSettingId ID
* @return
*/
public TeacherOpenCourseQuestionLogScoreInfo getScoreInfo(
@NotNull(message = "开课题目配置ID不能为空") final Long teacherOpenCourseQuestionSettingId) {
@NotNull(message = "开课题目配置ID不能为空") final Long questionSettingId) {
// 查询学生身份
Student student = getStudent();
@ -458,7 +458,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
new SQLReady("SELECT " +
"? as teacher_open_course_question_setting_id, " +
"? as student_id ",
teacherOpenCourseQuestionSettingId, student.getStudentId()
questionSettingId, student.getStudentId()
),
TeacherOpenCourseQuestionLogScoreInfo.class
);

@ -26,9 +26,6 @@ import lombok.SneakyThrows;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
@ -59,7 +56,7 @@ import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
@RestController
@Validated
public class GeneralQuestionLogController{
public class GeneralQuestionLogController extends BaseController {
private final Log log = LogFactory.getLog(this.getClass());
private static final String MODEL = "/jlw/generalQuestionLog";
@ -226,6 +223,24 @@ public class GeneralQuestionLogController{
return JsonResult.success(generalQuestionLogService.queryByConditionQuery(query));
}
/**
* : <br>
* ID
*
* @param generalQuestionSettingId
* @param coreUser
* @Author: lx
* @Date: 2022/11/30 0:35
*/
@GetMapping(API + "/excel/exportTuck.do")
public void exportTuck(@NotNull(message = "题目配置ID不能为空") Long generalQuestionSettingId, @SCoreUser CoreUser coreUser) {
GeneralQuestionLogQuery logQuery = new GeneralQuestionLogQuery();
logQuery.setGeneralQuestionLogStatus(1);
logQuery.setIsTuck(true);
logQuery.setGeneralQuestionSettingId(generalQuestionSettingId);
generalQuestionLogService.exportErrorFavorite(request, response, logQuery, coreUser);
}
/**
* /
* @param generalQuestionLogIds ID
@ -238,16 +253,6 @@ public class GeneralQuestionLogController{
return JsonResult.success();
}
/**
*
* @param query
* @return
*/
@PostMapping(API + "/scoreDetailInfo.do")
public JsonResult<PageQuery> scoreDetailInfo(@Validated GeneralQuestionLogScoreDetailsInfoQuery query, @SCoreUser CoreUser coreUser) {
return JsonResult.success(generalQuestionLogService.getQuestionLogScoreDetailsInfo(query.getPageQuery()));
}
/**
*
* @return
@ -264,6 +269,34 @@ public class GeneralQuestionLogController{
return JsonResult.success(generalQuestionLogService.queryByConditionQuery(query));
}
/**
* : <br>
* ID
*
* @param generalQuestionSettingId
* @param coreUser
* @Author: lx
* @Date: 2022/11/30 0:35
*/
@GetMapping(API + "/excel/exportErrorFavorite.do")
public void exportDo(@NotNull(message = "题目配置ID不能为空") Long generalQuestionSettingId, @SCoreUser CoreUser coreUser) {
GeneralQuestionLogQuery logQuery = new GeneralQuestionLogQuery();
logQuery.setGeneralQuestionLogStatus(1);
logQuery.setIsErrorFavorite(true);
logQuery.setGeneralQuestionSettingId(generalQuestionSettingId);
generalQuestionLogService.exportErrorFavorite(request, response, logQuery, coreUser);
}
/**
*
* @param query
* @return
*/
@PostMapping(API + "/scoreDetailInfo.do")
public JsonResult<PageQuery> scoreDetailInfo(@Validated GeneralQuestionLogScoreDetailsInfoQuery query, @SCoreUser CoreUser coreUser) {
return JsonResult.success(generalQuestionLogService.getQuestionLogScoreDetailsInfo(query.getPageQuery()));
}
/**
* -
* @param condition
@ -492,160 +525,7 @@ public class GeneralQuestionLogController{
@GetMapping(MODEL + "/excel/export.json")
@Function("generalQuestionLog.exportDocument")
public void export(HttpServletRequest request,HttpServletResponse response,GeneralQuestionLogQuery generalQuestionLogQuery,@SCoreUser CoreUser coreUser) {
if(null == coreUser){
return;
}
HSSFWorkbook workbook = null;
try {
//表头数据
String[] header = {
"通用题目配置",
"题目快照",
"学生提交的答案",
"附件,学生端上传附件",
"创建时间",
"状态",
"学生",
"学生得分",
"题型",
"分值",
"题干",
"选项A",
"选项B",
"选项C",
"选项D",
"选项E",
"答案",
"解析",
"是否收藏夹",
"是否错题库",
};
String[] headerCode = {
"generalQuestionSettingId",
"generalResourcesQuestionSnapshotId",
"generalQuestionLogAnswer",
"generalQuestionLogUploadFile",
"generalQuestionLogAddTime",
"generalQuestionLogStatus",
"studentId",
"studentScore",
"questionType",
"questionScore",
"questionStem",
"questionOptionA",
"questionOptionB",
"questionOptionC",
"questionOptionD",
"questionOptionE",
"questionAnswer",
"questionAnalysis",
"isTuck",
"isErrorFavorite",
};
//数据内容
List<Map<String, Object>> mapList = generalQuestionLogService.getExcelValues(generalQuestionLogQuery);
//内容宽度
Map<String, Object> widthMap = mapList.get(0);
mapList.remove(0);
//声明一个工作簿
workbook = new HSSFWorkbook();
//生成一个表格,设置表格名称为"Sheet1"
HSSFSheet sheet = workbook.createSheet("Sheet1");
//冻结表头
sheet.createFreezePane(0, 1, 0, 1);
//设置默认列宽度为5个字节
sheet.setDefaultColumnWidth(5);
//创建第一行表头
HSSFRow headRow = sheet.createRow(0);
//头部样式
HSSFCellStyle headerStyle = workbook.createCellStyle();
//垂直居中
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居中
headerStyle.setAlignment(HorizontalAlignment.CENTER);
//单元格样式
HSSFCellStyle cellStyle = workbook.createCellStyle();
//垂直居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居左
cellStyle.setAlignment(HorizontalAlignment.CENTER);
//自动换行
cellStyle.setWrapText(true);
//遍历添加表头
for (int i = 0; i < header.length; i++) {
//设置表格特定的列宽度
if (null != widthMap.get(headerCode[i])) {
String width = widthMap.get(headerCode[i]).toString().split("\\.")[0];
Integer w = Integer.parseInt(width) > header[i].length()*3?Integer.parseInt(width):header[i].length()*3;
sheet.setColumnWidth(i, w * 190);
}
//创建一个单元格
HSSFCell cell = headRow.createCell(i);
//创建一个内容对象
HSSFRichTextString text = new HSSFRichTextString(header[i]);
//将内容对象的文字内容写入到单元格中
cell.setCellValue(text);
//设置样式
cell.setCellStyle(headerStyle);
}
//遍历结果集,把内容加入表格
for (int i = 0; i < mapList.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
row.setHeight((short) (50*10));
Map<String, Object> map = mapList.get(i);
for (int j = 0; j < headerCode.length; j++) {
HSSFCell cell = row.createCell(j);
cell.setCellStyle(cellStyle);
HSSFRichTextString text = new HSSFRichTextString(null != map.get(headerCode[j]) ? map.get(headerCode[j]).toString() : " ");
cell.setCellValue(text);
}
}
//准备将Excel的输出流通过response输出到页面下载
//八进制输出流
response.setContentType("application/octet-stream");
//这后面可以设置导出Excel的名称此例中名为student.xls
String fileName = ToolUtils.web2fileName(request,"generalQuestionLog(" + TimeTool.getNowTime("YMD") + ").xls");
response.setHeader("Content-disposition", "attachment;filename="+fileName);
//刷新缓冲
response.flushBuffer();
//workbook将Excel写入到response的输出流中供页面下载
workbook.write(response.getOutputStream());
}catch (Exception e){
e.printStackTrace();
} finally {
try {
if (null != workbook) {
workbook.close();
}
if (null != response && null != response.getOutputStream()) {
response.getOutputStream().close();
}
} catch (Exception e) { }
}
generalQuestionLogService.exportErrorFavorite(request, response, generalQuestionLogQuery, coreUser);
}
}

@ -12,6 +12,7 @@ import com.ibeetl.admin.core.file.FileService;
import com.ibeetl.admin.core.util.TimeTool;
import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.jlw.entity.FileEntity;
import com.ibeetl.jlw.entity.GeneralQuestionLogScoreInfo;
import com.ibeetl.jlw.entity.GeneralResourcesQuestionSnapshot;
import com.ibeetl.jlw.entity.dto.GeneralQuestionTestSimpleInfoDTO;
import com.ibeetl.jlw.service.GeneralResourcesQuestionSnapshotService;
@ -97,6 +98,25 @@ public class GeneralResourcesQuestionSnapshotController{
}
}
/**
* -
*
*
*
*
* @param questionSettingId ID
* @param coreUser
* @return
*/
@PostMapping(API + "/getScoreInfo.do")
@ResponseBody
public JsonResult<GeneralQuestionLogScoreInfo> getScoreInfoDo(
Long questionSettingId,
@SCoreUser
CoreUser coreUser) {
return JsonResult.success(generalResourcesQuestionSnapshotService.getScoreInfo(questionSettingId));
}
/* 后台页面 */

Loading…
Cancel
Save