diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/MonitorController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/MonitorController.java index ff013570..e87f3d14 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/MonitorController.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/MonitorController.java @@ -99,7 +99,7 @@ public void exportMonitorExcel(@Valid MonitorPageReqVO pageReqVO, HttpServletRes @PostMapping("/stuMonitorQu") @Operation(summary = "学生端考试过程传试题") public CommonResult updateStuMonitor(@Valid @RequestBody StuMonitorQuVo stuMonitorQuVo) { - Boolean stuMonitor= monitorService.updateStuMonitor(stuMonitorQuVo); + Boolean stuMonitor = monitorService.updateStuMonitor(stuMonitorQuVo); if (!stuMonitor) { return error(DEMO03_MONITOR_SESSION_EXISTS); diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/StuMonitorQuVo.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/StuMonitorQuVo.java index 5bbc692f..ac4160cb 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/StuMonitorQuVo.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/StuMonitorQuVo.java @@ -12,13 +12,5 @@ public class StuMonitorQuVo { private String stuId; private String paperId; private String taskId; - private List paperSchemeMaps; // 使用自定义类 - - private String score; - @Data - public static class EducationPaperSchemeMap { - private EducationPaperScheme educationPaperScheme; - private Map questionResultMap; - - } + private Map questionResultMap; } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperController.java index 0adc9535..95ed42de 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperController.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperController.java @@ -3,6 +3,7 @@ package pc.exam.pp.module.exam.controller.admin.paper; import jakarta.servlet.http.HttpServletResponse; import lombok.extern.java.Log; +import org.checkerframework.checker.units.qual.A; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -15,7 +16,9 @@ import pc.exam.pp.module.exam.controller.admin.paper.dto.StatusDto; import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo; import pc.exam.pp.module.exam.dal.dataobject.EducationPaper; import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask; +import pc.exam.pp.module.exam.service.paper.IEducationPaperPersonService; import pc.exam.pp.module.exam.service.paper.IEducationPaperService; +import pc.exam.pp.module.exam.service.paper.IEducationPaperTaskService; import java.util.List; @@ -35,6 +38,12 @@ public class EducationPaperController @Autowired private IEducationPaperService educationPaperService; + @Autowired + private IEducationPaperPersonService educationPaperPersonService; + + @Autowired + private IEducationPaperTaskService educationPaperTaskService; + /** * 查询试卷列表 */ @@ -75,6 +84,26 @@ public class EducationPaperController return CommonResult.success(educationPaperService.addPaperList(num,taskid,taskSpecialty)); } + /** + * 学生端返回一张试卷 + */ + @GetMapping("/stuInfoPaper") + public CommonResult stuInfoPaper(@RequestParam("taskid") String taskid) + { + List stuIds=educationPaperPersonService.selectStuIdByTaskId(taskid); + Long loginUserId = getLoginUserId(); + // 判断试卷任务是否包含此学生 + if (stuIds.contains(String.valueOf(loginUserId))) { + return CommonResult.success(educationPaperService.stuInfoPaper(taskid)); + } + else { + return CommonResult.error(100_200_300,"您未分配此试卷任务,请联系老师!"); + } + + + } + + /** * 修改试卷 */ @@ -102,12 +131,23 @@ public class EducationPaperController return CommonResult.success(educationPaperService.selectPaperByTaskId(taskId)); } + + + @PostMapping("/update") public CommonResult update(@RequestBody EducationPaper educationPaper) { //根据方案id,查找所属试卷 ,把随机的清空掉 String taskId = educationPaper.getTaskId(); String rollUp = educationPaper.getRollUp(); + EducationPaperTask educationPaperTask = educationPaperTaskService.selectEducationPaperTaskByTaskId(taskId); + + if ("3".equals(rollUp)){ + educationPaperTask.setIsOne("0"); + }else { + educationPaperTask.setIsOne("1"); + } + educationPaperTaskService.updateEducationPaperTask(educationPaperTask); if ("0".equals(rollUp)||"1".equals(rollUp )){ //先清空 改试卷 的抽卷方式 String paperId = educationPaper.getPaperId(); @@ -158,6 +198,7 @@ public class EducationPaperController } + @PutMapping("/updatePaperStatus") // 更符合RESTful规范 public CommonResult updateTaskStatus(@RequestBody StatusDto statusDto) { // 改为Integer类型 return CommonResult.success( diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperQuController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperQuController.java index ebe55de6..47bedfd7 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperQuController.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperQuController.java @@ -90,5 +90,6 @@ public class EducationPaperQuController } + } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperTaskController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperTaskController.java index 97bb97e8..ac5dcc09 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperTaskController.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperTaskController.java @@ -172,6 +172,10 @@ public class EducationPaperTaskController } - + @GetMapping(value = "/getPaperBytaskId") + public CommonResult getPaperBytaskId(@RequestParam(value = "taskId") String taskId) + { + return CommonResult.success(educationPaperTaskService.selectPaperQuByPaperId(taskId)); + } } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/EducationPaperStuDto.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/EducationPaperStuDto.java index 2e868192..b4a82c66 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/EducationPaperStuDto.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/EducationPaperStuDto.java @@ -32,7 +32,7 @@ public class EducationPaperStuDto { - EducationPaperParam educationPaperParam; + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperQu.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperQu.java index 4e83a5af..f33379a4 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperQu.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperQu.java @@ -31,7 +31,7 @@ public class EducationPaperQu /** 试题版本 */ // @Excel(name = "试题版本") - private String quVersion; + private String sort; } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperTask.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperTask.java index fd059ecc..5f0550fe 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperTask.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperTask.java @@ -54,5 +54,7 @@ public class EducationPaperTask extends TenantBaseDO @TableField(exist = false) private String count; + @TableField(exist = false) + EducationPaperParam educationPaperParam; } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperTaskMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperTaskMapper.java index a78ac482..c1c99918 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperTaskMapper.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperTaskMapper.java @@ -110,4 +110,7 @@ public interface EducationPaperTaskMapper extends BaseMapperX selectEducationPaperTaskByTaskType(String id); + + String selectPaperQuByPaperId(String taskId); + } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/monitor/MonitorServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/monitor/MonitorServiceImpl.java index fc543cb8..c2a5f7c9 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/monitor/MonitorServiceImpl.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/monitor/MonitorServiceImpl.java @@ -10,6 +10,8 @@ import org.springframework.stereotype.Service; import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; +import java.io.FileWriter; +import java.io.IOException; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; @@ -105,7 +107,10 @@ public class MonitorServiceImpl implements MonitorService { @Override public Boolean getStuMonitor(StuMonitorPaperVo stuMonitorPaperVo) { String key = "userCache:"+stuMonitorPaperVo.getTaskId()+":" + stuMonitorPaperVo.getStuId(); - MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key),MonitorDO.class); +// MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key),MonitorDO.class); + MonitorDO info=new MonitorDO(); + String uuid = IdUtils.simpleUUID(); + info.setMonitorId(uuid); if (StringUtils.isNotBlank(stuMonitorPaperVo.getPaperId())){ EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(stuMonitorPaperVo.getPaperId()); String counts = educationPaper.getCounts(); @@ -181,34 +186,18 @@ public class MonitorServiceImpl implements MonitorService { @Override public Boolean updateStuMonitor(StuMonitorQuVo stuMonitorQuVo) { String key = "userCache:"+stuMonitorQuVo.getTaskId()+":" + stuMonitorQuVo.getStuId(); + String keychoice = "keychoice:"+stuMonitorQuVo.getTaskId()+":" + stuMonitorQuVo.getStuId(); MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key),MonitorDO.class); + + + if (info != null) { if (!("1".equals(info.getExamStatus()))){ return false; } - AtomicInteger totalScore = new AtomicInteger(); // 用于累加总分 - // 记录答题结果 - List paperSchemeMaps = stuMonitorQuVo.getPaperSchemeMaps(); - for (StuMonitorQuVo.EducationPaperSchemeMap paperSchemeMap : paperSchemeMaps) { - EducationPaperScheme educationPaperScheme = paperSchemeMap.getEducationPaperScheme(); - Map questionResultMap = paperSchemeMap.getQuestionResultMap(); - questionResultMap.forEach((quId, value) -> { - if (value) { - System.out.println("QuestionId: " + quId + ", boolean: " + value); - String quScores = educationPaperScheme.getQuScores(); - int score = Integer.parseInt(quScores); // 转换为 int 类型的分数 - totalScore.addAndGet(score); // 累加到总分 - - } - }); - } - - // 更新成绩(这里假设一题10分) - - info.setScore(String.valueOf(totalScore)); - + stringRedisTemplate.opsForValue().set(keychoice, JsonUtils.toJsonString(stuMonitorQuVo)); // 更新缓存 - redisTemplate.opsForValue().set(key, info); +// redisTemplate.opsForValue().set(key, info); // monitorMapper.updateById(info); } return true; @@ -218,6 +207,22 @@ public class MonitorServiceImpl implements MonitorService { @Override public void endStuMonitor(StuMonitorPaperEndVo stuMonitorPaperEndVo) { String key = "userCache:" + stuMonitorPaperEndVo.getTaskId()+":" +stuMonitorPaperEndVo.getStuId(); + String keychoice = "keychoice:"+stuMonitorPaperEndVo.getTaskId()+":" + stuMonitorPaperEndVo.getStuId(); + StuMonitorQuVo stuMonitorQuVo = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(keychoice),StuMonitorQuVo.class); + + try { + String fileName = "StuMonitorQu.txt"; + FileWriter writer = new FileWriter(fileName); + writer.write(JsonUtils.toJsonString(stuMonitorQuVo)); + writer.close(); + //上传至 + + + + } catch (IOException e) { + System.out.println(e); + } + MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key),MonitorDO.class); EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(stuMonitorPaperEndVo.getTaskId()); EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(stuMonitorPaperEndVo.getTaskId()); @@ -225,10 +230,14 @@ public class MonitorServiceImpl implements MonitorService { info.setScore(stuMonitorPaperEndVo.getScore()); }else { MonitorDO monitorDO = monitorMapper.selectById(info.getMonitorId()); - if (Integer.parseInt(monitorDO.getScore()) selectStuIdByTaskId(String taskid) { + return educationPaperPersonMapper.selectStuIdByTaskId(taskid); + } + /** * 查询试卷人员分配列表 diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperServiceImpl.java index 7e63c9ee..73c1df05 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperServiceImpl.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperServiceImpl.java @@ -8,9 +8,12 @@ import pc.exam.pp.framework.common.pojo.PageResult; import pc.exam.pp.framework.tenant.core.aop.TenantIgnore; import pc.exam.pp.framework.tenant.core.context.TenantContextHolder; import pc.exam.pp.module.exam.controller.admin.paper.dto.EducationPaperStuDto; +import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo; import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo; import pc.exam.pp.module.exam.dal.dataobject.*; import pc.exam.pp.module.exam.dal.mysql.paper.*; +import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper; +import pc.exam.pp.module.exam.dal.mysql.question.SysFileMapper; import pc.exam.pp.module.exam.utils.uuid.IdUtils; import java.util.*; @@ -40,6 +43,11 @@ public class EducationPaperServiceImpl implements IEducationPaperService @Autowired private EducationPaperPersonMapper educationPaperPersonMapper; + + @Autowired + private ExamQuestionMapper examQuestionMapper; + @Autowired + private SysFileMapper sysFileMapper; /** * 查询试卷 * @@ -172,10 +180,12 @@ public class EducationPaperServiceImpl implements IEducationPaperService //构建试卷试题对象 List educationPaperQus=new ArrayList<>(); if (examQuestionIds!=null&& examQuestionIds.size()>0){ + int sort = 1; // 从1开始 for (String examQuestionId : examQuestionIds) { EducationPaperQu educationPaperQu=new EducationPaperQu(); educationPaperQu.setPaperId(uuid); educationPaperQu.setQuId(examQuestionId); + educationPaperQu.setSort(String.valueOf(sort++)); educationPaperQus.add(educationPaperQu); } educationPaperQuMapper.insertEducationPaperQuList(educationPaperQus); @@ -275,14 +285,14 @@ public class EducationPaperServiceImpl implements IEducationPaperService for (EducationPaper educationPaper : list) { EducationPaperStuDto educationPaperStuDto=new EducationPaperStuDto(); - EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(educationPaper.getTaskId()); +// EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(educationPaper.getTaskId()); educationPaperStuDto.setPaperId(educationPaper.getPaperId()); educationPaperStuDto.setNum(educationPaper.getNum()); educationPaperStuDto.setTaskId(educationPaper.getTaskId()); educationPaperStuDto.setCounts(educationPaper.getCounts()); educationPaperStuDto.setRollUp(educationPaper.getRollUp()); educationPaperStuDto.setIsAb(educationPaper.getIsAb()); - educationPaperStuDto.setEducationPaperParam(educationPaperParam); +// educationPaperStuDto.setEducationPaperParam(educationPaperParam); educationPaperStuDtos.add(educationPaperStuDto); } } @@ -300,6 +310,96 @@ public class EducationPaperServiceImpl implements IEducationPaperService } + @Override + public ExamPaperVo stuInfoPaper(String taskid) { + + + EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(taskid); + String taskSpecialty = educationPaperTask.getTaskSpecialty(); + + //根据试卷任务id查找方案集合 + List educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskid); + List examQuestionIds = new ArrayList<>(); + for (EducationPaperScheme educationPaperScheme : educationPaperSchemeList) { + //获取试卷方案对象 + String pointNames = educationPaperScheme.getPointNames(); + //知识点id + List pointList ; + //知识点名称 + List pointName =new ArrayList<>(); + if (pointNames!=null){ + pointList = Arrays.asList(pointNames.split(",")); + if (pointList!=null){ + pointName= educationPaperTaskMapper.selectPointByid(pointList); + } + } + String keywords = educationPaperScheme.getKeywords(); + List keywordList =new ArrayList<>(); + if (keywords != null && !keywords.trim().isEmpty()) { + keywordList = Arrays.asList(keywords.split(",")); + } + if ("3".equals(educationPaperScheme.getQuLevel())){ + educationPaperScheme.setQuLevel(""); + } + //根据方案,去查找 试题表,返回试题id + Long requiredTenantId = TenantContextHolder.getRequiredTenantId(); + + List quId = educationPaperMapper.selectQuByPaperScheme(pointName,keywordList,educationPaperScheme,taskSpecialty,requiredTenantId); + //把第i张卷子方案的试题全加一起 + examQuestionIds.addAll(quId); + + } + int number=educationPaperMapper.selectCountPaperList(); + + // 格式化为8位,不足前面补0 + String formattedNumber = String.format("%08d", number); + + + + //构建试卷 + EducationPaper educationPaper =new EducationPaper(); + String uuid = IdUtils.simpleUUID(); + educationPaper.setPaperId(uuid); + educationPaper.setTaskId(taskid); + educationPaper.setNum(formattedNumber); + educationPaper.setTenantId(TenantContextHolder.getRequiredTenantId()); + educationPaperMapper.insertEducationPaper(educationPaper); + + System.out.println(examQuestionIds+"examQuestionIdsexamQuestionIds"); + + //构建试卷试题对象 + List educationPaperQus=new ArrayList<>(); + if (examQuestionIds!=null&& examQuestionIds.size()>0){ + for (String examQuestionId : examQuestionIds) { + EducationPaperQu educationPaperQu=new EducationPaperQu(); + educationPaperQu.setPaperId(uuid); + educationPaperQu.setQuId(examQuestionId); + educationPaperQus.add(educationPaperQu); + } + educationPaperQuMapper.insertEducationPaperQuList(educationPaperQus); + } + + + List quIds =educationPaperQuMapper.selectPaperQuByPaperId(uuid); + List examQuestionList=examQuestionMapper.selectExamQuestionListByQuIds(quIds); + + if (examQuestionList!=null&&examQuestionList.size()>0){ + for (ExamQuestion examQuestion : examQuestionList) { + //查找原始和素材试题文件 + List sysFileUploads =sysFileMapper.selectSysFileByQuidIN(examQuestion.getQuId()); + examQuestion.setFileUploads(sysFileUploads); + } + + } + ExamPaperVo examPaperVo=new ExamPaperVo(); + examPaperVo.setExamQuestionList(examQuestionList); + examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList); + + return examPaperVo; + + + } + } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperTaskServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperTaskServiceImpl.java index fcc0b0fb..e9a1a940 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperTaskServiceImpl.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperTaskServiceImpl.java @@ -1,6 +1,7 @@ package pc.exam.pp.module.exam.service.paper; +import com.alibaba.excel.util.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -9,9 +10,12 @@ import pc.exam.pp.framework.tenant.core.aop.TenantIgnore; import pc.exam.pp.framework.tenant.core.context.TenantContextHolder; import pc.exam.pp.module.exam.controller.admin.paper.dto.SchemeParam; import pc.exam.pp.module.exam.controller.admin.paper.dto.TempDto; +import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo; import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperTaskPageVo; import pc.exam.pp.module.exam.dal.dataobject.*; import pc.exam.pp.module.exam.dal.mysql.paper.*; +import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper; +import pc.exam.pp.module.exam.dal.mysql.question.SysFileMapper; import pc.exam.pp.module.exam.utils.date.DateUtils; import pc.exam.pp.module.exam.utils.uuid.IdUtils; @@ -46,7 +50,13 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService @Autowired private EducationPaperTaskMapper educationPaperTaskMapper; + @Autowired + private SysFileMapper sysFileMapper; +//@Autowired +//private ExamQuestionMapper + @Autowired + private ExamQuestionMapper examQuestionMapper; /** * 查询试卷任务 @@ -86,6 +96,9 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService } paperTask.setCount(String.valueOf(count)); + + EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(paperTask.getTaskId()); + paperTask.setEducationPaperParam(educationPaperParam); } } @@ -129,7 +142,11 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService educationPaperParam.setIsAnswer("0"); educationPaperParam.setIsLook("0"); } - + if ("0".equals(educationPaperTask.getTaskType())||"1".equals(educationPaperTask.getTaskType())||"3".equals(educationPaperTask.getTaskType())){ + educationPaperTask.setIsOne("0"); + }else{ + educationPaperTask.setIsOne("1"); + } educationPaperParamMapper.insertEducationPaperParam(educationPaperParam); @@ -362,4 +379,30 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService public boolean changeStatus(String taskId, String status) { return educationPaperTaskMapper.changeStatus(taskId,status); } + + @Override + public ExamPaperVo selectPaperQuByPaperId(String taskId) { + String paperId= educationPaperTaskMapper.selectPaperQuByPaperId(taskId); + + List examQuestionList=new ArrayList<>(); + List educationPaperSchemeList=new ArrayList<>(); + if (StringUtils.isNotBlank(paperId)){ + List quIds =educationPaperQuMapper.selectPaperQuByPaperId(paperId); + examQuestionList=examQuestionMapper.selectExamQuestionListByQuIds(quIds); + if (examQuestionList!=null&&examQuestionList.size()>0){ + for (ExamQuestion examQuestion : examQuestionList) { + //查找原始和素材试题文件 + List sysFileUploads =sysFileMapper.selectSysFileByQuidIN(examQuestion.getQuId()); + examQuestion.setFileUploads(sysFileUploads); + } + + } + educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskId); + } + ExamPaperVo examPaperVo=new ExamPaperVo(); + examPaperVo.setExamQuestionList(examQuestionList); + examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList); + + return examPaperVo; + } } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperPersonService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperPersonService.java index f10338b4..b3ba1684 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperPersonService.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperPersonService.java @@ -77,6 +77,8 @@ public interface IEducationPaperPersonService int removeTaskStu(DeleteRequestVo deleteRequestVo); + List selectStuIdByTaskId(String taskid); + // PageResult selectExamStuList(StudentPageReqVO examStu); diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperService.java index 7b175d61..11429965 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperService.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperService.java @@ -3,6 +3,7 @@ package pc.exam.pp.module.exam.service.paper; import pc.exam.pp.framework.common.pojo.PageResult; import pc.exam.pp.module.exam.controller.admin.paper.dto.EducationPaperStuDto; +import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo; import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo; import pc.exam.pp.module.exam.dal.dataobject.PaperListResponseVo; import pc.exam.pp.module.exam.dal.dataobject.EducationPaper; @@ -90,5 +91,6 @@ public interface IEducationPaperService PageResult selectStuEducationPaperList(PaperPageVo paperPageVo); + ExamPaperVo stuInfoPaper(String taskid); } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperTaskService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperTaskService.java index fc26ec4f..e14bc365 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperTaskService.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperTaskService.java @@ -4,6 +4,7 @@ package pc.exam.pp.module.exam.service.paper; import pc.exam.pp.framework.common.pojo.PageResult; import pc.exam.pp.module.exam.controller.admin.paper.dto.SchemeParam; import pc.exam.pp.module.exam.controller.admin.paper.dto.TempDto; +import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo; import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperTaskPageVo; import pc.exam.pp.module.exam.dal.dataobject.ExamPaperKnowledgePoints; import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask; @@ -82,5 +83,6 @@ public interface IEducationPaperTaskService boolean changeStatus(String taskId, String status); + ExamPaperVo selectPaperQuByPaperId(String taskId); } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperQuMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperQuMapper.xml index 9a1e7cf5..b49c5d92 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperQuMapper.xml +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperQuMapper.xml @@ -7,11 +7,11 @@ - + - select paper_id, qu_id, qu_version from education_paper_qu + select paper_id, qu_id, sort from education_paper_qu @@ -28,7 +28,7 @@ where paper_id = #{paperId} + @@ -160,6 +170,7 @@ task_name = #{taskName}, task_specialty = #{taskSpecialty}, task_type = #{taskType}, + is_one = #{isOne}, is_template = #{isTemplate}, status = #{status}, create_time = #{createTime}, diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Browser/BrowserComtroller.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Browser/BrowserComtroller.java index 1ba0adca..77d4efde 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Browser/BrowserComtroller.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Browser/BrowserComtroller.java @@ -21,9 +21,9 @@ public class BrowserComtroller { * 浏览器判分 * @return 得分 */ - @PostMapping("/run_judgement") - public CommonResult run_C_code() throws IOException { - return CommonResult.success(browserServerice.Judgement()); - } +// @PostMapping("/run_judgement") +// public CommonResult run_C_code() throws IOException { +// return CommonResult.success(browserServerice.Judgement()); +// } } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Mysql/MysqlController.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Mysql/MysqlController.java index d48f7ffb..cf03213b 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Mysql/MysqlController.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/Mysql/MysqlController.java @@ -25,9 +25,9 @@ public class MysqlController { * Mysql判分 * @return 得分 */ - @PostMapping("/run_judgement") - public CommonResult run_C_code() throws SQLException, IOException { - return CommonResult.success(mysqlServerice.Judgement()); - } +// @PostMapping("/run_judgement") +// public CommonResult run_C_code() throws SQLException, IOException { +// return CommonResult.success(mysqlServerice.Judgement( )); +// } } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/WindowFile/WindowsFileController.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/WindowFile/WindowsFileController.java index 23eb03e6..8bb0b25c 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/WindowFile/WindowsFileController.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/WindowFile/WindowsFileController.java @@ -27,10 +27,10 @@ public class WindowsFileController { * 文件操作题判分 * @return 判分 */ - @PostMapping("/run_judgement") - public CommonResult run_file_point() throws IOException { - //"权值得分比重" - return CommonResult.success(fileServerice.run_file_point()); - } +// @PostMapping("/run_judgement") +// public CommonResult run_file_point() throws IOException { +// //"权值得分比重" +// return CommonResult.success(fileServerice.run_file_point()); +// } } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/browser/BrowserServericeImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/browser/BrowserServericeImpl.java index 0693be70..36798301 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/browser/BrowserServericeImpl.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/browser/BrowserServericeImpl.java @@ -1,12 +1,14 @@ package pc.exam.pp.module.judgement.controller.service.browser; 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.judgement.controller.utils.brower.BookmarkChecker; import pc.exam.pp.module.judgement.controller.utils.brower.BookmarkDeleter; import pc.exam.pp.module.exam.utils.file.GetDifferencesBetweenFolders; import java.io.BufferedWriter; +import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.nio.file.Paths; @@ -16,13 +18,13 @@ import java.util.Map; @Service public class BrowserServericeImpl implements IBrowserServerice { - static String answerLogPath = "answerLogBrower.txt"; // 文件路径 + static String answerLogPath ; // 文件路径 //考生试题文件夹 - static final String BASE_DIR = "D:/exam/4/"; +// static final String BASE_DIR = "D:/exam/4/"; //谷歌浏览器 String chromeBookmarkPath = System.getenv("LOCALAPPDATA") + "\\Google\\Chrome\\User Data\\Default\\Bookmarks"; @Override - public String Judgement() throws IOException { + public double Judgement(double score, File file, ExamQuestion question) throws IOException { //根据题目,查找考点 //得到该试题的得分点 @@ -30,9 +32,9 @@ public class BrowserServericeImpl implements IBrowserServerice { // 添加到文件夹 1 // 添加到收藏夹 2 List answerList=new ArrayList<>(); - answerList.add(new ExamQuestionAnswer("","","","","1", "文件名1", "1", "1")); - answerList.add(new ExamQuestionAnswer("","","","","1", "文件名2", "1", "2")); - answerList.add(new ExamQuestionAnswer("","","","","2", "百度一下,你就知道", "1", "3")); + answerList.add(new ExamQuestionAnswer("","","","","1", "人民大学", "1", "1")); + answerList.add(new ExamQuestionAnswer("","","","","1", "校情", "1", "2")); + answerList.add(new ExamQuestionAnswer("","","","","1", "机构", "1", "3")); //判断如果类型为1,为添加到文件夹的html,后缀加 .html for (ExamQuestionAnswer answer : answerList) { if ("1".equals(answer.getContent())) { @@ -49,10 +51,10 @@ public class BrowserServericeImpl implements IBrowserServerice { // 2:收藏夹--去浏览器去找 根据值 文件名 查找 // 找到后 —————— +权值 ,根据文件名删除 - + answerLogPath = file.getParent() + File.separator + "log.txt"; //根据路径,得到考生答题文件集合 - Map stuFiles = GetDifferencesBetweenFolders.listFilesAndFoldersWithAttributes(Paths.get(BASE_DIR)); + Map stuFiles = GetDifferencesBetweenFolders.listFilesAndFoldersWithAttributes(file.toPath()); // 输出学生提交的内容 @@ -87,9 +89,10 @@ public class BrowserServericeImpl implements IBrowserServerice { .sum(); // 计算最终得分比例(保留两位小数) double scoreRatio = totalScore == 0 ? 0 : (double) studentScore / totalScore; - String formattedScoreRatio = String.format("%.2f", scoreRatio); - return formattedScoreRatio; + double roundedScoreRatio = Math.round(scoreRatio * 100.0) / 100.0; // 四舍五入到2位小数 + + return roundedScoreRatio*score; } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/browser/IBrowserServerice.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/browser/IBrowserServerice.java index eb6b260a..13a1861c 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/browser/IBrowserServerice.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/browser/IBrowserServerice.java @@ -1,8 +1,12 @@ package pc.exam.pp.module.judgement.controller.service.browser; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; + +import java.io.File; import java.io.IOException; public interface IBrowserServerice { - String Judgement() throws IOException; + double Judgement(double score, File file, ExamQuestion question) throws IOException; + } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/file/FileServericeImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/file/FileServericeImpl.java index 30138e58..bb3da760 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/file/FileServericeImpl.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/file/FileServericeImpl.java @@ -1,10 +1,12 @@ package pc.exam.pp.module.judgement.controller.service.file; 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.utils.file.GetDifferencesBetweenFolders; import java.io.BufferedWriter; +import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.nio.file.Paths; @@ -12,17 +14,15 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; @Service public class FileServericeImpl implements IFileServerice { static final String BASE_DIR = "D:/exam/3/"; - static String answerLogPath = "answerLogFile.txt"; // 文件路径 + static String answerLogPath ; // 文件路径 @Override - public String run_file_point() throws IOException { + public double run_file_point(double score,File file, ExamQuestion question) throws IOException { //todo 得到学生的考题答案 List answerList=new ArrayList<>(); answerList.add(new ExamQuestionAnswer("","","","","HGACYL\\RLQM.MEM", "考察删除", "1", "1")); @@ -30,10 +30,16 @@ public class FileServericeImpl implements IFileServerice { answerList.add(new ExamQuestionAnswer("","","","","AHEWL\\KMENS", "考察名称", "1", "3")); answerList.add(new ExamQuestionAnswer("","","","","EDZK\\RONGHE.COM", "考察名称", "1", "4")); answerList.add(new ExamQuestionAnswer("","","","","HGACYL\\PLAY.MEM", "考察名称", "1", "5")); + answerList.add(new ExamQuestionAnswer("","","","","WUE\\PB6.txt", "考察名称", "1", "6")); - String stuPath = BASE_DIR + "stu"; + + + File stuPath = file; + + // 设置日志文件路径为file所在目录下的answerLogFile.txt + answerLogPath = file.getParent() + File.separator + "log.txt"; // 获取 stu 文件夹的内容 - Map stuFiles = GetDifferencesBetweenFolders.listFilesAndFoldersWithAttributes(Paths.get( stuPath)); + Map stuFiles = GetDifferencesBetweenFolders.listFilesAndFoldersWithAttributes(stuPath.toPath()); // 输出学生提交的内容 appendToFile(answerLogPath,"=== 学生提交内容(stu 目录) ==="); @@ -52,9 +58,9 @@ public class FileServericeImpl implements IFileServerice { .sum(); // 计算最终得分比例(保留两位小数) double scoreRatio = totalScore == 0 ? 0 : (double) studentScore / totalScore; - String formattedScoreRatio = String.format("%.2f", scoreRatio); + double roundedScoreRatio = Math.round(scoreRatio * 100.0) / 100.0; // 四舍五入到2位小数 - return formattedScoreRatio; + return roundedScoreRatio*score; } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/file/IFileServerice.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/file/IFileServerice.java index 004c9ab5..b08407a7 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/file/IFileServerice.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/file/IFileServerice.java @@ -1,8 +1,10 @@ package pc.exam.pp.module.judgement.controller.service.file; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; import pc.exam.pp.module.exam.dal.dataobject.ExamQuestionAnswer; +import java.io.File; import java.io.IOException; import java.util.List; @@ -11,7 +13,7 @@ public interface IFileServerice { - String run_file_point() throws IOException; + double run_file_point(double score,File file, ExamQuestion question) throws IOException; } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/mysql/IMysqlServerice.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/mysql/IMysqlServerice.java index acc06f51..4ed40986 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/mysql/IMysqlServerice.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/mysql/IMysqlServerice.java @@ -1,6 +1,7 @@ package pc.exam.pp.module.judgement.controller.service.mysql; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; import pc.exam.pp.module.exam.dal.dataobject.ExamQuestionAnswer; import java.io.IOException; @@ -9,7 +10,7 @@ import java.util.List; import java.util.concurrent.atomic.AtomicInteger; public interface IMysqlServerice { - AtomicInteger Judgement() throws IOException, SQLException; + double Judgement(double sorce, ExamQuestion examQuestion) throws IOException, SQLException; diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/mysql/MysqlServericeImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/mysql/MysqlServericeImpl.java index 47cff8ce..2c561941 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/mysql/MysqlServericeImpl.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/service/mysql/MysqlServericeImpl.java @@ -1,6 +1,7 @@ package pc.exam.pp.module.judgement.controller.service.mysql; 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.ExamQuestionKeyword; import pc.exam.pp.module.judgement.controller.utils.Mysql.MySQLExporterUtil; @@ -28,7 +29,7 @@ public class MysqlServericeImpl implements IMysqlServerice { static String databaseName; static String answerLogPath = "answerLogMysql.txt"; // 文件路径 @Override - public AtomicInteger Judgement() throws IOException, SQLException { + public double Judgement(double score, ExamQuestion examQuestion) throws IOException, SQLException { AtomicInteger totalScoreAnswer= new AtomicInteger(); @@ -796,10 +797,20 @@ public class MysqlServericeImpl implements IMysqlServerice { System.out.println("文件不存在: " + fileback); } } + String totalscore = "44"; + double Score = score * (totalScoreAnswer.get() / Double.parseDouble(totalscore)); + + + return Score; + + - return totalScoreAnswer; } + + + + /** * 将指定内容追加写入到指定文件中。 * diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsServiceImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsServiceImpl.java index 7c757f93..d3d10ed2 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsServiceImpl.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsServiceImpl.java @@ -12,6 +12,9 @@ import pc.exam.pp.module.exam.service.question.IExamQuestionService; import pc.exam.pp.module.exam.service.stu_paper_file.StuPaperFileService; import pc.exam.pp.module.infra.dal.dataobject.config.ConfigDO; import pc.exam.pp.module.infra.service.config.ConfigService; +import pc.exam.pp.module.judgement.controller.service.browser.IBrowserServerice; +import pc.exam.pp.module.judgement.controller.service.file.IFileServerice; +import pc.exam.pp.module.judgement.controller.service.mysql.IMysqlServerice; import pc.exam.pp.module.judgement.service.c_programming.JudgementService; import pc.exam.pp.module.judgement.service.wps_word.JudgementWpsWordService; @@ -35,7 +38,12 @@ public class AutoToolsServiceImpl implements AutoToolsService{ JudgementService judgementService; @Resource JudgementWpsWordService judgementWpsWordService; - + @Resource + IMysqlServerice mysqlServerice; + @Resource + IFileServerice fileServerice; + @Resource + IBrowserServerice browserServerice; @Override public String downloadStudentFile(String fileUrl, String filePath) { try { @@ -187,7 +195,30 @@ public class AutoToolsServiceImpl implements AutoToolsService{ score += wps_word_score; break; } + // D:\1d70c404e6d42d144d0028496e893565dd2dec447f7e9b1db66466f00472424d\160\cb3cc9089b104a1e9e92deb330d0cfe8\d9f988d5ae6d435ba12d4d979d044219\stu + //windows文件处理 + if (file_one.getName().equals("stu")) { + File win_file = new File(file_one.getPath()); + double win_file_score = fileServerice.run_file_point(20.0,win_file, examQuestion); + score += win_file_score; + + } + System.out.println(file_one); + //浏览器操作 + // if ("浏览器网络题".equals(examQuestion.getCourseName()+examQuestion.getSubjectName())){ + if (file_one.getName().equals("edge")) { + File edge_file = new File(file_one.getPath()); + + double browse_score= browserServerice.Judgement(20.0,edge_file,examQuestion); + score += browse_score; + } + + } + ExamQuestion mysql=new ExamQuestion(); + double judgement = mysqlServerice.Judgement(20, mysql); + score+=judgement; + } return CommonResult.success(score); }