diff --git a/blade-common/src/main/java/org/springblade/common/cache/CacheNames.java b/blade-common/src/main/java/org/springblade/common/cache/CacheNames.java index 13a86e94..9a3cb2a6 100644 --- a/blade-common/src/main/java/org/springblade/common/cache/CacheNames.java +++ b/blade-common/src/main/java/org/springblade/common/cache/CacheNames.java @@ -23,10 +23,10 @@ package org.springblade.common.cache; */ public interface CacheNames { - String NOTICE_ONE = "blade_dict:notice:one"; + String NOTICE_ONE = "blade_notice:one"; - String DICT_VALUE = "blade_dict:dict:value"; - String DICT_LIST = "blade_dict:dict:list"; + String DICT_VALUE = "blade_dict:value"; + String DICT_LIST = "blade_dict:list"; String AUTH_ROUTES = "blade_menu:auth_routes"; diff --git a/blade-ops/blade-flowable/pom.xml b/blade-ops/blade-flowable/pom.xml index 500a24dc..9248a64c 100644 --- a/blade-ops/blade-flowable/pom.xml +++ b/blade-ops/blade-flowable/pom.xml @@ -15,6 +15,12 @@ <packaging>jar</packaging> <dependencies> + <!-- Blade --> + <dependency> + <groupId>org.springblade</groupId> + <artifactId>blade-common</artifactId> + <version>${bladex.project.version}</version> + </dependency> <dependency> <groupId>org.springblade</groupId> <artifactId>blade-core-boot</artifactId> @@ -22,8 +28,15 @@ </dependency> <dependency> <groupId>org.springblade</groupId> - <artifactId>blade-common</artifactId> - <version>${bladex.project.version}</version> + <artifactId>blade-core-auto</artifactId> + <version>${bladex.tool.version}</version> + <scope>provided</scope> + </dependency> + <!-- 工作流 --> + <dependency> + <groupId>org.flowable</groupId> + <artifactId>flowable-spring-boot-starter</artifactId> + <version>${flowable.version}</version> </dependency> </dependencies> diff --git a/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/business/controller/ExpenseController.java b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/business/controller/ExpenseController.java new file mode 100644 index 00000000..2bd03606 --- /dev/null +++ b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/business/controller/ExpenseController.java @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package org.springblade.flowable.business.controller; + +import lombok.AllArgsConstructor; +import org.flowable.bpmn.model.BpmnModel; +import org.flowable.engine.*; +import org.flowable.engine.runtime.Execution; +import org.flowable.engine.runtime.ProcessInstance; +import org.flowable.image.ProcessDiagramGenerator; +import org.flowable.task.api.Task; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * 报销控制器 + * + * @author Chill + */ +@Controller +@AllArgsConstructor +@RequestMapping(value = "expense") +public class ExpenseController { + + private RuntimeService runtimeService; + + private TaskService taskService; + + private RepositoryService repositoryService; + + private ProcessEngine processEngine; + + /** + * 添加报销 + * + * @param userId 用户Id + * @param money 报销金额 + * @param descption 描述 + */ + @RequestMapping(value = "add") + @ResponseBody + public String addExpense(String userId, Integer money, String descption) { + //启动流程 + HashMap<String, Object> map = new HashMap<>(); + map.put("taskUser", userId); + map.put("money", money); + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Expense", map); + return "提交成功.流程Id为:" + processInstance.getId(); + } + + /** + * 获取审批管理列表 + */ + @RequestMapping(value = "/list") + @ResponseBody + public Object list(String userId) { + List<Task> tasks = taskService.createTaskQuery().taskAssignee(userId).orderByTaskCreateTime().desc().list(); + for (Task task : tasks) { + System.out.println(task.toString()); + } + return tasks.toArray().toString(); + } + + /** + * 批准 + * + * @param taskId 任务ID + */ + @RequestMapping(value = "apply") + @ResponseBody + public String apply(String taskId) { + Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); + if (task == null) { + throw new RuntimeException("流程不存在"); + } + //通过审核 + HashMap<String, Object> map = new HashMap<>(); + map.put("outcome", "通过"); + taskService.complete(taskId, map); + return "processed ok!"; + } + + /** + * 拒绝 + */ + @ResponseBody + @RequestMapping(value = "reject") + public String reject(String taskId) { + HashMap<String, Object> map = new HashMap<>(); + map.put("outcome", "驳回"); + taskService.complete(taskId, map); + return "reject"; + } + + /** + * 生成流程图 + * + * @param processId 任务ID + */ + @RequestMapping(value = "processDiagram") + public void genProcessDiagram(HttpServletResponse httpServletResponse, String processId) throws Exception { + ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processId).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(); + } + } + } +} diff --git a/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/business/handler/BossTaskHandler.java b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/business/handler/BossTaskHandler.java new file mode 100644 index 00000000..009dee99 --- /dev/null +++ b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/business/handler/BossTaskHandler.java @@ -0,0 +1,19 @@ +package org.springblade.flowable.business.handler; + + +import org.flowable.engine.delegate.TaskListener; +import org.flowable.task.service.delegate.DelegateTask; + +/** + * 老板处理器 + * + * @author Chill + */ +public class BossTaskHandler implements TaskListener { + + @Override + public void notify(DelegateTask delegateTask) { + delegateTask.setAssignee("老板"); + } + +} diff --git a/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/business/handler/ManagerTaskHandler.java b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/business/handler/ManagerTaskHandler.java new file mode 100644 index 00000000..eeebcb60 --- /dev/null +++ b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/business/handler/ManagerTaskHandler.java @@ -0,0 +1,18 @@ +package org.springblade.flowable.business.handler; + +import org.flowable.engine.delegate.TaskListener; +import org.flowable.task.service.delegate.DelegateTask; + +/** + * 经理处理器 + * + * @author Chill + */ +public class ManagerTaskHandler implements TaskListener { + + @Override + public void notify(DelegateTask delegateTask) { + delegateTask.setAssignee("经理"); + } + +} diff --git a/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/engine/config/FlowableConfiguration.java b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/engine/config/FlowableConfiguration.java new file mode 100644 index 00000000..fa453234 --- /dev/null +++ b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/engine/config/FlowableConfiguration.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package org.springblade.flowable.engine.config; + +import lombok.AllArgsConstructor; +import org.flowable.spring.SpringProcessEngineConfiguration; +import org.flowable.spring.boot.EngineConfigurationConfigurer; +import org.flowable.spring.boot.FlowableProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +/** + * Flowable配置类 + * + * @author Chill + */ +@Configuration +@AllArgsConstructor +@EnableConfigurationProperties(FlowableProperties.class) +public class FlowableConfiguration implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> { + private FlowableProperties flowableProperties; + + @Override + public void configure(SpringProcessEngineConfiguration engineConfiguration) { + engineConfiguration.setActivityFontName(flowableProperties.getActivityFontName()); + engineConfiguration.setLabelFontName(flowableProperties.getLabelFontName()); + engineConfiguration.setAnnotationFontName(flowableProperties.getAnnotationFontName()); + } +} diff --git a/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/engine/controller/FlowManagerController.java b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/engine/controller/FlowManagerController.java new file mode 100644 index 00000000..e2308f1e --- /dev/null +++ b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/engine/controller/FlowManagerController.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package org.springblade.flowable.engine.controller; + +/** + * 流程管理接口 + * + * @author Chill + */ +public class FlowManagerController { +} diff --git a/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/engine/controller/FlowModelController.java b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/engine/controller/FlowModelController.java new file mode 100644 index 00000000..cb76bce9 --- /dev/null +++ b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/engine/controller/FlowModelController.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package org.springblade.flowable.engine.controller; + +/** + * 流程模型控制器 + * + * @author Chill + */ +public class FlowModelController { +} diff --git a/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/engine/entity/ProcessDefinition.java b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/engine/entity/ProcessDefinition.java new file mode 100644 index 00000000..2f9525c8 --- /dev/null +++ b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/engine/entity/ProcessDefinition.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package org.springblade.flowable.engine.entity; + +import lombok.Data; +import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntityImpl; + +import java.io.Serializable; +import java.util.Date; + +/** + * ProcessDefinition + * + * @author Chill + */ +@Data +public class ProcessDefinition implements Serializable { + + private String id; + private String name; + private String key; + private String category; + private String categoryName; + private Integer version; + private String deploymentId; + private String resourceName; + private String diagramResourceName; + private Integer suspensionState; + private Date deploymentTime; + + public ProcessDefinition(ProcessDefinitionEntityImpl entity) { + this.id = entity.getId(); + this.name = entity.getName(); + this.key = entity.getKey(); + this.category = entity.getCategory(); + this.categoryName = ""; + this.version = entity.getVersion(); + this.deploymentId = entity.getDeploymentId(); + this.resourceName = entity.getResourceName(); + this.diagramResourceName = entity.getDiagramResourceName(); + this.suspensionState = entity.getSuspensionState(); + } + +} diff --git a/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/launch/FlowableLauncherServiceImpl.java b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/launch/FlowableLauncherServiceImpl.java new file mode 100644 index 00000000..b0c54dcd --- /dev/null +++ b/blade-ops/blade-flowable/src/main/java/org/springblade/flowable/launch/FlowableLauncherServiceImpl.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package org.springblade.flowable.launch; + +import org.springblade.core.auto.service.AutoService; +import org.springblade.core.launch.constant.NacosConstant; +import org.springblade.core.launch.service.LauncherService; +import org.springframework.boot.builder.SpringApplicationBuilder; + +import java.util.Properties; + +/** + * 启动参数拓展 + * + * @author smallchil + */ +@AutoService(LauncherService.class) +public class FlowableLauncherServiceImpl implements LauncherService { + + @Override + public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) { + Properties props = System.getProperties(); + props.setProperty("spring.cloud.nacos.config.ext-config[0].data-id", NacosConstant.dataId(appName, profile)); + props.setProperty("spring.cloud.nacos.config.ext-config[0].group", NacosConstant.NACOS_CONFIG_GROUP); + props.setProperty("spring.cloud.nacos.config.ext-config[0].refresh", NacosConstant.NACOS_CONFIG_REFRESH); + } + +} diff --git a/blade-ops/blade-flowable/src/main/resources/application-dev.yml b/blade-ops/blade-flowable/src/main/resources/application-dev.yml index 83eab198..f216bb2a 100644 --- a/blade-ops/blade-flowable/src/main/resources/application-dev.yml +++ b/blade-ops/blade-flowable/src/main/resources/application-dev.yml @@ -5,6 +5,6 @@ server: #数据源配置 spring: datasource: - url: ${blade.datasource.dev.url} - username: ${blade.datasource.dev.username} - password: ${blade.datasource.dev.password} + url: ${blade.datasource.flow.dev.url} + username: ${blade.datasource.flow.dev.username} + password: ${blade.datasource.flow.dev.password} diff --git a/blade-ops/blade-flowable/src/main/resources/application-prod.yml b/blade-ops/blade-flowable/src/main/resources/application-prod.yml index 3665ecfe..6dd671b5 100644 --- a/blade-ops/blade-flowable/src/main/resources/application-prod.yml +++ b/blade-ops/blade-flowable/src/main/resources/application-prod.yml @@ -5,6 +5,6 @@ server: #数据源配置 spring: datasource: - url: ${blade.datasource.prod.url} - username: ${blade.datasource.prod.username} - password: ${blade.datasource.prod.password} + url: ${blade.datasource.flow.prod.url} + username: ${blade.datasource.flow.prod.username} + password: ${blade.datasource.flow.prod.password} diff --git a/blade-ops/blade-flowable/src/main/resources/application-test.yml b/blade-ops/blade-flowable/src/main/resources/application-test.yml index 3e83be8f..1ba9049f 100644 --- a/blade-ops/blade-flowable/src/main/resources/application-test.yml +++ b/blade-ops/blade-flowable/src/main/resources/application-test.yml @@ -5,6 +5,6 @@ server: #数据源配置 spring: datasource: - url: ${blade.datasource.test.url} - username: ${blade.datasource.test.username} - password: ${blade.datasource.test.password} + url: ${blade.datasource.flow.test.url} + username: ${blade.datasource.flow.test.username} + password: ${blade.datasource.flow.test.password} diff --git a/blade-ops/blade-flowable/src/main/resources/application.yml b/blade-ops/blade-flowable/src/main/resources/application.yml new file mode 100644 index 00000000..5af24db9 --- /dev/null +++ b/blade-ops/blade-flowable/src/main/resources/application.yml @@ -0,0 +1,6 @@ +flowable: + async-executor-activate: false + activity-font-name: \u5B8B\u4F53 + label-font-name: \u5B8B\u4F53 + annotation-font-name: \u5B8B\u4F53 + check-process-definitions: false diff --git a/blade-ops/blade-flowable/src/main/resources/processes/ExpenseProcess.bpmn20.xml b/blade-ops/blade-flowable/src/main/resources/processes/ExpenseProcess.bpmn20.xml new file mode 100644 index 00000000..a779d37b --- /dev/null +++ b/blade-ops/blade-flowable/src/main/resources/processes/ExpenseProcess.bpmn20.xml @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8"?> +<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" + xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" + typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" + targetNamespace="http://www.flowable.org/processdef"> + <process id="Expense" name="ExpenseProcess" isExecutable="true"> + <documentation>报销流程</documentation> + <startEvent id="start" name="开始"></startEvent> + <userTask id="fillTask" name="出差报销" flowable:assignee="${taskUser}"> + <extensionElements> + <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"> + <![CDATA[false]]></modeler:initiator-can-complete> + </extensionElements> + </userTask> + <exclusiveGateway id="judgeTask"></exclusiveGateway> + <userTask id="directorTak" name="经理审批"> + <extensionElements> + <flowable:taskListener event="create" + class="org.springblade.flowable.business.handler.ManagerTaskHandler"></flowable:taskListener> + </extensionElements> + </userTask> + <userTask id="bossTask" name="老板审批"> + <extensionElements> + <flowable:taskListener event="create" + class="org.springblade.flowable.business.handler.BossTaskHandler"></flowable:taskListener> + </extensionElements> + </userTask> + <endEvent id="end" name="结束"></endEvent> + <sequenceFlow id="directorNotPassFlow" name="驳回" sourceRef="directorTak" targetRef="fillTask"> + <conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='驳回'}]]></conditionExpression> + </sequenceFlow> + <sequenceFlow id="bossNotPassFlow" name="驳回" sourceRef="bossTask" targetRef="fillTask"> + <conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='驳回'}]]></conditionExpression> + </sequenceFlow> + <sequenceFlow id="flow1" sourceRef="start" targetRef="fillTask"></sequenceFlow> + <sequenceFlow id="flow2" sourceRef="fillTask" targetRef="judgeTask"></sequenceFlow> + <sequenceFlow id="judgeMore" name="大于500元" sourceRef="judgeTask" targetRef="bossTask"> + <conditionExpression xsi:type="tFormalExpression"><![CDATA[${money > 500}]]></conditionExpression> + </sequenceFlow> + <sequenceFlow id="bossPassFlow" name="通过" sourceRef="bossTask" targetRef="end"> + <conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='通过'}]]></conditionExpression> + </sequenceFlow> + <sequenceFlow id="directorPassFlow" name="通过" sourceRef="directorTak" targetRef="end"> + <conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='通过'}]]></conditionExpression> + </sequenceFlow> + <sequenceFlow id="judgeLess" name="小于500元" sourceRef="judgeTask" targetRef="directorTak"> + <conditionExpression xsi:type="tFormalExpression"><![CDATA[${money <= 500}]]></conditionExpression> + </sequenceFlow> + </process> + <bpmndi:BPMNDiagram id="BPMNDiagram_Expense"> + <bpmndi:BPMNPlane bpmnElement="Expense" id="BPMNPlane_Expense"> + <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start"> + <omgdc:Bounds height="30.0" width="30.0" x="285.0" y="135.0"></omgdc:Bounds> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape bpmnElement="fillTask" id="BPMNShape_fillTask"> + <omgdc:Bounds height="80.0" width="100.0" x="405.0" y="110.0"></omgdc:Bounds> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape bpmnElement="judgeTask" id="BPMNShape_judgeTask"> + <omgdc:Bounds height="40.0" width="40.0" x="585.0" y="130.0"></omgdc:Bounds> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape bpmnElement="directorTak" id="BPMNShape_directorTak"> + <omgdc:Bounds height="80.0" width="100.0" x="735.0" y="110.0"></omgdc:Bounds> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape bpmnElement="bossTask" id="BPMNShape_bossTask"> + <omgdc:Bounds height="80.0" width="100.0" x="555.0" y="255.0"></omgdc:Bounds> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end"> + <omgdc:Bounds height="28.0" width="28.0" x="771.0" y="281.0"></omgdc:Bounds> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1"> + <omgdi:waypoint x="315.0" y="150.0"></omgdi:waypoint> + <omgdi:waypoint x="405.0" y="150.0"></omgdi:waypoint> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2"> + <omgdi:waypoint x="505.0" y="150.16611295681062"></omgdi:waypoint> + <omgdi:waypoint x="585.4333333333333" y="150.43333333333334"></omgdi:waypoint> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge bpmnElement="judgeLess" id="BPMNEdge_judgeLess"> + <omgdi:waypoint x="624.5530726256983" y="150.44692737430168"></omgdi:waypoint> + <omgdi:waypoint x="735.0" y="150.1392757660167"></omgdi:waypoint> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge bpmnElement="directorNotPassFlow" id="BPMNEdge_directorNotPassFlow"> + <omgdi:waypoint x="785.0" y="110.0"></omgdi:waypoint> + <omgdi:waypoint x="785.0" y="37.0"></omgdi:waypoint> + <omgdi:waypoint x="455.0" y="37.0"></omgdi:waypoint> + <omgdi:waypoint x="455.0" y="110.0"></omgdi:waypoint> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge bpmnElement="bossPassFlow" id="BPMNEdge_bossPassFlow"> + <omgdi:waypoint x="655.0" y="295.0"></omgdi:waypoint> + <omgdi:waypoint x="771.0" y="295.0"></omgdi:waypoint> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge bpmnElement="judgeMore" id="BPMNEdge_judgeMore"> + <omgdi:waypoint x="605.4340277777778" y="169.56597222222223"></omgdi:waypoint> + <omgdi:waypoint x="605.1384083044983" y="255.0"></omgdi:waypoint> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge bpmnElement="directorPassFlow" id="BPMNEdge_directorPassFlow"> + <omgdi:waypoint x="785.0" y="190.0"></omgdi:waypoint> + <omgdi:waypoint x="785.0" y="281.0"></omgdi:waypoint> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge bpmnElement="bossNotPassFlow" id="BPMNEdge_bossNotPassFlow"> + <omgdi:waypoint x="555.0" y="295.0"></omgdi:waypoint> + <omgdi:waypoint x="455.0" y="295.0"></omgdi:waypoint> + <omgdi:waypoint x="455.0" y="190.0"></omgdi:waypoint> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</definitions> diff --git a/blade-ops/blade-flowdesign/pom.xml b/blade-ops/blade-flowdesign/pom.xml index 327789ce..985c7b1c 100644 --- a/blade-ops/blade-flowdesign/pom.xml +++ b/blade-ops/blade-flowdesign/pom.xml @@ -36,16 +36,40 @@ <dependency> <groupId>org.liquibase</groupId> <artifactId>liquibase-core</artifactId> + <exclusions> + <exclusion> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + </exclusion> + <exclusion> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.flowable</groupId> - <artifactId>flowable-spring-boot-starter-process</artifactId> + <artifactId>flowable-spring-boot-starter</artifactId> <version>${flowable.version}</version> </dependency> <dependency> <groupId>org.flowable</groupId> <artifactId>flowable-ui-modeler-rest</artifactId> <version>${flowable.version}</version> + <exclusions> + <exclusion> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>jul-to-slf4j</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>mysql</groupId> diff --git a/blade-ops/blade-flowdesign/src/main/java/org/springblade/flowable/config/FlowableAutoConfiguration.java b/blade-ops/blade-flowdesign/src/main/java/org/springblade/flowable/config/FlowableAutoConfiguration.java index c33ab38d..702d38d5 100644 --- a/blade-ops/blade-flowdesign/src/main/java/org/springblade/flowable/config/FlowableAutoConfiguration.java +++ b/blade-ops/blade-flowdesign/src/main/java/org/springblade/flowable/config/FlowableAutoConfiguration.java @@ -16,27 +16,12 @@ */ package org.springblade.flowable.config; -import org.flowable.common.engine.impl.cfg.IdGenerator; -import org.flowable.job.service.impl.asyncexecutor.AsyncExecutor; +import lombok.AllArgsConstructor; import org.flowable.spring.SpringProcessEngineConfiguration; -import org.flowable.spring.boot.FlowableMailProperties; +import org.flowable.spring.boot.EngineConfigurationConfigurer; import org.flowable.spring.boot.FlowableProperties; -import org.flowable.spring.boot.ProcessEngineAutoConfiguration; -import org.flowable.spring.boot.app.FlowableAppProperties; -import org.flowable.spring.boot.idm.FlowableIdmProperties; -import org.flowable.spring.boot.process.FlowableProcessProperties; -import org.flowable.spring.boot.process.Process; -import org.flowable.spring.boot.process.ProcessAsync; -import org.flowable.spring.boot.process.ProcessAsyncHistory; -import org.springframework.beans.factory.ObjectProvider; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.PlatformTransactionManager; - -import javax.sql.DataSource; -import java.io.IOException; /** * flowable配置 @@ -44,29 +29,15 @@ import java.io.IOException; * @author Chill */ @Configuration +@AllArgsConstructor @EnableConfigurationProperties(FlowableProperties.class) -public class FlowableAutoConfiguration extends ProcessEngineAutoConfiguration { - - @Autowired +public class FlowableAutoConfiguration implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> { private FlowableProperties flowableProperties; - public FlowableAutoConfiguration(FlowableProperties flowableProperties, - FlowableProcessProperties processProperties, FlowableAppProperties appProperties, FlowableIdmProperties idmProperties, - FlowableMailProperties mailProperties) { - super(flowableProperties, processProperties, appProperties, idmProperties, mailProperties); + @Override + public void configure(SpringProcessEngineConfiguration engineConfiguration) { + engineConfiguration.setActivityFontName(flowableProperties.getActivityFontName()); + engineConfiguration.setLabelFontName(flowableProperties.getLabelFontName()); + engineConfiguration.setAnnotationFontName(flowableProperties.getAnnotationFontName()); } - - @Bean - public SpringProcessEngineConfiguration springProcessEngineConfiguration(DataSource dataSource, PlatformTransactionManager platformTransactionManager, - @Process ObjectProvider<IdGenerator> processIdGenerator, - ObjectProvider<IdGenerator> globalIdGenerator, - @ProcessAsync ObjectProvider<AsyncExecutor> asyncExecutorProvider, - @ProcessAsyncHistory ObjectProvider<AsyncExecutor> asyncHistoryExecutorProvider) throws IOException { - SpringProcessEngineConfiguration conf = super.springProcessEngineConfiguration(dataSource, platformTransactionManager, processIdGenerator, globalIdGenerator, asyncExecutorProvider, asyncHistoryExecutorProvider); - conf.setActivityFontName(flowableProperties.getActivityFontName()); - conf.setLabelFontName(flowableProperties.getLabelFontName()); - conf.setAnnotationFontName(flowableProperties.getAnnotationFontName()); - return conf; - } - } diff --git a/blade-ops/blade-flowdesign/src/main/resources/application-dev.yml b/blade-ops/blade-flowdesign/src/main/resources/application-dev.yml index 41d85e08..c08170d9 100644 --- a/blade-ops/blade-flowdesign/src/main/resources/application-dev.yml +++ b/blade-ops/blade-flowdesign/src/main/resources/application-dev.yml @@ -1,7 +1,7 @@ #数据源配置 spring: datasource: - url: jdbc:mysql://localhost:3306/bladex-flow?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true + url: jdbc:mysql://localhost:3306/bladex-flowable?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true username: root password: root driver-class-name: com.mysql.cj.jdbc.Driver diff --git a/blade-ops/blade-flowdesign/src/main/resources/application-prod.yml b/blade-ops/blade-flowdesign/src/main/resources/application-prod.yml index 41d85e08..c08170d9 100644 --- a/blade-ops/blade-flowdesign/src/main/resources/application-prod.yml +++ b/blade-ops/blade-flowdesign/src/main/resources/application-prod.yml @@ -1,7 +1,7 @@ #数据源配置 spring: datasource: - url: jdbc:mysql://localhost:3306/bladex-flow?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true + url: jdbc:mysql://localhost:3306/bladex-flowable?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true username: root password: root driver-class-name: com.mysql.cj.jdbc.Driver diff --git a/blade-ops/blade-flowdesign/src/main/resources/application-test.yml b/blade-ops/blade-flowdesign/src/main/resources/application-test.yml index 41d85e08..c08170d9 100644 --- a/blade-ops/blade-flowdesign/src/main/resources/application-test.yml +++ b/blade-ops/blade-flowdesign/src/main/resources/application-test.yml @@ -1,7 +1,7 @@ #数据源配置 spring: datasource: - url: jdbc:mysql://localhost:3306/bladex-flow?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true + url: jdbc:mysql://localhost:3306/bladex-flowable?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true username: root password: root driver-class-name: com.mysql.cj.jdbc.Driver diff --git a/blade-service/pom.xml b/blade-service/pom.xml index 20395d02..10415f96 100644 --- a/blade-service/pom.xml +++ b/blade-service/pom.xml @@ -34,6 +34,11 @@ <artifactId>blade-starter-tenant</artifactId> <version>${bladex.tool.version}</version> </dependency> + <!--<dependency> + <groupId>org.springblade</groupId> + <artifactId>blade-starter-redis</artifactId> + <version>${bladex.tool.version}</version> + </dependency>--> </dependencies> <build> diff --git a/doc/nacos/blade-flowable-dev.yaml b/doc/nacos/blade-flowable-dev.yaml new file mode 100644 index 00000000..73091ab0 --- /dev/null +++ b/doc/nacos/blade-flowable-dev.yaml @@ -0,0 +1,9 @@ +#项目模块集中配置 +blade: + #工作流模块开发生产环境数据库地址 + datasource: + flow: + dev: + url: jdbc:mysql://localhost:3306/bladex-flowable?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true + username: root + password: root diff --git a/pom.xml b/pom.xml index 3bdc5b85..c4e4cf15 100644 --- a/pom.xml +++ b/pom.xml @@ -101,6 +101,7 @@ <artifactId>spring-boot-maven-plugin</artifactId> <version>${spring.boot.version}</version> <configuration> + <fork>true</fork> <finalName>${project.build.finalName}</finalName> </configuration> <executions>