v3审批:当前审批与申请人一样,默认通过
This commit is contained in:
parent
ffe1b86a28
commit
fdc9019a4b
|
@ -3,6 +3,8 @@ package io.renren.modules.processForm.listener.v3;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||
import io.renren.modules.activiti.service.ActTaskService;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
import io.renren.modules.sys.dao.SysUserDao;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||
|
@ -17,6 +19,7 @@ import org.activiti.engine.TaskService;
|
|||
import org.activiti.engine.delegate.*;
|
||||
import org.activiti.engine.delegate.event.ActivitiEvent;
|
||||
import org.activiti.engine.delegate.event.ActivitiEventListener;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -98,6 +101,7 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A
|
|||
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
||||
assignee = defaultAssigneeRoleId;
|
||||
}
|
||||
mpComplete(delegateTask, assignee);
|
||||
logger.error("分配的用户id为:{}", assignee);
|
||||
} else {
|
||||
try {
|
||||
|
@ -108,6 +112,17 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A
|
|||
}
|
||||
}
|
||||
|
||||
private void mpComplete(DelegateTask delegateTask, final String assignee) { // 处理审批人为申请人
|
||||
if (StringUtils.isNotEmpty(assignee)
|
||||
&& StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class))
|
||||
&& delegateTask.getVariable("creator", String.class).equals(assignee)) {
|
||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
|
||||
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
|
||||
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
|
||||
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(DelegateExecution delegateExecution) throws Exception {
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.renren.modules.processForm.listener.v3;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||
import io.renren.modules.activiti.service.ActTaskService;
|
||||
import io.renren.modules.sys.dao.SysUserDao;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||
|
@ -17,6 +18,7 @@ import org.activiti.engine.TaskService;
|
|||
import org.activiti.engine.delegate.*;
|
||||
import org.activiti.engine.delegate.event.ActivitiEvent;
|
||||
import org.activiti.engine.delegate.event.ActivitiEventListener;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -99,6 +101,7 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv
|
|||
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
||||
assignee = defaultAssigneeRoleId;
|
||||
}
|
||||
mpComplete(delegateTask, assignee);
|
||||
logger.error("分配的用户id为:{}", assignee);
|
||||
} else {
|
||||
try {
|
||||
|
@ -109,6 +112,17 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv
|
|||
}
|
||||
}
|
||||
|
||||
private void mpComplete(DelegateTask delegateTask, final String assignee) { // 处理审批人为申请人
|
||||
if (StringUtils.isNotEmpty(assignee)
|
||||
&& StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class))
|
||||
&& delegateTask.getVariable("creator", String.class).equals(assignee)) {
|
||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
|
||||
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
|
||||
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
|
||||
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(DelegateExecution delegateExecution) throws Exception {
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.renren.modules.processForm.listener.v3;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||
import io.renren.modules.activiti.service.ActTaskService;
|
||||
import io.renren.modules.sys.dao.SysUserDao;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||
|
@ -16,6 +17,7 @@ import org.activiti.engine.TaskService;
|
|||
import org.activiti.engine.delegate.*;
|
||||
import org.activiti.engine.delegate.event.ActivitiEvent;
|
||||
import org.activiti.engine.delegate.event.ActivitiEventListener;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -95,6 +97,7 @@ public class OwnerDistrictListener implements TaskListener, ExecutionListener, A
|
|||
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
||||
assignee = defaultAssigneeRoleId;
|
||||
}
|
||||
mpComplete(delegateTask, assignee);
|
||||
logger.error("分配的用户id为:{}", assignee);
|
||||
} else {
|
||||
try {
|
||||
|
@ -104,6 +107,17 @@ public class OwnerDistrictListener implements TaskListener, ExecutionListener, A
|
|||
}
|
||||
}
|
||||
}
|
||||
private void mpComplete(DelegateTask delegateTask, final String assignee) { // 处理审批人为申请人
|
||||
if (StringUtils.isNotEmpty(assignee)
|
||||
&& StringUtils.isNotEmpty(delegateTask.getVariable("creator", String.class))
|
||||
&& delegateTask.getVariable("creator", String.class).equals(assignee)) {
|
||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "审批人为发起人,默认通过");
|
||||
taskService.setVariable(delegateTask.getId(), ActTaskService.Task_HANDLE_STATE, ActTaskService.Task_HANDLE_STATE_AGREE);
|
||||
taskService.setVariable(delegateTask.getId(), "backToFirst", Boolean.FALSE);
|
||||
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void notify(DelegateExecution delegateExecution) throws Exception {
|
||||
|
|
Loading…
Reference in New Issue