fix -- 修复抄送人获取流程实例NPL和无法删除抄送人标签问题。
This commit is contained in:
@@ -14,8 +14,8 @@ import com.ruoyi.workflow.domain.vo.WfCopyVo;
|
||||
import com.ruoyi.workflow.mapper.WfCopyMapper;
|
||||
import com.ruoyi.workflow.service.IWfCopyService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.engine.HistoryService;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -34,7 +34,7 @@ public class WfCopyServiceImpl implements IWfCopyService {
|
||||
|
||||
private final WfCopyMapper baseMapper;
|
||||
|
||||
private final RuntimeService runtimeService;
|
||||
private final HistoryService historyService;
|
||||
|
||||
/**
|
||||
* 查询流程抄送
|
||||
@@ -88,20 +88,20 @@ public class WfCopyServiceImpl implements IWfCopyService {
|
||||
// 若抄送用户为空,则不需要处理,返回成功
|
||||
return true;
|
||||
}
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
|
||||
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(taskBo.getInstanceId()).singleResult();
|
||||
String[] ids = taskBo.getCopyUserIds().split(",");
|
||||
List<WfCopy> copyList = new ArrayList<>(ids.length);
|
||||
Long originatorId = LoginHelper.getUserId();
|
||||
String originatorName = LoginHelper.getNickName();
|
||||
String title = processInstance.getProcessDefinitionName() + "-" + taskBo.getTaskName();
|
||||
String title = historicProcessInstance.getProcessDefinitionName() + "-" + taskBo.getTaskName();
|
||||
for (String id : ids) {
|
||||
Long userId = Long.valueOf(id);
|
||||
WfCopy copy = new WfCopy();
|
||||
copy.setTitle(title);
|
||||
copy.setProcessId(processInstance.getProcessDefinitionId());
|
||||
copy.setProcessName(processInstance.getProcessDefinitionName());
|
||||
copy.setDeploymentId(processInstance.getDeploymentId());
|
||||
copy.setProcessId(historicProcessInstance.getProcessDefinitionId());
|
||||
copy.setProcessName(historicProcessInstance.getProcessDefinitionName());
|
||||
copy.setDeploymentId(historicProcessInstance.getDeploymentId());
|
||||
copy.setInstanceId(taskBo.getInstanceId());
|
||||
copy.setTaskId(taskBo.getTaskId());
|
||||
copy.setUserId(userId);
|
||||
|
||||
@@ -408,6 +408,13 @@ export default {
|
||||
let userObj = this.userMultipleSelection.find(item => item.userId === tag.id);
|
||||
this.userMultipleSelection.splice(this.userMultipleSelection.indexOf(userObj), 1);
|
||||
this.userData.copyUser.splice(this.userData.copyUser.indexOf(tag), 1);
|
||||
// 设置抄送人ID
|
||||
if (this.userData.copyUser && this.userData.copyUser.length > 0) {
|
||||
const val = this.userData.copyUser.map(item => item.id);
|
||||
this.taskForm.copyUserIds = val instanceof Array ? val.join(',') : val;
|
||||
} else {
|
||||
this.taskForm.copyUserIds = '';
|
||||
}
|
||||
},
|
||||
/** 流程变量赋值 */
|
||||
handleCheckChange(val) {
|
||||
@@ -574,13 +581,6 @@ export default {
|
||||
this.$modal.msgError("请选择用户");
|
||||
return false;
|
||||
}
|
||||
// 若有选择抄送用户,获取抄送用户ID
|
||||
if (this.userData.copyUser && this.userData.copyUser.length > 0) {
|
||||
const val = this.userData.copyUser.map(item => item.id);
|
||||
this.taskForm.copyUserIds = val instanceof Array ? val.join(',') : val;
|
||||
} else {
|
||||
this.taskForm.copyUserIds = '';
|
||||
}
|
||||
this.taskForm.userId = this.currentUserId;
|
||||
if (type === 'delegate') {
|
||||
delegate(this.taskForm).then(res => {
|
||||
|
||||
Reference in New Issue
Block a user