|
|
|
@@ -811,8 +811,8 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
if(i != taskAssigneeList.size() -1){ |
|
|
|
UserTaskVo nextTaskAssignee = taskAssigneeList.get(i+1); |
|
|
|
if(CollectionUtils.isEmpty(nextTaskAssignee.getUserList())){ |
|
|
|
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); |
|
|
|
taskService.complete(task.getId()); |
|
|
|
List<Task> task = taskService.createTaskQuery().processInstanceId(processInstanceId).list(); |
|
|
|
taskService.complete(task.get(0).getId()); |
|
|
|
has = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
@@ -830,8 +830,8 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
if(i != taskAssigneeList.size() -1){ |
|
|
|
Map<String,String> nextTaskAssignee = taskAssigneeList.get(i+1); |
|
|
|
if(StringUtils.isBlank(nextTaskAssignee.get("assignee"))){ |
|
|
|
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); |
|
|
|
taskService.complete(task.getId()); |
|
|
|
List<Task> task = taskService.createTaskQuery().processInstanceId(processInstanceId).list(); |
|
|
|
taskService.complete(task.get(0).getId()); |
|
|
|
has = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
@@ -847,8 +847,11 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
String processInstanceId = (String)params.get("processInstanceId"); |
|
|
|
String remark = (String)params.get("remark"); |
|
|
|
|
|
|
|
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); |
|
|
|
Map<String,Object> mapInfo = taskService.getVariables(task.getId()); |
|
|
|
List<Task> taskList = taskService.createTaskQuery().processInstanceId(processInstanceId).list(); |
|
|
|
if (CollectionUtils.isEmpty(taskList)) { |
|
|
|
return new ResultData(ErrorCode.FLOW_INST_NOT_EXIST.getCode(), "任务不存在"); |
|
|
|
} |
|
|
|
Map<String,Object> mapInfo = taskService.getVariables(taskList.get(0).getId()); |
|
|
|
Long businessId = Long.parseLong(mapInfo.get("businessId").toString()); |
|
|
|
Integer flowType = (Integer)mapInfo.get("flowType"); |
|
|
|
Map<String,Object> userMap = (Map<String,Object>)mapInfo.get("starter"); |
|
|
|
@@ -858,11 +861,9 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
|
|
|
|
String taskName; |
|
|
|
String taskKey; |
|
|
|
if (task == null) { |
|
|
|
return new ResultData(ErrorCode.FLOW_INST_NOT_EXIST.getCode(), "任务不存在"); |
|
|
|
} |
|
|
|
taskName = task.getName(); |
|
|
|
taskKey = task.getTaskDefinitionKey(); |
|
|
|
|
|
|
|
taskName = taskList.get(0).getName(); |
|
|
|
taskKey = taskList.get(0).getTaskDefinitionKey(); |
|
|
|
|
|
|
|
runtimeService.deleteProcessInstance(processInstanceId, "驳回"); |
|
|
|
|
|
|
|
@@ -873,7 +874,7 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
//保存wx_flow_record表审批记录 |
|
|
|
WxFlowRecord wxFlowRecord = new WxFlowRecord(); |
|
|
|
wxFlowRecord.setBusinessId(businessId); |
|
|
|
wxFlowRecord.setTaskId(task.getId()); |
|
|
|
wxFlowRecord.setTaskId(taskList.get(0).getId()); |
|
|
|
wxFlowRecord.setProcessInstanceId(processInstanceId); |
|
|
|
wxFlowRecord.setRemark(remark); |
|
|
|
wxFlowRecord.setUserId(userId); |
|
|
|
@@ -953,8 +954,8 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
String processInstanceId = (String)params.get("processInstanceId"); |
|
|
|
String remark = (String)params.get("remark"); |
|
|
|
|
|
|
|
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); |
|
|
|
Map<String,Object> mapInfo = taskService.getVariables(task.getId()); |
|
|
|
List<Task> task = taskService.createTaskQuery().processInstanceId(processInstanceId).list(); |
|
|
|
Map<String,Object> mapInfo = taskService.getVariables(task.get(0).getId()); |
|
|
|
Long businessId = Long.parseLong(mapInfo.get("businessId").toString()); |
|
|
|
Integer flowType = (Integer)mapInfo.get("flowType"); |
|
|
|
List<Map<String,Object>> variables = (List)mapInfo.get("variables"); |
|
|
|
@@ -965,8 +966,8 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
if (task == null) { |
|
|
|
return new ResultData(ErrorCode.FLOW_INST_NOT_EXIST.getCode(), "任务不存在"); |
|
|
|
} |
|
|
|
taskName = task.getName(); |
|
|
|
taskKey = task.getTaskDefinitionKey(); |
|
|
|
taskName = task.get(0).getName(); |
|
|
|
taskKey = task.get(0).getTaskDefinitionKey(); |
|
|
|
|
|
|
|
runtimeService.deleteProcessInstance(processInstanceId, "撤回"); |
|
|
|
|
|
|
|
@@ -977,7 +978,7 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
//保存wx_flow_record表审批记录 |
|
|
|
WxFlowRecord wxFlowRecord = new WxFlowRecord(); |
|
|
|
wxFlowRecord.setBusinessId(businessId); |
|
|
|
wxFlowRecord.setTaskId(task.getId()); |
|
|
|
wxFlowRecord.setTaskId(task.get(0).getId()); |
|
|
|
wxFlowRecord.setProcessInstanceId(processInstanceId); |
|
|
|
wxFlowRecord.setRemark(remark); |
|
|
|
wxFlowRecord.setUserId(userId); |
|
|
|
@@ -1068,58 +1069,6 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxFlowRecordMapper.myHandelList(record)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void genProcessDiagram(HttpServletResponse httpServletResponse,String businessId) throws Exception { |
|
|
|
List<WxFlowRecord> result = wxFlowRecordService.findList(new WxFlowRecord(Long.parseLong(businessId))); |
|
|
|
if(CollectionUtils.isNotEmpty(result)) { |
|
|
|
String processInstanceId = result.get(0).getProcessInstanceId(); |
|
|
|
ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); |
|
|
|
|
|
|
|
//流程走完的不显示图 |
|
|
|
if (pi == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); |
|
|
|
//使用流程实例ID,查询正在执行的执行对象表,返回流程实例对象 |
|
|
|
String InstanceId = task.getProcessInstanceId(); |
|
|
|
List<Execution> executions = runtimeService |
|
|
|
.createExecutionQuery() |
|
|
|
.processInstanceId(InstanceId) |
|
|
|
.list(); |
|
|
|
|
|
|
|
//得到正在执行的Activity的Id |
|
|
|
List<String> activityIds = new ArrayList<>(); |
|
|
|
List<String> flows = new ArrayList<>(); |
|
|
|
for (Execution exe : executions) { |
|
|
|
List<String> ids = runtimeService.getActiveActivityIds(exe.getId()); |
|
|
|
activityIds.addAll(ids); |
|
|
|
} |
|
|
|
|
|
|
|
//获取流程图 |
|
|
|
BpmnModel bpmnModel = repositoryService.getBpmnModel(pi.getProcessDefinitionId()); |
|
|
|
ProcessEngineConfiguration engconf = processEngine.getProcessEngineConfiguration(); |
|
|
|
ProcessDiagramGenerator diagramGenerator = engconf.getProcessDiagramGenerator(); |
|
|
|
InputStream in = diagramGenerator.generateDiagram(bpmnModel, "png", activityIds, flows, engconf.getActivityFontName(), engconf.getLabelFontName(), engconf.getAnnotationFontName(), engconf.getClassLoader(), 1.0,true); |
|
|
|
OutputStream out = null; |
|
|
|
byte[] buf = new byte[1024]; |
|
|
|
int legth = 0; |
|
|
|
try { |
|
|
|
out = httpServletResponse.getOutputStream(); |
|
|
|
while ((legth = in.read(buf)) != -1) { |
|
|
|
out.write(buf, 0, legth); |
|
|
|
} |
|
|
|
} finally { |
|
|
|
if (in != null) { |
|
|
|
in.close(); |
|
|
|
} |
|
|
|
if (out != null) { |
|
|
|
out.close(); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
throw new MallinkException(Result.ERROR, "找不到审批历史"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static Object getVariableByKey(List<Map<String,Object>> variables,String key){ |
|
|
|
if(variables == null) return null; |
|
|
|
|