From a4a4fcdb60f8c6d97b8f0768abc5afeee5a9d0f5 Mon Sep 17 00:00:00 2001 From: luozukai Date: Tue, 15 Jan 2019 10:30:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=89=B9=E6=B5=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=B5=81=E7=A8=8B=E5=9B=BE=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=9F=AD=E4=BF=A1=E6=A8=A1=E6=9D=BF=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxFlowAbleController.java | 3 +- .../com/iformall/service/WxFlowService.java | 2 +- .../service/impl/WxFlowServiceImpl.java | 84 ++++++++++--------- .../WxMsgValidationcodeModelServiceImpl.java | 2 +- 4 files changed, 48 insertions(+), 43 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxFlowAbleController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxFlowAbleController.java index c9cd60df0..042e47b88 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxFlowAbleController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxFlowAbleController.java @@ -22,8 +22,7 @@ public class WxFlowAbleController extends BaseController { @Autowired private WxFlowService wxFlowService; - - @ApiOperation(value = "启动流程",notes = "{\"businessId\":\"215315084967149568\",\"businessType\":1,\"remark\":\"意见意见。\",\"taskAssignee\":[{\"taskKey\":\"firstTaskUser\",\"assignee\":204398756307664896},{\"taskKey\":\"secondTaskUser\",\"assignee\":204398756307664896}]}") + @ApiOperation(value = "启动流程",notes = "{\"businessId\":\"215315084967149568\",\"businessType\":1,\"remark\":\"意见意见。\",\"taskAssignee\":[{\"taskKey\":\"firstTaskUser\",\"assignee\":\"204398756307664896\"},{\"taskKey\":\"secondTaskUser\",\"assignee\":\"204398756307664896\"}]}") @PostMapping("/start") public ResultData start(@RequestBody Map params) { logger.debug("[" + getIpAddr() + "] FlowAbleController::start"); diff --git a/mallinkService/src/main/java/com/iformall/service/WxFlowService.java b/mallinkService/src/main/java/com/iformall/service/WxFlowService.java index 847bef787..2bc22814d 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxFlowService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxFlowService.java @@ -54,5 +54,5 @@ public interface WxFlowService { * @param processInstanceId * @throws Exception */ - void genProcessDiagram(HttpServletResponse httpServletResponse, String processInstanceId) throws Exception; + void genProcessDiagram(HttpServletResponse httpServletResponse, String businessId) throws Exception; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java index bbaa21245..edd0bfe4a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -355,49 +355,55 @@ public class WxFlowServiceImpl implements WxFlowService { @Override - public void genProcessDiagram(HttpServletResponse httpServletResponse, String processInstanceId) throws Exception { - 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 executions = runtimeService - .createExecutionQuery() - .processInstanceId(InstanceId) - .list(); - - //得到正在执行的Activity的Id - List activityIds = new ArrayList<>(); - List flows = new ArrayList<>(); - for (Execution exe : executions) { - List ids = runtimeService.getActiveActivityIds(exe.getId()); - activityIds.addAll(ids); - } + public void genProcessDiagram(HttpServletResponse httpServletResponse,String businessId) throws Exception { + List 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(); - //获取流程图 - 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); + //流程走完的不显示图 + if (pi == null) { + return; } - } finally { - if (in != null) { - in.close(); + Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); + //使用流程实例ID,查询正在执行的执行对象表,返回流程实例对象 + String InstanceId = task.getProcessInstanceId(); + List executions = runtimeService + .createExecutionQuery() + .processInstanceId(InstanceId) + .list(); + + //得到正在执行的Activity的Id + List activityIds = new ArrayList<>(); + List flows = new ArrayList<>(); + for (Execution exe : executions) { + List ids = runtimeService.getActiveActivityIds(exe.getId()); + activityIds.addAll(ids); } - if (out != null) { - out.close(); + + //获取流程图 + 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, "找不到审批历史"); } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java index 63a10b49a..48efdbfb4 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java @@ -72,7 +72,7 @@ public class WxMsgValidationcodeModelServiceImpl implements WxMsgValidationcodeM } } - String result = WiwideUtil.addTemplate(secret, bid, wxMsgConfig.getPublickey(), signature, content, wxMsgConfig.getModelnotifyurl(),EnumVerifyCode.YES.getCode().toString()); + String result = WiwideUtil.addTemplate(secret, bid, wxMsgConfig.getPublickey(), signature, content, wxMsgConfig.getVerifynotifyurl(),EnumVerifyCode.YES.getCode().toString()); JSONObject jsonObjectResult = JSONObject.parseObject(result); String ret = jsonObjectResult.get("ret").toString();