【新增】 学生交卷之后,查询信息列表
This commit is contained in:
@@ -34,7 +34,21 @@ public class StuPaperScoreDO extends TenantBaseDO {
|
||||
*/
|
||||
private String paperId;
|
||||
/**
|
||||
* 总分
|
||||
* 试题ID
|
||||
*/
|
||||
private BigDecimal allScore;
|
||||
private String quId;
|
||||
/**
|
||||
* 得分
|
||||
*/
|
||||
private BigDecimal score;
|
||||
/**
|
||||
* 分值
|
||||
*/
|
||||
private BigDecimal trueScore;
|
||||
/**
|
||||
* 是否正确
|
||||
*/
|
||||
private int isTrue;
|
||||
|
||||
|
||||
}
|
@@ -18,6 +18,8 @@ public interface StuPaperScoreMapper extends BaseMapperX<StuPaperScoreDO> {
|
||||
|
||||
List<StuPaperScoreDO> findByStuIdAndPaperId(@Param("stuId") Long stuId, @Param("paperId") String paperId);
|
||||
|
||||
StuScoreVo getStuScore(@Param("stuId") Long stuId, @Param("paperId") String paperId);
|
||||
List<StuScoreVo> getStuScore(@Param("stuId") Long stuId, @Param("paperId") String paperId);
|
||||
|
||||
// 通过学生ID,试卷ID ,试题ID,查询数据
|
||||
StuPaperScoreDO findByStuIdAndPaperIdAndQuestionId(@Param("stuId") Long stuId, @Param("paperId") String paperId, @Param("quId") String questionId);
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package pc.exam.pp.module.exam.dal.mysql.student;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -7,13 +8,18 @@ import java.math.BigDecimal;
|
||||
@Data
|
||||
public class StuScoreVo {
|
||||
|
||||
private Long stuId;
|
||||
@Schema(description = "学号")
|
||||
private String stuNumber;
|
||||
|
||||
@Schema(description = "任务编号")
|
||||
private String taskId;
|
||||
|
||||
@Schema(description = "姓名")
|
||||
private String nickName;
|
||||
|
||||
private String paperid;
|
||||
|
||||
@Schema(description = "得分")
|
||||
private BigDecimal score;
|
||||
|
||||
private String stuNumber;
|
||||
@Schema(description = "正确得分")
|
||||
private BigDecimal trueScore;
|
||||
}
|
||||
|
@@ -13,11 +13,13 @@ import java.util.List;
|
||||
*/
|
||||
public interface StuPaperScoreService {
|
||||
|
||||
List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuID, String paperID);
|
||||
List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuId, String paperId);
|
||||
|
||||
void insertStuPaperScore(StuPaperScoreDO stuPaperScoreDO);
|
||||
|
||||
void updateStuPaperScore(StuPaperScoreDO stuPaperScoreDO);
|
||||
|
||||
StuScoreVo getStuScore(Long stuID, String paperID);
|
||||
StuScoreVo getStuScore(Long stuId, String paperId);
|
||||
|
||||
StuPaperScoreDO getStuScoreByPaperIdAndQuid(Long stuId, String paperId, String quId);
|
||||
}
|
@@ -3,13 +3,13 @@ package pc.exam.pp.module.exam.service.stuPaperScore;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaper;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperScoreDO;
|
||||
import pc.exam.pp.module.exam.dal.mysql.student.StuPaperFileMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.student.StuPaperScoreMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.student.StuScoreVo;
|
||||
import pc.exam.pp.module.exam.service.stu_paper_file.StuPaperFileService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -23,10 +23,12 @@ public class StuPaperScoreServiceImpl implements StuPaperScoreService {
|
||||
|
||||
@Resource
|
||||
private StuPaperScoreMapper stuPaperScoreMapper;
|
||||
@Resource
|
||||
private EducationPaperMapper educationPaperMapper;
|
||||
|
||||
@Override
|
||||
public List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuID, String paperID) {
|
||||
return stuPaperScoreMapper.findByStuIdAndPaperId(stuID, paperID);
|
||||
public List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuId, String paperId) {
|
||||
return stuPaperScoreMapper.findByStuIdAndPaperId(stuId, paperId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,7 +42,35 @@ public class StuPaperScoreServiceImpl implements StuPaperScoreService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public StuScoreVo getStuScore(Long stuID, String paperID) {
|
||||
return stuPaperScoreMapper.getStuScore(stuID, paperID);
|
||||
public StuScoreVo getStuScore(Long stuId, String paperId) {
|
||||
// 1、创建对象
|
||||
StuScoreVo stuScoreVo = new StuScoreVo();
|
||||
// 2、查询学生得分
|
||||
BigDecimal score = new BigDecimal(0);
|
||||
BigDecimal trueScore = new BigDecimal(0);
|
||||
String stuNumber = "";
|
||||
String nickName = "";
|
||||
String taskId = "";
|
||||
List<StuScoreVo> stuScoreVos = stuPaperScoreMapper.getStuScore(stuId, paperId);
|
||||
for (StuScoreVo scoreVo : stuScoreVos) {
|
||||
stuNumber = scoreVo.getStuNumber();
|
||||
nickName = scoreVo.getNickName();
|
||||
// 3、查询出来的所有分数进行相加
|
||||
score = score.add(scoreVo.getScore());
|
||||
trueScore = trueScore.add(scoreVo.getTrueScore());
|
||||
}
|
||||
stuScoreVo.setScore(score);
|
||||
stuScoreVo.setTrueScore(trueScore);
|
||||
stuScoreVo.setStuNumber(stuNumber);
|
||||
stuScoreVo.setNickName(nickName);
|
||||
// 4、通过paperId查询任务编号
|
||||
EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(paperId);
|
||||
stuScoreVo.setTaskId(educationPaper.getTaskId());
|
||||
return stuScoreVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StuPaperScoreDO getStuScoreByPaperIdAndQuid(Long stuId, String paperId, String quId) {
|
||||
return stuPaperScoreMapper.findByStuIdAndPaperIdAndQuestionId(stuId, paperId, quId);
|
||||
}
|
||||
}
|
@@ -17,7 +17,8 @@
|
||||
SELECT
|
||||
esps.stu_id AS stuId,
|
||||
esps.paper_id AS paperId,
|
||||
esps.all_score AS score,
|
||||
esps.score AS score,
|
||||
esps.true_score AS trueScore,
|
||||
su.username AS stuNumber,
|
||||
su.nickname AS nickName
|
||||
FROM
|
||||
@@ -25,5 +26,9 @@
|
||||
LEFT JOIN system_users AS su ON esps.stu_id = su.id
|
||||
WHERE esps.stu_id = #{stuId} AND esps.paper_id = #{paperId}
|
||||
</select>
|
||||
<select id="findByStuIdAndPaperIdAndQuestionId" resultType="pc.exam.pp.module.exam.dal.dataobject.student.StuPaperScoreDO">
|
||||
SELECT * FROM exam_stu_paper_score WHERE stu_id = #{stuId} AND paper_id = #{paperId} AND qu_id = #{quId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
@@ -1,6 +1,7 @@
|
||||
package pc.exam.pp.module.judgement.controller.admin.autoTools;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -8,11 +9,18 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import pc.exam.pp.framework.common.pojo.CommonResult;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperQuMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.student.StuScoreVo;
|
||||
import pc.exam.pp.module.exam.service.stuPaperScore.StuPaperScoreService;
|
||||
import pc.exam.pp.module.judgement.controller.admin.autoTools.vo.StuPaperReqVo;
|
||||
import pc.exam.pp.module.judgement.controller.admin.autoTools.vo.StuPaperScoreInfoVo;
|
||||
import pc.exam.pp.module.judgement.service.auto_tools.AutoToolsService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/tool")
|
||||
@Tag( name = "测试判分")
|
||||
@@ -22,14 +30,30 @@ public class AutoToolsController {
|
||||
private AutoToolsService autoToolsService;
|
||||
@Resource
|
||||
StuPaperScoreService stuPaperScoreService;
|
||||
@Resource
|
||||
EducationPaperQuMapper educationPaperQuMapper;
|
||||
@Resource
|
||||
ExamQuestionMapper examQuestionMapper;
|
||||
|
||||
@GetMapping("/get")
|
||||
public CommonResult<Double> get(StuPaperReqVo stuPaperReqVo) throws Exception {
|
||||
return autoToolsService.judgementScore(stuPaperReqVo.getStuId(),stuPaperReqVo.getPaperId());
|
||||
}
|
||||
@GetMapping("/get_stu_score")
|
||||
public CommonResult<StuScoreVo> getStuScore(StuPaperReqVo stuPaperReqVo){
|
||||
return CommonResult.success(stuPaperScoreService.getStuScore(stuPaperReqVo.getStuId(),stuPaperReqVo.getPaperId()));
|
||||
@GetMapping("/getStuScoreInfo")
|
||||
@Operation(summary = "通过学生ID、试卷ID获取")
|
||||
public CommonResult<StuPaperScoreInfoVo> getStuScore(StuPaperReqVo stuPaperReqVo){
|
||||
// 1、创建对象
|
||||
StuPaperScoreInfoVo stuPaperScoreInfoVos = new StuPaperScoreInfoVo();
|
||||
// 2、查询学生试卷信息
|
||||
StuScoreVo stuScoreVo = stuPaperScoreService.getStuScore(stuPaperReqVo.getStuId(),stuPaperReqVo.getPaperId());
|
||||
stuPaperScoreInfoVos.setStuInfoReqVo(stuScoreVo);
|
||||
// 3、查询学生试卷得分信息
|
||||
stuPaperScoreInfoVos.setStuPaperScoreDOList(stuPaperScoreService.findByStuIDAndPaperId(stuPaperReqVo.getStuId(),stuPaperReqVo.getPaperId()));
|
||||
// 4、查询学生试卷内容信息
|
||||
List<String> quIds = educationPaperQuMapper.selectPaperQuByPaperId(stuPaperReqVo.getPaperId());
|
||||
List<ExamQuestion> examQuestionList = examQuestionMapper.selectExamQuestionListByQuIds(quIds);
|
||||
stuPaperScoreInfoVos.setExamQuestionList(examQuestionList);
|
||||
return CommonResult.success(stuPaperScoreInfoVos);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,25 @@
|
||||
package pc.exam.pp.module.judgement.controller.admin.autoTools.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class StuInfoReqVo {
|
||||
|
||||
@Schema(description = "学号")
|
||||
private String stuNumber;
|
||||
|
||||
@Schema(description = "任务编号")
|
||||
private String taskId;
|
||||
|
||||
@Schema(description = "姓名")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "得分")
|
||||
private BigDecimal score;
|
||||
|
||||
@Schema(description = "总分")
|
||||
private BigDecimal allScore;
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package pc.exam.pp.module.judgement.controller.admin.autoTools.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperScoreDO;
|
||||
import pc.exam.pp.module.exam.dal.mysql.student.StuScoreVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class StuPaperScoreInfoVo {
|
||||
|
||||
@Schema(description = "交卷后成绩概要")
|
||||
private StuScoreVo stuInfoReqVo;
|
||||
|
||||
@Schema(description = "交卷后成绩明细")
|
||||
private List<StuPaperScoreDO> stuPaperScoreDOList;
|
||||
|
||||
@Schema(description = "交卷后试卷内容")
|
||||
private List<ExamQuestion> examQuestionList;
|
||||
|
||||
@Schema(description = "试卷试卷分析")
|
||||
private String paperAnalysis;
|
||||
|
||||
}
|
@@ -187,132 +187,136 @@ public class AutoToolsServiceImpl implements AutoToolsService{
|
||||
Stu stu = stringToJson(select_string);
|
||||
// 1-1-3、进行选择题判分
|
||||
for (String key : stu.getQuestionResultMap().keySet()) {
|
||||
// 查询该题的成绩
|
||||
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuId, paperId, key);
|
||||
// 判断是否做过该题
|
||||
boolean isNull = false;
|
||||
if (stuPaperScoreDO == null) {
|
||||
stuPaperScoreDO.setStuId(stuId);
|
||||
stuPaperScoreDO.setQuId(key);
|
||||
stuPaperScoreDO.setPaperId(paperId);
|
||||
isNull = true;
|
||||
}
|
||||
String value = stu.getQuestionResultMap().get(key);
|
||||
double select_score = judgementChoiceService.ProgrammingChoice(2.0, key, value);
|
||||
score += select_score;
|
||||
double selectScore = judgementChoiceService.programmingChoice(2.0, key, value, stuPaperScoreDO, isNull);
|
||||
score += selectScore;
|
||||
}
|
||||
// 1-1-4、删除文件
|
||||
select_file.delete();
|
||||
|
||||
// 2、判断文件路径是否存在
|
||||
if (stuPaperFileDO == null) {
|
||||
return CommonResult.error(100031, "试题文件没有上传,无法判分!");
|
||||
}
|
||||
// 3、下载文件
|
||||
String patn = downloadStudentFile(stuPaperFileDO.getUrl(), config.getValue());
|
||||
File zip_file = new File(patn);
|
||||
// 4、获取到得是zip文件,需要解压
|
||||
String stuFilePath = unzipToNamedFolder(patn);
|
||||
// 5、解压之后得文件获取文件夹和文件
|
||||
File folder = new File(stuFilePath);
|
||||
File[] files = folder.listFiles();
|
||||
String stu_files = null;
|
||||
// 5.1、 只查询文件夹 (学号-试卷ID-试题ID-具体内容)
|
||||
if (files == null) return CommonResult.error(100032, "1、试题文件上传,目录不正确!");
|
||||
// if (files.length > 1) return CommonResult.error(100033, "2、试题文件上传,目录不正确!");
|
||||
if (!files[0].isDirectory()) return CommonResult.error(100034, "3、试题文件上传,目录不正确!");
|
||||
// 判断学号是否正确
|
||||
if (!files[0].getName().equals(stuId.toString())) return CommonResult.error(100035, "文件与学号匹配异常");
|
||||
// 5.2、查询试题ID
|
||||
File folders = new File(files[0].getPath());
|
||||
File[] filess = folders.listFiles();
|
||||
if (filess == null) return CommonResult.error(100036, "4、试卷文件上传,目录不正确!");
|
||||
if (filess.length > 1) return CommonResult.error(100037, "5、试卷文件上传,目录不正确!");
|
||||
if (!filess[0].isDirectory()) return CommonResult.error(100038, "6、试卷文件上传,目录不正确!");
|
||||
// 判断学号是否正确
|
||||
if (!filess[0].getName().equals(paperId)) return CommonResult.error(100039, "文件与试卷匹配异常");
|
||||
// 5.3、查询出来所有试题
|
||||
File qu_files = new File(filess[0].getPath());
|
||||
// 所有试题文件夹
|
||||
File[] filess_qu = qu_files.listFiles();
|
||||
if (filess_qu == null) return CommonResult.error(100040, "没有试题文件!");
|
||||
for (File file : filess_qu) {
|
||||
// ** 接下来已经到了,每个课程题型了 file 得名称
|
||||
// 5.3、查询出来所有试题
|
||||
File cs_files = new File(file.getPath());
|
||||
// 所有试题文件夹
|
||||
File[] cs_file_list = cs_files.listFiles();
|
||||
if (cs_file_list!=null){
|
||||
for (File one_file : cs_file_list) {
|
||||
// 6、根据试题ID查询试题详情
|
||||
String qu_id = file.getName();
|
||||
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(qu_id);
|
||||
if (examQuestion != null) {
|
||||
// 7、进行对应得判分
|
||||
// --- 7.1、查询试题文件
|
||||
File qu_file = new File(one_file.getPath());
|
||||
File[] qu_file_list = qu_file.listFiles();
|
||||
if (qu_file_list == null) continue;
|
||||
// --- 7.2、通过文件名称进行判分
|
||||
for (File file_one : qu_file_list) {
|
||||
// 判断名称 类似于 C语言程序设计。 课程+题型
|
||||
System.out.println(one_file.getName());
|
||||
if (one_file.getName().split("\\.")[0].equals(examQuestion.getCourseName()+examQuestion.getSubjectName())) {
|
||||
double c_score = judgementService.ProgrammingC(15.0, one_file.getPath(), file_one.getName(), examQuestion);
|
||||
score += c_score;
|
||||
System.out.println(c_score+"C语言程序设计得分");
|
||||
break;
|
||||
}
|
||||
// wps 类型存在多级文文件夹,需要个性化设置
|
||||
if (file_one.getName().split("\\.")[0].equals("文档")) {
|
||||
double wps_word_score = judgementWpsWordService.judgementWpsWord(15.0, one_file.getPath(), file_one.getPath(), examQuestion);
|
||||
score += wps_word_score;
|
||||
System.out.println(wps_word_score+"wps得分");
|
||||
break;
|
||||
}
|
||||
//windows文件处理
|
||||
if (one_file.getName().equals("stu")) {
|
||||
File win_file = new File(one_file.getPath());
|
||||
double win_file_score = fileServerice.run_file_point(20.0,win_file, examQuestion);
|
||||
score += win_file_score;
|
||||
System.out.println(win_file_score+"windows文件处理得分");
|
||||
break;
|
||||
}
|
||||
//浏览器操作
|
||||
// if ("浏览器网络题".equals(examQuestion.getCourseName()+examQuestion.getSubjectName())){
|
||||
if (one_file.getName().equals("edge")) {
|
||||
System.out.println(one_file);
|
||||
File edge_file = new File(one_file.getPath());
|
||||
double browse_score= browserServerice.Judgement(20.0,edge_file,examQuestion);
|
||||
score += browse_score;
|
||||
System.out.println(browse_score+"浏览器操作得分");
|
||||
break;
|
||||
}
|
||||
if (one_file.getName().equals("mysql")) {
|
||||
System.out.println(one_file);
|
||||
File mysql_file = new File(one_file.getPath());
|
||||
double judgement = mysqlServerice.Judgement(20.0,mysql_file, examQuestion);
|
||||
score+=judgement;
|
||||
System.out.println(judgement+"mysql得分");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// // 2、判断文件路径是否存在
|
||||
// if (stuPaperFileDO == null) {
|
||||
// return CommonResult.error(100031, "试题文件没有上传,无法判分!");
|
||||
// }
|
||||
// // 3、下载文件
|
||||
// String patn = downloadStudentFile(stuPaperFileDO.getUrl(), config.getValue());
|
||||
// File zip_file = new File(patn);
|
||||
// // 4、获取到得是zip文件,需要解压
|
||||
// String stuFilePath = unzipToNamedFolder(patn);
|
||||
// // 5、解压之后得文件获取文件夹和文件
|
||||
// File folder = new File(stuFilePath);
|
||||
// File[] files = folder.listFiles();
|
||||
// String stu_files = null;
|
||||
// // 5.1、 只查询文件夹 (学号-试卷ID-试题ID-具体内容)
|
||||
// if (files == null) return CommonResult.error(100032, "1、试题文件上传,目录不正确!");
|
||||
// // if (files.length > 1) return CommonResult.error(100033, "2、试题文件上传,目录不正确!");
|
||||
// if (!files[0].isDirectory()) return CommonResult.error(100034, "3、试题文件上传,目录不正确!");
|
||||
// // 判断学号是否正确
|
||||
// if (!files[0].getName().equals(stuId.toString())) return CommonResult.error(100035, "文件与学号匹配异常");
|
||||
// // 5.2、查询试题ID
|
||||
// File folders = new File(files[0].getPath());
|
||||
// File[] filess = folders.listFiles();
|
||||
// if (filess == null) return CommonResult.error(100036, "4、试卷文件上传,目录不正确!");
|
||||
// if (filess.length > 1) return CommonResult.error(100037, "5、试卷文件上传,目录不正确!");
|
||||
// if (!filess[0].isDirectory()) return CommonResult.error(100038, "6、试卷文件上传,目录不正确!");
|
||||
// // 判断学号是否正确
|
||||
// if (!filess[0].getName().equals(paperId)) return CommonResult.error(100039, "文件与试卷匹配异常");
|
||||
// // 5.3、查询出来所有试题
|
||||
// File qu_files = new File(filess[0].getPath());
|
||||
// // 所有试题文件夹
|
||||
// File[] filess_qu = qu_files.listFiles();
|
||||
// if (filess_qu == null) return CommonResult.error(100040, "没有试题文件!");
|
||||
// for (File file : filess_qu) {
|
||||
// // ** 接下来已经到了,每个课程题型了 file 得名称
|
||||
// // 5.3、查询出来所有试题
|
||||
// File cs_files = new File(file.getPath());
|
||||
// // 所有试题文件夹
|
||||
// File[] cs_file_list = cs_files.listFiles();
|
||||
// if (cs_file_list!=null){
|
||||
// for (File one_file : cs_file_list) {
|
||||
// // 6、根据试题ID查询试题详情
|
||||
// String qu_id = file.getName();
|
||||
// ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(qu_id);
|
||||
// if (examQuestion != null) {
|
||||
// // 7、进行对应得判分
|
||||
// // --- 7.1、查询试题文件
|
||||
// File qu_file = new File(one_file.getPath());
|
||||
// File[] qu_file_list = qu_file.listFiles();
|
||||
// if (qu_file_list == null) continue;
|
||||
// // --- 7.2、通过文件名称进行判分
|
||||
// for (File file_one : qu_file_list) {
|
||||
// // 判断名称 类似于 C语言程序设计。 课程+题型
|
||||
// System.out.println(one_file.getName());
|
||||
// if (one_file.getName().split("\\.")[0].equals(examQuestion.getCourseName()+examQuestion.getSubjectName())) {
|
||||
// double c_score = judgementService.ProgrammingC(15.0, one_file.getPath(), file_one.getName(), examQuestion);
|
||||
// score += c_score;
|
||||
// System.out.println(c_score+"C语言程序设计得分");
|
||||
// break;
|
||||
// }
|
||||
// // wps 类型存在多级文文件夹,需要个性化设置
|
||||
// if (file_one.getName().split("\\.")[0].equals("文档")) {
|
||||
// double wps_word_score = judgementWpsWordService.judgementWpsWord(15.0, one_file.getPath(), file_one.getPath(), examQuestion);
|
||||
// score += wps_word_score;
|
||||
// System.out.println(wps_word_score+"wps得分");
|
||||
// break;
|
||||
// }
|
||||
// //windows文件处理
|
||||
// if (one_file.getName().equals("stu")) {
|
||||
// File win_file = new File(one_file.getPath());
|
||||
// double win_file_score = fileServerice.run_file_point(20.0,win_file, examQuestion);
|
||||
// score += win_file_score;
|
||||
// System.out.println(win_file_score+"windows文件处理得分");
|
||||
// break;
|
||||
// }
|
||||
// //浏览器操作
|
||||
// // if ("浏览器网络题".equals(examQuestion.getCourseName()+examQuestion.getSubjectName())){
|
||||
// if (one_file.getName().equals("edge")) {
|
||||
// System.out.println(one_file);
|
||||
// File edge_file = new File(one_file.getPath());
|
||||
// double browse_score= browserServerice.Judgement(20.0,edge_file,examQuestion);
|
||||
// score += browse_score;
|
||||
// System.out.println(browse_score+"浏览器操作得分");
|
||||
// break;
|
||||
// }
|
||||
// if (one_file.getName().equals("mysql")) {
|
||||
// System.out.println(one_file);
|
||||
// File mysql_file = new File(one_file.getPath());
|
||||
// double judgement = mysqlServerice.Judgement(20.0,mysql_file, examQuestion);
|
||||
// score+=judgement;
|
||||
// System.out.println(judgement+"mysql得分");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
// 8、将解压之后得问及那继续重新压缩并上传到服务器,并删除文件和文件夹
|
||||
String zipPath = FolderZipper.zipFolder(files[0].getPath());
|
||||
// String zipPath = FolderZipper.zipFolder(files[0].getPath());
|
||||
// 9、上传文件
|
||||
MultipartFile file = new CustomMultipartFile(zipPath);
|
||||
String path = null;
|
||||
fileService.createStuFile(stuId, paperId, file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()));
|
||||
// 10、将分数存入数据库
|
||||
StuPaperScoreDO stuPaperScoreDO = new StuPaperScoreDO();
|
||||
stuPaperScoreDO.setStuId(stuId);
|
||||
stuPaperScoreDO.setPaperId(paperId);
|
||||
stuPaperScoreDO.setAllScore(new BigDecimal(score));
|
||||
stuPaperScoreService.insertStuPaperScore(stuPaperScoreDO);
|
||||
// MultipartFile file = new CustomMultipartFile(zipPath);
|
||||
// String path = null;
|
||||
// fileService.createStuFile(stuId, paperId, file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()));
|
||||
|
||||
//更新学生分数
|
||||
endStuMonitorUtils.endStuMonitor(String.valueOf(stuId),paperId,score);
|
||||
// end、删除文件
|
||||
zip_file.delete();
|
||||
folder.delete();
|
||||
// zip_file.delete();
|
||||
// folder.delete();
|
||||
return CommonResult.success(score);
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,7 @@ package pc.exam.pp.module.judgement.service.choice;
|
||||
|
||||
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperScoreDO;
|
||||
|
||||
/**
|
||||
* 判分逻辑集合(选择题)
|
||||
@@ -16,7 +17,9 @@ public interface JudgementChoiceService {
|
||||
* @param score 题分
|
||||
* @param quId 试题ID
|
||||
* @param answerId 学生选择答案ID
|
||||
* @return 得分
|
||||
* @param stuPaperScoreDO 学生试卷分数
|
||||
* @param isNull 是否之前做过该题
|
||||
* @return 分数
|
||||
*/
|
||||
public double ProgrammingChoice(double score, String quId, String answerId);
|
||||
double programmingChoice(double score, String quId, String answerId, StuPaperScoreDO stuPaperScoreDO, boolean isNull);
|
||||
}
|
||||
|
@@ -4,7 +4,11 @@ import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestionAnswer;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperScoreDO;
|
||||
import pc.exam.pp.module.exam.service.question.IExamQuestionService;
|
||||
import pc.exam.pp.module.exam.service.stuPaperScore.StuPaperScoreService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 判分逻辑集合
|
||||
@@ -16,15 +20,20 @@ public class JudgementChoiceServiceImpl implements JudgementChoiceService
|
||||
{
|
||||
@Resource
|
||||
IExamQuestionService examQuestionService;
|
||||
@Resource
|
||||
StuPaperScoreService stuPaperScoreService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param score 题分
|
||||
* @param quId 试题ID
|
||||
* @param answerId 学生选择答案ID
|
||||
* @return 得分
|
||||
* @param stuPaperScoreDO 学生试卷分数
|
||||
* @param isNull 是否之前做过该题
|
||||
* @return 分数
|
||||
*/
|
||||
public double ProgrammingChoice(double score, String quId, String answerId) {
|
||||
@Override
|
||||
public double programmingChoice(double score, String quId, String answerId, StuPaperScoreDO stuPaperScoreDO, boolean isNull) {
|
||||
ExamQuestionAnswer answer = new ExamQuestionAnswer();
|
||||
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
|
||||
// 获取选择题的标准答案
|
||||
@@ -37,8 +46,32 @@ public class JudgementChoiceServiceImpl implements JudgementChoiceService
|
||||
}
|
||||
}
|
||||
if (answer.getAnswerId().equals(answerId)) {
|
||||
// 如果之前做过,则更新该题的分数
|
||||
stuPaperScoreDO.setScore(new BigDecimal(score));
|
||||
// 原始正确分数
|
||||
stuPaperScoreDO.setTrueScore(new BigDecimal(score));
|
||||
stuPaperScoreDO.setIsTrue(0);
|
||||
if (isNull) {
|
||||
// 如果之前没做过,则插入该题的分数
|
||||
stuPaperScoreService.insertStuPaperScore(stuPaperScoreDO);
|
||||
} else {
|
||||
// 如果之前做过,则更新该题的分数
|
||||
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
|
||||
}
|
||||
return score;
|
||||
} else {
|
||||
// 如果之前做过,则更新该题的分数
|
||||
stuPaperScoreDO.setScore(new BigDecimal(0));
|
||||
// 原始正确分数
|
||||
stuPaperScoreDO.setTrueScore(new BigDecimal(score));
|
||||
stuPaperScoreDO.setIsTrue(1);
|
||||
if (isNull) {
|
||||
// 如果之前没做过,则插入该题的分数
|
||||
stuPaperScoreService.insertStuPaperScore(stuPaperScoreDO);
|
||||
} else {
|
||||
// 如果之前做过,则更新该题的分数
|
||||
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user