Browse Source

3.2.1-更改命题老师后提交任务报错bug修复

xiaof 2 years ago
parent
commit
2fd8590a95

+ 2 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TFFlowJoinService.java

@@ -46,4 +46,6 @@ public interface TFFlowJoinService extends IService<TFFlowJoin> {
      * @return
      */
     public List<TFFlowJoin> findByFlowEntityId(Long flowEntityId);
+
+    void deleteByObjectIdAndFlowId(Long objectId, Long flowId);
 }

+ 3 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -291,6 +291,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         return this.baseMapper.listUser(schoolId, SystemConstant.translateSpecificSign(param), orgIds);
     }
 
+    @Transactional
     @Override
     public Boolean assignUser(ExamTask examTask) {
         if (examTask.getId() == null) {
@@ -340,7 +341,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                     map = activitiService.customFlowStart(map);
                     flowId = SystemConstant.convertIdToLong((String) map.get(SystemConstant.FLOW_ID));
                     map.computeIfAbsent(SystemConstant.FLOW_JOIN_TYPE, v -> FlowJoinTypeEnum.NEW);
-                    map.put(SystemConstant.FLOW_ID, String.valueOf(flowId));
+
+                    tfFlowJoinService.deleteByObjectIdAndFlowId(examTask.getId(), task.getFlowId());
                     tfFlowJoinService.saveOrUpdate(map);
                 } else {
                     flowId = task.getFlowId();

+ 11 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TFFlowJoinServiceImpl.java

@@ -1,6 +1,7 @@
 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.extension.service.impl.ServiceImpl;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.distributed.print.business.entity.TFFlowJoin;
@@ -118,4 +119,14 @@ public class TFFlowJoinServiceImpl extends ServiceImpl<TFFlowJoinMapper, TFFlowJ
     public List<TFFlowJoin> findByFlowEntityId(Long flowEntityId) {
         return this.list(new QueryWrapper<TFFlowJoin>().lambda().eq(TFFlowJoin::getFlowEntityId, flowEntityId));
     }
+
+    @Override
+    public void deleteByObjectIdAndFlowId(Long objectId, Long flowId) {
+        UpdateWrapper<TFFlowJoin> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.lambda().eq(TFFlowJoin::getObjectId, objectId);
+        if (flowId != null) {
+            updateWrapper.lambda().eq(TFFlowJoin::getFlowId, flowId);
+        }
+        this.remove(updateWrapper);
+    }
 }

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

@@ -295,7 +295,7 @@
         left join t_f_flow_join tffj on
         tffj.flow_id = art.PROC_INST_ID_
         left join exam_task a on
-            a.id = tffj.object_id and a.flow_id = tffj.flow_id
+            a.id = tffj.object_id
         left join act_ru_identitylink ari on
             ari.TASK_ID_ = art.ID_
         LEFT JOIN