基于javaweb+SpringBoot+MyBatis在线教学考试作业系统(后台、前台)
开发工具:eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
pageInfo.put("pageSize", page.getSize());
pageInfo.put("pageNum", page.getCurrent());
pageInfo.put("pages", page.getPages());
pageInfo.put("total", page.getTotal());
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("fileList", page.getRecords());
resultMap.put("pageInfo", pageInfo);
return new ResponseBean<Map<String, Object>>(true, resultMap, CommonEnum.SUCCESS_REQUEST);
}
/**
* 文件上传后删除所属对象的原先文件
* @param sysFile
* @param file
* @return
*/
@ApiOperation(value="文件上传后删除所属对象的原先文件")
@RequestMapping(value = "/uploadAndDel",method = {RequestMethod.POST})
@ResponseBody
public ResponseBean fileUpload(SysFile sysFile, MultipartFile file){
if(sysFile==null||file==null||file.isEmpty()){
* @param idList 试题ID列表
* @param session
* @param paperId 试卷ID
*/
private void checkManualAddPaperDetail(Integer type,List<Long> idList,HttpSession session ,Long paperId){
for(Long id:idList){
SysQuestion sysQuestion = questionService.getById(id);
PaperDetail paperDetail=new PaperDetail();
paperDetail.setPaperId(paperId);
paperDetail.setQuestionId(sysQuestion.getId());
paperDetail.setQuestion(sysQuestion.getQuestion());
paperDetail.setUserId(ToolsUtils.getLoginUserId(session));
paperDetail.setUserName(ToolsUtils.getLoginUserName(session));
paperDetail.setType(type);
paperDetail.setAnswera(sysQuestion.getAnswera());
paperDetail.setAnswerb(sysQuestion.getAnswerb());
paperDetail.setAnswerc(sysQuestion.getAnswerc());
paperDetail.setAnswerd(sysQuestion.getAnswerd());
paperDetail.setRighterAnswer(sysQuestion.getRighterAnswer());
paperDetail.setAnalysis(sysQuestion.getAnalysis());
}
logger.info("POST url...." + post.getURI());
CloseableHttpResponse httpResponse = httpClient.execute(post);
try {
HttpEntity entity = httpResponse.getEntity();
if (entity != null) {
logger.info("response code:" + httpResponse.getStatusLine());
ret = getRespString(entity);
logger.info("response content:" + ret);
}
} catch (Exception var27) {
logger.error("error:" + var27.getMessage(), var27);
} finally {
case 3:type3List.add(paperDetail);break;
case 4:type4List.add(paperDetail);break;
}
}
for(int i=0;i<type1List.size();i++){
type1List.get(i).setField0((i+1)+"");
}
for(int i=0;i<type2List.size();i++){
int j = type1List.size() + i + 1;
type2List.get(i).setField0(j+"");
}
for(int i=0;i<type3List.size();i++){
int j = type1List.size() +type2List.size()+ i + 1;
type3List.get(i).setField0(j+"");
}
for(int i=0;i<type4List.size();i++){
int j = type1List.size() +type2List.size()+type3List.size()+ i + 1;
type4List.get(i).setField0(j+"");
}
model.addAttribute("type1List",type1List);
model.addAttribute("type2List",type2List);
model.addAttribute("type3List",type3List);
model.addAttribute("type4List",type4List);
return "home/homework/detail";
}
<result column="writing_score" property="writingScore" />
<result column="total_score" property="totalScore" />
<result column="type" property="type" />
<result column="state" property="state" />
<result column="remark" property="remark" />
<result column="field0" property="field0" />
<result column="field1" property="field1" />
<result column="field2" property="field2" />
<result column="field3" property="field3" />
<result column="field4" property="field4" />
<result column="field5" property="field5" />
<result column="field6" property="field6" />
<result column="field7" property="field7" />
<result column="field8" property="field8" />
<result column="field9" property="field9" />
}
}
public static Map<String, List<String>> splitQuery(URI url) throws UnsupportedEncodingException {
Map<String, List<String>> query_pairs = new LinkedHashMap();
if (url.getRawQuery() == null) {
return query_pairs;
} else {
String[] pairs = url.getRawQuery().split("&");
String[] var6 = pairs;
int var5 = pairs.length;
for(int var4 = 0; var4 < var5; ++var4) {
String pair = var6[var4];
int idx = pair.indexOf("=");
String key = idx > 0 ? URLDecoder.decode(pair.substring(0, idx), "UTF-8") : pair;
if (!query_pairs.containsKey(key)) {
query_pairs.put(key, new LinkedList());
}
<result column="type" property="type" />
<result column="question" property="question" />
<result column="answera" property="answera" />
<result column="answerb" property="answerb" />
<result column="answerc" property="answerc" />
<result column="answerd" property="answerd" />
<result column="righter_answer" property="righterAnswer" />
<result column="analysis" property="analysis" />
<result column="level" property="level" />
<result column="remark" property="remark" />
<result column="field0" property="field0" />
<result column="field1" property="field1" />
<result column="field2" property="field2" />
HttpStatus statusCode = HttpStatus.OK;
ResponseEntity<byte[]> response = new ResponseEntity<byte[]>(outByteStream.toByteArray(), headers, statusCode);
return response;
} catch (Exception e) {
logger.error(e.getMessage(),e);
return null;
}finally {
try {
fileInputStream.close();
} catch (IOException e) {
logger.error(e.getMessage(),e);
}
}
}
var data = checkStatus.data;
var array = [];
data.forEach(function (val,index,data) {
array.push(data[index].id);
});
switch(obj.event){
case 'add':
WeAdminShow('添加用户','/user/addPage',800,600);
break;
case 'download':
var url="/file/export?fileName=importUserTemplate.xlsx";
window.location.href=url;
break;
case 'delete':
mydelete(array,table);
break;
};
});
} catch (Exception var22) {
var22.printStackTrace();
} finally {
try {
httpclient.close();
} catch (IOException var20) {
var20.printStackTrace();
}
}
return responseContent;
}
private static void setGetHead(HttpGet httpGet, Map<String, String> headMap) {
if (headMap != null && headMap.size() > 0) {
public ResponseBean getList(PageDTO pageDTO, UserPaperDetail queryParam , HttpSession session) {
logger.debug("查询学生答题明细列表参数:"+queryParam+",pageDTO:"+pageDTO);
QueryWrapper<UserPaperDetail> queryWrapper=new QueryWrapper<>();
queryWrapper.eq(queryParam.getPaperId()!=null,"paper_id",queryParam.getPaperId());
queryWrapper.eq(queryParam.getUserId()!=null,"user_id",queryParam.getUserId());
queryWrapper.eq(queryParam.getModelType()!=null,"model_type",queryParam.getModelType());
queryWrapper.eq(queryParam.getQuestionType()!=null,"question_type",queryParam.getQuestionType());
queryWrapper.like(!StringUtils.isEmpty(queryParam.getQuestion()),"question",queryParam.getQuestion());
queryWrapper.orderBy(true,pageDTO.getIsAsc().equals("asc"), ToolsUtils.camelToUnderline(pageDTO.getOrderByColumn()));
IPage<UserPaperDetail> indexPage = new Page<>(pageDTO.getPageNum(),pageDTO.getPageSize());
IPage<UserPaperDetail> listPage = userPaperDetailService.page(indexPage, queryWrapper);
logger.debug("获取的学生答题明细列表:"+listPage);
//获取分页信息
Map pageInfo = ToolsUtils.wrapperPageInfo(listPage);
return ResultUtil.successData(pageInfo);
}
/**
* 学生答题明细删除
* @param idList
* @return
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
技术框架
JSP JavaScript layui SpringBoot SpringMVC MyBatis
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
管理员:用户管理、班级、题库、考试、作业等模块管理
学生:考试、写作业
前台
后台
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)