Ver Fonte

题卡管理

xiaof há 4 anos atrás
pai
commit
3dc45a2c38
23 ficheiros alterados com 723 adições e 27 exclusões
  1. 125 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/CardCustDto.java
  2. 116 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamTaskDetailCardDto.java
  3. 9 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamTaskDetailDto.java
  4. 100 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/ExamCardParams.java
  5. 16 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamCard.java
  6. 1 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/EnumType.java
  7. 44 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/MakeMethodEnum.java
  8. 4 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamTaskMapper.java
  9. 1 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamCardDetailService.java
  10. 3 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamCardService.java
  11. 8 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamTaskDetailService.java
  12. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamTaskService.java
  13. 9 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamCardDetailServiceImpl.java
  14. 147 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamCardServiceImpl.java
  15. 24 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java
  16. 14 8
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java
  17. 12 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/ServletUtil.java
  18. 43 5
      distributed-print-business/src/main/resources/mapper/ExamTaskMapper.xml
  19. 1 0
      distributed-print-common/src/main/java/com/qmth/distributed/print/common/contant/SystemConstant.java
  20. 3 2
      distributed-print/src/main/java/com/qmth/distributed/print/api/BasicExamRuleController.java
  21. 3 0
      distributed-print/src/main/java/com/qmth/distributed/print/api/EnumsController.java
  22. 37 1
      distributed-print/src/main/java/com/qmth/distributed/print/api/ExamCardController.java
  23. 2 1
      distributed-print/src/main/java/com/qmth/distributed/print/api/ExamTaskController.java

+ 125 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/CardCustDto.java

