【修改】试卷任务,【新增】试题交互,定时试题交互
This commit is contained in:
@@ -89,10 +89,10 @@ public class EducationPaperPersonController
|
||||
/**
|
||||
* 根据试卷任务获取人员分配列表
|
||||
*/
|
||||
@GetMapping(value = "/{taskId}")
|
||||
@GetMapping( "/getList")
|
||||
public CommonResult<PageResult<PersonRepDto>> getInfo(ExamPersonVo examPersonVo)
|
||||
{
|
||||
PageResult<PersonRepDto> list = educationPaperPersonService.selectEducationPaperPersonByTaskId(examPersonVo.getTaskId());
|
||||
PageResult<PersonRepDto> list = educationPaperPersonService.selectEducationPaperPersonByTaskId(examPersonVo);
|
||||
return CommonResult.success(BeanUtils.toBean(list, PersonRepDto.class));
|
||||
}
|
||||
/**
|
||||
@@ -100,7 +100,7 @@ public class EducationPaperPersonController
|
||||
*/
|
||||
@GetMapping(value = "/getSessionStu")
|
||||
public CommonResult<PageResult<PersonRepDto>> getSessionStu(ExamPersonVo examPersonVo) {
|
||||
PageResult<PersonRepDto> list = educationPaperPersonService.selectEducationPaperPersonBySessionId(examPersonVo.getSessionId());
|
||||
PageResult<PersonRepDto> list = educationPaperPersonService.selectEducationPaperPersonBySessionId(examPersonVo);
|
||||
return CommonResult.success(BeanUtils.toBean(list, PersonRepDto.class));
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public class EducationPaperQuController
|
||||
|
||||
|
||||
/**
|
||||
* 获取试卷详细信息
|
||||
* 学生端根据id获取试卷
|
||||
*/
|
||||
@GetMapping(value = "/getPaper")
|
||||
public CommonResult getPaper(@RequestParam(value = "paperId") String paperId)
|
||||
|
||||
@@ -5,9 +5,13 @@ import org.springframework.web.bind.annotation.*;
|
||||
import pc.exam.pp.framework.common.pojo.CommonResult;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme;
|
||||
import pc.exam.pp.module.exam.service.paper.IEducationPaperSchemeService;
|
||||
import pc.exam.pp.module.exam.service.paper.IEducationPaperService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static pc.exam.pp.module.infra.enums.ErrorCodeConstants.DEMO03_PAPER_TASK_DEL_EXISTS;
|
||||
import static pc.exam.pp.module.infra.enums.ErrorCodeConstants.DEMO03_PAPER_TASK_ADD_EXISTS;
|
||||
|
||||
/**
|
||||
* 试卷方案Controller
|
||||
*
|
||||
@@ -20,7 +24,8 @@ public class EducationPaperSchemeController
|
||||
{
|
||||
@Autowired
|
||||
private IEducationPaperSchemeService educationPaperSchemeService;
|
||||
|
||||
@Autowired
|
||||
private IEducationPaperService educationPaperService;
|
||||
/**
|
||||
* 查询试卷方案列表
|
||||
*/
|
||||
@@ -58,6 +63,10 @@ public class EducationPaperSchemeController
|
||||
public CommonResult add(@RequestBody EducationPaperScheme educationPaperScheme)
|
||||
{
|
||||
|
||||
List<String> strings = educationPaperService.selectPaperByTaskId(educationPaperScheme.getTaskId());
|
||||
if (strings!=null&&strings.size()>0){
|
||||
return CommonResult.error(DEMO03_PAPER_TASK_ADD_EXISTS);
|
||||
}
|
||||
return CommonResult.success(educationPaperSchemeService.insertEducationPaperScheme(educationPaperScheme));
|
||||
}
|
||||
|
||||
@@ -74,8 +83,13 @@ public class EducationPaperSchemeController
|
||||
* 删除试卷方案
|
||||
*/
|
||||
@DeleteMapping("/{schemeIds}")
|
||||
public CommonResult remove(@PathVariable String[] schemeIds)
|
||||
public CommonResult remove(@PathVariable String schemeIds)
|
||||
{
|
||||
return CommonResult.success(educationPaperSchemeService.deleteEducationPaperSchemeBySchemeIds(schemeIds));
|
||||
EducationPaperScheme educationPaperScheme = educationPaperSchemeService.selectEducationPaperSchemeBySchemeId(schemeIds);
|
||||
List<String> strings = educationPaperService.selectPaperByTaskId(educationPaperScheme.getTaskId());
|
||||
if (strings!=null&&strings.size()>0){
|
||||
return CommonResult.error(DEMO03_PAPER_TASK_DEL_EXISTS);
|
||||
}
|
||||
return CommonResult.success(educationPaperSchemeService.deleteEducationPaperSchemeBySchemeId(schemeIds));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +140,14 @@ public class EducationPaperSessionController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取试卷场次答题时间
|
||||
*/
|
||||
@GetMapping(value = "/getTime/{taskId}")
|
||||
public CommonResult getAnswerTime(@PathVariable("taskId") String taskId)
|
||||
{
|
||||
return CommonResult.success(educationPaperSessionService.getAnswerTime(taskId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,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.framework.security.core.util.SecurityFrameworkUtils;
|
||||
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.StatusDto;
|
||||
@@ -37,7 +38,19 @@ public class EducationPaperTaskController
|
||||
@GetMapping("/list")
|
||||
public CommonResult<PageResult<EducationPaperTask>> list(PaperTaskPageVo educationPaperTask)
|
||||
{
|
||||
|
||||
PageResult<EducationPaperTask> pageResult = educationPaperTaskService.selectEducationPaperTaskList(educationPaperTask);
|
||||
|
||||
|
||||
|
||||
return CommonResult.success(BeanUtils.toBean(pageResult, EducationPaperTask.class));
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/stulist")
|
||||
public CommonResult<PageResult<EducationPaperTask>> stulist(PaperTaskPageVo educationPaperTask)
|
||||
{
|
||||
PageResult<EducationPaperTask> pageResult =educationPaperTaskService.selectEducationPaperTaskListByStu(educationPaperTask);
|
||||
return CommonResult.success(BeanUtils.toBean(pageResult, EducationPaperTask.class));
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.paper.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperParam;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||
|
||||
import java.util.List;
|
||||
@Data
|
||||
public class ExamPaperVo {
|
||||
String paperId;
|
||||
List<ExamQuestion> questionList;
|
||||
List<EducationPaperScheme> educationPaperSchemeList;
|
||||
String paperId;
|
||||
EducationPaperParam educationPaperParam;
|
||||
|
||||
StuInfoPaper stuInfoPaper;
|
||||
public ExamPaperVo() {
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.paper.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import pc.exam.pp.framework.common.pojo.PageParam;
|
||||
@Schema(description = "试卷人员vo")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ExamPersonVo extends PageParam {
|
||||
public class ExamPersonVo {
|
||||
/*
|
||||
试卷任务Id
|
||||
*/
|
||||
@@ -18,4 +20,29 @@ public class ExamPersonVo extends PageParam {
|
||||
场次Id
|
||||
*/
|
||||
private String sessionId;
|
||||
|
||||
|
||||
private static final Integer PAGE_NO = 1;
|
||||
private static final Integer PAGE_SIZE = 10;
|
||||
|
||||
/**
|
||||
* 每页条数 - 不分页
|
||||
*
|
||||
* 例如说,导出接口,可以设置 {@link #pageSize} 为 -1 不分页,查询所有数据。
|
||||
*/
|
||||
public static final Integer PAGE_SIZE_NONE = -1;
|
||||
|
||||
@Schema(description = "页码,从 1 开始", requiredMode = Schema.RequiredMode.REQUIRED,example = "1")
|
||||
@NotNull(message = "页码不能为空")
|
||||
@Min(value = 1, message = "页码最小值为 1")
|
||||
private Integer pageNo = PAGE_NO;
|
||||
|
||||
@Schema(description = "每页条数,最大值为 100", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
@Min(value = 1, message = "每页条数最小值为 1")
|
||||
@Max(value = 100, message = "每页条数最大值为 100")
|
||||
private Integer pageSize = PAGE_SIZE;
|
||||
public Integer getOffset() {
|
||||
return (this.pageNo - 1) * this.pageSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.paper.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -15,8 +18,7 @@ import static pc.exam.pp.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SessionStuPageReqVO extends PageParam {
|
||||
public class SessionStuPageReqVO {
|
||||
|
||||
@Schema(description = "用户账号,模糊匹配", example = "exam")
|
||||
private String username;
|
||||
@@ -50,4 +52,28 @@ public class SessionStuPageReqVO extends PageParam {
|
||||
|
||||
|
||||
|
||||
private static final Integer PAGE_NO = 1;
|
||||
private static final Integer PAGE_SIZE = 10;
|
||||
|
||||
/**
|
||||
* 每页条数 - 不分页
|
||||
*
|
||||
* 例如说,导出接口,可以设置 {@link #pageSize} 为 -1 不分页,查询所有数据。
|
||||
*/
|
||||
public static final Integer PAGE_SIZE_NONE = -1;
|
||||
|
||||
@Schema(description = "页码,从 1 开始", requiredMode = Schema.RequiredMode.REQUIRED,example = "1")
|
||||
@NotNull(message = "页码不能为空")
|
||||
@Min(value = 1, message = "页码最小值为 1")
|
||||
private Integer pageNo = PAGE_NO;
|
||||
|
||||
@Schema(description = "每页条数,最大值为 100", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
@Min(value = 1, message = "每页条数最小值为 1")
|
||||
@Max(value = 100, message = "每页条数最大值为 100")
|
||||
private Integer pageSize = PAGE_SIZE;
|
||||
public Integer getOffset() {
|
||||
return (this.pageNo - 1) * this.pageSize;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.paper.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.sql.Time;
|
||||
|
||||
@Data
|
||||
public class StuInfoPaper {
|
||||
//考生名称
|
||||
private String nickName;
|
||||
//学校
|
||||
private String schoolName;
|
||||
//考生场次
|
||||
private String batch;
|
||||
//准考证
|
||||
private String userName;
|
||||
//身份证
|
||||
private String sfz;
|
||||
//任务名称
|
||||
private String taskName;
|
||||
//试卷总分
|
||||
private String paperScore;
|
||||
//题目数量
|
||||
private String queNum;
|
||||
|
||||
private Time answerTime;
|
||||
|
||||
}
|
||||
@@ -2,20 +2,31 @@ package pc.exam.pp.module.exam.controller.admin.question;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.record.DVALRecord;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.tenant.core.aop.TenantIgnore;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.dto.ExamQuestionDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.dto.TenantDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExaminePageReqVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||
import pc.exam.pp.module.exam.service.question.IExamQuestionService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static pc.exam.pp.framework.common.pojo.CommonResult.error;
|
||||
import static pc.exam.pp.framework.common.pojo.CommonResult.success;
|
||||
import static pc.exam.pp.module.system.enums.ErrorCodeConstants.QESESTION_NOT_NULL;
|
||||
import static pc.exam.pp.module.system.enums.ErrorCodeConstants.QESESTION_AUDIT_ERROR;
|
||||
|
||||
/**
|
||||
* 试题(hyc)Controller
|
||||
@@ -43,6 +54,41 @@ public class ExamQuestionController
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询除了审核状态通过的其他状态的试题(试题推送)
|
||||
* @param questionVo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sendList")
|
||||
public CommonResult<PageResult<ExamQuestion>> sendList(QuestionVo questionVo)
|
||||
{
|
||||
PageResult<ExamQuestion> pageResult;
|
||||
if (StringUtils.isNotBlank(questionVo.getAudit())){
|
||||
pageResult= examQuestionService.selectExamQuestionList(questionVo);
|
||||
}else {
|
||||
pageResult = examQuestionService.selectExamQuestionListSend(questionVo);
|
||||
}
|
||||
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询试题(试题审核)
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/auditList")
|
||||
@TenantIgnore
|
||||
public CommonResult<PageResult<ExamQuestion>> auditList(@Valid QuestionExaminePageReqVO pageReqVO)
|
||||
{
|
||||
|
||||
PageResult<ExamQuestion> pageResult= examQuestionService.selectExamQuestionListNoAudit(pageReqVO);
|
||||
|
||||
// pageResult= examQuestionService.selectExamQuestionListAudit(pageReqVO);
|
||||
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出试题(hyc)列表
|
||||
*/
|
||||
@@ -64,7 +110,16 @@ public class ExamQuestionController
|
||||
{
|
||||
return success(examQuestionService.selectExamQuestionByQuId(quId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取试题(hyc)详细信息 无租户id
|
||||
*/
|
||||
//@PreAu
|
||||
@GetMapping(value = "/notId/{quId}")
|
||||
@TenantIgnore
|
||||
public CommonResult<ExamQuestion> getInfoNotId(@PathVariable("quId") String quId)
|
||||
{
|
||||
return success(examQuestionService.selectExamQuestionByQuId(quId));
|
||||
}
|
||||
/**
|
||||
* 新增试题(hyc)
|
||||
*/
|
||||
@@ -80,7 +135,6 @@ public class ExamQuestionController
|
||||
/**
|
||||
* 修改试题(hyc)
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('system:question:edit')")
|
||||
@PutMapping
|
||||
public CommonResult edit(@RequestBody ExamQuestion examQuestion)
|
||||
{
|
||||
@@ -90,14 +144,61 @@ public class ExamQuestionController
|
||||
/**
|
||||
* 删除试题(hyc)
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('system:question:remove')")
|
||||
@DeleteMapping("/{ids}")
|
||||
public CommonResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return success(examQuestionService.deleteExamQuestionByQuIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
*获得学校列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getSchoolName")
|
||||
@TenantIgnore
|
||||
public CommonResult<PageResult<TenantVo>> getSchoolName(TenantDto tenantDto)
|
||||
{
|
||||
return success(examQuestionService.getSchoolName(tenantDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务端审核通过试题
|
||||
* @param quIds
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/auditQue")
|
||||
@TenantIgnore
|
||||
public CommonResult auditQue(@RequestBody List<String> quIds) {
|
||||
if (CollectionUtils.isEmpty(quIds)) {
|
||||
return CommonResult.error(QESESTION_NOT_NULL);
|
||||
}
|
||||
int b = examQuestionService.auditQueByIds(quIds);
|
||||
if (b>0){
|
||||
return success("审核成功");
|
||||
}
|
||||
else {
|
||||
return error(QESESTION_AUDIT_ERROR);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 服务端审核不通过试题
|
||||
* @param quIds
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/noauditQue")
|
||||
@TenantIgnore
|
||||
public CommonResult noAuditQue(@RequestBody List<String> quIds) {
|
||||
if (CollectionUtils.isEmpty(quIds)) {
|
||||
return CommonResult.error(QESESTION_NOT_NULL);
|
||||
}
|
||||
int b = examQuestionService.noAuditQue(quIds);
|
||||
if (b>0){
|
||||
return success("操作成功");
|
||||
|
||||
}else {
|
||||
return error(QESESTION_AUDIT_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.question.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import pc.exam.pp.framework.common.pojo.PageParam;
|
||||
@Data
|
||||
public class TenantDto {
|
||||
|
||||
private String name;
|
||||
private static final Integer PAGE_NO = 1;
|
||||
private static final Integer PAGE_SIZE = 10;
|
||||
|
||||
/**
|
||||
* 每页条数 - 不分页
|
||||
*
|
||||
* 例如说,导出接口,可以设置 {@link #pageSize} 为 -1 不分页,查询所有数据。
|
||||
*/
|
||||
public static final Integer PAGE_SIZE_NONE = -1;
|
||||
|
||||
@Schema(description = "页码,从 1 开始", requiredMode = Schema.RequiredMode.REQUIRED,example = "1")
|
||||
@NotNull(message = "页码不能为空")
|
||||
@Min(value = 1, message = "页码最小值为 1")
|
||||
private Integer pageNo = PAGE_NO;
|
||||
|
||||
@Schema(description = "每页条数,最大值为 100", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
@Min(value = 1, message = "每页条数最小值为 1")
|
||||
@Max(value = 100, message = "每页条数最大值为 100")
|
||||
private Integer pageSize = PAGE_SIZE;
|
||||
public Integer getOffset() {
|
||||
return (this.pageNo - 1) * this.pageSize;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.question.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TenantVo {
|
||||
private String id;
|
||||
private String name;
|
||||
private String ququeName;
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.questionexamine;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import pc.exam.pp.framework.common.pojo.PageParam;
|
||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||
import pc.exam.pp.framework.common.pojo.CommonResult;
|
||||
import pc.exam.pp.framework.common.util.object.BeanUtils;
|
||||
import static pc.exam.pp.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import pc.exam.pp.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import pc.exam.pp.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static pc.exam.pp.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import pc.exam.pp.framework.tenant.core.aop.TenantIgnore;
|
||||
import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExaminePageReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExamineRespVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExamineSaveReqVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.QuestionExamineDO;
|
||||
import pc.exam.pp.module.exam.service.questionexamine.QuestionExamineService;
|
||||
|
||||
@Tag(name = "管理后台 - 试题交互中间")
|
||||
@RestController
|
||||
@RequestMapping("/education/question-examine")
|
||||
@Validated
|
||||
public class QuestionExamineController {
|
||||
|
||||
@Resource
|
||||
private QuestionExamineService questionExamineService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建试题交互中间")
|
||||
public CommonResult<String> createQuestionExamine(@Valid @RequestBody QuestionExamineSaveReqVO createReqVO) {
|
||||
return success(questionExamineService.createQuestionExamine(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新试题交互中间")
|
||||
public CommonResult<Boolean> updateQuestionExamine(@Valid @RequestBody QuestionExamineSaveReqVO updateReqVO) {
|
||||
questionExamineService.updateQuestionExamine(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除试题交互中间")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteQuestionExamine(@RequestParam("id") String id) {
|
||||
questionExamineService.deleteQuestionExamine(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得试题交互中间")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<QuestionExamineRespVO> getQuestionExamine(@RequestParam("id") String id) {
|
||||
QuestionExamineDO questionExamine = questionExamineService.getQuestionExamine(id);
|
||||
return success(BeanUtils.toBean(questionExamine, QuestionExamineRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得试题交互中间分页")
|
||||
public CommonResult<PageResult<QuestionExamineRespVO>> getQuestionExaminePage(@Valid QuestionExaminePageReqVO pageReqVO) {
|
||||
PageResult<QuestionExamineDO> pageResult = questionExamineService.getQuestionExaminePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, QuestionExamineRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出试题交互中间 Excel")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportQuestionExamineExcel(@Valid QuestionExaminePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<QuestionExamineDO> list = questionExamineService.getQuestionExaminePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "试题交互中间.xls", "数据", QuestionExamineRespVO.class,
|
||||
BeanUtils.toBean(list, QuestionExamineRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.questionexamine.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import pc.exam.pp.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static pc.exam.pp.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 试题交互中间分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class QuestionExaminePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "试题id", example = "18177")
|
||||
private String quId;
|
||||
|
||||
@Schema(description = "租户")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String createTeacher;
|
||||
|
||||
@Schema(description = "种类(0新增试题1错题)", example = "2")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.questionexamine.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 试题交互中间 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class QuestionExamineRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "11417")
|
||||
@ExcelProperty("主键")
|
||||
private String examineId;
|
||||
|
||||
@Schema(description = "试题id", example = "18177")
|
||||
@ExcelProperty("试题id")
|
||||
private String quId;
|
||||
|
||||
@Schema(description = "租户")
|
||||
@ExcelProperty("租户")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
@ExcelProperty("创建人")
|
||||
private String createTeacher;
|
||||
|
||||
@Schema(description = "种类(0新增试题1错题)", example = "2")
|
||||
@ExcelProperty("种类(0新增试题1错题)")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.questionexamine.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 试题交互中间新增/修改 Request VO")
|
||||
@Data
|
||||
public class QuestionExamineSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "11417")
|
||||
private String examineId;
|
||||
|
||||
@Schema(description = "试题id", example = "18177")
|
||||
private String quId;
|
||||
|
||||
@Schema(description = "租户")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String createTeacher;
|
||||
|
||||
@Schema(description = "种类(0新增试题1错题)", example = "2")
|
||||
private String type;
|
||||
|
||||
}
|
||||
@@ -2,15 +2,28 @@ package pc.exam.pp.module.exam.controller.admin.rabbitmq;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import pc.exam.pp.framework.common.pojo.CommonResult;
|
||||
import pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import pc.exam.pp.framework.tenant.core.aop.TenantIgnore;
|
||||
import pc.exam.pp.framework.tenant.core.service.TenantFrameworkService;
|
||||
import pc.exam.pp.module.exam.controller.admin.rabbitmq.vo.PushRequestVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.rabbitmq.vo.RabbitMQSendInfoVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||
import pc.exam.pp.module.exam.service.question.ExamQuestionServiceImpl;
|
||||
import pc.exam.pp.module.exam.utils.rabbitmq.RabbitmqUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static pc.exam.pp.module.system.enums.ErrorCodeConstants.RABBITMQ_NOT_EXISTS;
|
||||
import static pc.exam.pp.module.system.enums.ErrorCodeConstants.RABBITMQ_NAME_NOT_NULL;
|
||||
import static pc.exam.pp.module.system.enums.ErrorCodeConstants.RABBITMQ_CONNECT_EXISTS;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/rabbitmq")
|
||||
@Tag( name = "rabbitmq 消息队列")
|
||||
@@ -20,14 +33,26 @@ public class RabbitMQController {
|
||||
private RabbitmqUtils rabbitMqService;
|
||||
@Resource
|
||||
private ExamQuestionServiceImpl examQuestionService;
|
||||
|
||||
|
||||
/**
|
||||
* 连接Rabbitmq
|
||||
* @param queueName 队列名称
|
||||
* @return 连接状态
|
||||
*/
|
||||
@PostMapping("/connect")
|
||||
public String connect(@RequestParam String queueName) {
|
||||
return rabbitMqService.connect(queueName,"name");
|
||||
// public String connect(@RequestParam String queueName) {
|
||||
public CommonResult connect() {
|
||||
String queueName = SecurityFrameworkUtils.getLoginQueueName();
|
||||
int connect = rabbitMqService.connect(queueName);
|
||||
if (connect == 0 ){
|
||||
return CommonResult.success("已经连接");
|
||||
}
|
||||
if (connect ==1){
|
||||
return CommonResult.success("连接成功");
|
||||
}
|
||||
|
||||
return CommonResult.error(RABBITMQ_CONNECT_EXISTS);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,19 +71,105 @@ public class RabbitMQController {
|
||||
*/
|
||||
@PostMapping("/send")
|
||||
public int sendMessage(@RequestBody RabbitMQSendInfoVO rabbitMQSendInfoVO) {
|
||||
rabbitMQSendInfoVO.setQueueName(SecurityFrameworkUtils.getLoginQueueName());
|
||||
return examQuestionService.uploadExamQuestionToRabbitMQ(rabbitMQSendInfoVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 全部接收消息
|
||||
* @param queueName 队列名称-客户端代码
|
||||
* 全部接收消息(学校中心或服务器接收中心服务器推送的试题)
|
||||
队列名称-客户端代码
|
||||
* @return 接收结果
|
||||
*/
|
||||
@GetMapping("/receiveAll")
|
||||
public List<ExamQuestion> receiveMessage(@RequestParam String queueName) {
|
||||
return examQuestionService.getExamQuestionToRabbitMQ(queueName);
|
||||
// public List<ExamQuestion> receiveMessage(@RequestParam String queueName) {
|
||||
public CommonResult receiveMessage() {
|
||||
String queueName = SecurityFrameworkUtils.getLoginQueueName();
|
||||
boolean examQuestionToRabbitMQ = examQuestionService.getExamQuestionToRabbitMQInsertData(queueName);
|
||||
if (examQuestionToRabbitMQ){
|
||||
return CommonResult.success("接收成功");
|
||||
}else {
|
||||
return CommonResult.error(RABBITMQ_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务器连接学校
|
||||
* @param queueNames
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/connectSchoolAll")
|
||||
public CommonResult connectSchoolAll(@RequestBody List<String> queueNames) {
|
||||
if (CollectionUtils.isEmpty(queueNames)) {
|
||||
return CommonResult.error(RABBITMQ_NAME_NOT_NULL);
|
||||
}
|
||||
List<String> failedQueues = new ArrayList<>();
|
||||
|
||||
for (String queueName : queueNames) {
|
||||
boolean examQuestionToRabbitMQ = rabbitMqService.connectSchool(queueName);
|
||||
if (!examQuestionToRabbitMQ) {
|
||||
failedQueues.add(queueName);
|
||||
}
|
||||
}
|
||||
|
||||
if (failedQueues.isEmpty()) {
|
||||
return CommonResult.success("全部连接成功");
|
||||
} else {
|
||||
return CommonResult.error(1_005_005_023,"以下学校全部连接失败:" + String.join(", ", failedQueues));
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 接收学校的试题
|
||||
* @param queueNames
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/receiveSchoolAll")
|
||||
public CommonResult receiveSchoolMessage(@RequestBody List<String> queueNames) {
|
||||
if (CollectionUtils.isEmpty(queueNames)) {
|
||||
return CommonResult.error(RABBITMQ_NAME_NOT_NULL);
|
||||
}
|
||||
List<String> failedQueues = new ArrayList<>();
|
||||
|
||||
for (String queueName : queueNames) {
|
||||
boolean examQuestionToRabbitMQ = examQuestionService.getExamQuestionToRabbitMQ(queueName);
|
||||
if (!examQuestionToRabbitMQ) {
|
||||
failedQueues.add(queueName);
|
||||
}
|
||||
}
|
||||
|
||||
if (failedQueues.isEmpty()) {
|
||||
return CommonResult.success("全部接收成功");
|
||||
} else {
|
||||
return CommonResult.error(1_005_005_023,"以下学校接收失败:" + String.join(", ", failedQueues));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务器推送学校试题 到mqtt
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/doPush")
|
||||
@TenantIgnore
|
||||
public CommonResult doPush(@RequestBody PushRequestVo request) {
|
||||
List<String> queueNames = request.getQueueNames();
|
||||
List<String> questionIds = request.getQuestionIds();
|
||||
System.out.println(queueNames);
|
||||
System.out.println(questionIds);
|
||||
for (String queueName : queueNames) {
|
||||
RabbitMQSendInfoVO rabbitMQSendInfoVO=new RabbitMQSendInfoVO();
|
||||
rabbitMQSendInfoVO.setType("0");
|
||||
rabbitMQSendInfoVO.setQuIds(questionIds);
|
||||
rabbitMQSendInfoVO.setQueueName(queueName);
|
||||
examQuestionService.uploadExamQuestionToRabbitMQBySource(rabbitMQSendInfoVO);
|
||||
}
|
||||
|
||||
return CommonResult.success("推送成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 关闭
|
||||
* @return 关闭结果
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.rabbitmq.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PushRequestVo {
|
||||
private List<String> queueNames;
|
||||
private List<String> questionIds;
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
package pc.exam.pp.module.exam.dal.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.sql.Time;
|
||||
|
||||
/**
|
||||
* 通用参数对象 education_paper_param
|
||||
*
|
||||
@@ -77,4 +80,9 @@ public class EducationPaperParam
|
||||
private String isConnect;
|
||||
|
||||
private String isSession;
|
||||
|
||||
private String isTime;
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone = "Asia/Shanghai")
|
||||
private Time examTime = Time.valueOf("01:00:00"); // 默认 1 小时
|
||||
|
||||
}
|
||||
|
||||
@@ -118,5 +118,7 @@ public class ExamQuestion extends TenantBaseDO {
|
||||
|
||||
@TableField(exist = false)
|
||||
private String type;
|
||||
@TableField(exist = false)
|
||||
private String schoolName;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
package pc.exam.pp.module.exam.dal.dataobject;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import pc.exam.pp.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 试题交互中间 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("education_question_examine")
|
||||
@KeySequence("education_question_examine_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class QuestionExamineDO {
|
||||
|
||||
|
||||
/**
|
||||
* 试题id
|
||||
*/
|
||||
@TableId(type = IdType.INPUT)
|
||||
private String quId;
|
||||
/**
|
||||
* 租户
|
||||
*/
|
||||
private Long source;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createTeacher;
|
||||
/**
|
||||
* 种类(0新增试题1错题)
|
||||
*/
|
||||
private String type;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 审核人,目前使用 SysUser 的 id 编号
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.VARCHAR)
|
||||
private String updater;
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import pc.exam.pp.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import pc.exam.pp.framework.tenant.core.aop.TenantIgnore;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.dto.PersonRepDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.DeleteRequestVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPersonVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.SessionStuPageReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.StudentSessionReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.student.vo.StudentPageReqVO;
|
||||
@@ -32,10 +33,9 @@ public interface EducationPaperPersonMapper
|
||||
/**
|
||||
* 查询试卷人员分配
|
||||
*
|
||||
* @param taskId 试卷人员分配主键
|
||||
* @return 试卷人员分配
|
||||
*/
|
||||
List<EducationPaperPerson> selectEducationPaperPersonByTaskId(String taskId);
|
||||
List<EducationPaperPerson> selectEducationPaperPersonByTaskId(ExamPersonVo examPersonVo);
|
||||
|
||||
/**
|
||||
* 查询试卷人员分配列表
|
||||
@@ -86,7 +86,7 @@ public interface EducationPaperPersonMapper
|
||||
|
||||
String selectUserClassName(Long classId);
|
||||
|
||||
List<EducationPaperPerson> selectEducationPaperPersonBySessionId(String sessionId);
|
||||
List<EducationPaperPerson> selectEducationPaperPersonBySessionId(ExamPersonVo examPersonVo);
|
||||
|
||||
List<PersonRepDto> selectEducationPaperPersonByNotInSessionId(SessionStuPageReqVO sessionStuPageReqVO);
|
||||
|
||||
@@ -108,4 +108,16 @@ public interface EducationPaperPersonMapper
|
||||
List<PersonRepDto> selectEducationPaperPersonBySessionIdNotIn(SessionStuPageReqVO sessionStuPageReqVO);
|
||||
|
||||
List<String> selectStuIdByTaskId(String taskId);
|
||||
|
||||
List<String> selectTaskIdByStuid(Long loginUserId);
|
||||
|
||||
long selectEducationPaperPersonBySessionIdTotal(String sessionId);
|
||||
|
||||
long selectEducationPaperPersonByTaskIdTotal(String taskId);
|
||||
|
||||
|
||||
long selectEducationPaperPersonByNotInSessionIdTotal(SessionStuPageReqVO sessionStuPageReqVO);
|
||||
|
||||
long selectEducationPaperPersonBySessionIdNotInTotal(SessionStuPageReqVO sessionStuPageReqVO);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package pc.exam.pp.module.exam.dal.mysql.paper;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -90,4 +91,6 @@ public interface EducationPaperSessionMapper extends BaseMapperX<EducationPaperS
|
||||
);
|
||||
}
|
||||
|
||||
Time getAnswerTime(String taskId);
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ 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.vo.PaperTaskPageVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.dto.ExamQuestionDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.dto.TenantDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||
|
||||
@@ -47,6 +49,22 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询除了审核状态为通过的其他试题
|
||||
* @param questionVo
|
||||
* @return
|
||||
*/
|
||||
default PageResult<ExamQuestion> selectExamQuestionListNO(QuestionVo questionVo) {
|
||||
return selectPage(questionVo, new LambdaQueryWrapperX<ExamQuestion>()
|
||||
.likeIfPresent(ExamQuestion::getQuLevel, questionVo.getQuLevel())
|
||||
.likeIfPresent(ExamQuestion::getCourseName, questionVo.getCourseName())
|
||||
.likeIfPresent(ExamQuestion::getPointNames, questionVo.getPointNames())
|
||||
.likeIfPresent(ExamQuestion::getSpecialtyName, questionVo.getSpecialtyName())
|
||||
.likeIfPresent(ExamQuestion::getSubjectName, questionVo.getSubjectName())
|
||||
.neIfPresent(ExamQuestion::getAudit, 0) // 改为 audit != 0
|
||||
.likeIfPresent(ExamQuestion::getStatus, questionVo.getStatus())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增试题(hyc)
|
||||
@@ -81,4 +99,22 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
public int deleteExamQuestionByQuIds(@Param("ids") String[] ids);
|
||||
|
||||
List<ExamQuestion> selectExamQuestionListByQuIds(List<String> quIds);
|
||||
|
||||
void setQuestionAuditByids(@Param("quIds")List<String> quIds);
|
||||
|
||||
List<TenantVo> getSchoolName(TenantDto tenantDto);
|
||||
|
||||
|
||||
long getSchoolNameTotal(TenantDto tenantDto);
|
||||
|
||||
int auditQueByIds(@Param("quIds")List<String> quIds);
|
||||
|
||||
int noAuditQue(@Param("quIds")List<String> quIds);
|
||||
|
||||
|
||||
ExamQuestion selectExamQuestionByQuIdAndTenantId(@Param("quId") String quId, @Param("source")Long source);
|
||||
|
||||
List<String> seleAllQueueName();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package pc.exam.pp.module.exam.dal.mysql.questionexamine;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||
import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExaminePageReqVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.QuestionExamineDO;
|
||||
|
||||
/**
|
||||
* 试题交互中间 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface QuestionExamineMapper extends BaseMapperX<QuestionExamineDO> {
|
||||
|
||||
default PageResult<QuestionExamineDO> selectPage(QuestionExaminePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<QuestionExamineDO>()
|
||||
.eqIfPresent(QuestionExamineDO::getQuId, reqVO.getQuId())
|
||||
.eqIfPresent(QuestionExamineDO::getSource, reqVO.getSource())
|
||||
.eqIfPresent(QuestionExamineDO::getCreateTeacher, reqVO.getCreateTeacher())
|
||||
.eqIfPresent(QuestionExamineDO::getType, reqVO.getType())
|
||||
.betweenIfPresent(QuestionExamineDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(QuestionExamineDO::getCreateTime));
|
||||
}
|
||||
|
||||
void insertOrUpdateList(List<QuestionExamineDO> questionExamineDOS);
|
||||
|
||||
String selectSchoolName(Long source);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package pc.exam.pp.module.exam.job;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import pc.exam.pp.framework.quartz.core.handler.JobHandler;
|
||||
import pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper;
|
||||
import pc.exam.pp.module.exam.service.question.IExamQuestionService;
|
||||
import pc.exam.pp.module.exam.utils.rabbitmq.RabbitmqUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class QuestionDownJob implements JobHandler {
|
||||
@Resource
|
||||
private RabbitmqUtils rabbitMqService;
|
||||
@Resource
|
||||
private ExamQuestionMapper examQuestionMapper;
|
||||
@Resource
|
||||
private IExamQuestionService examQuestionService;
|
||||
@Override
|
||||
public String execute(String param) throws Exception {
|
||||
|
||||
|
||||
List<String> queueNames= examQuestionMapper.seleAllQueueName();
|
||||
log.info(queueNames.toString()+"所有学校队列名");
|
||||
if (queueNames!=null){
|
||||
List<String> failedQueues = new ArrayList<>();
|
||||
List<String> successQueues = new ArrayList<>();
|
||||
List<String> failedQueues1 = new ArrayList<>();
|
||||
List<String> successQueues2 = new ArrayList<>();
|
||||
for (String queueName : queueNames) {
|
||||
boolean examQuestionToRabbitMQ = rabbitMqService.connectSchool(queueName);
|
||||
if (!examQuestionToRabbitMQ) {
|
||||
failedQueues.add(queueName);
|
||||
}else {
|
||||
successQueues.add(queueName);
|
||||
}
|
||||
}
|
||||
for (String queueName : successQueues) {
|
||||
try {
|
||||
boolean examQuestionToRabbitMQ = examQuestionService.getExamQuestionToRabbitMQ(queueName);
|
||||
if (!examQuestionToRabbitMQ) {
|
||||
failedQueues1.add(queueName);
|
||||
} else {
|
||||
successQueues2.add(queueName);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("拉取队列 {} 时异常:{}", queueName, e.getMessage());
|
||||
failedQueues1.add(queueName);
|
||||
}
|
||||
}
|
||||
log.info(failedQueues.toString()+"连接失败的学校");
|
||||
log.info(successQueues.toString()+"连接成功的学校");
|
||||
log.info(failedQueues1.toString()+"拉取失败的学校");
|
||||
log.info(successQueues2.toString()+"拉取成功的学校");
|
||||
rabbitMqService.disconnect();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperParam;
|
||||
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperParamMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperTaskMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -19,7 +20,8 @@ public class EducationPaperParamServiceImpl implements IEducationPaperParamServi
|
||||
{
|
||||
@Autowired
|
||||
private EducationPaperParamMapper educationPaperParamMapper;
|
||||
|
||||
@Autowired
|
||||
private EducationPaperTaskMapper educationPaperTaskMapper;
|
||||
/**
|
||||
* 查询通用参数
|
||||
*
|
||||
|
||||
@@ -15,6 +15,7 @@ import pc.exam.pp.framework.common.pojo.PageResult;
|
||||
import pc.exam.pp.framework.common.util.json.JsonUtils;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.dto.PersonRepDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.DeleteRequestVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPersonVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.SessionStuPageReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.StudentSessionReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.student.vo.StudentPageReqVO;
|
||||
@@ -61,13 +62,13 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer
|
||||
/**
|
||||
* 查询试卷人员分配
|
||||
*
|
||||
* @param taskId 试卷人员分配主键
|
||||
* @return 试卷人员分配
|
||||
*/
|
||||
@Override
|
||||
public PageResult<PersonRepDto> selectEducationPaperPersonByTaskId(String taskId)
|
||||
public PageResult<PersonRepDto> selectEducationPaperPersonByTaskId(ExamPersonVo examPersonVo)
|
||||
{
|
||||
List<EducationPaperPerson> educationPaperPeoples= educationPaperPersonMapper.selectEducationPaperPersonByTaskId(taskId);
|
||||
List<EducationPaperPerson> educationPaperPeoples= educationPaperPersonMapper.selectEducationPaperPersonByTaskId(examPersonVo);
|
||||
long total= educationPaperPersonMapper.selectEducationPaperPersonByTaskIdTotal(examPersonVo.getTaskId());
|
||||
List<PersonRepDto> personRepDtos=new ArrayList<>();
|
||||
if (educationPaperPeoples!=null&&educationPaperPeoples.size()>0){
|
||||
for (EducationPaperPerson educationPaperPerson : educationPaperPeoples) {
|
||||
@@ -84,13 +85,14 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer
|
||||
}
|
||||
PageResult<PersonRepDto> pageResult=new PageResult<>();
|
||||
pageResult.setList(personRepDtos);
|
||||
pageResult.setTotal((long) personRepDtos.size());
|
||||
pageResult.setTotal(total);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PersonRepDto> selectEducationPaperPersonBySessionId(String sessionId) {
|
||||
List<EducationPaperPerson> educationPaperPeoples= educationPaperPersonMapper.selectEducationPaperPersonBySessionId(sessionId);
|
||||
public PageResult<PersonRepDto> selectEducationPaperPersonBySessionId(ExamPersonVo examPersonVo) {
|
||||
List<EducationPaperPerson> educationPaperPeoples= educationPaperPersonMapper.selectEducationPaperPersonBySessionId(examPersonVo);
|
||||
long total= educationPaperPersonMapper.selectEducationPaperPersonBySessionIdTotal(examPersonVo.getSessionId());
|
||||
List<PersonRepDto> personRepDtos=new ArrayList<>();
|
||||
if (educationPaperPeoples!=null&&educationPaperPeoples.size()>0){
|
||||
for (EducationPaperPerson educationPaperPerson : educationPaperPeoples) {
|
||||
@@ -107,7 +109,7 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer
|
||||
}
|
||||
PageResult<PersonRepDto> pageResult=new PageResult<>();
|
||||
pageResult.setList(personRepDtos);
|
||||
pageResult.setTotal((long) personRepDtos.size());
|
||||
pageResult.setTotal(total);
|
||||
return pageResult;
|
||||
|
||||
}
|
||||
@@ -120,13 +122,16 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer
|
||||
sessionStuPageReqVO.setClassId(classId);
|
||||
}
|
||||
List<PersonRepDto> personRepDtos;
|
||||
|
||||
long total;
|
||||
String sessionId = sessionStuPageReqVO.getSessionId();
|
||||
if (StringUtils.isNotBlank(sessionId)){
|
||||
personRepDtos = educationPaperPersonMapper.selectEducationPaperPersonByNotInSessionId(sessionStuPageReqVO);
|
||||
total=educationPaperPersonMapper.selectEducationPaperPersonByNotInSessionIdTotal(sessionStuPageReqVO);
|
||||
}
|
||||
else {
|
||||
personRepDtos = educationPaperPersonMapper.selectEducationPaperPersonBySessionIdNotIn(sessionStuPageReqVO);
|
||||
total=educationPaperPersonMapper.selectEducationPaperPersonBySessionIdNotInTotal(sessionStuPageReqVO);
|
||||
|
||||
}
|
||||
if (personRepDtos!=null&&personRepDtos.size()>0){
|
||||
for (PersonRepDto personRepDto : personRepDtos) {
|
||||
@@ -135,7 +140,7 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer
|
||||
}
|
||||
PageResult<PersonRepDto> pageResult=new PageResult<>();
|
||||
pageResult.setList(personRepDtos);
|
||||
pageResult.setTotal((long) personRepDtos.size());
|
||||
pageResult.setTotal(total);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
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.security.core.util.SecurityFrameworkUtils;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo;
|
||||
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.dataobject.ExamQuestion;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.SysFileUpload;
|
||||
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.controller.admin.paper.vo.StuInfoPaper;
|
||||
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;
|
||||
|
||||
@@ -33,7 +31,15 @@ public class EducationPaperQuServiceImpl implements IEducationPaperQuService
|
||||
@Autowired
|
||||
private EducationPaperSchemeMapper educationPaperSchemeMapper;
|
||||
@Autowired
|
||||
private EducationPaperParamMapper educationPaperParamMapper;
|
||||
@Autowired
|
||||
private EducationPaperSessionMapper educationPaperSessionMapper;
|
||||
@Autowired
|
||||
private EducationPaperPersonMapper educationPaperPersonMapper;
|
||||
@Autowired
|
||||
private SysFileMapper sysFileMapper;
|
||||
@Autowired
|
||||
private EducationPaperTaskMapper educationPaperTaskMapper;
|
||||
/**
|
||||
* 查询试卷试题
|
||||
*
|
||||
@@ -108,8 +114,7 @@ public class EducationPaperQuServiceImpl implements IEducationPaperQuService
|
||||
|
||||
@Override
|
||||
public ExamPaperVo selectPaperQuListByPaperId(String paperId) {
|
||||
|
||||
List<String> quIds =educationPaperQuMapper.selectPaperQuByPaperId(paperId);
|
||||
List<String> quIds =educationPaperQuMapper.selectPaperQuByPaperId(paperId);
|
||||
List<ExamQuestion> examQuestionList=examQuestionMapper.selectExamQuestionListByQuIds(quIds);
|
||||
|
||||
if (examQuestionList!=null&&examQuestionList.size()>0){
|
||||
@@ -121,12 +126,35 @@ public class EducationPaperQuServiceImpl implements IEducationPaperQuService
|
||||
|
||||
}
|
||||
String taskid=educationPaperMapper.selectTaskIdByPaperId(paperId);
|
||||
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskid);
|
||||
List<EducationPaperScheme> educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskid);
|
||||
|
||||
List<EducationPaperScheme> educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskid);
|
||||
//试卷试题数
|
||||
List<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(paperId);
|
||||
|
||||
|
||||
String nickname = SecurityFrameworkUtils.getLoginUserNickname();
|
||||
Long userId=SecurityFrameworkUtils.getLoginUserId();
|
||||
//设置进入试卷 考生考试信息确认参数
|
||||
StuInfoPaper stuInfoPaper=new StuInfoPaper();
|
||||
stuInfoPaper.setQueNum(String.valueOf(educationPaperQus.size()));
|
||||
stuInfoPaper.setNickName(nickname);
|
||||
|
||||
EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(paperId);
|
||||
EducationPaperPerson educationPaperPerson = educationPaperPersonMapper.selectByTaskIdAndPersonId(taskid, String.valueOf(userId));
|
||||
EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(taskid);
|
||||
if (educationPaperPerson!=null){
|
||||
stuInfoPaper.setBatch(educationPaperPerson.getBatch());
|
||||
}
|
||||
stuInfoPaper.setAnswerTime(educationPaperParam.getExamTime());
|
||||
stuInfoPaper.setPaperScore(educationPaper.getPaperScore());
|
||||
stuInfoPaper.setTaskName(educationPaperTask.getTaskName());
|
||||
ExamPaperVo examPaperVo=new ExamPaperVo();
|
||||
examPaperVo.setPaperId(paperId);
|
||||
examPaperVo.setExamQuestionList(examQuestionList);
|
||||
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
|
||||
examPaperVo.setEducationPaperParam(educationPaperParam);
|
||||
examPaperVo.setStuInfoPaper(stuInfoPaper);
|
||||
return examPaperVo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,13 @@ 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.security.core.util.SecurityFrameworkUtils;
|
||||
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.controller.admin.paper.vo.StuInfoPaper;
|
||||
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;
|
||||
@@ -327,12 +329,24 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
|
||||
|
||||
EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(taskid);
|
||||
String taskSpecialty = educationPaperTask.getTaskSpecialty();
|
||||
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskid);
|
||||
String taskSpecialty = educationPaperTask.getTaskSpecialty();
|
||||
|
||||
//根据试卷任务id查找方案集合
|
||||
List<EducationPaperScheme> educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskid);
|
||||
List<String> examQuestionIds = new ArrayList<>();
|
||||
|
||||
int totalScore = 0;
|
||||
for (EducationPaperScheme educationPaperScheme : educationPaperSchemeList) {
|
||||
|
||||
try {
|
||||
totalScore += Integer.parseInt(educationPaperScheme.getSubtotalScore());
|
||||
} catch (NumberFormatException e) {
|
||||
// 非数字按 0 处理
|
||||
totalScore += 0;
|
||||
// 可选:记录日志(避免静默忽略)
|
||||
throw new RuntimeException("非数字 subtotal_score: {}"+ educationPaperScheme.getSubtotalScore());
|
||||
}
|
||||
//获取试卷方案对象
|
||||
String pointNames = educationPaperScheme.getPointNames();
|
||||
//知识点id
|
||||
@@ -374,10 +388,14 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
educationPaper.setPaperId(uuid);
|
||||
educationPaper.setTaskId(taskid);
|
||||
educationPaper.setNum(formattedNumber);
|
||||
educationPaper.setPaperScore(String.valueOf(totalScore));
|
||||
educationPaper.setTenantId(TenantContextHolder.getRequiredTenantId());
|
||||
|
||||
|
||||
|
||||
|
||||
educationPaperMapper.insertEducationPaper(educationPaper);
|
||||
|
||||
System.out.println(examQuestionIds+"examQuestionIdsexamQuestionIds");
|
||||
|
||||
//构建试卷试题对象
|
||||
List<EducationPaperQu> educationPaperQus=new ArrayList<>();
|
||||
@@ -404,10 +422,33 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
}
|
||||
|
||||
}
|
||||
ExamPaperVo examPaperVo=new ExamPaperVo();
|
||||
|
||||
|
||||
//设置进入试卷 考生考试信息确认参数
|
||||
String nickname = SecurityFrameworkUtils.getLoginUserNickname();
|
||||
Long userId=SecurityFrameworkUtils.getLoginUserId();
|
||||
|
||||
EducationPaperPerson educationPaperPerson = educationPaperPersonMapper.selectByTaskIdAndPersonId(taskid, String.valueOf(userId));
|
||||
StuInfoPaper stuInfoPaper=new StuInfoPaper();
|
||||
stuInfoPaper.setQueNum(String.valueOf(educationPaperQus.size()));
|
||||
stuInfoPaper.setNickName(nickname);
|
||||
|
||||
if (educationPaperPerson!=null){
|
||||
stuInfoPaper.setBatch(educationPaperPerson.getBatch());
|
||||
}
|
||||
stuInfoPaper.setAnswerTime(educationPaperParam.getExamTime());
|
||||
stuInfoPaper.setPaperScore(educationPaper.getPaperScore());
|
||||
stuInfoPaper.setTaskName(educationPaperTask.getTaskName());
|
||||
|
||||
|
||||
|
||||
|
||||
ExamPaperVo examPaperVo=new ExamPaperVo();
|
||||
examPaperVo.setExamQuestionList(examQuestionList);
|
||||
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
|
||||
examPaperVo.setEducationPaperParam(educationPaperParam);
|
||||
examPaperVo.setPaperId(uuid);
|
||||
examPaperVo.setStuInfoPaper(stuInfoPaper);
|
||||
return examPaperVo;
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperPersonMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperSessionMapper;
|
||||
import pc.exam.pp.module.exam.utils.uuid.IdUtils;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -104,4 +105,9 @@ public class EducationPaperSessionServiceImpl implements IEducationPaperSessionS
|
||||
public int changeStatus(String sessionId, String status) {
|
||||
return educationPaperSessionMapper.changeStatus(sessionId,status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Time getAnswerTime(String taskId) {
|
||||
return educationPaperSessionMapper.getAnswerTime(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,19 @@ package pc.exam.pp.module.exam.service.paper;
|
||||
|
||||
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||
import pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils;
|
||||
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.controller.admin.paper.vo.StuInfoPaper;
|
||||
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;
|
||||
@@ -19,6 +22,7 @@ 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;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
@@ -49,6 +53,8 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
|
||||
|
||||
@Autowired
|
||||
private EducationPaperTaskMapper educationPaperTaskMapper;
|
||||
@Autowired
|
||||
private EducationPaperPersonMapper educationPaperPersonMapper;
|
||||
|
||||
@Autowired
|
||||
private SysFileMapper sysFileMapper;
|
||||
@@ -126,8 +132,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
|
||||
educationPaperParam.setIsNumber("1");
|
||||
educationPaperParam.setIsConnect("0");
|
||||
educationPaperParam.setIsAnswerId("1");
|
||||
|
||||
|
||||
educationPaperParam.setIsTime("0");
|
||||
educationPaperParam.setDirectory("KSWJ");
|
||||
educationPaperParam.setUploadTime("5");
|
||||
educationPaperParam.setIsDel("0");
|
||||
@@ -387,12 +392,14 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
|
||||
|
||||
@Override
|
||||
public ExamPaperVo selectPaperQuByPaperId(String taskId) {
|
||||
String paperId= educationPaperTaskMapper.selectPaperQuByPaperId(taskId);
|
||||
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskId);
|
||||
String paperId= educationPaperTaskMapper.selectPaperQuByPaperId(taskId);
|
||||
|
||||
List<ExamQuestion> examQuestionList=new ArrayList<>();
|
||||
List<EducationPaperScheme> educationPaperSchemeList=new ArrayList<>();
|
||||
List<String> quIds=new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(paperId)){
|
||||
List<String> quIds =educationPaperQuMapper.selectPaperQuByPaperId(paperId);
|
||||
quIds =educationPaperQuMapper.selectPaperQuByPaperId(paperId);
|
||||
examQuestionList=examQuestionMapper.selectExamQuestionListByQuIds(quIds);
|
||||
if (examQuestionList!=null&&examQuestionList.size()>0){
|
||||
for (ExamQuestion examQuestion : examQuestionList) {
|
||||
@@ -404,10 +411,49 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
|
||||
}
|
||||
educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskId);
|
||||
}
|
||||
ExamPaperVo examPaperVo=new ExamPaperVo();
|
||||
examPaperVo.setExamQuestionList(examQuestionList);
|
||||
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
|
||||
examPaperVo.setPaperId(paperId);
|
||||
return examPaperVo;
|
||||
|
||||
String nickname = SecurityFrameworkUtils.getLoginUserNickname();
|
||||
Long userId=SecurityFrameworkUtils.getLoginUserId();
|
||||
|
||||
EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(taskId);
|
||||
EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(paperId);
|
||||
//设置进入试卷 考生考试信息确认参数
|
||||
StuInfoPaper stuInfoPaper=new StuInfoPaper();
|
||||
stuInfoPaper.setQueNum(String.valueOf(quIds.size()));
|
||||
stuInfoPaper.setNickName(nickname);
|
||||
stuInfoPaper.setAnswerTime(educationPaperParam.getExamTime());
|
||||
stuInfoPaper.setPaperScore(educationPaper.getPaperScore());
|
||||
stuInfoPaper.setTaskName(educationPaperTask.getTaskName());
|
||||
|
||||
EducationPaperPerson educationPaperPerson = educationPaperPersonMapper.selectByTaskIdAndPersonId(taskId, String.valueOf(userId));
|
||||
if (educationPaperPerson!=null){
|
||||
stuInfoPaper.setBatch(educationPaperPerson.getBatch());
|
||||
}
|
||||
|
||||
ExamPaperVo examPaperVo=new ExamPaperVo();
|
||||
examPaperVo.setExamQuestionList(examQuestionList);
|
||||
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
|
||||
examPaperVo.setPaperId(paperId);
|
||||
examPaperVo.setEducationPaperParam(educationPaperParam);
|
||||
examPaperVo.setStuInfoPaper(stuInfoPaper);
|
||||
return examPaperVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<EducationPaperTask> selectEducationPaperTaskListByStu(PaperTaskPageVo educationPaperTask) {
|
||||
PageResult<EducationPaperTask> educationPaperTasks = educationPaperTaskMapper.selectEducationPaperTaskList(educationPaperTask);
|
||||
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
||||
|
||||
List<EducationPaperTask> list = educationPaperTasks.getList();
|
||||
List<String > taskIds= educationPaperPersonMapper.selectTaskIdByStuid(loginUserId);
|
||||
if (list!=null&&list.size()>0&&taskIds!=null&&taskIds.size()>0){
|
||||
list = list.stream()
|
||||
.filter(task -> taskIds.contains(task.getTaskId()))
|
||||
.collect(Collectors.toList());
|
||||
educationPaperTasks.setList(list);
|
||||
return educationPaperTasks;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.PersonRepDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.DeleteRequestVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPersonVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.SessionStuPageReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.StudentSessionReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.student.vo.StudentPageReqVO;
|
||||
@@ -22,10 +23,9 @@ public interface IEducationPaperPersonService
|
||||
/**
|
||||
* 查询试卷人员分配
|
||||
*
|
||||
* @param taskId 试卷人员分配主键
|
||||
* @return 试卷人员分配
|
||||
*/
|
||||
PageResult<PersonRepDto> selectEducationPaperPersonByTaskId(String taskId);
|
||||
PageResult<PersonRepDto> selectEducationPaperPersonByTaskId(ExamPersonVo examPersonVo);
|
||||
|
||||
/**
|
||||
* 查询试卷人员分配列表
|
||||
@@ -67,7 +67,7 @@ public interface IEducationPaperPersonService
|
||||
*/
|
||||
public int deleteEducationPaperPersonByTaskId(String taskId);
|
||||
|
||||
PageResult<PersonRepDto> selectEducationPaperPersonBySessionId(String sessionId);
|
||||
PageResult<PersonRepDto> selectEducationPaperPersonBySessionId(ExamPersonVo examPersonVo);
|
||||
|
||||
PageResult<PersonRepDto> selectEducationPaperPersonBySearch(SessionStuPageReqVO sessionStuPageReqVO);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import pc.exam.pp.framework.common.pojo.PageResult;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.EducationPaperSessionVo;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperSession;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -64,4 +65,6 @@ public interface IEducationPaperSessionService
|
||||
public int deleteEducationPaperSessionBySessionId(String sessionId);
|
||||
|
||||
int changeStatus(String sessionId, String status);
|
||||
|
||||
Time getAnswerTime(String taskId);
|
||||
}
|
||||
|
||||
@@ -84,5 +84,8 @@ public interface IEducationPaperTaskService
|
||||
boolean changeStatus(String taskId, String status);
|
||||
|
||||
ExamPaperVo selectPaperQuByPaperId(String taskId);
|
||||
|
||||
PageResult<EducationPaperTask> selectEducationPaperTaskListByStu(PaperTaskPageVo educationPaperTask);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
package pc.exam.pp.module.exam.service.question;
|
||||
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.security.core.util.SecurityFrameworkUtils;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.dto.ExamQuestionDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.dto.TenantDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExaminePageReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.rabbitmq.vo.RabbitMQSendInfoVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.*;
|
||||
import pc.exam.pp.module.exam.dal.mysql.question.*;
|
||||
import pc.exam.pp.module.exam.dal.mysql.questionexamine.QuestionExamineMapper;
|
||||
import pc.exam.pp.module.exam.service.questionexamine.QuestionExamineService;
|
||||
import pc.exam.pp.module.exam.utils.date.DateUtils;
|
||||
import pc.exam.pp.module.exam.utils.rabbitmq.RabbitmqUtils;
|
||||
import pc.exam.pp.module.exam.utils.uuid.IdUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -37,6 +46,8 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
|
||||
@Autowired
|
||||
private ExamQuestionKeywordMapper examQuestionKeywordMapper;
|
||||
@Autowired
|
||||
private QuestionExamineMapper questionExamineMapper;
|
||||
@Autowired
|
||||
private RabbitmqUtils rabbitMqService;
|
||||
/**
|
||||
* 查询试题(hyc)
|
||||
@@ -130,7 +141,6 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
|
||||
break;
|
||||
default:
|
||||
fileUpload.setFileName(null);
|
||||
// 可以设置一个默认文件名,或者保持原样(null 或空)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -342,13 +352,21 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
|
||||
public int uploadExamQuestionToRabbitMQ(RabbitMQSendInfoVO rabbitMQSendInfoVO) {
|
||||
// 1、判断上传题目数量
|
||||
int quCount = rabbitMQSendInfoVO.getQuIds().size();
|
||||
for (String quId : rabbitMQSendInfoVO.getQuIds()) {
|
||||
// 2、根据试题ID查找试题详情
|
||||
ExamQuestion examQuestion_obj = selectExamQuestionByQuId(quId);
|
||||
examQuestion_obj.setType(rabbitMQSendInfoVO.getType());
|
||||
// 3、上传至Rabbitmq
|
||||
rabbitMqService.sendMessage(rabbitMQSendInfoVO.getQueueName(), examQuestion_obj);
|
||||
List<String> quIds = rabbitMQSendInfoVO.getQuIds();
|
||||
if (quIds!=null&&quIds.size()>0){
|
||||
examQuestionMapper.setQuestionAuditByids(quIds);
|
||||
for (String quId : quIds) {
|
||||
// 2、根据试题ID查找试题详情
|
||||
ExamQuestion examQuestion_obj = selectExamQuestionByQuId(quId);
|
||||
examQuestion_obj.setType(rabbitMQSendInfoVO.getType());
|
||||
examQuestion_obj.setSource(SecurityFrameworkUtils.getLoginTenantId());
|
||||
examQuestion_obj.setCreateTeacher(SecurityFrameworkUtils.getLoginUserNickname());
|
||||
System.out.println(rabbitMQSendInfoVO.getQueueName());
|
||||
// 3、上传至Rabbitmq
|
||||
rabbitMqService.sendMessage(rabbitMQSendInfoVO.getQueueName(), examQuestion_obj);
|
||||
}
|
||||
}
|
||||
|
||||
return quCount;
|
||||
}
|
||||
|
||||
@@ -358,15 +376,136 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
|
||||
* @return 试题内容
|
||||
*/
|
||||
@Override
|
||||
public List<ExamQuestion> getExamQuestionToRabbitMQ(String queueName) {
|
||||
public boolean getExamQuestionToRabbitMQ(String queueName) {
|
||||
// 最先判断类型
|
||||
// TODO 1、拉取数据,保存至数据库 2、回调服务器是否拉取成功(中心服务器)
|
||||
// 1、获取上传的rabbit的试题数组
|
||||
List<ExamQuestion> examQuestions = rabbitMqService.receiveAllMessages(queueName);
|
||||
// 2、保存至数据库
|
||||
for (ExamQuestion examQuestion : examQuestions) {
|
||||
insertExamQuestion(examQuestion);
|
||||
List<ExamQuestion> examQuestions = null;
|
||||
try {
|
||||
examQuestions = rabbitMqService.receiveAllMessages(queueName);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return rabbitMqService.receiveAllMessages(queueName);
|
||||
if(examQuestions!=null&&examQuestions.size()>0){
|
||||
// 2、保存至数据库
|
||||
List<QuestionExamineDO> questionExamineDOS=new ArrayList<>();
|
||||
for (ExamQuestion examQuestion : examQuestions) {
|
||||
QuestionExamineDO questionExamineDO=new QuestionExamineDO();
|
||||
questionExamineDO.setQuId(examQuestion.getQuId());
|
||||
questionExamineDO.setSource(examQuestion.getSource());
|
||||
questionExamineDO.setCreateTeacher(examQuestion.getCreateTeacher());
|
||||
questionExamineDO.setType(examQuestion.getType());
|
||||
questionExamineDOS.add(questionExamineDO);
|
||||
// insertExamQuestion(examQuestion);
|
||||
}
|
||||
questionExamineMapper.insertOrUpdateList(questionExamineDOS);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ExamQuestion> selectExamQuestionListSend(QuestionVo questionVo) {
|
||||
return examQuestionMapper.selectExamQuestionListNO(questionVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ExamQuestion> selectExamQuestionListAudit(QuestionExaminePageReqVO questionVo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public PageResult<ExamQuestion> selectExamQuestionListAudit(QuestionVo questionVo) {
|
||||
// questionExamineMapper.selectPage()
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public PageResult<ExamQuestion> selectExamQuestionListNoAudit(QuestionExaminePageReqVO questionVo) {
|
||||
PageResult<QuestionExamineDO> questionExamineDOPageResult = questionExamineMapper.selectPage(questionVo);
|
||||
List<QuestionExamineDO> list = questionExamineDOPageResult.getList();
|
||||
List<ExamQuestion> examQuestionList=new ArrayList<>();
|
||||
if (list!=null&&list.size()>0){
|
||||
for (QuestionExamineDO questionExamineDO : list) {
|
||||
String schoolName =questionExamineMapper.selectSchoolName(questionExamineDO.getSource());
|
||||
ExamQuestion examQuestion = examQuestionMapper.selectExamQuestionByQuIdAndTenantId(questionExamineDO.getQuId(),questionExamineDO.getSource());
|
||||
examQuestion.setCreateTeacher(questionExamineDO.getCreateTeacher());
|
||||
examQuestion.setSchoolName(schoolName);
|
||||
examQuestion.setSource(questionExamineDO.getSource());
|
||||
examQuestion.setType(questionExamineDO.getType());
|
||||
examQuestion.setCreateTime(questionExamineDO.getCreateTime());
|
||||
examQuestionList.add(examQuestion);
|
||||
}
|
||||
}
|
||||
PageResult<ExamQuestion> examQuestionPageResult=new PageResult<>();
|
||||
examQuestionPageResult.setList(examQuestionList);
|
||||
examQuestionPageResult.setTotal((long) examQuestionList.size());
|
||||
|
||||
|
||||
return examQuestionPageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<TenantVo> getSchoolName(TenantDto tenantDto) {
|
||||
List<TenantVo> schoolName = examQuestionMapper.getSchoolName(tenantDto);
|
||||
long total = examQuestionMapper.getSchoolNameTotal(tenantDto);
|
||||
PageResult<TenantVo> pageResult=new PageResult<>();
|
||||
pageResult.setList(schoolName);
|
||||
pageResult.setTotal(total);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int auditQueByIds(List<String> quIds) {
|
||||
|
||||
|
||||
return examQuestionMapper.auditQueByIds(quIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int noAuditQue(List<String> quIds) {
|
||||
return examQuestionMapper.noAuditQue(quIds);
|
||||
}
|
||||
|
||||
public boolean getExamQuestionToRabbitMQInsertData(String queueName) {
|
||||
// 最先判断类型
|
||||
// TODO 1、拉取数据,保存至数据库 2、回调服务器是否拉取成功(中心服务器)
|
||||
// 1、获取上传的rabbit的试题数组
|
||||
List<ExamQuestion> examQuestions = null;
|
||||
try {
|
||||
examQuestions = rabbitMqService.receiveAllMessages(queueName);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
if(examQuestions!=null&&examQuestions.size()>0){
|
||||
examQuestionMapper.insertOrUpdate(examQuestions);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int uploadExamQuestionToRabbitMQBySource(RabbitMQSendInfoVO rabbitMQSendInfoVO) {
|
||||
// 1、判断上传题目数量
|
||||
int quCount = rabbitMQSendInfoVO.getQuIds().size();
|
||||
List<String> quIds = rabbitMQSendInfoVO.getQuIds();
|
||||
if (quIds!=null&&quIds.size()>0){
|
||||
for (String quId : quIds) {
|
||||
QuestionExamineDO questionExamineDO = questionExamineMapper.selectById(quId);
|
||||
|
||||
// 2、根据试题ID和租户查找试题详情
|
||||
ExamQuestion examQuestion_obj = examQuestionMapper.selectExamQuestionByQuIdAndTenantId(quId,questionExamineDO.getSource());
|
||||
// examQuestion_obj.setType(rabbitMQSendInfoVO.getType());
|
||||
// examQuestion_obj.setSource(SecurityFrameworkUtils.getLoginTenantId());
|
||||
// examQuestion_obj.setCreateTeacher(SecurityFrameworkUtils.getLoginUserNickname());
|
||||
// 3、上传至Rabbitmq
|
||||
rabbitMqService.sendMessage(rabbitMQSendInfoVO.getQueueName(), examQuestion_obj);
|
||||
}
|
||||
}
|
||||
|
||||
return quCount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@ package pc.exam.pp.module.exam.service.question;
|
||||
|
||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.dto.ExamQuestionDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.dto.TenantDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExaminePageReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.rabbitmq.vo.RabbitMQSendInfoVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||
@@ -78,5 +81,21 @@ public interface IExamQuestionService
|
||||
* @param queueName 客户端ID
|
||||
* @return 结果
|
||||
*/
|
||||
public List<ExamQuestion> getExamQuestionToRabbitMQ(String queueName);
|
||||
public boolean getExamQuestionToRabbitMQ(String queueName);
|
||||
|
||||
PageResult<ExamQuestion> selectExamQuestionListSend(QuestionVo questionVo);
|
||||
|
||||
PageResult<ExamQuestion> selectExamQuestionListAudit(QuestionExaminePageReqVO questionVo);
|
||||
|
||||
PageResult<ExamQuestion> selectExamQuestionListNoAudit(QuestionExaminePageReqVO questionVo);
|
||||
|
||||
|
||||
PageResult<TenantVo> getSchoolName(TenantDto tenantDto);
|
||||
|
||||
int auditQueByIds(List<String> quIds);
|
||||
|
||||
int noAuditQue(List<String> quIds);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package pc.exam.pp.module.exam.service.questionexamine;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.validation.*;
|
||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||
import pc.exam.pp.framework.common.pojo.PageParam;
|
||||
import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExaminePageReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExamineSaveReqVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.QuestionExamineDO;
|
||||
|
||||
/**
|
||||
* 试题交互中间 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface QuestionExamineService {
|
||||
|
||||
/**
|
||||
* 创建试题交互中间
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
String createQuestionExamine(@Valid QuestionExamineSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新试题交互中间
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateQuestionExamine(@Valid QuestionExamineSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除试题交互中间
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteQuestionExamine(String id);
|
||||
|
||||
/**
|
||||
* 获得试题交互中间
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 试题交互中间
|
||||
*/
|
||||
QuestionExamineDO getQuestionExamine(String id);
|
||||
|
||||
/**
|
||||
* 获得试题交互中间分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 试题交互中间分页
|
||||
*/
|
||||
PageResult<QuestionExamineDO> getQuestionExaminePage(QuestionExaminePageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package pc.exam.pp.module.exam.service.questionexamine;
|
||||
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import pc.exam.pp.framework.common.exception.ErrorCode;
|
||||
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.questionexamine.vo.QuestionExaminePageReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExamineSaveReqVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.QuestionExamineDO;
|
||||
import pc.exam.pp.module.exam.dal.mysql.questionexamine.QuestionExamineMapper;
|
||||
|
||||
import static pc.exam.pp.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static pc.exam.pp.module.system.enums.ErrorCodeConstants.QUESTION_EXAMINE_NOT_EXISTS;
|
||||
/**
|
||||
* 试题交互中间 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class QuestionExamineServiceImpl implements QuestionExamineService {
|
||||
|
||||
@Resource
|
||||
private QuestionExamineMapper questionExamineMapper;
|
||||
|
||||
@Override
|
||||
public String createQuestionExamine(QuestionExamineSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
QuestionExamineDO questionExamine = BeanUtils.toBean(createReqVO, QuestionExamineDO.class);
|
||||
questionExamineMapper.insert(questionExamine);
|
||||
// 返回
|
||||
return questionExamine.getQuId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateQuestionExamine(QuestionExamineSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateQuestionExamineExists(updateReqVO.getExamineId());
|
||||
// 更新
|
||||
QuestionExamineDO updateObj = BeanUtils.toBean(updateReqVO, QuestionExamineDO.class);
|
||||
questionExamineMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteQuestionExamine(String id) {
|
||||
// 校验存在
|
||||
validateQuestionExamineExists(id);
|
||||
// 删除
|
||||
questionExamineMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateQuestionExamineExists(String id) {
|
||||
if (questionExamineMapper.selectById(id) == null) {
|
||||
throw exception(QUESTION_EXAMINE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuestionExamineDO getQuestionExamine(String id) {
|
||||
return questionExamineMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<QuestionExamineDO> getQuestionExaminePage(QuestionExaminePageReqVO pageReqVO) {
|
||||
return questionExamineMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* rabbitmq 工具
|
||||
* QUEUE_NAME dept_id + "_Queue"
|
||||
* QUEUE_NAME tenant_id + "_Queue"
|
||||
*/
|
||||
@Service
|
||||
public class RabbitmqUtils {
|
||||
@@ -45,12 +45,11 @@ public class RabbitmqUtils {
|
||||
/**
|
||||
*
|
||||
* @param queueName 客户端对应队列
|
||||
* @param deptName 客户端名称
|
||||
* @return 客户端连接状态
|
||||
*/
|
||||
public String connect(String queueName, String deptName) {
|
||||
public int connect(String queueName) {
|
||||
if (isConnected()) {
|
||||
return "已经连接";
|
||||
return 0;
|
||||
}
|
||||
|
||||
ConnectionFactory factory = new ConnectionFactory();
|
||||
@@ -66,13 +65,36 @@ public class RabbitmqUtils {
|
||||
channel = connection.createChannel();
|
||||
// 声明一个队列,如果已经存在就不会重复创建
|
||||
channel.queueDeclare(queueName, true, false, false, null);
|
||||
return deptName + "_连接成功";
|
||||
return 1;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return deptName + "_连接失败: " + e.getMessage();
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
public boolean connectSchool(String queueName) {
|
||||
if (isConnected()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ConnectionFactory factory = new ConnectionFactory();
|
||||
factory.setHost(rabbitProps.getHost());
|
||||
factory.setPort(rabbitProps.getPort());
|
||||
factory.setUsername(rabbitProps.getUsername());
|
||||
factory.setPassword(rabbitProps.getPassword());
|
||||
factory.setVirtualHost(rabbitProps.getVirtualHost());
|
||||
|
||||
try {
|
||||
// 创建连接和通道
|
||||
connection = factory.newConnection();
|
||||
channel = connection.createChannel();
|
||||
// 声明一个队列,如果已经存在就不会重复创建
|
||||
channel.queueDeclare(queueName, true, false, false, null);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 向队列中发送一条消息
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
<result property="usb" column="usb" />
|
||||
<result property="saveGrades" column="save_grades" />
|
||||
<result property="driver" column="driver" />
|
||||
|
||||
<result property="isTime" column="is_time" />
|
||||
<result property="examTime" column="exam_time" />
|
||||
|
||||
|
||||
<result property="directory" column="directory" />
|
||||
<result property="uploadTime" column="upload_time" />
|
||||
<result property="isDel" column="is_del" />
|
||||
@@ -26,7 +31,7 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEducationPaperParamVo">
|
||||
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
|
||||
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_time,exam_time,is_del,is_repeat ,is_answer,is_look,is_connect,is_session from education_paper_param
|
||||
</sql>
|
||||
|
||||
<select id="selectEducationPaperParamList" parameterType="EducationPaperParam" resultMap="EducationPaperParamResult">
|
||||
@@ -68,6 +73,8 @@
|
||||
<if test="driver != null">driver,</if>
|
||||
<if test="directory != null">directory,</if>
|
||||
<if test="uploadTime != null">upload_time,</if>
|
||||
<if test="isTime != null">is_time,</if>
|
||||
<if test="examTime != null">exam_time,</if>
|
||||
<if test="isDel != null">is_del,</if>
|
||||
<if test="isRepeat != null">is_repeat,</if>
|
||||
<if test="isAnswer != null">is_answer,</if>
|
||||
@@ -89,6 +96,9 @@
|
||||
<if test="driver != null">#{driver},</if>
|
||||
<if test="directory != null">#{directory},</if>
|
||||
<if test="uploadTime != null">#{uploadTime},</if>
|
||||
<if test="isTime != null">#{isTime},</if>
|
||||
<if test="examTime != null">#{examTime},</if>
|
||||
|
||||
<if test="isDel != null">#{isDel},</if>
|
||||
<if test="isRepeat != null">#{isRepeat},</if>
|
||||
<if test="isAnswer != null">#{isAnswer},</if>
|
||||
@@ -113,6 +123,8 @@
|
||||
<if test="driver != null">driver = #{driver},</if>
|
||||
<if test="directory != null">directory = #{directory},</if>
|
||||
<if test="uploadTime != null">upload_time = #{uploadTime},</if>
|
||||
<if test="isTime != null">is_time = #{isTime},</if>
|
||||
<if test="examTime != null">exam_time = #{examTime},</if>
|
||||
<if test="isDel != null">is_del = #{isDel},</if>
|
||||
<if test="isRepeat != null">is_repeat = #{isRepeat},</if>
|
||||
<if test="isAnswer != null">is_answer = #{isAnswer},</if>
|
||||
|
||||
@@ -25,21 +25,17 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEducationPaperPersonByTaskId" parameterType="String" resultMap="EducationPaperPersonResult">
|
||||
<include refid="selectEducationPaperPersonVo"/>
|
||||
where task_id = #{taskId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectUserById" resultType="pc.exam.pp.module.exam.controller.admin.paper.dto.PersonRepDto">
|
||||
select * from system_users where id =#{personId}
|
||||
</select>
|
||||
<select id="selectUserClassName" resultType="java.lang.String">
|
||||
select name from exam_class where id =#{classId}
|
||||
</select>
|
||||
<select id="selectEducationPaperPersonBySessionId" parameterType="String" resultMap="EducationPaperPersonResult">
|
||||
|
||||
<include refid="selectEducationPaperPersonVo"/>
|
||||
where session_id = #{sessionId}
|
||||
</select>
|
||||
<select id="selectEducationPaperPersonByNotInSessionId"
|
||||
resultType="pc.exam.pp.module.exam.controller.admin.paper.dto.PersonRepDto">
|
||||
SELECT DISTINCT s.*
|
||||
@@ -67,7 +63,7 @@
|
||||
AND s.class_id = #{classId}
|
||||
</if>
|
||||
ORDER BY s.id DESC
|
||||
|
||||
LIMIT #{pageSize} OFFSET #{offset}
|
||||
|
||||
</select>
|
||||
|
||||
@@ -111,6 +107,81 @@
|
||||
|
||||
select person_id from education_paper_person where task_id=#{taskId}
|
||||
</select>
|
||||
<select id="selectTaskIdByStuid" resultType="java.lang.String">
|
||||
select task_id from education_paper_person where person_id =#{loginUserId}
|
||||
</select>
|
||||
<select id="selectEducationPaperPersonBySessionId"
|
||||
resultMap="EducationPaperPersonResult">
|
||||
<include refid="selectEducationPaperPersonVo"/>
|
||||
where session_id = #{sessionId}
|
||||
LIMIT #{pageSize} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="selectEducationPaperPersonByTaskIdTotal" resultType="java.lang.Long">
|
||||
select count(*) from education_paper_person where task_id = #{taskId}
|
||||
|
||||
</select>
|
||||
<select id="selectEducationPaperPersonBySessionIdTotal" resultType="java.lang.Long">
|
||||
select count(*) from education_paper_person
|
||||
where session_id = #{sessionId}
|
||||
</select>
|
||||
<select id="selectEducationPaperPersonByTaskId"
|
||||
resultMap="EducationPaperPersonResult">
|
||||
<include refid="selectEducationPaperPersonVo"/>
|
||||
where task_id = #{taskId}
|
||||
LIMIT #{pageSize} OFFSET #{offset}
|
||||
|
||||
</select>
|
||||
<select id="selectEducationPaperPersonByNotInSessionIdTotal" resultType="java.lang.Long">
|
||||
SELECT COUNT(DISTINCT s.id)
|
||||
FROM system_users s
|
||||
LEFT JOIN education_paper_person pp ON s.id = pp.person_id
|
||||
WHERE
|
||||
s.user_type = #{userType}
|
||||
AND s.id IN (
|
||||
SELECT person_id FROM education_paper_person WHERE
|
||||
session_id ='' and
|
||||
session_id !=#{sessionId} and task_id =#{taskId}
|
||||
)
|
||||
|
||||
<if test="username != null and username != ''">
|
||||
AND s.username LIKE CONCAT('%', #{username}, '%')
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND s.status = #{status}
|
||||
</if>
|
||||
<if test="startTime != null and endTime != null">
|
||||
AND s.create_time BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
|
||||
<if test="classId != null and classId != ''">
|
||||
AND s.class_id = #{classId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectEducationPaperPersonBySessionIdNotInTotal" resultType="java.lang.Long">
|
||||
SELECT COUNT(DISTINCT s.id)
|
||||
FROM system_users s
|
||||
LEFT JOIN education_paper_person pp ON s.id = pp.person_id
|
||||
WHERE
|
||||
s.user_type = #{userType}
|
||||
AND s.id NOT IN (
|
||||
SELECT person_id FROM education_paper_person WHERE task_id =#{taskId}
|
||||
)
|
||||
|
||||
<if test="username != null and username != ''">
|
||||
AND s.username LIKE CONCAT('%', #{username}, '%')
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND s.status = #{status}
|
||||
</if>
|
||||
<if test="startTime != null and endTime != null">
|
||||
AND s.create_time BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
|
||||
<if test="classId != null and classId != ''">
|
||||
AND s.class_id = #{classId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertEducationPaperPerson" parameterType="EducationPaperPerson">
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
<include refid="selectEducationPaperSessionVo"/>
|
||||
where task_id =#{taskId}
|
||||
</select>
|
||||
<select id="getAnswerTime" resultType="java.sql.Time">
|
||||
select exam_time from education_paper_param where task_id =#{taskId}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertEducationPaperSession" parameterType="EducationPaperSession">
|
||||
insert into education_paper_session
|
||||
|
||||
@@ -41,7 +41,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="sort" column="sort"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo" id="TenantVoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="ququeName" column="queue_name" />
|
||||
</resultMap>
|
||||
<sql id="selectExamQuestionVo">
|
||||
select qu_id, qu_bank_id, qu_bank_name, chapterId_dict_text,subject_name, qu_level,
|
||||
content, content_text, analysis, point_names, keywords, manual, create_time, creator, update_time, updater, deleted ,status,audit ,course_name, specialty_name from exam_question
|
||||
@@ -75,6 +79,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
CASE WHEN a.sort IS NOT NULL THEN 0 ELSE 1 END,
|
||||
a.sort ASC
|
||||
</select>
|
||||
<select id="getSchoolName" resultMap="TenantVoResult">
|
||||
SELECT id, name, queue_name
|
||||
FROM system_tenant
|
||||
WHERE deleted = 0
|
||||
<if test="name != null and name != ''">
|
||||
AND name LIKE CONCAT('%', #{name}, '%')
|
||||
</if>
|
||||
LIMIT #{pageSize} OFFSET #{offset}
|
||||
</select>
|
||||
<select id="getSchoolNameTotal" resultType="java.lang.Long">
|
||||
SELECT count(*)
|
||||
FROM system_tenant
|
||||
WHERE id != 1 AND deleted = 0
|
||||
<if test="name != null and name != ''">
|
||||
AND name LIKE CONCAT('%', #{name}, '%')
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectExamQuestionByQuIdAndTenantId"
|
||||
resultMap="ExamQuestionResult">
|
||||
<include refid="selectExamQuestionVo"/>
|
||||
where qu_id = #{quId} and tenant_id= #{source}
|
||||
|
||||
</select>
|
||||
<select id="seleAllQueueName" resultType="java.lang.String">
|
||||
SELECT queue_name
|
||||
FROM system_tenant
|
||||
WHERE deleted = 0
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertExamQuestion" parameterType="ExamQuestion">
|
||||
@@ -170,6 +202,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="setQuestionAuditByids">
|
||||
UPDATE exam_question
|
||||
SET audit = '2'
|
||||
WHERE qu_id IN
|
||||
<foreach collection="quIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="auditQueByIds">
|
||||
UPDATE exam_question
|
||||
SET audit = '0'
|
||||
WHERE qu_id IN
|
||||
<foreach collection="quIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="noAuditQue">
|
||||
|
||||
UPDATE exam_question
|
||||
SET audit = '3'
|
||||
WHERE qu_id IN
|
||||
<foreach collection="quIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="pc.exam.pp.module.exam.dal.mysql.questionexamine.QuestionExamineMapper">
|
||||
|
||||
|
||||
<insert id="insertOrUpdateList">
|
||||
INSERT INTO education_question_examine (qu_id,source, create_teacher,type,create_time)
|
||||
VALUES
|
||||
<foreach collection="collection" item="item" separator=",">
|
||||
( #{item.quId}, #{item.source}, #{item.createTeacher}, #{item.type},now())
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
source = VALUES(source),
|
||||
create_teacher = VALUES(create_teacher),
|
||||
type = VALUES(type),
|
||||
create_time=now()
|
||||
|
||||
|
||||
|
||||
|
||||
</insert>
|
||||
<select id="selectSchoolName" resultType="java.lang.String">
|
||||
select name from system_tenant where id =#{source}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user