소스 검색

3.2.5 新需求

xiaofei 2 년 전
부모
커밋
700c29d783

+ 92 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamPaperStructurePageDto.java

@@ -0,0 +1,92 @@
+package com.qmth.distributed.print.business.bean.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.distributed.print.business.entity.ExamPaperStructure;
+import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusEnum;
+import com.qmth.teachcloud.common.base.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 考试试卷结构dto
+ * </p>
+ *
+ * @author xf
+ */
+public class ExamPaperStructurePageDto extends ExamPaperStructure implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String statusStr;
+
+    private String paperNumberId;
+
+    private String taskStatus;
+
+    private String transferId;
+
+    private String cardId;
+
+    private Long examTaskId;
+
+    @Override
+    public String getStatusStr() {
+        return statusStr;
+    }
+
+    @Override
+    public void setStatusStr(String statusStr) {
+        this.statusStr = statusStr;
+    }
+
+    @Override
+    public String getPaperNumberId() {
+        return paperNumberId;
+    }
+
+    @Override
+    public void setPaperNumberId(String paperNumberId) {
+        this.paperNumberId = paperNumberId;
+    }
+
+    @Override
+    public String getTaskStatus() {
+        return taskStatus;
+    }
+
+    @Override
+    public void setTaskStatus(String taskStatus) {
+        this.taskStatus = taskStatus;
+    }
+
+    @Override
+    public String getTransferId() {
+        return transferId;
+    }
+
+    @Override
+    public void setTransferId(String transferId) {
+        this.transferId = transferId;
+    }
+
+    public String getCardId() {
+        return cardId;
+    }
+
+    public void setCardId(String cardId) {
+        this.cardId = cardId;
+    }
+
+    public Long getExamTaskId() {
+        return examTaskId;
+    }
+
+    public void setExamTaskId(Long examTaskId) {
+        this.examTaskId = examTaskId;
+    }
+}

+ 30 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/marking/Question.java