@@ -0,0 +1,125 @@
+package com.qmth.distributed.print.business.bean.dto;
+
+/**
+ * @Date: 2021/3/29.
+ */
+public class CardCustDto {
+
+    private String examTaskId;
+    private String cardId;
+    private String cardRuleId;
+    private String courseCode;
+    private String courseName;
+    private String status;
+    private String paperNumber;
+    private String schoolId;
+    private String schoolName;
+    private String orgId;
+    private String orgName;
+    private String createId;
+    private String createName;
+
+    public String getExamTaskId() {
+        return examTaskId;
+    }
+
+    public void setExamTaskId(String examTaskId) {
+        this.examTaskId = examTaskId;
+    }
+
+    public String getCardId() {
+        return cardId;
+    }
+
+    public void setCardId(String cardId) {
+        this.cardId = cardId;
+    }
+
+    public String getCardRuleId() {
+        return cardRuleId;
+    }
+
+    public void setCardRuleId(String cardRuleId) {
+        this.cardRuleId = cardRuleId;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getPaperNumber() {
+        return paperNumber;
+    }
+
+    public void setPaperNumber(String paperNumber) {
+        this.paperNumber = paperNumber;
+    }
+
+    public String getSchoolId() {
+        return schoolId;
+    }
+
+    public void setSchoolId(String schoolId) {
+        this.schoolId = schoolId;
+    }
+
+    public String getSchoolName() {
+        return schoolName;
+    }
+
+    public void setSchoolName(String schoolName) {
+        this.schoolName = schoolName;
+    }
+
+    public String getOrgId() {
+        return orgId;
+    }
+
+    public void setOrgId(String orgId) {
+        this.orgId = orgId;
+    }
+
+    public String getOrgName() {
+        return orgName;
+    }
+
+    public void setOrgName(String orgName) {
+        this.orgName = orgName;
+    }
+
+    public String getCreateId() {
+        return createId;
+    }
+
+    public void setCreateId(String createId) {
+        this.createId = createId;
+    }
+
+    public String getCreateName() {
+        return createName;
+    }
+
+    public void setCreateName(String createName) {
+        this.createName = createName;
+    }
+}

+ 116 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamTaskDetailCardDto.java

@@ -0,0 +1,116 @@
+package com.qmth.distributed.print.business.bean.dto;
+
+/**
+ * @Date: 2021/3/31.
+ */
+public class ExamTaskDetailCardDto {
+
+    private String examTaskId;
+    private String paperType;
+    private String paperAttachmentIds;
+    private String cardId;
+    private String paperConfirmAttachmentIds;
+    private String remark;
+    private String exposedPaperType;
+    private String relatePaperType;
+    private String unexposedPaperType;
+    private Boolean enable;
+    private String makeMethod;
+    private String status;
+
+    public String getExamTaskId() {
+        return examTaskId;
+    }
+
+    public void setExamTaskId(String examTaskId) {
+        this.examTaskId = examTaskId;
+    }
+
+    public String getPaperType() {
+        return paperType;
+    }
+
+    public void setPaperType(String paperType) {
+        this.paperType = paperType;
+    }
+
+    public String getPaperAttachmentIds() {
+        return paperAttachmentIds;
+    }
+
+    public void setPaperAttachmentIds(String paperAttachmentIds) {
+        this.paperAttachmentIds = paperAttachmentIds;
+    }
+
+    public String getCardId() {
+        return cardId;
+    }
+
+    public void setCardId(String cardId) {
+        this.cardId = cardId;
+    }
+
+    public String getPaperConfirmAttachmentIds() {
+        return paperConfirmAttachmentIds;
+    }
+
+    public void setPaperConfirmAttachmentIds(String paperConfirmAttachmentIds) {
+        this.paperConfirmAttachmentIds = paperConfirmAttachmentIds;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getExposedPaperType() {
+        return exposedPaperType;
+    }
+
+    public void setExposedPaperType(String exposedPaperType) {
+        this.exposedPaperType = exposedPaperType;
+    }
+
+    public String getRelatePaperType() {
+        return relatePaperType;
+    }
+
+    public void setRelatePaperType(String relatePaperType) {
+        this.relatePaperType = relatePaperType;
+    }
+
+    public String getUnexposedPaperType() {
+        return unexposedPaperType;
+    }
+
+    public void setUnexposedPaperType(String unexposedPaperType) {
+        this.unexposedPaperType = unexposedPaperType;
+    }
+
+    public Boolean getEnable() {
+        return enable;
+    }
+
+    public void setEnable(Boolean enable) {
+        this.enable = enable;
+    }
+
+    public String getMakeMethod() {
+        return makeMethod;
+    }
+
+    public void setMakeMethod(String makeMethod) {
+        this.makeMethod = makeMethod;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+}

+ 9 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamTaskDetailDto.java

@@ -20,6 +20,7 @@ public class ExamTaskDetailDto {
     private Boolean enable;
     private String createId;
     private Long createTime;
+    private String paperType;
     private String relatePaperType;
     private String exposedPaperType;
     private String unexposedPaperType;
@@ -176,4 +177,12 @@ public class ExamTaskDetailDto {
     public void setTotalSubjects(Integer totalSubjects) {
         this.totalSubjects = totalSubjects;
     }
+
+    public String getPaperType() {
+        return paperType;
+    }
+
+    public void setPaperType(String paperType) {
+        this.paperType = paperType;
+    }
 }

+ 100 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/ExamCardParams.java

@@ -0,0 +1,100 @@
+package com.qmth.distributed.print.business.bean.params;
+
+import com.qmth.distributed.print.business.enums.MakeMethodEnum;
+
+/**
+ * @Date: 2021/4/8.
+ */
+public class ExamCardParams {
+
+    private Long id;
+    private String status;
+    private String examTaskId;
+    private String courseCode;
+    private String courseName;
+    private String title;
+    private MakeMethodEnum makeMethod;
+    private String content;
+    private String htmlContent;
+    private String attachmentId;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getExamTaskId() {
+        return examTaskId;
+    }
+
+    public void setExamTaskId(String examTaskId) {
+        this.examTaskId = examTaskId;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public MakeMethodEnum getMakeMethod() {
+        return makeMethod;
+    }
+
+    public void setMakeMethod(MakeMethodEnum makeMethod) {
+        this.makeMethod = makeMethod;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getHtmlContent() {
+        return htmlContent;
+    }
+
+    public void setHtmlContent(String htmlContent) {
+        this.htmlContent = htmlContent;
+    }
+
+    public String getAttachmentId() {
+        return attachmentId;
+    }
+
+    public void setAttachmentId(String attachmentId) {
+        this.attachmentId = attachmentId;
+    }
+}

+ 16 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamCard.java

@@ -5,6 +5,7 @@ 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.base.BaseEntity;
+import com.qmth.distributed.print.business.enums.MakeMethodEnum;
 
 import java.io.Serializable;
 
@@ -42,7 +43,12 @@ public class ExamCard extends BaseEntity implements Serializable {
      * 题卡制作方式:SELECT-选择已有题卡,SELF-自助创建,CUST-客户制卡
      */
     @TableField("make_method")
-    private String makeMethod;
+    private MakeMethodEnum makeMethod;
+
+    /**
+     * STAGE-暂存,SUBMIT-提交
+     */
+    private String status;
 
     public Long getSchoolId() {
         return schoolId;
@@ -76,12 +82,19 @@ public class ExamCard extends BaseEntity implements Serializable {
         this.title = title;
     }
 
-    public String getMakeMethod() {
+    public MakeMethodEnum getMakeMethod() {
         return makeMethod;
     }
 
-    public void setMakeMethod(String makeMethod) {
+    public void setMakeMethod(MakeMethodEnum makeMethod) {
         this.makeMethod = makeMethod;
     }
 
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
 }

+ 1 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/EnumType.java

@@ -21,6 +21,7 @@ public enum EnumType {
     TEMPLATE_TYPE("模板类型"),
     CARD_REQUIRED_FIELDS("题卡规则必选字段"),
     ORG_CENTER_TYPE_ENUM("机构用户中心类型"),
+    MAKE_METHOD("题卡制作方式"),
     PRINT_PLAN_STATUS_ENUM("印刷计划状态类型");
 
     EnumType(String desc) {

+ 44 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/MakeMethodEnum.java

@@ -0,0 +1,44 @@
+package com.qmth.distributed.print.business.enums;
+
+import com.qmth.distributed.print.business.enums.result.EnumResult;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 题卡制作方式
+ * @Date: 2021/3/23.
+ */
+public enum MakeMethodEnum {
+
+    SELECT("选择已有题卡"),
+    SELF("自助创建"),
+    CUST("客户制卡");
+
+    MakeMethodEnum(String desc) {
+        this.desc = desc;
+    }
+
+    private String desc;
+
+    public String getDesc() {
+        return desc;
+    }
+
+    /**
+     * @return
+     */
+    public static List<EnumResult> listTypes() {
+        List<EnumResult> list = new ArrayList<EnumResult>();
+        for (MakeMethodEnum value : MakeMethodEnum.values()) {
+            EnumResult result = new EnumResult();
+            result.setName(value.name());
+            result.setOrdinal(value.ordinal());
+            result.setCode(null);
+            result.setDesc(value.getDesc());
+            list.add(result);
+        }
+        return list;
+    }
+
+}

+ 4 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamTaskMapper.java

@@ -3,10 +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.BlurryUserDto;
-import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto;
-import com.qmth.distributed.print.business.bean.dto.ExamTaskDto;
-import com.qmth.distributed.print.business.bean.dto.RelatePaperDto;
+import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.entity.ExamTask;
 import org.apache.ibatis.annotations.Param;
 
@@ -32,7 +29,9 @@ public interface ExamTaskMapper extends BaseMapper<ExamTask> {
 
     IPage<ExamTaskDto> listTaskReviewAudited(Page<ExamTaskDto> page, @Param("schoolId") Long schoolId, @Param("reviewStatus") String reviewStatus, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("userId") Long userId, @Param("cardRuleId") Long cardRuleId, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
 
-    IPage<ExamTaskDetailDto> listTaskPaper(Page<ExamTaskDetailDto> page, Long schoolId, String courseCode, String paperNumber, Long startTime, Long endTime);
+    IPage<ExamTaskDetailDto> listTaskPaper(Page<ExamTaskDetailDto> page, @Param("schoolId") Long schoolId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
 
     List<RelatePaperDto> listPaperNumbers(@Param("schoolId") Long schoolId, @Param("courseCode") String courseCode);
+
+    ExamTaskDetailCardDto applyGetOne(Long examTaskId);
 }

+ 1 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamCardDetailService.java

@@ -13,4 +13,5 @@ import com.qmth.distributed.print.business.entity.ExamCardDetail;
  */
 public interface ExamCardDetailService extends IService<ExamCardDetail> {
 
+    ExamCardDetail getByCardId(Long cardId);
 }

+ 3 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamCardService.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.params.ExamCardParams;
 import com.qmth.distributed.print.business.bean.result.WorkResult;
 import com.qmth.distributed.print.business.entity.ExamCard;
 import com.qmth.distributed.print.business.enums.ExamStatusEnum;
@@ -39,4 +40,6 @@ public interface ExamCardService extends IService<ExamCard> {
      * @return
      */
     IPage<WorkResult> queryByMyWorkSubmit(IPage<Map> iPage, Long userId, Long schoolId, ExamStatusEnum status);
+
+    String saveExamCard(ExamCardParams examCardParams);
 }

+ 8 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamTaskDetailService.java

@@ -3,8 +3,10 @@ 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.ExamTaskDetailDto;
+import com.qmth.distributed.print.business.bean.params.ExamCardParams;
 import com.qmth.distributed.print.business.entity.ExamTaskDetail;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -22,4 +24,10 @@ public interface ExamTaskDetailService extends IService<ExamTaskDetail> {
     boolean updatePaper(Map<String, String> map);
 
     IPage<ExamTaskDetailDto> list(Long schoolId, String relateType, Long printPlanId, String courseCode, String paperNumber, Integer pageNumber, Integer pageSize);
+
+    List<ExamTaskDetail> listByCardId(Long cardId);
+
+    void bindCardId(String examTaskId, Long cardId);
+
+    void resetCardId(Long id);
 }

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

@@ -57,5 +57,5 @@ public interface ExamTaskService extends IService<ExamTask> {
 
     boolean status(ExamTask examTask);
 
-    ExamTaskDetail applyGetOne(Long examTaskId);
+    ExamTaskDetailCardDto applyGetOne(Long examTaskId);
 }

+ 9 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamCardDetailServiceImpl.java

@@ -1,11 +1,14 @@
 package com.qmth.distributed.print.business.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.distributed.print.business.entity.ExamCardDetail;
 import com.qmth.distributed.print.business.mapper.ExamCardDetailMapper;
 import com.qmth.distributed.print.business.service.ExamCardDetailService;
 import org.springframework.stereotype.Service;
 
+import javax.management.Query;
+
 /**
  * <p>
  * 题卡详情 服务实现类
@@ -17,4 +20,10 @@ import org.springframework.stereotype.Service;
 @Service
 public class ExamCardDetailServiceImpl extends ServiceImpl<ExamCardDetailMapper, ExamCardDetail> implements ExamCardDetailService {
 
+    @Override
+    public ExamCardDetail getByCardId(Long cardId) {
+        QueryWrapper<ExamCardDetail> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ExamCardDetail::getCardId, cardId);
+        return this.getOne(queryWrapper);
+    }
 }

+ 147 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamCardServiceImpl.java

@@ -2,14 +2,26 @@ package com.qmth.distributed.print.business.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.distributed.print.business.bean.params.ExamCardParams;
 import com.qmth.distributed.print.business.bean.result.WorkResult;
-import com.qmth.distributed.print.business.entity.ExamCard;
+import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.ExamStatusEnum;
+import com.qmth.distributed.print.business.enums.MakeMethodEnum;
 import com.qmth.distributed.print.business.mapper.ExamCardMapper;
+import com.qmth.distributed.print.business.service.BasicExamRuleService;
+import com.qmth.distributed.print.business.service.ExamCardDetailService;
 import com.qmth.distributed.print.business.service.ExamCardService;
+import com.qmth.distributed.print.business.service.ExamTaskDetailService;
+import com.qmth.distributed.print.business.util.ServletUtil;
+import com.qmth.distributed.print.common.contant.SystemConstant;
+import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
@@ -27,6 +39,15 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
     @Resource
     ExamCardMapper examCardMapper;
 
+    @Autowired
+    private BasicExamRuleService basicExamRuleService;
+
+    @Autowired
+    private ExamCardDetailService examCardDetailService;
+
+    @Autowired
+    private ExamTaskDetailService examTaskDetailService;
+
     /**
      * 查询我的工作台
      *
@@ -54,4 +75,129 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
     public IPage<WorkResult> queryByMyWorkSubmit(IPage<Map> iPage, Long userId, Long schoolId, ExamStatusEnum status) {
         return examCardMapper.queryByMyWorkSubmit(iPage, userId, schoolId, Objects.nonNull(status) ? status.name() : null);
     }
+
+    @Transactional
+    @Override
+    public String saveExamCard(ExamCardParams examCardParams) {
+        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        SysUser user = (SysUser) ServletUtil.getRequestUser();
+
+        validateCardData(examCardParams, schoolId);
+
+        // 新增
+        ExamCard examCard = null;
+        ExamCardDetail examCardDetail = null;
+        if (examCardParams.getId() == null) {
+            examCard = new ExamCard();
+            examCard.setId(SystemConstant.getDbUuid());
+            examCard.setSchoolId(schoolId);
+            examCard.setCourseCode(examCardParams.getCourseCode());
+            examCard.setCourseName(examCardParams.getCourseName());
+            examCard.setTitle(examCardParams.getTitle());
+            examCard.setMakeMethod(examCardParams.getMakeMethod());
+            examCard.setStatus(examCardParams.getStatus());
+            examCard.setCreateId(user.getId());
+            examCard.setCreateTime(System.currentTimeMillis());
+            this.save(examCard);
+
+            examCardDetail = new ExamCardDetail();
+            examCardDetail.setId(SystemConstant.getDbUuid());
+            examCardDetail.setCardId(examCard.getId());
+            examCardDetail.setContent(examCardParams.getContent());
+            examCardDetail.setHtmlContent(examCardParams.getHtmlContent());
+            examCardDetail.setAttachmentId(examCardParams.getAttachmentId());
+            examCardDetail.setCreateId(user.getId());
+            examCardDetail.setCreateTime(System.currentTimeMillis());
+            examCardDetailService.save(examCardDetail);
+        }
+        // 修改
+        else {
+            examCard = this.getById(examCardParams.getId());
+            examCard.setTitle(examCardParams.getTitle());
+            if (!examCardParams.getCourseCode().equals(examCard.getCourseCode())) {
+                throw ExceptionResultEnum.ERROR.exception("课程不能更改");
+            }
+            if (!examCardParams.getMakeMethod().name().equals(examCard.getMakeMethod().name())) {
+                throw ExceptionResultEnum.ERROR.exception("题卡制作方式不能更改");
+            }
+            examCard.setUpdateId(user.getId());
+            examCard.setUpdateTime(System.currentTimeMillis());
+            this.updateById(examCard);
+
+            examCardDetail = examCardDetailService.getByCardId(examCardParams.getId());
+            if (examCardDetail == null) {
+                throw ExceptionResultEnum.ERROR.exception("题卡数据有误");
+            }
+            examCardDetail.setContent(examCardParams.getContent());
+            examCardDetail.setHtmlContent(examCardParams.getHtmlContent());
+            examCardDetail.setAttachmentId(examCardParams.getAttachmentId());
+            examCardDetail.setUpdateId(user.getId());
+            examCardDetail.setUpdateTime(System.currentTimeMillis());
+            examCardDetailService.updateById(examCardDetail);
+
+        }
+
+        // 绑定命题任务
+        examTaskDetailService.bindCardId(examCardParams.getExamTaskId(), examCard.getId());
+        return String.valueOf(examCard.getId());
+    }
+
+    /**
+     * 数据验证
+     *
+     * @param examCardParams
+     */
+    private void validateCardData(ExamCardParams examCardParams, Long schoolId) {
+        BasicExamRule basicExamRule = basicExamRuleService.getBySchoolId(schoolId);
+        if (basicExamRule == null) {
+            throw ExceptionResultEnum.ERROR.exception("通用规则未设置");
+        }
+
+        if (StringUtils.isBlank(examCardParams.getMakeMethod().name())) {
+            throw ExceptionResultEnum.ERROR.exception("题卡制作方式不能为空");
+        }
+        if (!basicExamRule.getCustomCard() && MakeMethodEnum.CUST.name().equals(examCardParams.getMakeMethod().name())) {
+            throw ExceptionResultEnum.ERROR.exception("未启用客服制卡,不能选择该方式制作题卡");
+        }
+        if (StringUtils.isBlank(examCardParams.getStatus())) {
+            throw ExceptionResultEnum.ERROR.exception("提交方式不能为空");
+        }
+        if (examCardParams.getExamTaskId() == null) {
+            throw ExceptionResultEnum.ERROR.exception("命题任务ID不能为空");
+        }
+        if (StringUtils.isBlank(examCardParams.getCourseCode())) {
+            throw ExceptionResultEnum.ERROR.exception("课程代码不能为空");
+        }
+        if (StringUtils.isBlank(examCardParams.getCourseName())) {
+            throw ExceptionResultEnum.ERROR.exception("课程名称不能为空");
+        }
+
+        if (MakeMethodEnum.SELECT.name().equals(examCardParams.getMakeMethod().name())) {
+            if (examCardParams.getId() == null) {
+                throw ExceptionResultEnum.ERROR.exception("选择已有题卡时,题卡ID不能为空");
+            }
+            // 当前选择题卡是否已绑定
+            List<ExamTaskDetail> list = examTaskDetailService.listByCardId(examCardParams.getId());
+            if (list != null && list.size() > 0) {
+                throw ExceptionResultEnum.ERROR.exception("选择的题卡已被其它命题任务绑定");
+            }
+
+        } else if (MakeMethodEnum.SELF.name().equals(examCardParams.getMakeMethod().name())) {
+            if (StringUtils.isBlank(examCardParams.getTitle())) {
+                throw ExceptionResultEnum.ERROR.exception("题卡标题不能为空");
+            }
+            if (StringUtils.isBlank(examCardParams.getContent())) {
+                throw ExceptionResultEnum.ERROR.exception("题卡内容不能为空");
+            }
+            if ("SUBMIT".equals(examCardParams.getStatus())) {
+                if (StringUtils.isBlank(examCardParams.getHtmlContent())) {
+                    throw ExceptionResultEnum.ERROR.exception("提交题卡时,html内容不能为空");
+                }
+            }
+        } else if (MakeMethodEnum.CUST.name().equals(examCardParams.getMakeMethod().name())) {
+            if (StringUtils.isBlank(examCardParams.getAttachmentId())) {
+                throw ExceptionResultEnum.ERROR.exception("客户制卡时,附件未上传");
+            }
+        }
+    }
 }

+ 24 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java

@@ -1,10 +1,12 @@
 package com.qmth.distributed.print.business.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto;
+import com.qmth.distributed.print.business.bean.params.ExamCardParams;
 import com.qmth.distributed.print.business.entity.ExamTask;
 import com.qmth.distributed.print.business.entity.ExamTaskDetail;
 import com.qmth.distributed.print.business.mapper.ExamTaskDetailMapper;
@@ -14,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -61,4 +64,25 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         return examDetailDtoIPage;
     }
 
+    @Override
+    public List<ExamTaskDetail> listByCardId(Long cardId) {
+        QueryWrapper<ExamTaskDetail> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ExamTaskDetail::getCardId, cardId);
+        return this.list(queryWrapper);
+    }
+
+    @Override
+    public void bindCardId(String examTaskId, Long cardId) {
+        UpdateWrapper<ExamTaskDetail> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.lambda().set(ExamTaskDetail::getCardId, cardId).eq(ExamTaskDetail::getExamTaskId, examTaskId);
+        this.update(updateWrapper);
+    }
+
+    @Override
+    public void resetCardId(Long id) {
+        UpdateWrapper<ExamTaskDetail> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.lambda().set(ExamTaskDetail::getEnable, null).eq(ExamTaskDetail::getExamTaskId, id);
+        this.update(updateWrapper);
+    }
+
 }

+ 14 - 8
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -108,6 +108,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         return this.update(updateWrapper);
     }
 
+    @Transactional
     @Override
     public boolean enable(ExamTask examTask) {
         if (examTask.getId() == null) {
@@ -120,6 +121,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         }
         UpdateWrapper<ExamTask> updateWrapper = new UpdateWrapper<>();
         updateWrapper.lambda().set(ExamTask::getEnable, examTask.getEnable()).eq(ExamTask::getId, examTask.getId());
+
+        // 解除题卡绑定
+        if(task.getEnable()){
+            examTaskDetailService.resetCardId(examTask.getId());
+        }
         return this.update(updateWrapper);
     }
 
@@ -298,8 +304,9 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             examTask.setStatus(ExamStatusEnum.FINISH);
         }
 
-        examTask.setStatus(ExamStatusEnum.valueOf(examTaskDetail.getOperateType()));
-        this.updateById(examTask);
+        UpdateWrapper<ExamTask> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.lambda().set(ExamTask::getStatus, ExamStatusEnum.valueOf(examTaskDetail.getOperateType())).set(ExamTask::getReviewStatus, null).eq(ExamTask::getId, examTask.getId());
+        this.update(updateWrapper);
 
         QueryWrapper<ExamTaskDetail> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTaskDetail.getExamTaskId());
@@ -320,9 +327,9 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         UpdateWrapper<ExamTask> updateWrapper = new UpdateWrapper<>();
         // 撤回
         if (examTask.getStatus().name().equals(ExamStatusEnum.CANCEL.name())) {
-            if (!task.getStatus().name().equals(ExamStatusEnum.FINISH.name())) {
+            /*if (!task.getStatus().name().equals(ExamStatusEnum.FINISH.name())) {
                 throw ExceptionResultEnum.ERROR.exception("命题任务状态为已完成,才能撤回");
-            }
+            }*/
             updateWrapper.lambda().set(ExamTask::getStatus, examTask.getStatus()).eq(ExamTask::getId, examTask.getId());
             return this.update(updateWrapper);
         }
@@ -330,9 +337,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
     }
 
     @Override
-    public ExamTaskDetail applyGetOne(Long examTaskId) {
-        QueryWrapper<ExamTaskDetail> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(ExamTaskDetail::getExamTaskId, examTaskId);
-        return examTaskDetailService.getOne(queryWrapper);
+    public ExamTaskDetailCardDto applyGetOne(Long examTaskId) {
+        ExamTaskDetailCardDto examTaskDetailDto = this.baseMapper.applyGetOne(examTaskId);
+        return examTaskDetailDto;
     }
 }

+ 12 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/ServletUtil.java

@@ -146,6 +146,18 @@ public class ServletUtil {
         return object;
     }
 
+    /**
+     * 获取header中schoolId
+     * @return
+     */
+    public static Object getRequestHeaderSchoolId() {
+        Object object = getRequest().getHeader(SystemConstant.SCHOOL_ID);
+        if (Objects.isNull(object)) {
+            throw ExceptionResultEnum.NOT_LOGIN.exception();
+        }
+        return object;
+    }
+
     /**
      * 获取请求的学校
      *

+ 43 - 5
distributed-print-business/src/main/resources/mapper/ExamTaskMapper.xml

@@ -82,7 +82,7 @@
     </select>
     <select id="listUser" resultType="com.qmth.distributed.print.business.bean.dto.BlurryUserDto">
         SELECT
-            a.user_id id, b.real_name name
+           distinct a.user_id id, b.real_name name
         FROM
             exam_task a
                 LEFT JOIN
@@ -177,7 +177,17 @@
             a.end_time endTime,
             a.enable,
             a.create_id createId,
-            a.create_time createTime
+            a.create_time createTime,
+            a.status,
+            CASE
+                WHEN a.review = 1 AND a.status = 'SUBMIT' THEN 'NOT_AUDITED'
+                WHEN a.review = 1 AND a.status IN ('STAGE', 'FINISH') AND  a.review_status IS NOT NULL THEN 'AUDITED'
+                ELSE ''
+            END auditStatus,
+            CASE
+                WHEN a.review_status IS NULL THEN ''
+                ELSE a.review_status
+            END reviewStatus
         FROM
             exam_task a
         LEFT JOIN
@@ -185,7 +195,7 @@
         LEFT JOIN
             sys_user c ON a.user_id = c.id
         <where>
-            a.review = true and a.review_status is null
+            a.review = true and a.status = 'SUBMIT' and a.review_status is null
             <if test="schoolId != null and schoolId != ''">
                 and a.school_id = #{schoolId}
             </if>
@@ -226,7 +236,17 @@
             a.review_status reviewStatus,
             a.enable,
             a.create_id createId,
-            a.create_time createTime
+            a.create_time createTime,
+            a.status,
+            CASE
+                WHEN a.review = 1 AND a.status = 'SUBMIT' THEN 'NOT_AUDITED'
+                WHEN a.review = 1 AND a.status IN ('STAGE', 'FINISH') AND  a.review_status IS NOT NULL THEN 'AUDITED'
+                ELSE ''
+            END auditStatus,
+            CASE
+                WHEN a.review_status IS NULL THEN ''
+                ELSE a.review_status
+            END reviewStatus,
         FROM
             exam_task a
         LEFT JOIN
@@ -234,7 +254,7 @@
         LEFT JOIN
             sys_user c ON a.user_id = c.id
         <where>
-            a.review = true and a.review_status is not null
+            a.review = true and a.status in ('STAGE','FINISH') and a.review_status is not null
             <if test="schoolId != null and schoolId != ''">
                 and a.school_id = #{schoolId}
             </if>
@@ -276,6 +296,7 @@
             a.create_id createId,
             a.create_time createTime,
             b.enable,
+            b.paper_type paperType,
             b.exposed_paper_type exposedPaperType,
             b.unexposed_paper_type unexposedPaperType
         FROM
@@ -285,6 +306,7 @@
                 LEFT JOIN
             sys_user c ON a.user_id = c.id
         <where>
+            a.status = 'FINISH'
             <if test="schoolId != null and schoolId != ''">
                 and a.school_id = #{schoolId}
             </if>
@@ -315,5 +337,21 @@
             school_id = #{schoolId} and course_code = #{courseCode}
         </where>
     </select>
+    <select id="applyGetOne" resultType="com.qmth.distributed.print.business.bean.dto.ExamTaskDetailCardDto">
+        SELECT
+            a.exam_task_id examTaskId,
+            a.paper_type paperType,
+            a.paper_attachment_ids paperAttachmentIds,
+            a.card_id cardId,
+            a.paper_confirm_attachment_ids paperConfirmAttachmentIds,
+            a.remark,
+            b.make_method makeMethod,
+            b.status
+        FROM
+            exam_task_detail a
+                LEFT JOIN
+            exam_card b ON a.card_id = b.id
+        where a.exam_task_id = #{examTaskId}
+    </select>
 
 </mapper>

+ 1 - 0
distributed-print-common/src/main/java/com/qmth/distributed/print/common/contant/SystemConstant.java

@@ -31,6 +31,7 @@ public class SystemConstant {
     public static final String SESSION = "session:";
     public static final String TASK = "task";
     public static final String USER = "account";
+    public static final String SCHOOL_ID = "schoolId";
     public static final String SCHOOL = "school";
     public static final String ORG = "org";
     public static final String ERROR = "/error";

+ 3 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/BasicExamRuleController.java

@@ -8,6 +8,7 @@ import com.qmth.distributed.print.business.bean.ApiUser;
 import com.qmth.distributed.print.business.entity.BasicExamRule;
 import com.qmth.distributed.print.business.service.BasicExamRuleService;
 import com.qmth.distributed.print.business.util.RequestUtils;
+import com.qmth.distributed.print.business.util.ServletUtil;
 import com.qmth.distributed.print.common.util.Result;
 import com.qmth.distributed.print.common.util.ResultUtil;
 import io.swagger.annotations.Api;
@@ -47,8 +48,8 @@ public class BasicExamRuleController {
     @ApiOperation(value = "查询")
     @RequestMapping(value = "/list", method = RequestMethod.POST)
     public Result list(HttpServletRequest request) {
-        ApiUser apiUser = RequestUtils.getApiUser(request);
-        BasicExamRule examRule = basicExamRuleService.getBySchoolId(apiUser.getSchoolId());
+        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        BasicExamRule examRule = basicExamRuleService.getBySchoolId(schoolId);
         return ResultUtil.ok(examRule);
     }
 

+ 3 - 0
distributed-print/src/main/java/com/qmth/distributed/print/api/EnumsController.java

@@ -92,6 +92,9 @@ public class EnumsController {
         } else if (type.equals(EnumType.PRINT_PLAN_STATUS_ENUM.name())){
             //印刷计划状态
             list = PrintPlanStatusEnum.listTypes();
+        } else if (type.equals(EnumType.MAKE_METHOD.name())){
+            // 题卡制作方式
+            list = MakeMethodEnum.listTypes();
         }
         return ResultUtil.ok(list);
     }

+ 37 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamCardController.java

@@ -1,10 +1,26 @@
 package com.qmth.distributed.print.api;
 
 
+import com.qmth.boot.api.annotation.Aac;
+import com.qmth.boot.api.annotation.BOOL;
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.distributed.print.business.bean.ApiUser;
+import com.qmth.distributed.print.business.bean.params.ExamCardParams;
+import com.qmth.distributed.print.business.service.ExamCardService;
+import com.qmth.distributed.print.business.util.RequestUtils;
+import com.qmth.distributed.print.common.util.Result;
+import com.qmth.distributed.print.common.util.ResultUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
  * <p>
  * 题卡 前端控制器
@@ -13,9 +29,29 @@ import org.springframework.web.bind.annotation.RestController;
  * @author xf
  * @since 2021-03-23
  */
+@Api(tags = "题卡Controller")
 @RestController
-@RequestMapping("/examCard")
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/${prefix.url.exam}/card")
+@Aac(auth = BOOL.FALSE)
 public class ExamCardController {
 
+    @Autowired
+    private ExamCardService examCardService;
+
+    /**
+     * 新建
+     *
+     * @param request
+     * @param examCardParams
+     * @return
+     */
+    @ApiOperation(value = "新建")
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public Result save(HttpServletRequest request, @RequestBody ExamCardParams examCardParams) {
+        ApiUser apiUser = RequestUtils.getApiUser(request);
+        String cardId = examCardService.saveExamCard(examCardParams);
+        return ResultUtil.ok(cardId, "");
+    }
+
 }
 

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

@@ -239,6 +239,7 @@ public class ExamTaskController {
 
     /**
      * 根据命题任务ID查询单个数据
+     *
      * @param request
      * @param examTaskId
      * @return
@@ -247,7 +248,7 @@ public class ExamTaskController {
     @RequestMapping(value = "/apply_get_one", method = RequestMethod.POST)
     public Result applyGetOne(HttpServletRequest request,
                               @RequestParam(value = "examTaskId", required = true) Long examTaskId) {
-        ExamTaskDetail detail = examTaskService.applyGetOne(examTaskId);
+        ExamTaskDetailCardDto detail = examTaskService.applyGetOne(examTaskId);
         return ResultUtil.ok(detail);
     }