安全教育和红外对射修改
This commit is contained in:
parent
a9f475fcff
commit
dfbc7c85d1
@ -211,27 +211,16 @@ public class ExamCourseRecordController {
|
||||
*/
|
||||
@ApiOperation(value = "导出excel学习情况信息", notes = "导出excel学习情况信息", httpMethod = "POST")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
|
||||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<ExamCourseRecord> queryWrapper = null;
|
||||
try {
|
||||
String paramsStr = request.getParameter("paramsStr");
|
||||
if (oConvertUtils.isNotEmpty(paramsStr)) {
|
||||
String deString = URLDecoder.decode(paramsStr, "UTF-8");
|
||||
ExamCourseRecord examCourseRecord = JSON.parseObject(deString, ExamCourseRecord.class);
|
||||
queryWrapper = QueryGenerator.initQueryWrapper(examCourseRecord, request.getParameterMap());
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
QueryWrapper<ExamCourseRecord> queryWrapper = QueryGenerator.initPageQueryWrapper(ExamCourseRecord.class, map);
|
||||
List<ExamCourseRecord> pageList = examCourseRecordService.page(new Page<>(-1 , -1), queryWrapper).getRecords();
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
List<ExamCourseRecord> pageList = examCourseRecordService.list(queryWrapper);
|
||||
//导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "学习情况列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, ExamCourseRecord.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("学习情况列表数据", "导出人:Jeecg", "导出信息"));
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("学习情况列表数据", "导出人:" + SecurityUtils.getUser().getRealName(), "导出信息"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
@ -111,24 +111,28 @@ public class ExamQuestionBankController {
|
||||
@OperLog(operModul = "题目管理管理", operType = "列表查询", operDesc = "随机获取题目")
|
||||
@ApiOperation(value = " 随机获取题目", notes = "随机获取题目", httpMethod = "POST")
|
||||
@PostMapping(value = "/random")
|
||||
public Result<HashSet<Long>> random(@RequestBody List<RandomQuery> randomQueryList) {
|
||||
public Result<List<ExamQuestionBank>> random(@RequestBody List<RandomQuery> randomQueryList) {
|
||||
LambdaQueryWrapper<ExamQuestionBank> queryWrapper = Wrappers.<ExamQuestionBank>lambdaQuery();
|
||||
if (randomQueryList.get(0).getSubjectId() != null) {
|
||||
queryWrapper.eq(ExamQuestionBank::getSubjectId, randomQueryList.get(0).getSubjectId());
|
||||
}
|
||||
List<ExamQuestionBank> list = examQuestionBankService.list(queryWrapper);
|
||||
HashSet<Long> resultList = new HashSet<>();
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < randomQueryList.size(); i++) {
|
||||
int finalI = i;
|
||||
List<ExamQuestionBank> radioList = list.stream().filter(l -> l.getType() == finalI + 1 &&
|
||||
l.getDifficulty() == randomQueryList.get(finalI).getDifficulty()).collect(Collectors.toList());
|
||||
List<ExamQuestionBank> radioList = list.stream()
|
||||
.filter(l -> l.getType() == randomQueryList.get(finalI).getType()
|
||||
&& l.getDifficulty() == randomQueryList.get(finalI).getDifficulty()).collect(Collectors.toList());
|
||||
for (int j = 0; j < randomQueryList.get(i).getNumber();) {
|
||||
int index = random.nextInt(radioList.size());
|
||||
boolean add = resultList.add(radioList.get(index).getId());
|
||||
if (add) {
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.success(resultList);
|
||||
return Result.success(examQuestionBankService.listByIds(resultList));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,6 +2,8 @@ package com.zhgd.xmgl.modules.exam.controller;
|
||||
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamAnswerQuestion;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamCourseRecord;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@ -233,4 +235,26 @@ public class ExamTrainRecordController {
|
||||
public Result<Object> submit(@RequestBody List<ExamAnswerQuestion> examAnswerQuestionList) {
|
||||
return Result.success(examTrainRecordService.submit(examAnswerQuestionList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@ApiOperation(value = "导出excel学习情况信息", notes = "导出excel学习情况信息", httpMethod = "POST")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> map) {
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<ExamTrainRecord> queryWrapper = QueryGenerator.initPageQueryWrapper(ExamTrainRecord.class, map);
|
||||
IPage<ExamTrainRecord> pageList = examTrainRecordService.page(new Page<>(-1, -1), queryWrapper);
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
//导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "教育培训情况列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, ExamTrainRecord.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("教育培训情况列表数据", "导出人:" + SecurityUtils.getUser().getRealName(), "导出信息"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,12 @@ import lombok.Data;
|
||||
@Data
|
||||
public class RandomQuery {
|
||||
|
||||
@ApiModelProperty(value = "科目ID")
|
||||
private Long subjectId;
|
||||
|
||||
@ApiModelProperty(value = "试题类型(1:单选题;2:多选题;3:填空题;)")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "难易程度")
|
||||
private Integer difficulty;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user