|
@@ -178,10 +178,8 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
String approveRemark,
|
|
|
Map<String, Object> map) {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- approveUserIds = new ArrayList<>();
|
|
|
- if (approve == FlowApprovePassEnum.START || approve == FlowApprovePassEnum.DRAFT) {//第一步只能是当前用户
|
|
|
- approveUserIds.add(String.valueOf(sysUser.getId()));//否则是当前登录用户
|
|
|
- } else if (CollectionUtils.isEmpty(approveUserIds) && approve == FlowApprovePassEnum.PASS) {
|
|
|
+ if (CollectionUtils.isEmpty(approveUserIds) && (approve == FlowApprovePassEnum.START || approve == FlowApprovePassEnum.DRAFT || approve == FlowApprovePassEnum.PASS)) {
|
|
|
+ approveUserIds = new ArrayList<>();
|
|
|
approveUserIds.add(String.valueOf(sysUser.getId()));//否则是当前登录用户
|
|
|
}
|
|
|
String processFlowId = null;
|
|
@@ -461,10 +459,10 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
@Transactional
|
|
|
public Boolean taskApproverExchange(Long userId, Long taskId) {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- SysOrg sysOrg = commonCacheService.orgCache(sysUser.getOrgId());
|
|
|
if (Objects.equals(String.valueOf(sysUser.getId()), String.valueOf(userId))) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("不能转给自己!");
|
|
|
}
|
|
|
+
|
|
|
boolean lock = memoryLock.lock(SystemConstant.LOCK_FLOW_EXCHANGE_PREFIX + taskId, taskId, SystemConstant.LOCK_FLOW_TIME_OUT);
|
|
|
if (!lock) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("正在转审中,请稍候再试!");
|
|
@@ -475,16 +473,16 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
|
|
|
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
|
|
|
FlowNode currFlow = (FlowNode) bpmnModel.getMainProcess().getFlowElement(task.getTaskDefinitionKey());
|
|
|
- Integer nrOfCompletedInstances = null, nrOfInstances = null;
|
|
|
boolean multiInstance = false;
|
|
|
if (currFlow.getBehavior() instanceof MultiInstanceActivityBehavior) {//会签
|
|
|
- nrOfCompletedInstances = (Integer) taskService.getVariable(task.getId(), SystemConstant.NR_OF_COMPLETED_INSTANCES);
|
|
|
- nrOfInstances = (Integer) taskService.getVariable(task.getId(), SystemConstant.NR_OF_INSTANCES);
|
|
|
multiInstance = true;
|
|
|
|
|
|
List<Task> taskList = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).list();
|
|
|
List<String> taskApproveList = new ArrayList<>();
|
|
|
for (Task t : taskList) {
|
|
|
+ if (Objects.equals(String.valueOf(t.getAssignee()), String.valueOf(userId))) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("不能转给自己!");
|
|
|
+ }
|
|
|
taskApproveList.add(t.getAssignee());
|
|
|
}
|
|
|
if (taskApproveList.contains(userId)) {
|
|
@@ -515,8 +513,13 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
Long.parseLong(task.getId()), tfCustomFlowEntity.getId(), String.valueOf(userId));
|
|
|
tfFlowLog.setApproveOperation(FlowApproveOperationEnum.EXCHANGE);
|
|
|
SysUser exchangeUser = sysUserService.getById(userId);
|
|
|
+ Optional.ofNullable(exchangeUser).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("转审人为空"));
|
|
|
+
|
|
|
+ SysOrg sysOrg = commonCacheService.orgCache(sysUser.getOrgId());
|
|
|
SysOrg exchangeOrg = commonCacheService.orgCache(exchangeUser.getOrgId());
|
|
|
- tfFlowLog.setApproveRemark(sysUser.getRealName() + "(" + sysOrg.getName() + ")转" + exchangeUser.getRealName() + "(" + exchangeOrg.getName() + ")审批");
|
|
|
+ String orgName = Objects.nonNull(sysOrg) ? sysOrg.getName() : "无机构";
|
|
|
+ String exchangeOrgName = Objects.nonNull(exchangeOrg) ? exchangeOrg.getName() : "无机构";
|
|
|
+ tfFlowLog.setApproveRemark(sysUser.getRealName() + "(" + orgName + ")转" + exchangeUser.getRealName() + "(" + exchangeOrgName + ")审批");
|
|
|
tfFlowLogService.save(tfFlowLog);
|
|
|
} catch (Exception e) {
|
|
|
log.error(SystemConstant.LOG_ERROR, e);
|