我的事务-候选组人无法收到待办事务

Java 已结 2 1588
SophieRoyal
SophieRoyal 剑者 2020-05-25 10:02

一、该问题的重现步骤是什么?

1. 在流程处理,我这里有个候选组,候选组任何一人通过就可以过审批。

2. 我在请假流程这里做的调整,把候选组存入,但是发起申请后候选组的人都没有看到该任务。代码如下:

@Override
@Transactional(rollbackFor = Exception.class)
public boolean startProcess(ProcessLeave leave, List<User> userList) {
   List<String> tempList = new ArrayList<>();
   List<Long> tempList2 = new ArrayList<>();
   userList.forEach(user -> {
      tempList.add(user.getName());
      tempList2.add(user.getId());
   });
   String userGroup = TaskUtil.getTaskUser(tempList2);
   for (int i = 0; i < 10; i++) {
      System.out.println("tempList2===" + tempList2);
      System.out.println("userGroup==" + userGroup);
   }


   String businessTable = FlowUtil.getBusinessTable(ProcessConstant.LEAVE_KEY);
   if (Func.isEmpty(leave.getId())) {
      // 保存leave
      leave.setApplyTime(DateUtil.now());
      save(leave);

      // 启动流程
      Kv variables = Kv.create()
         .set(ProcessConstant.TASK_VARIABLE_CREATE_USER, SecureUtil.getUserName())
         .set("taskUser", TaskUtil.getTaskUser(tempList2))
         .set("days", DateUtil.between(leave.getStartTime(), leave.getEndTime()).toDays())//;
         .set("userGroup", tempList);// 这个是新增字段
      BladeFlow flow = flowService.startProcessInstanceById(leave.getProcessDefinitionId(), FlowUtil.getBusinessKey(businessTable, String.valueOf(leave.getId())), variables);
      if (Func.isNotEmpty(flow)) {
         log.debug("流程已启动,流程ID:" + flow.getProcessInstanceId());
         // 返回流程id写入leave
         leave.setProcessInstanceId(flow.getProcessInstanceId());
         updateById(leave);
      } else {
         throw new ServiceException("开启流程失败");
      }
   } else {

      updateById(leave);
   }
   return true;
}


二、你期待的结果是什么?实际看到的又是什么?

每个候选人都能收到这个事务,任何人审批过了直接入库。

三、你正在使用的是什么产品,什么版本?在什么操作系统上?

bladex-springboot2.12,win10

四、请提供详细的错误堆栈信息,这很重要。

流程无法转给所有审批人

五、若有更多详细信息,请在下面提供。

TIM截图20200525095824.png

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef">
  <process id="Leave" name="工单审批" isExecutable="true">
    <documentation>工单审批</documentation>
    <startEvent id="start" name="发起人" flowable:initiator="applyUser"></startEvent>
    <userTask id="managerTask" name="经理审核" flowable:candidateGroups="${userGroup}"></userTask>
    <userTask id="userTask" name="调整申请" flowable:assignee="${taskUser}">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <endEvent id="end" name="结束"></endEvent>
    <sequenceFlow id="userPassFlow" name="审核通过" sourceRef="managerTask" targetRef="end">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${pass}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="userNotPassFlow" name="关闭申请" sourceRef="userTask" targetRef="end">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${!pass}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="managerNotPassFlow" name="驳回(审核不通过)" sourceRef="managerTask" targetRef="userTask">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${!pass}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flowStart" sourceRef="start" targetRef="managerTask"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_Leave">
    <bpmndi:BPMNPlane bpmnElement="Leave" id="BPMNPlane_Leave">
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="30.0" width="30.0" x="208.5" y="265.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="managerTask" id="BPMNShape_managerTask">
        <omgdc:Bounds height="80.0" width="100.0" x="358.5" y="240.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="userTask" id="BPMNShape_userTask">
        <omgdc:Bounds height="80.0" width="100.0" x="358.5" y="415.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
        <omgdc:Bounds height="28.0" width="28.0" x="643.5" y="266.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="userPassFlow" id="BPMNEdge_userPassFlow">
        <omgdi:waypoint x="458.44999999998765" y="280.0"></omgdi:waypoint>
        <omgdi:waypoint x="643.5" y="280.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="userNotPassFlow" id="BPMNEdge_userNotPassFlow">
        <omgdi:waypoint x="458.44999999998765" y="455.0"></omgdi:waypoint>
        <omgdi:waypoint x="657.5" y="455.0"></omgdi:waypoint>
        <omgdi:waypoint x="657.5" y="293.9499256774902"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flowStart" id="BPMNEdge_flowStart">
        <omgdi:waypoint x="238.44999946593478" y="280.0"></omgdi:waypoint>
        <omgdi:waypoint x="358.4999999999298" y="280.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="managerNotPassFlow" id="BPMNEdge_managerNotPassFlow">
        <omgdi:waypoint x="408.5" y="319.95000000000005"></omgdi:waypoint>
        <omgdi:waypoint x="408.5" y="415.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>


2条回答
  •  smallchill
    smallchill (最佳回答者)
    2020-05-26 09:03

    这块参考自带demo的经理审批和老板审批,节点跳转后,会先到"待签事务",任意一个用户组的人签收任务后,才会到待办任务进行下一步操作

    image.png

    image.png

    0 讨论(1)
  • 2020-05-26 13:47

    非常感谢。原来是这样呀,我一直以为搞错了。以为是账号名称,因为我这里刚好有这几个对应的账号名称。原来这里是角色组名称。

    0 讨论(0)
提交回复