|
@@ -21,8 +21,13 @@ import io.swagger.annotations.ApiParam;
|
|
|
import org.activiti.engine.task.Task;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.FileCopyUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.io.OutputStream;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -119,14 +124,38 @@ public class WorkFlowController {
|
|
|
workFlowService.saveBPMNContent(id, content, svg);
|
|
|
return new AjaxMessage(ResultStatus.OK);
|
|
|
}
|
|
|
-
|
|
|
+ @GetMapping("/image")
|
|
|
+ @ApiOperation(value = "工单流程图片")
|
|
|
+ public void image(
|
|
|
+ @ApiParam(value = "流程实例id", required = true) @RequestParam(required = true) String processId,
|
|
|
+ HttpServletResponse response
|
|
|
+ ) throws Exception {
|
|
|
+ InputStream inputStream =workFlowService.queryProHighLighted(processId);
|
|
|
+ OutputStream out = response.getOutputStream();
|
|
|
+
|
|
|
+ //设置响应头通知浏览器以图片的形式打开
|
|
|
+ response.setContentType("image/png");
|
|
|
+ //设置响应头控制浏览器不要缓存
|
|
|
+ response.setDateHeader("expries", -1);
|
|
|
+ response.setHeader("Cache-Control", "no-cache");
|
|
|
+ response.setHeader("Pragma", "no-cache");
|
|
|
+ //ImageIO.write(imageCode.getImage(), "PNG", out);
|
|
|
+ out.write(FileCopyUtils.copyToByteArray(inputStream));
|
|
|
+ out.close();
|
|
|
+ }
|
|
|
+ @PostMapping("/deleteProcess")
|
|
|
+ @ApiOperation(value = "终止流程")
|
|
|
+ public AjaxMessage saveBpmnContent(
|
|
|
+ @ApiParam(value = "流程实例id", required = true) @RequestParam(required = true) Integer processId) {
|
|
|
+ workFlowService.deleteProcessDefinition(processId);
|
|
|
+ return new AjaxMessage(ResultStatus.OK);
|
|
|
+ }
|
|
|
@GetMapping("/testStartProgress")
|
|
|
@ApiOperation(value = "开启流程")
|
|
|
public AjaxMessage testStartProgress() {
|
|
|
ProcessDefinition processDefinition=new ProcessDefinition();
|
|
|
processDefinition.setTenantId("test1");
|
|
|
processDefinition.setProcessKey("workFlow");
|
|
|
- String businessKey="43";
|
|
|
Map<String, Object> vars=new HashMap<>();
|
|
|
vars.put("assineeFormUserId","55,66");
|
|
|
//巡检发送系统消息所需参数
|
|
@@ -136,10 +165,10 @@ public class WorkFlowController {
|
|
|
vars.put("msgType",4);
|
|
|
//工单发送发送系统消息所需参数
|
|
|
vars.put("工单类型","ttt");
|
|
|
- vars.put("文档名称","12345678");
|
|
|
+ vars.put("工单编号","12345678");
|
|
|
vars.put("templateId",7);
|
|
|
vars.put("msgType",7);
|
|
|
- String startProcess = workFlowService.startProcess(processDefinition, businessKey, vars);
|
|
|
+ String startProcess = workFlowService.startProcess(processDefinition, vars);
|
|
|
Task task = workFlowService.getProcessRuntimeTask(startProcess).get(0);
|
|
|
Set<String> taskParticipator = workFlowService.getTaskParticipator(task.getId(), false, null);
|
|
|
return new AjaxMessage(ResultStatus.OK,taskParticipator);
|