Merge branch 'main' of http://47.97.8.94:19527/yj/zn-cloud into aiKai
This commit is contained in:
commit
7672487d79
@ -14,10 +14,8 @@ import org.flowable.engine.delegate.DelegateExecution;
|
|||||||
import org.flowable.engine.runtime.ProcessInstance;
|
import org.flowable.engine.runtime.ProcessInstance;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.Assert;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -66,10 +64,12 @@ public class BpmTaskCurrentAssignLeaderScript extends BpmTaskAssignLeaderAbstrac
|
|||||||
}
|
}
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
Long parentId = dept.getParentId();
|
||||||
for (int i = 0; i < dept.getLevel(); i++) {
|
for (int i = 0; i < dept.getLevel(); i++) {
|
||||||
|
|
||||||
if (i == 0) { //第一次查找 判断审批人是否为发起人部门负责人
|
if (i == 0) { //第一次查找 判断审批人是否为发起人部门负责人
|
||||||
if (!dept.getLeaderUserId().toString().equals(assigneeUserId.toString())){ //如果发起人上级部门负责人不为当前审批人时
|
if (assigneeUserId.toString().equals(processInstance.getStartUserId())
|
||||||
|
&& !dept.getLeaderUserId().toString().equals(processInstance.getStartUserId())){ //如果发起人不是所在部门负责人时
|
||||||
|
|
||||||
count = 1;
|
count = 1;
|
||||||
break;
|
break;
|
||||||
@ -77,7 +77,7 @@ public class BpmTaskCurrentAssignLeaderScript extends BpmTaskAssignLeaderAbstrac
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获得发起人的上级部门
|
//获得发起人的上级部门
|
||||||
DeptRespDTO parentDept = deptApi.getDept(dept.getParentId()).getCheckedData();
|
DeptRespDTO parentDept = deptApi.getDept(parentId).getCheckedData();
|
||||||
if (parentDept == null) { // 找不到父级部门,所以只好结束寻找。原因是:例如说,级别比较高的人,所在部门层级比较少
|
if (parentDept == null) { // 找不到父级部门,所以只好结束寻找。原因是:例如说,级别比较高的人,所在部门层级比较少
|
||||||
return emptySet();
|
return emptySet();
|
||||||
}
|
}
|
||||||
@ -87,6 +87,8 @@ public class BpmTaskCurrentAssignLeaderScript extends BpmTaskAssignLeaderAbstrac
|
|||||||
count = 1;
|
count = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parentId = parentDept.getParentId();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == 0){// 找不到父级部门。原因是:人的所属部门配在了最高节点了
|
if (count == 0){// 找不到父级部门。原因是:人的所属部门配在了最高节点了
|
||||||
|
@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmTaskExtDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmTaskExtDO;
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmActivityService;
|
import cn.iocoder.yudao.module.bpm.service.task.BpmActivityService;
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
|
||||||
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
|
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -38,10 +37,6 @@ public class BpmTaskEventListener extends AbstractFlowableEngineEventListener {
|
|||||||
@Lazy // 解决循环依赖
|
@Lazy // 解决循环依赖
|
||||||
private BpmActivityService activityService;
|
private BpmActivityService activityService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
@Lazy // 解决循环依赖
|
|
||||||
private BpmProcessInstanceService processInstanceService;
|
|
||||||
|
|
||||||
public static final Set<FlowableEngineEventType> TASK_EVENTS = ImmutableSet.<FlowableEngineEventType>builder()
|
public static final Set<FlowableEngineEventType> TASK_EVENTS = ImmutableSet.<FlowableEngineEventType>builder()
|
||||||
.add(FlowableEngineEventType.TASK_CREATED)
|
.add(FlowableEngineEventType.TASK_CREATED)
|
||||||
.add(FlowableEngineEventType.TASK_ASSIGNED)
|
.add(FlowableEngineEventType.TASK_ASSIGNED)
|
||||||
@ -57,9 +52,6 @@ public class BpmTaskEventListener extends AbstractFlowableEngineEventListener {
|
|||||||
protected void taskCreated(FlowableEngineEntityEvent event) {
|
protected void taskCreated(FlowableEngineEntityEvent event) {
|
||||||
Task task = (Task) event.getEntity();
|
Task task = (Task) event.getEntity();
|
||||||
taskService.createTaskExt(task);
|
taskService.createTaskExt(task);
|
||||||
|
|
||||||
//在TASK创建时, 监听审批人是否时发起人
|
|
||||||
taskService.approveAuto(task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,22 +2,28 @@ package cn.iocoder.yudao.module.bpm.service.message;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.web.config.WebProperties;
|
import cn.iocoder.yudao.framework.web.config.WebProperties;
|
||||||
import cn.iocoder.yudao.module.bpm.convert.message.BpmMessageConvert;
|
import cn.iocoder.yudao.module.bpm.convert.message.BpmMessageConvert;
|
||||||
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
|
||||||
import cn.iocoder.yudao.module.bpm.enums.message.BpmMessageEnum;
|
import cn.iocoder.yudao.module.bpm.enums.message.BpmMessageEnum;
|
||||||
|
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||||
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceApproveReqDTO;
|
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceApproveReqDTO;
|
||||||
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceRejectReqDTO;
|
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceRejectReqDTO;
|
||||||
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO;
|
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||||
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
||||||
import cn.iocoder.yudao.module.system.api.sms.SmsSendApi;
|
import cn.iocoder.yudao.module.system.api.sms.SmsSendApi;
|
||||||
import cn.iocoder.yudao.module.system.api.subscribe.SubscribeMessageSendApi;
|
import cn.iocoder.yudao.module.system.api.subscribe.SubscribeMessageSendApi;
|
||||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BPM 消息 Service 实现类
|
* BPM 消息 Service 实现类
|
||||||
@ -41,6 +47,10 @@ public class BpmMessageServiceImpl implements BpmMessageService {
|
|||||||
@Resource
|
@Resource
|
||||||
private WebProperties webProperties;
|
private WebProperties webProperties;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Lazy // 解决循环依赖
|
||||||
|
private BpmProcessInstanceService bpmProcessInstanceService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessageWhenProcessInstanceApprove(BpmMessageSendWhenProcessInstanceApproveReqDTO reqDTO) {
|
public void sendMessageWhenProcessInstanceApprove(BpmMessageSendWhenProcessInstanceApproveReqDTO reqDTO) {
|
||||||
//审批通过
|
//审批通过
|
||||||
@ -49,10 +59,16 @@ public class BpmMessageServiceImpl implements BpmMessageService {
|
|||||||
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
|
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
|
||||||
// smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(),
|
// smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(),
|
||||||
// BpmMessageEnum.PROCESS_INSTANCE_APPROVE.getSmsTemplateCode(), templateParams));
|
// BpmMessageEnum.PROCESS_INSTANCE_APPROVE.getSmsTemplateCode(), templateParams));
|
||||||
|
|
||||||
|
//当流程全部审批通过
|
||||||
|
BpmProcessInstanceExtDO processInstance = bpmProcessInstanceService.getProcessInstanceDO(reqDTO.getProcessInstanceId());
|
||||||
|
if (processInstance.getResult().equals(BpmProcessInstanceResultEnum.APPROVE.getResult())) {
|
||||||
|
|
||||||
|
//发送站内信息
|
||||||
notifyMessageSendApi.sendSingleMessageToAdmin(BpmMessageConvert.INSTANCE.convert1(reqDTO.getStartUserId(),
|
notifyMessageSendApi.sendSingleMessageToAdmin(BpmMessageConvert.INSTANCE.convert1(reqDTO.getStartUserId(),
|
||||||
BpmMessageEnum.PROCESS_INSTANCE_APPROVE.getSmsTemplateCode(), templateParams));
|
BpmMessageEnum.PROCESS_INSTANCE_APPROVE.getSmsTemplateCode(), templateParams));
|
||||||
|
|
||||||
//发送审批结果通知
|
//发送审批结果通知至微信
|
||||||
String openId = getUserOpenId(reqDTO.getStartUserId());
|
String openId = getUserOpenId(reqDTO.getStartUserId());
|
||||||
if (openId != null) {
|
if (openId != null) {
|
||||||
subscribeMessageSendApi.sendApprovalResultNotification(
|
subscribeMessageSendApi.sendApprovalResultNotification(
|
||||||
@ -64,6 +80,28 @@ public class BpmMessageServiceImpl implements BpmMessageService {
|
|||||||
*/
|
*/
|
||||||
"formal"));
|
"formal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取抄送用户ID
|
||||||
|
String ccIDs = processInstance.getCcids();
|
||||||
|
Pattern pattern = Pattern.compile("\\[(\\d+)]");
|
||||||
|
Matcher matcher = pattern.matcher(ccIDs);
|
||||||
|
while (matcher.find()) {
|
||||||
|
String ccID = matcher.group(1);
|
||||||
|
String ccOpenId = getUserOpenId(Long.valueOf(ccID));
|
||||||
|
|
||||||
|
//发送抄送信息至微信
|
||||||
|
if (ccOpenId != null) {
|
||||||
|
subscribeMessageSendApi.sendApprovalResultNotification(
|
||||||
|
BpmMessageConvert.INSTANCE.convertApprovalResultNotification(
|
||||||
|
ccOpenId, reqDTO.getProcessInstanceName(), reqDTO.getCreateTime(), "抄送", reqDTO.getReason(),
|
||||||
|
reqDTO.getProcessInstanceId(),
|
||||||
|
/**
|
||||||
|
* 跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版
|
||||||
|
*/
|
||||||
|
"formal"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -112,9 +150,10 @@ public class BpmMessageServiceImpl implements BpmMessageService {
|
|||||||
//站内信
|
//站内信
|
||||||
notifyMessageSendApi.sendSingleMessageToAdmin(BpmMessageConvert.INSTANCE.convert1(
|
notifyMessageSendApi.sendSingleMessageToAdmin(BpmMessageConvert.INSTANCE.convert1(
|
||||||
reqDTO.getAssigneeUserId(), BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams));
|
reqDTO.getAssigneeUserId(), BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams));
|
||||||
|
|
||||||
//微信小程序订阅消息
|
//微信小程序订阅消息
|
||||||
//发送OA流程待办提醒
|
//发送OA流程待办提醒
|
||||||
String openId = getUserOpenId(reqDTO.getStartUserId()); //只有在微信小程序登陆过用户才会有openid
|
String openId = getUserOpenId(assigneeUserId); //只有在微信小程序登陆过用户才会有openid
|
||||||
if (openId != null) {
|
if (openId != null) {
|
||||||
subscribeMessageSendApi.sendProcessToDoReminder(BpmMessageConvert.INSTANCE.convertProcessToDoReminder(
|
subscribeMessageSendApi.sendProcessToDoReminder(BpmMessageConvert.INSTANCE.convertProcessToDoReminder(
|
||||||
openId, reqDTO.getProcessInstanceName(), reqDTO.getStartUserNickname(), reqDTO.getCreateTime(), reqDTO.getSchedule(),
|
openId, reqDTO.getProcessInstanceName(), reqDTO.getStartUserNickname(), reqDTO.getCreateTime(), reqDTO.getSchedule(),
|
||||||
@ -134,7 +173,7 @@ public class BpmMessageServiceImpl implements BpmMessageService {
|
|||||||
|
|
||||||
private String getUserOpenId(Long userId) {
|
private String getUserOpenId(Long userId) {
|
||||||
AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(userId).getData();
|
AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(userId).getData();
|
||||||
String openId = adminUserRespDTO.getOpenId();
|
|
||||||
return openId;
|
return adminUserRespDTO.getOpenId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,4 +179,11 @@ public interface BpmProcessInstanceService {
|
|||||||
*/
|
*/
|
||||||
List<BpmProcessFinishStatisticsRespVO> getUserProcessTpo10(BpmProcessInstanceStatisticsReqVO pageReqVO);
|
List<BpmProcessFinishStatisticsRespVO> getUserProcessTpo10(BpmProcessInstanceStatisticsReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得流程实例
|
||||||
|
*
|
||||||
|
* @param id 流程实例的编号
|
||||||
|
* @return 流程实例
|
||||||
|
*/
|
||||||
|
BpmProcessInstanceExtDO getProcessInstanceDO(String id);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -196,11 +196,4 @@ public interface BpmTaskService {
|
|||||||
* @return 当前任务的taskId
|
* @return 当前任务的taskId
|
||||||
*/
|
*/
|
||||||
String getCurrentTaskIdByProcessInstanceId(String processInstanceId) ;
|
String getCurrentTaskIdByProcessInstanceId(String processInstanceId) ;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 监听 判断流程审批人是否是发起人
|
|
||||||
* @param task
|
|
||||||
*/
|
|
||||||
void approveAuto(Task task);
|
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,6 @@ import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
|
|||||||
/**
|
/**
|
||||||
* 流程任务实例 Service 实现类
|
* 流程任务实例 Service 实现类
|
||||||
*
|
*
|
||||||
|
|
||||||
* @author jason
|
* @author jason
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -153,7 +152,6 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 执行查询
|
// 执行查询
|
||||||
List<Task> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize());
|
List<Task> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize());
|
||||||
if (CollUtil.isEmpty(tasks)) {
|
if (CollUtil.isEmpty(tasks)) {
|
||||||
@ -721,26 +719,60 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTaskExtAssign(Task task) {
|
public void updateTaskExtAssign(Task task) {
|
||||||
BpmTaskExtDO taskExtDO =
|
// BpmTaskExtDO taskExtDO =
|
||||||
new BpmTaskExtDO().setAssigneeUserId(NumberUtils.parseLong(task.getAssignee())).setTaskId(task.getId());
|
// new BpmTaskExtDO().setAssigneeUserId(NumberUtils.parseLong(task.getAssignee())).setTaskId(task.getId());
|
||||||
taskExtMapper.updateByTaskId(taskExtDO);
|
// taskExtMapper.updateByTaskId(taskExtDO);
|
||||||
|
|
||||||
// 发送通知。在事务提交时,批量执行操作,所以直接查询会无法查询到 ProcessInstance,所以这里是通过监听事务的提交来实现。
|
// 发送通知。在事务提交时,批量执行操作,所以直接查询会无法查询到 ProcessInstance,所以这里是通过监听事务的提交来实现。
|
||||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterCommit() {
|
public void afterCommit() {
|
||||||
|
|
||||||
if (StrUtil.isNotEmpty(task.getAssignee())) {
|
if (StrUtil.isNotEmpty(task.getAssignee())) {
|
||||||
ProcessInstance processInstance =
|
|
||||||
processInstanceService.getProcessInstance(task.getProcessInstanceId());
|
ProcessInstance processInstance = processInstanceService.getProcessInstance(task.getProcessInstanceId());
|
||||||
if (processInstance != null) {
|
if (processInstance != null) {
|
||||||
// 获得任务列表
|
// 获得任务列表
|
||||||
List<BpmTaskRespVO> BpmTaskRespVOs = getTaskListByProcessInstanceId(processInstance.getProcessInstanceId());
|
List<BpmTaskRespVO> BpmTaskRespVOs = getTaskListByProcessInstanceId(processInstance.getProcessInstanceId());
|
||||||
AdminUserRespDTO startUser = adminUserApi.getUser(Long.valueOf(processInstance.getStartUserId())).getCheckedData();
|
AdminUserRespDTO startUser = adminUserApi.getUser(Long.valueOf(processInstance.getStartUserId())).getCheckedData();
|
||||||
|
//发送信息通知
|
||||||
messageService.sendMessageWhenTaskAssigned(
|
messageService.sendMessageWhenTaskAssigned(
|
||||||
BpmTaskConvert.INSTANCE.convert(processInstance, startUser, task, BpmTaskRespVOs));
|
BpmTaskConvert.INSTANCE.convert(processInstance, startUser, task, BpmTaskRespVOs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCompletion(int status) {
|
||||||
|
|
||||||
|
if(TransactionSynchronization.STATUS_COMMITTED == status){
|
||||||
|
|
||||||
|
ProcessInstance processInstance = processInstanceService.getProcessInstance(task.getProcessInstanceId());
|
||||||
|
|
||||||
|
//如果当前审批人是流程发起人,则自动通过当前审批节点
|
||||||
|
if (processInstance.getStartUserId().equals(task.getAssignee())) {
|
||||||
|
|
||||||
|
BpmTaskApproveReqVO reqVO = new BpmTaskApproveReqVO();
|
||||||
|
reqVO.setId(task.getId());
|
||||||
|
reqVO.setReason(BpmConstants.AUTO_APPRAVAL);
|
||||||
|
|
||||||
|
approveTask(Long.valueOf(task.getAssignee()), reqVO);
|
||||||
|
} else {
|
||||||
|
//判断 当前审批人是否在该流程中 已通过审批
|
||||||
|
//如果有,则自动审批通过该审批人节点
|
||||||
|
Long count = taskExtMapper.selectListCount(Long.valueOf(task.getAssignee()), task.getProcessInstanceId());
|
||||||
|
|
||||||
|
if (count > 0L) {
|
||||||
|
|
||||||
|
BpmTaskApproveReqVO reqVO = new BpmTaskApproveReqVO();
|
||||||
|
reqVO.setId(task.getId());
|
||||||
|
reqVO.setReason(BpmConstants.AUTO_APPRAVAL);
|
||||||
|
approveTask(Long.valueOf(task.getAssignee()), reqVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1083,6 +1115,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断当前类型是否为加签
|
* 判断当前类型是否为加签
|
||||||
|
*
|
||||||
* @param scopeType 任务的 scopeType
|
* @param scopeType 任务的 scopeType
|
||||||
* @return 当前 scopeType 为加签则返回 true
|
* @return 当前 scopeType 为加签则返回 true
|
||||||
*/
|
*/
|
||||||
@ -1185,43 +1218,4 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||||||
throw exception(TASK_NOT_EXISTS);
|
throw exception(TASK_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 监听 判断流程审批人是否是发起人
|
|
||||||
* @param task
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void approveAuto(Task task) {
|
|
||||||
|
|
||||||
//在事务提交后, 进行判断
|
|
||||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterCommit() {
|
|
||||||
|
|
||||||
ProcessInstance processInstance = processInstanceService.getProcessInstance(task.getProcessInstanceId());
|
|
||||||
|
|
||||||
//如果当前审批人是流程发起人,则自动通过当前审批节点
|
|
||||||
if (processInstance.getStartUserId().equals(task.getAssignee())) {
|
|
||||||
|
|
||||||
BpmTaskApproveReqVO reqVO = new BpmTaskApproveReqVO();
|
|
||||||
reqVO.setId(task.getId());
|
|
||||||
reqVO.setReason(BpmConstants.AUTO_APPRAVAL);
|
|
||||||
approveTask(Long.valueOf(task.getAssignee()), reqVO);
|
|
||||||
}else {
|
|
||||||
//判断 当前审批人是否在该流程中 已通过审批
|
|
||||||
//如果有,则自动审批通过该审批人节点
|
|
||||||
Long count = taskExtMapper.selectListCount(Long.valueOf(task.getAssignee()), task.getProcessInstanceId());
|
|
||||||
|
|
||||||
if (count > 0L) {
|
|
||||||
|
|
||||||
BpmTaskApproveReqVO reqVO = new BpmTaskApproveReqVO();
|
|
||||||
reqVO.setId(task.getId());
|
|
||||||
reqVO.setReason(BpmConstants.AUTO_APPRAVAL);
|
|
||||||
approveTask(Long.valueOf(task.getAssignee()), reqVO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user