@@ -44,6 +44,12 @@ public class Question {
     @ApiModelProperty(value = "客观题答案")
     private String answer;
 
+    private Integer type;
+
+    private String typeName;
+
+    private Integer optionCount;
+
     public Integer getMainNumber() {
         return mainNumber;
     }
@@ -124,6 +130,30 @@ public class Question {
         this.expandSub = expandSub;
     }
 
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getTypeName() {
+        return typeName;
+    }
+
+    public void setTypeName(String typeName) {
+        this.typeName = typeName;
+    }
+
+    public Integer getOptionCount() {
+        return optionCount;
+    }
+
+    public void setOptionCount(Integer optionCount) {
+        this.optionCount = optionCount;
+    }
+
     /**
      * 判断两个题目是否完全相同
      * <p>

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamPaperStructureMapper.java

@@ -3,6 +3,7 @@ package com.qmth.distributed.print.business.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.distributed.print.business.bean.dto.ExamPaperStructurePageDto;
 import com.qmth.distributed.print.business.entity.ExamPaperStructure;
 import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
 import org.apache.ibatis.annotations.Param;
@@ -17,7 +18,7 @@ import java.util.List;
  * @author xf
  */
 public interface ExamPaperStructureMapper extends BaseMapper<ExamPaperStructure> {
-    IPage<ExamPaperStructure> listByPropositionTeacherId(@Param("page") Page<ExamPaperStructure> page, @Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("propositionTeacherId") Long propositionTeacherId, @Param("syncStatus") String syncStatus, @Param("structureStatusEnums") String[] structureStatusEnums, @Param("ready") Boolean ready,@Param("dpr") DataPermissionRule dpr);
+    IPage<ExamPaperStructurePageDto> listByPropositionTeacherId(@Param("page") Page<ExamPaperStructure> page, @Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("propositionTeacherId") Long propositionTeacherId, @Param("syncStatus") String syncStatus, @Param("structureStatusEnums") String[] structureStatusEnums, @Param("ready") Boolean ready, @Param("dpr") DataPermissionRule dpr);
 
     List<ExamPaperStructure> listByPropositionTeacherId(@Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("propositionTeacherId") Long propositionTeacherId, @Param("syncStatus") String syncStatus, @Param("structureStatusEnums") String[] structureStatusEnums, @Param("ready") Boolean ready,@Param("dpr") DataPermissionRule dpr);
 }

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamPaperStructureService.java

@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.distributed.print.business.bean.dto.ExamPaperStructurePageDto;
 import com.qmth.distributed.print.business.bean.marking.CardJpgResult;
 import com.qmth.distributed.print.business.bean.marking.GroupInfo;
 import com.qmth.distributed.print.business.bean.marking.Question;
@@ -24,7 +25,7 @@ import java.util.Map;
  */
 public interface ExamPaperStructureService extends IService<ExamPaperStructure> {
 
-    IPage<ExamPaperStructure> listByPropositionTeacherId(Long semesterId, Long examId, Integer pageNumber, Integer pageSize, String[] structureStatusEnums, Boolean ready);
+    IPage<ExamPaperStructurePageDto> listByPropositionTeacherId(Long semesterId, Long examId, Integer pageNumber, Integer pageSize, String[] structureStatusEnums, Boolean ready);
 
     ExamPaperStructure upload(String examPaperStructure, String md5, String keys, MultipartFile[] files);
 

+ 13 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperStructureServiceImpl.java

@@ -12,6 +12,7 @@ import com.google.common.collect.Lists;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.distributed.print.business.bean.dto.ExamPaperObjectiveStructureDto;
 import com.qmth.distributed.print.business.bean.dto.ExamPaperStructureDto;
+import com.qmth.distributed.print.business.bean.dto.ExamPaperStructurePageDto;
 import com.qmth.distributed.print.business.bean.dto.ExamPaperSubjectiveStructureDto;
 import com.qmth.distributed.print.business.bean.marking.*;
 import com.qmth.distributed.print.business.entity.*;
@@ -100,12 +101,12 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
     private BasicRoleDataPermissionService basicRoleDataPermissionService;
 
     @Override
-    public IPage<ExamPaperStructure> listByPropositionTeacherId(Long semesterId, Long examId, Integer pageNumber, Integer pageSize, String[] structureStatusEnums, Boolean ready) {
+    public IPage<ExamPaperStructurePageDto> listByPropositionTeacherId(Long semesterId, Long examId, Integer pageNumber, Integer pageSize, String[] structureStatusEnums, Boolean ready) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(schoolId, sysUser.getId(), ServletUtil.getRequest().getServletPath());
         Page<ExamPaperStructure> page = new Page<>(pageNumber, pageSize);
-        IPage<ExamPaperStructure> examPaperStructureIPage = this.baseMapper.listByPropositionTeacherId(page, schoolId, semesterId, examId, sysUser.getId(), ExamTaskSyncStatusEnum.FINISH.name(), structureStatusEnums, ready, dpr);
+        IPage<ExamPaperStructurePageDto> examPaperStructureIPage = this.baseMapper.listByPropositionTeacherId(page, schoolId, semesterId, examId, sysUser.getId(), ExamTaskSyncStatusEnum.FINISH.name(), structureStatusEnums, ready, dpr);
         examPaperStructureIPage.getRecords().forEach(m -> {
             m.setStatusStr(ExamPaperStructureStatusEnum.INIT.equals(m.getStatus()) ? "未提交" : "已提交");
 
@@ -116,6 +117,16 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
                 TBSyncTask tbSyncTask = tbSyncTaskService.getOne(queryWrapper);
                 m.setTaskStatus(tbSyncTask == null ? null : tbSyncTask.getStatus().name());
             }
+
+            ExamTaskDetail examTaskDetail = examTaskDetailService.getOne(new QueryWrapper<ExamTaskDetail>().lambda()
+                    .eq(ExamTaskDetail::getExamTaskId, m.getExamTaskId()));
+            if(StringUtils.isNotBlank(examTaskDetail.getPaperAttachmentIds())){
+                List<JSONObject> jsonObjectList = JSON.parseArray(examTaskDetail.getPaperAttachmentIds(), JSONObject.class);
+               Optional<JSONObject> objectOptional = jsonObjectList.stream().filter(t->m.getPaperType().equals(t.getString("name"))).findFirst();
+               if(objectOptional.isPresent()){
+                   m.setCardId(objectOptional.get().getString("cardId"));
+               }
+            }
         });
         return examPaperStructureIPage;
     }

+ 6 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceImpl.java

@@ -52,6 +52,7 @@ import java.io.*;
 import java.math.BigDecimal;
 import java.nio.charset.StandardCharsets;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -1187,7 +1188,11 @@ public class PrintCommonServiceImpl implements PrintCommonService {
     @Override
     public String createTicketNumber(SerialNumberParams serialNumberParams) {
         try {
-            lock.lock();
+            try {
+                lock.tryLock(30, TimeUnit.SECONDS);
+            } catch (InterruptedException e) {
+                log.error("生成准考证号失败");
+            }
             return convertUtil.getIncre(serialNumberParams.getPrefix(), serialNumberParams.getModel(), serialNumberParams.getDigit());
         } finally {
             lock.unlock();

+ 2 - 1
distributed-print-business/src/main/resources/mapper/ExamPaperStructureMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.qmth.distributed.print.business.mapper.ExamPaperStructureMapper">
     <select id="listByPropositionTeacherId"
-            resultType="com.qmth.distributed.print.business.entity.ExamPaperStructure">
+            resultType="com.qmth.distributed.print.business.bean.dto.ExamPaperStructurePageDto">
         SELECT
             eps.id,
             ep.school_id schoolId,
@@ -11,6 +11,7 @@
             ep.third_relate_name thirdRelateName,
             eps.objective_structure objectiveStructure,
             eps.subjective_structure subjectiveStructure,
+            et.id examTaskId,
             ep.paper_number paperNumber,
             ep.course_code courseCode,
             ep.course_name courseName,

+ 2 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamPaperStructureController.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.distributed.print.business.bean.dto.ExamPaperStructurePageDto;
 import com.qmth.distributed.print.business.bean.marking.EvaluationParameters;
 import com.qmth.distributed.print.business.bean.marking.GroupInfo;
 import com.qmth.distributed.print.business.bean.result.EditResult;
@@ -58,7 +59,7 @@ public class ExamPaperStructureController {
                        @ApiParam(value = "考试ID", required = false) @RequestParam(required = false) Long examId,
                        @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
                        @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
-        IPage<ExamPaperStructure> examPaperStructureIPage = examPaperStructureService.listByPropositionTeacherId(semesterId, examId, pageNumber, pageSize, null, false);
+        IPage<ExamPaperStructurePageDto> examPaperStructureIPage = examPaperStructureService.listByPropositionTeacherId(semesterId, examId, pageNumber, pageSize, null, false);
         return ResultUtil.ok(examPaperStructureIPage);
     }