use of org.daijie.api.enums.RelicStatus in project daijie-example by daijiejay.
the class RelicService method review.
@Override
public ModelResult<Boolean> review(String processInstanceId, String assignee, Boolean vote, String customerService) {
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).taskAssignee(assignee).singleResult();
if (task == null) {
return Result.build("没有需要处理的订单!", ApiResult.ERROR);
}
Map<String, Object> variables = new HashMap<String, Object>();
Object obj = runtimeService.getVariable(task.getExecutionId(), "reviewVotes");
Integer votes = obj == null ? 0 : (Integer) obj;
if (vote) {
variables.put("reviewVotes", votes + 1);
}
runtimeService.setVariables(task.getExecutionId(), variables);
variables.put(assignee, vote);
Integer nrOfCompletedInstances = (Integer) runtimeService.getVariable(task.getExecutionId(), "nrOfCompletedInstances");
if (nrOfCompletedInstances >= 2) {
RelicStatus relicStatus = RelicStatus.valueOf(task.getTaskDefinitionKey());
if (relicStatus.nextProcess(Process.THROUGH) != null) {
variables.put(relicStatus.nextProcess(Process.THROUGH).getAssignee(), customerService);
}
}
taskService.complete(task.getId(), variables);
return Result.build(true);
}
use of org.daijie.api.enums.RelicStatus in project daijie-example by daijiejay.
the class RelicService method lastTrail.
@Override
public ModelResult<Boolean> lastTrail(String processInstanceId, String assignee, Boolean vote, String operator) {
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).taskAssignee(assignee).singleResult();
if (task == null) {
return Result.build("没有需要处理的订单!", ApiResult.ERROR);
}
Map<String, Object> variables = new HashMap<String, Object>();
Object obj = runtimeService.getVariable(task.getExecutionId(), "lastTrailVotes");
Integer votes = obj == null ? 0 : (Integer) obj;
if (vote) {
variables.put("lastTrailVotes", votes + 1);
}
runtimeService.setVariables(task.getExecutionId(), variables);
variables.put(assignee, vote);
RelicStatus relicStatus = RelicStatus.valueOf(task.getTaskDefinitionKey());
if (relicStatus.nextProcess(Process.THROUGH) != null) {
variables.put(relicStatus.nextProcess(Process.THROUGH).getAssignee(), operator);
}
taskService.complete(task.getId(), variables);
return Result.build(true);
}
use of org.daijie.api.enums.RelicStatus in project daijie-example by daijiejay.
the class RelicService method submit.
@Override
public ModelResult<Boolean> submit(String processInstanceId, String assignee, String auditor) {
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).taskAssignee(assignee).singleResult();
if (task == null) {
return Result.build("没有需要处理的订单!", ApiResult.ERROR);
}
Map<String, Object> variables = new HashMap<String, Object>();
RelicStatus relicStatus = RelicStatus.valueOf(task.getTaskDefinitionKey());
if (relicStatus.nextProcess(Process.THROUGH) != null) {
variables.put(relicStatus.nextProcess(Process.THROUGH).getAssignee(), auditor);
}
taskService.complete(task.getId(), variables);
return Result.build(true);
}
use of org.daijie.api.enums.RelicStatus in project daijie-example by daijiejay.
the class RelicService method pay.
@Override
public ModelResult<Boolean> pay(String processInstanceId, String assignee, Integer pay, String auditor) {
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).taskAssignee(assignee).singleResult();
if (task == null) {
return Result.build("没有需要处理的订单!", ApiResult.ERROR);
}
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("pay", pay);
variables.put("repeat", "1");
RelicStatus relicStatus = RelicStatus.valueOf(task.getTaskDefinitionKey());
if (relicStatus.nextProcess(Process.THROUGH) != null) {
variables.put(relicStatus.nextProcess(Process.THROUGH).getAssignee(), auditor);
}
taskService.complete(task.getId(), variables);
return Result.build(true);
}
Aggregations