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.mapper.WfCopyMapper;
|
||||||
import com.ruoyi.workflow.service.IWfCopyService;
|
import com.ruoyi.workflow.service.IWfCopyService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.flowable.engine.RuntimeService;
|
import org.flowable.engine.HistoryService;
|
||||||
import org.flowable.engine.runtime.ProcessInstance;
|
import org.flowable.engine.history.HistoricProcessInstance;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -34,7 +34,7 @@ public class WfCopyServiceImpl implements IWfCopyService {
|
|||||||
|
|
||||||
private final WfCopyMapper baseMapper;
|
private final WfCopyMapper baseMapper;
|
||||||
|
|
||||||
private final RuntimeService runtimeService;
|
private final HistoryService historyService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询流程抄送
|
* 查询流程抄送
|
||||||
@@ -88,20 +88,20 @@ public class WfCopyServiceImpl implements IWfCopyService {
|
|||||||
// 若抄送用户为空,则不需要处理,返回成功
|
// 若抄送用户为空,则不需要处理,返回成功
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
|
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
|
||||||
.processInstanceId(taskBo.getInstanceId()).singleResult();
|
.processInstanceId(taskBo.getInstanceId()).singleResult();
|
||||||
String[] ids = taskBo.getCopyUserIds().split(",");
|
String[] ids = taskBo.getCopyUserIds().split(",");
|
||||||
List<WfCopy> copyList = new ArrayList<>(ids.length);
|
List<WfCopy> copyList = new ArrayList<>(ids.length);
|
||||||
Long originatorId = LoginHelper.getUserId();
|
Long originatorId = LoginHelper.getUserId();
|
||||||
String originatorName = LoginHelper.getNickName();
|
String originatorName = LoginHelper.getNickName();
|
||||||
String title = processInstance.getProcessDefinitionName() + "-" + taskBo.getTaskName();
|
String title = historicProcessInstance.getProcessDefinitionName() + "-" + taskBo.getTaskName();
|
||||||
for (String id : ids) {
|
for (String id : ids) {
|
||||||
Long userId = Long.valueOf(id);
|
Long userId = Long.valueOf(id);
|
||||||
WfCopy copy = new WfCopy();
|
WfCopy copy = new WfCopy();
|
||||||
copy.setTitle(title);
|
copy.setTitle(title);
|
||||||
copy.setProcessId(processInstance.getProcessDefinitionId());
|
copy.setProcessId(historicProcessInstance.getProcessDefinitionId());
|
||||||
copy.setProcessName(processInstance.getProcessDefinitionName());
|
copy.setProcessName(historicProcessInstance.getProcessDefinitionName());
|
||||||
copy.setDeploymentId(processInstance.getDeploymentId());
|
copy.setDeploymentId(historicProcessInstance.getDeploymentId());
|
||||||
copy.setInstanceId(taskBo.getInstanceId());
|
copy.setInstanceId(taskBo.getInstanceId());
|
||||||
copy.setTaskId(taskBo.getTaskId());
|
copy.setTaskId(taskBo.getTaskId());
|
||||||
copy.setUserId(userId);
|
copy.setUserId(userId);
|
||||||
|
|||||||
@@ -408,6 +408,13 @@ export default {
|
|||||||
let userObj = this.userMultipleSelection.find(item => item.userId === tag.id);
|
let userObj = this.userMultipleSelection.find(item => item.userId === tag.id);
|
||||||
this.userMultipleSelection.splice(this.userMultipleSelection.indexOf(userObj), 1);
|
this.userMultipleSelection.splice(this.userMultipleSelection.indexOf(userObj), 1);
|
||||||
this.userData.copyUser.splice(this.userData.copyUser.indexOf(tag), 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) {
|
handleCheckChange(val) {
|
||||||
@@ -574,13 +581,6 @@ export default {
|
|||||||
this.$modal.msgError("请选择用户");
|
this.$modal.msgError("请选择用户");
|
||||||
return false;
|
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;
|
this.taskForm.userId = this.currentUserId;
|
||||||
if (type === 'delegate') {
|
if (type === 'delegate') {
|
||||||
delegate(this.taskForm).then(res => {
|
delegate(this.taskForm).then(res => {
|
||||||
|
|||||||
Reference in New Issue
Block a user