|
@@ -39,25 +39,29 @@ public class ApprovalTaskServiceImpl implements ApprovalTaskService {
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> salesmanSubmitApply(int type) {
|
|
|
+
|
|
|
Map<String, Object> result = new HashMap<>(4);
|
|
|
result.put("status", 1);
|
|
|
|
|
|
ProcessInstance pi = runtimeService.startProcessInstanceByKey(type == 1 ? GENERATION_APPROVAL_KEY : APPLICATION_FOR_DELIVERY_KEY);
|
|
|
-
|
|
|
+
|
|
|
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
|
|
|
if (task == null) {
|
|
|
result.put("status", 0);
|
|
|
result.put("key", pi.getId());
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
taskService.complete(task.getId());
|
|
|
-
|
|
|
+
|
|
|
Map<String, Object> approver = findTaskNextAssignee(pi.getId());
|
|
|
if (approver == null) {
|
|
|
+
|
|
|
result.put("status", 0);
|
|
|
result.put("key", pi.getId());
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
result.put("key", pi.getId());
|
|
|
result.put("users", approver.get("assignee"));
|
|
|
result.put("taskId", approver.get("taskId"));
|
|
@@ -70,12 +74,15 @@ public class ApprovalTaskServiceImpl implements ApprovalTaskService {
|
|
|
result.put("status", 0);
|
|
|
|
|
|
taskService.complete(taskId);
|
|
|
-
|
|
|
+
|
|
|
Map<String, Object> approver = findTaskNextAssignee(pid);
|
|
|
if (approver == null) {
|
|
|
+
|
|
|
result.put("status", 1);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
result.put("users", approver.get("assignee"));
|
|
|
result.put("taskId", approver.get("taskId"));
|
|
|
return result;
|
|
@@ -93,11 +100,12 @@ public class ApprovalTaskServiceImpl implements ApprovalTaskService {
|
|
|
*/
|
|
|
private Map<String, Object> findTaskNextAssignee(String pid) {
|
|
|
Map<String, Object> result = new HashMap<>(2);
|
|
|
-
|
|
|
+
|
|
|
Task nextTask = taskService.createTaskQuery().processInstanceId(pid).singleResult();
|
|
|
if (nextTask == null) {
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
String assignee = nextTask.getAssignee();
|
|
|
if (assignee.contains(SPLIT_ASSIGNEE_CHAR)) {
|
|
|
result.put("taskId", nextTask.getId());
|
|
@@ -105,7 +113,7 @@ public class ApprovalTaskServiceImpl implements ApprovalTaskService {
|
|
|
return result;
|
|
|
}
|
|
|
result.put("taskId", nextTask.getId());
|
|
|
- result.put("assignee", assignee);
|
|
|
+ result.put("assignee", new String[]{assignee});
|
|
|
return result;
|
|
|
}
|
|
|
}
|