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 13355d26..ff013570 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 @@ -27,7 +27,8 @@ import static pc.exam.pp.framework.apilog.core.enums.OperateTypeEnum.*; import pc.exam.pp.module.exam.controller.admin.monitor.vo.*; import pc.exam.pp.module.exam.dal.dataobject.monitor.MonitorDO; import pc.exam.pp.module.exam.service.monitor.MonitorService; - +import static pc.exam.pp.module.infra.enums.ErrorCodeConstants.DEMO03_MONITOR_SESSION_EXISTS; +import static pc.exam.pp.module.infra.enums.ErrorCodeConstants.DEMO03_MONITOR_TIME_EXISTS; @Tag(name = "管理后台 - 监控管理") @RestController @@ -92,13 +93,18 @@ public void exportMonitorExcel(@Valid MonitorPageReqVO pageReqVO, HttpServletRes { return success("进入考试成功"); } - return error(100_200_300,"不在考试时间范围内!"); + return error(DEMO03_MONITOR_TIME_EXISTS); } @PostMapping("/stuMonitorQu") @Operation(summary = "学生端考试过程传试题") - public void updateStuMonitor(@Valid @RequestBody StuMonitorQuVo stuMonitorQuVo) { - monitorService.updateStuMonitor(stuMonitorQuVo); + public CommonResult updateStuMonitor(@Valid @RequestBody StuMonitorQuVo stuMonitorQuVo) { + Boolean stuMonitor= monitorService.updateStuMonitor(stuMonitorQuVo); + if (!stuMonitor) + { + return error(DEMO03_MONITOR_SESSION_EXISTS); + } + return success("传值成功"); } @PostMapping("/endMonitor") @Operation(summary = "学生端结束考试返回值") @@ -106,4 +112,19 @@ public void exportMonitorExcel(@Valid MonitorPageReqVO pageReqVO, HttpServletRes monitorService.endStuMonitor(stuMonitorPaperEndVo); } + + @GetMapping("/getPaperTaskList") + @Operation(summary = "根据种类获得试卷任务") + @Parameter(name = "id", description = "试卷种类", required = true, example = "1024") + public CommonResult getPaperTaskList(@RequestParam("id") String id) { + + return success(monitorService.getPaperTaskList(id)); + } + + @PostMapping("/updateMonitorStatus") + @Operation(summary = "改变考生状态") + public CommonResult updateMonitorStatus(@Valid @RequestBody StuMonitorStatusVo stuMonitorStatusVo) { + return success(monitorService.updateMonitorStatus(stuMonitorStatusVo)); + } + } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/MonitorPageReqVO.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/MonitorPageReqVO.java index 00bed8a8..bd50df61 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/MonitorPageReqVO.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/MonitorPageReqVO.java @@ -1,6 +1,7 @@ package pc.exam.pp.module.exam.controller.admin.monitor.vo; +import com.baomidou.mybatisplus.annotation.TableLogic; import lombok.*; import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; @@ -15,6 +16,7 @@ import static pc.exam.pp.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_ @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MonitorPageReqVO extends PageParam { +private String [] monitorId; @Schema(description = "用户账号", example = "芋艿") private String username; @@ -37,6 +39,8 @@ private String paperNum; @Schema(description = "场次", example = "赵六") private String taskName; +private String taskType; + @Schema(description = "机器ip") private String ip; diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/MonitorRespVO.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/MonitorRespVO.java index 8ddf894c..fe5afd1c 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/MonitorRespVO.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/MonitorRespVO.java @@ -39,10 +39,14 @@ private String score; @ExcelProperty("试卷编号") private String paperNum; -@Schema(description = "场次", example = "赵六") -@ExcelProperty("场次") +@Schema(description = "任务名称") +@ExcelProperty("任务名称") private String taskName; +@Schema(description = "任务类别") +@ExcelProperty("任务类别") +private String taskType; + @Schema(description = "机器ip") @ExcelProperty("机器ip") private String ip; diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/StuMonitorStatusVo.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/StuMonitorStatusVo.java new file mode 100644 index 00000000..9d36700b --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/monitor/vo/StuMonitorStatusVo.java @@ -0,0 +1,12 @@ +package pc.exam.pp.module.exam.controller.admin.monitor.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; +@Schema(description = "管理后台 - 监控管理 改变学生考试状态 Request VO") +@Data +public class StuMonitorStatusVo { + private List monitorIds; + private String status; +} 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 6edbae00..0adc9535 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 @@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.*; import pc.exam.pp.framework.common.pojo.CommonResult; import pc.exam.pp.framework.common.pojo.PageResult; import pc.exam.pp.framework.common.util.object.BeanUtils; +import pc.exam.pp.module.exam.controller.admin.paper.dto.EducationPaperStuDto; import pc.exam.pp.module.exam.controller.admin.paper.dto.PaperQueryRequest; import pc.exam.pp.module.exam.controller.admin.paper.dto.StatusDto; import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo; @@ -19,6 +20,7 @@ import pc.exam.pp.module.exam.service.paper.IEducationPaperService; import java.util.List; import static pc.exam.pp.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR; +import static pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; /** * 试卷Controller @@ -152,8 +154,6 @@ public class EducationPaperController @PostMapping(value = "/getPaperByTaskIdByType") public CommonResult getPaperByTaskIdByType(@RequestBody PaperQueryRequest requestData) { - - return CommonResult.success(educationPaperService.getPaperByTaskIdByType(requestData.getTaskId(), requestData.getRows())); } @@ -165,4 +165,14 @@ public class EducationPaperController ); } + + + @GetMapping("/stulist") + public CommonResult> stulist(PaperPageVo paperPageVo) + { + + PageResult pageResult = educationPaperService.selectStuEducationPaperList(paperPageVo); + return CommonResult.success(pageResult); + } + } 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 new file mode 100644 index 00000000..2e868192 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/EducationPaperStuDto.java @@ -0,0 +1,39 @@ +package pc.exam.pp.module.exam.controller.admin.paper.dto; + +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperParam; + +@Data +public class EducationPaperStuDto { + + private static final long serialVersionUID = 1L; + + /** 主键ID */ + @TableId + private String paperId; + + /** 试卷任务ID */ + // @Excel(name = "试卷任务ID") + private String taskId; + + private String num; + /** 使用次数 */ + // @Excel(name = "使用次数") + private String counts; + + /** 抽卷方式(0固定1AB2随机) */ + //@Excel(name = "抽卷方式(0固定1AB2随机)") + private String rollUp; + + /** 0A1B */ + //Excel(name = "0A1B") + private String isAb; + + + + EducationPaperParam educationPaperParam; + + + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/PaperPageVo.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/PaperPageVo.java index 06f15389..85acda9d 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/PaperPageVo.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/vo/PaperPageVo.java @@ -5,6 +5,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; import pc.exam.pp.framework.common.pojo.PageParam; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperParam; + @Schema(description = "试卷vo") @Data @EqualsAndHashCode(callSuper = true) diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaper.java index e92309c6..5858ace4 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaper.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaper.java @@ -48,6 +48,5 @@ public class EducationPaper extends TenantBaseDO // @Excel(name = "0启用1不启") private String status; - } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperParam.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperParam.java index 7a8b2862..32d6ec9e 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperParam.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperParam.java @@ -27,6 +27,12 @@ public class EducationPaperParam /** 试卷任务ID */ // @Excel(name = "试卷任务ID") private String taskId; + //是否显示试卷编号 + private String isNumber; + //是否显示试卷内容 + private String isContent; + //是否显示答案id + private String isAnswerId; /** 是否使用监考密码验证(0是1否) */ // @Excel(name = "是否使用监考密码验证", readConverterExp = "0=是1否") diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperSession.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperSession.java index 2d3c677c..20acb680 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperSession.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperSession.java @@ -1,5 +1,6 @@ package pc.exam.pp.module.exam.dal.dataobject; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonInclude; @@ -24,6 +25,7 @@ public class EducationPaperSession private static final long serialVersionUID = 1L; /** 主键ID */ + @TableId private String sessionId; /** 试卷任务ID */ 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 d04976c0..fd059ecc 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 @@ -1,6 +1,8 @@ package pc.exam.pp.module.exam.dal.dataobject; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; @@ -39,6 +41,8 @@ public class EducationPaperTask extends TenantBaseDO //@Excel(name = "试卷任务模式") private String taskType; + private String isOne; + /** 是否为模板 */ //@Excel(name = "是否为模板") private String isTemplate; @@ -47,8 +51,8 @@ public class EducationPaperTask extends TenantBaseDO //@Excel(name = "是否启用", readConverterExp = "0=:启用,1:停用") private String status; - - + @TableField(exist = false) + private String count; } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/monitor/MonitorDO.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/monitor/MonitorDO.java index fc7d75e0..437c1330 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/monitor/MonitorDO.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/monitor/MonitorDO.java @@ -27,6 +27,8 @@ public class MonitorDO extends BaseDO { */ @TableId(type = IdType.INPUT) private String monitorId; + +private String stuId; /** * 用户账号 */ @@ -51,10 +53,11 @@ private String score; * 试卷编号 */ private String paperNum; -/** - * 场次 - */ + +private String taskId; private String taskName; + +private String taskType; /** * 机器ip */ diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/student/StuPaperFileDO.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/student/StuPaperFileDO.java new file mode 100644 index 00000000..fbec5417 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/student/StuPaperFileDO.java @@ -0,0 +1,38 @@ +package pc.exam.pp.module.exam.dal.dataobject.student; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; +import pc.exam.pp.framework.tenant.core.db.TenantBaseDO; + +/** + * 学生-试卷-文件表 DO + * + * @author rwb + */ +@TableName("exam_stu_paper_fileurl") +@Data +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class StuPaperFileDO extends TenantBaseDO { + + /** + * Id + */ + @TableId + private Long id; + /** + * 学生号 + */ + private Long stuId; + /** + * 试卷ID + */ + private String paperId; + /** + * 学生文件URL + */ + private String url; +} \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/monitor/MonitorMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/monitor/MonitorMapper.java index ec55c659..fc1b0fb3 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/monitor/MonitorMapper.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/monitor/MonitorMapper.java @@ -8,6 +8,9 @@ import org.apache.ibatis.annotations.Mapper; import pc.exam.pp.module.exam.controller.admin.monitor.vo.MonitorPageReqVO; import pc.exam.pp.module.exam.dal.dataobject.monitor.MonitorDO; +import java.util.Arrays; +import java.util.Optional; + /** * 监控管理 Mapper * @@ -18,10 +21,12 @@ import pc.exam.pp.module.exam.dal.dataobject.monitor.MonitorDO; default PageResult selectPage(MonitorPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() + .inIfPresent(MonitorDO::getMonitorId, Optional.ofNullable(reqVO.getMonitorId()).map(Arrays::asList).orElse(null)) .likeIfPresent(MonitorDO::getUsername, reqVO.getUsername()) .likeIfPresent(MonitorDO::getNickname, reqVO.getNickname()) .likeIfPresent(MonitorDO::getClassName, reqVO.getClassName()) .eqIfPresent(MonitorDO::getExamStatus, reqVO.getExamStatus()) + .eqIfPresent(MonitorDO::getTaskType, reqVO.getTaskType()) .eqIfPresent(MonitorDO::getScore, reqVO.getScore()) .eqIfPresent(MonitorDO::getPaperNum, reqVO.getPaperNum()) .likeIfPresent(MonitorDO::getTaskName, reqVO.getTaskName()) diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperMapper.java index 33a9855f..50555437 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperMapper.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperMapper.java @@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param; import pc.exam.pp.framework.common.pojo.PageResult; import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX; import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX; +import pc.exam.pp.module.exam.controller.admin.paper.dto.EducationPaperStuDto; import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo; import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperTaskPageVo; import pc.exam.pp.module.exam.dal.dataobject.EducationPaper; @@ -121,5 +122,12 @@ public interface EducationPaperMapper extends BaseMapperX int selectCountPaperList(); + default PageResult selectStuEducationPaperList(PaperPageVo paperPageVo) { + return selectPage(paperPageVo, new LambdaQueryWrapperX() + .likeIfPresent(EducationPaper::getTaskId, paperPageVo.getTaskId()) + .isNotNull(EducationPaper::getRollUp) // 改为数据库字段不为 null + .eq(EducationPaper::getStatus, 0) + ); + } } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperPersonMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperPersonMapper.java index 60287fb1..39693fdd 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperPersonMapper.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperPersonMapper.java @@ -107,4 +107,5 @@ public interface EducationPaperPersonMapper List selectEducationPaperPersonBySessionIdNotIn(SessionStuPageReqVO sessionStuPageReqVO); + List selectStuIdByTaskId(String taskId); } 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 c7f87f2e..a78ac482 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 @@ -109,4 +109,5 @@ public interface EducationPaperTaskMapper extends BaseMapperX selectEducationPaperTaskByTaskType(String id); } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/student/StuPaperFileMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/student/StuPaperFileMapper.java new file mode 100644 index 00000000..f13a583a --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/student/StuPaperFileMapper.java @@ -0,0 +1,18 @@ +package pc.exam.pp.module.exam.dal.mysql.student; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX; +import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO; + +/** + * 学生-试卷-文件 Mapper + * + * @author rwb + */ +@Mapper +public interface StuPaperFileMapper extends BaseMapperX { + StuPaperFileDO findByStuIdAndPaperId(@Param("stuId") Long stuId, @Param("paperId") String paperId); + +} \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/monitor/MonitorService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/monitor/MonitorService.java index 0bd7048e..b2d3ed24 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/monitor/MonitorService.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/monitor/MonitorService.java @@ -3,8 +3,11 @@ package pc.exam.pp.module.exam.service.monitor; import jakarta.validation.*; import pc.exam.pp.framework.common.pojo.PageResult; import pc.exam.pp.module.exam.controller.admin.monitor.vo.*; +import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask; import pc.exam.pp.module.exam.dal.dataobject.monitor.MonitorDO; +import java.util.List; + /** * 监控管理 Service 接口 * @@ -52,8 +55,11 @@ import pc.exam.pp.module.exam.dal.dataobject.monitor.MonitorDO; Boolean getStuMonitor(StuMonitorPaperVo stuMonitorPaperVo); - void updateStuMonitor(StuMonitorQuVo stuMonitorQuVo); + Boolean updateStuMonitor(StuMonitorQuVo stuMonitorQuVo); void endStuMonitor(StuMonitorPaperEndVo stuMonitorPaperEndVo); + List getPaperTaskList(String id); + + Boolean updateMonitorStatus(StuMonitorStatusVo stuMonitorStatusVo); } \ No newline at end of file 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 ffa8c860..fc543cb8 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 @@ -108,6 +108,18 @@ public class MonitorServiceImpl implements MonitorService { MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key),MonitorDO.class); if (StringUtils.isNotBlank(stuMonitorPaperVo.getPaperId())){ EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(stuMonitorPaperVo.getPaperId()); + String counts = educationPaper.getCounts(); + + int count = 0; + + try { + count = Integer.parseInt(counts); + } catch (NumberFormatException | NullPointerException e) { + count = 0; // 默认从 0 开始 + } + count += 1; + educationPaper.setCounts(String.valueOf(count)); + educationPaperMapper.updateById(educationPaper); info.setPaperNum(educationPaper.getNum()); } @@ -153,6 +165,9 @@ public class MonitorServiceImpl implements MonitorService { long remainingSeconds = ChronoUnit.SECONDS.between(LocalDateTime.now(), DateUtil.toLocalDateTime(endTime)); info.setRemainingTime(remainingSeconds > 0 ? remainingSeconds : 0); + + + //todo 考虑加点时间,或判分后删除 stringRedisTemplate.opsForValue().set("userCache:"+stuMonitorPaperVo.getTaskId()+":"+stuMonitorPaperVo.getStuId(), JsonUtils.toJsonString(info), remainingSeconds, TimeUnit.SECONDS); monitorMapper.updateById(info); return true; @@ -164,10 +179,13 @@ public class MonitorServiceImpl implements MonitorService { } @Override - public void updateStuMonitor(StuMonitorQuVo stuMonitorQuVo) { + public Boolean updateStuMonitor(StuMonitorQuVo stuMonitorQuVo) { String key = "userCache:"+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(); @@ -193,6 +211,7 @@ public class MonitorServiceImpl implements MonitorService { redisTemplate.opsForValue().set(key, info); // monitorMapper.updateById(info); } + return true; } @@ -216,11 +235,57 @@ public class MonitorServiceImpl implements MonitorService { info.setExamStatus("0"); }else { info.setExamStatus("2"); - redisTemplate.delete(key); } - + redisTemplate.delete(key); monitorMapper.updateById(info); } + @Override + public List getPaperTaskList(String id) { + return educationPaperTaskMapper.selectEducationPaperTaskByTaskType(id); + } + + @Override + public Boolean updateMonitorStatus(StuMonitorStatusVo stuMonitorStatusVo) { + String status = stuMonitorStatusVo.getStatus(); + List monitorIds = stuMonitorStatusVo.getMonitorIds(); + if ("1".equals(status)||"0".equals(status)){ + //新增或更新 + for (String monitorId : monitorIds) { + MonitorDO monitorDO = monitorMapper.selectById(monitorId); + String taskId = monitorDO.getTaskId(); + String stuId = monitorDO.getStuId(); + String key = "userCache:" + taskId+":" +stuId; + monitorDO.setExamStatus(status); + monitorMapper.updateById(monitorDO); + MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key),MonitorDO.class); + + info.setExamStatus(status); + + stringRedisTemplate.opsForValue().set(key, JsonUtils.toJsonString(info)); + + } + + } + + if ("2".equals(status)){ + //删除 + for (String monitorId : monitorIds) { + MonitorDO monitorDO = monitorMapper.selectById(monitorId); + String taskId = monitorDO.getTaskId(); + String stuId = monitorDO.getStuId(); + String key = "userCache:" + taskId+":" +stuId; + monitorDO.setExamStatus(status); + monitorMapper.updateById(monitorDO); + + redisTemplate.delete(key); + + } + } + + return true; + + } + } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperPersonServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperPersonServiceImpl.java index 5606db40..af81cca6 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperPersonServiceImpl.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperPersonServiceImpl.java @@ -196,7 +196,7 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer } else if (existing == null) { - + EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(taskId); String name= educationPaperTaskMapper.selectEducationPaperTaskNameByid(taskId); @@ -206,6 +206,8 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer String uuid = IdUtils.simpleUUID(); MonitorDO info = new MonitorDO(); info.setMonitorId(uuid); + info.setTaskId(taskId); + info.setStuId(studentId); info.setUsername(personRepDto.getUsername()); info.setNickname(personRepDto.getNickname()); //设置学生班级 @@ -217,6 +219,7 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer info.setScore("0"); info.setPaperNum(""); info.setTaskName(name); + info.setTaskType(educationPaperTask.getTaskType()); stringRedisTemplate.opsForValue().set(key, JsonUtils.toJsonString(info)); monitorMapper.insert(info); 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 937a4eea..7e63c9ee 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 @@ -1,24 +1,22 @@ package pc.exam.pp.module.exam.service.paper; +import org.checkerframework.checker.units.qual.A; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; 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.PaperPageVo; -import pc.exam.pp.module.exam.dal.dataobject.PaperListResponseVo; -import pc.exam.pp.module.exam.dal.dataobject.EducationPaper; -import pc.exam.pp.module.exam.dal.dataobject.EducationPaperQu; -import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme; -import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperMapper; -import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperQuMapper; -import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperSchemeMapper; -import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperTaskMapper; +import pc.exam.pp.module.exam.dal.dataobject.*; +import pc.exam.pp.module.exam.dal.mysql.paper.*; import pc.exam.pp.module.exam.utils.uuid.IdUtils; import java.util.*; +import static pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; + /** * 试卷Service业务层处理 * @@ -31,12 +29,17 @@ public class EducationPaperServiceImpl implements IEducationPaperService @Autowired private EducationPaperMapper educationPaperMapper; @Autowired + private EducationPaperParamMapper educationPaperParamMapper; + @Autowired private EducationPaperSchemeMapper educationPaperSchemeMapper; @Autowired private EducationPaperTaskMapper educationPaperTaskMapper; @Autowired private EducationPaperQuMapper educationPaperQuMapper; + + @Autowired + private EducationPaperPersonMapper educationPaperPersonMapper; /** * 查询试卷 * @@ -257,6 +260,46 @@ public class EducationPaperServiceImpl implements IEducationPaperService return educationPaperMapper.changeStatus(paperId,status); } + @Override + public PageResult selectStuEducationPaperList(PaperPageVo paperPageVo) { + String taskId = paperPageVo.getTaskId(); + List stuIds=educationPaperPersonMapper.selectStuIdByTaskId(taskId); + Long loginUserId = getLoginUserId(); + // 判断试卷任务是否包含此学生 + if (stuIds.contains(String.valueOf(loginUserId))) { + // + List educationPaperStuDtos=new ArrayList<>(); + PageResult educationPaperPageResult = educationPaperMapper.selectStuEducationPaperList(paperPageVo); + List list = educationPaperPageResult.getList(); + if (list!=null&&list.size()>0){ + for (EducationPaper educationPaper : list) { + EducationPaperStuDto educationPaperStuDto=new EducationPaperStuDto(); + + 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); + educationPaperStuDtos.add(educationPaperStuDto); + } + } + PageResult educationPaperStuDtoPageResult=new PageResult<>(); + educationPaperStuDtoPageResult.setList(educationPaperStuDtos); + educationPaperStuDtoPageResult.setTotal(educationPaperPageResult.getTotal()); + return educationPaperStuDtoPageResult; + + } else { + // 不包含 + PageResult educationPaperStuDtoPageResult=new PageResult<>(); + return educationPaperStuDtoPageResult; + } + + + } + } 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 29b9aace..fcc0b0fb 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 @@ -68,6 +68,27 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService @Override public PageResult selectEducationPaperTaskList(PaperTaskPageVo educationPaperTask) { PageResult educationPaperTasks = educationPaperTaskMapper.selectEducationPaperTaskList(educationPaperTask); + List list = educationPaperTasks.getList(); + if (list!=null&&list.size()>0){ + for (EducationPaperTask paperTask : list) { + int count=0; + List educationPapers = educationPaperMapper.selectPaperListByTaskId(paperTask.getTaskId()); + if (educationPapers!=null&&educationPapers.size()>0){ + for (EducationPaper educationPaper : educationPapers) { + try { + count += Integer.parseInt(educationPaper.getCounts()); + } catch (NumberFormatException e) { + // 可选:记录异常或忽略非法数字 + System.err.println("无效的 counts 值: " + educationPaper.getCounts()); + } + + } + } + paperTask.setCount(String.valueOf(count)); + + } + } + return educationPaperTasks ; } @@ -89,6 +110,11 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService educationPaperParam.setUsb("0"); educationPaperParam.setSaveGrades("0"); educationPaperParam.setDriver("C"); + educationPaperParam.setIsNumber("1"); + educationPaperParam.setIsConnect("0"); + educationPaperParam.setIsAnswerId("1"); + + educationPaperParam.setDirectory("KSWJ"); educationPaperParam.setUploadTime("5"); educationPaperParam.setIsDel("0"); 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 fc429372..7b175d61 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 @@ -2,6 +2,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.PaperPageVo; import pc.exam.pp.module.exam.dal.dataobject.PaperListResponseVo; import pc.exam.pp.module.exam.dal.dataobject.EducationPaper; @@ -87,5 +88,7 @@ public interface IEducationPaperService int changeStatus(String paperId, String status); + PageResult selectStuEducationPaperList(PaperPageVo paperPageVo); + } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/stu_paper_file/StuPaperFileService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/stu_paper_file/StuPaperFileService.java new file mode 100644 index 00000000..4dc63a73 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/stu_paper_file/StuPaperFileService.java @@ -0,0 +1,24 @@ +package pc.exam.pp.module.exam.service.stu_paper_file; + +import jakarta.validation.Valid; +import pc.exam.pp.framework.common.pojo.PageResult; +import pc.exam.pp.module.exam.controller.admin.student.vo.StudentPageReqVO; +import pc.exam.pp.module.exam.controller.admin.student.vo.StudentSaveReqVO; +import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO; +import pc.exam.pp.module.exam.dal.dataobject.student.StudentDO; + +import java.util.List; + +/** + * 学生-试卷-文件 Service 接口 + * + * @author rwb + */ +public interface StuPaperFileService { + + StuPaperFileDO findByStuIDAndPaperId(Long stuID, String paperID); + + void insertStuPaperFile(StuPaperFileDO stuPaperFileDO); + + void updateStuPaperFile(StuPaperFileDO stuPaperFileDO); +} \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/stu_paper_file/StuPaperFileServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/stu_paper_file/StuPaperFileServiceImpl.java new file mode 100644 index 00000000..3089ef9a --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/stu_paper_file/StuPaperFileServiceImpl.java @@ -0,0 +1,35 @@ +package pc.exam.pp.module.exam.service.stu_paper_file; + +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.mysql.student.StuPaperFileMapper; + +/** + * 学生-试卷-文件 Service 实现类 + * + * @author rwb + */ +@Service +@Validated +public class StuPaperFileServiceImpl implements StuPaperFileService { + + @Resource + private StuPaperFileMapper stuPaperFileMapper; + + @Override + public StuPaperFileDO findByStuIDAndPaperId(Long stuID, String paperID) { + return stuPaperFileMapper.findByStuIdAndPaperId(stuID, paperID); + } + + @Override + public void insertStuPaperFile(StuPaperFileDO stuPaperFileDO) { + stuPaperFileMapper.insert(stuPaperFileDO); + } + + @Override + public void updateStuPaperFile(StuPaperFileDO stuPaperFileDO) { + stuPaperFileMapper.updateById(stuPaperFileDO); + } +} \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperParamMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperParamMapper.xml index 41f4703f..dba90b11 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperParamMapper.xml +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperParamMapper.xml @@ -7,6 +7,9 @@ + + + @@ -23,7 +26,7 @@ - select param_id, task_id, is_exam_password, exam_password, usb, save_grades, driver, directory, upload_time, is_del,is_repeat ,is_answer,is_look,is_connect,is_session from education_paper_param + select param_id, task_id, is_number,is_content,is_answer_id,is_exam_password, exam_password, usb, save_grades, driver, directory, upload_time, is_del,is_repeat ,is_answer,is_look,is_connect,is_session from education_paper_param + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperTaskMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperTaskMapper.xml index 7a2566a9..caf90ab6 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperTaskMapper.xml +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperTaskMapper.xml @@ -113,6 +113,12 @@ + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/SysFileMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/SysFileMapper.xml index 7e89841a..f48e27e2 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/SysFileMapper.xml +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/SysFileMapper.xml @@ -38,7 +38,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and qu_id = #{quId} - and (file_type = '0' or file_type ='1') diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/student/StuPaperFileMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/student/StuPaperFileMapper.xml new file mode 100644 index 00000000..0620ad05 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/student/StuPaperFileMapper.xml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/exam-module-infra/exam-module-infra-api/src/main/java/pc/exam/pp/module/infra/enums/ErrorCodeConstants.java b/exam-module-infra/exam-module-infra-api/src/main/java/pc/exam/pp/module/infra/enums/ErrorCodeConstants.java index db5625ba..7befb3f3 100644 --- a/exam-module-infra/exam-module-infra-api/src/main/java/pc/exam/pp/module/infra/enums/ErrorCodeConstants.java +++ b/exam-module-infra/exam-module-infra-api/src/main/java/pc/exam/pp/module/infra/enums/ErrorCodeConstants.java @@ -73,4 +73,11 @@ public interface ErrorCodeConstants { // ========== 试卷参数 1-001-401-000 ========== ErrorCode DEMO03_PAPER_SESSION_EXISTS = new ErrorCode(1_001_401_001, "请开启考场设置"); + + + // ========== 监控管理 1-001-606-000 ========== + ErrorCode DEMO03_MONITOR_TIME_EXISTS = new ErrorCode(1-001-606-001, "该考试不在考场时间范围内!"); + ErrorCode DEMO03_MONITOR_SESSION_EXISTS = new ErrorCode(1-001-606-002, "考生状态未在考试中!请联系管理员"); + + } diff --git a/exam-module-infra/exam-module-infra-biz/pom.xml b/exam-module-infra/exam-module-infra-biz/pom.xml index 874aeba2..871be7c9 100644 --- a/exam-module-infra/exam-module-infra-biz/pom.xml +++ b/exam-module-infra/exam-module-infra-biz/pom.xml @@ -124,6 +124,12 @@ org.apache.tika tika-core + + pc.exam.gg + exam-module-exam-biz + 2.4.2-SNAPSHOT + compile + diff --git a/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/controller/admin/file/FileController.java b/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/controller/admin/file/FileController.java index 6b7a0192..95da0b54 100644 --- a/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/controller/admin/file/FileController.java +++ b/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/controller/admin/file/FileController.java @@ -66,6 +66,14 @@ public class FileController { return success(true); } + @PostMapping("/upload_stu") + @Operation(summary = "上传学生考试文件", description = "模式三:后端上传文件,带有学生ID") + public CommonResult uploadStuFile(StuFileUploadReqVO uploadReqVO) throws Exception { + MultipartFile file = uploadReqVO.getFile(); + String path = uploadReqVO.getPath(); + return success(fileService.createStuFile(uploadReqVO.getStuId(), uploadReqVO.getPaperId(), file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()))); + } + @GetMapping("/{configId}/get/**") @PermitAll @Operation(summary = "下载文件") diff --git a/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/controller/admin/file/vo/file/StuFileUploadReqVO.java b/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/controller/admin/file/vo/file/StuFileUploadReqVO.java new file mode 100644 index 00000000..f7126567 --- /dev/null +++ b/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/controller/admin/file/vo/file/StuFileUploadReqVO.java @@ -0,0 +1,25 @@ +package pc.exam.pp.module.infra.controller.admin.file.vo.file; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import org.springframework.web.multipart.MultipartFile; + +@Schema(description = "管理后台 - 上传文件 Request VO") +@Data +public class StuFileUploadReqVO { + + @Schema(description = "文件附件", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "文件附件不能为空") + private MultipartFile file; + + @Schema(description = "文件附件", example = "examyuanma.png") + private String path; + + @Schema(description = "学生ID") + private Long stuId; + + @Schema(description = "试卷ID") + private String paperId; + +} diff --git a/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/service/file/FileService.java b/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/service/file/FileService.java index eda97d7d..fe2d14ad 100644 --- a/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/service/file/FileService.java +++ b/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/service/file/FileService.java @@ -31,6 +31,16 @@ public interface FileService { */ String createFile(String name, String path, byte[] content); + /** + * 保存文件,并返回文件的访问路径 + * + * @param name 文件名称 + * @param path 文件路径 + * @param content 文件内容 + * @return 文件路径 + */ + String createStuFile(Long stuId, String paperId, String name, String path, byte[] content); + /** * 创建文件 * diff --git a/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/service/file/FileServiceImpl.java b/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/service/file/FileServiceImpl.java index 20c1cb6c..f277aea2 100644 --- a/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/service/file/FileServiceImpl.java +++ b/exam-module-infra/exam-module-infra-biz/src/main/java/pc/exam/pp/module/infra/service/file/FileServiceImpl.java @@ -5,6 +5,8 @@ import cn.hutool.core.util.StrUtil; import pc.exam.pp.framework.common.pojo.PageResult; import pc.exam.pp.framework.common.util.io.FileUtils; import pc.exam.pp.framework.common.util.object.BeanUtils; +import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO; +import pc.exam.pp.module.exam.service.stu_paper_file.StuPaperFileService; import pc.exam.pp.module.infra.framework.file.core.client.FileClient; import pc.exam.pp.module.infra.framework.file.core.client.s3.FilePresignedUrlRespDTO; import pc.exam.pp.module.infra.framework.file.core.utils.FileTypeUtils; @@ -34,6 +36,9 @@ public class FileServiceImpl implements FileService { @Resource private FileMapper fileMapper; + @Resource + private StuPaperFileService stuPaperFileService; + @Override public PageResult getFilePage(FilePageReqVO pageReqVO) { return fileMapper.selectPage(pageReqVO); @@ -69,6 +74,53 @@ public class FileServiceImpl implements FileService { return url; } + @Override + @SneakyThrows + public String createStuFile(Long stuId, String paperId, String name, String path, byte[] content) { + // 计算默认的 path 名 + String type = FileTypeUtils.getMineType(content, name); + if (StrUtil.isEmpty(path)) { + path = FileUtils.generatePath(content, name); + } + // 如果 name 为空,则使用 path 填充 + if (StrUtil.isEmpty(name)) { + name = path; + } + + // 上传到文件存储器 + FileClient client = fileConfigService.getMasterFileClient(); + Assert.notNull(client, "客户端(master) 不能为空"); + String url = client.upload(content, path, type); + + // 保存到数据库 + FileDO file = new FileDO(); + file.setConfigId(client.getId()); + file.setName(name); + file.setPath(path); + file.setUrl(url); + file.setType(type); + file.setSize(content.length); + fileMapper.insert(file); + // 需要更新学生表 + // 1、先查询学生,试卷 是否已经存在数据 + StuPaperFileDO stuPaperFileDO = stuPaperFileService.findByStuIDAndPaperId(stuId, paperId); + if (stuPaperFileDO == null) { + // 说明没有上传过,需要新增进去 + StuPaperFileDO stuPaperFile = new StuPaperFileDO(); + stuPaperFile.setPaperId(paperId); + stuPaperFile.setStuId(stuId); + stuPaperFile.setUrl(url); + stuPaperFileService.insertStuPaperFile(stuPaperFile); + } else { + // 说明已经上传过,判断url是否一致,不一致得,需要进行更新操作 + if (!url.equals(stuPaperFileDO.getUrl())) { + stuPaperFileDO.setUrl(url); + stuPaperFileService.updateStuPaperFile(stuPaperFileDO); + } + } + return url; + } + @Override public Long createFile(FileCreateReqVO createReqVO) { FileDO file = BeanUtils.toBean(createReqVO, FileDO.class); diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/AutoToolsController.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/AutoToolsController.java index 669cce78..2cfd31b3 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/AutoToolsController.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/AutoToolsController.java @@ -1,4 +1,26 @@ package pc.exam.pp.module.judgement.controller.admin.autoTools; + +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +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.judgement.controller.admin.autoTools.vo.StuPaperReqVo; +import pc.exam.pp.module.judgement.service.auto_tools.AutoToolsService; + +@RestController +@RequestMapping("/tool") +@Tag( name = "测试判分") +@Validated public class AutoToolsController { + @Resource + private AutoToolsService autoToolsService; + + @GetMapping("/get") + public CommonResult get(StuPaperReqVo stuPaperReqVo) { + return autoToolsService.judgementScore(stuPaperReqVo.getStuId(),stuPaperReqVo.getPaperId()); + } } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/vo/StudentUploadFileZipReqVo.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/vo/StuPaperReqVo.java similarity index 63% rename from exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/vo/StudentUploadFileZipReqVo.java rename to exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/vo/StuPaperReqVo.java index 9f789cf4..771cd962 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/vo/StudentUploadFileZipReqVo.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/controller/admin/autoTools/vo/StuPaperReqVo.java @@ -5,15 +5,13 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @Data -public class StudentUploadFileZipReqVo { +public class StuPaperReqVo { @Schema(description = "学号") - private Long studentId; + private Long stuId; @Schema(description = "试卷号") private String paperId; - @Schema(description = "上传文件路径") - private String filePath; } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsService.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsService.java index 5cd1cefa..59078212 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsService.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsService.java @@ -1,5 +1,7 @@ package pc.exam.pp.module.judgement.service.auto_tools; +import pc.exam.pp.framework.common.pojo.CommonResult; + public interface AutoToolsService { @@ -23,4 +25,12 @@ public interface AutoToolsService { * @return 解压后的目录 */ String unzipToNamedFolder(String zipFilePath); + + /** + * 判分 + * @param stuId 学号 + * @param paperId 试卷ID + * @return 分数 + */ + CommonResult judgementScore(Long stuId, String paperId); } 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 1021ed73..e0e21119 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 @@ -1,6 +1,16 @@ package pc.exam.pp.module.judgement.service.auto_tools; +import jakarta.annotation.Resource; import org.springframework.stereotype.Service; +import pc.exam.pp.framework.common.exception.ErrorCode; +import pc.exam.pp.framework.common.pojo.CommonResult; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; +import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO; +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.service.c_programming.JudgementService; import java.io.*; import java.net.MalformedURLException; @@ -11,6 +21,14 @@ import java.util.zip.ZipInputStream; @Service public class AutoToolsServiceImpl implements AutoToolsService{ + @Resource + private StuPaperFileService stuPaperFileService; + @Resource + ConfigService configService; + @Resource + IExamQuestionService examQuestionService; + @Resource + JudgementService judgementService; @Override public String downloadStudentFile(String fileUrl, String filePath) { @@ -94,4 +112,66 @@ public class AutoToolsServiceImpl implements AutoToolsService{ return null; } } + + @Override + public CommonResult judgementScore(Long stuId, String paperId) { + double score = 0; + // 1、通过学号,试卷ID查询文件路径 + StuPaperFileDO stuPaperFileDO = stuPaperFileService.findByStuIDAndPaperId(stuId, paperId); + // 2、判断文件路径是否存在 + if (stuPaperFileDO == null) { + return CommonResult.error(100031, "试题文件没有上传,无法判分!"); + } + // 3、下载文件 + // 获取平台文件参数 + ConfigDO config = configService.getConfigByKey("file_down_path"); + String patn = downloadStudentFile(stuPaperFileDO.getUrl(), config.getValue()); + // 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 (!files[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) { + // 6、根据试题ID查询试题详情 + ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(file.getName()); + // 7、进行对应得判分 + // --- 7.1、查询试题文件 + File qu_file = new File(file.getPath()); + File[] qu_file_list = qu_files.listFiles(); + if (qu_file_list == null) continue; + // --- 7.2、通过文件名称进行判分 + for (File file_one : qu_file_list) { + // 判断名称 类似于 C语言程序设计。 + if (file_one.getName().split("\\.")[0].equals(examQuestion.getCourseName()+examQuestion.getSubjectName())) { + double c_score = judgementService.ProgrammingC(15.0, file.getPath(), file_one.getName(), examQuestion); + score += c_score; + break; + } + // wps 类型存在多级文文件夹,需要个性化设置 +// if () + } + } + + return CommonResult.success(score); + } } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/c_programming/JudgementService.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/c_programming/JudgementService.java index f4f195bf..fa286f97 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/c_programming/JudgementService.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/c_programming/JudgementService.java @@ -12,11 +12,12 @@ public interface JudgementService { /** * 程序设计判分 * @param examQuestion 程序设计题内容 - * @param path 文件路径 + * @param fileName 文件名称 + * @param pathC 文件路径 C语言文件 * @param score 分数 * @return 返回判分 */ - public double ProgrammingC(double score, String path, ExamQuestion examQuestion); + public double ProgrammingC(double score, String pathC, String fileName, ExamQuestion examQuestion); /** diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/c_programming/JudgementServiceImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/c_programming/JudgementServiceImpl.java index 1da72d73..9fce1937 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/c_programming/JudgementServiceImpl.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/c_programming/JudgementServiceImpl.java @@ -21,11 +21,11 @@ public class JudgementServiceImpl implements JudgementService /** * 程序设计判分 * @param examQuestion 程序设计题内容 - * @param path 文件路径 + * @param fileName 文件名称 * @param score 分数 * @return 返回判分 */ - public double ProgrammingC(double score, String path, ExamQuestion examQuestion) { + public double ProgrammingC(double score, String pathC, String fileName, ExamQuestion examQuestion) { // 关键字比对,超过权重-测试用例/运行(测试用例全对,直接满分-不全对)-结果,不超过权重只给关键字几个的分 // 获取该题有多少分 @@ -61,11 +61,9 @@ public class JudgementServiceImpl implements JudgementService // 编译分数分数占比 double pass_score = score * is_pass_score; - // 试卷其中有C语言的试题 - String path_c = path + "/" + examQuestion.getQuBankName(); // 创建log文件txt,用于记录 - LogFileUtils.createFile(path_c + "/log.txt"); - String code = JudgementCUtils.readFile(path_c, examQuestion.getQuId()+".txt"); + LogFileUtils.createFile(pathC + "/log.txt"); + String code = JudgementCUtils.readFile(pathC, fileName); LogFileUtils.writeLine("✅ 系统开始读取文件:" + code); if (code == null) { // 如果没有读到源码 diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordService.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordService.java index 318e57e7..8d8eb119 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordService.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordService.java @@ -2,8 +2,10 @@ package pc.exam.pp.module.judgement.service.wps_word; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; import pc.exam.pp.module.judgement.utils.wps_word.vo.WordVO; +import java.math.BigDecimal; import java.util.List; /** @@ -20,4 +22,14 @@ public interface JudgementWpsWordService { * @throws Exception 异常 */ public List ProgrammingWpsWord(String path) throws Exception; + + /** + * 读取考生文件,与题型中要求进行判断 + * @param path 文件路径 + * @param examQuestion 试题参数 + * @param sorce 试题分数 + * @return 得分 + * @throws Exception 异常 + */ + public BigDecimal judgementWpsWord(BigDecimal sorce, String path, ExamQuestion examQuestion) throws Exception; } diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordServiceImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordServiceImpl.java index 6175f1ca..5e56ffdf 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordServiceImpl.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_word/JudgementWpsWordServiceImpl.java @@ -4,6 +4,8 @@ package pc.exam.pp.module.judgement.service.wps_word; 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.infra.dal.dataobject.config.ConfigDO; import pc.exam.pp.module.infra.service.config.ConfigService; import pc.exam.pp.module.judgement.controller.admin.WpsWord.vo.WordListReqVO; @@ -14,6 +16,8 @@ import pc.exam.pp.module.judgement.utils.wps_word.WpsWordUtils; import pc.exam.pp.module.judgement.utils.wps_word.vo.WordVO; import java.io.File; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.List; @Service @@ -46,5 +50,31 @@ public class JudgementWpsWordServiceImpl implements JudgementWpsWordService { return margins1; } + @Override + public BigDecimal judgementWpsWord(BigDecimal sorce, String path, ExamQuestion examQuestion) throws Exception { + BigDecimal wps_word_sorce = new BigDecimal(0); + // 1、查询Word考点tree + WordListReqVO wordListReqVO = new WordListReqVO(); + wordListReqVO.setBelongTo(0); + List list = wpsWordLinkMapper.selectList(wordListReqVO); + // 2、docx文件读取并返回考点及说明信息 + List margins1 = WpsWordUtils.wps_word(path, list); + // 3、获取答案得组成 + List answerList = examQuestion.getAnswerList(); + // 4、进行关联判断 + for (ExamQuestionAnswer examQuestionAnswer : answerList) { + for (WordVO wordVO : margins1) { + for (String str : wordVO.getExamKeynote()) { + if (str.equals(examQuestionAnswer.getContent())) { + // 得分 根据权重进行得分 每个选项分值 = 总分 / 总权重 + BigDecimal one_sorce = sorce.multiply(new BigDecimal(examQuestionAnswer.getScoreRate())).setScale(2, RoundingMode.HALF_UP); + wps_word_sorce = wps_word_sorce.add(one_sorce); + } + } + } + } + return wps_word_sorce; + } + } diff --git a/exam-module-system/exam-module-system-api/src/main/java/pc/exam/pp/module/system/enums/ErrorCodeConstants.java b/exam-module-system/exam-module-system-api/src/main/java/pc/exam/pp/module/system/enums/ErrorCodeConstants.java index 99384d5b..39d47021 100644 --- a/exam-module-system/exam-module-system-api/src/main/java/pc/exam/pp/module/system/enums/ErrorCodeConstants.java +++ b/exam-module-system/exam-module-system-api/src/main/java/pc/exam/pp/module/system/enums/ErrorCodeConstants.java @@ -185,5 +185,5 @@ public interface ErrorCodeConstants { ErrorCode WORD_PARENT_IS_CHILD = new ErrorCode(1_002_030_007, "不能设置自己的子WORD节点为父WORD节点"); - ErrorCode MONITOR_NOT_EXISTS = new ErrorCode(1_003_301_001, "id为空"); + ErrorCode MONITOR_NOT_EXISTS = new ErrorCode(1_003_301_001, "找不到值!"); } diff --git a/exam-server/src/main/resources/application-local.yaml b/exam-server/src/main/resources/application-local.yaml index 4939dd30..6c708a16 100644 --- a/exam-server/src/main/resources/application-local.yaml +++ b/exam-server/src/main/resources/application-local.yaml @@ -47,7 +47,7 @@ spring: primary: master datasource: master: - url: jdbc:mysql://127.0.0.1:3306/pc-exam?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例 + url: jdbc:mysql://rm-bp1a44uap1mm20980mo.mysql.rds.aliyuncs.com:3306/pc-exam?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -55,8 +55,8 @@ spring: # url: jdbc:dm://127.0.0.1:5236?schema=RUOYI_VUE_PRO # DM 连接的示例 # url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例 - username: root - password: 123 + username: pc_exam + password: Pcexam123 # username: sa # SQL Server 连接的示例 # password: Exam@2024 # SQL Server 连接的示例 # username: SYSDBA # DM 连接的示例