Bläddra i källkod

3.2.0-命题任务撤回、审核驳回清除命题任务题卡ID

xiaof 2 år sedan
förälder
incheckning
47a8436dc8

+ 23 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ActivitiServiceImpl.java

@@ -1,5 +1,7 @@
 package com.qmth.distributed.print.business.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.qmth.boot.api.exception.ApiException;
@@ -41,6 +43,7 @@ import org.activiti.engine.repository.Deployment;
 import org.activiti.engine.runtime.ProcessInstance;
 import org.activiti.engine.task.Task;
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -86,6 +89,9 @@ public class ActivitiServiceImpl implements ActivitiService {
     @Resource
     ExamTaskService examTaskService;
 
+    @Resource
+    ExamTaskDetailService examTaskDetailService;
+
     @Resource
     RedisUtil redisUtil;
 
@@ -773,6 +779,23 @@ public class ActivitiServiceImpl implements ActivitiService {
             rejectLinkMap.put(nextFlowTaskResult.getTaskKey(), currFlowTaskResult);
             tfFlowApprove.setRejectLink(JacksonUtil.parseJson(rejectLinkMap));
         }
+
+        // 驳回给命题任务发起人,需要清除绑定的题卡id
+        if (approvePass == FlowApprovePassEnum.REJECT && nextFlowTaskResult.getSetup() == 1) {
+            ExamTask examTask = examTaskService.findByFlowId(tfFlowLog.getFlowId());
+            ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTask.getId());
+            String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
+            if (StringUtils.isNotBlank(paperAttachmentIds)) {
+                List<JSONObject> objects = JSON.parseArray(paperAttachmentIds, JSONObject.class);
+                for (JSONObject object : objects) {
+                    object.put("cardId", "");
+                    object.put("cardType", "");
+                    object.put("cardTitle", "");
+                }
+                examTaskDetail.setPaperAttachmentIds(JSON.toJSONString(objects));
+                examTaskDetailService.updateById(examTaskDetail);
+            }
+        }
     }
 
     /**

+ 20 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -1,5 +1,6 @@
 package com.qmth.distributed.print.business.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -939,6 +940,20 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         map.computeIfAbsent(SystemConstant.APPROVE_REMARK, v -> sysUser.getRealName() + "(" + remark + ")" + FlowApprovePassEnum.CANCEL.getTitle());
         map.computeIfAbsent(SystemConstant.APPROVE_SETUP, v -> FlowApproveSetupEnum.SUBMIT.getSetup());
         activitiService.taskApprove(map);
+
+        // 清除cardId
+        ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTask.getId());
+        String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
+        if (StringUtils.isNotBlank(paperAttachmentIds)) {
+            List<JSONObject> objects = JSON.parseArray(paperAttachmentIds, JSONObject.class);
+            for (JSONObject object : objects) {
+                object.put("cardId", "");
+                object.put("cardType", "");
+                object.put("cardTitle", "");
+            }
+            examTaskDetail.setPaperAttachmentIds(JSON.toJSONString(objects));
+            examTaskDetailService.updateById(examTaskDetail);
+        }
         return true;
     }
 
@@ -1546,7 +1561,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 throw ExceptionResultEnum.ERROR.exception("未查到考试信息");
             }
 
-            BasicCourse basicCourse = basicCourseService.findByCourseCode(examTask.getCourseCode(),schoolId);
+            BasicCourse basicCourse = basicCourseService.findByCourseCode(examTask.getCourseCode(), schoolId);
 
             if (ExamModelEnum.MODEL1.equals(basicExam.getExamModel()) || ExamModelEnum.MODEL2.equals(basicExam.getExamModel())) {
                 // 创建印刷计划
@@ -1728,7 +1743,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         SysOrg schoolOrg = schoolOrgList.get(0);
         List<SysOrg> collegeList = orgList.stream().filter(e -> Objects.equals(schoolOrg.getId(), e.getParentId())).collect(Collectors.toList());
         SysOrg college = new SysOrg();
-        if (collegeList.size() == 1){
+        if (collegeList.size() == 1) {
             college = collegeList.get(0);
         }
 
@@ -1754,7 +1769,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         // ---- 组装Dto
         ExamTaskApprovalFormDto examTaskApprovalFormDto = new ExamTaskApprovalFormDto();
         BasicInfo basicInfo = new BasicInfo();
-        if (Objects.nonNull(college)){
+        if (Objects.nonNull(college)) {
             basicInfo.setCollegeId(college.getId());
             basicInfo.setCollegeName(college.getName());
         }
@@ -2046,7 +2061,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 throw ExceptionResultEnum.ERROR.exception("异常:考场对应多个考点");
             }
             String examPlace = null;
-            if (examPlaceList.size() > 0){
+            if (examPlaceList.size() > 0) {
                 examPlace = examPlaceList.get(0);
             }
 
@@ -2085,7 +2100,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
 
             ExamTaskExamStudentImportResult examTaskExamStudentImportResult = new ExamTaskExamStudentImportResult();
             examTaskExamStudentImportResult.setExamRoom(examRoom);
-            if (SystemConstant.strNotNull(examPlace)){
+            if (SystemConstant.strNotNull(examPlace)) {
                 examTaskExamStudentImportResult.setExamPlace(examPlace);
             }
             examTaskExamStudentImportResult.setExamTaskStudentObjectResultList(examTaskStudentObjectResultList);

+ 3 - 1
distributed-print-business/src/main/resources/mapper/ExamCardMapper.xml

@@ -136,8 +136,10 @@
                 1
             FROM
                 exam_task_detail b
+                    LEFT JOIN exam_task et on b.exam_task_id = et.id
+                    LEFT JOIN t_f_flow_approve e ON et.flow_id = e.flow_id
             WHERE
-                FIND_IN_SET(a.id, REPLACE(substring_index(substring_index(CONVERT((b.paper_attachment_ids ->>'$[*].cardId') USING utf8), ']', 1), '[',-1),'"','')))
+                e.status != 'CANCEL' and FIND_IN_SET(a.id, REPLACE(substring_index(substring_index(CONVERT((b.paper_attachment_ids ->>'$[*].cardId') USING utf8), ']', 1), '[',-1),'"','')))
         order by a.create_time desc
     </select>
     <select id="getCardDetailBySelect" resultType="com.qmth.distributed.print.business.bean.dto.CardDetailDto">