From 3f5737664d799ece89224079860505a009dec32b Mon Sep 17 00:00:00 2001 From: lyh <liuyuanheng@xalxzn.com> Date: 星期一, 24 二月 2025 09:29:47 +0800 Subject: [PATCH] 去除原有activiti 新增flowable工作流 --- lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusiness.java | 113 + lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusiness.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/service/IFlowThirdService.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/FlowMyBusinessMapper.java | 14 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/CustomProcessDiagramGenerator.java | 402 +++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java | 42 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.java | 14 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowNextDto.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/IFlowTaskService.java | 172 + lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/service/FlowCallBackServiceI.java | 46 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/controller/FlowTaskController.java | 219 + lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/FlowableUtils.java | 587 +++++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java | 34 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/service/FlowCommonService.java | 86 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/SysCategory.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/IFlowDefinitionService.java | 97 lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java | 4 lxzn-module-flowable/pom.xml | 52 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/listener/UserTaskListener.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/SysRole.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowCommentDto$FlowCommentDtoBuilder.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/mapper/FlowMyBusinessMapper.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowInstanceServiceImpl.java | 187 + lxzn-module-system/lxzn-system-start/src/main/java/org/jeecg/JeecgSystemApplication.java | 4 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/SysUser.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/FlowableConfig.java | 21 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/SysUser.java | 138 + lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowViewerDto.java | 15 lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml | 38 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/impl/FlowInstanceServiceImpl.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/service/FlowCommonService.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/CustomProcessDiagramGenerator.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/config/MyDefaultProcessDiagramCanvas.class | 0 pom.xml | 4 lxzn-module-system/lxzn-system-start/pom.xml | 4 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml | 5 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowProcDefDto.java | 56 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/IFlowDefinitionService.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowSaveXmlVo.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java | 1429 ++++++++++++ lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/ActStatus.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/controller/FlowTaskController.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/IFlowTaskService.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/impl/FlowDefinitionServiceImpl.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml | 5 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowNextDto.java | 24 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/FindNextNodeUtil.java | 235 ++ lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/IFlowInstanceService.java | 58 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/controller/FlowInstanceController.java | 63 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/SysRole.java | 27 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/FlowableUtils.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java | 27 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/factory/FlowServiceFactory.java | 42 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/service/IFlowThirdService.java | 56 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/common/constant/ProcessConstants.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/controller/FlowDefinitionController.class | 0 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java | 156 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/FlowBeforeParams.java | 20 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/FlowBeforeParams.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusinessDto.java | 100 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowViewerDto.class | 0 lxzn-boot-base-core/pom.xml | 6 lxzn-module-dnc/pom.xml | 4 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/CustomProcessDiagramCanvas.java | 369 +++ lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/common/exception/CustomException.java | 42 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/vo/FlowTaskVo.java | 48 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/service/FlowCallBackServiceI.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/controller/FlowInstanceController.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/common/enums/FlowComment.java | 41 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/ActStatus.java | 17 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/factory/FlowServiceFactory.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusinessDto.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/FindNextNodeUtil.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/controller/FlowDefinitionController.java | 243 ++ lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/FlowableConfig.class | 0 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/flow/FlowThirdServiceImpl.java | 112 + lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowCommentDto.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/vo/FlowTaskVo.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/IFlowInstanceService.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/common/constant/ProcessConstants.java | 77 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowProcDefDto.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java | 95 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowDefinitionServiceImpl.java | 406 +++ lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/SysCategory.java | 24 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/CustomProcessDiagramCanvas.class | 0 lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/common/exception/CustomException.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowCommentDto.java | 24 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/listener/UserTaskListener.java | 16 lxzn-module-flowable/src/main/java/org/jeecg/JeecgFlowableCloudApplication.java | 14 lxzn-module-system/lxzn-system-biz/pom.xml | 18 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowSaveXmlVo.java | 27 /dev/null | 273 -- lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/common/enums/FlowComment.class | 0 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/config/MyDefaultProcessDiagramCanvas.java | 92 98 files changed, 6,117 insertions(+), 427 deletions(-) diff --git a/lxzn-boot-base-core/pom.xml b/lxzn-boot-base-core/pom.xml index d956bcc..7973bef 100644 --- a/lxzn-boot-base-core/pom.xml +++ b/lxzn-boot-base-core/pom.xml @@ -98,8 +98,8 @@ <!-- sqlserver--> <dependency> <groupId>com.microsoft.sqlserver</groupId> - <artifactId>sqljdbc4</artifactId> - <version>${sqljdbc4.version}</version> + <artifactId>mssql-jdbc</artifactId> + <version>${mssql-jdbc.version}</version> <scope>runtime</scope> </dependency> <!-- oracle椹卞姩 --> @@ -221,4 +221,4 @@ </dependency> </dependencies> -</project> \ No newline at end of file +</project> diff --git a/lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java b/lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java index 10a77f0..e2c3bbe 100644 --- a/lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java +++ b/lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java @@ -132,7 +132,7 @@ .apiInfo(apiInfo()) .select() //姝ゅ寘璺緞涓嬬殑绫伙紝鎵嶇敓鎴愭帴鍙f枃妗� - .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.activiti")) + .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.flowable")) //鍔犱簡ApiOperation娉ㄨВ鐨勭被锛屾墠鐢熸垚鎺ュ彛鏂囨。 .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) @@ -141,7 +141,7 @@ .securitySchemes(Collections.singletonList(securityScheme())) .securityContexts(securityContexts()) .globalOperationParameters(setHeaderToken()) - .groupName("Activiti妯″潡"); + .groupName("Flowable妯″潡"); } /*** diff --git a/lxzn-module-activiti/pom.xml b/lxzn-module-activiti/pom.xml deleted file mode 100644 index f837685..0000000 --- a/lxzn-module-activiti/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>lxzn-boot-parent</artifactId> - <groupId>org.jeecgframework.boot</groupId> - <version>3.4.3</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>lxzn-module-activiti</artifactId> - - <dependencies> - <dependency> - <groupId>org.jeecgframework.boot</groupId> - <artifactId>lxzn-boot-base-core</artifactId> - </dependency> - <dependency> - <groupId>org.jeecgframework.boot</groupId> - <artifactId>lxzn-system-biz</artifactId> - </dependency> - - <!--activiti 娴佺▼寮曟搸--> - <dependency> - <groupId>org.activiti</groupId> - <artifactId>activiti-spring-boot-starter-basic</artifactId> - <version>6.0.0</version> - <exclusions> - <exclusion> - <groupId>org.mybatis</groupId> - <artifactId>mybatis</artifactId> - </exclusion> - <exclusion> - <groupId>com.sun.mail</groupId> - <artifactId>javax.mail</artifactId> - </exclusion> - </exclusions> - </dependency> - <!--activiti 娴佺▼寮曟搸--> - - <dependency> - <groupId>cn.hutool</groupId> - <artifactId>hutool-all</artifactId> - <version>5.3.8</version> - </dependency> - </dependencies> - -</project> diff --git a/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/AbstractQuery.java b/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/AbstractQuery.java deleted file mode 100644 index aa5c5e4..0000000 --- a/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/AbstractQuery.java +++ /dev/null @@ -1,212 +0,0 @@ -package org.activiti.engine.impl; - -// -// Source code recreated from a .class file by IntelliJ IDEA -// (powered by FernFlower decompiler) -// - -import org.activiti.engine.ActivitiException; -import org.activiti.engine.ActivitiIllegalArgumentException; -import org.activiti.engine.ManagementService; -import org.activiti.engine.impl.context.Context; -import org.activiti.engine.impl.db.ListQueryParameterObject; -import org.activiti.engine.impl.interceptor.Command; -import org.activiti.engine.impl.interceptor.CommandContext; -import org.activiti.engine.impl.interceptor.CommandExecutor; -import org.activiti.engine.query.Query; -import org.activiti.engine.query.QueryProperty; - -import java.io.Serializable; -import java.util.List; - -public abstract class AbstractQuery<T extends Query<?, ?>, U> extends ListQueryParameterObject implements Command<Object>, Query<T, U>, Serializable { - private static final long serialVersionUID = 1L; - public static final String SORTORDER_ASC = "asc"; - public static final String SORTORDER_DESC = "desc"; - protected transient CommandExecutor commandExecutor; - protected transient CommandContext commandContext; - protected String databaseType; - protected String orderBy; - protected ResultType resultType; - protected QueryProperty orderProperty; - protected NullHandlingOnOrder nullHandlingOnOrder; - - protected AbstractQuery() { - this.parameter = this; - } - - protected AbstractQuery(CommandExecutor commandExecutor) { - this.commandExecutor = commandExecutor; - } - - public AbstractQuery(CommandContext commandContext) { - this.commandContext = commandContext; - } - - public AbstractQuery(ManagementService managementService) { - this(((ManagementServiceImpl)managementService).getCommandExecutor()); - } - - public AbstractQuery<T, U> setCommandExecutor(CommandExecutor commandExecutor) { - this.commandExecutor = commandExecutor; - return this; - } - - public T orderBy(QueryProperty property) { - this.orderProperty = property; - return (T) this; - } - - public T orderBy(QueryProperty property, NullHandlingOnOrder nullHandlingOnOrder) { - this.orderBy(property); - this.nullHandlingOnOrder = nullHandlingOnOrder; - return (T) this; - } - - public T asc() { - return this.direction(Direction.ASCENDING); - } - - public T desc() { - return this.direction(Direction.DESCENDING); - } - - public T direction(Direction direction) { - if (this.orderProperty == null) { - throw new ActivitiIllegalArgumentException("You should call any of the orderBy methods first before specifying a direction"); - } else { - this.addOrder(this.orderProperty.getName(), direction.getName(), this.nullHandlingOnOrder); - this.orderProperty = null; - this.nullHandlingOnOrder = null; - return (T) this; - } - } - - protected void checkQueryOk() { - if (this.orderProperty != null) { - throw new ActivitiIllegalArgumentException("Invalid query: call asc() or desc() after using orderByXX()"); - } - } - - public U singleResult() { - this.resultType = ResultType.SINGLE_RESULT; - return this.commandExecutor != null ? (U) this.commandExecutor.execute(this) : this.executeSingleResult(Context.getCommandContext()); - } - - public List<U> list() { - this.resultType = ResultType.LIST; - return this.commandExecutor != null ? (List)this.commandExecutor.execute(this) : this.executeList(Context.getCommandContext(), (Page)null); - } - - public List<U> listPage(int firstResult, int maxResults) { - this.firstResult = firstResult; - this.maxResults = maxResults; - this.resultType = ResultType.LIST_PAGE; - return this.commandExecutor != null ? (List)this.commandExecutor.execute(this) : this.executeList(Context.getCommandContext(), new Page(firstResult, maxResults)); - } - - public long count() { - this.resultType = ResultType.COUNT; - return this.commandExecutor != null ? (Long)this.commandExecutor.execute(this) : this.executeCount(Context.getCommandContext()); - } - - public Object execute(CommandContext commandContext) { - if (this.resultType == ResultType.LIST) { - return this.executeList(commandContext, (Page)null); - } else if (this.resultType == ResultType.SINGLE_RESULT) { - return this.executeSingleResult(commandContext); - } else { - return this.resultType == ResultType.LIST_PAGE ? this.executeList(commandContext, (Page)null) : this.executeCount(commandContext); - } - } - - public abstract long executeCount(CommandContext var1); - - public abstract List<U> executeList(CommandContext var1, Page var2); - - public U executeSingleResult(CommandContext commandContext) { - List<U> results = this.executeList(commandContext, (Page)null); - if (results.size() == 1) { - return results.get(0); - } else if (results.size() > 1) { - throw new ActivitiException("Query return " + results.size() + " results instead of max 1"); - } else { - return null; - } - } - - protected void addOrder(String column, String sortOrder, NullHandlingOnOrder nullHandlingOnOrder) { - if (this.orderBy == null) { - this.orderBy = ""; - } else { - this.orderBy = this.orderBy + ", "; - } - - String defaultOrderByClause = column + " " + sortOrder; - if (nullHandlingOnOrder != null) { - if (nullHandlingOnOrder.equals(NullHandlingOnOrder.NULLS_FIRST)) { - if (!"h2".equals(this.databaseType) && !"hsql".equals(this.databaseType) && !"postgres".equals(this.databaseType) && !"oracle".equals(this.databaseType)) { - if ("mysql".equals(this.databaseType)) { - this.orderBy = this.orderBy + "isnull(" + column + ") desc," + defaultOrderByClause; - } else if (!"db2".equals(this.databaseType) && !"mssql".equals(this.databaseType)) { - this.orderBy = this.orderBy + defaultOrderByClause; - } else { - this.orderBy = this.orderBy + "case when " + column + " is null then 0 else 1 end," + defaultOrderByClause; - } - } else { - this.orderBy = this.orderBy + defaultOrderByClause + " NULLS FIRST"; - } - } else if (nullHandlingOnOrder.equals(NullHandlingOnOrder.NULLS_LAST)) { - if (!"h2".equals(this.databaseType) && !"hsql".equals(this.databaseType) && !"postgres".equals(this.databaseType) && !"oracle".equals(this.databaseType)) { - if ("mysql".equals(this.databaseType)) { - this.orderBy = this.orderBy + "isnull(" + column + ") asc," + defaultOrderByClause; - } else if (!"db2".equals(this.databaseType) && !"mssql".equals(this.databaseType)) { - this.orderBy = this.orderBy + defaultOrderByClause; - } else { - this.orderBy = this.orderBy + "case when " + column + " is null then 1 else 0 end," + defaultOrderByClause; - } - } else { - this.orderBy = this.orderBy + column + " " + sortOrder + " NULLS LAST"; - } - } - } else { - this.orderBy = this.orderBy + defaultOrderByClause; - } - - } - - public String getOrderBy() { - return this.orderBy == null ? super.getOrderBy() : this.orderBy; - } - - public String getOrderByColumns() { - return this.getOrderBy(); - } - - public String getDatabaseType() { - return this.databaseType; - } - - public void setDatabaseType(String databaseType) { - this.databaseType = databaseType; - } - - public static enum NullHandlingOnOrder { - NULLS_FIRST, - NULLS_LAST; - - private NullHandlingOnOrder() { - } - } - - private static enum ResultType { - LIST, - LIST_PAGE, - SINGLE_RESULT, - COUNT; - - private ResultType() { - } - } -} - diff --git a/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java b/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java deleted file mode 100644 index c676ee7..0000000 --- a/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java +++ /dev/null @@ -1,3541 +0,0 @@ -// -// Source code recreated from a .class file by IntelliJ IDEA -// (powered by FernFlower decompiler) -// - -package org.activiti.engine.impl.cfg; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.activiti.dmn.api.DmnRepositoryService; -import org.activiti.dmn.api.DmnRuleService; -import org.activiti.engine.*; -import org.activiti.engine.cfg.ProcessEngineConfigurator; -import org.activiti.engine.compatibility.Activiti5CompatibilityHandler; -import org.activiti.engine.compatibility.Activiti5CompatibilityHandlerFactory; -import org.activiti.engine.compatibility.DefaultActiviti5CompatibilityHandlerFactory; -import org.activiti.engine.delegate.event.ActivitiEventDispatcher; -import org.activiti.engine.delegate.event.ActivitiEventListener; -import org.activiti.engine.delegate.event.ActivitiEventType; -import org.activiti.engine.delegate.event.impl.ActivitiEventDispatcherImpl; -import org.activiti.engine.form.AbstractFormType; -import org.activiti.engine.impl.*; -import org.activiti.engine.impl.agenda.DefaultActivitiEngineAgendaFactory; -import org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor; -import org.activiti.engine.impl.asyncexecutor.DefaultJobManager; -import org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnableFactory; -import org.activiti.engine.impl.asyncexecutor.JobManager; -import org.activiti.engine.impl.bpmn.data.ItemInstance; -import org.activiti.engine.impl.bpmn.deployer.*; -import org.activiti.engine.impl.bpmn.listener.ListenerNotificationHelper; -import org.activiti.engine.impl.bpmn.parser.BpmnParseHandlers; -import org.activiti.engine.impl.bpmn.parser.BpmnParser; -import org.activiti.engine.impl.bpmn.parser.factory.*; -import org.activiti.engine.impl.bpmn.parser.handler.*; -import org.activiti.engine.impl.bpmn.webservice.MessageInstance; -import org.activiti.engine.impl.calendar.*; -import org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContextFactory; -import org.activiti.engine.impl.cmd.ValidateExecutionRelatedEntityCountCfgCmd; -import org.activiti.engine.impl.context.Context; -import org.activiti.engine.impl.db.DbIdGenerator; -import org.activiti.engine.impl.db.DbSqlSessionFactory; -import org.activiti.engine.impl.db.IbatisVariableTypeHandler; -import org.activiti.engine.impl.delegate.invocation.DefaultDelegateInterceptor; -import org.activiti.engine.impl.el.ExpressionManager; -import org.activiti.engine.impl.event.CompensationEventHandler; -import org.activiti.engine.impl.event.EventHandler; -import org.activiti.engine.impl.event.MessageEventHandler; -import org.activiti.engine.impl.event.SignalEventHandler; -import org.activiti.engine.impl.event.logger.EventLogger; -import org.activiti.engine.impl.form.*; -import org.activiti.engine.impl.history.DefaultHistoryManager; -import org.activiti.engine.impl.history.HistoryLevel; -import org.activiti.engine.impl.history.HistoryManager; -import org.activiti.engine.impl.interceptor.*; -import org.activiti.engine.impl.jobexecutor.*; -import org.activiti.engine.impl.persistence.GenericManagerFactory; -import org.activiti.engine.impl.persistence.cache.EntityCache; -import org.activiti.engine.impl.persistence.cache.EntityCacheImpl; -import org.activiti.engine.impl.persistence.deploy.*; -import org.activiti.engine.impl.persistence.entity.*; -import org.activiti.engine.impl.persistence.entity.data.*; -import org.activiti.engine.impl.persistence.entity.data.impl.*; -import org.activiti.engine.impl.scripting.*; -import org.activiti.engine.impl.util.DefaultClockImpl; -import org.activiti.engine.impl.util.IoUtil; -import org.activiti.engine.impl.util.ProcessInstanceHelper; -import org.activiti.engine.impl.util.ReflectUtil; -import org.activiti.engine.impl.variable.*; -import org.activiti.engine.parse.BpmnParseHandler; -import org.activiti.engine.runtime.Clock; -import org.activiti.form.api.FormRepositoryService; -import org.activiti.image.impl.DefaultProcessDiagramGenerator; -import org.activiti.validation.ProcessValidator; -import org.activiti.validation.ProcessValidatorFactory; -import org.apache.ibatis.builder.xml.XMLConfigBuilder; -import org.apache.ibatis.builder.xml.XMLMapperBuilder; -import org.apache.ibatis.datasource.pooled.PooledDataSource; -import org.apache.ibatis.mapping.Environment; -import org.apache.ibatis.session.Configuration; -import org.apache.ibatis.session.SqlSessionFactory; -import org.apache.ibatis.session.defaults.DefaultSqlSessionFactory; -import org.apache.ibatis.transaction.TransactionFactory; -import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory; -import org.apache.ibatis.transaction.managed.ManagedTransactionFactory; -import org.apache.ibatis.type.JdbcType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.naming.InitialContext; -import javax.sql.DataSource; -import javax.xml.namespace.QName; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.net.URL; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.SQLException; -import java.util.*; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public abstract class ProcessEngineConfigurationImpl extends ProcessEngineConfiguration { - private static Logger log = LoggerFactory.getLogger(ProcessEngineConfigurationImpl.class); - public static final String DB_SCHEMA_UPDATE_CREATE = "create"; - public static final String DB_SCHEMA_UPDATE_DROP_CREATE = "drop-create"; - public static final String DEFAULT_WS_SYNC_FACTORY = "org.activiti.engine.impl.webservice.CxfWebServiceClientFactory"; - public static final String DEFAULT_MYBATIS_MAPPING_FILE = "org/activiti/db/mapping/mappings.xml"; - public static final int DEFAULT_GENERIC_MAX_LENGTH_STRING = 4000; - public static final int DEFAULT_ORACLE_MAX_LENGTH_STRING = 2000; - protected RepositoryService repositoryService = new RepositoryServiceImpl(); - protected RuntimeService runtimeService = new RuntimeServiceImpl(); - protected HistoryService historyService = new HistoryServiceImpl(this); - protected IdentityService identityService = new IdentityServiceImpl(); - protected TaskService taskService = new TaskServiceImpl(this); - protected FormService formService = new FormServiceImpl(); - protected ManagementService managementService = new ManagementServiceImpl(); - protected DynamicBpmnService dynamicBpmnService = new DynamicBpmnServiceImpl(this); - protected boolean formEngineInitialized; - protected FormRepositoryService formEngineRepositoryService; - protected org.activiti.form.api.FormService formEngineFormService; - protected boolean dmnEngineInitialized; - protected DmnRepositoryService dmnEngineRepositoryService; - protected DmnRuleService dmnEngineRuleService; - protected CommandConfig defaultCommandConfig; - protected CommandConfig schemaCommandConfig; - protected CommandInterceptor commandInvoker; - protected List<CommandInterceptor> customPreCommandInterceptors; - protected List<CommandInterceptor> customPostCommandInterceptors; - protected List<CommandInterceptor> commandInterceptors; - protected CommandExecutor commandExecutor; - protected AttachmentDataManager attachmentDataManager; - protected ByteArrayDataManager byteArrayDataManager; - protected CommentDataManager commentDataManager; - protected DeploymentDataManager deploymentDataManager; - protected EventLogEntryDataManager eventLogEntryDataManager; - protected EventSubscriptionDataManager eventSubscriptionDataManager; - protected ExecutionDataManager executionDataManager; - protected GroupDataManager groupDataManager; - protected HistoricActivityInstanceDataManager historicActivityInstanceDataManager; - protected HistoricDetailDataManager historicDetailDataManager; - protected HistoricIdentityLinkDataManager historicIdentityLinkDataManager; - protected HistoricProcessInstanceDataManager historicProcessInstanceDataManager; - protected HistoricTaskInstanceDataManager historicTaskInstanceDataManager; - protected HistoricVariableInstanceDataManager historicVariableInstanceDataManager; - protected IdentityInfoDataManager identityInfoDataManager; - protected IdentityLinkDataManager identityLinkDataManager; - protected JobDataManager jobDataManager; - protected TimerJobDataManager timerJobDataManager; - protected SuspendedJobDataManager suspendedJobDataManager; - protected DeadLetterJobDataManager deadLetterJobDataManager; - protected MembershipDataManager membershipDataManager; - protected ModelDataManager modelDataManager; - protected ProcessDefinitionDataManager processDefinitionDataManager; - protected ProcessDefinitionInfoDataManager processDefinitionInfoDataManager; - protected PropertyDataManager propertyDataManager; - protected ResourceDataManager resourceDataManager; - protected TaskDataManager taskDataManager; - protected UserDataManager userDataManager; - protected VariableInstanceDataManager variableInstanceDataManager; - protected AttachmentEntityManager attachmentEntityManager; - protected ByteArrayEntityManager byteArrayEntityManager; - protected CommentEntityManager commentEntityManager; - protected DeploymentEntityManager deploymentEntityManager; - protected EventLogEntryEntityManager eventLogEntryEntityManager; - protected EventSubscriptionEntityManager eventSubscriptionEntityManager; - protected ExecutionEntityManager executionEntityManager; - protected GroupEntityManager groupEntityManager; - protected HistoricActivityInstanceEntityManager historicActivityInstanceEntityManager; - protected HistoricDetailEntityManager historicDetailEntityManager; - protected HistoricIdentityLinkEntityManager historicIdentityLinkEntityManager; - protected HistoricProcessInstanceEntityManager historicProcessInstanceEntityManager; - protected HistoricTaskInstanceEntityManager historicTaskInstanceEntityManager; - protected HistoricVariableInstanceEntityManager historicVariableInstanceEntityManager; - protected IdentityInfoEntityManager identityInfoEntityManager; - protected IdentityLinkEntityManager identityLinkEntityManager; - protected JobEntityManager jobEntityManager; - protected TimerJobEntityManager timerJobEntityManager; - protected SuspendedJobEntityManager suspendedJobEntityManager; - protected DeadLetterJobEntityManager deadLetterJobEntityManager; - protected MembershipEntityManager membershipEntityManager; - protected ModelEntityManager modelEntityManager; - protected ProcessDefinitionEntityManager processDefinitionEntityManager; - protected ProcessDefinitionInfoEntityManager processDefinitionInfoEntityManager; - protected PropertyEntityManager propertyEntityManager; - protected ResourceEntityManager resourceEntityManager; - protected TableDataManager tableDataManager; - protected TaskEntityManager taskEntityManager; - protected UserEntityManager userEntityManager; - protected VariableInstanceEntityManager variableInstanceEntityManager; - protected HistoryManager historyManager; - protected JobManager jobManager; - protected List<SessionFactory> customSessionFactories; - protected DbSqlSessionFactory dbSqlSessionFactory; - protected Map<Class<?>, SessionFactory> sessionFactories; - protected boolean enableConfiguratorServiceLoader = true; - protected List<ProcessEngineConfigurator> configurators; - protected List<ProcessEngineConfigurator> allConfigurators; - protected BpmnDeployer bpmnDeployer; - protected BpmnParser bpmnParser; - protected ParsedDeploymentBuilderFactory parsedDeploymentBuilderFactory; - protected TimerManager timerManager; - protected EventSubscriptionManager eventSubscriptionManager; - protected BpmnDeploymentHelper bpmnDeploymentHelper; - protected CachingAndArtifactsManager cachingAndArtifactsManager; - protected ProcessDefinitionDiagramHelper processDefinitionDiagramHelper; - protected List<Deployer> customPreDeployers; - protected List<Deployer> customPostDeployers; - protected List<Deployer> deployers; - protected DeploymentManager deploymentManager; - protected int processDefinitionCacheLimit = -1; - protected DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache; - protected int processDefinitionInfoCacheLimit = -1; - protected ProcessDefinitionInfoCache processDefinitionInfoCache; - protected int knowledgeBaseCacheLimit = -1; - protected DeploymentCache<Object> knowledgeBaseCache; - protected List<JobHandler> customJobHandlers; - protected Map<String, JobHandler> jobHandlers; - protected ProcessInstanceHelper processInstanceHelper; - protected ListenerNotificationHelper listenerNotificationHelper; - protected int asyncExecutorNumberOfRetries = 3; - protected int asyncExecutorCorePoolSize = 2; - protected int asyncExecutorMaxPoolSize = 10; - protected long asyncExecutorThreadKeepAliveTime = 5000L; - protected int asyncExecutorThreadPoolQueueSize = 100; - protected BlockingQueue<Runnable> asyncExecutorThreadPoolQueue; - protected long asyncExecutorSecondsToWaitOnShutdown = 60L; - protected int asyncExecutorMaxTimerJobsPerAcquisition = 1; - protected int asyncExecutorMaxAsyncJobsDuePerAcquisition = 1; - protected int asyncExecutorDefaultTimerJobAcquireWaitTime = 10000; - protected int asyncExecutorDefaultAsyncJobAcquireWaitTime = 10000; - protected int asyncExecutorDefaultQueueSizeFullWaitTime = 0; - protected String asyncExecutorLockOwner; - protected int asyncExecutorTimerLockTimeInMillis = 300000; - protected int asyncExecutorAsyncJobLockTimeInMillis = 300000; - protected int asyncExecutorResetExpiredJobsInterval = 60000; - protected int asyncExecutorResetExpiredJobsPageSize = 3; - protected boolean asyncExecutorMessageQueueMode; - protected ExecuteAsyncRunnableFactory asyncExecutorExecuteAsyncRunnableFactory; - protected SqlSessionFactory sqlSessionFactory; - protected TransactionFactory transactionFactory; - protected Set<Class<?>> customMybatisMappers; - protected Set<String> customMybatisXMLMappers; - protected IdGenerator idGenerator; - protected DataSource idGeneratorDataSource; - protected String idGeneratorDataSourceJndiName; - protected List<BpmnParseHandler> preBpmnParseHandlers; - protected List<BpmnParseHandler> postBpmnParseHandlers; - protected List<BpmnParseHandler> customDefaultBpmnParseHandlers; - protected ActivityBehaviorFactory activityBehaviorFactory; - protected ListenerFactory listenerFactory; - protected BpmnParseFactory bpmnParseFactory; - protected ProcessValidator processValidator; - protected List<FormEngine> customFormEngines; - protected Map<String, FormEngine> formEngines; - protected List<AbstractFormType> customFormTypes; - protected FormTypes formTypes; - protected List<VariableType> customPreVariableTypes; - protected List<VariableType> customPostVariableTypes; - protected VariableTypes variableTypes; - protected boolean serializableVariableTypeTrackDeserializedObjects = true; - protected ExpressionManager expressionManager; - protected List<String> customScriptingEngineClasses; - protected ScriptingEngines scriptingEngines; - protected List<ResolverFactory> resolverFactories; - protected BusinessCalendarManager businessCalendarManager; - protected int executionQueryLimit = 20000; - protected int taskQueryLimit = 20000; - protected int historicTaskQueryLimit = 20000; - protected int historicProcessInstancesQueryLimit = 20000; - protected String wsSyncFactoryClassName = "org.activiti.engine.impl.webservice.CxfWebServiceClientFactory"; - protected ConcurrentMap<QName, URL> wsOverridenEndpointAddresses = new ConcurrentHashMap(); - protected CommandContextFactory commandContextFactory; - protected TransactionContextFactory transactionContextFactory; - protected Map<Object, Object> beans; - protected DelegateInterceptor delegateInterceptor; - protected Map<String, EventHandler> eventHandlers; - protected List<EventHandler> customEventHandlers; - protected FailedJobCommandFactory failedJobCommandFactory; - protected boolean enableSafeBpmnXml; - protected int batchSizeProcessInstances = 25; - protected int batchSizeTasks = 25; - protected boolean enableEventDispatcher = true; - protected ActivitiEventDispatcher eventDispatcher; - protected List<ActivitiEventListener> eventListeners; - protected Map<String, List<ActivitiEventListener>> typedEventListeners; - protected boolean enableDatabaseEventLogging; - protected DelegateExpressionFieldInjectionMode delegateExpressionFieldInjectionMode; - protected int maxLengthStringVariableType; - protected boolean isBulkInsertEnabled; - protected int maxNrOfStatementsInBulkInsert; - public int DEFAULT_MAX_NR_OF_STATEMENTS_BULK_INSERT_SQL_SERVER; - protected ObjectMapper objectMapper; - protected boolean usingRelationalDatabase; - protected boolean enableVerboseExecutionTreeLogging; - protected PerformanceSettings performanceSettings; - protected boolean isActiviti5CompatibilityEnabled; - protected Activiti5CompatibilityHandlerFactory activiti5CompatibilityHandlerFactory; - protected Activiti5CompatibilityHandler activiti5CompatibilityHandler; - protected Object activiti5ActivityBehaviorFactory; - protected Object activiti5ListenerFactory; - protected List<Object> activiti5PreBpmnParseHandlers; - protected List<Object> activiti5PostBpmnParseHandlers; - protected List<Object> activiti5CustomDefaultBpmnParseHandlers; - protected Set<Class<?>> activiti5CustomMybatisMappers; - protected Set<String> activiti5CustomMybatisXMLMappers; - protected static Properties databaseTypeMappings = getDefaultDatabaseTypeMappings(); - - public static final String DATABASE_TYPE_DM = "dm"; - public static final String DATABASE_TYPE_H2 = "h2"; - public static final String DATABASE_TYPE_HSQL = "hsql"; - public static final String DATABASE_TYPE_MYSQL = "mysql"; - public static final String DATABASE_TYPE_ORACLE = "oracle"; - public static final String DATABASE_TYPE_POSTGRES = "postgres"; - public static final String DATABASE_TYPE_MSSQL = "mssql"; - public static final String DATABASE_TYPE_DB2 = "db2"; - - public ProcessEngineConfigurationImpl() { - this.delegateExpressionFieldInjectionMode = DelegateExpressionFieldInjectionMode.MIXED; - this.maxLengthStringVariableType = -1; - this.isBulkInsertEnabled = true; - this.maxNrOfStatementsInBulkInsert = 100; - this.DEFAULT_MAX_NR_OF_STATEMENTS_BULK_INSERT_SQL_SERVER = 70; - this.objectMapper = new ObjectMapper(); - this.usingRelationalDatabase = true; - this.performanceSettings = new PerformanceSettings(); - } - - public ProcessEngine buildProcessEngine() { - this.init(); - ProcessEngineImpl processEngine = new ProcessEngineImpl(this); - if (this.isActiviti5CompatibilityEnabled && this.activiti5CompatibilityHandler != null) { - Context.setProcessEngineConfiguration(processEngine.getProcessEngineConfiguration()); - this.activiti5CompatibilityHandler.getRawProcessEngine(); - } - - this.postProcessEngineInitialisation(); - return processEngine; - } - - public void init() { - this.initConfigurators(); - this.configuratorsBeforeInit(); - this.initProcessDiagramGenerator(); - this.initHistoryLevel(); - this.initExpressionManager(); - if (this.usingRelationalDatabase) { - this.initDataSource(); - } - - this.initAgendaFactory(); - this.initHelpers(); - this.initVariableTypes(); - this.initBeans(); - this.initFormEngines(); - this.initFormTypes(); - this.initScriptingEngines(); - this.initClock(); - this.initBusinessCalendarManager(); - this.initCommandContextFactory(); - this.initTransactionContextFactory(); - this.initCommandExecutors(); - this.initServices(); - this.initIdGenerator(); - this.initBehaviorFactory(); - this.initListenerFactory(); - this.initBpmnParser(); - this.initProcessDefinitionCache(); - this.initProcessDefinitionInfoCache(); - this.initKnowledgeBaseCache(); - this.initJobHandlers(); - this.initJobManager(); - this.initAsyncExecutor(); - this.initTransactionFactory(); - if (this.usingRelationalDatabase) { - this.initSqlSessionFactory(); - } - - this.initSessionFactories(); - this.initDataManagers(); - this.initEntityManagers(); - this.initHistoryManager(); - this.initJpa(); - this.initDeployers(); - this.initDelegateInterceptor(); - this.initEventHandlers(); - this.initFailedJobCommandFactory(); - this.initEventDispatcher(); - this.initProcessValidator(); - this.initDatabaseEventLogging(); - this.initActiviti5CompatibilityHandler(); - this.configuratorsAfterInit(); - } - - public void initFailedJobCommandFactory() { - if (this.failedJobCommandFactory == null) { - this.failedJobCommandFactory = new DefaultFailedJobCommandFactory(); - } - - } - - public void initCommandExecutors() { - this.initDefaultCommandConfig(); - this.initSchemaCommandConfig(); - this.initCommandInvoker(); - this.initCommandInterceptors(); - this.initCommandExecutor(); - } - - public void initDefaultCommandConfig() { - if (this.defaultCommandConfig == null) { - this.defaultCommandConfig = new CommandConfig(); - } - - } - - public void initSchemaCommandConfig() { - if (this.schemaCommandConfig == null) { - this.schemaCommandConfig = (new CommandConfig()).transactionNotSupported(); - } - - } - - public void initCommandInvoker() { - if (this.commandInvoker == null) { - if (this.enableVerboseExecutionTreeLogging) { - this.commandInvoker = new DebugCommandInvoker(); - } else { - this.commandInvoker = new CommandInvoker(); - } - } - - } - - public void initCommandInterceptors() { - if (this.commandInterceptors == null) { - this.commandInterceptors = new ArrayList(); - if (this.customPreCommandInterceptors != null) { - this.commandInterceptors.addAll(this.customPreCommandInterceptors); - } - - this.commandInterceptors.addAll(this.getDefaultCommandInterceptors()); - if (this.customPostCommandInterceptors != null) { - this.commandInterceptors.addAll(this.customPostCommandInterceptors); - } - - this.commandInterceptors.add(this.commandInvoker); - } - - } - - public Collection<? extends CommandInterceptor> getDefaultCommandInterceptors() { - List<CommandInterceptor> interceptors = new ArrayList(); - interceptors.add(new LogInterceptor()); - CommandInterceptor transactionInterceptor = this.createTransactionInterceptor(); - if (transactionInterceptor != null) { - interceptors.add(transactionInterceptor); - } - - if (this.commandContextFactory != null) { - interceptors.add(new CommandContextInterceptor(this.commandContextFactory, this)); - } - - if (this.transactionContextFactory != null) { - interceptors.add(new TransactionContextInterceptor(this.transactionContextFactory)); - } - - return interceptors; - } - - public void initCommandExecutor() { - if (this.commandExecutor == null) { - CommandInterceptor first = this.initInterceptorChain(this.commandInterceptors); - this.commandExecutor = new CommandExecutorImpl(this.getDefaultCommandConfig(), first); - } - - } - - public CommandInterceptor initInterceptorChain(List<CommandInterceptor> chain) { - if (chain != null && !chain.isEmpty()) { - for(int i = 0; i < chain.size() - 1; ++i) { - ((CommandInterceptor)chain.get(i)).setNext((CommandInterceptor)chain.get(i + 1)); - } - - return (CommandInterceptor)chain.get(0); - } else { - throw new ActivitiException("invalid command interceptor chain configuration: " + chain); - } - } - - public abstract CommandInterceptor createTransactionInterceptor(); - - public void initServices() { - this.initService(this.repositoryService); - this.initService(this.runtimeService); - this.initService(this.historyService); - this.initService(this.identityService); - this.initService(this.taskService); - this.initService(this.formService); - this.initService(this.managementService); - this.initService(this.dynamicBpmnService); - } - - public void initService(Object service) { - if (service instanceof ServiceImpl) { - ((ServiceImpl)service).setCommandExecutor(this.commandExecutor); - } - - } - - public void initDataSource() { - if (this.dataSource == null) { - if (this.dataSourceJndiName != null) { - try { - this.dataSource = (DataSource)(new InitialContext()).lookup(this.dataSourceJndiName); - } catch (Exception var2) { - Exception e = var2; - throw new ActivitiException("couldn't lookup datasource from " + this.dataSourceJndiName + ": " + e.getMessage(), e); - } - } else if (this.jdbcUrl != null) { - if (this.jdbcDriver == null || this.jdbcUsername == null) { - throw new ActivitiException("DataSource or JDBC properties have to be specified in a process engine configuration"); - } - - log.debug("initializing datasource to db: {}", this.jdbcUrl); - PooledDataSource pooledDataSource = new PooledDataSource(ReflectUtil.getClassLoader(), this.jdbcDriver, this.jdbcUrl, this.jdbcUsername, this.jdbcPassword); - if (this.jdbcMaxActiveConnections > 0) { - pooledDataSource.setPoolMaximumActiveConnections(this.jdbcMaxActiveConnections); - } - - if (this.jdbcMaxIdleConnections > 0) { - pooledDataSource.setPoolMaximumIdleConnections(this.jdbcMaxIdleConnections); - } - - if (this.jdbcMaxCheckoutTime > 0) { - pooledDataSource.setPoolMaximumCheckoutTime(this.jdbcMaxCheckoutTime); - } - - if (this.jdbcMaxWaitTime > 0) { - pooledDataSource.setPoolTimeToWait(this.jdbcMaxWaitTime); - } - - if (this.jdbcPingEnabled) { - pooledDataSource.setPoolPingEnabled(true); - if (this.jdbcPingQuery != null) { - pooledDataSource.setPoolPingQuery(this.jdbcPingQuery); - } - - pooledDataSource.setPoolPingConnectionsNotUsedFor(this.jdbcPingConnectionNotUsedFor); - } - - if (this.jdbcDefaultTransactionIsolationLevel > 0) { - pooledDataSource.setDefaultTransactionIsolationLevel(this.jdbcDefaultTransactionIsolationLevel); - } - - this.dataSource = pooledDataSource; - } - - if (this.dataSource instanceof PooledDataSource) { - ((PooledDataSource)this.dataSource).forceCloseAll(); - } - } - - if (this.databaseType == null) { - this.initDatabaseType(); - } - - } - - public static Properties getDefaultDatabaseTypeMappings() { - Properties databaseTypeMappings = new Properties(); - databaseTypeMappings.setProperty("dm", DATABASE_TYPE_DM); - databaseTypeMappings.setProperty("DM DBMS",DATABASE_TYPE_ORACLE); - databaseTypeMappings.setProperty("H2", "h2"); - databaseTypeMappings.setProperty("HSQL Database Engine", "hsql"); - databaseTypeMappings.setProperty("MySQL", "mysql"); - databaseTypeMappings.setProperty("Oracle", "oracle"); - databaseTypeMappings.setProperty("PostgreSQL", "postgres"); - databaseTypeMappings.setProperty("Microsoft SQL Server", "mssql"); - databaseTypeMappings.setProperty("db2", "db2"); - databaseTypeMappings.setProperty("DB2", "db2"); - databaseTypeMappings.setProperty("DB2/NT", "db2"); - databaseTypeMappings.setProperty("DB2/NT64", "db2"); - databaseTypeMappings.setProperty("DB2 UDP", "db2"); - databaseTypeMappings.setProperty("DB2/LINUX", "db2"); - databaseTypeMappings.setProperty("DB2/LINUX390", "db2"); - databaseTypeMappings.setProperty("DB2/LINUXX8664", "db2"); - databaseTypeMappings.setProperty("DB2/LINUXZ64", "db2"); - databaseTypeMappings.setProperty("DB2/LINUXPPC64", "db2"); - databaseTypeMappings.setProperty("DB2/LINUXPPC64LE", "db2"); - databaseTypeMappings.setProperty("DB2/400 SQL", "db2"); - databaseTypeMappings.setProperty("DB2/6000", "db2"); - databaseTypeMappings.setProperty("DB2 UDB iSeries", "db2"); - databaseTypeMappings.setProperty("DB2/AIX64", "db2"); - databaseTypeMappings.setProperty("DB2/HPUX", "db2"); - databaseTypeMappings.setProperty("DB2/HP64", "db2"); - databaseTypeMappings.setProperty("DB2/SUN", "db2"); - databaseTypeMappings.setProperty("DB2/SUN64", "db2"); - databaseTypeMappings.setProperty("DB2/PTX", "db2"); - databaseTypeMappings.setProperty("DB2/2", "db2"); - databaseTypeMappings.setProperty("DB2 UDB AS400", "db2"); - return databaseTypeMappings; - } - - public void initDatabaseType() { - Connection connection = null; - - try { - connection = this.dataSource.getConnection(); - DatabaseMetaData databaseMetaData = connection.getMetaData(); - String databaseProductName = databaseMetaData.getDatabaseProductName(); - log.debug("database product name: '{}'", databaseProductName); - this.databaseType = databaseTypeMappings.getProperty(databaseProductName); - if (this.databaseType == null) { - throw new ActivitiException("couldn't deduct database type from database product name '" + databaseProductName + "'"); - } - - log.debug("using database type: {}", this.databaseType); - if ("mssql".equals(this.databaseType)) { - this.maxNrOfStatementsInBulkInsert = this.DEFAULT_MAX_NR_OF_STATEMENTS_BULK_INSERT_SQL_SERVER; - } - } catch (SQLException var12) { - SQLException e = var12; - log.error("Exception while initializing Database connection", e); - } finally { - try { - if (connection != null) { - connection.close(); - } - } catch (SQLException var11) { - SQLException e = var11; - log.error("Exception while closing the Database connection", e); - } - - } - - } - - public void initTransactionFactory() { - if (this.transactionFactory == null) { - if (this.transactionsExternallyManaged) { - this.transactionFactory = new ManagedTransactionFactory(); - } else { - this.transactionFactory = new JdbcTransactionFactory(); - } - } - - } - - public void initSqlSessionFactory() { - if (this.sqlSessionFactory == null) { - InputStream inputStream = null; - - try { - inputStream = this.getMyBatisXmlConfigurationStream(); - Environment environment = new Environment("default", this.transactionFactory, this.dataSource); - Reader reader = new InputStreamReader(inputStream); - Properties properties = new Properties(); - properties.put("prefix", this.databaseTablePrefix); - String wildcardEscapeClause = ""; - if (this.databaseWildcardEscapeCharacter != null && this.databaseWildcardEscapeCharacter.length() != 0) { - wildcardEscapeClause = " escape '" + this.databaseWildcardEscapeCharacter + "'"; - } - - properties.put("wildcardEscapeClause", wildcardEscapeClause); - properties.put("limitBefore", ""); - properties.put("limitAfter", ""); - properties.put("limitBetween", ""); - properties.put("limitOuterJoinBetween", ""); - properties.put("limitBeforeNativeQuery", ""); - properties.put("orderBy", "order by ${orderByColumns}"); - properties.put("blobType", "BLOB"); - properties.put("boolValue", "TRUE"); - if (this.databaseType != null) { - properties.load(this.getResourceAsStream("org/activiti/db/properties/" + this.databaseType + ".properties")); - } - - Configuration configuration = this.initMybatisConfiguration(environment, reader, properties); - this.sqlSessionFactory = new DefaultSqlSessionFactory(configuration); - } catch (Exception var10) { - Exception e = var10; - throw new ActivitiException("Error while building ibatis SqlSessionFactory: " + e.getMessage(), e); - } finally { - IoUtil.closeSilently(inputStream); - } - } - - } - - public Configuration initMybatisConfiguration(Environment environment, Reader reader, Properties properties) { - XMLConfigBuilder parser = new XMLConfigBuilder(reader, "", properties); - Configuration configuration = parser.getConfiguration(); - if (this.databaseType != null) { - configuration.setDatabaseId(this.databaseType); - } - - configuration.setEnvironment(environment); - this.initMybatisTypeHandlers(configuration); - this.initCustomMybatisMappers(configuration); - configuration = this.parseMybatisConfiguration(configuration, parser); - return configuration; - } - - public void initMybatisTypeHandlers(Configuration configuration) { - configuration.getTypeHandlerRegistry().register(VariableType.class, JdbcType.VARCHAR, new IbatisVariableTypeHandler()); - } - - public void initCustomMybatisMappers(Configuration configuration) { - if (this.getCustomMybatisMappers() != null) { - Iterator var2 = this.getCustomMybatisMappers().iterator(); - - while(var2.hasNext()) { - Class<?> clazz = (Class)var2.next(); - configuration.addMapper(clazz); - } - } - - } - - public Configuration parseMybatisConfiguration(Configuration configuration, XMLConfigBuilder parser) { - return this.parseCustomMybatisXMLMappers(parser.parse()); - } - - public Configuration parseCustomMybatisXMLMappers(Configuration configuration) { - if (this.getCustomMybatisXMLMappers() != null) { - Iterator var2 = this.getCustomMybatisXMLMappers().iterator(); - - while(var2.hasNext()) { - String resource = (String)var2.next(); - XMLMapperBuilder mapperParser = new XMLMapperBuilder(this.getResourceAsStream(resource), configuration, resource, configuration.getSqlFragments()); - mapperParser.parse(); - } - } - - return configuration; - } - - protected InputStream getResourceAsStream(String resource) { - return ReflectUtil.getResourceAsStream(resource); - } - - public InputStream getMyBatisXmlConfigurationStream() { - return this.getResourceAsStream("org/activiti/db/mapping/mappings.xml"); - } - - public Set<Class<?>> getCustomMybatisMappers() { - return this.customMybatisMappers; - } - - public void setCustomMybatisMappers(Set<Class<?>> customMybatisMappers) { - this.customMybatisMappers = customMybatisMappers; - } - - public Set<String> getCustomMybatisXMLMappers() { - return this.customMybatisXMLMappers; - } - - public void setCustomMybatisXMLMappers(Set<String> customMybatisXMLMappers) { - this.customMybatisXMLMappers = customMybatisXMLMappers; - } - - public void initDataManagers() { - if (this.attachmentDataManager == null) { - this.attachmentDataManager = new MybatisAttachmentDataManager(this); - } - - if (this.byteArrayDataManager == null) { - this.byteArrayDataManager = new MybatisByteArrayDataManager(this); - } - - if (this.commentDataManager == null) { - this.commentDataManager = new MybatisCommentDataManager(this); - } - - if (this.deploymentDataManager == null) { - this.deploymentDataManager = new MybatisDeploymentDataManager(this); - } - - if (this.eventLogEntryDataManager == null) { - this.eventLogEntryDataManager = new MybatisEventLogEntryDataManager(this); - } - - if (this.eventSubscriptionDataManager == null) { - this.eventSubscriptionDataManager = new MybatisEventSubscriptionDataManager(this); - } - - if (this.executionDataManager == null) { - this.executionDataManager = new MybatisExecutionDataManager(this); - } - - if (this.groupDataManager == null) { - this.groupDataManager = new MybatisGroupDataManager(this); - } - - if (this.historicActivityInstanceDataManager == null) { - this.historicActivityInstanceDataManager = new MybatisHistoricActivityInstanceDataManager(this); - } - - if (this.historicDetailDataManager == null) { - this.historicDetailDataManager = new MybatisHistoricDetailDataManager(this); - } - - if (this.historicIdentityLinkDataManager == null) { - this.historicIdentityLinkDataManager = new MybatisHistoricIdentityLinkDataManager(this); - } - - if (this.historicProcessInstanceDataManager == null) { - this.historicProcessInstanceDataManager = new MybatisHistoricProcessInstanceDataManager(this); - } - - if (this.historicTaskInstanceDataManager == null) { - this.historicTaskInstanceDataManager = new MybatisHistoricTaskInstanceDataManager(this); - } - - if (this.historicVariableInstanceDataManager == null) { - this.historicVariableInstanceDataManager = new MybatisHistoricVariableInstanceDataManager(this); - } - - if (this.identityInfoDataManager == null) { - this.identityInfoDataManager = new MybatisIdentityInfoDataManager(this); - } - - if (this.identityLinkDataManager == null) { - this.identityLinkDataManager = new MybatisIdentityLinkDataManager(this); - } - - if (this.jobDataManager == null) { - this.jobDataManager = new MybatisJobDataManager(this); - } - - if (this.timerJobDataManager == null) { - this.timerJobDataManager = new MybatisTimerJobDataManager(this); - } - - if (this.suspendedJobDataManager == null) { - this.suspendedJobDataManager = new MybatisSuspendedJobDataManager(this); - } - - if (this.deadLetterJobDataManager == null) { - this.deadLetterJobDataManager = new MybatisDeadLetterJobDataManager(this); - } - - if (this.membershipDataManager == null) { - this.membershipDataManager = new MybatisMembershipDataManager(this); - } - - if (this.modelDataManager == null) { - this.modelDataManager = new MybatisModelDataManager(this); - } - - if (this.processDefinitionDataManager == null) { - this.processDefinitionDataManager = new MybatisProcessDefinitionDataManager(this); - } - - if (this.processDefinitionInfoDataManager == null) { - this.processDefinitionInfoDataManager = new MybatisProcessDefinitionInfoDataManager(this); - } - - if (this.propertyDataManager == null) { - this.propertyDataManager = new MybatisPropertyDataManager(this); - } - - if (this.resourceDataManager == null) { - this.resourceDataManager = new MybatisResourceDataManager(this); - } - - if (this.taskDataManager == null) { - this.taskDataManager = new MybatisTaskDataManager(this); - } - - if (this.userDataManager == null) { - this.userDataManager = new MybatisUserDataManager(this); - } - - if (this.variableInstanceDataManager == null) { - this.variableInstanceDataManager = new MybatisVariableInstanceDataManager(this); - } - - } - - public void initEntityManagers() { - if (this.attachmentEntityManager == null) { - this.attachmentEntityManager = new AttachmentEntityManagerImpl(this, this.attachmentDataManager); - } - - if (this.byteArrayEntityManager == null) { - this.byteArrayEntityManager = new ByteArrayEntityManagerImpl(this, this.byteArrayDataManager); - } - - if (this.commentEntityManager == null) { - this.commentEntityManager = new CommentEntityManagerImpl(this, this.commentDataManager); - } - - if (this.deploymentEntityManager == null) { - this.deploymentEntityManager = new DeploymentEntityManagerImpl(this, this.deploymentDataManager); - } - - if (this.eventLogEntryEntityManager == null) { - this.eventLogEntryEntityManager = new EventLogEntryEntityManagerImpl(this, this.eventLogEntryDataManager); - } - - if (this.eventSubscriptionEntityManager == null) { - this.eventSubscriptionEntityManager = new EventSubscriptionEntityManagerImpl(this, this.eventSubscriptionDataManager); - } - - if (this.executionEntityManager == null) { - this.executionEntityManager = new ExecutionEntityManagerImpl(this, this.executionDataManager); - } - - if (this.groupEntityManager == null) { - this.groupEntityManager = new GroupEntityManagerImpl(this, this.groupDataManager); - } - - if (this.historicActivityInstanceEntityManager == null) { - this.historicActivityInstanceEntityManager = new HistoricActivityInstanceEntityManagerImpl(this, this.historicActivityInstanceDataManager); - } - - if (this.historicDetailEntityManager == null) { - this.historicDetailEntityManager = new HistoricDetailEntityManagerImpl(this, this.historicDetailDataManager); - } - - if (this.historicIdentityLinkEntityManager == null) { - this.historicIdentityLinkEntityManager = new HistoricIdentityLinkEntityManagerImpl(this, this.historicIdentityLinkDataManager); - } - - if (this.historicProcessInstanceEntityManager == null) { - this.historicProcessInstanceEntityManager = new HistoricProcessInstanceEntityManagerImpl(this, this.historicProcessInstanceDataManager); - } - - if (this.historicTaskInstanceEntityManager == null) { - this.historicTaskInstanceEntityManager = new HistoricTaskInstanceEntityManagerImpl(this, this.historicTaskInstanceDataManager); - } - - if (this.historicVariableInstanceEntityManager == null) { - this.historicVariableInstanceEntityManager = new HistoricVariableInstanceEntityManagerImpl(this, this.historicVariableInstanceDataManager); - } - - if (this.identityInfoEntityManager == null) { - this.identityInfoEntityManager = new IdentityInfoEntityManagerImpl(this, this.identityInfoDataManager); - } - - if (this.identityLinkEntityManager == null) { - this.identityLinkEntityManager = new IdentityLinkEntityManagerImpl(this, this.identityLinkDataManager); - } - - if (this.jobEntityManager == null) { - this.jobEntityManager = new JobEntityManagerImpl(this, this.jobDataManager); - } - - if (this.timerJobEntityManager == null) { - this.timerJobEntityManager = new TimerJobEntityManagerImpl(this, this.timerJobDataManager); - } - - if (this.suspendedJobEntityManager == null) { - this.suspendedJobEntityManager = new SuspendedJobEntityManagerImpl(this, this.suspendedJobDataManager); - } - - if (this.deadLetterJobEntityManager == null) { - this.deadLetterJobEntityManager = new DeadLetterJobEntityManagerImpl(this, this.deadLetterJobDataManager); - } - - if (this.membershipEntityManager == null) { - this.membershipEntityManager = new MembershipEntityManagerImpl(this, this.membershipDataManager); - } - - if (this.modelEntityManager == null) { - this.modelEntityManager = new ModelEntityManagerImpl(this, this.modelDataManager); - } - - if (this.processDefinitionEntityManager == null) { - this.processDefinitionEntityManager = new ProcessDefinitionEntityManagerImpl(this, this.processDefinitionDataManager); - } - - if (this.processDefinitionInfoEntityManager == null) { - this.processDefinitionInfoEntityManager = new ProcessDefinitionInfoEntityManagerImpl(this, this.processDefinitionInfoDataManager); - } - - if (this.propertyEntityManager == null) { - this.propertyEntityManager = new PropertyEntityManagerImpl(this, this.propertyDataManager); - } - - if (this.resourceEntityManager == null) { - this.resourceEntityManager = new ResourceEntityManagerImpl(this, this.resourceDataManager); - } - - if (this.tableDataManager == null) { - this.tableDataManager = new TableDataManagerImpl(this); - } - - if (this.taskEntityManager == null) { - this.taskEntityManager = new TaskEntityManagerImpl(this, this.taskDataManager); - } - - if (this.userEntityManager == null) { - this.userEntityManager = new UserEntityManagerImpl(this, this.userDataManager); - } - - if (this.variableInstanceEntityManager == null) { - this.variableInstanceEntityManager = new VariableInstanceEntityManagerImpl(this, this.variableInstanceDataManager); - } - - } - - public void initHistoryManager() { - if (this.historyManager == null) { - this.historyManager = new DefaultHistoryManager(this, this.historyLevel); - } - - } - - public void initJobManager() { - if (this.jobManager == null) { - this.jobManager = new DefaultJobManager(this); - } - - this.jobManager.setProcessEngineConfiguration(this); - } - - public void initSessionFactories() { - if (this.sessionFactories == null) { - this.sessionFactories = new HashMap(); - if (this.usingRelationalDatabase) { - this.initDbSqlSessionFactory(); - } - - this.addSessionFactory(new GenericManagerFactory(EntityCache.class, EntityCacheImpl.class)); - } - - if (this.customSessionFactories != null) { - Iterator var1 = this.customSessionFactories.iterator(); - - while(var1.hasNext()) { - SessionFactory sessionFactory = (SessionFactory)var1.next(); - this.addSessionFactory(sessionFactory); - } - } - - } - - public void initDbSqlSessionFactory() { - if (this.dbSqlSessionFactory == null) { - this.dbSqlSessionFactory = this.createDbSqlSessionFactory(); - } - - this.dbSqlSessionFactory.setDatabaseType(this.databaseType); - this.dbSqlSessionFactory.setIdGenerator(this.idGenerator); - this.dbSqlSessionFactory.setSqlSessionFactory(this.sqlSessionFactory); - this.dbSqlSessionFactory.setDbIdentityUsed(this.isDbIdentityUsed); - this.dbSqlSessionFactory.setDbHistoryUsed(this.isDbHistoryUsed); - this.dbSqlSessionFactory.setDatabaseTablePrefix(this.databaseTablePrefix); - this.dbSqlSessionFactory.setTablePrefixIsSchema(this.tablePrefixIsSchema); - this.dbSqlSessionFactory.setDatabaseCatalog(this.databaseCatalog); - this.dbSqlSessionFactory.setDatabaseSchema(this.databaseSchema); - this.dbSqlSessionFactory.setBulkInsertEnabled(this.isBulkInsertEnabled, this.databaseType); - this.dbSqlSessionFactory.setMaxNrOfStatementsInBulkInsert(this.maxNrOfStatementsInBulkInsert); - this.addSessionFactory(this.dbSqlSessionFactory); - } - - public DbSqlSessionFactory createDbSqlSessionFactory() { - return new DbSqlSessionFactory(); - } - - public void addSessionFactory(SessionFactory sessionFactory) { - this.sessionFactories.put(sessionFactory.getSessionType(), sessionFactory); - } - - public void initConfigurators() { - this.allConfigurators = new ArrayList(); - if (this.configurators != null) { - Iterator var1 = this.configurators.iterator(); - - while(var1.hasNext()) { - ProcessEngineConfigurator configurator = (ProcessEngineConfigurator)var1.next(); - this.allConfigurators.add(configurator); - } - } - - if (this.enableConfiguratorServiceLoader) { - ClassLoader classLoader = this.getClassLoader(); - if (classLoader == null) { - classLoader = ReflectUtil.getClassLoader(); - } - - ServiceLoader<ProcessEngineConfigurator> configuratorServiceLoader = ServiceLoader.load(ProcessEngineConfigurator.class, classLoader); - int nrOfServiceLoadedConfigurators = 0; - - Iterator var4; - ProcessEngineConfigurator configurator; - for(var4 = configuratorServiceLoader.iterator(); var4.hasNext(); ++nrOfServiceLoadedConfigurators) { - configurator = (ProcessEngineConfigurator)var4.next(); - this.allConfigurators.add(configurator); - } - - if (nrOfServiceLoadedConfigurators > 0) { - log.info("Found {} auto-discoverable Process Engine Configurator{}", nrOfServiceLoadedConfigurators++, nrOfServiceLoadedConfigurators > 1 ? "s" : ""); - } - - if (!this.allConfigurators.isEmpty()) { - Collections.sort(this.allConfigurators, new Comparator<ProcessEngineConfigurator>() { - public int compare(ProcessEngineConfigurator configurator1, ProcessEngineConfigurator configurator2) { - int priority1 = configurator1.getPriority(); - int priority2 = configurator2.getPriority(); - if (priority1 < priority2) { - return -1; - } else { - return priority1 > priority2 ? 1 : 0; - } - } - }); - log.info("Found {} Process Engine Configurators in total:", this.allConfigurators.size()); - var4 = this.allConfigurators.iterator(); - - while(var4.hasNext()) { - configurator = (ProcessEngineConfigurator)var4.next(); - log.info("{} (priority:{})", configurator.getClass(), configurator.getPriority()); - } - } - } - - } - - public void configuratorsBeforeInit() { - Iterator var1 = this.allConfigurators.iterator(); - - while(var1.hasNext()) { - ProcessEngineConfigurator configurator = (ProcessEngineConfigurator)var1.next(); - log.info("Executing beforeInit() of {} (priority:{})", configurator.getClass(), configurator.getPriority()); - configurator.beforeInit(this); - } - - } - - public void configuratorsAfterInit() { - Iterator var1 = this.allConfigurators.iterator(); - - while(var1.hasNext()) { - ProcessEngineConfigurator configurator = (ProcessEngineConfigurator)var1.next(); - log.info("Executing configure() of {} (priority:{})", configurator.getClass(), configurator.getPriority()); - configurator.configure(this); - } - - } - - public void initProcessDefinitionCache() { - if (this.processDefinitionCache == null) { - if (this.processDefinitionCacheLimit <= 0) { - this.processDefinitionCache = new DefaultDeploymentCache(); - } else { - this.processDefinitionCache = new DefaultDeploymentCache(this.processDefinitionCacheLimit); - } - } - - } - - public void initProcessDefinitionInfoCache() { - if (this.processDefinitionInfoCache == null) { - if (this.processDefinitionInfoCacheLimit <= 0) { - this.processDefinitionInfoCache = new ProcessDefinitionInfoCache(this.commandExecutor); - } else { - this.processDefinitionInfoCache = new ProcessDefinitionInfoCache(this.commandExecutor, this.processDefinitionInfoCacheLimit); - } - } - - } - - public void initKnowledgeBaseCache() { - if (this.knowledgeBaseCache == null) { - if (this.knowledgeBaseCacheLimit <= 0) { - this.knowledgeBaseCache = new DefaultDeploymentCache(); - } else { - this.knowledgeBaseCache = new DefaultDeploymentCache(this.knowledgeBaseCacheLimit); - } - } - - } - - public void initDeployers() { - if (this.deployers == null) { - this.deployers = new ArrayList(); - if (this.customPreDeployers != null) { - this.deployers.addAll(this.customPreDeployers); - } - - this.deployers.addAll(this.getDefaultDeployers()); - if (this.customPostDeployers != null) { - this.deployers.addAll(this.customPostDeployers); - } - } - - if (this.deploymentManager == null) { - this.deploymentManager = new DeploymentManager(); - this.deploymentManager.setDeployers(this.deployers); - this.deploymentManager.setProcessDefinitionCache(this.processDefinitionCache); - this.deploymentManager.setProcessDefinitionInfoCache(this.processDefinitionInfoCache); - this.deploymentManager.setKnowledgeBaseCache(this.knowledgeBaseCache); - this.deploymentManager.setProcessEngineConfiguration(this); - this.deploymentManager.setProcessDefinitionEntityManager(this.processDefinitionEntityManager); - this.deploymentManager.setDeploymentEntityManager(this.deploymentEntityManager); - } - - } - - public void initBpmnDeployerDependencies() { - if (this.parsedDeploymentBuilderFactory == null) { - this.parsedDeploymentBuilderFactory = new ParsedDeploymentBuilderFactory(); - } - - if (this.parsedDeploymentBuilderFactory.getBpmnParser() == null) { - this.parsedDeploymentBuilderFactory.setBpmnParser(this.bpmnParser); - } - - if (this.timerManager == null) { - this.timerManager = new TimerManager(); - } - - if (this.eventSubscriptionManager == null) { - this.eventSubscriptionManager = new EventSubscriptionManager(); - } - - if (this.bpmnDeploymentHelper == null) { - this.bpmnDeploymentHelper = new BpmnDeploymentHelper(); - } - - if (this.bpmnDeploymentHelper.getTimerManager() == null) { - this.bpmnDeploymentHelper.setTimerManager(this.timerManager); - } - - if (this.bpmnDeploymentHelper.getEventSubscriptionManager() == null) { - this.bpmnDeploymentHelper.setEventSubscriptionManager(this.eventSubscriptionManager); - } - - if (this.cachingAndArtifactsManager == null) { - this.cachingAndArtifactsManager = new CachingAndArtifactsManager(); - } - - if (this.processDefinitionDiagramHelper == null) { - this.processDefinitionDiagramHelper = new ProcessDefinitionDiagramHelper(); - } - - } - - public Collection<? extends Deployer> getDefaultDeployers() { - List<Deployer> defaultDeployers = new ArrayList(); - if (this.bpmnDeployer == null) { - this.bpmnDeployer = new BpmnDeployer(); - } - - this.initBpmnDeployerDependencies(); - this.bpmnDeployer.setIdGenerator(this.idGenerator); - this.bpmnDeployer.setParsedDeploymentBuilderFactory(this.parsedDeploymentBuilderFactory); - this.bpmnDeployer.setBpmnDeploymentHelper(this.bpmnDeploymentHelper); - this.bpmnDeployer.setCachingAndArtifactsManager(this.cachingAndArtifactsManager); - this.bpmnDeployer.setProcessDefinitionDiagramHelper(this.processDefinitionDiagramHelper); - defaultDeployers.add(this.bpmnDeployer); - return defaultDeployers; - } - - public void initListenerFactory() { - if (this.listenerFactory == null) { - DefaultListenerFactory defaultListenerFactory = new DefaultListenerFactory(); - defaultListenerFactory.setExpressionManager(this.expressionManager); - this.listenerFactory = defaultListenerFactory; - } else if (this.listenerFactory instanceof AbstractBehaviorFactory && ((AbstractBehaviorFactory)this.listenerFactory).getExpressionManager() == null) { - ((AbstractBehaviorFactory)this.listenerFactory).setExpressionManager(this.expressionManager); - } - - } - - public void initBehaviorFactory() { - if (this.activityBehaviorFactory == null) { - DefaultActivityBehaviorFactory defaultActivityBehaviorFactory = new DefaultActivityBehaviorFactory(); - defaultActivityBehaviorFactory.setExpressionManager(this.expressionManager); - this.activityBehaviorFactory = defaultActivityBehaviorFactory; - } else if (this.activityBehaviorFactory instanceof AbstractBehaviorFactory && ((AbstractBehaviorFactory)this.activityBehaviorFactory).getExpressionManager() == null) { - ((AbstractBehaviorFactory)this.activityBehaviorFactory).setExpressionManager(this.expressionManager); - } - - } - - public void initBpmnParser() { - if (this.bpmnParser == null) { - this.bpmnParser = new BpmnParser(); - } - - if (this.bpmnParseFactory == null) { - this.bpmnParseFactory = new DefaultBpmnParseFactory(); - } - - this.bpmnParser.setBpmnParseFactory(this.bpmnParseFactory); - this.bpmnParser.setActivityBehaviorFactory(this.activityBehaviorFactory); - this.bpmnParser.setListenerFactory(this.listenerFactory); - List<BpmnParseHandler> parseHandlers = new ArrayList(); - if (this.getPreBpmnParseHandlers() != null) { - parseHandlers.addAll(this.getPreBpmnParseHandlers()); - } - - parseHandlers.addAll(this.getDefaultBpmnParseHandlers()); - if (this.getPostBpmnParseHandlers() != null) { - parseHandlers.addAll(this.getPostBpmnParseHandlers()); - } - - BpmnParseHandlers bpmnParseHandlers = new BpmnParseHandlers(); - bpmnParseHandlers.addHandlers(parseHandlers); - this.bpmnParser.setBpmnParserHandlers(bpmnParseHandlers); - } - - public List<BpmnParseHandler> getDefaultBpmnParseHandlers() { - List<BpmnParseHandler> bpmnParserHandlers = new ArrayList(); - bpmnParserHandlers.add(new BoundaryEventParseHandler()); - bpmnParserHandlers.add(new BusinessRuleParseHandler()); - bpmnParserHandlers.add(new CallActivityParseHandler()); - bpmnParserHandlers.add(new CancelEventDefinitionParseHandler()); - bpmnParserHandlers.add(new CompensateEventDefinitionParseHandler()); - bpmnParserHandlers.add(new EndEventParseHandler()); - bpmnParserHandlers.add(new ErrorEventDefinitionParseHandler()); - bpmnParserHandlers.add(new EventBasedGatewayParseHandler()); - bpmnParserHandlers.add(new ExclusiveGatewayParseHandler()); - bpmnParserHandlers.add(new InclusiveGatewayParseHandler()); - bpmnParserHandlers.add(new IntermediateCatchEventParseHandler()); - bpmnParserHandlers.add(new IntermediateThrowEventParseHandler()); - bpmnParserHandlers.add(new ManualTaskParseHandler()); - bpmnParserHandlers.add(new MessageEventDefinitionParseHandler()); - bpmnParserHandlers.add(new ParallelGatewayParseHandler()); - bpmnParserHandlers.add(new ProcessParseHandler()); - bpmnParserHandlers.add(new ReceiveTaskParseHandler()); - bpmnParserHandlers.add(new ScriptTaskParseHandler()); - bpmnParserHandlers.add(new SendTaskParseHandler()); - bpmnParserHandlers.add(new SequenceFlowParseHandler()); - bpmnParserHandlers.add(new ServiceTaskParseHandler()); - bpmnParserHandlers.add(new SignalEventDefinitionParseHandler()); - bpmnParserHandlers.add(new StartEventParseHandler()); - bpmnParserHandlers.add(new SubProcessParseHandler()); - bpmnParserHandlers.add(new EventSubProcessParseHandler()); - bpmnParserHandlers.add(new AdhocSubProcessParseHandler()); - bpmnParserHandlers.add(new TaskParseHandler()); - bpmnParserHandlers.add(new TimerEventDefinitionParseHandler()); - bpmnParserHandlers.add(new TransactionParseHandler()); - bpmnParserHandlers.add(new UserTaskParseHandler()); - if (this.customDefaultBpmnParseHandlers != null) { - Map<Class<?>, BpmnParseHandler> customParseHandlerMap = new HashMap(); - Iterator var3 = this.customDefaultBpmnParseHandlers.iterator(); - - BpmnParseHandler defaultBpmnParseHandler; - while(var3.hasNext()) { - defaultBpmnParseHandler = (BpmnParseHandler)var3.next(); - Iterator var5 = defaultBpmnParseHandler.getHandledTypes().iterator(); - - while(var5.hasNext()) { - Class<?> handledType = (Class)var5.next(); - customParseHandlerMap.put(handledType, defaultBpmnParseHandler); - } - } - - for(int i = 0; i < bpmnParserHandlers.size(); ++i) { - defaultBpmnParseHandler = (BpmnParseHandler)bpmnParserHandlers.get(i); - if (defaultBpmnParseHandler.getHandledTypes().size() != 1) { - StringBuilder supportedTypes = new StringBuilder(); - Iterator var12 = defaultBpmnParseHandler.getHandledTypes().iterator(); - - while(var12.hasNext()) { - Class<?> type = (Class)var12.next(); - supportedTypes.append(" ").append(type.getCanonicalName()).append(" "); - } - - throw new ActivitiException("The default BPMN parse handlers should only support one type, but " + defaultBpmnParseHandler.getClass() + " supports " + supportedTypes.toString() + ". This is likely a programmatic error"); - } - - Class<?> handledType = (Class)defaultBpmnParseHandler.getHandledTypes().iterator().next(); - if (customParseHandlerMap.containsKey(handledType)) { - BpmnParseHandler newBpmnParseHandler = (BpmnParseHandler)customParseHandlerMap.get(handledType); - log.info("Replacing default BpmnParseHandler " + defaultBpmnParseHandler.getClass().getName() + " with " + newBpmnParseHandler.getClass().getName()); - bpmnParserHandlers.set(i, newBpmnParseHandler); - } - } - } - - return bpmnParserHandlers; - } - - public void initClock() { - if (this.clock == null) { - this.clock = new DefaultClockImpl(); - } - - } - - public void initProcessDiagramGenerator() { - if (this.processDiagramGenerator == null) { - this.processDiagramGenerator = new DefaultProcessDiagramGenerator(); - } - - } - - public void initAgendaFactory() { - if (this.engineAgendaFactory == null) { - this.engineAgendaFactory = new DefaultActivitiEngineAgendaFactory(); - } - - } - - public void initJobHandlers() { - this.jobHandlers = new HashMap(); - AsyncContinuationJobHandler asyncContinuationJobHandler = new AsyncContinuationJobHandler(); - this.jobHandlers.put(asyncContinuationJobHandler.getType(), asyncContinuationJobHandler); - TriggerTimerEventJobHandler triggerTimerEventJobHandler = new TriggerTimerEventJobHandler(); - this.jobHandlers.put(triggerTimerEventJobHandler.getType(), triggerTimerEventJobHandler); - TimerStartEventJobHandler timerStartEvent = new TimerStartEventJobHandler(); - this.jobHandlers.put(timerStartEvent.getType(), timerStartEvent); - TimerSuspendProcessDefinitionHandler suspendProcessDefinitionHandler = new TimerSuspendProcessDefinitionHandler(); - this.jobHandlers.put(suspendProcessDefinitionHandler.getType(), suspendProcessDefinitionHandler); - TimerActivateProcessDefinitionHandler activateProcessDefinitionHandler = new TimerActivateProcessDefinitionHandler(); - this.jobHandlers.put(activateProcessDefinitionHandler.getType(), activateProcessDefinitionHandler); - ProcessEventJobHandler processEventJobHandler = new ProcessEventJobHandler(); - this.jobHandlers.put(processEventJobHandler.getType(), processEventJobHandler); - if (this.getCustomJobHandlers() != null) { - Iterator var7 = this.getCustomJobHandlers().iterator(); - - while(var7.hasNext()) { - JobHandler customJobHandler = (JobHandler)var7.next(); - this.jobHandlers.put(customJobHandler.getType(), customJobHandler); - } - } - - } - - public void initAsyncExecutor() { - if (this.asyncExecutor == null) { - DefaultAsyncJobExecutor defaultAsyncExecutor = new DefaultAsyncJobExecutor(); - defaultAsyncExecutor.setMessageQueueMode(this.asyncExecutorMessageQueueMode); - defaultAsyncExecutor.setCorePoolSize(this.asyncExecutorCorePoolSize); - defaultAsyncExecutor.setMaxPoolSize(this.asyncExecutorMaxPoolSize); - defaultAsyncExecutor.setKeepAliveTime(this.asyncExecutorThreadKeepAliveTime); - if (this.asyncExecutorThreadPoolQueue != null) { - defaultAsyncExecutor.setThreadPoolQueue(this.asyncExecutorThreadPoolQueue); - } - - defaultAsyncExecutor.setQueueSize(this.asyncExecutorThreadPoolQueueSize); - defaultAsyncExecutor.setDefaultTimerJobAcquireWaitTimeInMillis(this.asyncExecutorDefaultTimerJobAcquireWaitTime); - defaultAsyncExecutor.setDefaultAsyncJobAcquireWaitTimeInMillis(this.asyncExecutorDefaultAsyncJobAcquireWaitTime); - defaultAsyncExecutor.setDefaultQueueSizeFullWaitTimeInMillis(this.asyncExecutorDefaultQueueSizeFullWaitTime); - defaultAsyncExecutor.setTimerLockTimeInMillis(this.asyncExecutorTimerLockTimeInMillis); - defaultAsyncExecutor.setAsyncJobLockTimeInMillis(this.asyncExecutorAsyncJobLockTimeInMillis); - if (this.asyncExecutorLockOwner != null) { - defaultAsyncExecutor.setLockOwner(this.asyncExecutorLockOwner); - } - - defaultAsyncExecutor.setResetExpiredJobsInterval(this.asyncExecutorResetExpiredJobsInterval); - defaultAsyncExecutor.setResetExpiredJobsPageSize(this.asyncExecutorResetExpiredJobsPageSize); - defaultAsyncExecutor.setSecondsToWaitOnShutdown(this.asyncExecutorSecondsToWaitOnShutdown); - this.asyncExecutor = defaultAsyncExecutor; - } - - this.asyncExecutor.setProcessEngineConfiguration(this); - this.asyncExecutor.setAutoActivate(this.asyncExecutorActivate); - } - - public void initHistoryLevel() { - if (this.historyLevel == null) { - this.historyLevel = HistoryLevel.getHistoryLevelForKey(this.getHistory()); - } - - } - - public void initIdGenerator() { - if (this.idGenerator == null) { - CommandExecutor idGeneratorCommandExecutor = null; - StandaloneProcessEngineConfiguration processEngineConfiguration; - if (this.idGeneratorDataSource != null) { - processEngineConfiguration = new StandaloneProcessEngineConfiguration(); - processEngineConfiguration.setDataSource(this.idGeneratorDataSource); - processEngineConfiguration.setDatabaseSchemaUpdate("false"); - processEngineConfiguration.init(); - idGeneratorCommandExecutor = processEngineConfiguration.getCommandExecutor(); - } else if (this.idGeneratorDataSourceJndiName != null) { - processEngineConfiguration = new StandaloneProcessEngineConfiguration(); - processEngineConfiguration.setDataSourceJndiName(this.idGeneratorDataSourceJndiName); - processEngineConfiguration.setDatabaseSchemaUpdate("false"); - processEngineConfiguration.init(); - idGeneratorCommandExecutor = processEngineConfiguration.getCommandExecutor(); - } else { - idGeneratorCommandExecutor = this.getCommandExecutor(); - } - - DbIdGenerator dbIdGenerator = new DbIdGenerator(); - dbIdGenerator.setIdBlockSize(this.idBlockSize); - dbIdGenerator.setCommandExecutor(idGeneratorCommandExecutor); - dbIdGenerator.setCommandConfig(this.getDefaultCommandConfig().transactionRequiresNew()); - this.idGenerator = dbIdGenerator; - } - - } - - public void initCommandContextFactory() { - if (this.commandContextFactory == null) { - this.commandContextFactory = new CommandContextFactory(); - } - - this.commandContextFactory.setProcessEngineConfiguration(this); - } - - public void initTransactionContextFactory() { - if (this.transactionContextFactory == null) { - this.transactionContextFactory = new StandaloneMybatisTransactionContextFactory(); - } - - } - - public void initHelpers() { - if (this.processInstanceHelper == null) { - this.processInstanceHelper = new ProcessInstanceHelper(); - } - - if (this.listenerNotificationHelper == null) { - this.listenerNotificationHelper = new ListenerNotificationHelper(); - } - - } - - public void initVariableTypes() { - if (this.variableTypes == null) { - this.variableTypes = new DefaultVariableTypes(); - Iterator var1; - VariableType customVariableType; - if (this.customPreVariableTypes != null) { - var1 = this.customPreVariableTypes.iterator(); - - while(var1.hasNext()) { - customVariableType = (VariableType)var1.next(); - this.variableTypes.addType(customVariableType); - } - } - - this.variableTypes.addType(new NullType()); - this.variableTypes.addType(new StringType(this.getMaxLengthString())); - this.variableTypes.addType(new LongStringType(this.getMaxLengthString() + 1)); - this.variableTypes.addType(new BooleanType()); - this.variableTypes.addType(new ShortType()); - this.variableTypes.addType(new IntegerType()); - this.variableTypes.addType(new LongType()); - this.variableTypes.addType(new DateType()); - this.variableTypes.addType(new JodaDateType()); - this.variableTypes.addType(new JodaDateTimeType()); - this.variableTypes.addType(new DoubleType()); - this.variableTypes.addType(new UUIDType()); - this.variableTypes.addType(new JsonType(this.getMaxLengthString(), this.objectMapper)); - this.variableTypes.addType(new LongJsonType(this.getMaxLengthString() + 1, this.objectMapper)); - this.variableTypes.addType(new ByteArrayType()); - this.variableTypes.addType(new SerializableType(this.serializableVariableTypeTrackDeserializedObjects)); - this.variableTypes.addType(new CustomObjectType("item", ItemInstance.class)); - this.variableTypes.addType(new CustomObjectType("message", MessageInstance.class)); - if (this.customPostVariableTypes != null) { - var1 = this.customPostVariableTypes.iterator(); - - while(var1.hasNext()) { - customVariableType = (VariableType)var1.next(); - this.variableTypes.addType(customVariableType); - } - } - } - - } - - public int getMaxLengthString() { - if (this.maxLengthStringVariableType == -1) { - return "oracle".equalsIgnoreCase(this.databaseType) ? 2000 : 4000; - } else { - return this.maxLengthStringVariableType; - } - } - - public void initFormEngines() { - if (this.formEngines == null) { - this.formEngines = new HashMap(); - FormEngine defaultFormEngine = new JuelFormEngine(); - this.formEngines.put("", defaultFormEngine); - this.formEngines.put(defaultFormEngine.getName(), defaultFormEngine); - } - - if (this.customFormEngines != null) { - Iterator var3 = this.customFormEngines.iterator(); - - while(var3.hasNext()) { - FormEngine formEngine = (FormEngine)var3.next(); - this.formEngines.put(formEngine.getName(), formEngine); - } - } - - } - - public void initFormTypes() { - if (this.formTypes == null) { - this.formTypes = new FormTypes(); - this.formTypes.addFormType(new StringFormType()); - this.formTypes.addFormType(new LongFormType()); - this.formTypes.addFormType(new DateFormType("dd/MM/yyyy")); - this.formTypes.addFormType(new BooleanFormType()); - this.formTypes.addFormType(new DoubleFormType()); - } - - if (this.customFormTypes != null) { - Iterator var1 = this.customFormTypes.iterator(); - - while(var1.hasNext()) { - AbstractFormType customFormType = (AbstractFormType)var1.next(); - this.formTypes.addFormType(customFormType); - } - } - - } - - public void initScriptingEngines() { - if (this.resolverFactories == null) { - this.resolverFactories = new ArrayList(); - this.resolverFactories.add(new VariableScopeResolverFactory()); - this.resolverFactories.add(new BeansResolverFactory()); - } - - if (this.scriptingEngines == null) { - this.scriptingEngines = new ScriptingEngines(new ScriptBindingsFactory(this, this.resolverFactories)); - } - - } - - public void initExpressionManager() { - if (this.expressionManager == null) { - this.expressionManager = new ExpressionManager(this.beans); - } - - } - - public void initBusinessCalendarManager() { - if (this.businessCalendarManager == null) { - MapBusinessCalendarManager mapBusinessCalendarManager = new MapBusinessCalendarManager(); - mapBusinessCalendarManager.addBusinessCalendar(DurationBusinessCalendar.NAME, new DurationBusinessCalendar(this.clock)); - mapBusinessCalendarManager.addBusinessCalendar("dueDate", new DueDateBusinessCalendar(this.clock)); - mapBusinessCalendarManager.addBusinessCalendar(CycleBusinessCalendar.NAME, new CycleBusinessCalendar(this.clock)); - this.businessCalendarManager = mapBusinessCalendarManager; - } - - } - - public void initDelegateInterceptor() { - if (this.delegateInterceptor == null) { - this.delegateInterceptor = new DefaultDelegateInterceptor(); - } - - } - - public void initEventHandlers() { - if (this.eventHandlers == null) { - this.eventHandlers = new HashMap(); - SignalEventHandler signalEventHandler = new SignalEventHandler(); - this.eventHandlers.put(signalEventHandler.getEventHandlerType(), signalEventHandler); - CompensationEventHandler compensationEventHandler = new CompensationEventHandler(); - this.eventHandlers.put(compensationEventHandler.getEventHandlerType(), compensationEventHandler); - MessageEventHandler messageEventHandler = new MessageEventHandler(); - this.eventHandlers.put(messageEventHandler.getEventHandlerType(), messageEventHandler); - } - - if (this.customEventHandlers != null) { - Iterator var4 = this.customEventHandlers.iterator(); - - while(var4.hasNext()) { - EventHandler eventHandler = (EventHandler)var4.next(); - this.eventHandlers.put(eventHandler.getEventHandlerType(), eventHandler); - } - } - - } - - public void initJpa() { - if (this.jpaPersistenceUnitName != null) { - this.jpaEntityManagerFactory =JpaHelper.createEntityManagerFactory(this.jpaPersistenceUnitName); - } - - if (this.jpaEntityManagerFactory != null) { - this.sessionFactories.put(EntityManagerSession.class, new EntityManagerSessionFactory(this.jpaEntityManagerFactory, this.jpaHandleTransaction, this.jpaCloseEntityManager)); - VariableType jpaType = this.variableTypes.getVariableType("jpa-entity"); - if (jpaType == null) { - int serializableIndex = this.variableTypes.getTypeIndex("serializable"); - if (serializableIndex > -1) { - this.variableTypes.addType(new JPAEntityVariableType(), serializableIndex); - } else { - this.variableTypes.addType(new JPAEntityVariableType()); - } - } - - jpaType = this.variableTypes.getVariableType("jpa-entity-list"); - if (jpaType == null) { - this.variableTypes.addType(new JPAEntityListVariableType(), this.variableTypes.getTypeIndex("jpa-entity")); - } - } - - } - - public void initBeans() { - if (this.beans == null) { - this.beans = new HashMap(); - } - - } - - public void initEventDispatcher() { - if (this.eventDispatcher == null) { - this.eventDispatcher = new ActivitiEventDispatcherImpl(); - } - - this.eventDispatcher.setEnabled(this.enableEventDispatcher); - Iterator var1; - if (this.eventListeners != null) { - var1 = this.eventListeners.iterator(); - - while(var1.hasNext()) { - ActivitiEventListener listenerToAdd = (ActivitiEventListener)var1.next(); - this.eventDispatcher.addEventListener(listenerToAdd); - } - } - - if (this.typedEventListeners != null) { - var1 = this.typedEventListeners.entrySet().iterator(); - - while(var1.hasNext()) { - Map.Entry<String, List<ActivitiEventListener>> listenersToAdd = (Map.Entry)var1.next(); - ActivitiEventType[] types = ActivitiEventType.getTypesFromString((String)listenersToAdd.getKey()); - Iterator var4 = ((List)listenersToAdd.getValue()).iterator(); - - while(var4.hasNext()) { - ActivitiEventListener listenerToAdd = (ActivitiEventListener)var4.next(); - this.eventDispatcher.addEventListener(listenerToAdd, types); - } - } - } - - } - - public void initProcessValidator() { - if (this.processValidator == null) { - this.processValidator = (new ProcessValidatorFactory()).createDefaultProcessValidator(); - } - - } - - public void initDatabaseEventLogging() { - if (this.enableDatabaseEventLogging) { - this.getEventDispatcher().addEventListener(new EventLogger(this.clock, this.objectMapper)); - } - - } - - public void initActiviti5CompatibilityHandler() { - if (!this.isActiviti5CompatibilityEnabled || this.activiti5CompatibilityHandler == null) { - if (this.activiti5CompatibilityHandlerFactory == null) { - this.activiti5CompatibilityHandlerFactory = new DefaultActiviti5CompatibilityHandlerFactory(); - } - - this.activiti5CompatibilityHandler = this.activiti5CompatibilityHandlerFactory.createActiviti5CompatibilityHandler(); - if (this.activiti5CompatibilityHandler != null) { - log.info("Found compatibility handler instance : " + this.activiti5CompatibilityHandler.getClass()); - } - } - - } - - protected void postProcessEngineInitialisation() { - if (this.performanceSettings.isValidateExecutionRelationshipCountConfigOnBoot()) { - this.commandExecutor.execute(new ValidateExecutionRelatedEntityCountCfgCmd()); - } - - } - - public CommandConfig getDefaultCommandConfig() { - return this.defaultCommandConfig; - } - - public void setDefaultCommandConfig(CommandConfig defaultCommandConfig) { - this.defaultCommandConfig = defaultCommandConfig; - } - - public CommandConfig getSchemaCommandConfig() { - return this.schemaCommandConfig; - } - - public void setSchemaCommandConfig(CommandConfig schemaCommandConfig) { - this.schemaCommandConfig = schemaCommandConfig; - } - - public CommandInterceptor getCommandInvoker() { - return this.commandInvoker; - } - - public void setCommandInvoker(CommandInterceptor commandInvoker) { - this.commandInvoker = commandInvoker; - } - - public List<CommandInterceptor> getCustomPreCommandInterceptors() { - return this.customPreCommandInterceptors; - } - - public ProcessEngineConfigurationImpl setCustomPreCommandInterceptors(List<CommandInterceptor> customPreCommandInterceptors) { - this.customPreCommandInterceptors = customPreCommandInterceptors; - return this; - } - - public List<CommandInterceptor> getCustomPostCommandInterceptors() { - return this.customPostCommandInterceptors; - } - - public ProcessEngineConfigurationImpl setCustomPostCommandInterceptors(List<CommandInterceptor> customPostCommandInterceptors) { - this.customPostCommandInterceptors = customPostCommandInterceptors; - return this; - } - - public List<CommandInterceptor> getCommandInterceptors() { - return this.commandInterceptors; - } - - public ProcessEngineConfigurationImpl setCommandInterceptors(List<CommandInterceptor> commandInterceptors) { - this.commandInterceptors = commandInterceptors; - return this; - } - - public CommandExecutor getCommandExecutor() { - return this.commandExecutor; - } - - public ProcessEngineConfigurationImpl setCommandExecutor(CommandExecutor commandExecutor) { - this.commandExecutor = commandExecutor; - return this; - } - - public RepositoryService getRepositoryService() { - return this.repositoryService; - } - - public ProcessEngineConfigurationImpl setRepositoryService(RepositoryService repositoryService) { - this.repositoryService = repositoryService; - return this; - } - - public RuntimeService getRuntimeService() { - return this.runtimeService; - } - - public ProcessEngineConfigurationImpl setRuntimeService(RuntimeService runtimeService) { - this.runtimeService = runtimeService; - return this; - } - - public HistoryService getHistoryService() { - return this.historyService; - } - - public ProcessEngineConfigurationImpl setHistoryService(HistoryService historyService) { - this.historyService = historyService; - return this; - } - - public IdentityService getIdentityService() { - return this.identityService; - } - - public ProcessEngineConfigurationImpl setIdentityService(IdentityService identityService) { - this.identityService = identityService; - return this; - } - - public TaskService getTaskService() { - return this.taskService; - } - - public ProcessEngineConfigurationImpl setTaskService(TaskService taskService) { - this.taskService = taskService; - return this; - } - - public FormService getFormService() { - return this.formService; - } - - public ProcessEngineConfigurationImpl setFormService(FormService formService) { - this.formService = formService; - return this; - } - - public ManagementService getManagementService() { - return this.managementService; - } - - public ProcessEngineConfigurationImpl setManagementService(ManagementService managementService) { - this.managementService = managementService; - return this; - } - - public DynamicBpmnService getDynamicBpmnService() { - return this.dynamicBpmnService; - } - - public ProcessEngineConfigurationImpl setDynamicBpmnService(DynamicBpmnService dynamicBpmnService) { - this.dynamicBpmnService = dynamicBpmnService; - return this; - } - - public ProcessEngineConfigurationImpl getProcessEngineConfiguration() { - return this; - } - - public boolean isFormEngineInitialized() { - return this.formEngineInitialized; - } - - public ProcessEngineConfigurationImpl setFormEngineInitialized(boolean formEngineInitialized) { - this.formEngineInitialized = formEngineInitialized; - return this; - } - - public FormRepositoryService getFormEngineRepositoryService() { - return this.formEngineRepositoryService; - } - - public ProcessEngineConfigurationImpl setFormEngineRepositoryService(FormRepositoryService formEngineRepositoryService) { - this.formEngineRepositoryService = formEngineRepositoryService; - return this; - } - - public org.activiti.form.api.FormService getFormEngineFormService() { - return this.formEngineFormService; - } - - public ProcessEngineConfigurationImpl setFormEngineFormService(org.activiti.form.api.FormService formEngineFormService) { - this.formEngineFormService = formEngineFormService; - return this; - } - - public boolean isDmnEngineInitialized() { - return this.dmnEngineInitialized; - } - - public ProcessEngineConfigurationImpl setDmnEngineInitialized(boolean dmnEngineInitialized) { - this.dmnEngineInitialized = dmnEngineInitialized; - return this; - } - - public DmnRepositoryService getDmnEngineRepositoryService() { - return this.dmnEngineRepositoryService; - } - - public ProcessEngineConfigurationImpl setDmnEngineRepositoryService(DmnRepositoryService dmnEngineRepositoryService) { - this.dmnEngineRepositoryService = dmnEngineRepositoryService; - return this; - } - - public DmnRuleService getDmnEngineRuleService() { - return this.dmnEngineRuleService; - } - - public ProcessEngineConfigurationImpl setDmnEngineRuleService(DmnRuleService dmnEngineRuleService) { - this.dmnEngineRuleService = dmnEngineRuleService; - return this; - } - - public Map<Class<?>, SessionFactory> getSessionFactories() { - return this.sessionFactories; - } - - public ProcessEngineConfigurationImpl setSessionFactories(Map<Class<?>, SessionFactory> sessionFactories) { - this.sessionFactories = sessionFactories; - return this; - } - - public List<ProcessEngineConfigurator> getConfigurators() { - return this.configurators; - } - - public ProcessEngineConfigurationImpl addConfigurator(ProcessEngineConfigurator configurator) { - if (this.configurators == null) { - this.configurators = new ArrayList(); - } - - this.configurators.add(configurator); - return this; - } - - public ProcessEngineConfigurationImpl setConfigurators(List<ProcessEngineConfigurator> configurators) { - this.configurators = configurators; - return this; - } - - public void setEnableConfiguratorServiceLoader(boolean enableConfiguratorServiceLoader) { - this.enableConfiguratorServiceLoader = enableConfiguratorServiceLoader; - } - - public List<ProcessEngineConfigurator> getAllConfigurators() { - return this.allConfigurators; - } - - public BpmnDeployer getBpmnDeployer() { - return this.bpmnDeployer; - } - - public ProcessEngineConfigurationImpl setBpmnDeployer(BpmnDeployer bpmnDeployer) { - this.bpmnDeployer = bpmnDeployer; - return this; - } - - public BpmnParser getBpmnParser() { - return this.bpmnParser; - } - - public ProcessEngineConfigurationImpl setBpmnParser(BpmnParser bpmnParser) { - this.bpmnParser = bpmnParser; - return this; - } - - public ParsedDeploymentBuilderFactory getParsedDeploymentBuilderFactory() { - return this.parsedDeploymentBuilderFactory; - } - - public ProcessEngineConfigurationImpl setParsedDeploymentBuilderFactory(ParsedDeploymentBuilderFactory parsedDeploymentBuilderFactory) { - this.parsedDeploymentBuilderFactory = parsedDeploymentBuilderFactory; - return this; - } - - public TimerManager getTimerManager() { - return this.timerManager; - } - - public void setTimerManager(TimerManager timerManager) { - this.timerManager = timerManager; - } - - public EventSubscriptionManager getEventSubscriptionManager() { - return this.eventSubscriptionManager; - } - - public void setEventSubscriptionManager(EventSubscriptionManager eventSubscriptionManager) { - this.eventSubscriptionManager = eventSubscriptionManager; - } - - public BpmnDeploymentHelper getBpmnDeploymentHelper() { - return this.bpmnDeploymentHelper; - } - - public ProcessEngineConfigurationImpl setBpmnDeploymentHelper(BpmnDeploymentHelper bpmnDeploymentHelper) { - this.bpmnDeploymentHelper = bpmnDeploymentHelper; - return this; - } - - public CachingAndArtifactsManager getCachingAndArtifactsManager() { - return this.cachingAndArtifactsManager; - } - - public void setCachingAndArtifactsManager(CachingAndArtifactsManager cachingAndArtifactsManager) { - this.cachingAndArtifactsManager = cachingAndArtifactsManager; - } - - public ProcessDefinitionDiagramHelper getProcessDefinitionDiagramHelper() { - return this.processDefinitionDiagramHelper; - } - - public ProcessEngineConfigurationImpl setProcessDefinitionDiagramHelper(ProcessDefinitionDiagramHelper processDefinitionDiagramHelper) { - this.processDefinitionDiagramHelper = processDefinitionDiagramHelper; - return this; - } - - public List<Deployer> getDeployers() { - return this.deployers; - } - - public ProcessEngineConfigurationImpl setDeployers(List<Deployer> deployers) { - this.deployers = deployers; - return this; - } - - public IdGenerator getIdGenerator() { - return this.idGenerator; - } - - public ProcessEngineConfigurationImpl setIdGenerator(IdGenerator idGenerator) { - this.idGenerator = idGenerator; - return this; - } - - public String getWsSyncFactoryClassName() { - return this.wsSyncFactoryClassName; - } - - public ProcessEngineConfigurationImpl setWsSyncFactoryClassName(String wsSyncFactoryClassName) { - this.wsSyncFactoryClassName = wsSyncFactoryClassName; - return this; - } - - public ProcessEngineConfiguration addWsEndpointAddress(QName endpointName, URL address) { - this.wsOverridenEndpointAddresses.put(endpointName, address); - return this; - } - - public ProcessEngineConfiguration removeWsEndpointAddress(QName endpointName) { - this.wsOverridenEndpointAddresses.remove(endpointName); - return this; - } - - public ConcurrentMap<QName, URL> getWsOverridenEndpointAddresses() { - return this.wsOverridenEndpointAddresses; - } - - public ProcessEngineConfiguration setWsOverridenEndpointAddresses(ConcurrentMap<QName, URL> wsOverridenEndpointAddress) { - this.wsOverridenEndpointAddresses.putAll(wsOverridenEndpointAddress); - return this; - } - - public Map<String, FormEngine> getFormEngines() { - return this.formEngines; - } - - public ProcessEngineConfigurationImpl setFormEngines(Map<String, FormEngine> formEngines) { - this.formEngines = formEngines; - return this; - } - - public FormTypes getFormTypes() { - return this.formTypes; - } - - public ProcessEngineConfigurationImpl setFormTypes(FormTypes formTypes) { - this.formTypes = formTypes; - return this; - } - - public ScriptingEngines getScriptingEngines() { - return this.scriptingEngines; - } - - public ProcessEngineConfigurationImpl setScriptingEngines(ScriptingEngines scriptingEngines) { - this.scriptingEngines = scriptingEngines; - return this; - } - - public VariableTypes getVariableTypes() { - return this.variableTypes; - } - - public ProcessEngineConfigurationImpl setVariableTypes(VariableTypes variableTypes) { - this.variableTypes = variableTypes; - return this; - } - - public boolean isSerializableVariableTypeTrackDeserializedObjects() { - return this.serializableVariableTypeTrackDeserializedObjects; - } - - public void setSerializableVariableTypeTrackDeserializedObjects(boolean serializableVariableTypeTrackDeserializedObjects) { - this.serializableVariableTypeTrackDeserializedObjects = serializableVariableTypeTrackDeserializedObjects; - } - - public ExpressionManager getExpressionManager() { - return this.expressionManager; - } - - public ProcessEngineConfigurationImpl setExpressionManager(ExpressionManager expressionManager) { - this.expressionManager = expressionManager; - return this; - } - - public BusinessCalendarManager getBusinessCalendarManager() { - return this.businessCalendarManager; - } - - public ProcessEngineConfigurationImpl setBusinessCalendarManager(BusinessCalendarManager businessCalendarManager) { - this.businessCalendarManager = businessCalendarManager; - return this; - } - - public int getExecutionQueryLimit() { - return this.executionQueryLimit; - } - - public ProcessEngineConfigurationImpl setExecutionQueryLimit(int executionQueryLimit) { - this.executionQueryLimit = executionQueryLimit; - return this; - } - - public int getTaskQueryLimit() { - return this.taskQueryLimit; - } - - public ProcessEngineConfigurationImpl setTaskQueryLimit(int taskQueryLimit) { - this.taskQueryLimit = taskQueryLimit; - return this; - } - - public int getHistoricTaskQueryLimit() { - return this.historicTaskQueryLimit; - } - - public ProcessEngineConfigurationImpl setHistoricTaskQueryLimit(int historicTaskQueryLimit) { - this.historicTaskQueryLimit = historicTaskQueryLimit; - return this; - } - - public int getHistoricProcessInstancesQueryLimit() { - return this.historicProcessInstancesQueryLimit; - } - - public ProcessEngineConfigurationImpl setHistoricProcessInstancesQueryLimit(int historicProcessInstancesQueryLimit) { - this.historicProcessInstancesQueryLimit = historicProcessInstancesQueryLimit; - return this; - } - - public CommandContextFactory getCommandContextFactory() { - return this.commandContextFactory; - } - - public ProcessEngineConfigurationImpl setCommandContextFactory(CommandContextFactory commandContextFactory) { - this.commandContextFactory = commandContextFactory; - return this; - } - - public TransactionContextFactory getTransactionContextFactory() { - return this.transactionContextFactory; - } - - public ProcessEngineConfigurationImpl setTransactionContextFactory(TransactionContextFactory transactionContextFactory) { - this.transactionContextFactory = transactionContextFactory; - return this; - } - - public List<Deployer> getCustomPreDeployers() { - return this.customPreDeployers; - } - - public ProcessEngineConfigurationImpl setCustomPreDeployers(List<Deployer> customPreDeployers) { - this.customPreDeployers = customPreDeployers; - return this; - } - - public List<Deployer> getCustomPostDeployers() { - return this.customPostDeployers; - } - - public ProcessEngineConfigurationImpl setCustomPostDeployers(List<Deployer> customPostDeployers) { - this.customPostDeployers = customPostDeployers; - return this; - } - - public Map<String, JobHandler> getJobHandlers() { - return this.jobHandlers; - } - - public ProcessEngineConfigurationImpl setJobHandlers(Map<String, JobHandler> jobHandlers) { - this.jobHandlers = jobHandlers; - return this; - } - - public ProcessInstanceHelper getProcessInstanceHelper() { - return this.processInstanceHelper; - } - - public ProcessEngineConfigurationImpl setProcessInstanceHelper(ProcessInstanceHelper processInstanceHelper) { - this.processInstanceHelper = processInstanceHelper; - return this; - } - - public ListenerNotificationHelper getListenerNotificationHelper() { - return this.listenerNotificationHelper; - } - - public ProcessEngineConfigurationImpl setListenerNotificationHelper(ListenerNotificationHelper listenerNotificationHelper) { - this.listenerNotificationHelper = listenerNotificationHelper; - return this; - } - - public SqlSessionFactory getSqlSessionFactory() { - return this.sqlSessionFactory; - } - - public ProcessEngineConfigurationImpl setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) { - this.sqlSessionFactory = sqlSessionFactory; - return this; - } - - public DbSqlSessionFactory getDbSqlSessionFactory() { - return this.dbSqlSessionFactory; - } - - public ProcessEngineConfigurationImpl setDbSqlSessionFactory(DbSqlSessionFactory dbSqlSessionFactory) { - this.dbSqlSessionFactory = dbSqlSessionFactory; - return this; - } - - public TransactionFactory getTransactionFactory() { - return this.transactionFactory; - } - - public ProcessEngineConfigurationImpl setTransactionFactory(TransactionFactory transactionFactory) { - this.transactionFactory = transactionFactory; - return this; - } - - public List<SessionFactory> getCustomSessionFactories() { - return this.customSessionFactories; - } - - public ProcessEngineConfigurationImpl setCustomSessionFactories(List<SessionFactory> customSessionFactories) { - this.customSessionFactories = customSessionFactories; - return this; - } - - public List<JobHandler> getCustomJobHandlers() { - return this.customJobHandlers; - } - - public ProcessEngineConfigurationImpl setCustomJobHandlers(List<JobHandler> customJobHandlers) { - this.customJobHandlers = customJobHandlers; - return this; - } - - public List<FormEngine> getCustomFormEngines() { - return this.customFormEngines; - } - - public ProcessEngineConfigurationImpl setCustomFormEngines(List<FormEngine> customFormEngines) { - this.customFormEngines = customFormEngines; - return this; - } - - public List<AbstractFormType> getCustomFormTypes() { - return this.customFormTypes; - } - - public ProcessEngineConfigurationImpl setCustomFormTypes(List<AbstractFormType> customFormTypes) { - this.customFormTypes = customFormTypes; - return this; - } - - public List<String> getCustomScriptingEngineClasses() { - return this.customScriptingEngineClasses; - } - - public ProcessEngineConfigurationImpl setCustomScriptingEngineClasses(List<String> customScriptingEngineClasses) { - this.customScriptingEngineClasses = customScriptingEngineClasses; - return this; - } - - public List<VariableType> getCustomPreVariableTypes() { - return this.customPreVariableTypes; - } - - public ProcessEngineConfigurationImpl setCustomPreVariableTypes(List<VariableType> customPreVariableTypes) { - this.customPreVariableTypes = customPreVariableTypes; - return this; - } - - public List<VariableType> getCustomPostVariableTypes() { - return this.customPostVariableTypes; - } - - public ProcessEngineConfigurationImpl setCustomPostVariableTypes(List<VariableType> customPostVariableTypes) { - this.customPostVariableTypes = customPostVariableTypes; - return this; - } - - public List<BpmnParseHandler> getPreBpmnParseHandlers() { - return this.preBpmnParseHandlers; - } - - public ProcessEngineConfigurationImpl setPreBpmnParseHandlers(List<BpmnParseHandler> preBpmnParseHandlers) { - this.preBpmnParseHandlers = preBpmnParseHandlers; - return this; - } - - public List<BpmnParseHandler> getCustomDefaultBpmnParseHandlers() { - return this.customDefaultBpmnParseHandlers; - } - - public ProcessEngineConfigurationImpl setCustomDefaultBpmnParseHandlers(List<BpmnParseHandler> customDefaultBpmnParseHandlers) { - this.customDefaultBpmnParseHandlers = customDefaultBpmnParseHandlers; - return this; - } - - public List<BpmnParseHandler> getPostBpmnParseHandlers() { - return this.postBpmnParseHandlers; - } - - public ProcessEngineConfigurationImpl setPostBpmnParseHandlers(List<BpmnParseHandler> postBpmnParseHandlers) { - this.postBpmnParseHandlers = postBpmnParseHandlers; - return this; - } - - public ActivityBehaviorFactory getActivityBehaviorFactory() { - return this.activityBehaviorFactory; - } - - public ProcessEngineConfigurationImpl setActivityBehaviorFactory(ActivityBehaviorFactory activityBehaviorFactory) { - this.activityBehaviorFactory = activityBehaviorFactory; - return this; - } - - public ListenerFactory getListenerFactory() { - return this.listenerFactory; - } - - public ProcessEngineConfigurationImpl setListenerFactory(ListenerFactory listenerFactory) { - this.listenerFactory = listenerFactory; - return this; - } - - public BpmnParseFactory getBpmnParseFactory() { - return this.bpmnParseFactory; - } - - public ProcessEngineConfigurationImpl setBpmnParseFactory(BpmnParseFactory bpmnParseFactory) { - this.bpmnParseFactory = bpmnParseFactory; - return this; - } - - public Map<Object, Object> getBeans() { - return this.beans; - } - - public ProcessEngineConfigurationImpl setBeans(Map<Object, Object> beans) { - this.beans = beans; - return this; - } - - public List<ResolverFactory> getResolverFactories() { - return this.resolverFactories; - } - - public ProcessEngineConfigurationImpl setResolverFactories(List<ResolverFactory> resolverFactories) { - this.resolverFactories = resolverFactories; - return this; - } - - public DeploymentManager getDeploymentManager() { - return this.deploymentManager; - } - - public ProcessEngineConfigurationImpl setDeploymentManager(DeploymentManager deploymentManager) { - this.deploymentManager = deploymentManager; - return this; - } - - public ProcessEngineConfigurationImpl setDelegateInterceptor(DelegateInterceptor delegateInterceptor) { - this.delegateInterceptor = delegateInterceptor; - return this; - } - - public DelegateInterceptor getDelegateInterceptor() { - return this.delegateInterceptor; - } - - public EventHandler getEventHandler(String eventType) { - return (EventHandler)this.eventHandlers.get(eventType); - } - - public ProcessEngineConfigurationImpl setEventHandlers(Map<String, EventHandler> eventHandlers) { - this.eventHandlers = eventHandlers; - return this; - } - - public Map<String, EventHandler> getEventHandlers() { - return this.eventHandlers; - } - - public List<EventHandler> getCustomEventHandlers() { - return this.customEventHandlers; - } - - public ProcessEngineConfigurationImpl setCustomEventHandlers(List<EventHandler> customEventHandlers) { - this.customEventHandlers = customEventHandlers; - return this; - } - - public FailedJobCommandFactory getFailedJobCommandFactory() { - return this.failedJobCommandFactory; - } - - public ProcessEngineConfigurationImpl setFailedJobCommandFactory(FailedJobCommandFactory failedJobCommandFactory) { - this.failedJobCommandFactory = failedJobCommandFactory; - return this; - } - - public DataSource getIdGeneratorDataSource() { - return this.idGeneratorDataSource; - } - - public ProcessEngineConfigurationImpl setIdGeneratorDataSource(DataSource idGeneratorDataSource) { - this.idGeneratorDataSource = idGeneratorDataSource; - return this; - } - - public String getIdGeneratorDataSourceJndiName() { - return this.idGeneratorDataSourceJndiName; - } - - public ProcessEngineConfigurationImpl setIdGeneratorDataSourceJndiName(String idGeneratorDataSourceJndiName) { - this.idGeneratorDataSourceJndiName = idGeneratorDataSourceJndiName; - return this; - } - - public int getBatchSizeProcessInstances() { - return this.batchSizeProcessInstances; - } - - public ProcessEngineConfigurationImpl setBatchSizeProcessInstances(int batchSizeProcessInstances) { - this.batchSizeProcessInstances = batchSizeProcessInstances; - return this; - } - - public int getBatchSizeTasks() { - return this.batchSizeTasks; - } - - public ProcessEngineConfigurationImpl setBatchSizeTasks(int batchSizeTasks) { - this.batchSizeTasks = batchSizeTasks; - return this; - } - - public int getProcessDefinitionCacheLimit() { - return this.processDefinitionCacheLimit; - } - - public ProcessEngineConfigurationImpl setProcessDefinitionCacheLimit(int processDefinitionCacheLimit) { - this.processDefinitionCacheLimit = processDefinitionCacheLimit; - return this; - } - - public DeploymentCache<ProcessDefinitionCacheEntry> getProcessDefinitionCache() { - return this.processDefinitionCache; - } - - public ProcessEngineConfigurationImpl setProcessDefinitionCache(DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache) { - this.processDefinitionCache = processDefinitionCache; - return this; - } - - public int getKnowledgeBaseCacheLimit() { - return this.knowledgeBaseCacheLimit; - } - - public ProcessEngineConfigurationImpl setKnowledgeBaseCacheLimit(int knowledgeBaseCacheLimit) { - this.knowledgeBaseCacheLimit = knowledgeBaseCacheLimit; - return this; - } - - public DeploymentCache<Object> getKnowledgeBaseCache() { - return this.knowledgeBaseCache; - } - - public ProcessEngineConfigurationImpl setKnowledgeBaseCache(DeploymentCache<Object> knowledgeBaseCache) { - this.knowledgeBaseCache = knowledgeBaseCache; - return this; - } - - public boolean isEnableSafeBpmnXml() { - return this.enableSafeBpmnXml; - } - - public ProcessEngineConfigurationImpl setEnableSafeBpmnXml(boolean enableSafeBpmnXml) { - this.enableSafeBpmnXml = enableSafeBpmnXml; - return this; - } - - public ActivitiEventDispatcher getEventDispatcher() { - return this.eventDispatcher; - } - - public ProcessEngineConfigurationImpl setEventDispatcher(ActivitiEventDispatcher eventDispatcher) { - this.eventDispatcher = eventDispatcher; - return this; - } - - public ProcessEngineConfigurationImpl setEnableEventDispatcher(boolean enableEventDispatcher) { - this.enableEventDispatcher = enableEventDispatcher; - return this; - } - - public Map<String, List<ActivitiEventListener>> getTypedEventListeners() { - return this.typedEventListeners; - } - - public ProcessEngineConfigurationImpl setTypedEventListeners(Map<String, List<ActivitiEventListener>> typedListeners) { - this.typedEventListeners = typedListeners; - return this; - } - - public List<ActivitiEventListener> getEventListeners() { - return this.eventListeners; - } - - public ProcessEngineConfigurationImpl setEventListeners(List<ActivitiEventListener> eventListeners) { - this.eventListeners = eventListeners; - return this; - } - - public ProcessValidator getProcessValidator() { - return this.processValidator; - } - - public ProcessEngineConfigurationImpl setProcessValidator(ProcessValidator processValidator) { - this.processValidator = processValidator; - return this; - } - - public boolean isEnableEventDispatcher() { - return this.enableEventDispatcher; - } - - public boolean isEnableDatabaseEventLogging() { - return this.enableDatabaseEventLogging; - } - - public ProcessEngineConfigurationImpl setEnableDatabaseEventLogging(boolean enableDatabaseEventLogging) { - this.enableDatabaseEventLogging = enableDatabaseEventLogging; - return this; - } - - public int getMaxLengthStringVariableType() { - return this.maxLengthStringVariableType; - } - - public ProcessEngineConfigurationImpl setMaxLengthStringVariableType(int maxLengthStringVariableType) { - this.maxLengthStringVariableType = maxLengthStringVariableType; - return this; - } - - public boolean isBulkInsertEnabled() { - return this.isBulkInsertEnabled; - } - - public ProcessEngineConfigurationImpl setBulkInsertEnabled(boolean isBulkInsertEnabled) { - this.isBulkInsertEnabled = isBulkInsertEnabled; - return this; - } - - public int getMaxNrOfStatementsInBulkInsert() { - return this.maxNrOfStatementsInBulkInsert; - } - - public ProcessEngineConfigurationImpl setMaxNrOfStatementsInBulkInsert(int maxNrOfStatementsInBulkInsert) { - this.maxNrOfStatementsInBulkInsert = maxNrOfStatementsInBulkInsert; - return this; - } - - public boolean isUsingRelationalDatabase() { - return this.usingRelationalDatabase; - } - - public ProcessEngineConfigurationImpl setUsingRelationalDatabase(boolean usingRelationalDatabase) { - this.usingRelationalDatabase = usingRelationalDatabase; - return this; - } - - public boolean isEnableVerboseExecutionTreeLogging() { - return this.enableVerboseExecutionTreeLogging; - } - - public ProcessEngineConfigurationImpl setEnableVerboseExecutionTreeLogging(boolean enableVerboseExecutionTreeLogging) { - this.enableVerboseExecutionTreeLogging = enableVerboseExecutionTreeLogging; - return this; - } - - public ProcessEngineConfigurationImpl setEnableEagerExecutionTreeFetching(boolean enableEagerExecutionTreeFetching) { - this.performanceSettings.setEnableEagerExecutionTreeFetching(enableEagerExecutionTreeFetching); - return this; - } - - public ProcessEngineConfigurationImpl setEnableExecutionRelationshipCounts(boolean enableExecutionRelationshipCounts) { - this.performanceSettings.setEnableExecutionRelationshipCounts(enableExecutionRelationshipCounts); - return this; - } - - public PerformanceSettings getPerformanceSettings() { - return this.performanceSettings; - } - - public void setPerformanceSettings(PerformanceSettings performanceSettings) { - this.performanceSettings = performanceSettings; - } - - public ProcessEngineConfigurationImpl setEnableLocalization(boolean enableLocalization) { - this.performanceSettings.setEnableLocalization(enableLocalization); - return this; - } - - public AttachmentDataManager getAttachmentDataManager() { - return this.attachmentDataManager; - } - - public ProcessEngineConfigurationImpl setAttachmentDataManager(AttachmentDataManager attachmentDataManager) { - this.attachmentDataManager = attachmentDataManager; - return this; - } - - public ByteArrayDataManager getByteArrayDataManager() { - return this.byteArrayDataManager; - } - - public ProcessEngineConfigurationImpl setByteArrayDataManager(ByteArrayDataManager byteArrayDataManager) { - this.byteArrayDataManager = byteArrayDataManager; - return this; - } - - public CommentDataManager getCommentDataManager() { - return this.commentDataManager; - } - - public ProcessEngineConfigurationImpl setCommentDataManager(CommentDataManager commentDataManager) { - this.commentDataManager = commentDataManager; - return this; - } - - public DeploymentDataManager getDeploymentDataManager() { - return this.deploymentDataManager; - } - - public ProcessEngineConfigurationImpl setDeploymentDataManager(DeploymentDataManager deploymentDataManager) { - this.deploymentDataManager = deploymentDataManager; - return this; - } - - public EventLogEntryDataManager getEventLogEntryDataManager() { - return this.eventLogEntryDataManager; - } - - public ProcessEngineConfigurationImpl setEventLogEntryDataManager(EventLogEntryDataManager eventLogEntryDataManager) { - this.eventLogEntryDataManager = eventLogEntryDataManager; - return this; - } - - public EventSubscriptionDataManager getEventSubscriptionDataManager() { - return this.eventSubscriptionDataManager; - } - - public ProcessEngineConfigurationImpl setEventSubscriptionDataManager(EventSubscriptionDataManager eventSubscriptionDataManager) { - this.eventSubscriptionDataManager = eventSubscriptionDataManager; - return this; - } - - public ExecutionDataManager getExecutionDataManager() { - return this.executionDataManager; - } - - public ProcessEngineConfigurationImpl setExecutionDataManager(ExecutionDataManager executionDataManager) { - this.executionDataManager = executionDataManager; - return this; - } - - public GroupDataManager getGroupDataManager() { - return this.groupDataManager; - } - - public ProcessEngineConfigurationImpl setGroupDataManager(GroupDataManager groupDataManager) { - this.groupDataManager = groupDataManager; - return this; - } - - public HistoricActivityInstanceDataManager getHistoricActivityInstanceDataManager() { - return this.historicActivityInstanceDataManager; - } - - public ProcessEngineConfigurationImpl setHistoricActivityInstanceDataManager(HistoricActivityInstanceDataManager historicActivityInstanceDataManager) { - this.historicActivityInstanceDataManager = historicActivityInstanceDataManager; - return this; - } - - public HistoricDetailDataManager getHistoricDetailDataManager() { - return this.historicDetailDataManager; - } - - public ProcessEngineConfigurationImpl setHistoricDetailDataManager(HistoricDetailDataManager historicDetailDataManager) { - this.historicDetailDataManager = historicDetailDataManager; - return this; - } - - public HistoricIdentityLinkDataManager getHistoricIdentityLinkDataManager() { - return this.historicIdentityLinkDataManager; - } - - public ProcessEngineConfigurationImpl setHistoricIdentityLinkDataManager(HistoricIdentityLinkDataManager historicIdentityLinkDataManager) { - this.historicIdentityLinkDataManager = historicIdentityLinkDataManager; - return this; - } - - public HistoricProcessInstanceDataManager getHistoricProcessInstanceDataManager() { - return this.historicProcessInstanceDataManager; - } - - public ProcessEngineConfigurationImpl setHistoricProcessInstanceDataManager(HistoricProcessInstanceDataManager historicProcessInstanceDataManager) { - this.historicProcessInstanceDataManager = historicProcessInstanceDataManager; - return this; - } - - public HistoricTaskInstanceDataManager getHistoricTaskInstanceDataManager() { - return this.historicTaskInstanceDataManager; - } - - public ProcessEngineConfigurationImpl setHistoricTaskInstanceDataManager(HistoricTaskInstanceDataManager historicTaskInstanceDataManager) { - this.historicTaskInstanceDataManager = historicTaskInstanceDataManager; - return this; - } - - public HistoricVariableInstanceDataManager getHistoricVariableInstanceDataManager() { - return this.historicVariableInstanceDataManager; - } - - public ProcessEngineConfigurationImpl setHistoricVariableInstanceDataManager(HistoricVariableInstanceDataManager historicVariableInstanceDataManager) { - this.historicVariableInstanceDataManager = historicVariableInstanceDataManager; - return this; - } - - public IdentityInfoDataManager getIdentityInfoDataManager() { - return this.identityInfoDataManager; - } - - public ProcessEngineConfigurationImpl setIdentityInfoDataManager(IdentityInfoDataManager identityInfoDataManager) { - this.identityInfoDataManager = identityInfoDataManager; - return this; - } - - public IdentityLinkDataManager getIdentityLinkDataManager() { - return this.identityLinkDataManager; - } - - public ProcessEngineConfigurationImpl setIdentityLinkDataManager(IdentityLinkDataManager identityLinkDataManager) { - this.identityLinkDataManager = identityLinkDataManager; - return this; - } - - public JobDataManager getJobDataManager() { - return this.jobDataManager; - } - - public ProcessEngineConfigurationImpl setJobDataManager(JobDataManager jobDataManager) { - this.jobDataManager = jobDataManager; - return this; - } - - public TimerJobDataManager getTimerJobDataManager() { - return this.timerJobDataManager; - } - - public ProcessEngineConfigurationImpl setTimerJobDataManager(TimerJobDataManager timerJobDataManager) { - this.timerJobDataManager = timerJobDataManager; - return this; - } - - public SuspendedJobDataManager getSuspendedJobDataManager() { - return this.suspendedJobDataManager; - } - - public ProcessEngineConfigurationImpl setSuspendedJobDataManager(SuspendedJobDataManager suspendedJobDataManager) { - this.suspendedJobDataManager = suspendedJobDataManager; - return this; - } - - public DeadLetterJobDataManager getDeadLetterJobDataManager() { - return this.deadLetterJobDataManager; - } - - public ProcessEngineConfigurationImpl setDeadLetterJobDataManager(DeadLetterJobDataManager deadLetterJobDataManager) { - this.deadLetterJobDataManager = deadLetterJobDataManager; - return this; - } - - public MembershipDataManager getMembershipDataManager() { - return this.membershipDataManager; - } - - public ProcessEngineConfigurationImpl setMembershipDataManager(MembershipDataManager membershipDataManager) { - this.membershipDataManager = membershipDataManager; - return this; - } - - public ModelDataManager getModelDataManager() { - return this.modelDataManager; - } - - public ProcessEngineConfigurationImpl setModelDataManager(ModelDataManager modelDataManager) { - this.modelDataManager = modelDataManager; - return this; - } - - public ProcessDefinitionDataManager getProcessDefinitionDataManager() { - return this.processDefinitionDataManager; - } - - public ProcessEngineConfigurationImpl setProcessDefinitionDataManager(ProcessDefinitionDataManager processDefinitionDataManager) { - this.processDefinitionDataManager = processDefinitionDataManager; - return this; - } - - public ProcessDefinitionInfoDataManager getProcessDefinitionInfoDataManager() { - return this.processDefinitionInfoDataManager; - } - - public ProcessEngineConfigurationImpl setProcessDefinitionInfoDataManager(ProcessDefinitionInfoDataManager processDefinitionInfoDataManager) { - this.processDefinitionInfoDataManager = processDefinitionInfoDataManager; - return this; - } - - public PropertyDataManager getPropertyDataManager() { - return this.propertyDataManager; - } - - public ProcessEngineConfigurationImpl setPropertyDataManager(PropertyDataManager propertyDataManager) { - this.propertyDataManager = propertyDataManager; - return this; - } - - public ResourceDataManager getResourceDataManager() { - return this.resourceDataManager; - } - - public ProcessEngineConfigurationImpl setResourceDataManager(ResourceDataManager resourceDataManager) { - this.resourceDataManager = resourceDataManager; - return this; - } - - public TaskDataManager getTaskDataManager() { - return this.taskDataManager; - } - - public ProcessEngineConfigurationImpl setTaskDataManager(TaskDataManager taskDataManager) { - this.taskDataManager = taskDataManager; - return this; - } - - public UserDataManager getUserDataManager() { - return this.userDataManager; - } - - public ProcessEngineConfigurationImpl setUserDataManager(UserDataManager userDataManager) { - this.userDataManager = userDataManager; - return this; - } - - public VariableInstanceDataManager getVariableInstanceDataManager() { - return this.variableInstanceDataManager; - } - - public ProcessEngineConfigurationImpl setVariableInstanceDataManager(VariableInstanceDataManager variableInstanceDataManager) { - this.variableInstanceDataManager = variableInstanceDataManager; - return this; - } - - public boolean isEnableConfiguratorServiceLoader() { - return this.enableConfiguratorServiceLoader; - } - - public AttachmentEntityManager getAttachmentEntityManager() { - return this.attachmentEntityManager; - } - - public ProcessEngineConfigurationImpl setAttachmentEntityManager(AttachmentEntityManager attachmentEntityManager) { - this.attachmentEntityManager = attachmentEntityManager; - return this; - } - - public ByteArrayEntityManager getByteArrayEntityManager() { - return this.byteArrayEntityManager; - } - - public ProcessEngineConfigurationImpl setByteArrayEntityManager(ByteArrayEntityManager byteArrayEntityManager) { - this.byteArrayEntityManager = byteArrayEntityManager; - return this; - } - - public CommentEntityManager getCommentEntityManager() { - return this.commentEntityManager; - } - - public ProcessEngineConfigurationImpl setCommentEntityManager(CommentEntityManager commentEntityManager) { - this.commentEntityManager = commentEntityManager; - return this; - } - - public DeploymentEntityManager getDeploymentEntityManager() { - return this.deploymentEntityManager; - } - - public ProcessEngineConfigurationImpl setDeploymentEntityManager(DeploymentEntityManager deploymentEntityManager) { - this.deploymentEntityManager = deploymentEntityManager; - return this; - } - - public EventLogEntryEntityManager getEventLogEntryEntityManager() { - return this.eventLogEntryEntityManager; - } - - public ProcessEngineConfigurationImpl setEventLogEntryEntityManager(EventLogEntryEntityManager eventLogEntryEntityManager) { - this.eventLogEntryEntityManager = eventLogEntryEntityManager; - return this; - } - - public EventSubscriptionEntityManager getEventSubscriptionEntityManager() { - return this.eventSubscriptionEntityManager; - } - - public ProcessEngineConfigurationImpl setEventSubscriptionEntityManager(EventSubscriptionEntityManager eventSubscriptionEntityManager) { - this.eventSubscriptionEntityManager = eventSubscriptionEntityManager; - return this; - } - - public ExecutionEntityManager getExecutionEntityManager() { - return this.executionEntityManager; - } - - public ProcessEngineConfigurationImpl setExecutionEntityManager(ExecutionEntityManager executionEntityManager) { - this.executionEntityManager = executionEntityManager; - return this; - } - - public GroupEntityManager getGroupEntityManager() { - return this.groupEntityManager; - } - - public ProcessEngineConfigurationImpl setGroupEntityManager(GroupEntityManager groupEntityManager) { - this.groupEntityManager = groupEntityManager; - return this; - } - - public HistoricActivityInstanceEntityManager getHistoricActivityInstanceEntityManager() { - return this.historicActivityInstanceEntityManager; - } - - public ProcessEngineConfigurationImpl setHistoricActivityInstanceEntityManager(HistoricActivityInstanceEntityManager historicActivityInstanceEntityManager) { - this.historicActivityInstanceEntityManager = historicActivityInstanceEntityManager; - return this; - } - - public HistoricDetailEntityManager getHistoricDetailEntityManager() { - return this.historicDetailEntityManager; - } - - public ProcessEngineConfigurationImpl setHistoricDetailEntityManager(HistoricDetailEntityManager historicDetailEntityManager) { - this.historicDetailEntityManager = historicDetailEntityManager; - return this; - } - - public HistoricIdentityLinkEntityManager getHistoricIdentityLinkEntityManager() { - return this.historicIdentityLinkEntityManager; - } - - public ProcessEngineConfigurationImpl setHistoricIdentityLinkEntityManager(HistoricIdentityLinkEntityManager historicIdentityLinkEntityManager) { - this.historicIdentityLinkEntityManager = historicIdentityLinkEntityManager; - return this; - } - - public HistoricProcessInstanceEntityManager getHistoricProcessInstanceEntityManager() { - return this.historicProcessInstanceEntityManager; - } - - public ProcessEngineConfigurationImpl setHistoricProcessInstanceEntityManager(HistoricProcessInstanceEntityManager historicProcessInstanceEntityManager) { - this.historicProcessInstanceEntityManager = historicProcessInstanceEntityManager; - return this; - } - - public HistoricTaskInstanceEntityManager getHistoricTaskInstanceEntityManager() { - return this.historicTaskInstanceEntityManager; - } - - public ProcessEngineConfigurationImpl setHistoricTaskInstanceEntityManager(HistoricTaskInstanceEntityManager historicTaskInstanceEntityManager) { - this.historicTaskInstanceEntityManager = historicTaskInstanceEntityManager; - return this; - } - - public HistoricVariableInstanceEntityManager getHistoricVariableInstanceEntityManager() { - return this.historicVariableInstanceEntityManager; - } - - public ProcessEngineConfigurationImpl setHistoricVariableInstanceEntityManager(HistoricVariableInstanceEntityManager historicVariableInstanceEntityManager) { - this.historicVariableInstanceEntityManager = historicVariableInstanceEntityManager; - return this; - } - - public IdentityInfoEntityManager getIdentityInfoEntityManager() { - return this.identityInfoEntityManager; - } - - public ProcessEngineConfigurationImpl setIdentityInfoEntityManager(IdentityInfoEntityManager identityInfoEntityManager) { - this.identityInfoEntityManager = identityInfoEntityManager; - return this; - } - - public IdentityLinkEntityManager getIdentityLinkEntityManager() { - return this.identityLinkEntityManager; - } - - public ProcessEngineConfigurationImpl setIdentityLinkEntityManager(IdentityLinkEntityManager identityLinkEntityManager) { - this.identityLinkEntityManager = identityLinkEntityManager; - return this; - } - - public JobEntityManager getJobEntityManager() { - return this.jobEntityManager; - } - - public ProcessEngineConfigurationImpl setJobEntityManager(JobEntityManager jobEntityManager) { - this.jobEntityManager = jobEntityManager; - return this; - } - - public TimerJobEntityManager getTimerJobEntityManager() { - return this.timerJobEntityManager; - } - - public ProcessEngineConfigurationImpl setTimerJobEntityManager(TimerJobEntityManager timerJobEntityManager) { - this.timerJobEntityManager = timerJobEntityManager; - return this; - } - - public SuspendedJobEntityManager getSuspendedJobEntityManager() { - return this.suspendedJobEntityManager; - } - - public ProcessEngineConfigurationImpl setSuspendedJobEntityManager(SuspendedJobEntityManager suspendedJobEntityManager) { - this.suspendedJobEntityManager = suspendedJobEntityManager; - return this; - } - - public DeadLetterJobEntityManager getDeadLetterJobEntityManager() { - return this.deadLetterJobEntityManager; - } - - public ProcessEngineConfigurationImpl setDeadLetterJobEntityManager(DeadLetterJobEntityManager deadLetterJobEntityManager) { - this.deadLetterJobEntityManager = deadLetterJobEntityManager; - return this; - } - - public MembershipEntityManager getMembershipEntityManager() { - return this.membershipEntityManager; - } - - public ProcessEngineConfigurationImpl setMembershipEntityManager(MembershipEntityManager membershipEntityManager) { - this.membershipEntityManager = membershipEntityManager; - return this; - } - - public ModelEntityManager getModelEntityManager() { - return this.modelEntityManager; - } - - public ProcessEngineConfigurationImpl setModelEntityManager(ModelEntityManager modelEntityManager) { - this.modelEntityManager = modelEntityManager; - return this; - } - - public ProcessDefinitionEntityManager getProcessDefinitionEntityManager() { - return this.processDefinitionEntityManager; - } - - public ProcessEngineConfigurationImpl setProcessDefinitionEntityManager(ProcessDefinitionEntityManager processDefinitionEntityManager) { - this.processDefinitionEntityManager = processDefinitionEntityManager; - return this; - } - - public ProcessDefinitionInfoEntityManager getProcessDefinitionInfoEntityManager() { - return this.processDefinitionInfoEntityManager; - } - - public ProcessEngineConfigurationImpl setProcessDefinitionInfoEntityManager(ProcessDefinitionInfoEntityManager processDefinitionInfoEntityManager) { - this.processDefinitionInfoEntityManager = processDefinitionInfoEntityManager; - return this; - } - - public PropertyEntityManager getPropertyEntityManager() { - return this.propertyEntityManager; - } - - public ProcessEngineConfigurationImpl setPropertyEntityManager(PropertyEntityManager propertyEntityManager) { - this.propertyEntityManager = propertyEntityManager; - return this; - } - - public ResourceEntityManager getResourceEntityManager() { - return this.resourceEntityManager; - } - - public ProcessEngineConfigurationImpl setResourceEntityManager(ResourceEntityManager resourceEntityManager) { - this.resourceEntityManager = resourceEntityManager; - return this; - } - - public TaskEntityManager getTaskEntityManager() { - return this.taskEntityManager; - } - - public ProcessEngineConfigurationImpl setTaskEntityManager(TaskEntityManager taskEntityManager) { - this.taskEntityManager = taskEntityManager; - return this; - } - - public UserEntityManager getUserEntityManager() { - return this.userEntityManager; - } - - public ProcessEngineConfigurationImpl setUserEntityManager(UserEntityManager userEntityManager) { - this.userEntityManager = userEntityManager; - return this; - } - - public VariableInstanceEntityManager getVariableInstanceEntityManager() { - return this.variableInstanceEntityManager; - } - - public ProcessEngineConfigurationImpl setVariableInstanceEntityManager(VariableInstanceEntityManager variableInstanceEntityManager) { - this.variableInstanceEntityManager = variableInstanceEntityManager; - return this; - } - - public TableDataManager getTableDataManager() { - return this.tableDataManager; - } - - public ProcessEngineConfigurationImpl setTableDataManager(TableDataManager tableDataManager) { - this.tableDataManager = tableDataManager; - return this; - } - - public HistoryManager getHistoryManager() { - return this.historyManager; - } - - public ProcessEngineConfigurationImpl setHistoryManager(HistoryManager historyManager) { - this.historyManager = historyManager; - return this; - } - - public JobManager getJobManager() { - return this.jobManager; - } - - public ProcessEngineConfigurationImpl setJobManager(JobManager jobManager) { - this.jobManager = jobManager; - return this; - } - - public ProcessEngineConfigurationImpl setClock(Clock clock) { - if (this.clock == null) { - this.clock = clock; - } else { - this.clock.setCurrentCalendar(clock.getCurrentCalendar()); - } - - if (this.isActiviti5CompatibilityEnabled && this.activiti5CompatibilityHandler != null) { - this.getActiviti5CompatibilityHandler().setClock(clock); - } - - return this; - } - - public void resetClock() { - if (this.clock != null) { - this.clock.reset(); - if (this.isActiviti5CompatibilityEnabled && this.activiti5CompatibilityHandler != null) { - this.getActiviti5CompatibilityHandler().resetClock(); - } - } - - } - - public DelegateExpressionFieldInjectionMode getDelegateExpressionFieldInjectionMode() { - return this.delegateExpressionFieldInjectionMode; - } - - public ProcessEngineConfigurationImpl setDelegateExpressionFieldInjectionMode(DelegateExpressionFieldInjectionMode delegateExpressionFieldInjectionMode) { - this.delegateExpressionFieldInjectionMode = delegateExpressionFieldInjectionMode; - return this; - } - - public ObjectMapper getObjectMapper() { - return this.objectMapper; - } - - public ProcessEngineConfigurationImpl setObjectMapper(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - return this; - } - - public boolean isActiviti5CompatibilityEnabled() { - return this.isActiviti5CompatibilityEnabled; - } - - public ProcessEngineConfigurationImpl setActiviti5CompatibilityEnabled(boolean isActiviti5CompatibilityEnabled) { - this.isActiviti5CompatibilityEnabled = isActiviti5CompatibilityEnabled; - return this; - } - - public Activiti5CompatibilityHandlerFactory getActiviti5CompatibilityHandlerFactory() { - return this.activiti5CompatibilityHandlerFactory; - } - - public ProcessEngineConfigurationImpl setActiviti5CompatibilityHandlerFactory(Activiti5CompatibilityHandlerFactory activiti5CompatibilityHandlerFactory) { - this.activiti5CompatibilityHandlerFactory = activiti5CompatibilityHandlerFactory; - return this; - } - - public Activiti5CompatibilityHandler getActiviti5CompatibilityHandler() { - return this.activiti5CompatibilityHandler; - } - - public ProcessEngineConfigurationImpl setActiviti5CompatibilityHandler(Activiti5CompatibilityHandler activiti5CompatibilityHandler) { - this.activiti5CompatibilityHandler = activiti5CompatibilityHandler; - return this; - } - - public Object getActiviti5ActivityBehaviorFactory() { - return this.activiti5ActivityBehaviorFactory; - } - - public ProcessEngineConfigurationImpl setActiviti5ActivityBehaviorFactory(Object activiti5ActivityBehaviorFactory) { - this.activiti5ActivityBehaviorFactory = activiti5ActivityBehaviorFactory; - return this; - } - - public Object getActiviti5ListenerFactory() { - return this.activiti5ListenerFactory; - } - - public ProcessEngineConfigurationImpl setActiviti5ListenerFactory(Object activiti5ListenerFactory) { - this.activiti5ListenerFactory = activiti5ListenerFactory; - return this; - } - - public List<Object> getActiviti5PreBpmnParseHandlers() { - return this.activiti5PreBpmnParseHandlers; - } - - public ProcessEngineConfigurationImpl setActiviti5PreBpmnParseHandlers(List<Object> activiti5PreBpmnParseHandlers) { - this.activiti5PreBpmnParseHandlers = activiti5PreBpmnParseHandlers; - return this; - } - - public List<Object> getActiviti5PostBpmnParseHandlers() { - return this.activiti5PostBpmnParseHandlers; - } - - public ProcessEngineConfigurationImpl setActiviti5PostBpmnParseHandlers(List<Object> activiti5PostBpmnParseHandlers) { - this.activiti5PostBpmnParseHandlers = activiti5PostBpmnParseHandlers; - return this; - } - - public List<Object> getActiviti5CustomDefaultBpmnParseHandlers() { - return this.activiti5CustomDefaultBpmnParseHandlers; - } - - public ProcessEngineConfigurationImpl setActiviti5CustomDefaultBpmnParseHandlers(List<Object> activiti5CustomDefaultBpmnParseHandlers) { - this.activiti5CustomDefaultBpmnParseHandlers = activiti5CustomDefaultBpmnParseHandlers; - return this; - } - - public Set<Class<?>> getActiviti5CustomMybatisMappers() { - return this.activiti5CustomMybatisMappers; - } - - public ProcessEngineConfigurationImpl setActiviti5CustomMybatisMappers(Set<Class<?>> activiti5CustomMybatisMappers) { - this.activiti5CustomMybatisMappers = activiti5CustomMybatisMappers; - return this; - } - - public Set<String> getActiviti5CustomMybatisXMLMappers() { - return this.activiti5CustomMybatisXMLMappers; - } - - public ProcessEngineConfigurationImpl setActiviti5CustomMybatisXMLMappers(Set<String> activiti5CustomMybatisXMLMappers) { - this.activiti5CustomMybatisXMLMappers = activiti5CustomMybatisXMLMappers; - return this; - } - - public int getAsyncExecutorCorePoolSize() { - return this.asyncExecutorCorePoolSize; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorCorePoolSize(int asyncExecutorCorePoolSize) { - this.asyncExecutorCorePoolSize = asyncExecutorCorePoolSize; - return this; - } - - public int getAsyncExecutorNumberOfRetries() { - return this.asyncExecutorNumberOfRetries; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorNumberOfRetries(int asyncExecutorNumberOfRetries) { - this.asyncExecutorNumberOfRetries = asyncExecutorNumberOfRetries; - return this; - } - - public int getAsyncExecutorMaxPoolSize() { - return this.asyncExecutorMaxPoolSize; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorMaxPoolSize(int asyncExecutorMaxPoolSize) { - this.asyncExecutorMaxPoolSize = asyncExecutorMaxPoolSize; - return this; - } - - public long getAsyncExecutorThreadKeepAliveTime() { - return this.asyncExecutorThreadKeepAliveTime; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorThreadKeepAliveTime(long asyncExecutorThreadKeepAliveTime) { - this.asyncExecutorThreadKeepAliveTime = asyncExecutorThreadKeepAliveTime; - return this; - } - - public int getAsyncExecutorThreadPoolQueueSize() { - return this.asyncExecutorThreadPoolQueueSize; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorThreadPoolQueueSize(int asyncExecutorThreadPoolQueueSize) { - this.asyncExecutorThreadPoolQueueSize = asyncExecutorThreadPoolQueueSize; - return this; - } - - public BlockingQueue<Runnable> getAsyncExecutorThreadPoolQueue() { - return this.asyncExecutorThreadPoolQueue; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorThreadPoolQueue(BlockingQueue<Runnable> asyncExecutorThreadPoolQueue) { - this.asyncExecutorThreadPoolQueue = asyncExecutorThreadPoolQueue; - return this; - } - - public long getAsyncExecutorSecondsToWaitOnShutdown() { - return this.asyncExecutorSecondsToWaitOnShutdown; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorSecondsToWaitOnShutdown(long asyncExecutorSecondsToWaitOnShutdown) { - this.asyncExecutorSecondsToWaitOnShutdown = asyncExecutorSecondsToWaitOnShutdown; - return this; - } - - public int getAsyncExecutorMaxTimerJobsPerAcquisition() { - return this.asyncExecutorMaxTimerJobsPerAcquisition; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorMaxTimerJobsPerAcquisition(int asyncExecutorMaxTimerJobsPerAcquisition) { - this.asyncExecutorMaxTimerJobsPerAcquisition = asyncExecutorMaxTimerJobsPerAcquisition; - return this; - } - - public int getAsyncExecutorMaxAsyncJobsDuePerAcquisition() { - return this.asyncExecutorMaxAsyncJobsDuePerAcquisition; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorMaxAsyncJobsDuePerAcquisition(int asyncExecutorMaxAsyncJobsDuePerAcquisition) { - this.asyncExecutorMaxAsyncJobsDuePerAcquisition = asyncExecutorMaxAsyncJobsDuePerAcquisition; - return this; - } - - public int getAsyncExecutorDefaultTimerJobAcquireWaitTime() { - return this.asyncExecutorDefaultTimerJobAcquireWaitTime; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorDefaultTimerJobAcquireWaitTime(int asyncExecutorDefaultTimerJobAcquireWaitTime) { - this.asyncExecutorDefaultTimerJobAcquireWaitTime = asyncExecutorDefaultTimerJobAcquireWaitTime; - return this; - } - - public int getAsyncExecutorDefaultAsyncJobAcquireWaitTime() { - return this.asyncExecutorDefaultAsyncJobAcquireWaitTime; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorDefaultAsyncJobAcquireWaitTime(int asyncExecutorDefaultAsyncJobAcquireWaitTime) { - this.asyncExecutorDefaultAsyncJobAcquireWaitTime = asyncExecutorDefaultAsyncJobAcquireWaitTime; - return this; - } - - public int getAsyncExecutorDefaultQueueSizeFullWaitTime() { - return this.asyncExecutorDefaultQueueSizeFullWaitTime; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorDefaultQueueSizeFullWaitTime(int asyncExecutorDefaultQueueSizeFullWaitTime) { - this.asyncExecutorDefaultQueueSizeFullWaitTime = asyncExecutorDefaultQueueSizeFullWaitTime; - return this; - } - - public String getAsyncExecutorLockOwner() { - return this.asyncExecutorLockOwner; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorLockOwner(String asyncExecutorLockOwner) { - this.asyncExecutorLockOwner = asyncExecutorLockOwner; - return this; - } - - public int getAsyncExecutorTimerLockTimeInMillis() { - return this.asyncExecutorTimerLockTimeInMillis; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorTimerLockTimeInMillis(int asyncExecutorTimerLockTimeInMillis) { - this.asyncExecutorTimerLockTimeInMillis = asyncExecutorTimerLockTimeInMillis; - return this; - } - - public int getAsyncExecutorAsyncJobLockTimeInMillis() { - return this.asyncExecutorAsyncJobLockTimeInMillis; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorAsyncJobLockTimeInMillis(int asyncExecutorAsyncJobLockTimeInMillis) { - this.asyncExecutorAsyncJobLockTimeInMillis = asyncExecutorAsyncJobLockTimeInMillis; - return this; - } - - public int getAsyncExecutorResetExpiredJobsInterval() { - return this.asyncExecutorResetExpiredJobsInterval; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorResetExpiredJobsInterval(int asyncExecutorResetExpiredJobsInterval) { - this.asyncExecutorResetExpiredJobsInterval = asyncExecutorResetExpiredJobsInterval; - return this; - } - - public ExecuteAsyncRunnableFactory getAsyncExecutorExecuteAsyncRunnableFactory() { - return this.asyncExecutorExecuteAsyncRunnableFactory; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorExecuteAsyncRunnableFactory(ExecuteAsyncRunnableFactory asyncExecutorExecuteAsyncRunnableFactory) { - this.asyncExecutorExecuteAsyncRunnableFactory = asyncExecutorExecuteAsyncRunnableFactory; - return this; - } - - public int getAsyncExecutorResetExpiredJobsPageSize() { - return this.asyncExecutorResetExpiredJobsPageSize; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorResetExpiredJobsPageSize(int asyncExecutorResetExpiredJobsPageSize) { - this.asyncExecutorResetExpiredJobsPageSize = asyncExecutorResetExpiredJobsPageSize; - return this; - } - - public boolean isAsyncExecutorIsMessageQueueMode() { - return this.asyncExecutorMessageQueueMode; - } - - public ProcessEngineConfigurationImpl setAsyncExecutorMessageQueueMode(boolean asyncExecutorMessageQueueMode) { - this.asyncExecutorMessageQueueMode = asyncExecutorMessageQueueMode; - return this; - } -} diff --git a/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSession.java b/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSession.java deleted file mode 100644 index b452e92..0000000 --- a/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSession.java +++ /dev/null @@ -1,1274 +0,0 @@ -package org.activiti.engine.impl.db; - -import org.activiti.engine.ActivitiException; -import org.activiti.engine.ActivitiOptimisticLockingException; -import org.activiti.engine.ActivitiWrongDbException; -import org.activiti.engine.impl.*; -import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.activiti.engine.impl.context.Context; -import org.activiti.engine.impl.db.upgrade.DbUpgradeStep; -import org.activiti.engine.impl.interceptor.Session; -import org.activiti.engine.impl.persistence.cache.CachedEntity; -import org.activiti.engine.impl.persistence.cache.EntityCache; -import org.activiti.engine.impl.persistence.entity.Entity; -import org.activiti.engine.impl.persistence.entity.ExecutionEntity; -import org.activiti.engine.impl.persistence.entity.PropertyEntity; -import org.activiti.engine.impl.util.IoUtil; -import org.activiti.engine.impl.util.ReflectUtil; -import org.apache.ibatis.session.SqlSession; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringReader; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.Statement; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class DbSqlSession implements Session { - private static final Logger log = LoggerFactory.getLogger(DbSqlSession.class); - protected static final Pattern CLEAN_VERSION_REGEX = Pattern.compile("\\d\\.\\d*"); - protected static final String LAST_V5_VERSION = "5.99.0.0"; - protected static final List<ActivitiVersion> ACTIVITI_VERSIONS = new ArrayList(); - protected SqlSession sqlSession; - protected DbSqlSessionFactory dbSqlSessionFactory; - protected EntityCache entityCache; - protected Map<Class<? extends Entity>, Map<String, Entity>> insertedObjects = new HashMap(); - protected Map<Class<? extends Entity>, Map<String, Entity>> deletedObjects = new HashMap(); - protected Map<Class<? extends Entity>, List<BulkDeleteOperation>> bulkDeleteOperations = new HashMap(); - protected List<Entity> updatedObjects = new ArrayList(); - protected String connectionMetadataDefaultCatalog; - protected String connectionMetadataDefaultSchema; - public static String[] JDBC_METADATA_TABLE_TYPES; - - public DbSqlSession(DbSqlSessionFactory dbSqlSessionFactory, EntityCache entityCache) { - this.dbSqlSessionFactory = dbSqlSessionFactory; - this.sqlSession = dbSqlSessionFactory.getSqlSessionFactory().openSession(); - this.entityCache = entityCache; - this.connectionMetadataDefaultCatalog = dbSqlSessionFactory.getDatabaseCatalog(); - this.connectionMetadataDefaultSchema = dbSqlSessionFactory.getDatabaseSchema(); - } - - public DbSqlSession(DbSqlSessionFactory dbSqlSessionFactory, EntityCache entityCache, Connection connection, String catalog, String schema) { - this.dbSqlSessionFactory = dbSqlSessionFactory; - this.sqlSession = dbSqlSessionFactory.getSqlSessionFactory().openSession(connection); - this.entityCache = entityCache; - this.connectionMetadataDefaultCatalog = catalog; - this.connectionMetadataDefaultSchema = schema; - } - - public void insert(Entity entity) { - if (entity.getId() == null) { - String id = this.dbSqlSessionFactory.getIdGenerator().getNextId(); - entity.setId(id); - } - - Class<? extends Entity> clazz = entity.getClass(); - if (!this.insertedObjects.containsKey(clazz)) { - this.insertedObjects.put(clazz, new LinkedHashMap()); - } - - ((Map)this.insertedObjects.get(clazz)).put(entity.getId(), entity); - this.entityCache.put(entity, false); - entity.setInserted(true); - } - - public void update(Entity entity) { - this.entityCache.put(entity, false); - entity.setUpdated(true); - } - - public int update(String statement, Object parameters) { - String updateStatement = this.dbSqlSessionFactory.mapStatement(statement); - return this.getSqlSession().update(updateStatement, parameters); - } - - public void delete(String statement, Object parameter, Class<? extends Entity> entityClass) { - if (!this.bulkDeleteOperations.containsKey(entityClass)) { - this.bulkDeleteOperations.put(entityClass, new ArrayList(1)); - } - - ((List)this.bulkDeleteOperations.get(entityClass)).add(new BulkDeleteOperation(this.dbSqlSessionFactory.mapStatement(statement), parameter)); - } - - public void delete(Entity entity) { - Class<? extends Entity> clazz = entity.getClass(); - if (!this.deletedObjects.containsKey(clazz)) { - this.deletedObjects.put(clazz, new LinkedHashMap()); - } - - ((Map)this.deletedObjects.get(clazz)).put(entity.getId(), entity); - entity.setDeleted(true); - } - - public List selectList(String statement) { - return this.selectList(statement, (Object)null, 0, Integer.MAX_VALUE); - } - - public List selectList(String statement, Object parameter) { - return this.selectList(statement, parameter, 0, Integer.MAX_VALUE); - } - - public List selectList(String statement, Object parameter, boolean useCache) { - return this.selectList(statement, parameter, 0, Integer.MAX_VALUE, useCache); - } - - public List selectList(String statement, Object parameter, Page page) { - return this.selectList(statement, parameter, page, true); - } - - public List selectList(String statement, Object parameter, Page page, boolean useCache) { - return page != null ? this.selectList(statement, parameter, page.getFirstResult(), page.getMaxResults(), useCache) : this.selectList(statement, parameter, 0, Integer.MAX_VALUE, useCache); - } - - public List selectList(String statement, ListQueryParameterObject parameter, Page page) { - return this.selectList(statement, parameter, page, true); - } - - public List selectList(String statement, ListQueryParameterObject parameter, Page page, boolean useCache) { - ListQueryParameterObject parameterToUse = parameter; - if (parameterToUse == null) { - parameterToUse = new ListQueryParameterObject(); - } - - if (page != null) { - parameterToUse.setFirstResult(page.getFirstResult()); - parameterToUse.setMaxResults(page.getMaxResults()); - } - - return this.selectList(statement, parameterToUse, useCache); - } - - public List selectList(String statement, Object parameter, int firstResult, int maxResults) { - return this.selectList(statement, parameter, firstResult, maxResults, true); - } - - public List selectList(String statement, Object parameter, int firstResult, int maxResults, boolean useCache) { - return this.selectList(statement, new ListQueryParameterObject(parameter, firstResult, maxResults), useCache); - } - - public List selectList(String statement, ListQueryParameterObject parameter) { - return this.selectList(statement, parameter, true); - } - - public List selectList(String statement, ListQueryParameterObject parameter, boolean useCache) { - return this.selectListWithRawParameter(statement, parameter, parameter.getFirstResult(), parameter.getMaxResults(), useCache); - } - - public List selectListWithRawParameter(String statement, Object parameter, int firstResult, int maxResults) { - return this.selectListWithRawParameter(statement, parameter, firstResult, maxResults, true); - } - - public List selectListWithRawParameter(String statement, Object parameter, int firstResult, int maxResults, boolean useCache) { - statement = this.dbSqlSessionFactory.mapStatement(statement); - if (firstResult != -1 && maxResults != -1) { - List loadedObjects = this.sqlSession.selectList(statement, parameter); - return useCache ? this.cacheLoadOrStore(loadedObjects) : loadedObjects; - } else { - return Collections.EMPTY_LIST; - } - } - - public List selectListWithRawParameterWithoutFilter(String statement, Object parameter, int firstResult, int maxResults) { - statement = this.dbSqlSessionFactory.mapStatement(statement); - return firstResult != -1 && maxResults != -1 ? this.sqlSession.selectList(statement, parameter) : Collections.EMPTY_LIST; - } - - public Object selectOne(String statement, Object parameter) { - statement = this.dbSqlSessionFactory.mapStatement(statement); - Object result = this.sqlSession.selectOne(statement, parameter); - if (result instanceof Entity) { - Entity loadedObject = (Entity)result; - result = this.cacheLoadOrStore(loadedObject); - } - - return result; - } - - public <T extends Entity> T selectById(Class<T> entityClass, String id) { - return this.selectById(entityClass, id, true); - } - - public <T extends Entity> T selectById(Class<T> entityClass, String id, boolean useCache) { - T entity = null; - if (useCache) { - entity = (T) this.entityCache.findInCache(entityClass, id); - if (entity != null) { - return entity; - } - } - - String selectStatement = this.dbSqlSessionFactory.getSelectStatement(entityClass); - selectStatement = this.dbSqlSessionFactory.mapStatement(selectStatement); - entity = (T) this.sqlSession.selectOne(selectStatement, id); - if (entity == null) { - return null; - } else { - this.entityCache.put(entity, true); - return entity; - } - } - - protected List cacheLoadOrStore(List<Object> loadedObjects) { - if (loadedObjects.isEmpty()) { - return loadedObjects; - } else if (!(loadedObjects.get(0) instanceof Entity)) { - return loadedObjects; - } else { - List<Entity> filteredObjects = new ArrayList(loadedObjects.size()); - Iterator var3 = loadedObjects.iterator(); - - while(var3.hasNext()) { - Object loadedObject = var3.next(); - Entity cachedEntity = this.cacheLoadOrStore((Entity)loadedObject); - filteredObjects.add(cachedEntity); - } - - return filteredObjects; - } - } - - protected Entity cacheLoadOrStore(Entity entity) { - Entity cachedEntity = (Entity)this.entityCache.findInCache(entity.getClass(), entity.getId()); - if (cachedEntity != null) { - return cachedEntity; - } else { - this.entityCache.put(entity, true); - return entity; - } - } - - public void flush() { - this.determineUpdatedObjects(); - this.removeUnnecessaryOperations(); - if (log.isDebugEnabled()) { - this.debugFlush(); - } - - this.flushInserts(); - this.flushUpdates(); - this.flushDeletes(); - } - - protected void removeUnnecessaryOperations() { - Iterator var1 = this.deletedObjects.keySet().iterator(); - - while(var1.hasNext()) { - Class<? extends Entity> entityClass = (Class)var1.next(); - Set<String> ids = new HashSet(); - Iterator<Entity> entitiesToDeleteIterator = ((Map)this.deletedObjects.get(entityClass)).values().iterator(); - - while(entitiesToDeleteIterator.hasNext()) { - Entity entityToDelete = (Entity)entitiesToDeleteIterator.next(); - if (!ids.contains(entityToDelete.getId())) { - ids.add(entityToDelete.getId()); - } else { - entitiesToDeleteIterator.remove(); - } - } - - Iterator var7 = ids.iterator(); - - while(var7.hasNext()) { - String id = (String)var7.next(); - if (this.insertedObjects.containsKey(entityClass) && ((Map)this.insertedObjects.get(entityClass)).containsKey(id)) { - ((Map)this.insertedObjects.get(entityClass)).remove(id); - ((Map)this.deletedObjects.get(entityClass)).remove(id); - } - } - } - - } - - public void determineUpdatedObjects() { - this.updatedObjects = new ArrayList(); - Map<Class<?>, Map<String, CachedEntity>> cachedObjects = this.entityCache.getAllCachedEntities(); - Iterator var2 = cachedObjects.keySet().iterator(); - - label34: - while(var2.hasNext()) { - Class<?> clazz = (Class)var2.next(); - Map<String, CachedEntity> classCache = (Map)cachedObjects.get(clazz); - Iterator var5 = classCache.values().iterator(); - - while(true) { - CachedEntity cachedObject; - Entity cachedEntity; - do { - do { - if (!var5.hasNext()) { - continue label34; - } - - cachedObject = (CachedEntity)var5.next(); - cachedEntity = cachedObject.getEntity(); - } while(this.isEntityInserted(cachedEntity)); - } while(!ExecutionEntity.class.isAssignableFrom(cachedEntity.getClass()) && this.isEntityToBeDeleted(cachedEntity)); - - if (cachedObject.hasChanged()) { - this.updatedObjects.add(cachedEntity); - } - } - } - - } - - protected void debugFlush() { - log.debug("Flushing dbSqlSession"); - int nrOfInserts = 0; - int nrOfUpdates = 0; - int nrOfDeletes = 0; - Iterator var4 = this.insertedObjects.values().iterator(); - - Map deletedObjectMap; - Iterator var6; - Entity deletedObject; - while(var4.hasNext()) { - deletedObjectMap = (Map)var4.next(); - - for(var6 = deletedObjectMap.values().iterator(); var6.hasNext(); ++nrOfInserts) { - deletedObject = (Entity)var6.next(); - log.debug(" insert {}", deletedObject); - } - } - - for(var4 = this.updatedObjects.iterator(); var4.hasNext(); ++nrOfUpdates) { - Entity updatedObject = (Entity)var4.next(); - log.debug(" update {}", updatedObject); - } - - var4 = this.deletedObjects.values().iterator(); - - while(var4.hasNext()) { - deletedObjectMap = (Map)var4.next(); - - for(var6 = deletedObjectMap.values().iterator(); var6.hasNext(); ++nrOfDeletes) { - deletedObject = (Entity)var6.next(); - log.debug(" delete {} with id {}", deletedObject, deletedObject.getId()); - } - } - - var4 = this.bulkDeleteOperations.values().iterator(); - - while(var4.hasNext()) { - Collection<BulkDeleteOperation> bulkDeleteOperationList = (Collection)var4.next(); - - for(var6 = bulkDeleteOperationList.iterator(); var6.hasNext(); ++nrOfDeletes) { - BulkDeleteOperation bulkDeleteOperation = (BulkDeleteOperation)var6.next(); - log.debug(" {}", bulkDeleteOperation); - } - } - - log.debug("flush summary: {} insert, {} update, {} delete.", new Object[]{nrOfInserts, nrOfUpdates, nrOfDeletes}); - log.debug("now executing flush..."); - } - - public boolean isEntityInserted(Entity entity) { - return this.insertedObjects.containsKey(entity.getClass()) && ((Map)this.insertedObjects.get(entity.getClass())).containsKey(entity.getId()); - } - - public boolean isEntityToBeDeleted(Entity entity) { - return this.deletedObjects.containsKey(entity.getClass()) && ((Map)this.deletedObjects.get(entity.getClass())).containsKey(entity.getId()); - } - - protected void flushInserts() { - if (this.insertedObjects.size() != 0) { - Iterator var1 = EntityDependencyOrder.INSERT_ORDER.iterator(); - - Class entityClass; - while(var1.hasNext()) { - entityClass = (Class)var1.next(); - if (this.insertedObjects.containsKey(entityClass)) { - this.flushInsertEntities(entityClass, ((Map)this.insertedObjects.get(entityClass)).values()); - this.insertedObjects.remove(entityClass); - } - } - - if (this.insertedObjects.size() > 0) { - var1 = this.insertedObjects.keySet().iterator(); - - while(var1.hasNext()) { - entityClass = (Class)var1.next(); - this.flushInsertEntities(entityClass, ((Map)this.insertedObjects.get(entityClass)).values()); - } - } - - this.insertedObjects.clear(); - } - } - - protected void flushInsertEntities(Class<? extends Entity> entityClass, Collection<Entity> entitiesToInsert) { - if (entitiesToInsert.size() == 1) { - this.flushRegularInsert((Entity)entitiesToInsert.iterator().next(), entityClass); - } else if (Boolean.FALSE.equals(this.dbSqlSessionFactory.isBulkInsertable(entityClass))) { - Iterator var3 = entitiesToInsert.iterator(); - - while(var3.hasNext()) { - Entity entity = (Entity)var3.next(); - this.flushRegularInsert(entity, entityClass); - } - } else { - this.flushBulkInsert(entitiesToInsert, entityClass); - } - - } - - protected Collection<Entity> orderExecutionEntities(Map<String, Entity> executionEntities, boolean parentBeforeChildExecution) { - List<Entity> result = new ArrayList(executionEntities.size()); - Map<String, String> childToParentExecutionMapping = new HashMap(); - Map<String, List<ExecutionEntity>> parentToChildrenMapping = new HashMap(); - Collection<Entity> executionCollection = executionEntities.values(); - - Iterator executionIterator; - ExecutionEntity currentExecutionEntity; - String executionId; - String parentId; - for(executionIterator = executionCollection.iterator(); executionIterator.hasNext(); ((List)parentToChildrenMapping.get(parentId)).add(currentExecutionEntity)) { - currentExecutionEntity = (ExecutionEntity)executionIterator.next(); - parentId = currentExecutionEntity.getParentId(); - executionId = currentExecutionEntity.getSuperExecutionId(); - parentId = parentId != null ? parentId : executionId; - childToParentExecutionMapping.put(currentExecutionEntity.getId(), parentId); - if (!parentToChildrenMapping.containsKey(parentId)) { - parentToChildrenMapping.put(parentId, new ArrayList()); - } - } - - Set<String> handledExecutionIds = new HashSet(executionEntities.size()); - executionIterator = executionCollection.iterator(); - - while(true) { - do { - if (!executionIterator.hasNext()) { - return result; - } - - currentExecutionEntity = (ExecutionEntity)executionIterator.next(); - executionId = currentExecutionEntity.getId(); - } while(handledExecutionIds.contains(executionId)); - - parentId = (String)childToParentExecutionMapping.get(executionId); - if (parentId != null) { - while(parentId != null) { - String newParentId = (String)childToParentExecutionMapping.get(parentId); - if (newParentId == null) { - break; - } - - parentId = newParentId; - } - } - - if (parentId == null) { - parentId = executionId; - } - - if (executionEntities.containsKey(parentId) && !handledExecutionIds.contains(parentId)) { - handledExecutionIds.add(parentId); - if (parentBeforeChildExecution) { - result.add(executionEntities.get(parentId)); - } else { - result.add(0, executionEntities.get(parentId)); - } - } - - this.collectChildExecutionsForInsertion(result, parentToChildrenMapping, handledExecutionIds, parentId, parentBeforeChildExecution); - } - } - - protected void collectChildExecutionsForInsertion(List<Entity> result, Map<String, List<ExecutionEntity>> parentToChildrenMapping, Set<String> handledExecutionIds, String parentId, boolean parentBeforeChildExecution) { - List<ExecutionEntity> childExecutionEntities = (List)parentToChildrenMapping.get(parentId); - if (childExecutionEntities != null) { - ExecutionEntity childExecutionEntity; - for(Iterator var7 = childExecutionEntities.iterator(); var7.hasNext(); this.collectChildExecutionsForInsertion(result, parentToChildrenMapping, handledExecutionIds, childExecutionEntity.getId(), parentBeforeChildExecution)) { - childExecutionEntity = (ExecutionEntity)var7.next(); - handledExecutionIds.add(childExecutionEntity.getId()); - if (parentBeforeChildExecution) { - result.add(childExecutionEntity); - } else { - result.add(0, childExecutionEntity); - } - } - - } - } - - protected void flushRegularInsert(Entity entity, Class<? extends Entity> clazz) { - String insertStatement = this.dbSqlSessionFactory.getInsertStatement(entity); - insertStatement = this.dbSqlSessionFactory.mapStatement(insertStatement); - if (insertStatement == null) { - throw new ActivitiException("no insert statement for " + entity.getClass() + " in the ibatis mapping files"); - } else { - log.debug("inserting: {}", entity); - this.sqlSession.insert(insertStatement, entity); - if (entity instanceof HasRevision) { - this.incrementRevision(entity); - } - - } - } - - protected void flushBulkInsert(Collection<Entity> entities, Class<? extends Entity> clazz) { - String insertStatement = this.dbSqlSessionFactory.getBulkInsertStatement(clazz); - insertStatement = this.dbSqlSessionFactory.mapStatement(insertStatement); - if (insertStatement == null) { - throw new ActivitiException("no insert statement for " + ((Entity)entities.iterator().next()).getClass() + " in the ibatis mapping files"); - } else { - Iterator<Entity> entityIterator = entities.iterator(); - Boolean hasRevision = null; - - while(entityIterator.hasNext()) { - List<Entity> subList = new ArrayList(); - - for(int index = 0; entityIterator.hasNext() && index < this.dbSqlSessionFactory.getMaxNrOfStatementsInBulkInsert(); ++index) { - Entity entity = (Entity)entityIterator.next(); - subList.add(entity); - if (hasRevision == null) { - hasRevision = entity instanceof HasRevision; - } - } - - this.sqlSession.insert(insertStatement, subList); - } - - if (hasRevision != null && hasRevision) { - entityIterator = entities.iterator(); - - while(entityIterator.hasNext()) { - this.incrementRevision((Entity)entityIterator.next()); - } - } - - } - } - - protected void incrementRevision(Entity insertedObject) { - HasRevision revisionEntity = (HasRevision)insertedObject; - if (revisionEntity.getRevision() == 0) { - revisionEntity.setRevision(revisionEntity.getRevisionNext()); - } - - } - - protected void flushUpdates() { - Iterator var1 = this.updatedObjects.iterator(); - - while(var1.hasNext()) { - Entity updatedObject = (Entity)var1.next(); - String updateStatement = this.dbSqlSessionFactory.getUpdateStatement(updatedObject); - updateStatement = this.dbSqlSessionFactory.mapStatement(updateStatement); - if (updateStatement == null) { - throw new ActivitiException("no update statement for " + updatedObject.getClass() + " in the ibatis mapping files"); - } - - log.debug("updating: {}", updatedObject); - int updatedRecords = this.sqlSession.update(updateStatement, updatedObject); - if (updatedRecords == 0) { - throw new ActivitiOptimisticLockingException(updatedObject + " was updated by another transaction concurrently"); - } - - if (updatedObject instanceof HasRevision) { - ((HasRevision)updatedObject).setRevision(((HasRevision)updatedObject).getRevisionNext()); - } - } - - this.updatedObjects.clear(); - } - - protected void flushDeletes() { - if (this.deletedObjects.size() != 0 || this.bulkDeleteOperations.size() != 0) { - Iterator var1; - Class entityClass; - for(var1 = EntityDependencyOrder.DELETE_ORDER.iterator(); var1.hasNext(); this.flushBulkDeletes(entityClass)) { - entityClass = (Class)var1.next(); - if (this.deletedObjects.containsKey(entityClass)) { - this.flushDeleteEntities(entityClass, ((Map)this.deletedObjects.get(entityClass)).values()); - this.deletedObjects.remove(entityClass); - } - } - - if (this.deletedObjects.size() > 0) { - var1 = this.deletedObjects.keySet().iterator(); - - while(var1.hasNext()) { - entityClass = (Class)var1.next(); - this.flushDeleteEntities(entityClass, ((Map)this.deletedObjects.get(entityClass)).values()); - this.flushBulkDeletes(entityClass); - } - } - - this.deletedObjects.clear(); - } - } - - protected void flushBulkDeletes(Class<? extends Entity> entityClass) { - if (this.bulkDeleteOperations.containsKey(entityClass)) { - Iterator var2 = ((List)this.bulkDeleteOperations.get(entityClass)).iterator(); - - while(var2.hasNext()) { - BulkDeleteOperation bulkDeleteOperation = (BulkDeleteOperation)var2.next(); - bulkDeleteOperation.execute(this.sqlSession); - } - } - - } - - protected void flushDeleteEntities(Class<? extends Entity> entityClass, Collection<Entity> entitiesToDelete) { - Iterator var3 = entitiesToDelete.iterator(); - - while(var3.hasNext()) { - Entity entity = (Entity)var3.next(); - String deleteStatement = this.dbSqlSessionFactory.getDeleteStatement(entity.getClass()); - deleteStatement = this.dbSqlSessionFactory.mapStatement(deleteStatement); - if (deleteStatement == null) { - throw new ActivitiException("no delete statement for " + entity.getClass() + " in the ibatis mapping files"); - } - - if (entity instanceof HasRevision) { - int nrOfRowsDeleted = this.sqlSession.delete(deleteStatement, entity); - if (nrOfRowsDeleted == 0) { - throw new ActivitiOptimisticLockingException(entity + " was updated by another transaction concurrently"); - } - } else { - this.sqlSession.delete(deleteStatement, entity); - } - } - - } - - public void close() { - this.sqlSession.close(); - } - - public void commit() { - this.sqlSession.commit(); - } - - public void rollback() { - this.sqlSession.rollback(); - } - - public void dbSchemaCheckVersion() { - try { - String dbVersion = this.getDbVersion(); - if (!"6.0.0.4".equals(dbVersion)) { - throw new ActivitiWrongDbException("6.0.0.4", dbVersion); - } - - String errorMessage = null; - if (!this.isEngineTablePresent()) { - errorMessage = this.addMissingComponent(errorMessage, "engine"); - } - - if (this.dbSqlSessionFactory.isDbHistoryUsed() && !this.isHistoryTablePresent()) { - errorMessage = this.addMissingComponent(errorMessage, "history"); - } - - if (this.dbSqlSessionFactory.isDbIdentityUsed() && !this.isIdentityTablePresent()) { - errorMessage = this.addMissingComponent(errorMessage, "identity"); - } - - if (errorMessage != null) { - throw new ActivitiException("Activiti database problem: " + errorMessage); - } - } catch (Exception var3) { - Exception e = var3; - if (this.isMissingTablesException(e)) { - throw new ActivitiException("no activiti tables in db. set <property name=\"databaseSchemaUpdate\" to value=\"true\" or value=\"create-drop\" (use create-drop for testing only!) in bean processEngineConfiguration in activiti.cfg.xml for automatic schema creation", e); - } - - if (e instanceof RuntimeException) { - throw (RuntimeException)e; - } - - throw new ActivitiException("couldn't get db schema version", e); - } - - log.debug("activiti db schema check successful"); - } - - protected String addMissingComponent(String missingComponents, String component) { - return missingComponents == null ? "Tables missing for component(s) " + component : missingComponents + ", " + component; - } - - protected String getDbVersion() { - String selectSchemaVersionStatement = this.dbSqlSessionFactory.mapStatement("selectDbSchemaVersion"); - return (String)this.sqlSession.selectOne(selectSchemaVersionStatement); - } - - public void dbSchemaCreate() { - if (this.isEngineTablePresent()) { - String dbVersion = this.getDbVersion(); - if (!"6.0.0.4".equals(dbVersion)) { - throw new ActivitiWrongDbException("6.0.0.4", dbVersion); - } - } else { - this.dbSchemaCreateEngine(); - } - - if (this.dbSqlSessionFactory.isDbHistoryUsed()) { - this.dbSchemaCreateHistory(); - } - - if (this.dbSqlSessionFactory.isDbIdentityUsed()) { - this.dbSchemaCreateIdentity(); - } - - } - - protected void dbSchemaCreateIdentity() { - this.executeMandatorySchemaResource("create", "identity"); - } - - protected void dbSchemaCreateHistory() { - this.executeMandatorySchemaResource("create", "history"); - } - - protected void dbSchemaCreateEngine() { - this.executeMandatorySchemaResource("create", "engine"); - } - - public void dbSchemaDrop() { - this.executeMandatorySchemaResource("drop", "engine"); - if (this.dbSqlSessionFactory.isDbHistoryUsed()) { - this.executeMandatorySchemaResource("drop", "history"); - } - - if (this.dbSqlSessionFactory.isDbIdentityUsed()) { - this.executeMandatorySchemaResource("drop", "identity"); - } - - } - - public void dbSchemaPrune() { - if (this.isHistoryTablePresent() && !this.dbSqlSessionFactory.isDbHistoryUsed()) { - this.executeMandatorySchemaResource("drop", "history"); - } - - if (this.isIdentityTablePresent() && this.dbSqlSessionFactory.isDbIdentityUsed()) { - this.executeMandatorySchemaResource("drop", "identity"); - } - - } - - public void executeMandatorySchemaResource(String operation, String component) { - this.executeSchemaResource(operation, component, this.getResourceForDbOperation(operation, operation, component), false); - } - - public String dbSchemaUpdate() { - String feedback = null; - boolean isUpgradeNeeded = false; - int matchingVersionIndex = -1; - if (this.isEngineTablePresent()) { - PropertyEntity dbVersionProperty = (PropertyEntity)this.selectById(PropertyEntity.class, "schema.version"); - String dbVersion = dbVersionProperty.getValue(); - matchingVersionIndex = this.findMatchingVersionIndex(dbVersion); - if (matchingVersionIndex < 0 && dbVersion != null && dbVersion.startsWith("5.")) { - matchingVersionIndex = this.findMatchingVersionIndex("5.99.0.0"); - } - - if (matchingVersionIndex < 0) { - throw new ActivitiException("Could not update Activiti database schema: unknown version from database: '" + dbVersion + "'"); - } - - isUpgradeNeeded = matchingVersionIndex != ACTIVITI_VERSIONS.size() - 1; - if (isUpgradeNeeded) { - dbVersionProperty.setValue("6.0.0.4"); - PropertyEntity dbHistoryProperty; - if ("5.0".equals(dbVersion)) { - dbHistoryProperty = (PropertyEntity)Context.getCommandContext().getPropertyEntityManager().create(); - dbHistoryProperty.setName("schema.history"); - dbHistoryProperty.setValue("create(5.0)"); - this.insert(dbHistoryProperty); - } else { - dbHistoryProperty = (PropertyEntity)this.selectById(PropertyEntity.class, "schema.history"); - } - - String dbHistoryValue = dbHistoryProperty.getValue() + " upgrade(" + dbVersion + "->" + "6.0.0.4" + ")"; - dbHistoryProperty.setValue(dbHistoryValue); - this.dbSchemaUpgrade("engine", matchingVersionIndex); - feedback = "upgraded Activiti from " + dbVersion + " to " + "6.0.0.4"; - } - } else { - this.dbSchemaCreateEngine(); - } - - if (this.isHistoryTablePresent()) { - if (isUpgradeNeeded) { - this.dbSchemaUpgrade("history", matchingVersionIndex); - } - } else if (this.dbSqlSessionFactory.isDbHistoryUsed()) { - this.dbSchemaCreateHistory(); - } - - if (this.isIdentityTablePresent()) { - if (isUpgradeNeeded) { - this.dbSchemaUpgrade("identity", matchingVersionIndex); - } - } else if (this.dbSqlSessionFactory.isDbIdentityUsed()) { - this.dbSchemaCreateIdentity(); - } - - return feedback; - } - - protected int findMatchingVersionIndex(String dbVersion) { - int index = 0; - int matchingVersionIndex = -1; - - while(matchingVersionIndex < 0 && index < ACTIVITI_VERSIONS.size()) { - if (((ActivitiVersion)ACTIVITI_VERSIONS.get(index)).matches(dbVersion)) { - matchingVersionIndex = index; - } else { - ++index; - } - } - - return matchingVersionIndex; - } - - public boolean isEngineTablePresent() { - return this.isTablePresent("ACT_RU_EXECUTION"); - } - - public boolean isHistoryTablePresent() { - return this.isTablePresent("ACT_HI_PROCINST"); - } - - public boolean isIdentityTablePresent() { - return this.isTablePresent("ACT_ID_USER"); - } - - public boolean isTablePresent(String tableName) { - if (!this.dbSqlSessionFactory.isTablePrefixIsSchema()) { - tableName = this.prependDatabaseTablePrefix(tableName); - } - - Connection connection = null; - - try { - connection = this.sqlSession.getConnection(); - DatabaseMetaData databaseMetaData = connection.getMetaData(); - ResultSet tables = null; - String catalog = this.connectionMetadataDefaultCatalog; - if (this.dbSqlSessionFactory.getDatabaseCatalog() != null && this.dbSqlSessionFactory.getDatabaseCatalog().length() > 0) { - catalog = this.dbSqlSessionFactory.getDatabaseCatalog(); - } - - String schema = this.connectionMetadataDefaultSchema; - if (this.dbSqlSessionFactory.getDatabaseSchema() != null && this.dbSqlSessionFactory.getDatabaseSchema().length() > 0) { - schema = this.dbSqlSessionFactory.getDatabaseSchema(); - } - - String databaseType = this.dbSqlSessionFactory.getDatabaseType(); - if ("postgres".equals(databaseType)) { - tableName = tableName.toLowerCase(); - } - - if (schema != null && "oracle".equals(databaseType)) { - schema = schema.toUpperCase(); - } - - if (catalog != null && catalog.length() == 0) { - catalog = null; - } - - boolean var8; - try { - tables = databaseMetaData.getTables(catalog, schema, tableName, JDBC_METADATA_TABLE_TYPES); - var8 = tables.next(); - } finally { - try { - tables.close(); - } catch (Exception var16) { - Exception e = var16; - log.error("Error closing meta data tables", e); - } - - } - - return var8; - } catch (Exception var18) { - Exception e = var18; - throw new ActivitiException("couldn't check if tables are already present using metadata: " + e.getMessage(), e); - } - } - - protected boolean isUpgradeNeeded(String versionInDatabase) { - if ("6.0.0.4".equals(versionInDatabase)) { - return false; - } else { - String cleanDbVersion = this.getCleanVersion(versionInDatabase); - String[] cleanDbVersionSplitted = cleanDbVersion.split("\\."); - int dbMajorVersion = Integer.valueOf(cleanDbVersionSplitted[0]); - int dbMinorVersion = Integer.valueOf(cleanDbVersionSplitted[1]); - String cleanEngineVersion = this.getCleanVersion("6.0.0.4"); - String[] cleanEngineVersionSplitted = cleanEngineVersion.split("\\."); - int engineMajorVersion = Integer.valueOf(cleanEngineVersionSplitted[0]); - int engineMinorVersion = Integer.valueOf(cleanEngineVersionSplitted[1]); - if (dbMajorVersion <= engineMajorVersion && (dbMajorVersion > engineMajorVersion || dbMinorVersion <= engineMinorVersion)) { - if (cleanDbVersion.compareTo(cleanEngineVersion) == 0) { - log.warn("Engine-version is the same, but not an exact match: {} vs. {}. Not performing database-upgrade.", versionInDatabase, "6.0.0.4"); - return false; - } else { - return true; - } - } else { - throw new ActivitiException("Version of activiti database (" + versionInDatabase + ") is more recent than the engine (" + "6.0.0.4" + ")"); - } - } - } - - protected String getCleanVersion(String versionString) { - Matcher matcher = CLEAN_VERSION_REGEX.matcher(versionString); - if (!matcher.find()) { - throw new ActivitiException("Illegal format for version: " + versionString); - } else { - String cleanString = matcher.group(); - - try { - Double.parseDouble(cleanString); - return cleanString; - } catch (NumberFormatException var5) { - throw new ActivitiException("Illegal format for version: " + versionString); - } - } - } - - protected String prependDatabaseTablePrefix(String tableName) { - return this.dbSqlSessionFactory.getDatabaseTablePrefix() + tableName; - } - - protected void dbSchemaUpgrade(String component, int currentDatabaseVersionsIndex) { - ActivitiVersion activitiVersion = (ActivitiVersion)ACTIVITI_VERSIONS.get(currentDatabaseVersionsIndex); - String dbVersion = activitiVersion.getMainVersion(); - log.info("upgrading activiti {} schema from {} to {}", new Object[]{component, dbVersion, "6.0.0.4"}); - - for(int i = currentDatabaseVersionsIndex + 1; i < ACTIVITI_VERSIONS.size(); ++i) { - String nextVersion = ((ActivitiVersion)ACTIVITI_VERSIONS.get(i)).getMainVersion(); - if (nextVersion.endsWith("-SNAPSHOT")) { - nextVersion = nextVersion.substring(0, nextVersion.length() - "-SNAPSHOT".length()); - } - - dbVersion = dbVersion.replace(".", ""); - nextVersion = nextVersion.replace(".", ""); - log.info("Upgrade needed: {} -> {}. Looking for schema update resource for component '{}'", new Object[]{dbVersion, nextVersion, component}); - this.executeSchemaResource("upgrade", component, this.getResourceForDbOperation("upgrade", "upgradestep." + dbVersion + ".to." + nextVersion, component), true); - dbVersion = nextVersion; - } - - } - - public String getResourceForDbOperation(String directory, String operation, String component) { - String databaseType = this.dbSqlSessionFactory.getDatabaseType(); - // 褰揹atabaseType 涓篸m鏃讹紝鍊熺敤oracle鐨剆ql鏂囦欢鏉ヤ唬鏇挎墽琛� - if (ProcessEngineConfigurationImpl.DATABASE_TYPE_DM.equals(databaseType)) { - databaseType = ProcessEngineConfigurationImpl.DATABASE_TYPE_ORACLE; - } - return "org/activiti/db/" + directory + "/activiti." + databaseType + "." + operation + "." + component + ".sql"; - } - - public void executeSchemaResource(String operation, String component, String resourceName, boolean isOptional) { - InputStream inputStream = null; - - try { - inputStream = ReflectUtil.getResourceAsStream(resourceName); - if (inputStream == null) { - if (!isOptional) { - throw new ActivitiException("resource '" + resourceName + "' is not available"); - } - - log.info("no schema resource {} for {}", resourceName, operation); - } else { - this.executeSchemaResource(operation, component, resourceName, inputStream); - } - } finally { - IoUtil.closeSilently(inputStream); - } - - } - - private void executeSchemaResource(String operation, String component, String resourceName, InputStream inputStream) { - log.info("performing {} on {} with resource {}", new Object[]{operation, component, resourceName}); - String sqlStatement = null; - String exceptionSqlStatement = null; - - try { - Connection connection = this.sqlSession.getConnection(); - Exception exception = null; - byte[] bytes = IoUtil.readInputStream(inputStream, resourceName); - String ddlStatements = new String(bytes); - - try { - if (this.isMysql()) { - DatabaseMetaData databaseMetaData = connection.getMetaData(); - int majorVersion = databaseMetaData.getDatabaseMajorVersion(); - int minorVersion = databaseMetaData.getDatabaseMinorVersion(); - log.info("Found MySQL: majorVersion=" + majorVersion + " minorVersion=" + minorVersion); - if (majorVersion <= 5 && minorVersion < 6) { - ddlStatements = this.updateDdlForMySqlVersionLowerThan56(ddlStatements); - } - } - } catch (Exception var26) { - Exception e = var26; - log.info("Could not get database metadata", e); - } - - BufferedReader reader = new BufferedReader(new StringReader(ddlStatements)); - String line = this.readNextTrimmedLine(reader); - - for(boolean inOraclePlsqlBlock = false; line != null; line = this.readNextTrimmedLine(reader)) { - if (line.startsWith("# ")) { - log.debug(line.substring(2)); - } else if (line.startsWith("-- ")) { - log.debug(line.substring(3)); - } else { - Exception e; - if (line.startsWith("execute java ")) { - String upgradestepClassName = line.substring(13).trim(); - e = null; - - DbUpgradeStep dbUpgradeStep; - try { - dbUpgradeStep = (DbUpgradeStep)ReflectUtil.instantiate(upgradestepClassName); - } catch (ActivitiException var25) { - ActivitiException ex = var25; - throw new ActivitiException("database update java class '" + upgradestepClassName + "' can't be instantiated: " + ex.getMessage(), ex); - } - - try { - log.debug("executing upgrade step java class {}", upgradestepClassName); - dbUpgradeStep.execute(this); - } catch (Exception var24) { - Exception ex = var24; - throw new ActivitiException("error while executing database update java class '" + upgradestepClassName + "': " + ex.getMessage(), ex); - } - } else if (line.length() > 0) { - if (this.isOracle() && line.startsWith("begin")) { - inOraclePlsqlBlock = true; - sqlStatement = this.addSqlStatementPiece(sqlStatement, line); - } else if ((!line.endsWith(";") || inOraclePlsqlBlock) && (!line.startsWith("/") || !inOraclePlsqlBlock)) { - sqlStatement = this.addSqlStatementPiece(sqlStatement, line); - } else { - if (inOraclePlsqlBlock) { - inOraclePlsqlBlock = false; - } else { - sqlStatement = this.addSqlStatementPiece(sqlStatement, line.substring(0, line.length() - 1)); - } - - Statement jdbcStatement = connection.createStatement(); - - try { - log.debug("SQL: {}", sqlStatement); - jdbcStatement.execute(sqlStatement); - jdbcStatement.close(); - } catch (Exception var27) { - e = var27; - if (exception == null) { - exception = e; - } - - log.error("problem during schema {}, statement {}", new Object[]{operation, sqlStatement, e}); - } finally { - sqlStatement = null; - } - } - } - } - } - - if (exception != null) { - throw exception; - } else { - log.debug("activiti db schema {} for component {} successful", operation, component); - } - } catch (Exception var29) { - Exception e = var29; - throw new ActivitiException("couldn't " + operation + " db schema: " + exceptionSqlStatement, e); - } - } - - protected String updateDdlForMySqlVersionLowerThan56(String ddlStatements) { - return ddlStatements.replace("timestamp(3)", "timestamp").replace("datetime(3)", "datetime").replace("TIMESTAMP(3)", "TIMESTAMP").replace("DATETIME(3)", "DATETIME"); - } - - protected String addSqlStatementPiece(String sqlStatement, String line) { - return sqlStatement == null ? line : sqlStatement + " \n" + line; - } - - protected String readNextTrimmedLine(BufferedReader reader) throws IOException { - String line = reader.readLine(); - if (line != null) { - line = line.trim(); - } - - return line; - } - - protected boolean isMissingTablesException(Exception e) { - String exceptionMessage = e.getMessage(); - if (e.getMessage() != null) { - if (exceptionMessage.indexOf("Table") != -1 && exceptionMessage.indexOf("not found") != -1) { - return true; - } - - if ((exceptionMessage.indexOf("Table") != -1 || exceptionMessage.indexOf("table") != -1) && exceptionMessage.indexOf("doesn't exist") != -1) { - return true; - } - - if ((exceptionMessage.indexOf("relation") != -1 || exceptionMessage.indexOf("table") != -1) && exceptionMessage.indexOf("does not exist") != -1) { - return true; - } - } - - return false; - } - - public void performSchemaOperationsProcessEngineBuild() { - String databaseSchemaUpdate = Context.getProcessEngineConfiguration().getDatabaseSchemaUpdate(); - log.debug("Executing performSchemaOperationsProcessEngineBuild with setting " + databaseSchemaUpdate); - if ("drop-create".equals(databaseSchemaUpdate)) { - try { - this.dbSchemaDrop(); - } catch (RuntimeException var3) { - } - } - - if (!"create-drop".equals(databaseSchemaUpdate) && !"drop-create".equals(databaseSchemaUpdate) && !"create".equals(databaseSchemaUpdate)) { - if ("false".equals(databaseSchemaUpdate)) { - this.dbSchemaCheckVersion(); - } else if ("true".equals(databaseSchemaUpdate)) { - this.dbSchemaUpdate(); - } - } else { - this.dbSchemaCreate(); - } - - } - - public void performSchemaOperationsProcessEngineClose() { - String databaseSchemaUpdate = Context.getProcessEngineConfiguration().getDatabaseSchemaUpdate(); - if ("create-drop".equals(databaseSchemaUpdate)) { - this.dbSchemaDrop(); - } - - } - - public <T> T getCustomMapper(Class<T> type) { - return this.sqlSession.getMapper(type); - } - - public boolean isMysql() { - return this.dbSqlSessionFactory.getDatabaseType().equals("mysql"); - } - - public boolean isOracle() { - return this.dbSqlSessionFactory.getDatabaseType().equals("oracle"); - } - - public DeploymentQueryImpl createDeploymentQuery() { - return new DeploymentQueryImpl(); - } - - public ModelQueryImpl createModelQueryImpl() { - return new ModelQueryImpl(); - } - - public ProcessDefinitionQueryImpl createProcessDefinitionQuery() { - return new ProcessDefinitionQueryImpl(); - } - - public ProcessInstanceQueryImpl createProcessInstanceQuery() { - return new ProcessInstanceQueryImpl(); - } - - public ExecutionQueryImpl createExecutionQuery() { - return new ExecutionQueryImpl(); - } - - public TaskQueryImpl createTaskQuery() { - return new TaskQueryImpl(); - } - - public JobQueryImpl createJobQuery() { - return new JobQueryImpl(); - } - - public HistoricProcessInstanceQueryImpl createHistoricProcessInstanceQuery() { - return new HistoricProcessInstanceQueryImpl(); - } - - public HistoricActivityInstanceQueryImpl createHistoricActivityInstanceQuery() { - return new HistoricActivityInstanceQueryImpl(); - } - - public HistoricTaskInstanceQueryImpl createHistoricTaskInstanceQuery() { - return new HistoricTaskInstanceQueryImpl(); - } - - public HistoricDetailQueryImpl createHistoricDetailQuery() { - return new HistoricDetailQueryImpl(); - } - - public HistoricVariableInstanceQueryImpl createHistoricVariableInstanceQuery() { - return new HistoricVariableInstanceQueryImpl(); - } - - public UserQueryImpl createUserQuery() { - return new UserQueryImpl(); - } - - public GroupQueryImpl createGroupQuery() { - return new GroupQueryImpl(); - } - - public SqlSession getSqlSession() { - return this.sqlSession; - } - - public DbSqlSessionFactory getDbSqlSessionFactory() { - return this.dbSqlSessionFactory; - } - - static { - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.7")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.8")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.9")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.10")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.11")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.12", Arrays.asList("5.12.1", "5.12T"))); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.13")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.14")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.15")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.15.1")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.16")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.16.1")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.16.2-SNAPSHOT")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.16.2")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.16.3.0")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.16.4.0")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.17.0.0")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.17.0.1")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.17.0.2")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.18.0.0")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.18.0.1")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.20.0.0")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.20.0.1")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.20.0.2")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.21.0.0")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.22.0.0")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("5.99.0.0")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("6.0.0.0")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("6.0.0.1")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("6.0.0.2")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("6.0.0.3")); - ACTIVITI_VERSIONS.add(new ActivitiVersion("6.0.0.4")); - JDBC_METADATA_TABLE_TYPES = new String[]{"TABLE"}; - } -} diff --git a/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSessionFactory.java b/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSessionFactory.java deleted file mode 100644 index a71afda..0000000 --- a/lxzn-module-activiti/src/main/java/org/activiti/engine/impl/db/DbSqlSessionFactory.java +++ /dev/null @@ -1,301 +0,0 @@ -package org.activiti.engine.impl.db; - -// -// Source code recreated from a .class file by IntelliJ IDEA -// (powered by FernFlower decompiler) -// - -import org.activiti.engine.ActivitiException; -import org.activiti.engine.impl.cfg.IdGenerator; -import org.activiti.engine.impl.interceptor.CommandContext; -import org.activiti.engine.impl.interceptor.Session; -import org.activiti.engine.impl.interceptor.SessionFactory; -import org.activiti.engine.impl.persistence.entity.Entity; -import org.activiti.engine.impl.persistence.entity.EventLogEntryEntityImpl; -import org.apache.ibatis.session.SqlSessionFactory; - -import java.sql.SQLException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -public class DbSqlSessionFactory implements SessionFactory { - protected static final Map<String, Map<String, String>> databaseSpecificStatements = new HashMap(); - protected static Map<Class<? extends Entity>, Boolean> bulkInsertableMap; - protected String databaseType; - protected String databaseTablePrefix = ""; - private boolean tablePrefixIsSchema; - protected String databaseCatalog; - protected String databaseSchema; - protected SqlSessionFactory sqlSessionFactory; - protected IdGenerator idGenerator; - protected Map<String, String> statementMappings; - protected Map<Class<?>, String> insertStatements = new ConcurrentHashMap(); - protected Map<Class<?>, String> bulkInsertStatements = new ConcurrentHashMap(); - protected Map<Class<?>, String> updateStatements = new ConcurrentHashMap(); - protected Map<Class<?>, String> deleteStatements = new ConcurrentHashMap(); - protected Map<Class<?>, String> bulkDeleteStatements = new ConcurrentHashMap(); - protected Map<Class<?>, String> selectStatements = new ConcurrentHashMap(); - protected boolean isDbIdentityUsed = true; - protected boolean isDbHistoryUsed = true; - protected int maxNrOfStatementsInBulkInsert = 100; - - public DbSqlSessionFactory() { - } - - public Class<?> getSessionType() { - return DbSqlSession.class; - } - - public Session openSession(CommandContext commandContext) { - DbSqlSession dbSqlSession = new DbSqlSession(this, commandContext.getEntityCache()); - SQLException e; - if (this.getDatabaseSchema() != null && this.getDatabaseSchema().length() > 0) { - try { - dbSqlSession.getSqlSession().getConnection().setSchema(this.getDatabaseSchema()); - } catch (SQLException var5) { - e = var5; - throw new ActivitiException("Could not set database schema on connection", e); - } - } - - if (this.getDatabaseCatalog() != null && this.getDatabaseCatalog().length() > 0) { - try { - dbSqlSession.getSqlSession().getConnection().setCatalog(this.getDatabaseCatalog()); - } catch (SQLException var4) { - e = var4; - throw new ActivitiException("Could not set database catalog on connection", e); - } - } - - return dbSqlSession; - } - - public String getInsertStatement(Entity object) { - return this.getStatement(object.getClass(), this.insertStatements, "insert"); - } - - public String getInsertStatement(Class<? extends Entity> clazz) { - return this.getStatement(clazz, this.insertStatements, "insert"); - } - - public String getBulkInsertStatement(Class clazz) { - return this.getStatement(clazz, this.bulkInsertStatements, "bulkInsert"); - } - - public String getUpdateStatement(Entity object) { - return this.getStatement(object.getClass(), this.updateStatements, "update"); - } - - public String getDeleteStatement(Class<?> entityClass) { - return this.getStatement(entityClass, this.deleteStatements, "delete"); - } - - public String getBulkDeleteStatement(Class<?> entityClass) { - return this.getStatement(entityClass, this.bulkDeleteStatements, "bulkDelete"); - } - - public String getSelectStatement(Class<?> entityClass) { - return this.getStatement(entityClass, this.selectStatements, "select"); - } - - private String getStatement(Class<?> entityClass, Map<Class<?>, String> cachedStatements, String prefix) { - String statement = (String)cachedStatements.get(entityClass); - if (statement != null) { - return statement; - } else { - statement = prefix + entityClass.getSimpleName(); - if (statement.endsWith("Impl")) { - statement = statement.substring(0, statement.length() - 10); - } else { - statement = statement.substring(0, statement.length() - 6); - } - - cachedStatements.put(entityClass, statement); - return statement; - } - } - - protected static void addDatabaseSpecificStatement(String databaseType, String activitiStatement, String ibatisStatement) { - Map<String, String> specificStatements = (Map)databaseSpecificStatements.get(databaseType); - if (specificStatements == null) { - specificStatements = new HashMap(); - databaseSpecificStatements.put(databaseType, specificStatements); - } - - ((Map)specificStatements).put(activitiStatement, ibatisStatement); - } - - public String mapStatement(String statement) { - if (this.statementMappings == null) { - return statement; - } else { - String mappedStatement = (String)this.statementMappings.get(statement); - return mappedStatement != null ? mappedStatement : statement; - } - } - - public void setDatabaseType(String databaseType) { - this.databaseType = databaseType; - this.statementMappings = (Map)databaseSpecificStatements.get(databaseType); - } - - public void setBulkInsertEnabled(boolean isBulkInsertEnabled, String databaseType) { - if (isBulkInsertEnabled) { - this.initBulkInsertEnabledMap(databaseType); - } - - } - - protected void initBulkInsertEnabledMap(String databaseType) { - bulkInsertableMap = new HashMap(); - Iterator var2 = EntityDependencyOrder.INSERT_ORDER.iterator(); - - while(var2.hasNext()) { - Class<? extends Entity> clazz = (Class)var2.next(); - bulkInsertableMap.put(clazz, Boolean.TRUE); - } - - if ("oracle".equals(databaseType) || "dm".equals(databaseType)) { - bulkInsertableMap.put(EventLogEntryEntityImpl.class, Boolean.FALSE); - } - - } - - public Boolean isBulkInsertable(Class<? extends Entity> entityClass) { - return bulkInsertableMap != null && bulkInsertableMap.containsKey(entityClass) && (Boolean)bulkInsertableMap.get(entityClass); - } - - public SqlSessionFactory getSqlSessionFactory() { - return this.sqlSessionFactory; - } - - public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) { - this.sqlSessionFactory = sqlSessionFactory; - } - - public IdGenerator getIdGenerator() { - return this.idGenerator; - } - - public void setIdGenerator(IdGenerator idGenerator) { - this.idGenerator = idGenerator; - } - - public String getDatabaseType() { - return this.databaseType; - } - - public Map<String, String> getStatementMappings() { - return this.statementMappings; - } - - public void setStatementMappings(Map<String, String> statementMappings) { - this.statementMappings = statementMappings; - } - - public Map<Class<?>, String> getInsertStatements() { - return this.insertStatements; - } - - public void setInsertStatements(Map<Class<?>, String> insertStatements) { - this.insertStatements = insertStatements; - } - - public Map<Class<?>, String> getBulkInsertStatements() { - return this.bulkInsertStatements; - } - - public void setBulkInsertStatements(Map<Class<?>, String> bulkInsertStatements) { - this.bulkInsertStatements = bulkInsertStatements; - } - - public Map<Class<?>, String> getUpdateStatements() { - return this.updateStatements; - } - - public void setUpdateStatements(Map<Class<?>, String> updateStatements) { - this.updateStatements = updateStatements; - } - - public Map<Class<?>, String> getDeleteStatements() { - return this.deleteStatements; - } - - public void setDeleteStatements(Map<Class<?>, String> deleteStatements) { - this.deleteStatements = deleteStatements; - } - - public Map<Class<?>, String> getBulkDeleteStatements() { - return this.bulkDeleteStatements; - } - - public void setBulkDeleteStatements(Map<Class<?>, String> bulkDeleteStatements) { - this.bulkDeleteStatements = bulkDeleteStatements; - } - - public Map<Class<?>, String> getSelectStatements() { - return this.selectStatements; - } - - public void setSelectStatements(Map<Class<?>, String> selectStatements) { - this.selectStatements = selectStatements; - } - - public boolean isDbIdentityUsed() { - return this.isDbIdentityUsed; - } - - public void setDbIdentityUsed(boolean isDbIdentityUsed) { - this.isDbIdentityUsed = isDbIdentityUsed; - } - - public boolean isDbHistoryUsed() { - return this.isDbHistoryUsed; - } - - public void setDbHistoryUsed(boolean isDbHistoryUsed) { - this.isDbHistoryUsed = isDbHistoryUsed; - } - - public void setDatabaseTablePrefix(String databaseTablePrefix) { - this.databaseTablePrefix = databaseTablePrefix; - } - - public String getDatabaseTablePrefix() { - return this.databaseTablePrefix; - } - - public String getDatabaseCatalog() { - return this.databaseCatalog; - } - - public void setDatabaseCatalog(String databaseCatalog) { - this.databaseCatalog = databaseCatalog; - } - - public String getDatabaseSchema() { - return this.databaseSchema; - } - - public void setDatabaseSchema(String databaseSchema) { - this.databaseSchema = databaseSchema; - } - - public void setTablePrefixIsSchema(boolean tablePrefixIsSchema) { - this.tablePrefixIsSchema = tablePrefixIsSchema; - } - - public boolean isTablePrefixIsSchema() { - return this.tablePrefixIsSchema; - } - - public int getMaxNrOfStatementsInBulkInsert() { - return this.maxNrOfStatementsInBulkInsert; - } - - public void setMaxNrOfStatementsInBulkInsert(int maxNrOfStatementsInBulkInsert) { - this.maxNrOfStatementsInBulkInsert = maxNrOfStatementsInBulkInsert; - } -} diff --git a/lxzn-module-dnc/pom.xml b/lxzn-module-dnc/pom.xml index ed3a17f..48ee57c 100644 --- a/lxzn-module-dnc/pom.xml +++ b/lxzn-module-dnc/pom.xml @@ -22,8 +22,8 @@ </dependency> <dependency> <groupId>org.jeecgframework.boot</groupId> - <artifactId>lxzn-module-activiti</artifactId> - <version>3.4.3</version> + <artifactId>lxzn-module-flowable</artifactId> + <version>${jeecgboot.version}</version> </dependency> <dependency> <groupId>org.graylog2</groupId> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/ActivitiDefinitionController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/ActivitiDefinitionController.java deleted file mode 100644 index ea9b77f..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/ActivitiDefinitionController.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.jeecg.modules.activiti.controller; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.jeecg.common.api.vo.Result; -import org.jeecg.common.aspect.annotation.AutoLog; -import org.jeecg.modules.activiti.entity.ActivitiDefinition; -import org.jeecg.modules.activiti.request.ActivitiDefinitionRequest; -import org.jeecg.modules.activiti.service.IActivitiDefinitionService; -import org.jeecg.modules.dnc.response.CommonCode; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; -import org.jeecg.modules.dnc.response.ResponseResult; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -@Slf4j -@Api(tags = "DNC鎸囨淳璁惧娴佺▼閰嶇疆") -@RestController -@RequestMapping("/nc/definition") -public class ActivitiDefinitionController { - @Autowired - private IActivitiDefinitionService definitionService; - - @AutoLog(value = "DNC鎸囨淳璁惧娴佺▼閰嶇疆-娣诲姞閰嶇疆") - @ApiOperation(value = "DNC鎸囨淳璁惧娴佺▼閰嶇疆-娣诲姞閰嶇疆", notes = "DNC鎸囨淳璁惧娴佺▼閰嶇疆-娣诲姞閰嶇疆") - @PostMapping("/add") - public ResponseResult addDefinition(@RequestBody ActivitiDefinition definition) { - boolean b = definitionService.addDefinition(definition); - if(b) - return new ResponseResult(CommonCode.SUCCESS); - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "DNC鎸囨淳璁惧娴佺▼閰嶇疆-淇敼閰嶇疆") - @ApiOperation(value = "DNC鎸囨淳璁惧娴佺▼閰嶇疆-淇敼閰嶇疆", notes = "DNC鎸囨淳璁惧娴佺▼閰嶇疆-淇敼閰嶇疆") - @PutMapping("/edit") - public ResponseResult editDefinition( @RequestBody ActivitiDefinition definition) { - boolean b = definitionService.updateById(definition); - if(b) - return new ResponseResult(CommonCode.SUCCESS); - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "DNC鎸囨淳璁惧娴佺▼閰嶇疆-鍒犻櫎閰嶇疆") - @ApiOperation(value = "DNC鎸囨淳璁惧娴佺▼閰嶇疆-鍒犻櫎閰嶇疆", notes = "DNC鎸囨淳璁惧娴佺▼閰嶇疆-鍒犻櫎閰嶇疆") - @DeleteMapping("/delete") - public ResponseResult deleteDefinition(@RequestParam("id") String id) { - boolean b = definitionService.deleteDefinition(id); - if(b) - return new ResponseResult(CommonCode.SUCCESS); - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "DNC鎸囨淳璁惧娴佺▼閰嶇疆-鍒嗛〉鏌ヨ閰嶇疆鍒楄〃") - @ApiOperation(value = "DNC鎸囨淳璁惧娴佺▼閰嶇疆-鍒嗛〉鏌ヨ閰嶇疆鍒楄〃", notes = "DNC鎸囨淳璁惧娴佺▼閰嶇疆-鍒嗛〉鏌ヨ閰嶇疆鍒楄〃") - @GetMapping("/find/page") - public Result<?> findPageList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, - ActivitiDefinitionRequest request) { - return definitionService.findPageList(pageNo, pageSize, request); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/ActivitiSignExamineController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/ActivitiSignExamineController.java deleted file mode 100644 index a265ab3..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/ActivitiSignExamineController.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.jeecg.modules.activiti.controller; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.jeecg.common.api.vo.Result; -import org.jeecg.common.aspect.annotation.AutoLog; -import org.jeecg.modules.activiti.entity.ActivitiSignExamine; -import org.jeecg.modules.activiti.request.ActivitiDefinitionRequest; -import org.jeecg.modules.activiti.service.IActivitiDefinitionService; -import org.jeecg.modules.activiti.service.IActivitiSignExamineService; -import org.jeecg.modules.dnc.response.CommonCode; -import org.jeecg.modules.dnc.response.ResponseResult; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.sql.Struct; - -@Slf4j -@Api(tags = "NC绋嬪簭绛炬淳娴佺▼閰嶇疆") -@RestController -@RequestMapping("/nc/activitiSignExamine") -public class ActivitiSignExamineController { - @Autowired - private IActivitiSignExamineService iActivitiSignExamineService; - - @AutoLog(value = "NC绋嬪簭绛炬淳娴佺▼閰嶇疆-娣诲姞閰嶇疆") - @ApiOperation(value = "NC绋嬪簭绛炬淳娴佺▼閰嶇疆-娣诲姞閰嶇疆", notes = "NC绋嬪簭绛炬淳娴佺▼閰嶇疆-娣诲姞閰嶇疆") - @PostMapping("/add") - public Result<?> addDefinition(@RequestBody ActivitiSignExamine activitiSignExamine) { - iActivitiSignExamineService.save(activitiSignExamine); - return Result.ok("娣诲姞鎴愬姛锛�"); - } - - @AutoLog(value = "NC绋嬪簭绛炬淳娴佺▼閰嶇疆-淇敼閰嶇疆") - @ApiOperation(value = "NC绋嬪簭绛炬淳娴佺▼閰嶇疆-淇敼閰嶇疆", notes = "NC绋嬪簭绛炬淳娴佺▼閰嶇疆-淇敼閰嶇疆") - @PutMapping("/edit") - public Result<?> editDefinition( @RequestBody ActivitiSignExamine activitiSignExamine) { - iActivitiSignExamineService.updateById(activitiSignExamine); - return Result.ok("缂栬緫鎴愬姛!"); - } - - @AutoLog(value = "NC绋嬪簭绛炬淳娴佺▼閰嶇疆-鍒犻櫎閰嶇疆") - @ApiOperation(value = "NC绋嬪簭绛炬淳娴佺▼閰嶇疆-鍒犻櫎閰嶇疆", notes = "NC绋嬪簭绛炬淳娴佺▼閰嶇疆-鍒犻櫎閰嶇疆") - @DeleteMapping("/delete") - public Result<?> deleteDefinition(@RequestParam("id") String id) { - iActivitiSignExamineService.removeById(id); - return Result.ok("鍒犻櫎鎴愬姛!"); - } - - @AutoLog(value = "NC绋嬪簭绛炬淳娴佺▼閰嶇疆-鍒嗛〉鏌ヨ閰嶇疆鍒楄〃") - @ApiOperation(value = "NC绋嬪簭绛炬淳娴佺▼閰嶇疆-鍒嗛〉鏌ヨ閰嶇疆鍒楄〃", notes = "NC绋嬪簭绛炬淳娴佺▼閰嶇疆-鍒嗛〉鏌ヨ閰嶇疆鍒楄〃") - @GetMapping("/find/page") - public Result<?> findPageList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, - ActivitiSignExamine activitiSignExamine) { - QueryWrapper<ActivitiSignExamine> queryWrapper=new QueryWrapper<>(); - queryWrapper.like(StrUtil.isNotEmpty(activitiSignExamine.getActName()),"act_name",activitiSignExamine.getActName()); - queryWrapper.orderByDesc("create_time"); - IPage<ActivitiSignExamine> page=iActivitiSignExamineService.page(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<ActivitiSignExamine>(pageNo, pageSize),queryWrapper); - return Result.ok(page); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/AssignFileStreamController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/AssignFileStreamController.java deleted file mode 100644 index ae4580a..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/controller/AssignFileStreamController.java +++ /dev/null @@ -1,114 +0,0 @@ -package org.jeecg.modules.activiti.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.jeecg.common.api.vo.Result; -import org.jeecg.common.aspect.annotation.AutoLog; -import org.jeecg.modules.activiti.entity.AssignFileStream; -import org.jeecg.modules.activiti.ext.ActTaskExt; -import org.jeecg.modules.activiti.ext.AssignFileStreamExt; -import org.jeecg.modules.activiti.request.ApproveBatchRequest; -import org.jeecg.modules.activiti.request.AssignFileRequest; -import org.jeecg.modules.activiti.request.AssignFileStreamQueryRequest; -import org.jeecg.modules.activiti.service.IAssignFileStreamService; -import org.jeecg.modules.dnc.response.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Collections; -import java.util.List; - -@Slf4j -@Api(tags = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔") -@RestController -@RequestMapping("/nc/activit") -public class AssignFileStreamController { - @Autowired - private IAssignFileStreamService assignFileStreamService; - - @AutoLog(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鍚姩娴佺▼ 淇濆瓨鐩稿簲鐨勬暟鎹� 缁戝畾businessKey") - @ApiOperation(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鍚姩娴佺▼ 淇濆瓨鐩稿簲鐨勬暟鎹� 缁戝畾businessKey", notes = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鍚姩娴佺▼ 淇濆瓨鐩稿簲鐨勬暟鎹� 缁戝畾businessKey") - @PostMapping("/assign/file/apply") - public ResponseResult applyAssignFile(@RequestBody AssignFileStream stream) { - ResponseResult b = assignFileStreamService.applyAssignFile(stream); - if(b.isSuccess()) { - return new ResponseResult(CommonCode.SUCCESS); - } - return b; - } - - @AutoLog(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-瀹℃壒鏈嶅姟") - @ApiOperation(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-瀹℃壒鏈嶅姟", notes = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-瀹℃壒鏈嶅姟") - @PostMapping("/assign/file/approve/{taskId}/{streamId}") - public ResponseResult approveAssignFile(@PathVariable("taskId") String taskId, @PathVariable("streamId") String streamId, - @RequestBody AssignFileStream stream) { - boolean b = assignFileStreamService.approveAssignFile(taskId, streamId, stream); - if(b) - return new ResponseResult(CommonCode.SUCCESS); - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鑾峰彇褰撳墠鐢ㄦ埛鐨勫緟鍔炲強鍙嬀鍙栫殑浠诲姟") - @ApiOperation(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鑾峰彇褰撳墠鐢ㄦ埛鐨勫緟鍔炲強鍙嬀鍙栫殑浠诲姟", notes = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鑾峰彇褰撳墠鐢ㄦ埛鐨勫緟鍔炲強鍙嬀鍙栫殑浠诲姟") - @GetMapping("/find/task/list") - public Result<?> getUndoTaskList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { - IPage<ActTaskExt> actTaskExtIPage = assignFileStreamService.getUndoTaskList(pageNo,pageSize); - return Result.ok(actTaskExtIPage); - } - - @AutoLog(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鎵归噺鎸囨淳鍒拌澶�") - @ApiOperation(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鎵归噺鎸囨淳鍒拌澶�", notes = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鎵归噺鎸囨淳鍒拌澶�") - @PostMapping("/assign/file/batch/apply") - public ResponseResult applyBatchAssignFile(@RequestBody AssignFileRequest assignFileRequest) { - boolean b = assignFileStreamService.applyBatchAssignFile(assignFileRequest); - if(b) - return new ResponseResult(CommonCode.SUCCESS); - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鎵归噺瀹℃壒") - @ApiOperation(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鎵归噺瀹℃壒", notes = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鎵归噺瀹℃壒") - @PostMapping("/assign/file/batch/approve") - public ResponseResult approveBatchAssignFile(@RequestBody ApproveBatchRequest approveBatchRequest) { - boolean b = assignFileStreamService.approveBatchAssignFile(approveBatchRequest); - if(b) - return new ResponseResult(CommonCode.SUCCESS); - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-宸插姙鍒楄〃鑾峰彇") - @ApiOperation(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-宸插姙鍒楄〃鑾峰彇", notes = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-宸插姙鍒楄〃鑾峰彇") - @GetMapping("/find/page") - public Result<?> findPageList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, AssignFileStreamQueryRequest request) { - return assignFileStreamService.findPageList(pageNo, pageSize, request); - } - - @AutoLog(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鏌ヨ鏂囨。鐨勫鎵硅褰�") - @ApiOperation(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鏌ヨ鏂囨。鐨勫鎵硅褰�", notes = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鏌ヨ鏂囨。鐨勫鎵硅褰�") - @GetMapping("/find/page/{page}/{size}/{docId}") - public QueryPageResponseResult<AssignFileStreamExt> findPageListByDocId(@PathVariable("page") int page, @PathVariable("size") int size, @PathVariable("docId") String docId) { - return assignFileStreamService.findPageListByDocId(page, size, docId); - } - - @AutoLog(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鑾峰彇鍚敤娴佺▼鐨勬爣璁�") - @ApiOperation(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鑾峰彇鍚敤娴佺▼鐨勬爣璁�", notes = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鑾峰彇鍚敤娴佺▼鐨勬爣璁�") - @GetMapping("/get/enable/flag") - public DataResponseResult<Boolean> getActiveEnable() { - Boolean b = assignFileStreamService.getActiveEnable(); - return new DataResponseResult<>(CommonCode.SUCCESS, b); - } - - @AutoLog(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鎵爜浼犺緭绋嬪簭 涓嶇粡杩囧鎵� 鏂囦欢瀛樺湪閲囩敤瑕嗙洊") - @ApiOperation(value = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鎵爜浼犺緭绋嬪簭 涓嶇粡杩囧鎵� 鏂囦欢瀛樺湪閲囩敤瑕嗙洊", notes = "DNC鎸囨淳璁惧娴佺▼鎿嶄綔-鎵爜浼犺緭绋嬪簭 涓嶇粡杩囧鎵� 鏂囦欢瀛樺湪閲囩敤瑕嗙洊") - @PostMapping("/transfer/doc") - public ResponseResult transferDocFile(String pnCode, String deviceNo) { - boolean b = assignFileStreamService.transferDocFile(pnCode, deviceNo); - if(b) - return new ResponseResult(CommonCode.SUCCESS); - return new ResponseResult(CommonCode.FAIL); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiDefinition.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiDefinition.java deleted file mode 100644 index f11db6b..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiDefinition.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.jeecg.modules.activiti.entity; - -import com.baomidou.mybatisplus.annotation.*; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonIgnore; -import io.swagger.annotations.Api; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.jeecg.common.aspect.annotation.Dict; - -import java.util.Date; - -@Data -@NoArgsConstructor -@TableName("nc_activiti_definition_info") -@Api(value= "DNC鎸囨淳璁惧娴佺▼瀹氫箟") -public class ActivitiDefinition { - @TableId(value = "id") - private String id; - @TableField(value = "act_name") - private String actName; - @TableField(value = "depart_id") - @Dict(dictTable = "mdc_production",dicCode = "id",dicText = "production_name") - private String departId; - @TableField(value = "approve_users") - @Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname") - private String approveUsers; - @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - @TableField(value = "create_time", fill = FieldFill.INSERT) - private Date createTime; - @TableField(value = "update_time", fill = FieldFill.UPDATE) - @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - private Date updateTime; - @JsonIgnore - @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) - private String createUser; - @JsonIgnore - @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) - private String updateUser; - @JsonIgnore - @TableLogic - @TableField(value = "delete_flag", select = false) - private Integer deleteFlag = 0; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiSignExamine.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiSignExamine.java deleted file mode 100644 index ae8e5a4..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiSignExamine.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.jeecg.modules.activiti.entity; - -import com.baomidou.mybatisplus.annotation.*; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonIgnore; -import io.swagger.annotations.Api; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.jeecg.common.aspect.annotation.Dict; - -import java.util.Date; - -@Data -@NoArgsConstructor -@TableName("nc_assign_to_sign_examine") -@Api(value= "NC绋嬪簭绛炬淳娴佺▼瀹氫箟") -public class ActivitiSignExamine { - @TableId(value = "id") - private String id; - @TableField(value = "act_name") - private String actName; - @TableField(value = "depart_id") - @Dict(dictTable = "mdc_production",dicCode = "id",dicText = "production_name") - private String departId; - @TableField(value = "proofreader_user") - @Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname") - private String proofreaderUser; - @TableField(value = "approving_user") - @Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname") - private String approveUser; - @TableField(value = "cutter_user") - @Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname") - private String cutterUser; - @TableField(value = "typecast_user") - @Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname") - private String typecastUser; - @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - @TableField(value = "create_time", fill = FieldFill.INSERT) - private Date createTime; - @TableField(value = "update_time", fill = FieldFill.UPDATE) - @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - private Date updateTime; - @JsonIgnore - @TableField(value = "create_by", select = false, fill = FieldFill.INSERT) - private String createBy; - @JsonIgnore - @TableField(value = "update_by", select = false, fill = FieldFill.UPDATE) - private String updateBy; - @JsonIgnore - @TableLogic - @TableField(value = "delete_flag", select = false) - private Integer deleteFlag = 0; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/AssignFileStream.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/AssignFileStream.java deleted file mode 100644 index 004f4fa..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/AssignFileStream.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.jeecg.modules.activiti.entity; - -import com.baomidou.mybatisplus.annotation.*; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonIgnore; -import io.swagger.annotations.Api; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.jeecg.common.aspect.annotation.Dict; - -import java.util.Date; - -@Data -@NoArgsConstructor -@TableName("nc_assign_file_stream") -@Api(value= "DNC鎸囨淳璁惧娴佺▼鎿嶄綔") -public class AssignFileStream { - @TableId(value = "stream_id") - private String streamId; - @TableField(value = "product_id") - private String productId; - @TableField(value = "component_id") - private String componentId; - @TableField(value = "parts_id") - private String partsId; - @TableField(value = "process_id") - private String processId; - @TableField(value = "step_id") - private String stepId; - @TableField(value = "doc_id") - private String docId; - @TableField(value = "file_id") - private String fileId; - @TableField(value = "device_id") - private String deviceId; - @TableField(value = "apply_user_id") - private String applyUserId; - @TableField(value = "apply_reason") - private String applyReason; - @TableField(value = "apply_time") - @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - private Date applyTime; - @TableField(value = "approve_user_id") - private String approveUserId; - @TableField(value = "approve_content") - private String approveContent; - @TableField(value = "approve_time") - @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - private Date approveTime; - @TableField(value = "status") - @Dict(dicCode = "dnc_assign_stream_status") - private Integer status; - @JsonIgnore - @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) - private Date createTime; - @JsonIgnore - @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) - private Date updateTime; - @JsonIgnore - @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) - private String createUser; - @JsonIgnore - @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) - private String updateUser; - @JsonIgnore - @TableLogic - @TableField(value = "delete_flag", select = false) - private Integer deleteFlag = 0; - - /**鎸囨淳璁惧涓撶敤-鎵�灞濱D*/ - private transient String attributionId; - - /**鎸囨淳璁惧涓撶敤-鎵�灞瀟ype*/ - private transient String attributionType; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ToEquipmentTask.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ToEquipmentTask.java deleted file mode 100644 index 257b9b1..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ToEquipmentTask.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.jeecg.modules.activiti.entity; - -import com.baomidou.mybatisplus.annotation.*; -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Date; - -@Data -@NoArgsConstructor -@TableName("nc_to_equipment_lists") -public class ToEquipmentTask { - @TableId(value = "code") - private String code; - @TableField(value = "doc_id") - private String docId; - @TableField(value = "file_id") - private String fileId; - @TableField(value = "device_id") - private String deviceId; - @TableField(value = "device_no") - private String deviceNo; - @TableField(value = "depart_id") - private String departId; - @TableField(value = "file_name") - private String fileName; - @TableField(value = "file_encode_name") - private String fileEncodeName; - @TableField(value = "file_path") - private String filePath; - @TableField(value = "file_suffix") - private String fileSuffix; - @TableField(value = "doc_version") - private String docVersion; - @TableField(value = "file_size") - private Long fileSize; - @TableField(value = "sync_flag") - private Integer syncFlag; - @TableField(value = "sync_time") - private Date syncTime; - @TableField(value = "apply_user") - private String applyUser; - @TableField(value = "apply_time") - private Date applyTime; - @JsonIgnore - @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) - private Date createTime; - @JsonIgnore - @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) - private Date updateTime; - @JsonIgnore - @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) - private String createUser; - @JsonIgnore - @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) - private String updateUser; - @JsonIgnore - @TableLogic - @TableField(value = "delete_flag", select = false) - private Integer deleteFlag = 0; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/ActTaskExt.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/ActTaskExt.java deleted file mode 100644 index 363032f..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/ActTaskExt.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jeecg.modules.activiti.ext; - -import lombok.Data; -import lombok.NoArgsConstructor; -import org.activiti.engine.task.Task; - -@Data -@NoArgsConstructor -public class ActTaskExt { - private String id; - private String name; - private String processInstanceId; - private String assignee; - private String executionId; - private String processDefinitionId; - private String businessKey; - private AssignFileStreamExt assignFileStream; - - public ActTaskExt instanceOfTask(Task task) { - this.id = task.getId(); - this.name = task.getName(); - this.processInstanceId = task.getProcessInstanceId(); - this.assignee = task.getAssignee(); - this.executionId = task.getExecutionId(); - this.processDefinitionId = task.getProcessDefinitionId(); - return this; - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/AssignFileStreamExt.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/AssignFileStreamExt.java deleted file mode 100644 index 15e1202..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/ext/AssignFileStreamExt.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jeecg.modules.activiti.ext; - -import lombok.Data; -import lombok.NoArgsConstructor; -import org.jeecg.modules.activiti.entity.AssignFileStream; - -@Data -@NoArgsConstructor -public class AssignFileStreamExt extends AssignFileStream { - private String productName; - private String componentName; - private String partsName; - private String docName; - private String version; - private String applyUser; - private String approveUser; - private String deviceName; - private String docSuffix; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ActivitiDefinitionMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ActivitiDefinitionMapper.java deleted file mode 100644 index 0514246..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ActivitiDefinitionMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jeecg.modules.activiti.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.jeecg.modules.activiti.entity.ActivitiDefinition; - -public interface ActivitiDefinitionMapper extends BaseMapper<ActivitiDefinition> { -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ActivitiSignExamineMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ActivitiSignExamineMapper.java deleted file mode 100644 index c8db5d0..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ActivitiSignExamineMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jeecg.modules.activiti.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.jeecg.modules.activiti.entity.ActivitiSignExamine; - -public interface ActivitiSignExamineMapper extends BaseMapper<ActivitiSignExamine> { -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/AssignFileStreamMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/AssignFileStreamMapper.java deleted file mode 100644 index db8c5f2..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/AssignFileStreamMapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jeecg.modules.activiti.mapper; - -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Constants; -import org.apache.ibatis.annotations.Param; -import org.jeecg.modules.activiti.entity.AssignFileStream; -import org.jeecg.modules.activiti.ext.AssignFileStreamExt; - -public interface AssignFileStreamMapper extends BaseMapper<AssignFileStream> { - /** - * 鍏宠仈鐢ㄦ埛琛� 鑾峰彇鐢ㄦ埛鏄电О - * @param streamId - * @return - */ - AssignFileStreamExt getAssignFileStreamDetail(@Param("streamId") String streamId); - - /** - * 鍒嗛〉鏌ヨ宸插姙浠诲姟 - * @param page - * @param wrapper - * @return - */ - IPage<AssignFileStreamExt> findByPage(IPage<AssignFileStreamExt> page, @Param(Constants.WRAPPER) Wrapper<AssignFileStreamExt> wrapper); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ToEquipmentTaskMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ToEquipmentTaskMapper.java deleted file mode 100644 index 2645b80..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/ToEquipmentTaskMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jeecg.modules.activiti.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.jeecg.modules.activiti.entity.ToEquipmentTask; - -public interface ToEquipmentTaskMapper extends BaseMapper<ToEquipmentTask> { -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/xml/AssignFileStreamMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/xml/AssignFileStreamMapper.xml deleted file mode 100644 index 7f2fae5..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/mapper/xml/AssignFileStreamMapper.xml +++ /dev/null @@ -1,89 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > -<mapper namespace="org.jeecg.modules.activiti.mapper.AssignFileStreamMapper"> - <select id="getAssignFileStreamDetail" resultType="org.jeecg.modules.activiti.ext.AssignFileStreamExt" parameterType="String"> - select a.stream_id - , a.product_id - , a.component_id - , a.parts_id - , a.process_id - , a.doc_id - , a.file_id - , a.device_id - , a.apply_user_id - , a.apply_reason - , a.apply_time - , a.approve_user_id - , a.approve_content - , a.approve_time - , a.status - , u1.realname as applyUser - , u2.realname as approveUser - , p.product_name as productName - , c.component_name as componentName - , pt.parts_name as partsName - , dc.doc_name as docName - , dc.publish_version as version - , dc.doc_suffix as docSuffix - , de.device_name as deviceName - from (select * from nc_assign_file_stream where stream_id=#{streamId}) a - left join sys_user u1 - on a.apply_user_id=u1.id - left join sys_user u2 - on a.approve_user_id=u2.id - left join nc_product_info p - on a.product_id=p.product_id - left join nc_component_info c - on a.component_id=c.component_id - left join nc_parts_info pt - on a.parts_id=pt.parts_id - left join nc_doc_info dc - on a.doc_id=dc.doc_id - left join nc_device_info de - on a.device_id=de.device_id - - </select> - - <select id="findByPage" resultType="org.jeecg.modules.activiti.ext.AssignFileStreamExt" parameterType="String"> - select a.stream_id - , a.product_id - , a.component_id - , a.parts_id - , a.process_id - , a.doc_id - , a.file_id - , a.device_id - , a.apply_user_id - , a.apply_reason - , a.apply_time - , a.approve_user_id - , a.approve_content - , a.approve_time - , a.status - , u1.realname as applyUser - , u2.realname as approveUser - , p.product_name as productName - , c.component_name as componentName - , pt.parts_name as partsName - , dc.doc_name as docName - , dc.publish_version as version - , dc.doc_suffix as docSuffix - , de.device_name as deviceName - from (select * from nc_assign_file_stream where delete_flag=0 and approve_time is not null) a - left join sys_user u1 - on a.apply_user_id=u1.id - left join sys_user u2 - on a.approve_user_id=u2.id - left join nc_product_info p - on a.product_id=p.product_id - left join nc_component_info c - on a.component_id=c.component_id - left join nc_parts_info pt - on a.parts_id=pt.parts_id - left join nc_doc_info dc - on a.doc_id=dc.doc_id - left join nc_device_info de - on a.device_id=de.device_id - ${ew.customSqlSegment} - </select> -</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ActivitiDefinitionRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ActivitiDefinitionRequest.java deleted file mode 100644 index 09aa963..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ActivitiDefinitionRequest.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.jeecg.modules.activiti.request; - -import lombok.Data; - -@Data -public class ActivitiDefinitionRequest { - private String actName; - //鎺掑簭瀛楁 - private String descStr; - private String ascStr; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ApproveBatchRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ApproveBatchRequest.java deleted file mode 100644 index 7edef40..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/ApproveBatchRequest.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jeecg.modules.activiti.request; - -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.List; - -@Data -@NoArgsConstructor -public class ApproveBatchRequest implements Serializable { - private String approveContent; - private Integer status; - private List<TaskRequest> taskArr; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileRequest.java deleted file mode 100644 index 6882c12..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileRequest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.jeecg.modules.activiti.request; - -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -@Data -@NoArgsConstructor -public class AssignFileRequest implements Serializable { - private String processId; - private String fileId; - private String docId; - private String applyReason; - private String[] deviceIds; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileStreamQueryRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileStreamQueryRequest.java deleted file mode 100644 index 2f1fbf7..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/AssignFileStreamQueryRequest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.jeecg.modules.activiti.request; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@ApiModel(value = "宸插姙浠诲姟鏌ヨ鏉′欢", description = "宸插姙浠诲姟鏌ヨ") -public class AssignFileStreamQueryRequest { - //鎺掑簭瀛楁 - @ApiModelProperty(value = "闄嶅簭鎺掑垪", notes="鎺掑簭瀛楁涓烘暟鎹簱鍏蜂綋瀛楁鍚嶏紝闇�瑕佽В鏋愶紱 澶氫釜瀛楁浠ヨ嫳鏂囬�楀彿鍒嗛殧") - private String descStr; - @ApiModelProperty(value = "鍗囧簭鎺掑垪", notes="鎺掑簭瀛楁涓烘暟鎹簱鍏蜂綋瀛楁鍚嶏紝闇�瑕佽В鏋愶紱 澶氫釜瀛楁浠ヨ嫳鏂囬�楀彿鍒嗛殧") - private String ascStr; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/TaskRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/TaskRequest.java deleted file mode 100644 index 49b29ec..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/request/TaskRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jeecg.modules.activiti.request; - -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -@Data -@NoArgsConstructor -public class TaskRequest implements Serializable { - private String id; - private String businessKey; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IActivitiDefinitionService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IActivitiDefinitionService.java deleted file mode 100644 index dc27d24..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IActivitiDefinitionService.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.jeecg.modules.activiti.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.common.api.vo.Result; -import org.jeecg.modules.activiti.entity.ActivitiDefinition; -import org.jeecg.modules.activiti.request.ActivitiDefinitionRequest; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; - -import java.util.List; - -public interface IActivitiDefinitionService extends IService<ActivitiDefinition> { - /** - * 娣诲姞閰嶇疆 - * @param definition - * @return - */ - boolean addDefinition(ActivitiDefinition definition); - /** - * 缂栬緫閰嶇疆 - * @param definition - * @return - */ - boolean editDefinition(String id, ActivitiDefinition definition); - - /** - * 鍒犻櫎閰嶇疆 - * @param id - * @return - */ - boolean deleteDefinition(String id); - - /** - * 鑾峰彇閮ㄩ棬鐨勬祦绋嬪畾涔� - * @param departId - * @return - */ - ActivitiDefinition getByDepartId(String departId); - - /** - * 鍒嗛〉鏌ヨ - * @param page - * @param size - * @param request - * @return - */ - Result<?> findPageList(int page, int size, ActivitiDefinitionRequest request); - - /** - * 鑾峰彇澶氫釜閮ㄩ棬鐨勫鎵逛汉 鍘婚噸 - * @param departIds - * @return - */ - List<String> getByDepartIds(List<String> departIds); - - /** - * 鏍规嵁鐢ㄦ埛淇℃伅鑾峰彇瀹℃壒 - * @param userId - * @return - */ - List<ActivitiDefinition> findByUserId(String userId); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IActivitiSignExamineService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IActivitiSignExamineService.java deleted file mode 100644 index ab5e090..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IActivitiSignExamineService.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.jeecg.modules.activiti.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.activiti.entity.ActivitiSignExamine; - - -public interface IActivitiSignExamineService extends IService<ActivitiSignExamine> { - -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IAssignFileStreamService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IAssignFileStreamService.java deleted file mode 100644 index 5d755fb..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IAssignFileStreamService.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.jeecg.modules.activiti.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.common.api.vo.Result; -import org.jeecg.modules.activiti.entity.AssignFileStream; -import org.jeecg.modules.activiti.ext.ActTaskExt; -import org.jeecg.modules.activiti.ext.AssignFileStreamExt; -import org.jeecg.modules.activiti.request.ApproveBatchRequest; -import org.jeecg.modules.activiti.request.AssignFileRequest; -import org.jeecg.modules.activiti.request.AssignFileStreamQueryRequest; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; -import org.jeecg.modules.dnc.response.ResponseResult; - -import java.util.List; - -public interface IAssignFileStreamService extends IService<AssignFileStream> { - /** - * 鍚姩娴佺▼ 淇濆瓨鐩稿簲鐨勬暟鎹� 缁戝畾businessKey - * @param stream - * @return - */ - ResponseResult applyAssignFile(AssignFileStream stream); - - /**securedoc - * 鍚姩娴佺▼ 淇濆瓨鐩稿簲鐨勬暟鎹� 缁戝畾businessKey - * @param stream - * @return - */ - boolean applyAssignFileActive(AssignFileStream stream); - /** - * 鍚姩娴佺▼ 淇濆瓨鐩稿簲鐨勬暟鎹� 缁戝畾businessKey - * @param stream - * @return - */ - ResponseResult applyAssignFileNonActive(AssignFileStream stream); - - /** - * 鑾峰彇褰撳墠鐢ㄦ埛鐨勫緟鍔炲強鍙嬀鍙栫殑浠诲姟 - * @return - */ - IPage<ActTaskExt> getUndoTaskList(Integer pageNo, Integer pageSize); - - /** - * 鍏宠仈鐢ㄦ埛琛� 鑾峰彇鐢ㄦ埛鏄电О - * @param streamId - * @return - */ - AssignFileStreamExt getAssignFileStreamDetail(String streamId); - - /** - * 瀹℃壒鏈嶅姟 - * @param taskId - * @param streamId - * @param stream - * @return - */ - boolean approveAssignFile(String taskId, String streamId, AssignFileStream stream); - - /** - * 鎵归噺鎸囨淳鍒拌澶� - * @param assignFileRequest - * @return - */ - boolean applyBatchAssignFile(AssignFileRequest assignFileRequest); - - /** - * 鎵归噺瀹℃壒 - * @param approveBatchRequest - * @return - */ - boolean approveBatchAssignFile(ApproveBatchRequest approveBatchRequest); - - /** - * 宸插姙鍒楄〃鑾峰彇 - * @param page - * @param size - * @return - */ - Result<?> findPageList(int page, int size, AssignFileStreamQueryRequest request); - - /** - * 鏌ヨ鏂囨。鐨勫鎵硅褰� - * @param page - * @param size - * @param docId - * @return - */ - QueryPageResponseResult<AssignFileStreamExt> findPageListByDocId(int page, int size, String docId); - - /** - * 鑾峰彇鍚敤娴佺▼鐨勬爣璁� - * @return - */ - Boolean getActiveEnable(); - - /** - * 鎵爜浼犺緭绋嬪簭 涓嶇粡杩囧鎵� 鏂囦欢瀛樺湪閲囩敤瑕嗙洊 - * @param pnCode - * @param deviceNo - * @return - */ - boolean transferDocFile(String pnCode, String deviceNo); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IToEquipmentTaskService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IToEquipmentTaskService.java deleted file mode 100644 index b230900..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/IToEquipmentTaskService.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jeecg.modules.activiti.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.activiti.entity.ToEquipmentTask; - -public interface IToEquipmentTaskService extends IService<ToEquipmentTask> { -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiDefinitionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiDefinitionServiceImpl.java deleted file mode 100644 index b2b524d..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiDefinitionServiceImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -package org.jeecg.modules.activiti.service.impl; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.common.api.vo.Result; -import org.jeecg.modules.activiti.entity.ActivitiDefinition; -import org.jeecg.modules.activiti.mapper.ActivitiDefinitionMapper; -import org.jeecg.modules.activiti.request.ActivitiDefinitionRequest; -import org.jeecg.modules.activiti.service.IActivitiDefinitionService; -import org.jeecg.modules.dnc.exception.ExceptionCast; -import org.jeecg.modules.dnc.mapper.DepartmentMapper; -import org.jeecg.modules.dnc.response.ActivitiDefinitionCode; -import org.jeecg.modules.dnc.response.CommonCode; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; -import org.jeecg.modules.dnc.ucenter.Department; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.jeecg.modules.system.entity.MdcProduction; -import org.jeecg.modules.system.entity.SysUser; -import org.jeecg.modules.system.service.IMdcProductionService; -import org.jeecg.modules.system.service.ISysUserService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; - -@Service -public class ActivitiDefinitionServiceImpl extends ServiceImpl<ActivitiDefinitionMapper, ActivitiDefinition> implements IActivitiDefinitionService { - @Autowired - private DepartmentMapper departmentMapper; - @Autowired - private ISysUserService userService; - @Autowired - private IMdcProductionService iMdcProductionService; - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean addDefinition(ActivitiDefinition definition) { - if(definition == null || !ValidateUtil.validateString(definition.getDepartId()) - || !ValidateUtil.validateString(definition.getActName()) || !ValidateUtil.validateString(definition.getApproveUsers())) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - ActivitiDefinition en = getByDepartId(definition.getDepartId()); - if(en != null) - ExceptionCast.cast(ActivitiDefinitionCode.DEF_IS_EXIST); - //淇敼涓簃dc杞﹂棿 - MdcProduction mdcProduction=iMdcProductionService.getById(definition.getDepartId()); - if(mdcProduction == null) - ExceptionCast.cast(ActivitiDefinitionCode.DEF_DEPART_NONE); - String[] userIds = definition.getApproveUsers().split(","); - if(userIds == null|| userIds.length < 1) - ExceptionCast.cast(ActivitiDefinitionCode.DEF_USER_NONE); - List<String> userIdList = new ArrayList<>(userIds.length); - Collections.addAll(userIdList, userIds); - Collection<SysUser> userList = userService.listByIds(userIdList); - if(userList == null || userList.isEmpty() || userList.size() != userIds.length) - ExceptionCast.cast(ActivitiDefinitionCode.DEF_USER_NONE); - return super.save(definition); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean editDefinition(String id, ActivitiDefinition definition) { - if(!ValidateUtil.validateString(id) || definition == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - ActivitiDefinition en = super.getById(id); - if(en == null) - ExceptionCast.cast(ActivitiDefinitionCode.DEF_NOT_EXIST); - String[] userIds = definition.getApproveUsers().split(","); - if(userIds == null|| userIds.length < 1) - ExceptionCast.cast(ActivitiDefinitionCode.DEF_USER_NONE); - List<String> userIdList = new ArrayList<>(userIds.length); - Collections.addAll(userIdList, userIds); - Collection<SysUser> userList = userService.listByIds(userIdList); - if(userList == null || userList.isEmpty() || userList.size() != userIds.length) - ExceptionCast.cast(ActivitiDefinitionCode.DEF_USER_NONE); - definition.setId(id); - definition.setDepartId(null); - return super.updateById(definition); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteDefinition(String id) { - if(!ValidateUtil.validateString(id)) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - ActivitiDefinition en = super.getById(id); - if(en == null) - ExceptionCast.cast(ActivitiDefinitionCode.DEF_NOT_EXIST); - return super.removeById(id); - } - - @Override - public ActivitiDefinition getByDepartId(String departId) { - if(!ValidateUtil.validateString(departId)) - return null; - List<ActivitiDefinition> list = super.lambdaQuery().eq(ActivitiDefinition::getDepartId, departId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - @Override - public Result<?> findPageList(int page, int size, ActivitiDefinitionRequest request) { - if(page < 1 || size < 1) { - ExceptionCast.cast(CommonCode.INVALID_PAGE); - } - IPage<ActivitiDefinition> pageData = new Page<>(page, size); - LambdaQueryChainWrapper<ActivitiDefinition> lambdaQuery = super.lambdaQuery(); - if(request != null) { - if(ValidateUtil.validateString(request.getActName())) { - lambdaQuery.like(ActivitiDefinition::getActName, request.getActName()); - } - } - lambdaQuery.orderByDesc(ActivitiDefinition::getCreateTime); - IPage<ActivitiDefinition> definitionIPage = lambdaQuery.page(pageData); - return Result.ok(definitionIPage); - - } - - @Override - public List<String> getByDepartIds(List<String> departIds) { - if(departIds == null || departIds.isEmpty()) - return null; - List<ActivitiDefinition> list = super.lambdaQuery().in(ActivitiDefinition::getDepartId, departIds).list(); - if(list == null || list.isEmpty()) - return null; - Map<String, String> userIdMap = new HashMap<>(); - list.forEach(item -> { - if(ValidateUtil.validateString(item.getApproveUsers())) { - String[] arr = item.getApproveUsers().split(","); - if(arr != null && arr.length > 0) { - for (String s : arr) { - userIdMap.put(s, s); - } - } - } - }); - if(userIdMap.isEmpty()) - return null; - List<String> userIds = new ArrayList<>(); - userIdMap.forEach((key, value) -> { - userIds.add(key); - }); - return userIds; - } - - @Override - public List<ActivitiDefinition> findByUserId(String userId) { - return super.lambdaQuery().like(ActivitiDefinition::getApproveUsers, userId).list(); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiSignExamineServiceimpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiSignExamineServiceimpl.java deleted file mode 100644 index 6d6b3b2..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiSignExamineServiceimpl.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.jeecg.modules.activiti.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.modules.activiti.entity.ActivitiSignExamine; -import org.jeecg.modules.activiti.mapper.ActivitiSignExamineMapper; -import org.jeecg.modules.activiti.service.IActivitiSignExamineService; -import org.springframework.stereotype.Service; - -@Service -public class ActivitiSignExamineServiceimpl extends ServiceImpl<ActivitiSignExamineMapper, ActivitiSignExamine> implements IActivitiSignExamineService { -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java deleted file mode 100644 index 8fbb198..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java +++ /dev/null @@ -1,817 +0,0 @@ -package org.jeecg.modules.activiti.service.impl; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.IdWorker; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.activiti.engine.HistoryService; -import org.activiti.engine.RuntimeService; -import org.activiti.engine.TaskService; -import org.activiti.engine.history.HistoricProcessInstance; -import org.activiti.engine.runtime.ProcessInstance; -import org.activiti.engine.task.Task; -import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.SecurityUtils; -import org.jeecg.common.api.vo.Result; -import org.jeecg.common.system.vo.LoginUser; -import org.jeecg.modules.activiti.entity.AssignFileStream; -import org.jeecg.modules.activiti.entity.ToEquipmentTask; -import org.jeecg.modules.activiti.ext.ActTaskExt; -import org.jeecg.modules.activiti.ext.AssignFileStreamExt; -import org.jeecg.modules.activiti.mapper.AssignFileStreamMapper; -import org.jeecg.modules.activiti.request.ApproveBatchRequest; -import org.jeecg.modules.activiti.request.AssignFileRequest; -import org.jeecg.modules.activiti.request.AssignFileStreamQueryRequest; -import org.jeecg.modules.activiti.request.TaskRequest; -import org.jeecg.modules.activiti.service.IActivitiDefinitionService; -import org.jeecg.modules.activiti.service.IAssignFileStreamService; -import org.jeecg.modules.activiti.service.IToEquipmentTaskService; -import org.jeecg.modules.dnc.entity.*; -import org.jeecg.modules.dnc.exception.ExceptionCast; -import org.jeecg.modules.dnc.ext.NcTxtFilePathInfo; -import org.jeecg.modules.dnc.response.*; -import org.jeecg.modules.dnc.service.*; -import org.jeecg.modules.dnc.ucenter.Department; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.jeecg.modules.dnc.utils.date.DateUtil; -import org.jeecg.modules.dnc.utils.file.FileUtilS; -import org.jeecg.modules.mdc.entity.MdcEquipment; -import org.jeecg.modules.mdc.service.IMdcEquipmentService; -import org.jeecg.modules.system.service.IMdcProductionService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.io.IOException; -import java.util.*; -import java.util.stream.Collectors; - -@Service -public class AssignFileStreamServiceImpl extends ServiceImpl<AssignFileStreamMapper, AssignFileStream> implements IAssignFileStreamService { - private static final String PROCESS_KEY = "assign_nc_to_device"; - private static final String APPLY_VARIABLE = "apply_user"; - private static final String APPROVE_VARIABLE = "approve_users"; - private static final String SEND_CODE = "SEND"; - - @Value("${activiti.enable}") - private Boolean activeEnable; - - @Autowired - private RuntimeService runtimeService; - @Autowired - private TaskService taskService; - @Autowired - private IDocInfoService docInfoService; - @Autowired - private IProcessStreamService processStreamService; - @Autowired - private IWorkStepService workStepService; - @Autowired - private IPermissionStreamService permissionStreamService; - @Autowired - private IDepartmentService departmentService; - @Autowired - private HistoryService historyService; - @Autowired - private IDocClassificationService classificationService; - @Autowired - private IToEquipmentTaskService equipmentTaskService; - @Autowired - private IDeviceInfoService deviceInfoService; - @Autowired - private IDocFileService docFileService; - @Autowired - private IActivitiDefinitionService definitionService; - @Autowired - private IDocRelativeService docRelativeService; - @Autowired - private ISynchronizedFlagService synchronizedFlagService; - @Autowired - private IDeviceGroupService deviceGroupService; - @Autowired - private IDncPassLogService dncPassLogService; - @Autowired - private IDeviceCharactersService iDeviceCharactersService; - @Autowired - private IMdcEquipmentService iMdcEquipmentService; - @Autowired - private IMdcProductionService iMdcProductionService; - @Autowired - private StringRedisTemplate redisTemplate; - - @Value("${securedoc.serverIp}") - private String serverIp; - @Value("${securedoc.serverPort}") - private int serverPort; - @Value("${securedoc.whether}") - private String whether; - @Value("${securedoc.localFilePath}") - private String localFilePath; - - @Override - @Transactional(rollbackFor = {Exception.class}) - public ResponseResult applyAssignFile(AssignFileStream stream) { - synchronized (this){ - //鍒ゆ柇璁惧鐗规畩瀛楃 - String specialChar = getDeviceSpecialChar(stream.getDeviceId(),stream.getFileId()); - if (StrUtil.isNotEmpty(specialChar)){ - //鎶涘嚭鐗规畩瀛楃寮傚父 - return createSpecialCharErrorResponse(specialChar); - } - if(activeEnable) { - boolean b = applyAssignFileActive(stream); - if (b) { - return ResponseResult.SUCCESS(); - } else { - return ResponseResult.SUCCESS(); - } - - }else { - return applyAssignFileNonActive(stream); - } - } - } - - /** - * 鍒ゆ柇璁惧鐗规畩瀛楃 - * @param deviceId,fileId - * 璁惧ID锛屾枃浠禝D - */ - public String getDeviceSpecialChar(String deviceId, String fileId){ - //鏇挎崲涓簃dc璁惧琛� -// DeviceInfo deviceInfo = deviceInfoService.getById(deviceId); - MdcEquipment mdcEquipment = iMdcEquipmentService.getById(deviceId); - if(mdcEquipment == null) - ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); -// DocFile docFile = docFileService.getById(fileId); - DocInfo docInfo = docInfoService.getOne(new QueryWrapper<DocInfo>().eq("publish_file_id",fileId)); - if(docInfo == null) - ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); - List<DeviceCharacters> deviceCharactersList=iDeviceCharactersService.list( - new LambdaQueryWrapper<DeviceCharacters>().eq(DeviceCharacters::getDeviceNo,mdcEquipment.getEquipmentId())); - if (deviceCharactersList.isEmpty()){ - return ""; - }else { - List<String> specialCharList=deviceCharactersList.stream().map(DeviceCharacters::getCharacters).collect(Collectors.toList()); - if(!specialCharList.isEmpty()){ - //瀵规瘮鏂囦欢鍚嶆槸鍚﹀寘鍚壒娈婂瓧绗� - String fileName=docInfo.getDocName(); - for(String specialChar:specialCharList){ - if (fileName.contains(specialChar)){ - return specialChar; - } - } - }else { - return ""; - } - } - return ""; - } - - private ResponseResult createSpecialCharErrorResponse(String specialChar) { - return new ResponseResult(new ResultCode() { - @Override - public boolean success() { - return false; - } - @Override - public int code() { - return 88881; - } - @Override - public String message() { - return "鏂囦欢鍚嶇О瀛樺湪璁惧鐗规畩瀛楃" + specialChar; - } - }); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean applyAssignFileActive(AssignFileStream stream) { - validateParams(stream); - DocInfo docInfo = getDocInfo(stream); - MdcEquipment mdcEquipment = getMdcEquipment(stream); - DocFile docFile = docFileService.getById(stream.getFileId()); - DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 4, stream.getDeviceId()); - if (deviceDoc != null) { - handleExistingDeviceDoc(docFile, mdcEquipment, stream.getDeviceId()); - } - deviceDoc = docInfoService.findByAttrAndDocName(docInfo.getDocName(), 4, stream.getDeviceId()); - if (deviceDoc != null) { - handleExistingDeviceDoc(docFile, mdcEquipment, stream.getDeviceId()); - } - List<PermissionStream> permissionStreams = getPermissionStreams(stream); - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userId = user.getId(); - List<String> departIds = getDepartIds(permissionStreams, userId); - List<String> userIdList = getUserIdList(departIds); - saveBusinessObject(stream, userId); - ProcessInstance processInstance = startProcessInstance(stream, userIdList); - completeTask(processInstance, userId); - return true; - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public ResponseResult applyAssignFileNonActive(AssignFileStream stream) { - //鏉冮檺鏍¢獙 - validateParams(stream); - DocInfo docInfo = getDocInfo(stream); - MdcEquipment mdcEquipment = getMdcEquipment(stream); - DocFile docFile = getDocFile(stream); - DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 4, stream.getDeviceId()); - if(deviceDoc != null) { - // 鍒犻櫎 澶囦唤 瑕嗙洊 鍘熸湁鐨� - List<String> strings=iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); - if (strings != null && !strings.isEmpty()) { - String path = StringUtils.join(strings.toArray(), "/"); - boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ mdcEquipment.getEquipmentId(), - docFile.getFileName(), docFile.getFileSuffix()); - } - } - /*deviceDoc = docInfoService.findByAttrAndDocName(docInfo.getDocName(), 4, stream.getDeviceId()); - if(deviceDoc != null) { - // 鍒犻櫎 澶囦唤 瑕嗙洊 鍘熸湁鐨� - List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); - if (strings != null && !strings.isEmpty()) { - String path = StringUtils.join(strings.toArray(), "/"); - boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ deviceInfo.getDeviceNo(), - docFile.getFileName(), docFile.getFileSuffix()); - } - }*/ - getPermissionStreams(stream); - //鎻掑叆鏂囨。鍒拌澶囧彂閫佹枃妗� - if(deviceDoc == null) { - DocClassification classification = classificationService.getByCode(SEND_CODE); - if(classification == null) - ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); - DocRelative docRelative = new DocRelative(); - docRelative.setDocId(docInfo.getDocId()); - docRelative.setClassificationId(classification.getClassificationId()); - docRelative.setAttributionType(4); - docRelative.setAttributionId(stream.getDeviceId()); - boolean b = docRelativeService.save(docRelative); - if(!b) { - ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); - } - - } - handleFileTransfer(mdcEquipment, docFile); - handleFileProcessing(docFile, mdcEquipment, whether, localFilePath); - synchronizedFlagService.updateFlag(2); - return new ResponseResult(CommonCode.SUCCESS); - } - - @Override - public IPage<ActTaskExt> getUndoTaskList(Integer pageNo,Integer pageSize) { - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userId = user.getId(); - if(!ValidateUtil.validateString(userId)) - return null; - List<Task> list = taskService.createTaskQuery().taskCandidateOrAssigned(userId).list(); - if(list == null || list.isEmpty()) - return null; - List<ActTaskExt> extList = new ArrayList<>(); - list.forEach(item -> { - ActTaskExt ext = new ActTaskExt(); - ext.instanceOfTask(item); - - HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId( - item.getProcessInstanceId()).singleResult(); - if(historicProcessInstance == null || !ValidateUtil.validateString(historicProcessInstance.getBusinessKey())) { - ExceptionCast.cast(ActivitiCode.ACT_PROC_INST_ERROR); - } - ext.setBusinessKey(historicProcessInstance.getBusinessKey()); - AssignFileStreamExt streamDetail = getAssignFileStreamDetail(historicProcessInstance.getBusinessKey()); - if(streamDetail == null) - ExceptionCast.cast(ActivitiCode.ACT_BUSINESS_DETAIL_ERROR); - ext.setAssignFileStream(streamDetail); - extList.add(ext); - }); - //灏佽Page - IPage<ActTaskExt> page = new Page<>(pageNo,pageSize); - page.setRecords(extList); - return page; - } - - @Override - public AssignFileStreamExt getAssignFileStreamDetail(String streamId) { - if(!ValidateUtil.validateString(streamId)) - return null; - return super.getBaseMapper().getAssignFileStreamDetail(streamId); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean approveAssignFile(String taskId, String streamId, AssignFileStream stream) { - if(!ValidateUtil.validateString(taskId) || !ValidateUtil.validateString(streamId) || stream == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userId = user.getId(); - if(!ValidateUtil.validateString(userId)) - ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); - if(!ValidateUtil.validateInteger(stream.getStatus())) - ExceptionCast.cast(ActivitiCode.ACT_STATUS_ERROR); - AssignFileStream en = super.getById(streamId); - if(en == null) - ExceptionCast.cast(ActivitiCode.ACT_BUSINESS_DETAIL_ERROR); - Task task = taskService.createTaskQuery().taskId(taskId).taskCandidateOrAssigned(userId).singleResult(); - if(task == null) - ExceptionCast.cast(ActivitiCode.ACT_TASK_ERROR); - if(!ValidateUtil.validateString(task.getAssignee())) { - //鎷惧彇浠诲姟 - taskService.claim(task.getId(), userId); - //瀹屾垚浠诲姟 - taskService.complete(task.getId()); - }else { - //瀹屾垚浠诲姟 - taskService.complete(task.getId()); - } - //鏇存柊瀵硅薄灏佽 - AssignFileStream up = new AssignFileStream(); - up.setApproveContent(stream.getApproveContent()); - up.setStatus(stream.getStatus()); - up.setApproveUserId(userId); - up.setApproveTime(DateUtil.getNow()); - up.setStreamId(streamId); - boolean b = super.updateById(up); - if(!b) - ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); - if(up.getStatus() == 2) { - //鍚屾剰鎿嶄綔 - DocInfo docInfo = docInfoService.getByDocAttrAndDocId(en.getDocId(), 5, en.getProcessId()); - if(docInfo == null || docInfo.getDocStatus() == 3) - ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); - DeviceInfo deviceInfo = deviceInfoService.getById(en.getDeviceId()); - if(deviceInfo == null) - ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); - DocFile docFile = docFileService.getById(en.getFileId()); - if(docFile == null) - ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); - DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(en.getDocId(),4, en.getDeviceId()); - if(deviceDoc != null) { - // 鍒犻櫎 澶囦唤 瑕嗙洊 鍘熸湁鐨� - List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); - if (strings != null && !strings.isEmpty()) { - String path = StringUtils.join(strings.toArray(), "/"); - boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ deviceInfo.getDeviceNo(), - docFile.getFileName(), docFile.getFileSuffix()); - /* //docInfoService.getBaseMapper().deleteById(deviceDoc.getDocId()); - boolean doc = docRelativeService.deleteCopyDocByAttrNext(deviceDoc.getDocId(),4,stream.getDeviceId()); - if (!doc) { - ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR_DELEVE); - }*/ - - } - } else { - //鎻掑叆鏂囨。鍒拌澶囧彂閫佹枃妗� - DocClassification classification = classificationService.getByCode(SEND_CODE); - if(classification == null) - ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); - - DocRelative docRelative = new DocRelative(); - docRelative.setDocId(docInfo.getDocId()); - docRelative.setClassificationId(classification.getClassificationId()); - docRelative.setAttributionType(4); - docRelative.setAttributionId(en.getDeviceId()); - b = docRelativeService.save(docRelative); - } - if(!b) - ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); - if (deviceInfo != null) { - List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); - if (strings != null && !strings.isEmpty()) { - String path = StringUtils.join(strings.toArray(), "/"); - boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ deviceInfo.getDeviceNo(), - docFile.getFileEncodeName(), - docFile.getFileName(),docFile.getFileSuffix()); - if (!copyFileNc) { - ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); - } else { - FileUtilS.deleteZipFromToSend(path + "/"+ deviceInfo.getDeviceNo(), - docFile.getFileName(),docFile.getFileSuffix()); - - } - } - - } - return synchronizedFlagService.updateFlag(1); - }else if(up.getStatus() == 3) { - //鎷掔粷鎿嶄綔 浠�涔堜篃涓嶅仛 - return true; - }else { - ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); - } - return false; - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean applyBatchAssignFile(AssignFileRequest assignFileRequest) { - if(assignFileRequest == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - String[] deviceIds = assignFileRequest.getDeviceIds(); - if(deviceIds == null || deviceIds.length < 1) - ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); - AssignFileStream stream; - for(String id : deviceIds) { - stream = new AssignFileStream(); - stream.setProcessId(assignFileRequest.getProcessId()); - stream.setDocId(assignFileRequest.getDocId()); - stream.setFileId(assignFileRequest.getFileId()); - stream.setApplyReason(assignFileRequest.getApplyReason()); - stream.setDeviceId(id); - ResponseResult b = applyAssignFile(stream); - if(!b.isSuccess()) - ExceptionCast.cast(ActivitiCode.ACT_APPLY_ERROR); - } - return true; - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean approveBatchAssignFile(ApproveBatchRequest approveBatchRequest) { - if(approveBatchRequest == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - List<TaskRequest> list = approveBatchRequest.getTaskArr(); - if(list == null || list.isEmpty()) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - list.forEach(item -> { - AssignFileStream stream = new AssignFileStream(); - stream.setApproveContent(approveBatchRequest.getApproveContent()); - stream.setStatus(approveBatchRequest.getStatus()); - boolean b = approveAssignFile(item.getId(), item.getBusinessKey(), stream); - if(!b) - ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); - }); - return synchronizedFlagService.updateFlag(1); - } - - @Override - public Result<?> findPageList(int page, int size, AssignFileStreamQueryRequest request) { - if(page < 1 || size < 1) { - ExceptionCast.cast(CommonCode.INVALID_PAGE); - } - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userId = user.getId(); - if(!ValidateUtil.validateString(userId)) - ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); - LambdaQueryWrapper<AssignFileStreamExt> lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(AssignFileStreamExt::getApproveUserId, userId); - lambdaQueryWrapper.orderByDesc(AssignFileStreamExt::getApproveTime); - IPage<AssignFileStreamExt> pageData = new Page<>(page, size); - if(request != null) { - if(ValidateUtil.validateString(request.getAscStr())) { - String[] ascArr = request.getAscStr().split(","); -// ((Page<AssignFileStreamExt>) pageData).setAsc(ascArr); - } - if(ValidateUtil.validateString(request.getDescStr())) { - String[] descStr = request.getDescStr().split(","); -// ((Page<AssignFileStreamExt>) pageData).setDesc(descStr); - } - } - IPage<AssignFileStreamExt> streamExtIPage = super.getBaseMapper().findByPage(pageData, lambdaQueryWrapper); - return Result.ok(streamExtIPage); - } - - @Override - public QueryPageResponseResult<AssignFileStreamExt> findPageListByDocId(int page, int size, String docId) { - if(page < 1 || size < 1) { - ExceptionCast.cast(CommonCode.INVALID_PAGE); - } - if(!ValidateUtil.validateString(docId)) - ExceptionCast.cast(ActivitiCode.ACT_DOC_ID_NONE); - QueryWrapper<AssignFileStreamExt> queryWrapper = Wrappers.query(); - queryWrapper.eq("a.doc_id", docId); - queryWrapper.orderByDesc("approve_time"); - IPage<AssignFileStreamExt> pageData = new Page<>(page, size); - IPage<AssignFileStreamExt> streamExtIPage = super.getBaseMapper().findByPage(pageData, queryWrapper); - return new QueryPageResponseResult<>(CommonCode.SUCCESS, streamExtIPage); - } - - @Override - public Boolean getActiveEnable() { - if(activeEnable != null) { - return activeEnable; - } - return false; - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean transferDocFile(String pnCode, String deviceNo) { - List<ProcessStream> streams = processStreamService.validateDeviceProcessInfo(pnCode, deviceNo); - DeviceInfo deviceInfo = deviceInfoService.getByDeviceNo(deviceNo); - if(deviceInfo == null) - ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); - //鍒犻櫎鍘熸潵璁惧涓嬬殑鎵�鏈夋枃妗� - docRelativeService.deleteByDocAttr(4, deviceInfo.getDeviceId()); - List<DocInfo> docInfoList = docInfoService.getByProcessIds(streams); - if(docInfoList == null || docInfoList.isEmpty()) - ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userId = user.getId(); - if(!ValidateUtil.validateString(userId)) - ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); - for(DocInfo docInfo : docInfoList) { - DocFile docFile = docFileService.getById(docInfo.getPublishFileId()); - if(docFile == null) - ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); - //鎻掑叆鏂囨。鍒拌澶囧彂閫佹枃妗� - DocClassification classification = classificationService.getByCode(SEND_CODE); - if(classification == null) - ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); - DocRelative docRelative = new DocRelative(); - docRelative.setDocId(docInfo.getDocId()); - docRelative.setClassificationId(classification.getClassificationId()); - docRelative.setAttributionType(4); - docRelative.setAttributionId(deviceInfo.getDeviceId()); - boolean b = docRelativeService.save(docRelative); - if(!b) - ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); - //鎻掑叆鏂囦欢浼犺緭浠诲姟琛� - ToEquipmentTask equipmentTask = new ToEquipmentTask(); - //涓嶈兘鐩存帴浠巇oc涓嬁fileId 鍜寁ersion 鍙兘浼氬瓨鍦ㄦ枌鏇� - //equipmentTask.setFileId(docInfo.getPublishFileId()); - //equipmentTask.setDocVersion(docInfo.getPublishVersion()); - equipmentTask.setDocId(docInfo.getDocId()); - equipmentTask.setSyncFlag(1); - equipmentTask.setDeviceNo(deviceInfo.getDeviceNo()); - equipmentTask.setDeviceId(deviceInfo.getDeviceId()); - equipmentTask.setDepartId(deviceInfo.getDepartId()); - //鏂囦欢鐩稿叧淇℃伅 - equipmentTask.setFileId(docFile.getFileId()); - equipmentTask.setDocVersion(docFile.getDocVersion()); - equipmentTask.setFileName(docInfo.getDocName()); - equipmentTask.setFileEncodeName(docFile.getFileEncodeName()); - equipmentTask.setFilePath(docFile.getFilePath()); - equipmentTask.setFileSuffix(docFile.getFileSuffix()); - equipmentTask.setFileSize(docFile.getFileSize()); - b = equipmentTaskService.save(equipmentTask); - if(!b) { - ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); - } - } - return synchronizedFlagService.updateFlag(1); - } - - //浼犲弬楠岃瘉 - private void validateParams(AssignFileStream stream) { - if (stream == null) { - ExceptionCast.cast(CommonCode.INVALID_PARAM); - } - if (!ValidateUtil.validateString(stream.getAttributionId()) || !ValidateUtil.validateString(stream.getDocId()) - || !ValidateUtil.validateString(stream.getFileId()) || !ValidateUtil.validateString(stream.getAttributionType())) { - ExceptionCast.cast(CommonCode.INVALID_PARAM); - } - if (!ValidateUtil.validateString(stream.getDeviceId())) { - ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); - } - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userId = user.getId(); - if (!ValidateUtil.validateString(userId)) { - ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); - } - } - - //鑾峰彇鏂囦欢淇℃伅 - private DocInfo getDocInfo(AssignFileStream stream) { - DocInfo docInfo = docInfoService.getByDocAttrAndDocId(stream.getDocId(), Integer.parseInt(stream.getAttributionType()), stream.getAttributionId()); - if (docInfo == null || docInfo.getDocStatus() == 3) { - ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); - } - return docInfo; - } - - //鑾峰彇鏂囦欢 - private void handleExistingDeviceDoc(DocFile docFile, MdcEquipment mdcEquipment, String deviceId) { - List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getEquipmentId()); - if (strings != null && !strings.isEmpty()) { - String path = StringUtils.join(strings.toArray(), "/"); - boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/" + mdcEquipment.getEquipmentId(), - docFile.getFileName(), docFile.getFileSuffix()); - if (!copyFileNc) { - ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); - } else { - DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(deviceId, 4, deviceId); - boolean doc = docRelativeService.deleteDocByAttr(deviceDoc.getDocId(), 4, deviceId); - if (!doc) { - ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR_DELEVE); - } - } - } - } - - //鏉冮檺鏍¢獙 - private List<PermissionStream> getPermissionStreams(AssignFileStream stream) { - List<PermissionStream> permissionStreams = new ArrayList<>(); - if (stream.getAttributionType().equals("5")) { - // 宸ュ簭 - ProcessStream processStream = processStreamService.getById(stream.getAttributionId()); - if (processStream == null) { - ExceptionCast.cast(CommonCode.INVALID_PARAM); - } - stream.setProductId(processStream.getProductId()); - stream.setComponentId(processStream.getComponentId()); - stream.setPartsId(processStream.getPartsId()); - stream.setProcessId(processStream.getProcessId()); - permissionStreams = permissionStreamService - .getByProcessId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(), processStream.getProcessId()); - } else { - // 宸ユ - WorkStep workStep = workStepService.getById(stream.getAttributionId()); - if (workStep == null) { - ExceptionCast.cast(CommonCode.INVALID_PARAM); - } - stream.setProductId(workStep.getProductId()); - stream.setComponentId(workStep.getComponentId()); - stream.setPartsId(workStep.getPartsId()); - stream.setProcessId(workStep.getProcessId()); - stream.setStepId(workStep.getId()); - permissionStreams = permissionStreamService - .getByStepId(workStep.getProductId(), workStep.getComponentId(), workStep.getPartsId(), workStep.getProcessId(), workStep.getId()); - } - if (permissionStreams == null || permissionStreams.isEmpty()) { - ExceptionCast.cast(ActivitiCode.ACT_NODE_DEPART_NONE); - } - return permissionStreams; - } - - //鑾峰彇閮ㄩ棬淇℃伅 - //todo 淇敼 - private List<String> getDepartIds(List<PermissionStream> permissionStreams, String userId) { - Map<String, Department> map = departmentService.getMapByUserId(userId); - List<String> departIds = permissionStreams.stream() - .filter(item -> map.containsKey(item.getDepartId())) - .map(PermissionStream::getDepartId) - .collect(Collectors.toList()); - if (departIds.isEmpty()) { - ExceptionCast.cast(ActivitiCode.ACT_USER_NOT_PERM); - } - return departIds; - } - - //鑾峰彇澶氫釜閮ㄩ棬鐨勫鎵逛汉 鍘婚噸 - private List<String> getUserIdList(List<String> departIds) { - List<String> userIdList = definitionService.getByDepartIds(departIds); - if (userIdList == null || userIdList.isEmpty()) { - ExceptionCast.cast(ActivitiCode.ACT_APPROVE_USERS_NONE); - } - return userIdList; - } - - //灏佽鏁版嵁 - private void saveBusinessObject(AssignFileStream stream, String userId) { - String streamId = IdWorker.getIdStr(); - stream.setStreamId(streamId); - stream.setApplyUserId(userId); - stream.setApplyTime(DateUtil.getNow()); - stream.setStatus(1); - boolean b = super.save(stream); - if (!b) { - ExceptionCast.cast(ActivitiCode.ACT_BUSINESS_SAVE_ERROR); - } - } - - //寮�濮嬪伐浣滄祦 - private ProcessInstance startProcessInstance(AssignFileStream stream, List<String> userIdList) { - String approveUsers = String.join(",", userIdList); - Map<String, Object> avariableMap = new HashMap<>(); - avariableMap.put(APPLY_VARIABLE, stream.getApplyUserId()); - avariableMap.put(APPROVE_VARIABLE, approveUsers); - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_KEY, stream.getStreamId(), avariableMap); - if (processInstance == null) { - ExceptionCast.cast(ActivitiCode.ACT_APPROVE_USERS_NONE); - } - return processInstance; - } - - //鎷惧彇浠诲姟 - private void completeTask(ProcessInstance processInstance, String userId) { - Task task = taskService.createTaskQuery().processDefinitionKey(PROCESS_KEY).taskAssignee(userId) - .processInstanceId(processInstance.getId()).singleResult(); - if (task == null) { - ExceptionCast.cast(ActivitiCode.ACT_APPROVE_USERS_NONE); - } - taskService.complete(task.getId()); - } - - //鑾峰彇璁惧 - private MdcEquipment getMdcEquipment(AssignFileStream stream) { - MdcEquipment mdcEquipment = iMdcEquipmentService.getById(stream.getDeviceId()); - if (mdcEquipment == null) { - ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); - } - return mdcEquipment; - } - - //鑾峰彇鏂囦欢 - private DocFile getDocFile(AssignFileStream stream) { - DocFile docFile = docFileService.getById(stream.getFileId()); - if (docFile == null) { - ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); - } - return docFile; - } - - //鎻掑叆鏂囦欢浼犺緭浠诲姟琛� - private void handleFileTransfer(MdcEquipment mdcEquipment, DocFile docFile) { - List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); - if (strings != null && !strings.isEmpty()) { - String path = StringUtils.join(strings.toArray(), "/"); - boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(), path + "/" + mdcEquipment.getEquipmentId(), - docFile.getFileEncodeName(), - docFile.getFileName(), docFile.getFileSuffix()); - if (!copyFileNc) { - ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); - } else { - FileUtilS.deleteZipFromToSend(path + "/" + mdcEquipment.getEquipmentId(), - docFile.getFileName(), docFile.getFileSuffix()); - } - } else { - throw new RuntimeException("鏂囦欢浼犺緭璺緞鑾峰彇澶辫触"); - } - } - - //灏佽澶勭悊鏂囦欢 - private void handleFileProcessing(DocFile docFile, MdcEquipment mdcEquipment, String whether, String localFilePath) { - if (whether.equals("true") && !docFile.getFileSuffix().equals("zip") && !docFile.getFileSuffix().equals("rar")) { - String size = FileUtilS.fileSizeNC(docFile.getFilePath(), docFile.getFileEncodeName()); - List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); - if (strings != null && !strings.isEmpty()) { - String path = StringUtils.join(strings.toArray(), "/"); - Date dateFirst = DateUtil.getNow(); - DncPassLog passInfoTxt = new DncPassLog(); - passInfoTxt.setDayTime(DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY)); - DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY)); - Integer fileTxt = 0, fileNc = 0; - if (dncPassLog != null) { - fileTxt = dncPassLog.getSequenceNumber() + 1; - fileNc = fileTxt + 1; - } else { - fileTxt = 1; - fileNc = fileTxt + 1; - } - String sequence = String.format("%06d", fileTxt); - String sequenceNc = String.format("%06d", fileNc); - passInfoTxt.setSequenceNumber(fileTxt); - passInfoTxt.setSequenceOrder(sequence); - passInfoTxt.setCreateTime(dateFirst); - passInfoTxt.setPassType("02"); - dncPassLogService.save(passInfoTxt); - - DncPassLog passInfoNc = new DncPassLog(); - passInfoNc.setSequenceNumber(fileNc); - passInfoNc.setSequenceOrder(sequenceNc); - passInfoNc.setDayTime(DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY)); - passInfoNc.setPassType("02"); - passInfoNc.setPassName(docFile.getFileName()); - try { - Thread.sleep(1000); - Date date = new Date(); - passInfoNc.setCreateTime(date); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - dncPassLogService.save(passInfoNc); - - NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo(); - ncTxt.setEquipmentId(mdcEquipment.getEquipmentId()); - ncTxt.setFileNcName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY) + sequenceNc); - ncTxt.setFileTxtName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY) + sequence); - ncTxt.setFilePath(path + "/" + mdcEquipment.getEquipmentId() + "/"); - ncTxt.setOrigFileName(docFile.getFileName()); - ncTxt.setOrigFileSuffix(docFile.getFileSuffix()); - ncTxt.setFileAddOrDelete(1); - String loFilePath = localFilePath + ncTxt.getFileTxtName() + ".nc"; - try { - String allList = ncTxt.getFileTxtName() + "\n" - + ncTxt.getFileNcName() + "\n" - + ncTxt.getOrigFileName() + "\n" - + ncTxt.getOrigFileSuffix() + "\n" - + ncTxt.getFilePath() + "\n" - + ncTxt.getEquipmentId() + "\n" - + ncTxt.getFileAddOrDelete().toString() + "\n" - + size + "\n"; - FileUtilS.fileWriterSql(loFilePath, allList); - boolean copyFileNc = FileUtilS.copyFileUpName(path + "/" + mdcEquipment.getEquipmentId() + "/send/" + - docFile.getFileName(), - localFilePath + ncTxt.getFileNcName(), - docFile.getFileSuffix(), "NC"); - if (!copyFileNc) { - FileUtilS.deleteNcFile(loFilePath); - } - } catch (IOException e) { - throw new RuntimeException("鏂囦欢澶勭悊澶辫触", e); - } - } - } - } - -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ToEquipmentTaskServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ToEquipmentTaskServiceImpl.java deleted file mode 100644 index 5e7ae9c..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ToEquipmentTaskServiceImpl.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.jeecg.modules.activiti.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.modules.activiti.entity.ToEquipmentTask; -import org.jeecg.modules.activiti.mapper.ToEquipmentTaskMapper; -import org.jeecg.modules.activiti.service.IToEquipmentTaskService; -import org.springframework.stereotype.Service; - -@Service -public class ToEquipmentTaskServiceImpl extends ServiceImpl<ToEquipmentTaskMapper, ToEquipmentTask> implements IToEquipmentTaskService { -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DepartmentController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DepartmentController.java deleted file mode 100644 index 73238d4..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DepartmentController.java +++ /dev/null @@ -1,219 +0,0 @@ -package org.jeecg.modules.dnc.controller; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.apache.shiro.SecurityUtils; -import org.jeecg.common.api.vo.Result; -import org.jeecg.common.aspect.annotation.AutoLog; -import org.jeecg.common.constant.CommonConstant; -import org.jeecg.common.system.vo.LoginUser; -import org.jeecg.common.util.oConvertUtils; -import org.jeecg.modules.dnc.request.DepartmentRequest; -import org.jeecg.modules.dnc.response.*; -import org.jeecg.modules.dnc.service.IDepartmentService; -import org.jeecg.modules.dnc.ucenter.Department; -import org.jeecg.modules.system.entity.SysUser; -import org.jeecg.modules.system.model.SysDepartTreeModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Collections; -import java.util.List; - -@Slf4j -@Api(tags = "DNC閮ㄩ棬绠$悊") -@RestController -@RequestMapping("/ucenter/depart") -public class DepartmentController { - @Autowired - private IDepartmentService departmentService; - - @AutoLog(value = "DNC閮ㄩ棬绠$悊-娣诲姞閮ㄩ棬淇℃伅") - @ApiOperation(value = "DNC閮ㄩ棬绠$悊-娣诲姞閮ㄩ棬淇℃伅", notes = "DNC閮ㄩ棬绠$悊-娣诲姞閮ㄩ棬淇℃伅") - @PostMapping("/add") - public ResponseResult addDepartment(@RequestBody Department department) { - boolean b = departmentService.addDepartment(department); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "DNC閮ㄩ棬绠$悊-淇敼閮ㄩ棬") - @ApiOperation(value = "DNC閮ㄩ棬绠$悊-淇敼閮ㄩ棬", notes = "DNC閮ㄩ棬绠$悊-淇敼閮ㄩ棬") - @PutMapping("/edit/{id}") - public ResponseResult editDepartment(@PathVariable("id") String id,@RequestBody Department department) { - boolean b = departmentService.editDepartment(id,department); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "DNC閮ㄩ棬绠$悊-鍒嗛〉鏌ヨ") - @ApiOperation(value = "DNC閮ㄩ棬绠$悊-鍒嗛〉鏌ヨ", notes = "DNC閮ㄩ棬绠$悊-鍒嗛〉鏌ヨ") - @GetMapping("/find/page/{page}/{size}") - public QueryPageResponseResult<Department> findPageList(@PathVariable("page") int page, @PathVariable("size") int size, DepartmentRequest departmentRequest) { - return departmentService.findPageList(page,size,departmentRequest); - } - - @AutoLog(value = "DNC閮ㄩ棬绠$悊-鑾峰彇鎵�鏈夊垪琛紝鎸夊眰绾�") - @ApiOperation(value = "DNC閮ㄩ棬绠$悊-鑾峰彇鎵�鏈夊垪琛紝鎸夊眰绾�", notes = "DNC閮ㄩ棬绠$悊-鑾峰彇鎵�鏈夊垪琛紝鎸夊眰绾�") - @GetMapping("/load/tree") - public QueryListResponseResult<CommonJsonTree> loadTree() { - List<CommonJsonTree> tree = departmentService.loadTree(); - if(tree == null) - tree = Collections.emptyList(); - return new QueryListResponseResult(CommonCode.SUCCESS, tree); - } - - @AutoLog(value = "DNC閮ㄩ棬绠$悊-鍒犻櫎 閮ㄩ棬") - @ApiOperation(value = "DNC閮ㄩ棬绠$悊-鍒犻櫎 閮ㄩ棬", notes = "DNC閮ㄩ棬绠$悊-鍒犻櫎 閮ㄩ棬") - @DeleteMapping("/delete") - public ResponseResult deleteDepartment(@RequestParam("id") String id) { - boolean b = departmentService.deleteDepartmentById(id); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "DNC閮ㄩ棬绠$悊-鑾峰彇鐢ㄦ埛鏈垎閰嶇殑閮ㄩ棬鍒楄〃") - @ApiOperation(value = "DNC閮ㄩ棬绠$悊-鑾峰彇鐢ㄦ埛鏈垎閰嶇殑閮ㄩ棬鍒楄〃", notes = "DNC閮ㄩ棬绠$悊-鑾峰彇鐢ㄦ埛鏈垎閰嶇殑閮ㄩ棬鍒楄〃") - @GetMapping("/perm/select/non/{userId}") - public QueryListResponseResult<Department> getUserNonPermDepart(@PathVariable("userId") String userId) { - List<Department> list = departmentService.getUserNonPermDepart(userId); - if(list == null) - list = Collections.emptyList(); - return new QueryListResponseResult<>(CommonCode.SUCCESS, list); - } - - @AutoLog(value = "DNC閮ㄩ棬绠$悊-鑾峰彇鐢ㄦ埛宸插垎閰嶇殑閮ㄩ棬鍒楄〃") - @ApiOperation(value = "DNC閮ㄩ棬绠$悊-鑾峰彇鐢ㄦ埛宸插垎閰嶇殑閮ㄩ棬鍒楄〃", notes = "DNC閮ㄩ棬绠$悊-鑾峰彇鐢ㄦ埛宸插垎閰嶇殑閮ㄩ棬鍒楄〃") - @GetMapping("/perm/select/{userId}") - public QueryListResponseResult<Department> getUserPermDepart(@PathVariable("userId") String userId) { - List<Department> list = departmentService.getUserPermDepart(userId); - if(list == null) - list = Collections.emptyList(); - return new QueryListResponseResult<>(CommonCode.SUCCESS, list); - } - - @AutoLog(value = "DNC閮ㄩ棬绠$悊-鑾峰彇閮ㄩ棬鏈寚瀹氱殑瀹℃壒浜�") - @ApiOperation(value = "DNC閮ㄩ棬绠$悊-鑾峰彇閮ㄩ棬鏈寚瀹氱殑瀹℃壒浜�", notes = "DNC閮ㄩ棬绠$悊-鑾峰彇閮ㄩ棬鏈寚瀹氱殑瀹℃壒浜�") - @GetMapping("/approve/select/non/{departId}") - public QueryListResponseResult<SysUser> getUserNonApproveDepart(@PathVariable("departId") String departId) { - List<SysUser> list = departmentService.getUserNonApproveDepart(departId); - if(list == null) - list = Collections.emptyList(); - return new QueryListResponseResult<>(CommonCode.SUCCESS, list); - } - - @AutoLog(value = "DNC閮ㄩ棬绠$悊-鑾峰彇閮ㄩ棬宸叉寚瀹氱殑瀹℃壒浜�") - @ApiOperation(value = "DNC閮ㄩ棬绠$悊-鑾峰彇閮ㄩ棬宸叉寚瀹氱殑瀹℃壒浜�", notes = "DNC閮ㄩ棬绠$悊-鑾峰彇閮ㄩ棬宸叉寚瀹氱殑瀹℃壒浜�") - @GetMapping("/approve/select/{departId}") - public QueryListResponseResult<SysUser> getUserApproveDepart(@PathVariable("departId") String departId) { - List<SysUser> list = departmentService.getUserApproveDepart(departId); - if(list == null) - list = Collections.emptyList(); - return new QueryListResponseResult<>(CommonCode.SUCCESS, list); - } - - @AutoLog(value = "DNC閮ㄩ棬绠$悊-澧炲姞閮ㄩ棬瀹℃壒浜�") - @ApiOperation(value = "DNC閮ㄩ棬绠$悊-澧炲姞閮ㄩ棬瀹℃壒浜�", notes = "DNC閮ㄩ棬绠$悊-澧炲姞閮ㄩ棬瀹℃壒浜�") - @PostMapping("/assign/add/approve/user/{departId}/{relativeFlag}") - public ResponseResult assignAddApproveUser(@PathVariable("departId") String departId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] userIds) { - boolean b = departmentService.assignAddApproveUser(departId, relativeFlag, userIds); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "DNC閮ㄩ棬绠$悊-绉婚櫎閮ㄩ棬瀹℃壒浜�") - @ApiOperation(value = "DNC閮ㄩ棬绠$悊-绉婚櫎閮ㄩ棬瀹℃壒浜�", notes = "DNC閮ㄩ棬绠$悊-绉婚櫎閮ㄩ棬瀹℃壒浜�") - @PostMapping("/assign/remove/approve/user/{departId}/{relativeFlag}") - public ResponseResult assignRemoveApproveUser(@PathVariable("departId") String departId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] userIds) { - boolean b = departmentService.assignRemoveApproveUser(departId, relativeFlag, userIds); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "DNC閮ㄩ棬绠$悊-鑾峰彇閮ㄩ棬List") - @ApiOperation(value = "DNC閮ㄩ棬绠$悊-鑾峰彇閮ㄩ棬List", notes = "DNC閮ㄩ棬绠$悊-鑾峰彇閮ㄩ棬List") - @GetMapping("/list/all") - public QueryListResponseResult<Department> getDepartList() { - List<Department> list = departmentService.list(); - if(list == null) - list = Collections.emptyList(); - return new QueryListResponseResult<>(CommonCode.SUCCESS, list); - } - - - @AutoLog(value = "DNC閮ㄩ棬绠$悊-鑾峰彇鏍戠粨鏋�") - @ApiOperation(value = "DNC閮ㄩ棬绠$悊-鑾峰彇鏍戠粨鏋�", notes = "DNC閮ㄩ棬绠$悊-鑾峰彇鏍戠粨鏋�") - @GetMapping("/load/queryTreeList") - public QueryListResponseResult<CommonJsonTree> queryTreeList() { - List<CommonJsonTree> tree = departmentService.loadTree(); - if(tree == null) - tree = Collections.emptyList(); - return new QueryListResponseResult(CommonCode.SUCCESS, tree); - } - - /** - * 鏌ヨ鏁版嵁 鏌ュ嚭鎵�鏈夐儴闂�,骞朵互鏍戠粨鏋勬暟鎹牸寮忓搷搴旂粰鍓嶇 - * - * @return - */ - @GetMapping(value = "/queryTreeList") - public Result<List<DepartmentTreeModel>> queryTreeList(@RequestParam(name = "ids", required = false) String ids) { - Result<List<DepartmentTreeModel>> result = new Result<>(); - try { - // 浠庡唴瀛樹腑璇诲彇 -// List<SysDepartTreeModel> list =FindsDepartsChildrenUtil.getSysDepartTreeList(); -// if (CollectionUtils.isEmpty(list)) { -// list = sysDepartService.queryTreeList(); -// } - if(oConvertUtils.isNotEmpty(ids)){ - List<DepartmentTreeModel> departList = departmentService.queryTreeList(ids); - result.setResult(departList); - }else{ - List<DepartmentTreeModel> list = departmentService.queryTreeList(); - result.setResult(list); - } - result.setSuccess(true); - } catch (Exception e) { - log.error(e.getMessage(),e); - } - return result; - } - - /** - * <p> - * 閮ㄩ棬鎼滅储鍔熻兘鏂规硶,鏍规嵁鍏抽敭瀛楁ā绯婃悳绱㈢浉鍏抽儴闂� - * </p> - * - * @param keyWord - * @return - */ - @RequestMapping(value = "/searchBy", method = RequestMethod.GET) - public Result<List<DepartmentTreeModel>> searchBy(@RequestParam(name = "keyWord", required = true) String keyWord,@RequestParam(name = "myDeptSearch", required = false) String myDeptSearch) { - Result<List<DepartmentTreeModel>> result = new Result<List<DepartmentTreeModel>>(); - //閮ㄩ棬鏌ヨ锛宮yDeptSearch涓�1鏃朵负鎴戠殑閮ㄩ棬鏌ヨ锛岀櫥褰曠敤鎴蜂负涓婄骇鏃舵煡鍙煡璐熻矗閮ㄩ棬涓嬫暟鎹� - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String departIds = null; - if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals( CommonConstant.USER_IDENTITY_2 )){ - departIds = user.getDepartIds(); - } - List<DepartmentTreeModel> treeList = this.departmentService.searchByKeyWord(keyWord,myDeptSearch,departIds); - if (treeList == null || treeList.size() == 0) { - result.setSuccess(false); - result.setMessage("鏈煡璇㈠尮閰嶆暟鎹紒"); - return result; - } - result.setResult(treeList); - return result; - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java index 9d6c1cd..542e144 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java @@ -80,27 +80,27 @@ return new QueryListResponseResult<>(CommonCode.SUCCESS, list); } - @AutoLog(value = "璁惧鍒嗙粍琛�-缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄�") - @ApiOperation(value = "璁惧鍒嗙粍琛�-缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄�", notes = "璁惧鍒嗙粍琛�-缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄�") - @PostMapping("/assign/add/depart/{groupId}/{relativeFlag}") - public ResponseResult assignAddDepartment(@PathVariable("groupId") String groupId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] departmentIds) { - boolean b = deviceGroupService.assignAddDepartment(groupId, relativeFlag, departmentIds); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "璁惧鍒嗙粍琛�-绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺") - @ApiOperation(value = "璁惧鍒嗙粍琛�-绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺", notes = "璁惧鍒嗙粍琛�-绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺") - @PostMapping("/assign/remove/depart/{groupId}/{relativeFlag}") - public ResponseResult assignRemoveDepartment(@PathVariable("groupId") String groupId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] departmentIds) { - boolean b = deviceGroupService.assignRemoveDepartment(groupId, relativeFlag, departmentIds); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } +// @AutoLog(value = "璁惧鍒嗙粍琛�-缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄�") +// @ApiOperation(value = "璁惧鍒嗙粍琛�-缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄�", notes = "璁惧鍒嗙粍琛�-缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄�") +// @PostMapping("/assign/add/depart/{groupId}/{relativeFlag}") +// public ResponseResult assignAddDepartment(@PathVariable("groupId") String groupId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] departmentIds) { +// boolean b = deviceGroupService.assignAddDepartment(groupId, relativeFlag, departmentIds); +// if(b) { +// return new ResponseResult(CommonCode.SUCCESS); +// } +// return new ResponseResult(CommonCode.FAIL); +// } +// +// @AutoLog(value = "璁惧鍒嗙粍琛�-绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺") +// @ApiOperation(value = "璁惧鍒嗙粍琛�-绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺", notes = "璁惧鍒嗙粍琛�-绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺") +// @PostMapping("/assign/remove/depart/{groupId}/{relativeFlag}") +// public ResponseResult assignRemoveDepartment(@PathVariable("groupId") String groupId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] departmentIds) { +// boolean b = deviceGroupService.assignRemoveDepartment(groupId, relativeFlag, departmentIds); +// if(b) { +// return new ResponseResult(CommonCode.SUCCESS); +// } +// return new ResponseResult(CommonCode.FAIL); +// } } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/UserPermButtonController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/UserPermButtonController.java deleted file mode 100644 index 4192f04..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/UserPermButtonController.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.jeecg.modules.dnc.controller; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.jeecg.common.aspect.annotation.AutoLog; -import org.jeecg.modules.dnc.response.CommonCode; -import org.jeecg.modules.dnc.response.QueryListResponseResult; -import org.jeecg.modules.dnc.service.IUserPermButtonService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Collections; -import java.util.List; - -@Slf4j -@Api(tags = "鐢ㄦ埛鎸夐挳鏉冮檺") -@RestController -@RequestMapping("/nc/user") -public class UserPermButtonController { - @Autowired - private IUserPermButtonService userPermButtonService; - - - /** - * 鑾峰彇褰撳墠鐢ㄦ埛鎸夐挳鏉冮檺鍒楄〃 - * @param param - * @param flag - * @param objectId - * @param relativeParam - * @param relativeObjectId - * @return - */ - @AutoLog(value = "鐢ㄦ埛鎸夐挳鏉冮檺-鑾峰彇褰撳墠鐢ㄦ埛鎸夐挳鏉冮檺鍒楄〃") - @ApiOperation(value = "鐢ㄦ埛鎸夐挳鏉冮檺-鑾峰彇褰撳墠鐢ㄦ埛鎸夐挳鏉冮檺鍒楄〃", notes = "鐢ㄦ埛鎸夐挳鏉冮檺-鑾峰彇褰撳墠鐢ㄦ埛鎸夐挳鏉冮檺鍒楄〃") - @GetMapping("/get/button/perms") - public QueryListResponseResult<String> getCurrentUserButtonPerms(@RequestParam("param") String param, - @RequestParam("flag") Integer flag, - @RequestParam(value = "objectId", required = false) String objectId, - @RequestParam(value = "relativeParam", required = false) String relativeParam, - @RequestParam(value = "relativeObjectId", required = false) String relativeObjectId) { - List<String> perms = userPermButtonService.getCurrentUserButtonPerms(param, flag, objectId, relativeParam, relativeObjectId); - if(perms == null) - perms = Collections.emptyList(); - return new QueryListResponseResult(CommonCode.SUCCESS, perms); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentService.java deleted file mode 100644 index 1d27e52..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentService.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.response.CommonJsonTree; -import org.jeecg.modules.dnc.response.DepartmentTreeModel; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; -import org.jeecg.modules.dnc.ucenter.Department; -import org.jeecg.modules.system.entity.SysUser; -import org.jeecg.modules.dnc.request.DepartmentRequest; -import org.jeecg.modules.system.model.SysDepartTreeModel; - -import java.util.List; -import java.util.Map; - -public interface IDepartmentService extends IService<Department> { - /** - * 娣诲姞閮ㄩ棬淇℃伅 - * @param department - * @return - */ - boolean addDepartment(Department department); - - /** - * 淇敼閮ㄩ棬 - * @param id - * @param department - * @return - */ - boolean editDepartment(String id,Department department); - - /** - * 鏍规嵁閮ㄩ棬缂栧彿鏌ユ壘閮ㄩ棬 - * @param departCode - * @param departId null 琛ㄧず鍙牴鎹甦epartCode鏌ワ紝 闈瀗ull 琛ㄧず鎺掗櫎璇epartId - * @return - */ - Department getByDepartCode(String departCode, String departId); - - /** - * 鑾峰彇鐢ㄦ埛鏈垎閰嶇殑閮ㄩ棬鍒楄〃 - * @param userId - * @return - */ - List<Department> getUserNonPermDepart(String userId); - - /** - * 鑾峰彇鐢ㄦ埛宸插垎閰嶇殑閮ㄩ棬鍒楄〃 - * @param userId - * @return - */ - List<Department> getUserPermDepart(String userId); - - /** - * 鍒嗛〉鏌ヨ - * @param page - * @param size - * @param requestParams - * @return - */ - QueryPageResponseResult<Department> findPageList(int page, int size, DepartmentRequest requestParams); - - /** - * 鍒犻櫎 閮ㄩ棬 - * @param id - * @return - */ - boolean deleteDepartmentById(String id); - - - /** - * 鏍规嵁鐖禝D 鏌ヨ鏁版嵁 - * @param parentId - * @return - */ - List<Department> findSunLint(String parentId); - - /** - * 鑾峰彇鎵�鏈夊垪琛紝鎸夊眰绾� - * @return - */ - List<CommonJsonTree> loadTree(); - - /** - * 鑾峰彇鐢ㄦ埛鎵�鍦ㄧ殑閮ㄩ棬 - * @param userId - * @return - */ - Map<String, Department> getMapByUserId(String userId); - - /** - * 鑾峰彇閮ㄩ棬鏈寚瀹氱殑瀹℃壒浜� - * @param departId - * @return - */ - List<SysUser> getUserNonApproveDepart(String departId); - - /** - * 鑾峰彇閮ㄩ棬宸叉寚瀹氱殑瀹℃壒浜� - * @param departId - * @return - */ - List<SysUser> getUserApproveDepart(String departId); - - /** - * 澧炲姞閮ㄩ棬瀹℃壒浜� - * @param departId - * @param relativeFlag - * @param userIds - * @return - */ - boolean assignAddApproveUser(String departId, Integer relativeFlag, String[] userIds); - - /** - * 绉婚櫎閮ㄩ棬瀹℃壒浜� - * @param departId - * @param relativeFlag - * @param userIds - * @return - */ - boolean assignRemoveApproveUser(String departId, Integer relativeFlag, String[] userIds); - - /** - * 鏌ヨ鎵�鏈夐儴闂ㄤ俊鎭�,骞跺垎鑺傜偣杩涜鏄剧ず - * @return - */ - List<DepartmentTreeModel> queryTreeList(); - - - /** - * 鏌ヨ鎵�鏈夐儴闂ㄤ俊鎭�,骞跺垎鑺傜偣杩涜鏄剧ず - * @param ids 澶氫釜閮ㄩ棬id - * @return - */ - List<DepartmentTreeModel> queryTreeList(String ids); - - - /** - * 鏍规嵁鍏抽敭瀛楁悳绱㈢浉鍏崇殑閮ㄩ棬鏁版嵁 - * @param keyWord - * @param myDeptSearch - * @param departIds 澶氫釜閮ㄩ棬id - * @return - */ - List<DepartmentTreeModel> searchByKeyWord(String keyWord,String myDeptSearch,String departIds); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java index ed34326..374ddc5 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java @@ -108,23 +108,23 @@ */ List<Department> getDepartNonPermsList(String groupId); - /** - * 缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄� - * @param groupId - * @param relativeFlag - * @param departmentIds - * @return - */ - boolean assignAddDepartment(String groupId, Integer relativeFlag, String[] departmentIds); - - /** - * 绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺 - * @param groupId - * @param relativeFlag - * @param departmentIds - * @return - */ - boolean assignRemoveDepartment(String groupId, Integer relativeFlag, String[] departmentIds); +// /** +// * 缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄� +// * @param groupId +// * @param relativeFlag +// * @param departmentIds +// * @return +// */ +// boolean assignAddDepartment(String groupId, Integer relativeFlag, String[] departmentIds); +// +// /** +// * 绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺 +// * @param groupId +// * @param relativeFlag +// * @param departmentIds +// * @return +// */ +// boolean assignRemoveDepartment(String groupId, Integer relativeFlag, String[] departmentIds); /** * 缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄� diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IUserPermButtonService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IUserPermButtonService.java deleted file mode 100644 index 4425c62..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IUserPermButtonService.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import java.util.List; - -public interface IUserPermButtonService { - /** - * 鑾峰彇褰撳墠鐢ㄦ埛鎸夐挳鏉冮檺鍒楄〃 - * @param param - * @param objectId - * @param userId - * @return - */ - Boolean checkObjectValid(String param, String objectId, String userId); - - /** - * 鑾峰彇褰撳墠鐢ㄦ埛鎸夐挳鏉冮檺鍒楄〃 - * @param param - * @param flag - * @param objectId - * @param relativeParam - * @param relativeObjectId - * @return - */ - List<String> getCurrentUserButtonPerms(String param, Integer flag, String objectId, String relativeParam, String relativeObjectId); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentServiceImpl.java deleted file mode 100644 index 16fc6b2..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentServiceImpl.java +++ /dev/null @@ -1,340 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.common.constant.CommonConstant; -import org.jeecg.common.util.oConvertUtils; -import org.jeecg.modules.activiti.entity.ActivitiDefinition; -import org.jeecg.modules.activiti.service.IActivitiDefinitionService; -import org.jeecg.modules.dnc.ucenter.DepartApproveUser; -import org.jeecg.modules.dnc.dto.DepartmentExt; -import org.jeecg.modules.dnc.ucenter.DepartmentUser; -import org.jeecg.modules.dnc.entity.DevicePermissionStream; -import org.jeecg.modules.dnc.entity.PermissionStream; -import org.jeecg.modules.dnc.exception.ExceptionCast; -import org.jeecg.modules.dnc.mapper.DepartmentMapper; -import org.jeecg.modules.dnc.request.DepartmentRequest; -import org.jeecg.modules.dnc.response.*; -import org.jeecg.modules.dnc.service.*; -import org.jeecg.modules.dnc.service.support.DepartmentTreeWrapper; -import org.jeecg.modules.dnc.service.support.FindsDepartmentChildrenUtil; -import org.jeecg.modules.dnc.ucenter.Department; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.jeecg.modules.system.entity.SysUser; -import org.jeecg.modules.system.service.ISysUserService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; - -@Service -public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements IDepartmentService { - @Autowired - private ISysUserService userService; - @Autowired - private IDepartApproveUserService departApproveUserService; - @Autowired - private IDepartmentUserService departmentUserService; - @Autowired - private IPermissionStreamService permissionStreamService; - @Autowired - private IDevicePermissionStreamService devicePermissionStreamService; - @Autowired - private IActivitiDefinitionService activitiDefinitionService; - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean addDepartment(Department department) { - if(department == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - if(!ValidateUtil.validateString(department.getDepartCode())) - ExceptionCast.cast(DepartmentCode.DEPART_CODE_NONE); - if(!ValidateUtil.validateString(department.getDepartName())) - ExceptionCast.cast(DepartmentCode.DEPART_NAME_NONE); - Department en = this.getByDepartCode(department.getDepartCode(), null); - if(en != null) - ExceptionCast.cast(DepartmentCode.DEPART_IS_EXIST); - if(ValidateUtil.validateString(department.getParentId())) { - Department parent = super.getById(department.getParentId()); - if(parent == null) - ExceptionCast.cast(DepartmentCode.DEPART_PARENT_NOT_EXIST); - department.setRankLevel(parent.getRankLevel() + 1); - }else { - department.setParentId(null); - department.setRankLevel(1); - } - return super.save(department); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean editDepartment(String id, Department department) { - if(!ValidateUtil.validateString(id) || department == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - Department en = super.getById(id); - if (en == null) - ExceptionCast.cast(DepartmentCode.DEPART_NOT_EXIST); - department.setDepartId(id); - department.setDepartCode(null); - if(ValidateUtil.validateString(department.getParentId())) { - if (!department.getParentId().equals(en.getParentId())) { - Department parent = super.getById(department.getParentId()); - if(parent == null) - ExceptionCast.cast(DepartmentCode.DEPART_PARENT_NOT_EXIST); - department.setRankLevel(parent.getRankLevel() + 1); - } - }else { - department.setRankLevel(1); - } - return super.updateById(department); - } - - @Override - public Department getByDepartCode(String departCode, String departId) { - if(!ValidateUtil.validateString(departCode)) - return null; - LambdaQueryChainWrapper<Department> lambdaQueryChain = super.lambdaQuery(); - lambdaQueryChain.eq(Department::getDepartCode, departCode); - if(ValidateUtil.validateString(departId)) { - lambdaQueryChain.ne(Department::getDepartId, departCode); - } - List<Department> departmentList = lambdaQueryChain.list(); - if(!ValidateUtil.validateString(departCode)) - return null; - if(departmentList == null || departmentList.isEmpty()) - return null; - return departmentList.get(0); - } - - @Override - public List<Department> getUserNonPermDepart(String userId) { - return super.getBaseMapper().getUserNonPermDepart(userId); - } - - @Override - public List<Department> getUserPermDepart(String userId) { - return super.getBaseMapper().getUserPermDepart(userId); - } - - @Override - public QueryPageResponseResult<Department> findPageList(int page, int size, DepartmentRequest requestParams) { - if(page < 1 || size < 1) { - ExceptionCast.cast(CommonCode.INVALID_PAGE); - } - IPage<Department> pageData = new Page<>(page, size); - LambdaQueryChainWrapper<Department> lambdaQuery = super.lambdaQuery(); - if(requestParams != null) { - if(ValidateUtil.validateString(requestParams.getDepartName())) { - lambdaQuery.like(Department::getDepartName, requestParams.getDepartName()); - } - if(ValidateUtil.validateString(requestParams.getDepartCode())) { - lambdaQuery.like(Department::getDepartCode, requestParams.getDepartCode()); - } - if(ValidateUtil.validateString(requestParams.getId())) { - lambdaQuery.eq(Department::getParentId,requestParams.getId()); - } - if(ValidateUtil.validateString(requestParams.getAscStr())) { - String[] ascArr = requestParams.getAscStr().split(","); -// ((Page<Department>) pageData).setAsc(ascArr); - } - if(ValidateUtil.validateString(requestParams.getDescStr())) { - String[] descStr = requestParams.getDescStr().split(","); -// ((Page<Department>) pageData).setDesc(descStr); - } - } - IPage<Department> userIPage = lambdaQuery.page(pageData); - return new QueryPageResponseResult<>(CommonCode.SUCCESS, userIPage); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteDepartmentById(String id) { - if(!ValidateUtil.validateString(id)) { - ExceptionCast.cast(CommonCode.INVALID_PARAM); - } - Department en = super.getById(id); - if (en == null) - ExceptionCast.cast(DepartmentCode.DEPART_NOT_EXIST); - List<Department> list = findSunLint(id); - if (list != null && list.size() > 0) { - ExceptionCast.cast(DepartmentCode.DEPART_SUN_EXIST); - } - List<DepartmentUser> departmentUserList = departmentUserService.findByDepartId(id); - if(departmentUserList != null && !departmentUserList.isEmpty()) - ExceptionCast.cast(DepartmentCode.DEPART_USER_EXIST); - List<PermissionStream> permissionStreamList = permissionStreamService.findByDepartId(id); - if(permissionStreamList != null && !permissionStreamList.isEmpty()) - ExceptionCast.cast(DepartmentCode.DEPART_PRODUCT_EXIST); - List<DevicePermissionStream> devicePermissionStreams = devicePermissionStreamService.findByDepartId(id); - if(devicePermissionStreams != null && !devicePermissionStreams.isEmpty()) - ExceptionCast.cast(DepartmentCode.DEPART_DEVICE_EXIST); - ActivitiDefinition activitiDefinition = activitiDefinitionService.getByDepartId(id); - if(activitiDefinition != null) - ExceptionCast.cast(DepartmentCode.DEPART_ACT_EXIST); - return super.removeById(id); - } - - @Override - public List<Department> findSunLint(String parentId) { - if(!ValidateUtil.validateString(parentId)) - return null; - List<Department> list = super.lambdaQuery().eq(Department::getParentId, parentId).list(); - if(list == null || list.isEmpty()) - return null; - return list; - } - - @Override - public List<CommonJsonTree> loadTree() { - List<DepartmentExt> multilevelExt = this.getBaseMapper().findExtAll(); - return DepartmentTreeWrapper.loadTree(multilevelExt); - } - - @Override - public Map<String, Department> getMapByUserId(String userId) { - if(!ValidateUtil.validateString(userId)) - return null; - List<Department> userPermDepart = getUserPermDepart(userId); - if(userPermDepart == null || userPermDepart.isEmpty()) - return null; - Map<String, Department> map = new HashMap<>(); - userPermDepart.forEach(item -> { - map.put(item.getDepartId(), item); - }); - return map; - } - - @Override - public List<SysUser> getUserNonApproveDepart(String departId) { - return super.getBaseMapper().getUserNonApproveDepart(departId); - } - - @Override - public List<SysUser> getUserApproveDepart(String departId) { - return super.getBaseMapper().getUserApproveDepart(departId); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean assignAddApproveUser(String departId, Integer relativeFlag, String[] userIds) { - if(!ValidateUtil.validateString(departId) ||! ValidateUtil.validateInteger(relativeFlag)) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - if(userIds == null || userIds.length < 1) - ExceptionCast.cast(DepartmentCode.DEPART_APPROVE_USER_ERROR); - Department en = super.getById(departId); - if(en == null) - ExceptionCast.cast(DepartmentCode.DEPART_NOT_EXIST); - List<String> userIdList = new ArrayList<>(userIds.length); - Collections.addAll(userIdList, userIds); - Collection<SysUser> userCollection = userService.listByIds(userIdList); - if(userCollection == null || userCollection.size() != userIds.length) - ExceptionCast.cast(DepartmentCode.DEPART_APPROVE_USER_ERROR); - List<DepartApproveUser> permissionList = new ArrayList<>(); - userCollection.forEach(item -> { - DepartApproveUser approveUser = departApproveUserService.getByDepartIdAndUserId(en.getDepartId(), item.getId()); - if(approveUser == null) { - approveUser = new DepartApproveUser(); - approveUser.setUserId(item.getId()); - approveUser.setDepartId(en.getDepartId()); - permissionList.add(approveUser); - } - }); - if(!permissionList.isEmpty()) { - return departApproveUserService.saveBatch(permissionList); - } - return false; - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean assignRemoveApproveUser(String departId, Integer relativeFlag, String[] userIds) { - if(!ValidateUtil.validateString(departId) ||! ValidateUtil.validateInteger(relativeFlag)) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - if(userIds == null || userIds.length < 1) - ExceptionCast.cast(DepartmentCode.DEPART_APPROVE_USER_ERROR); - Department en = super.getById(departId); - if(en == null) - ExceptionCast.cast(DepartmentCode.DEPART_NOT_EXIST); - List<String> userIdList = new ArrayList<>(userIds.length); - Collections.addAll(userIdList, userIds); - Collection<SysUser> userCollection = userService.listByIds(userIdList); - if(userCollection == null || userCollection.size() != userIds.length) - ExceptionCast.cast(DepartmentCode.DEPART_APPROVE_USER_ERROR); - List<DepartApproveUser> permissionList = new ArrayList<>(); - userCollection.forEach(item -> { - DepartApproveUser approveUser = departApproveUserService.getByDepartIdAndUserId(en.getDepartId(), item.getId()); - if(approveUser != null) { - permissionList.add(approveUser); - } - }); - if(!permissionList.isEmpty()) { - return departApproveUserService.removeByCollection(permissionList); - } - return false; - } - - /** - * 鏌ヨ鎵�鏈夐儴闂ㄤ俊鎭�,骞跺垎鑺傜偣杩涜鏄剧ず - * @return - */ - @Override - public List<DepartmentTreeModel> queryTreeList(){ - LambdaQueryWrapper<Department> query = new LambdaQueryWrapper<Department>(); - query.eq(Department::getDeleteFlag, CommonConstant.DEL_FLAG_0.toString()); - query.orderByAsc(Department::getPriority); - List<Department> list = this.list(query); - List<DepartmentTreeModel> listResult = FindsDepartmentChildrenUtil.wrapTreeDataToTreeList(list); - return listResult; - } - - - /** - * 鏌ヨ鎵�鏈夐儴闂ㄤ俊鎭�,骞跺垎鑺傜偣杩涜鏄剧ず - * @param ids 澶氫釜閮ㄩ棬id - * @return - */ - @Override - public List<DepartmentTreeModel> queryTreeList(String ids){ - List<DepartmentTreeModel> listResult=new ArrayList<>(); - LambdaQueryWrapper<Department> query = new LambdaQueryWrapper<Department>(); - query.eq(Department::getDeleteFlag, CommonConstant.DEL_FLAG_0.toString()); - if(oConvertUtils.isNotEmpty(ids)){ - query.in(true,Department::getDepartId,ids.split(",")); - } - query.orderByAsc(Department::getPriority); - List<Department> list= this.list(query); - for (Department department : list) { - listResult.add(new DepartmentTreeModel(department)); - } - return listResult; - } - - /** - * <p> - * 鏍规嵁鍏抽敭瀛楁悳绱㈢浉鍏崇殑閮ㄩ棬鏁版嵁 - * </p> - */ - @Override - public List<DepartmentTreeModel> searchByKeyWord(String keyWord,String myDeptSearch,String departIds) { - LambdaQueryWrapper<Department> query = new LambdaQueryWrapper<Department>(); - List<DepartmentTreeModel> newList = new ArrayList<>(); - query.like(Department::getDepartName, keyWord); - //update-begin--Author:huangzhilin Date:20140417 for锛歔bugfree鍙穄缁勭粐鏈烘瀯鎼滅储鍥炴樉浼樺寲-------------------- - DepartmentTreeModel model = new DepartmentTreeModel(); - List<Department> departList = this.list(query); - if(departList.size() > 0) { - for(Department depart : departList) { - model = new DepartmentTreeModel(depart); - model.setChildren(null); - //update-end--Author:huangzhilin Date:20140417 for锛歔bugfree鍙穄缁勭粐鏈烘瀯鎼滅储鍔熷洖鏄句紭鍖�---------------------- - newList.add(model); - } - return newList; - } - return null; - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java index e518cdb..077f156 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java @@ -39,8 +39,6 @@ @Autowired private IDeviceGroupDepartService deviceGroupDepartService; @Autowired - private IDepartmentService departmentService; - @Autowired @Lazy private IDeviceInfoService deviceInfoService; @Autowired @@ -375,83 +373,83 @@ return deviceGroupDepartService.getDepartNonPermsByGroupId(groupId); } - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean assignAddDepartment(String groupId, Integer relativeFlag, String[] departmentIds) { - if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateInteger(relativeFlag) || departmentIds == null || departmentIds.length < 1) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - List<String> ids = new ArrayList<>(departmentIds.length); - Collections.addAll(ids, departmentIds); - Collection<Department> departmentList = departmentService.listByIds(ids); - if(departmentList == null || departmentList.isEmpty() || departmentList.size() != departmentIds.length) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - DeviceGroup deviceGroup = super.getById(groupId); - if(deviceGroup == null) - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); - boolean b1 = deviceInfoService.checkDevicePerm(1, deviceGroup.getGroupId()); - if(!b1) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); - } - b1 = assignAddDepartment(deviceGroup, departmentList); - if(!b1) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); - } - if(relativeFlag == 1) { - //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁� - List<DeviceGroup> childrenList = getChildrenByParentId(deviceGroup.getGroupId()); - if(childrenList != null && !childrenList.isEmpty()) { - childrenList.forEach(item -> { - boolean b = deviceInfoService.checkDevicePerm(1, item.getGroupId()); - if(b) { - b = assignAddDepartment(item, departmentList); - if(!b) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); - } - } - }); - } - } - return true; - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean assignRemoveDepartment(String groupId, Integer relativeFlag, String[] departmentIds) { - if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateInteger(relativeFlag) || departmentIds == null || departmentIds.length < 1) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - List<String> ids = new ArrayList<>(departmentIds.length); - Collections.addAll(ids, departmentIds); - Collection<Department> departmentList = departmentService.listByIds(ids); - if(departmentList == null || departmentList.isEmpty() || departmentList.size() != departmentIds.length) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - DeviceGroup deviceGroup = super.getById(groupId); - if(deviceGroup == null) - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); - boolean b1 = deviceInfoService.checkDevicePerm(1, deviceGroup.getGroupId()); - if(!b1) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); - } - b1 = assignRemoveDepartment(deviceGroup, departmentList); - if(!b1) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); - } - if(relativeFlag == 1) { - //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁� - List<DeviceGroup> childrenList = getChildrenByParentId(deviceGroup.getGroupId()); - if(childrenList != null && !childrenList.isEmpty()) { - childrenList.forEach(item -> { - boolean b = deviceInfoService.checkDevicePerm(1, item.getGroupId()); - if(b) { - b = assignRemoveDepartment(item, departmentList); - if(!b) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); - } - } - }); - } - } - return true; - } +// @Override +// @Transactional(rollbackFor = {Exception.class}) +// public boolean assignAddDepartment(String groupId, Integer relativeFlag, String[] departmentIds) { +// if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateInteger(relativeFlag) || departmentIds == null || departmentIds.length < 1) +// ExceptionCast.cast(CommonCode.INVALID_PARAM); +// List<String> ids = new ArrayList<>(departmentIds.length); +// Collections.addAll(ids, departmentIds); +// Collection<Department> departmentList = departmentService.listByIds(ids); +// if(departmentList == null || departmentList.isEmpty() || departmentList.size() != departmentIds.length) +// ExceptionCast.cast(CommonCode.INVALID_PARAM); +// DeviceGroup deviceGroup = super.getById(groupId); +// if(deviceGroup == null) +// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); +// boolean b1 = deviceInfoService.checkDevicePerm(1, deviceGroup.getGroupId()); +// if(!b1) { +// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); +// } +// b1 = assignAddDepartment(deviceGroup, departmentList); +// if(!b1) { +// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); +// } +// if(relativeFlag == 1) { +// //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁� +// List<DeviceGroup> childrenList = getChildrenByParentId(deviceGroup.getGroupId()); +// if(childrenList != null && !childrenList.isEmpty()) { +// childrenList.forEach(item -> { +// boolean b = deviceInfoService.checkDevicePerm(1, item.getGroupId()); +// if(b) { +// b = assignAddDepartment(item, departmentList); +// if(!b) { +// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); +// } +// } +// }); +// } +// } +// return true; +// } +// +// @Override +// @Transactional(rollbackFor = {Exception.class}) +// public boolean assignRemoveDepartment(String groupId, Integer relativeFlag, String[] departmentIds) { +// if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateInteger(relativeFlag) || departmentIds == null || departmentIds.length < 1) +// ExceptionCast.cast(CommonCode.INVALID_PARAM); +// List<String> ids = new ArrayList<>(departmentIds.length); +// Collections.addAll(ids, departmentIds); +// Collection<Department> departmentList = departmentService.listByIds(ids); +// if(departmentList == null || departmentList.isEmpty() || departmentList.size() != departmentIds.length) +// ExceptionCast.cast(CommonCode.INVALID_PARAM); +// DeviceGroup deviceGroup = super.getById(groupId); +// if(deviceGroup == null) +// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); +// boolean b1 = deviceInfoService.checkDevicePerm(1, deviceGroup.getGroupId()); +// if(!b1) { +// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); +// } +// b1 = assignRemoveDepartment(deviceGroup, departmentList); +// if(!b1) { +// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); +// } +// if(relativeFlag == 1) { +// //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁� +// List<DeviceGroup> childrenList = getChildrenByParentId(deviceGroup.getGroupId()); +// if(childrenList != null && !childrenList.isEmpty()) { +// childrenList.forEach(item -> { +// boolean b = deviceInfoService.checkDevicePerm(1, item.getGroupId()); +// if(b) { +// b = assignRemoveDepartment(item, departmentList); +// if(!b) { +// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); +// } +// } +// }); +// } +// } +// return true; +// } @Override @Transactional(rollbackFor = {Exception.class}) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/UserPermButtonServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/UserPermButtonServiceImpl.java deleted file mode 100644 index 1298de4..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/UserPermButtonServiceImpl.java +++ /dev/null @@ -1,273 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import org.apache.shiro.SecurityUtils; -import org.jeecg.common.system.vo.LoginUser; -import org.jeecg.modules.dnc.service.*; -import org.jeecg.modules.dnc.ucenter.Department; -import org.jeecg.modules.dnc.utils.ValidateUtil; - -import org.jeecg.modules.dnc.entity.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -@Service -public class UserPermButtonServiceImpl implements IUserPermButtonService { - @Autowired - private IButtonService buttonService; - @Autowired - private IProductInfoService productInfoService; - @Autowired - private IComponentInfoService componentInfoService; - @Autowired - private IPartsInfoService partsInfoService; - @Autowired - private IDepartmentService departmentService; - @Autowired - private IPermissionStreamService permissionStreamService; - @Autowired - private IDeviceInfoService deviceInfoService; - @Autowired - private IDevicePermissionService devicePermissionService; - @Autowired - private IProcessStreamService processStreamService; - @Autowired - private IDeviceGroupService deviceGroupService; - @Autowired - private IDevicePermissionStreamService devicePermissionStreamService; - - /** - * 鍒ゅ畾浜у搧鏁拌妭鐐规潈闄� - * TODO 寰呭畬鍠� - * @param param - * @param objectId - * @param userId - * @return - */ - @Override - public Boolean checkObjectValid(String param, String objectId, String userId) { - if(!ValidateUtil.validateString(param) || !ValidateUtil.validateString(objectId)) - return null; - if("product".equals(param)) { - //鍙抽敭鏌愪釜浜у搧 - ProductInfo productInfo = productInfoService.getById(objectId); - if(productInfo == null) - return null; - //鏍¢獙鏄惁鏈夎浜у搧鐨勬潈闄� - boolean b = productInfoService.checkProductPerm(1, objectId); - if(!b) { - return null; - } - //鑾峰彇浜у搧鎵�鍦ㄩ儴闂� - List<PermissionStream> departPerms = permissionStreamService.getByProductId(productInfo.getProductId()); - if(departPerms == null || departPerms.isEmpty()) - return false; - //鑾峰彇鐢ㄦ埛鎵�鍦ㄩ儴闂� - Map<String, Department> departmentMap = departmentService.getMapByUserId(userId); - if(departmentMap == null || departmentMap.isEmpty()) - return null; - for(PermissionStream stream : departPerms) { - if(departmentMap.containsKey(stream.getDepartId())) { - return true; - } - } - }else if("component".equals(param)) { - //鍙抽敭鏌愪釜閮ㄤ欢 - ComponentInfo componentInfo = componentInfoService.getById(objectId); - if(componentInfo == null) - return null; - //鏍¢獙鏄惁鏈夎閮ㄤ欢鐨勬潈闄� - boolean b = productInfoService.checkProductPerm(2, objectId); - if(!b) { - return null; - } - //鑾峰彇閮ㄤ欢鎵�鍦ㄩ儴闂� - List<PermissionStream> departPerms = permissionStreamService.getByComponentId(componentInfo.getProductId(), componentInfo.getComponentId()); - if(departPerms == null || departPerms.isEmpty()) - return false; - //鑾峰彇鐢ㄦ埛鎵�鍦ㄩ儴闂� - Map<String, Department> departmentMap = departmentService.getMapByUserId(userId); - if(departmentMap == null || departmentMap.isEmpty()) - return null; - for(PermissionStream stream : departPerms) { - if(departmentMap.containsKey(stream.getDepartId())) { - return true; - } - } - }else if("parts".equals(param)) { - //鍙抽敭鏌愪釜闆朵欢 - PartsInfo partsInfo = partsInfoService.getById(objectId); - if(partsInfo == null) - return null; - //鏍¢獙鏄惁鏈夎闆朵欢鐨勬潈闄� - boolean b = productInfoService.checkProductPerm(3, objectId); - if(!b) { - return null; - } - //鑾峰彇閮ㄤ欢鎵�鍦ㄩ儴闂� - List<PermissionStream> departPerms = permissionStreamService.getByPartsId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId()); - if(departPerms == null || departPerms.isEmpty()) - return false; - //鑾峰彇鐢ㄦ埛鎵�鍦ㄩ儴闂� - Map<String, Department> departmentMap = departmentService.getMapByUserId(userId); - if(departmentMap == null || departmentMap.isEmpty()) - return null; - for(PermissionStream stream : departPerms) { - if(departmentMap.containsKey(stream.getDepartId())) { - return true; - } - } - }else if("device".equals(param)) { - //鍙抽敭璁惧 - DeviceInfo deviceInfo = deviceInfoService.getById(objectId); - if(deviceInfo == null) - return null; - //鏍¢獙鏄惁鏈夎闆朵欢鐨勬潈闄� - boolean b = deviceInfoService.checkDevicePerm(2, objectId); - if(!b) { - return null; - } - if(!ValidateUtil.validateString(deviceInfo.getDepartId())) - return false; - //鑾峰彇鐢ㄦ埛鎵�鍦ㄩ儴闂� - Map<String, Department> departmentMap = departmentService.getMapByUserId(userId); - if(departmentMap == null || departmentMap.isEmpty()) - return null; - if(departmentMap.containsKey(deviceInfo.getDepartId())) { - return true; - } - } else if("device_group".equals(param)) { - //鍙抽敭璁惧 - DeviceGroup deviceGroup = deviceGroupService.getById(objectId); - if(deviceGroup == null) - return null; - //鏍¢獙鏄惁鏈夎鍒嗙粍鐨勬潈闄� - boolean b = deviceInfoService.checkDevicePerm(1, objectId); - if(!b) { - return null; - } - //鑾峰彇閮ㄤ欢鎵�鍦ㄩ儴闂� - List<DevicePermissionStream> permissionStreams = devicePermissionStreamService.getDepartPermByGroupId(deviceGroup.getGroupId()); - if(permissionStreams == null || permissionStreams.isEmpty()) - return false; - //鑾峰彇鐢ㄦ埛鎵�鍦ㄩ儴闂� - Map<String, Department> departmentMap = departmentService.getMapByUserId(userId); - if(departmentMap == null || departmentMap.isEmpty()) - return null; - for(DevicePermissionStream stream : permissionStreams) { - if(departmentMap.containsKey(stream.getDepartId())) { - return true; - } - } - } - return null; - } - - /** - * 鑾峰彇浜у搧鏁拌妭鐐规潈闄� - * TODO 寰呭畬鍠� - * @param param - * @param flag - * @param objectId - * @param relativeParam - * @param relativeObjectId - * @return - */ - @Override - public List<String> getCurrentUserButtonPerms(String param, Integer flag, String objectId, String relativeParam, String relativeObjectId) { - if(!ValidateUtil.validateString(param)) - return null; - if(!ValidateUtil.validateInteger(flag)) - return null; - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userId = user.getId(); - if(!ValidateUtil.validateString(userId)) - return null; - List<String> permsList = new ArrayList<>(); - List<String> objectPermsList = new ArrayList<>(); - List<Button> buttonPerms = buttonService.getButtonPerms(userId); - if(buttonPerms != null && !buttonPerms.isEmpty()) { - buttonPerms.forEach(item -> { - permsList.add(item.getButtonPerm()); - objectPermsList.add(item.getButtonPerm()); - }); - } - if(flag == 1) { - List<Button> list = buttonService.getMenuButtonPerms(userId, param); - if(list == null || list.isEmpty()) - return permsList; - for(Button button : list) { - if(ValidateUtil.validateString(button.getPermCode())) { - permsList.add(button.getPermCode()); - } - } - }else if(flag == 2) { - List<Button> list = buttonService.getObjectButtonPerms(userId, param); - if(list == null || list.isEmpty()) - return permsList; - for(Button button : list) { - if(ValidateUtil.validateString(button.getPermCode())) { - objectPermsList.add(button.getPermCode()); - } - } - if("product".equals(param)) { - if(ValidateUtil.validateString(objectId)) { - Boolean checkValue = checkObjectValid(param, objectId, userId); - return getCurrentPerms(checkValue, permsList, objectPermsList); - }else { - //鍙抽敭浜у搧缁撴瀯鏍戠┖鐧藉尯 - return objectPermsList; - } - } else if("component".equals(param) || "parts".equals(param)) { - if(ValidateUtil.validateString(objectId)) { - Boolean checkValue = checkObjectValid(param, objectId, userId); - return getCurrentPerms(checkValue, permsList, objectPermsList); - }else { - //鍙抽敭浜у搧缁撴瀯鏍戠┖鐧藉尯 - return null; - } - }else if("process".equals(param) || "document".equals(param) || "file".equals(param)) { - if(!ValidateUtil.validateString(relativeParam) || !ValidateUtil.validateString(relativeObjectId)) { - return null; - } - Boolean checkValue = checkObjectValid(relativeParam, relativeObjectId, userId); - return getCurrentPerms(checkValue, permsList, objectPermsList); - }else if("device".equals(param)) { - if(ValidateUtil.validateString(objectId)) { - Boolean checkValue = checkObjectValid(param, objectId, userId); - return getCurrentPerms(checkValue, permsList, objectPermsList); - }else { - //鍙抽敭璁惧绌虹櫧鍖� - return null; - } - }else if("device_group".equals(param)) { - if(ValidateUtil.validateString(objectId)) { - //鍙抽敭璁惧鍒嗙粍 - Boolean checkValue = checkObjectValid(param, objectId, userId); - return getCurrentPerms(checkValue, permsList, objectPermsList); - }else { - //鍙抽敭璁惧鏍戠┖鐧藉尯 - return objectPermsList; - } - }else { - return null; - } - }else { - return null; - } - return permsList; - } - - private List<String> getCurrentPerms(Boolean b , List<String> permsList, List<String> objectPermsList) { - if(b == null) - return null; - if(b) { - return objectPermsList; - }else { - return permsList; - } - } -} diff --git a/lxzn-module-flowable/pom.xml b/lxzn-module-flowable/pom.xml new file mode 100644 index 0000000..51615bc --- /dev/null +++ b/lxzn-module-flowable/pom.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>lxzn-boot-parent</artifactId> + <groupId>org.jeecgframework.boot</groupId> + <version>3.4.3</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>lxzn-module-flowable</artifactId> + + <dependencies> + <!--淇濇寔鐙珛锛屽彧寮曞叆jeecg鍩虹妯″潡 --> + <dependency> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>lxzn-boot-base-core</artifactId> + </dependency> + <!--=======================================flow妯″潡鐙珛===================================--> + <dependency> + <groupId>org.flowable</groupId> + <artifactId>flowable-engine</artifactId> + <scope>compile</scope> + <version>6.4.0</version> + <exclusions> + <exclusion> + <groupId>org.mybatis</groupId> + <artifactId>mybatis</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.flowable</groupId> + <artifactId>flowable-spring-boot-starter-basic</artifactId> + <version>6.4.0</version> + </dependency> + <!--琛ㄨ揪寮忚В鏋愬伐鍏�--> + <dependency> + <groupId>org.eweb4j</groupId> + <artifactId>fel</artifactId> + <version>0.8</version> + </dependency> + <!--xml瑙f瀽鍖咃細濡傛灉椤圭洰涓凡鏈夛紝寮曡捣鍐茬獊锛屽彲娉ㄩ噴--> + <dependency> + <groupId>xerces</groupId> + <artifactId>xercesImpl</artifactId> + <version>2.12.0</version> + </dependency> + </dependencies> + +</project> diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/JeecgFlowableCloudApplication.java b/lxzn-module-flowable/src/main/java/org/jeecg/JeecgFlowableCloudApplication.java new file mode 100644 index 0000000..2dc8f42 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/JeecgFlowableCloudApplication.java @@ -0,0 +1,14 @@ +package org.jeecg;//package org.jeecg; +// +//import org.springframework.boot.SpringApplication; +//import org.springframework.boot.autoconfigure.SpringBootApplication; +//import org.springframework.cloud.openfeign.EnableFeignClients; +// +//@SpringBootApplication +//@EnableFeignClients +//public class JeecgFlowableCloudApplication { +// +// public static void main(String[] args) { +// SpringApplication.run(JeecgDemoCloudApplication.class, args); +// } +//} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusiness.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusiness.java new file mode 100644 index 0000000..1e8bb74 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusiness.java @@ -0,0 +1,113 @@ +package org.jeecg.modules.flowable.apithird.business.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; +import java.util.Map; + +/** + * @Description: 娴佺▼涓氬姟鎵╁睍琛� + * @Author: jeecg-boot + * @Date: 2021-11-25 + * @Version: V1.0 + */ +@Data +@TableName("flow_my_business") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="flow_my_business瀵硅薄", description="娴佺▼涓氬姟鎵╁睍琛�") +public class FlowMyBusiness implements Serializable { + private static final long serialVersionUID = 1L; + + /**涓婚敭ID*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "涓婚敭ID") + private String id; + /**鍒涘缓浜�*/ + @ApiModelProperty(value = "鍒涘缓浜�") + private String createBy; + /**鍒涘缓鏃堕棿*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "鍒涘缓鏃堕棿") + private Date createTime; + /**淇敼浜�*/ + @ApiModelProperty(value = "淇敼浜�") + private String updateBy; + /**淇敼鏃堕棿*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "淇敼鏃堕棿") + private Date updateTime; + /**娴佺▼瀹氫箟key 涓�涓猭ey浼氭湁澶氫釜鐗堟湰鐨刬d*/ + @Excel(name = "娴佺▼瀹氫箟key 涓�涓猭ey浼氭湁澶氫釜鐗堟湰鐨刬d", width = 15) + @ApiModelProperty(value = "娴佺▼瀹氫箟key 涓�涓猭ey浼氭湁澶氫釜鐗堟湰鐨刬d") + private String processDefinitionKey; + /**娴佺▼瀹氫箟id 涓�涓祦绋嬪畾涔夊敮涓�*/ + @Excel(name = "娴佺▼瀹氫箟id 涓�涓祦绋嬪畾涔夊敮涓�", width = 15) + @ApiModelProperty(value = "娴佺▼瀹氫箟id 涓�涓祦绋嬪畾涔夊敮涓�") + private String processDefinitionId; + /**娴佺▼涓氬姟瀹炰緥id 涓�涓祦绋嬩笟鍔″敮涓�锛屾湰琛ㄤ腑涔熷敮涓�*/ + @Excel(name = "娴佺▼涓氬姟瀹炰緥id 涓�涓祦绋嬩笟鍔″敮涓�锛屾湰琛ㄤ腑涔熷敮涓�", width = 15) + @ApiModelProperty(value = "娴佺▼涓氬姟瀹炰緥id 涓�涓祦绋嬩笟鍔″敮涓�锛屾湰琛ㄤ腑涔熷敮涓�") + private String processInstanceId; + /**娴佺▼涓氬姟绠�瑕佹弿杩�*/ + @Excel(name = "娴佺▼涓氬姟绠�瑕佹弿杩�", width = 15) + @ApiModelProperty(value = "娴佺▼涓氬姟绠�瑕佹弿杩�") + private String title; + /**涓氬姟琛╥d锛岀悊璁哄敮涓�*/ + @Excel(name = "涓氬姟琛╥d锛岀悊璁哄敮涓�", width = 15) + @ApiModelProperty(value = "涓氬姟琛╥d锛岀悊璁哄敮涓�") + private String dataId; + /**涓氬姟绫诲悕锛岀敤鏉ヨ幏鍙杝pring瀹瑰櫒閲岀殑鏈嶅姟瀵硅薄*/ + @Excel(name = "涓氬姟绫诲悕锛岀敤鏉ヨ幏鍙杝pring瀹瑰櫒閲岀殑鏈嶅姟瀵硅薄", width = 15) + @ApiModelProperty(value = "涓氬姟绫诲悕锛岀敤鏉ヨ幏鍙杝pring瀹瑰櫒閲岀殑鏈嶅姟瀵硅薄") + private String serviceImplName; + /**鐢宠浜�*/ + @Excel(name = "鐢宠浜�", width = 15) + @ApiModelProperty(value = "鐢宠浜�") + private String proposer; + /**娴佺▼鐘舵�佽鏄庯紝鏈夛細鍚姩 鎾ゅ洖 椹冲洖 瀹℃壒涓� 瀹℃壒閫氳繃 瀹℃壒寮傚父*/ + @Excel(name = "娴佺▼鐘舵�佽鏄庯紝鏈夛細鍚姩 鎾ゅ洖 椹冲洖 瀹℃壒涓� 瀹℃壒閫氳繃 瀹℃壒寮傚父", width = 15) + @ApiModelProperty(value = "娴佺▼鐘舵�佽鏄庯紝鏈夛細鍚姩 鎾ゅ洖 椹冲洖 瀹℃壒涓� 瀹℃壒閫氳繃 瀹℃壒寮傚父") + private String actStatus; + /**褰撳墠鐨勮妭鐐瑰疄渚嬩笂鐨処d*/ + @Excel(name = "褰撳墠鐨勮妭鐐笽d", width = 15) + @ApiModelProperty(value = "褰撳墠鐨勮妭鐐笽d") + private String taskId; + /**褰撳墠鐨勮妭鐐�*/ + @Excel(name = "褰撳墠鐨勮妭鐐�", width = 15) + @ApiModelProperty(value = "褰撳墠鐨勮妭鐐�") + private String taskName; + /**褰撳墠鐨勮妭鐐瑰畾涔変笂鐨処d*/ + @Excel(name = "褰撳墠鐨勮妭鐐�", width = 15) + @ApiModelProperty(value = "褰撳墠鐨勮妭鐐�") + private String taskNameId; + /**褰撳墠鐨勮妭鐐瑰彲浠ュ鐞嗙殑鐢ㄦ埛鍚嶏紝涓簎sername鐨勯泦鍚坖son瀛楃涓�*/ + @Excel(name = "褰撳墠鐨勮妭鐐瑰彲浠ュ鐞嗙殑鐢ㄦ埛鍚�", width = 15) + @ApiModelProperty(value = "褰撳墠鐨勮妭鐐瑰彲浠ュ鐞嗙殑鐢ㄦ埛鍚�") + private String todoUsers; + /**澶勭悊杩囩殑浜�,涓簎sername鐨勯泦鍚坖son瀛楃涓�*/ + @Excel(name = "澶勭悊杩囩殑浜�", width = 15) + @ApiModelProperty(value = "澶勭悊杩囩殑浜�") + private String doneUsers; + /**褰撳墠浠诲姟鑺傜偣鐨勪紭鍏堢骇 娴佺▼瀹氫箟鐨勬椂鍊欐墍濉�*/ + @Excel(name = "褰撳墠浠诲姟鑺傜偣鐨勪紭鍏堢骇 娴佺▼瀹氫箟鐨勬椂鍊欐墍濉�", width = 15) + @ApiModelProperty(value = "褰撳墠浠诲姟鑺傜偣鐨勪紭鍏堢骇 娴佺▼瀹氫箟鐨勬椂鍊欐墍濉�") + private String priority; + /**娴佺▼鍙橀噺*/ + @TableField(exist = false) + private Map<String,Object> values; +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusinessDto.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusinessDto.java new file mode 100644 index 0000000..f0b48c5 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusinessDto.java @@ -0,0 +1,100 @@ +package org.jeecg.modules.flowable.apithird.business.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.io.Serializable; +import java.util.Map; + +/** + * @Description: 娴佺▼涓氬姟鎵╁睍琛� + * @Author: jeecg-boot + * @Date: 2021-11-25 + * @Version: V1.0 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="flow_my_business瀵硅薄", description="娴佺▼涓氬姟鎵╁睍琛�") +public class FlowMyBusinessDto implements Serializable { + private static final long serialVersionUID = 1L; + + /**娴佺▼瀹氫箟key 涓�涓猭ey浼氭湁澶氫釜鐗堟湰鐨刬d*/ + @TableField(exist = false) + @Excel(name = "娴佺▼瀹氫箟key 涓�涓猭ey浼氭湁澶氫釜鐗堟湰鐨刬d", width = 15) + @ApiModelProperty(value = "娴佺▼瀹氫箟key 涓�涓猭ey浼氭湁澶氫釜鐗堟湰鐨刬d") + private String processDefinitionKey; + /**娴佺▼瀹氫箟id 涓�涓祦绋嬪畾涔夊敮涓�*/ + @TableField(exist = false) + @Excel(name = "娴佺▼瀹氫箟id 涓�涓祦绋嬪畾涔夊敮涓�", width = 15) + @ApiModelProperty(value = "娴佺▼瀹氫箟id 涓�涓祦绋嬪畾涔夊敮涓�") + private String processDefinitionId; + /**娴佺▼涓氬姟瀹炰緥id 涓�涓祦绋嬩笟鍔″敮涓�锛屾湰琛ㄤ腑涔熷敮涓�*/ + @TableField(exist = false) + @Excel(name = "娴佺▼涓氬姟瀹炰緥id 涓�涓祦绋嬩笟鍔″敮涓�锛屾湰琛ㄤ腑涔熷敮涓�", width = 15) + @ApiModelProperty(value = "娴佺▼涓氬姟瀹炰緥id 涓�涓祦绋嬩笟鍔″敮涓�锛屾湰琛ㄤ腑涔熷敮涓�") + private String processInstanceId; + /**娴佺▼涓氬姟绠�瑕佹弿杩�*/ + @TableField(exist = false) + @Excel(name = "娴佺▼涓氬姟绠�瑕佹弿杩�", width = 15) + @ApiModelProperty(value = "娴佺▼涓氬姟绠�瑕佹弿杩�") + private String title; + /**涓氬姟琛╥d锛岀悊璁哄敮涓�*/ + @TableField(exist = false) + @Excel(name = "涓氬姟琛╥d锛岀悊璁哄敮涓�", width = 15) + @ApiModelProperty(value = "涓氬姟琛╥d锛岀悊璁哄敮涓�") + private String dataId; + /**涓氬姟绫诲悕锛岀敤鏉ヨ幏鍙杝pring瀹瑰櫒閲岀殑鏈嶅姟瀵硅薄*/ + @TableField(exist = false) + @Excel(name = "涓氬姟绫诲悕锛岀敤鏉ヨ幏鍙杝pring瀹瑰櫒閲岀殑鏈嶅姟瀵硅薄", width = 15) + @ApiModelProperty(value = "涓氬姟绫诲悕锛岀敤鏉ヨ幏鍙杝pring瀹瑰櫒閲岀殑鏈嶅姟瀵硅薄") + private String serviceImplName; + /**鐢宠浜�*/ + @TableField(exist = false) + @Excel(name = "鐢宠浜�", width = 15) + @ApiModelProperty(value = "鐢宠浜�") + private String proposer; + /**娴佺▼鐘舵�佽鏄庯紝鏈夛細鍚姩 鎾ゅ洖 椹冲洖 瀹℃壒涓� 瀹℃壒閫氳繃 瀹℃壒寮傚父*/ + @TableField(exist = false) + @Excel(name = "娴佺▼鐘舵�佽鏄庯紝鏈夛細鍚姩 鎾ゅ洖 椹冲洖 瀹℃壒涓� 瀹℃壒閫氳繃 瀹℃壒寮傚父", width = 15) + @ApiModelProperty(value = "娴佺▼鐘舵�佽鏄庯紝鏈夛細鍚姩 鎾ゅ洖 椹冲洖 瀹℃壒涓� 瀹℃壒閫氳繃 瀹℃壒寮傚父") + private String actStatus; + /**褰撳墠鐨勮妭鐐瑰疄渚嬩笂鐨処d*/ + @TableField(exist = false) + @Excel(name = "褰撳墠鐨勮妭鐐笽d", width = 15) + @ApiModelProperty(value = "褰撳墠鐨勮妭鐐笽d") + private String taskId; + /**褰撳墠鐨勮妭鐐�*/ + @TableField(exist = false) + @Excel(name = "褰撳墠鐨勮妭鐐�", width = 15) + @ApiModelProperty(value = "褰撳墠鐨勮妭鐐�") + private String taskName; + /**褰撳墠鐨勮妭鐐瑰畾涔変笂鐨処d*/ + @TableField(exist = false) + @Excel(name = "褰撳墠鐨勮妭鐐�", width = 15) + @ApiModelProperty(value = "褰撳墠鐨勮妭鐐�") + private String taskNameId; + /**褰撳墠鐨勮妭鐐瑰彲浠ュ鐞嗙殑鐢ㄦ埛鍚嶏紝涓簎sername鐨勯泦鍚坖son瀛楃涓�*/ + @TableField(exist = false) + @Excel(name = "褰撳墠鐨勮妭鐐瑰彲浠ュ鐞嗙殑鐢ㄦ埛鍚�", width = 15) + @ApiModelProperty(value = "褰撳墠鐨勮妭鐐瑰彲浠ュ鐞嗙殑鐢ㄦ埛鍚�") + private String todoUsers; + /**澶勭悊杩囩殑浜�,涓簎sername鐨勯泦鍚坖son瀛楃涓�*/ + @TableField(exist = false) + @Excel(name = "澶勭悊杩囩殑浜�", width = 15) + @ApiModelProperty(value = "澶勭悊杩囩殑浜�") + private String doneUsers; + /**褰撳墠浠诲姟鑺傜偣鐨勪紭鍏堢骇 娴佺▼瀹氫箟鐨勬椂鍊欐墍濉�*/ + @TableField(exist = false) + @Excel(name = "褰撳墠浠诲姟鑺傜偣鐨勪紭鍏堢骇 娴佺▼瀹氫箟鐨勬椂鍊欐墍濉�", width = 15) + @ApiModelProperty(value = "褰撳墠浠诲姟鑺傜偣鐨勪紭鍏堢骇 娴佺▼瀹氫箟鐨勬椂鍊欐墍濉�") + private String priority; + /**娴佺▼鍙橀噺*/ + @TableField(exist = false) + private Map<String,Object> values; +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/FlowMyBusinessMapper.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/FlowMyBusinessMapper.java new file mode 100644 index 0000000..8aa4b88 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/FlowMyBusinessMapper.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.flowable.apithird.business.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; + +/** + * @Description: 娴佺▼涓氬姟鎵╁睍琛� + * @Author: jeecg-boot + * @Date: 2021-11-25 + * @Version: V1.0 + */ +public interface FlowMyBusinessMapper extends BaseMapper<FlowMyBusiness> { + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml new file mode 100644 index 0000000..78b00c1 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.jeecg.modules.flowable.apithird.business.mapper.FlowMyBusinessMapper"> + +</mapper> diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.java new file mode 100644 index 0000000..298fdcc --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.flowable.apithird.business.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; + +/** + * @Description: 娴佺▼涓氬姟鎵╁睍琛� + * @Author: jeecg-boot + * @Date: 2021-11-25 + * @Version: V1.0 + */ +public interface IFlowMyBusinessService extends IService<FlowMyBusiness> { + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java new file mode 100644 index 0000000..54b3646 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.flowable.apithird.business.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; +import org.jeecg.modules.flowable.apithird.business.mapper.FlowMyBusinessMapper; +import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; +import org.springframework.stereotype.Service; + +/** + * @Description: 娴佺▼涓氬姟鎵╁睍琛� + * @Author: jeecg-boot + * @Date: 2021-11-25 + * @Version: V1.0 + */ +@Service +public class FlowMyBusinessServiceImpl extends ServiceImpl<FlowMyBusinessMapper, FlowMyBusiness> implements IFlowMyBusinessService { + + public FlowMyBusiness getByDataId(String dataId) { + LambdaQueryWrapper<FlowMyBusiness> flowMyBusinessLambdaQueryWrapper = new LambdaQueryWrapper<>(); + flowMyBusinessLambdaQueryWrapper.eq(FlowMyBusiness::getDataId,dataId) + ; + //濡傛灉淇濆瓨鏁版嵁鍓嶆湭璋冪敤蹇呰皟鐨凢lowCommonService.initActBusiness鏂规硶锛屽氨浼氭湁闂 + FlowMyBusiness business = this.getOne(flowMyBusinessLambdaQueryWrapper); + return business; + } +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/common/constant/ProcessConstants.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/common/constant/ProcessConstants.java new file mode 100644 index 0000000..0e08f99 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/common/constant/ProcessConstants.java @@ -0,0 +1,77 @@ +package org.jeecg.modules.flowable.apithird.common.constant; + +/** + * 娴佺▼甯搁噺淇℃伅 + * + */ +public class ProcessConstants { + + /** + * 绾﹀畾鐨勫紑濮嬭妭鐐规爣璁板悕 + */ + public static final String START_NODE = "start"; + /** + * 鍔ㄦ�佹暟鎹� + */ + public static final String DATA_TYPE = "dynamic"; + + /** + * 鍗曚釜瀹℃壒浜� + */ + public static final String USER_TYPE_ASSIGNEE = "assignee"; + + + /** + * 鍊欓�変汉 + */ + public static final String USER_TYPE_USERS = "candidateUsers"; + + + /** + * 瀹℃壒缁� + */ + public static final String USER_TYPE_ROUPS = "candidateGroups"; + + /** + * 鍗曚釜瀹℃壒浜� + */ + public static final String PROCESS_APPROVAL = "approval"; + + /** + * 浼氱浜哄憳 + */ + public static final String PROCESS_MULTI_INSTANCE_USER = "userList"; + + /** + * nameapace + */ + public static final String NAMASPASE = "http://flowable.org/bpmn"; + + /** + * 浼氱鑺傜偣 + */ + public static final String PROCESS_MULTI_INSTANCE = "multiInstance"; + + /** + * 鑷畾涔夊睘鎬� dataType + */ + public static final String PROCESS_CUSTOM_DATA_TYPE = "dataType"; + + /** + * 鑷畾涔夊睘鎬� userType + */ + public static final String PROCESS_CUSTOM_USER_TYPE = "userType"; + + /** + * 鍒濆鍖栦汉鍛� + */ + public static final String PROCESS_INITIATOR = "INITIATOR"; + + + /** + * 娴佺▼璺宠繃 + */ + public static final String FLOWABLE_SKIP_EXPRESSION_ENABLED = "_FLOWABLE_SKIP_EXPRESSION_ENABLED"; + + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/common/enums/FlowComment.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/common/enums/FlowComment.java new file mode 100644 index 0000000..4c25bec --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/common/enums/FlowComment.java @@ -0,0 +1,41 @@ +package org.jeecg.modules.flowable.apithird.common.enums; + +/** + * 娴佺▼鎰忚绫诲瀷 + * + */ +public enum FlowComment { + + /** + * 璇存槑 + */ + NORMAL("1", "姝e父鎰忚"), + REBACK("2", "閫�鍥炴剰瑙�"), + REJECT("3", "椹冲洖鎰忚"), + DELEGATE("4", "濮旀淳鎰忚"), + ASSIGN("5", "杞姙鎰忚"), + STOP("6", "缁堟娴佺▼"); + + /** + * 绫诲瀷 + */ + private final String type; + + /** + * 璇存槑 + */ + private final String remark; + + FlowComment(String type, String remark) { + this.type = type; + this.remark = remark; + } + + public String getType() { + return type; + } + + public String getRemark() { + return remark; + } +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/common/exception/CustomException.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/common/exception/CustomException.java new file mode 100644 index 0000000..7235434 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/common/exception/CustomException.java @@ -0,0 +1,42 @@ +package org.jeecg.modules.flowable.apithird.common.exception; + +/** + * 鑷畾涔夊紓甯� + * + */ +public class CustomException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + private Integer code; + + private String message; + + public CustomException(String message) + { + this.message = message; + } + + public CustomException(String message, Integer code) + { + this.message = message; + this.code = code; + } + + public CustomException(String message, Throwable e) + { + super(message, e); + this.message = message; + } + + @Override + public String getMessage() + { + return message; + } + + public Integer getCode() + { + return code; + } +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/ActStatus.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/ActStatus.java new file mode 100644 index 0000000..51f7426 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/ActStatus.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.flowable.apithird.entity; + +/** + * @author PanMeiCheng + * @version 1.0 + * @date 2021/11/26 + */ +public interface ActStatus { + //鍚姩 鎾ゅ洖 椹冲洖 瀹℃壒涓� 瀹℃壒閫氳繃 瀹℃壒寮傚父 + //鏈祦绋嬩笉搴旀湁鍚姩鐘舵�侊紝鍚姩鍗宠繘鍏ュ鎵癸紝绗竴涓妭鐐瑰氨鏄彂璧蜂汉鑺傜偣锛屾湭鏂逛究涓氬姟鍖哄垎锛岃瀹氫负鈥滃惎鍔ㄢ�濈姸鎬� + String start = "鍚姩"; + String recall = "鎾ゅ洖"; + String reject = "椹冲洖"; + String doing = "瀹℃壒涓�"; + String pass = "瀹℃壒閫氳繃"; + String err = "瀹℃壒寮傚父"; +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/FlowBeforeParams.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/FlowBeforeParams.java new file mode 100644 index 0000000..981e64e --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/FlowBeforeParams.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.flowable.apithird.entity; + +import lombok.Data; + +import java.util.List; +import java.util.Map; + +/** + *娴佺▼杩愯涔嬪墠浠庝笟鍔″眰鑾峰彇鐨勭浉鍏冲弬鏁� + *@author PanMeiCheng + *@date 2021/12/3 + *@version 1.0 + */ +@Data +public class FlowBeforeParams { + /**鎸囧畾涓嬩釜鑺傜偣鐨勫�欓�変汉锛岀敤鎴峰悕username*/ + List<String> candidateUsernames; + /**娴佺▼鍙橀噺*/ + Map<String,Object> values; +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/SysCategory.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/SysCategory.java new file mode 100644 index 0000000..6a5eebb --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/SysCategory.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.flowable.apithird.entity; + +import lombok.Data; + +/** + *娴佺▼鍒嗙被 + *@author PanMeiCheng + *@date 2021/11/25 + *@version 1.0 + */ +@Data +public class SysCategory { + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 鍒嗙被鍚嶇О + */ + private String name; +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/SysRole.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/SysRole.java new file mode 100644 index 0000000..175b017 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/SysRole.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.flowable.apithird.entity; + +import lombok.Data; + +/** + * 瑙掕壊 + * @author pmc + */ +@Data +public class SysRole { + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 瑙掕壊鍚嶇О + */ + private String roleName; + + /** + * 瑙掕壊缂栫爜 + */ + private String roleCode; +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/SysUser.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/SysUser.java new file mode 100644 index 0000000..51700ea --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/entity/SysUser.java @@ -0,0 +1,138 @@ +package org.jeecg.modules.flowable.apithird.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * 鐢ㄦ埛瀵硅薄 <br/> + * //todo 鏆傛椂鏀寔鐢ㄤ簬jeecg锛屽闇�杩佺Щ鍏朵粬妗嗘灦锛岄渶瑕佹敼鍔� + * @author pmc + */ +@Data +public class SysUser { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 鐧诲綍璐﹀彿 + */ + private String username; + + /** + * 鐪熷疄濮撳悕 + */ + private String realname; + + /** + * 瀵嗙爜 + */ + private String password; + + /** + * md5瀵嗙爜鐩� + */ + private String salt; + + /** + * 澶村儚 + */ + private String avatar; + + /** + * 鐢熸棩 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date birthday; + + /** + * 鎬у埆锛�1锛氱敺 2锛氬コ锛� + */ + private Integer sex; + + /** + * 鐢靛瓙閭欢 + */ + private String email; + + /** + * 鐢佃瘽 + */ + private String phone; + + /** + * 閮ㄩ棬code(褰撳墠閫夋嫨鐧诲綍閮ㄩ棬) + */ + private String orgCode; + + /**閮ㄩ棬鍚嶇О*/ + private transient String orgCodeTxt; + + /** + * 鐘舵��(1锛氭甯� 2锛氬喕缁� 锛� + */ + private Integer status; + + /** + * 鍒犻櫎鐘舵�侊紙0锛屾甯革紝1宸插垹闄わ級 + */ + private Integer delFlag; + + /** + * 宸ュ彿锛屽敮涓�閿� + */ + private String workNo; + + /** + * 鑱屽姟锛屽叧鑱旇亴鍔¤〃 + */ + private String post; + + /** + * 搴ф満鍙� + */ + private String telephone; + + /** + * 鍒涘缓浜� + */ + private String createBy; + + /** + * 鍒涘缓鏃堕棿 + */ + private Date createTime; + + /** + * 鏇存柊浜� + */ + private String updateBy; + + /** + * 鏇存柊鏃堕棿 + */ + private Date updateTime; + /** + * 鍚屾宸ヤ綔娴佸紩鎿�1鍚屾0涓嶅悓姝� + */ + private Integer activitiSync; + + /** + * 韬唤锛�0 鏅�氭垚鍛� 1 涓婄骇锛� + */ + private Integer userIdentity; + + /** + * 璐熻矗閮ㄩ棬 + */ + private String departIds; + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/service/FlowCallBackServiceI.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/service/FlowCallBackServiceI.java new file mode 100644 index 0000000..7099968 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/service/FlowCallBackServiceI.java @@ -0,0 +1,46 @@ +package org.jeecg.modules.flowable.apithird.service; + +import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; + +import java.util.List; +import java.util.Map; + +/** + * 涓氬姟灞傚疄鐜版帴鍙f柟娉曪紝鐢ㄤ簬娴佺▼澶勭悊鍚庣殑鍥炶皟 + * @author PanMeiCheng + * @version 1.0 + * @date 2021/11/26 + */ +public interface FlowCallBackServiceI { + /** + * 娴佺▼澶勭悊瀹屾垚鍚庣殑鍥炶皟 + * @param business 閲岄潰鍖呭惈娴佺▼杩愯鐨勭幇鐘朵俊鎭紝涓氬姟灞傚彲鏍规嵁鍏朵俊鎭垽鏂紝涔﹀啓澧炲己涓氬姟閫昏緫鐨勪唬鐮侊紝<br/> + * 1銆佹瘮濡傚皢鍏朵腑鍏抽敭淇℃伅瀛樺叆涓氬姟琛紝鍗冲彲鍗曡〃涓氬姟鎿嶄綔,鍚﹀垯闇�瑕佸叧鑱攆low_my_business琛ㄨ幏鍙栨祦绋嬩俊鎭�<br/> + * 2銆佹瘮濡傚湪娴佺▼杩涜鍒版煇涓妭鐐规椂(business.taskId)锛岄渶瑕佺壒鍒繘琛屾煇浜涗笟鍔¢�昏緫鎿嶄綔绛夌瓑<br/> + */ + void afterFlowHandle(FlowMyBusiness business); + + + /** + * 鏍规嵁涓氬姟id杩斿洖涓氬姟琛ㄥ崟鏁版嵁<br/> + * @param dataId + * @return + */ + Object getBusinessDataById(String dataId); + + /** + * 杩斿洖褰撳墠鑺傜偣鐨勬祦绋嬪彉閲� + * @param taskNameId 鑺傜偣瀹氫箟id + * @param values 鍓嶇浼犲叆鐨勫彉閲忥紝閲岄潰鍖呭惈dataId + * @return + */ + Map<String, Object> flowValuesOfTask(String taskNameId, Map<String, Object> values); + + /** + * 杩斿洖褰撳墠鑺傜偣鐨勫�欓�変汉username + * @param taskNameId 鑺傜偣瀹氫箟id + * @param values 鍓嶇浼犲叆鐨勫彉閲忥紝閲岄潰鍖呭惈dataId + * @return + */ + List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values); +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/service/FlowCommonService.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/service/FlowCommonService.java new file mode 100644 index 0000000..3669e75 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/service/FlowCommonService.java @@ -0,0 +1,86 @@ +package org.jeecg.modules.flowable.apithird.service; + +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; +import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl; +import org.jeecg.modules.flowable.apithird.common.exception.CustomException; +import org.jeecg.modules.flowable.service.impl.FlowInstanceServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + *涓氬姟妯″潡璋冪敤API鐨勯泦鍚� + *@author PanMeiCheng + *@date 2021/11/22 + *@version 1.0 + */ +@Service +public class FlowCommonService { + @Autowired + FlowMyBusinessServiceImpl flowMyBusinessService; + @Autowired + FlowInstanceServiceImpl flowInstanceService; + /** + * 鍒濆鐢熸垚鎴栦慨鏀逛笟鍔′笌娴佺▼鐨勫叧鑱斾俊鎭�<br/> + * 褰撲笟鍔℃ā鍧楁柊澧炰竴鏉℃暟鎹悗璋冪敤锛屾鏃朵笟鍔℃暟鎹叧鑱斾竴涓祦绋嬪畾涔夛紝浠ュ鍚庣画娴佺▼浣跨敤 + * @return 鏄惁鎴愬姛 + * @param title 蹇呭~銆傛祦绋嬩笟鍔$畝瑕佹弿杩般�備緥锛�2021骞�11鏈�26鏃xxxx鐢宠 + * @param dataId 蹇呭~銆備笟鍔℃暟鎹甀d锛屽鏋滄槸涓�瀵瑰涓氬姟鍏崇郴锛屼紶鍏ヤ富琛ㄧ殑鏁版嵁Id + * @param serviceImplName 蹇呭~銆備笟鍔ervice娉ㄥ叆spring瀹瑰櫒鐨勫悕绉般�� +* 渚嬪锛欯Service("demoService")鍒欎紶鍏� demoService + * @param processDefinitionKey 蹇呭~銆傛祦绋嬪畾涔塊ey锛屼紶鍏ユ鍊硷紝鏈潵鍚姩鐨勪細鏄绫绘祦绋嬬殑鏈�鏂颁竴涓増鏈� + * @param processDefinitionId 閫夊~銆傛祦绋嬪畾涔塈d锛屼紶鍏ユ鍊硷紝鏈潵鍚姩鐨勪负鎸囧畾鐗堟湰鐨勬祦绋� + */ + public boolean initActBusiness(String title,String dataId, String serviceImplName, String processDefinitionKey, String processDefinitionId){ + boolean hasBlank = StrUtil.hasBlank(title,dataId, serviceImplName, processDefinitionKey); + if (hasBlank) throw new CustomException("娴佺▼鍏抽敭鍙傛暟鏈~瀹屽叏锛乨ataId, serviceImplName, processDefinitionKey"); + LambdaQueryWrapper<FlowMyBusiness> flowMyBusinessLambdaQueryWrapper = new LambdaQueryWrapper<>(); + flowMyBusinessLambdaQueryWrapper.eq(FlowMyBusiness::getDataId, dataId) + ; + FlowMyBusiness flowMyBusiness = new FlowMyBusiness(); + FlowMyBusiness business = flowMyBusinessService.getOne(flowMyBusinessLambdaQueryWrapper); + if (business!=null){ + flowMyBusiness = business; + } else { + flowMyBusiness.setId(IdUtil.fastSimpleUUID()); + } + if (processDefinitionId==null){ + // 浠ヤ究鏇存柊娴佺▼ + processDefinitionId = ""; + } + flowMyBusiness.setTitle(title) + .setDataId(dataId) + .setServiceImplName(serviceImplName) + .setProcessDefinitionKey(processDefinitionKey) + .setProcessDefinitionId(processDefinitionId) + ; + if (business!=null){ + return flowMyBusinessService.updateById(flowMyBusiness); + } else { + return flowMyBusinessService.save(flowMyBusiness); + } + } + + /** + * 鍒犻櫎娴佺▼ + * @param dataId + * @return + */ + public boolean delActBusiness(String dataId){ + boolean hasBlank = StrUtil.hasBlank(dataId); + if (hasBlank) throw new CustomException("娴佺▼鍏抽敭鍙傛暟鏈~瀹屽叏锛乨ataId"); + LambdaQueryWrapper<FlowMyBusiness> flowMyBusinessQueryWrapper = new LambdaQueryWrapper<>(); + flowMyBusinessQueryWrapper.eq(FlowMyBusiness::getDataId,dataId); + FlowMyBusiness one = flowMyBusinessService.getOne(flowMyBusinessQueryWrapper); + if (one.getProcessInstanceId()!=null){ + try { + flowInstanceService.delete(one.getProcessInstanceId(),"鍒犻櫎娴佺▼"); + } catch (Exception e) { + e.printStackTrace(); + } + } + return flowMyBusinessService.remove(flowMyBusinessQueryWrapper); + } +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/service/IFlowThirdService.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/service/IFlowThirdService.java new file mode 100644 index 0000000..b44dc01 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/service/IFlowThirdService.java @@ -0,0 +1,56 @@ +package org.jeecg.modules.flowable.apithird.service; + +import org.jeecg.modules.flowable.apithird.entity.SysCategory; +import org.jeecg.modules.flowable.apithird.entity.SysRole; +import org.jeecg.modules.flowable.apithird.entity.SysUser; + +import java.util.List; + +/** + * 涓氬姟灞傞渶瀹炵幇鐨勬帴鍙e畾涔�<br/> + * 鏀拺宸ヤ綔娴佹ā鍧椾笌涓氬姟鐨勫叧鑱� + * @author pmc + */ +public interface IFlowThirdService { + /** + * 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 + * + * @return 褰撳墠鐧诲綍鐢ㄦ埛淇℃伅 + */ + public SysUser getLoginUser(); + /** + * 鎵�鏈夌敤鎴� + * @return + */ + List<SysUser> getAllUser(); + /** + * 閫氳繃瑙掕壊id鑾峰彇鐢ㄦ埛 + * @return + */ + List<SysUser> getUsersByRoleId(String roleId); + /** + * 鏍规嵁鐢ㄦ埛username鏌ヨ鐢ㄦ埛淇℃伅 + * @param username + * @return + */ + SysUser getUserByUsername(String username); + + /** + * 鑾峰彇鎵�鏈夎鑹� + * @return + */ + public List<SysRole> getAllRole(); + /** + * 鑾峰彇鎵�鏈夋祦绋嬪垎绫� + * @return + */ + List<SysCategory> getAllCategory(); + /** + * 閫氳繃鐢ㄦ埛璐﹀彿鏌ヨ閮ㄩ棬 name + * @param username + * @return 閮ㄩ棬 name + */ + List<String> getDepartNamesByUsername(String username); + + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/config/MyDefaultProcessDiagramCanvas.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/config/MyDefaultProcessDiagramCanvas.java new file mode 100644 index 0000000..62daf40 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/config/MyDefaultProcessDiagramCanvas.java @@ -0,0 +1,92 @@ +package org.jeecg.modules.flowable.config; + +import org.flowable.bpmn.model.AssociationDirection; +import org.flowable.image.impl.DefaultProcessDiagramCanvas; +import java.awt.*; +import java.awt.geom.Line2D; +import java.awt.geom.RoundRectangle2D; + +/** + * 涓�浜涢厤缃� + */ +public class MyDefaultProcessDiagramCanvas extends DefaultProcessDiagramCanvas { + //璁剧疆楂樹寒绾跨殑棰滆壊 杩欓噷鎴戣缃垚缁胯壊 + protected static Color HIGHLIGHT_SEQUENCEFLOW_COLOR = Color.GREEN; + + public MyDefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) { + super(width, height, minX, minY, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader); + } + + public MyDefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType) { + super(width, height, minX, minY, imageType); + } + + + /** + * 鐢荤嚎棰滆壊璁剧疆 + */ + @Override + public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, String connectionType, + AssociationDirection associationDirection, boolean highLighted, double scaleFactor) { + + Paint originalPaint = g.getPaint(); + Stroke originalStroke = g.getStroke(); + + g.setPaint(CONNECTION_COLOR); + if (connectionType.equals("association")) { + g.setStroke(ASSOCIATION_STROKE); + } else if (highLighted) { + //璁剧疆绾跨殑棰滆壊 + g.setPaint(originalPaint); + g.setStroke(HIGHLIGHT_FLOW_STROKE); + } + + for (int i = 1; i < xPoints.length; i++) { + Integer sourceX = xPoints[i - 1]; + Integer sourceY = yPoints[i - 1]; + Integer targetX = xPoints[i]; + Integer targetY = yPoints[i]; + Line2D.Double line = new Line2D.Double(sourceX, sourceY, targetX, targetY); + g.draw(line); + } + + if (isDefault) { + Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]); + drawDefaultSequenceFlowIndicator(line, scaleFactor); + } + + if (conditional) { + Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]); + drawConditionalSequenceFlowIndicator(line, scaleFactor); + } + + if (associationDirection == AssociationDirection.ONE || associationDirection == AssociationDirection.BOTH) { + Line2D.Double line = new Line2D.Double(xPoints[xPoints.length - 2], yPoints[xPoints.length - 2], xPoints[xPoints.length - 1], yPoints[xPoints.length - 1]); + drawArrowHead(line, scaleFactor); + } + if (associationDirection == AssociationDirection.BOTH) { + Line2D.Double line = new Line2D.Double(xPoints[1], yPoints[1], xPoints[0], yPoints[0]); + drawArrowHead(line, scaleFactor); + } + g.setPaint(originalPaint); + g.setStroke(originalStroke); + } + + /** + * 楂樹寒鑺傜偣璁剧疆 + */ + @Override + public void drawHighLight(int x, int y, int width, int height) { + Paint originalPaint = g.getPaint(); + Stroke originalStroke = g.getStroke(); + //璁剧疆楂樹寒鑺傜偣鐨勯鑹� + g.setPaint(HIGHLIGHT_COLOR); + g.setStroke(THICK_TASK_BORDER_STROKE); + + RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20); + g.draw(rect); + + g.setPaint(originalPaint); + g.setStroke(originalStroke); + } +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/controller/FlowDefinitionController.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/controller/FlowDefinitionController.java new file mode 100644 index 0000000..6e17eea --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/controller/FlowDefinitionController.java @@ -0,0 +1,243 @@ +package org.jeecg.modules.flowable.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.flowable.apithird.entity.SysCategory; +import org.jeecg.modules.flowable.apithird.entity.SysRole; +import org.jeecg.modules.flowable.apithird.entity.SysUser; +import org.jeecg.modules.flowable.apithird.service.IFlowThirdService; +import org.jeecg.modules.flowable.domain.dto.FlowProcDefDto; +import org.jeecg.modules.flowable.domain.dto.FlowSaveXmlVo; +import org.jeecg.modules.flowable.service.IFlowDefinitionService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.imageio.ImageIO; +import javax.servlet.http.HttpServletResponse; +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Map; + +/** + * <p> + * 宸ヤ綔娴佺▼瀹氫箟 + * </p> + * + */ +@Slf4j +@Api(tags = "娴佺▼瀹氫箟") +@RestController +@RequestMapping("/flowable/definition") +public class FlowDefinitionController { + + @Autowired + private IFlowDefinitionService flowDefinitionService; + + @Autowired + private IFlowThirdService iFlowThirdService; + + + + @GetMapping(value = "/list") + @ApiOperation(value = "娴佺▼瀹氫箟鍒楄〃", response = FlowProcDefDto.class) + public Result list(@ApiParam(value = "褰撳墠椤电爜", required = true) @RequestParam Integer pageNum, + @ApiParam(value = "姣忛〉鏉℃暟", required = true) @RequestParam Integer pageSize, + FlowProcDefDto flowProcDefDto + ) { + return Result.OK(flowDefinitionService.list(pageNum, pageSize,flowProcDefDto)); + } + + + @ApiOperation(value = "瀵煎叆娴佺▼鏂囦欢", notes = "涓婁紶bpmn20鐨剎ml鏂囦欢") + @PostMapping("/import") + public Result importFile(@RequestParam(required = false) String name, + @RequestParam(required = false) String category, + MultipartFile file) { + InputStream in = null; + try { + in = file.getInputStream(); + flowDefinitionService.importFile(name, category, in); + } catch (Exception e) { + log.error("瀵煎叆澶辫触:", e); + return Result.OK(e.getMessage()); + } finally { + try { + if (in != null) { + in.close(); + } + } catch (IOException e) { + log.error("鍏抽棴杈撳叆娴佸嚭閿�", e); + } + } + + return Result.OK("瀵煎叆鎴愬姛"); + } + + + @ApiOperation(value = "璇诲彇xml鏂囦欢") + @GetMapping("/readXml/{deployId}") + public Result readXml(@ApiParam(value = "娴佺▼瀹氫箟id") @PathVariable(value = "deployId") String deployId) { + try { + return flowDefinitionService.readXml(deployId); + } catch (Exception e) { + return Result.error("鍔犺浇xml鏂囦欢寮傚父"); + } + + } + @ApiOperation(value = "璇诲彇xml鏂囦欢") + @GetMapping("/readXmlByDataId/{dataId}") + public Result readXmlByDataId(@ApiParam(value = "娴佺▼瀹氫箟id") @PathVariable(value = "dataId") String dataId) { + try { + return flowDefinitionService.readXmlByDataId(dataId); + } catch (Exception e) { + return Result.error("鍔犺浇xml鏂囦欢寮傚父"); + } + + } + + @ApiOperation(value = "璇诲彇鍥剧墖鏂囦欢") + @GetMapping("/readImage/{deployId}") + public void readImage(@ApiParam(value = "娴佺▼瀹氫箟id") @PathVariable(value = "deployId") String deployId, HttpServletResponse response) { + OutputStream os = null; + BufferedImage image = null; + try { + image = ImageIO.read(flowDefinitionService.readImage(deployId)); + response.setContentType("image/png"); + os = response.getOutputStream(); + if (image != null) { + ImageIO.write(image, "png", os); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (os != null) { + os.flush(); + os.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + } + @ApiOperation(value = "璇诲彇鍥剧墖鏂囦欢") + @GetMapping("/readImageByDataId/{dataId}") + public void readImageByDataId(@ApiParam(value = "娴佺▼鏁版嵁涓氬姟id") @PathVariable(value = "dataId") String dataId, HttpServletResponse response) { + OutputStream os = null; + BufferedImage image = null; + try { + image = ImageIO.read(flowDefinitionService.readImageByDataId(dataId)); + response.setContentType("image/png"); + os = response.getOutputStream(); + if (image != null) { + ImageIO.write(image, "png", os); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (os != null) { + os.flush(); + os.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + } + + + @ApiOperation(value = "淇濆瓨娴佺▼璁捐鍣ㄥ唴鐨剎ml鏂囦欢") + @PostMapping("/save") + public Result save(@RequestBody FlowSaveXmlVo vo) { + InputStream in = null; + try { + in = new ByteArrayInputStream(vo.getXml().getBytes(StandardCharsets.UTF_8)); + flowDefinitionService.importFile(vo.getName(), vo.getCategory(), in); + } catch (Exception e) { + log.error("瀵煎叆澶辫触:", e); + return Result.OK(e.getMessage()); + } finally { + try { + if (in != null) { + in.close(); + } + } catch (IOException e) { + log.error("鍏抽棴杈撳叆娴佸嚭閿�", e); + } + } + + return Result.OK("瀵煎叆鎴愬姛"); + } + + + @ApiOperation(value = "鏍规嵁娴佺▼瀹氫箟id鍚姩娴佺▼瀹炰緥") + @PostMapping("/startByProcDefId/{procDefId}") + public Result startByProcDefId(@ApiParam(value = "娴佺▼瀹氫箟id") @PathVariable(value = "procDefId") String procDefId, + @ApiParam(value = "鍙橀噺闆嗗悎,json瀵硅薄") @RequestBody Map<String, Object> variables) { + return flowDefinitionService.startProcessInstanceById(procDefId, variables); + + } + @ApiOperation(value = "鏍规嵁娴佺▼瀹氫箟key鍚姩娴佺▼瀹炰緥") + @PostMapping("/startByProcDefKey/{procDefKey}") + public Result startByProcDefKey(@ApiParam(value = "娴佺▼瀹氫箟id") @PathVariable(value = "procDefKey") String procDefKey, + @ApiParam(value = "鍙橀噺闆嗗悎,json瀵硅薄") @RequestBody Map<String, Object> variables) { + return flowDefinitionService.startProcessInstanceByKey(procDefKey, variables); + + } + @ApiOperation(value = "鏍规嵁鏁版嵁Id鍚姩娴佺▼瀹炰緥") + @PostMapping("/startByDataId/{dataId}") + public Result startByDataId(@ApiParam(value = "娴佺▼瀹氫箟id") @PathVariable(value = "dataId") String dataId, + @ApiParam(value = "鍙橀噺闆嗗悎,json瀵硅薄") @RequestBody Map<String, Object> variables) { + variables.put("dataId",dataId); + return flowDefinitionService.startProcessInstanceByDataId(dataId, variables); + + } + + @ApiOperation(value = "婵�娲绘垨鎸傝捣娴佺▼瀹氫箟") + @PutMapping(value = "/updateState") + public Result updateState(@ApiParam(value = "1:婵�娲�,2:鎸傝捣", required = true) @RequestParam Integer state, + @ApiParam(value = "娴佺▼閮ㄧ讲ID", required = true) @RequestParam String deployId) { + flowDefinitionService.updateState(state, deployId); + return Result.OK("鎿嶄綔鎴愬姛"); + } + + @ApiOperation(value = "鍒犻櫎娴佺▼") + @DeleteMapping(value = "/delete") + public Result delete(@ApiParam(value = "娴佺▼閮ㄧ讲ID", required = true) @RequestParam String deployId) { + flowDefinitionService.delete(deployId); + return Result.OK(); + } + + @ApiOperation(value = "鎸囧畾娴佺▼鍔炵悊浜哄憳鍒楄〃") + @GetMapping("/userList") + public Result userList(SysUser user) { + List<SysUser> list = iFlowThirdService.getAllUser(); + return Result.OK(list); + } + + @ApiOperation(value = "鎸囧畾娴佺▼鍔炵悊缁勫垪琛�") + @GetMapping("/roleList") + public Result roleList(SysRole role) { + List<SysRole> list = iFlowThirdService.getAllRole(); + return Result.OK(list); + } + @ApiOperation(value = "鎸囧畾娴佺▼鍔炵悊缁勫垪琛�") + @GetMapping("/categoryList") + public Result categoryList(SysCategory category) { + List<SysCategory> list = iFlowThirdService.getAllCategory(); + return Result.OK(list); + } + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/controller/FlowInstanceController.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/controller/FlowInstanceController.java new file mode 100644 index 0000000..176d5cd --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/controller/FlowInstanceController.java @@ -0,0 +1,63 @@ +package org.jeecg.modules.flowable.controller; + + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.flowable.service.IFlowInstanceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * <p>宸ヤ綔娴佹祦绋嬪疄渚嬬鐞�<p> + */ +@Slf4j +@Api(tags = "宸ヤ綔娴佹祦绋嬪疄渚嬬鐞�") +@RestController +@RequestMapping("/flowable/instance") +public class FlowInstanceController { + + @Autowired + private IFlowInstanceService flowInstanceService; + + /*@ApiOperation(value = "鏍规嵁娴佺▼瀹氫箟id鍚姩娴佺▼瀹炰緥") + @PostMapping("/startBy/{procDefId}") + public Result startById(@ApiParam(value = "娴佺▼瀹氫箟id") @PathVariable(value = "procDefId") String procDefId, + @ApiParam(value = "鍙橀噺闆嗗悎,json瀵硅薄") @RequestBody Map<String, Object> variables) { + return flowInstanceService.startProcessInstanceById(procDefId, variables); + + }*/ + + + @ApiOperation(value = "婵�娲绘垨鎸傝捣娴佺▼瀹炰緥") + @PostMapping(value = "/updateState") + public Result updateState(@ApiParam(value = "1:婵�娲�,2:鎸傝捣", required = true) @RequestParam Integer state, + @ApiParam(value = "娴佺▼瀹炰緥ID", required = true) @RequestParam String instanceId) { + flowInstanceService.updateState(state,instanceId); + return Result.OK(); + } + + /*@ApiOperation("缁撴潫娴佺▼瀹炰緥") + @PostMapping(value = "/stopProcessInstance") + public Result stopProcessInstance(@RequestBody FlowTaskVo flowTaskVo) { + flowInstanceService.stopProcessInstance(flowTaskVo); + return Result.OK(); + }*/ + + @ApiOperation(value = "鍒犻櫎娴佺▼瀹炰緥") + @DeleteMapping(value = "/delete") + public Result delete(@ApiParam(value = "娴佺▼瀹炰緥ID", required = true) @RequestParam String instanceId, + @ApiParam(value = "鍒犻櫎鍘熷洜") @RequestParam(required = false) String deleteReason) { + flowInstanceService.delete(instanceId,deleteReason); + return Result.OK(); + } + @ApiOperation(value = "鍒犻櫎娴佺▼瀹炰緥") + @PostMapping(value = "/deleteByDataId") + public Result deleteByDataId(@ApiParam(value = "娴佺▼瀹炰緥鍏宠仈涓氬姟ID", required = true) @RequestParam String dataId, + @ApiParam(value = "鍒犻櫎鍘熷洜") @RequestParam(required = false) String deleteReason) { + flowInstanceService.deleteByDataId(dataId,deleteReason); + return Result.OK(); + } +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/controller/FlowTaskController.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/controller/FlowTaskController.java new file mode 100644 index 0000000..0de7455 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/controller/FlowTaskController.java @@ -0,0 +1,219 @@ +package org.jeecg.modules.flowable.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.flowable.domain.dto.FlowTaskDto; +import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; +import org.jeecg.modules.flowable.service.IFlowTaskService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.imageio.ImageIO; +import javax.servlet.http.HttpServletResponse; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * <p>宸ヤ綔娴佷换鍔$鐞�<p> + * + */ +@Slf4j +@Api(tags = "宸ヤ綔娴佹祦绋嬩换鍔$鐞�") +@RestController +@RequestMapping("/flowable/task") +public class FlowTaskController { + + @Autowired + private IFlowTaskService flowTaskService; + + @ApiOperation(value = "鎴戝彂璧风殑娴佺▼", response = FlowTaskDto.class) + @GetMapping(value = "/myProcess") + public Result myProcess(@ApiParam(value = "褰撳墠椤电爜", required = true) @RequestParam Integer pageNum, + @ApiParam(value = "姣忛〉鏉℃暟", required = true) @RequestParam Integer pageSize) { + return flowTaskService.myProcess(pageNum, pageSize); + } + + @ApiOperation(value = "鍙栨秷鐢宠", response = FlowTaskDto.class) + @PostMapping(value = "/stopProcess") + public Result stopProcess(@RequestBody FlowTaskVo flowTaskVo) { + return flowTaskService.stopProcess(flowTaskVo); + } + + @ApiOperation(value = "鎾ゅ洖娴佺▼", response = FlowTaskDto.class) + @PostMapping(value = "/revokeProcess") + public Result revokeProcess(@RequestBody FlowTaskVo flowTaskVo) { + return flowTaskService.revokeProcess(flowTaskVo); + } + + @ApiOperation(value = "鑾峰彇寰呭姙鍒楄〃", response = FlowTaskDto.class) + @GetMapping(value = "/todoList") + public Result todoList(@ApiParam(value = "褰撳墠椤电爜", required = true) @RequestParam Integer pageNum, + @ApiParam(value = "姣忛〉鏉℃暟", required = true) @RequestParam Integer pageSize) { + return flowTaskService.todoList(pageNum, pageSize); + } + + @ApiOperation(value = "鑾峰彇宸插姙浠诲姟", response = FlowTaskDto.class) + @GetMapping(value = "/finishedList") + public Result finishedList(@ApiParam(value = "褰撳墠椤电爜", required = true) @RequestParam Integer pageNum, + @ApiParam(value = "姣忛〉鏉℃暟", required = true) @RequestParam Integer pageSize) { + return flowTaskService.finishedList(pageNum, pageSize); + } + + + @ApiOperation(value = "娴佺▼鍘嗗彶娴佽浆璁板綍", response = FlowTaskDto.class) + @GetMapping(value = "/flowRecord") + public Result flowRecord(String dataId) { + return flowTaskService.flowRecord(dataId); + } + + @ApiOperation(value = "鑾峰彇娴佺▼鍙橀噺", response = FlowTaskDto.class) + @GetMapping(value = "/processVariables/{taskId}") + public Result processVariables(@ApiParam(value = "娴佺▼浠诲姟Id") @PathVariable(value = "taskId") String taskId) { + return flowTaskService.processVariables(taskId); + } + + @ApiOperation(value = "瀹℃壒浠诲姟") + @PostMapping(value = "/complete") + public Result complete(@RequestBody FlowTaskVo flowTaskVo) { + return flowTaskService.complete(flowTaskVo); + } + @ApiOperation(value = "瀹℃壒浠诲姟") + @PostMapping(value = "/completeByDateId") + public Result completeByDateId(@RequestBody FlowTaskVo flowTaskVo) { + return flowTaskService.completeByDateId(flowTaskVo); + } + + @ApiOperation(value = "椹冲洖浠诲姟") + @PostMapping(value = "/reject") + public Result taskReject(@RequestBody FlowTaskVo flowTaskVo) { + flowTaskService.taskReject(flowTaskVo); + return Result.OK(); + } + @ApiOperation(value = "椹冲洖浠诲姟") + @PostMapping(value = "/taskRejectByDataId") + public Result taskRejectByDataId(@RequestBody FlowTaskVo flowTaskVo) { + flowTaskService.taskRejectByDataId(flowTaskVo); + return Result.OK(); + } + + @ApiOperation(value = "閫�鍥炰换鍔�") + @PostMapping(value = "/return") + public Result taskReturn(@RequestBody FlowTaskVo flowTaskVo) { + flowTaskService.taskReturn(flowTaskVo); + return Result.OK(); + } + @ApiOperation(value = "閫�鍥炰换鍔�") + @PostMapping(value = "/taskReturnByDataId") + public Result taskReturnByDataId(@RequestBody FlowTaskVo flowTaskVo) { + flowTaskService.taskReturnByDataId(flowTaskVo); + return Result.OK(); + } + + @ApiOperation(value = "鑾峰彇鎵�鏈夊彲鍥為��鐨勮妭鐐�") + @PostMapping(value = "/returnList") + public Result findReturnTaskList(@RequestBody FlowTaskVo flowTaskVo) { + return flowTaskService.findReturnTaskList(flowTaskVo); + } + @ApiOperation(value = "鑾峰彇鎵�鏈夊彲鍥為��鐨勮妭鐐�") + @PostMapping(value = "/findReturnTaskListByDataId") + public Result findReturnTaskListByDataId(@RequestBody FlowTaskVo flowTaskVo) { + return flowTaskService.findReturnTaskListByDataId(flowTaskVo); + } + + @ApiOperation(value = "鍒犻櫎浠诲姟") + @DeleteMapping(value = "/delete") + public Result delete(@RequestBody FlowTaskVo flowTaskVo) { + flowTaskService.deleteTask(flowTaskVo); + return Result.OK(); + } + + @ApiOperation(value = "璁ら/绛炬敹浠诲姟") + @PostMapping(value = "/claim") + public Result claim(@RequestBody FlowTaskVo flowTaskVo) { + flowTaskService.claim(flowTaskVo); + return Result.OK(); + } + + @ApiOperation(value = "鍙栨秷璁ら/绛炬敹浠诲姟") + @PostMapping(value = "/unClaim") + public Result unClaim(@RequestBody FlowTaskVo flowTaskVo) { + flowTaskService.unClaim(flowTaskVo); + return Result.OK(); + } + + @ApiOperation(value = "濮旀淳浠诲姟") + @PostMapping(value = "/delegate") + public Result delegate(@RequestBody FlowTaskVo flowTaskVo) { + flowTaskService.delegateTask(flowTaskVo); + return Result.OK(); + } + + @ApiOperation(value = "杞姙浠诲姟") + @PostMapping(value = "/assign") + public Result assign(@RequestBody FlowTaskVo flowTaskVo) { + flowTaskService.assignTask(flowTaskVo); + return Result.OK(); + } + + @ApiOperation(value = "鑾峰彇涓嬩竴鑺傜偣") + @PostMapping(value = "/nextFlowNode") + public Result getNextFlowNode(@RequestBody FlowTaskVo flowTaskVo) { + return flowTaskService.getNextFlowNode(flowTaskVo); + } + + /** + * 鐢熸垚娴佺▼鍥� + * + * @param processId 浠诲姟ID + */ + @RequestMapping("/diagram/{processId}") + public void genProcessDiagram(HttpServletResponse response, + @PathVariable("processId") String processId) { + InputStream inputStream = flowTaskService.diagram(processId); + OutputStream os = null; + BufferedImage image = null; + try { + image = ImageIO.read(inputStream); + response.setContentType("image/png"); + os = response.getOutputStream(); + if (image != null) { + ImageIO.write(image, "png", os); + } + }catch (Exception e) { + e.printStackTrace(); + }finally { + try { + if (os != null) { + os.flush(); + os.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * 鐢熸垚娴佺▼鍥� + * + * @param procInsId 浠诲姟ID + */ + @RequestMapping("/flowViewer/{procInsId}") + public Result getFlowViewer(@PathVariable("procInsId") String procInsId) { + return Result.OK(flowTaskService.getFlowViewer(procInsId)); + } + /** + * 鐢熸垚娴佺▼鍥� + * + * @param dataId 浠诲姟鏁版嵁ID + */ + @RequestMapping("/flowViewerByDataId/{dataId}") + public Result getFlowViewerByDataId(@PathVariable("dataId") String dataId) { + return Result.OK(flowTaskService.getFlowViewerByDataId(dataId)); + } +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowCommentDto.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowCommentDto.java new file mode 100644 index 0000000..512dfc6 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowCommentDto.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.flowable.domain.dto; + +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; + +/** + * 鍩虹甯搁噺 + */ +@Data +@Builder +public class FlowCommentDto implements Serializable { + + /** + * 鎰忚绫诲埆 0 姝e父鎰忚 1 閫�鍥炴剰瑙� 2 椹冲洖鎰忚 + */ + private String type; + + /** + * 鎰忚鍐呭 + */ + private String comment; +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowNextDto.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowNextDto.java new file mode 100644 index 0000000..851333f --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowNextDto.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.flowable.domain.dto; + +import lombok.Data; +import org.flowable.bpmn.model.UserTask; +import org.jeecg.modules.flowable.apithird.entity.SysUser; + +import java.io.Serializable; +import java.util.List; + +/** + * 浜哄憳銆佺粍 + */ +@Data +public class FlowNextDto implements Serializable { + /** + * 鑺傜偣瀵硅薄 + */ + private UserTask userTask; + /** + * 寰呭姙浜哄憳 + */ + private List<SysUser> userList; + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowProcDefDto.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowProcDefDto.java new file mode 100644 index 0000000..24e7108 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowProcDefDto.java @@ -0,0 +1,56 @@ +package org.jeecg.modules.flowable.domain.dto; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +/** + * <p>娴佺▼瀹氫箟<p> + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("娴佺▼瀹氫箟") +public class FlowProcDefDto implements Serializable { + + @ApiModelProperty("娴佺▼id") + private String id; + + @ApiModelProperty("娴佺▼鍚嶇О") + private String name; + + @ApiModelProperty("娴佺▼key") + private String key; + + @ApiModelProperty("娴佺▼鍒嗙被") + private String category; + + @ApiModelProperty("閰嶇疆琛ㄥ崟鍚嶇О") + private String formName; + + @ApiModelProperty("閰嶇疆琛ㄥ崟id") + private Long formId; + + @ApiModelProperty("鐗堟湰") + private int version; + + @ApiModelProperty("閮ㄧ讲ID") + private String deploymentId; + + @ApiModelProperty("娴佺▼瀹氫箟鐘舵��: 1:婵�娲� , 2:涓") + private int suspensionState; + + @ApiModelProperty("娴佺▼瀹氫箟鏄惁鏈�鏂扮増鏈�") + private int isLastVersion; + + @ApiModelProperty("閮ㄧ讲鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date deploymentTime; + + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowSaveXmlVo.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowSaveXmlVo.java new file mode 100644 index 0000000..c8deb52 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowSaveXmlVo.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.flowable.domain.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 娴佺▼瑙勮寖xml + */ +@Data +public class FlowSaveXmlVo implements Serializable { + + /** + * 娴佺▼鍚嶇О + */ + private String name; + + /** + * 娴佺▼鍒嗙被 + */ + private String category; + + /** + * xml 鏂囦欢 + */ + private String xml; +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java new file mode 100644 index 0000000..8202e42 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java @@ -0,0 +1,95 @@ +package org.jeecg.modules.flowable.domain.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + * <p>宸ヤ綔娴佷换鍔�<p> + * + */ +@Getter +@Setter +@ApiModel("宸ヤ綔娴佷换鍔$浉鍏�-杩斿洖鍙傛暟") +public class FlowTaskDto implements Serializable { + + @ApiModelProperty("浠诲姟缂栧彿") + private String taskId; + + @ApiModelProperty("浠诲姟鍚嶇О") + private String taskName; + + @ApiModelProperty("浠诲姟Key") + private String taskDefKey; + + @ApiModelProperty("浠诲姟鎵ц浜篒d") + private String assigneeId; + + @ApiModelProperty("閮ㄩ棬鍚嶇О") + private String deptName; + + @ApiModelProperty("娴佺▼鍙戣捣浜洪儴闂ㄥ悕绉�") + private String startDeptName; + + @ApiModelProperty("浠诲姟鎵ц浜哄悕绉�") + private String assigneeName; + + @ApiModelProperty("娴佺▼鍙戣捣浜篒d") + private String startUserId; + + @ApiModelProperty("娴佺▼鍙戣捣浜哄悕绉�") + private String startUserName; + + @ApiModelProperty("娴佺▼绫诲瀷") + private String category; + + @ApiModelProperty("娴佺▼鍙橀噺淇℃伅") + private Object procVars; + + @ApiModelProperty("灞�閮ㄥ彉閲忎俊鎭�") + private Object taskLocalVars; + + @ApiModelProperty("娴佺▼閮ㄧ讲缂栧彿") + private String deployId; + + @ApiModelProperty("娴佺▼ID") + private String procDefId; + + @ApiModelProperty("娴佺▼key") + private String procDefKey; + + @ApiModelProperty("娴佺▼瀹氫箟鍚嶇О") + private String procDefName; + + @ApiModelProperty("娴佺▼瀹氫箟鍐呯疆浣跨敤鐗堟湰") + private int procDefVersion; + + @ApiModelProperty("娴佺▼瀹炰緥ID") + private String procInsId; + + @ApiModelProperty("鍘嗗彶娴佺▼瀹炰緥ID") + private String hisProcInsId; + + @ApiModelProperty("浠诲姟鑰楁椂") + private String duration; + + @ApiModelProperty("浠诲姟鎰忚") + private FlowCommentDto comment; + + @ApiModelProperty("鍊欓�夋墽琛屼汉") + private String candidate; + + @ApiModelProperty("浠诲姟鍒涘缓鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + @ApiModelProperty("浠诲姟瀹屾垚鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date finishTime; + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowViewerDto.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowViewerDto.java new file mode 100644 index 0000000..a195a2a --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowViewerDto.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.flowable.domain.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + */ +@Data +public class FlowViewerDto implements Serializable { + + private String key; + private boolean completed; + private boolean back; +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/vo/FlowTaskVo.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/vo/FlowTaskVo.java new file mode 100644 index 0000000..fc68a63 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/vo/FlowTaskVo.java @@ -0,0 +1,48 @@ +package org.jeecg.modules.flowable.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; +import java.util.Map; + +/** + * <p>娴佺▼浠诲姟<p> + * + */ +@Data +@ApiModel("宸ヤ綔娴佷换鍔$浉鍏�--璇锋眰鍙傛暟") +public class FlowTaskVo { + + @ApiModelProperty("鏁版嵁Id") + private String dataId; + @ApiModelProperty("浠诲姟Id") + private String taskId; + + @ApiModelProperty("鐢ㄦ埛Id") + private String userId; + + @ApiModelProperty("浠诲姟鎰忚") + private String comment; + + @ApiModelProperty("娴佺▼瀹炰緥Id") + private String instanceId; + + @ApiModelProperty("鑺傜偣") + private String targetKey; + + @ApiModelProperty("娴佺▼鍙橀噺淇℃伅") + private Map<String, Object> values; + + @ApiModelProperty("瀹℃壒浜�") + private String assignee; + + @ApiModelProperty("鍊欓�変汉") + private List<String> candidateUsers; + + @ApiModelProperty("瀹℃壒缁�") + private List<String> candidateGroups; + + private String xiugaiId; +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/factory/FlowServiceFactory.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/factory/FlowServiceFactory.java new file mode 100644 index 0000000..b5379ed --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/factory/FlowServiceFactory.java @@ -0,0 +1,42 @@ +package org.jeecg.modules.flowable.factory; + +import lombok.Getter; +import org.flowable.engine.*; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * flowable 寮曟搸娉ㄥ叆灏佽 + */ +@Component +@Getter +public class FlowServiceFactory { + + @Resource + protected RepositoryService repositoryService; + + @Resource + protected RuntimeService runtimeService; + + @Resource + protected IdentityService identityService; + + @Resource + protected TaskService taskService; + + @Resource + protected FormService formService; + + @Resource + protected HistoryService historyService; + + @Resource + protected ManagementService managementService; + + @Qualifier("processEngine") + @Resource + protected ProcessEngine processEngine; + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/CustomProcessDiagramCanvas.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/CustomProcessDiagramCanvas.java new file mode 100644 index 0000000..471ebc6 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/CustomProcessDiagramCanvas.java @@ -0,0 +1,369 @@ +package org.jeecg.modules.flowable.flow; + +import org.flowable.bpmn.model.AssociationDirection; +import org.flowable.bpmn.model.GraphicInfo; +import org.flowable.image.impl.DefaultProcessDiagramCanvas; +import org.flowable.image.util.ReflectUtil; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.font.FontRenderContext; +import java.awt.font.LineBreakMeasurer; +import java.awt.font.TextAttribute; +import java.awt.font.TextLayout; +import java.awt.geom.Ellipse2D; +import java.awt.geom.Rectangle2D; +import java.awt.geom.RoundRectangle2D; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.text.AttributedCharacterIterator; +import java.text.AttributedString; + +/** + * 鍩虹閰嶇疆 + */ +public class CustomProcessDiagramCanvas extends DefaultProcessDiagramCanvas { + //瀹氫箟璧拌繃娴佺▼杩炵嚎棰滆壊涓虹豢鑹� + protected static Color HIGHLIGHT_SequenceFlow_COLOR = Color.GREEN; + //璁剧疆鏈蛋杩囨祦绋嬬殑杩炴帴绾块鑹� + protected static Color CONNECTION_COLOR = Color.BLACK; + //璁剧疆flows杩炴帴绾垮瓧浣撻鑹瞨ed + protected static Color LABEL_COLOR = new Color(0, 0, 0); + //楂樹寒鏄剧ずtask妗嗛鑹� + protected static Color HIGHLIGHT_COLOR = Color.GREEN; + protected static Color HIGHLIGHT_COLOR1 = Color.RED; + + public CustomProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) { + super(width, height, minX, minY, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader); + this.initialize(imageType); + } + + /** + * 閲嶅啓缁樺埗杩炵嚎鐨勬柟寮�,璁剧疆缁樺埗棰滆壊 + * @param xPoints + * @param yPoints + * @param conditional + * @param isDefault + * @param connectionType + * @param associationDirection + * @param highLighted + * @param scaleFactor + */ + @Override + public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, String connectionType, AssociationDirection associationDirection, boolean highLighted, double scaleFactor) { + Paint originalPaint = this.g.getPaint(); + Stroke originalStroke = this.g.getStroke(); + this.g.setPaint(CONNECTION_COLOR); + if (connectionType.equals("association")) { + this.g.setStroke(ASSOCIATION_STROKE); + } else if (highLighted) { + this.g.setPaint(HIGHLIGHT_SequenceFlow_COLOR); + this.g.setStroke(HIGHLIGHT_FLOW_STROKE); + } + + for (int i = 1; i < xPoints.length; ++i) { + Integer sourceX = xPoints[i - 1]; + Integer sourceY = yPoints[i - 1]; + Integer targetX = xPoints[i]; + Integer targetY = yPoints[i]; + java.awt.geom.Line2D.Double line = new java.awt.geom.Line2D.Double((double) sourceX, (double) sourceY, (double) targetX, (double) targetY); + this.g.draw(line); + } + + java.awt.geom.Line2D.Double line; + if (isDefault) { + line = new java.awt.geom.Line2D.Double((double) xPoints[0], (double) yPoints[0], (double) xPoints[1], (double) yPoints[1]); + this.drawDefaultSequenceFlowIndicator(line, scaleFactor); + } + + if (conditional) { + line = new java.awt.geom.Line2D.Double((double) xPoints[0], (double) yPoints[0], (double) xPoints[1], (double) yPoints[1]); + this.drawConditionalSequenceFlowIndicator(line, scaleFactor); + } + + if (associationDirection.equals(AssociationDirection.ONE) || associationDirection.equals(AssociationDirection.BOTH)) { + line = new java.awt.geom.Line2D.Double((double) xPoints[xPoints.length - 2], (double) yPoints[xPoints.length - 2], (double) xPoints[xPoints.length - 1], (double) yPoints[xPoints.length - 1]); + this.drawArrowHead(line, scaleFactor); + } + + if (associationDirection.equals(AssociationDirection.BOTH)) { + line = new java.awt.geom.Line2D.Double((double) xPoints[1], (double) yPoints[1], (double) xPoints[0], (double) yPoints[0]); + this.drawArrowHead(line, scaleFactor); + } + + this.g.setPaint(originalPaint); + this.g.setStroke(originalStroke); + } + + /** + * 璁剧疆瀛椾綋澶у皬鍥炬爣棰滆壊 + * @param imageType + */ + @Override + public void initialize(String imageType) { + if ("png".equalsIgnoreCase(imageType)) { + this.processDiagram = new BufferedImage(this.canvasWidth, this.canvasHeight, 2); + } else { + this.processDiagram = new BufferedImage(this.canvasWidth, this.canvasHeight, 1); + } + + this.g = this.processDiagram.createGraphics(); + if (!"png".equalsIgnoreCase(imageType)) { + this.g.setBackground(new Color(255, 255, 255, 0)); + this.g.clearRect(0, 0, this.canvasWidth, this.canvasHeight); + } + + this.g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + //淇敼鍥炬爣棰滆壊锛屼慨鏀瑰浘鏍囧瓧浣撳ぇ灏� + this.g.setPaint(Color.black); + Font font = new Font(this.activityFontName, 10, 14); + this.g.setFont(font); + this.fontMetrics = this.g.getFontMetrics(); + //淇敼杩炴帴绾垮瓧浣撳ぇ灏� + LABEL_FONT = new Font(this.labelFontName, 10, 15); + ANNOTATION_FONT = new Font(this.annotationFontName, 0, 11); + + try { + USERTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/userTask.png", this.customClassLoader)); + SCRIPTTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/scriptTask.png", this.customClassLoader)); + SERVICETASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/serviceTask.png", this.customClassLoader)); + RECEIVETASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/receiveTask.png", this.customClassLoader)); + SENDTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/sendTask.png", this.customClassLoader)); + MANUALTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/manualTask.png", this.customClassLoader)); + BUSINESS_RULE_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/businessRuleTask.png", this.customClassLoader)); + SHELL_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/shellTask.png", this.customClassLoader)); + DMN_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/dmnTask.png", this.customClassLoader)); + CAMEL_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/camelTask.png", this.customClassLoader)); + MULE_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/muleTask.png", this.customClassLoader)); + HTTP_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/httpTask.png", this.customClassLoader)); + TIMER_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/timer.png", this.customClassLoader)); + COMPENSATE_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/compensate-throw.png", this.customClassLoader)); + COMPENSATE_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/compensate.png", this.customClassLoader)); + ERROR_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/error-throw.png", this.customClassLoader)); + ERROR_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/error.png", this.customClassLoader)); + MESSAGE_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/message-throw.png", this.customClassLoader)); + MESSAGE_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/message.png", this.customClassLoader)); + SIGNAL_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/signal-throw.png", this.customClassLoader)); + SIGNAL_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource("org/flowable/icons/signal.png", this.customClassLoader)); + } catch (IOException var4) { + LOGGER.warn("Could not load image for process diagram creation: {}", var4.getMessage()); + } + + } + + /** + * 璁剧疆杩炴帴绾垮瓧浣� + * @param text + * @param graphicInfo + * @param centered + */ + @Override + public void drawLabel(String text, GraphicInfo graphicInfo, boolean centered) { + float interline = 1.0f; + + // text + if (text != null && text.length() > 0) { + Paint originalPaint = g.getPaint(); + Font originalFont = g.getFont(); + + g.setPaint(LABEL_COLOR); + g.setFont(LABEL_FONT); + + int wrapWidth = 100; + int textY = (int) graphicInfo.getY(); + + // TODO: use drawMultilineText() + AttributedString as = new AttributedString(text); + as.addAttribute(TextAttribute.FOREGROUND, g.getPaint()); + as.addAttribute(TextAttribute.FONT, g.getFont()); + AttributedCharacterIterator aci = as.getIterator(); + FontRenderContext frc = new FontRenderContext(null, true, false); + LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc); + + while (lbm.getPosition() < text.length()) { + TextLayout tl = lbm.nextLayout(wrapWidth); + textY += tl.getAscent(); + + Rectangle2D bb = tl.getBounds(); + double tX = graphicInfo.getX(); + + if (centered) { + tX += (int) (graphicInfo.getWidth() / 2 - bb.getWidth() / 2); + } + tl.draw(g, (float) tX, textY); + textY += tl.getDescent() + tl.getLeading() + (interline - 1.0f) * tl.getAscent(); + } + + // restore originals + g.setFont(originalFont); + g.setPaint(originalPaint); + } + } + + /** + * 楂樹寒鏄剧ずtask妗嗗畬鎴愮殑 + * @param x + * @param y + * @param width + * @param height + */ + @Override + public void drawHighLight(int x, int y, int width, int height) { + Paint originalPaint = g.getPaint(); + Stroke originalStroke = g.getStroke(); + + g.setPaint(HIGHLIGHT_COLOR); + g.setStroke(THICK_TASK_BORDER_STROKE); + + RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20); + g.draw(rect); + + g.setPaint(originalPaint); + g.setStroke(originalStroke); + } + + /** + * 鑷畾涔塼ask妗嗗綋鍓嶇殑浣嶇疆 + * @param x + * @param y + * @param width + * @param height + */ + public void drawHighLightNow(int x, int y, int width, int height) { + Paint originalPaint = g.getPaint(); + Stroke originalStroke = g.getStroke(); + + g.setPaint(HIGHLIGHT_COLOR1); + g.setStroke(THICK_TASK_BORDER_STROKE); + + RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20); + g.draw(rect); + + g.setPaint(originalPaint); + g.setStroke(originalStroke); + } + + /** + * 鑷畾涔夌粨鏉熻妭鐐� + * @param x + * @param y + * @param width + * @param height + */ + public void drawHighLightEnd(int x, int y, int width, int height) { + Paint originalPaint = g.getPaint(); + Stroke originalStroke = g.getStroke(); + + g.setPaint(HIGHLIGHT_COLOR); + g.setStroke(THICK_TASK_BORDER_STROKE); + + RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20); + g.draw(rect); + + g.setPaint(originalPaint); + g.setStroke(originalStroke); + } + + /** + * task妗嗚嚜瀹氫箟鏂囧瓧 + * @param name + * @param graphicInfo + * @param thickBorder + * @param scaleFactor + */ + @Override + protected void drawTask(String name, GraphicInfo graphicInfo, boolean thickBorder, double scaleFactor) { + + Paint originalPaint = g.getPaint(); + int x = (int) graphicInfo.getX(); + int y = (int) graphicInfo.getY(); + int width = (int) graphicInfo.getWidth(); + int height = (int) graphicInfo.getHeight(); + + // Create a new gradient paint for every task box, gradient depends on x and y and is not relative + g.setPaint(TASK_BOX_COLOR); + + int arcR = 6; + if (thickBorder) { + arcR = 3; + } + + // shape + RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, arcR, arcR); + g.fill(rect); + g.setPaint(TASK_BORDER_COLOR); + + if (thickBorder) { + Stroke originalStroke = g.getStroke(); + g.setStroke(THICK_TASK_BORDER_STROKE); + g.draw(rect); + g.setStroke(originalStroke); + } else { + g.draw(rect); + } + + g.setPaint(originalPaint); + // text + if (scaleFactor == 1.0 && name != null && name.length() > 0) { + int boxWidth = width - (2 * TEXT_PADDING); + int boxHeight = height - 16 - ICON_PADDING - ICON_PADDING - MARKER_WIDTH - 2 - 2; + int boxX = x + width / 2 - boxWidth / 2; + int boxY = y + height / 2 - boxHeight / 2 + ICON_PADDING + ICON_PADDING - 2 - 2; + + drawMultilineCentredText(name, boxX, boxY, boxWidth, boxHeight); + } + } + + protected static Color EVENT_COLOR = new Color(255, 255, 255); + + /** + * 閲嶅啓寮�濮嬩簨浠� + * @param graphicInfo + * @param image + * @param scaleFactor + */ + @Override + public void drawStartEvent(GraphicInfo graphicInfo, BufferedImage image, double scaleFactor) { + Paint originalPaint = g.getPaint(); + g.setPaint(EVENT_COLOR); + Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(), + graphicInfo.getWidth(), graphicInfo.getHeight()); + g.fill(circle); + g.setPaint(EVENT_BORDER_COLOR); + g.draw(circle); + g.setPaint(originalPaint); + if (image != null) { + // calculate coordinates to center image + int imageX = (int) Math.round(graphicInfo.getX() + (graphicInfo.getWidth() / 2) - (image.getWidth() / (2 * scaleFactor))); + int imageY = (int) Math.round(graphicInfo.getY() + (graphicInfo.getHeight() / 2) - (image.getHeight() / (2 * scaleFactor))); + g.drawImage(image, imageX, imageY, + (int) (image.getWidth() / scaleFactor), (int) (image.getHeight() / scaleFactor), null); + } + + } + + /** + * 閲嶅啓缁撴潫浜嬩欢 + * @param graphicInfo + * @param scaleFactor + */ + @Override + public void drawNoneEndEvent(GraphicInfo graphicInfo, double scaleFactor) { + Paint originalPaint = g.getPaint(); + Stroke originalStroke = g.getStroke(); + g.setPaint(EVENT_COLOR); + Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(), + graphicInfo.getWidth(), graphicInfo.getHeight()); + g.fill(circle); + g.setPaint(EVENT_BORDER_COLOR); +// g.setPaint(HIGHLIGHT_COLOR); + if (scaleFactor == 1.0) { + g.setStroke(END_EVENT_STROKE); + } else { + g.setStroke(new BasicStroke(2.0f)); + } + g.draw(circle); + g.setStroke(originalStroke); + g.setPaint(originalPaint); + } +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/CustomProcessDiagramGenerator.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/CustomProcessDiagramGenerator.java new file mode 100644 index 0000000..38c8080 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/CustomProcessDiagramGenerator.java @@ -0,0 +1,402 @@ +package org.jeecg.modules.flowable.flow; + + +import org.flowable.bpmn.model.Process; +import org.flowable.bpmn.model.*; +import org.flowable.image.impl.DefaultProcessDiagramCanvas; +import org.flowable.image.impl.DefaultProcessDiagramGenerator; + +import java.util.Iterator; +import java.util.List; + +/** + */ +public class CustomProcessDiagramGenerator extends DefaultProcessDiagramGenerator { + @Override + protected DefaultProcessDiagramCanvas generateProcessDiagram(BpmnModel bpmnModel, String imageType, List<String> highLightedActivities, List<String> highLightedFlows, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader, double scaleFactor, boolean drawSequenceFlowNameWithNoLabelDI) { + this.prepareBpmnModel(bpmnModel); + DefaultProcessDiagramCanvas processDiagramCanvas = initProcessDiagramCanvas(bpmnModel, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader); + Iterator var13 = bpmnModel.getPools().iterator(); + + while (var13.hasNext()) { + Pool process = (Pool) var13.next(); + GraphicInfo subProcesses = bpmnModel.getGraphicInfo(process.getId()); + processDiagramCanvas.drawPoolOrLane(process.getName(), subProcesses, scaleFactor); + } + + var13 = bpmnModel.getProcesses().iterator(); + + Process process1; + Iterator subProcesses1; + while (var13.hasNext()) { + process1 = (Process) var13.next(); + subProcesses1 = process1.getLanes().iterator(); + + while (subProcesses1.hasNext()) { + Lane artifact = (Lane) subProcesses1.next(); + GraphicInfo subProcess = bpmnModel.getGraphicInfo(artifact.getId()); + processDiagramCanvas.drawPoolOrLane(artifact.getName(), subProcess, scaleFactor); + } + } + + var13 = bpmnModel.getProcesses().iterator(); + + while (var13.hasNext()) { + process1 = (Process) var13.next(); + subProcesses1 = process1.findFlowElementsOfType(FlowNode.class).iterator(); + + while (subProcesses1.hasNext()) { + FlowNode artifact1 = (FlowNode) subProcesses1.next(); + if (!this.isPartOfCollapsedSubProcess(artifact1, bpmnModel)) { + this.drawActivity(processDiagramCanvas, bpmnModel, artifact1, highLightedActivities, highLightedFlows, scaleFactor, Boolean.valueOf(drawSequenceFlowNameWithNoLabelDI)); + } + } + } + + var13 = bpmnModel.getProcesses().iterator(); + + label75: + while (true) { + List subProcesses2; + do { + if (!var13.hasNext()) { + return processDiagramCanvas; + } + + process1 = (Process) var13.next(); + subProcesses1 = process1.getArtifacts().iterator(); + + while (subProcesses1.hasNext()) { + Artifact artifact2 = (Artifact) subProcesses1.next(); + this.drawArtifact(processDiagramCanvas, bpmnModel, artifact2); + } + + subProcesses2 = process1.findFlowElementsOfType(SubProcess.class, true); + } while (subProcesses2 == null); + + Iterator artifact3 = subProcesses2.iterator(); + + while (true) { + GraphicInfo graphicInfo; + SubProcess subProcess1; + do { + do { + if (!artifact3.hasNext()) { + continue label75; + } + + subProcess1 = (SubProcess) artifact3.next(); + graphicInfo = bpmnModel.getGraphicInfo(subProcess1.getId()); + } while (graphicInfo != null && graphicInfo.getExpanded() != null && !graphicInfo.getExpanded().booleanValue()); + } while (this.isPartOfCollapsedSubProcess(subProcess1, bpmnModel)); + + Iterator var19 = subProcess1.getArtifacts().iterator(); + + while (var19.hasNext()) { + Artifact subProcessArtifact = (Artifact) var19.next(); + this.drawArtifact(processDiagramCanvas, bpmnModel, subProcessArtifact); + } + } + } + } + + protected static DefaultProcessDiagramCanvas initProcessDiagramCanvas(BpmnModel bpmnModel, String imageType, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) { + double minX = 1.7976931348623157E308D; + double maxX = 0.0D; + double minY = 1.7976931348623157E308D; + double maxY = 0.0D; + + GraphicInfo nrOfLanes; + for (Iterator flowNodes = bpmnModel.getPools().iterator(); flowNodes.hasNext(); maxY = nrOfLanes.getY() + nrOfLanes.getHeight()) { + Pool artifacts = (Pool) flowNodes.next(); + nrOfLanes = bpmnModel.getGraphicInfo(artifacts.getId()); + minX = nrOfLanes.getX(); + maxX = nrOfLanes.getX() + nrOfLanes.getWidth(); + minY = nrOfLanes.getY(); + } + + List var23 = gatherAllFlowNodes(bpmnModel); + Iterator var24 = var23.iterator(); + + label155: + while (var24.hasNext()) { + FlowNode var26 = (FlowNode) var24.next(); + GraphicInfo artifact = bpmnModel.getGraphicInfo(var26.getId()); + if (artifact.getX() + artifact.getWidth() > maxX) { + maxX = artifact.getX() + artifact.getWidth(); + } + + if (artifact.getX() < minX) { + minX = artifact.getX(); + } + + if (artifact.getY() + artifact.getHeight() > maxY) { + maxY = artifact.getY() + artifact.getHeight(); + } + + if (artifact.getY() < minY) { + minY = artifact.getY(); + } + + Iterator process = var26.getOutgoingFlows().iterator(); + + while (true) { + List l; + do { + if (!process.hasNext()) { + continue label155; + } + + SequenceFlow graphicInfoList = (SequenceFlow) process.next(); + l = bpmnModel.getFlowLocationGraphicInfo(graphicInfoList.getId()); + } while (l == null); + + Iterator graphicInfo = l.iterator(); + + while (graphicInfo.hasNext()) { + GraphicInfo graphicInfo1 = (GraphicInfo) graphicInfo.next(); + if (graphicInfo1.getX() > maxX) { + maxX = graphicInfo1.getX(); + } + + if (graphicInfo1.getX() < minX) { + minX = graphicInfo1.getX(); + } + + if (graphicInfo1.getY() > maxY) { + maxY = graphicInfo1.getY(); + } + + if (graphicInfo1.getY() < minY) { + minY = graphicInfo1.getY(); + } + } + } + } + + List var25 = gatherAllArtifacts(bpmnModel); + Iterator var27 = var25.iterator(); + + GraphicInfo var37; + while (var27.hasNext()) { + Artifact var29 = (Artifact) var27.next(); + GraphicInfo var31 = bpmnModel.getGraphicInfo(var29.getId()); + if (var31 != null) { + if (var31.getX() + var31.getWidth() > maxX) { + maxX = var31.getX() + var31.getWidth(); + } + + if (var31.getX() < minX) { + minX = var31.getX(); + } + + if (var31.getY() + var31.getHeight() > maxY) { + maxY = var31.getY() + var31.getHeight(); + } + + if (var31.getY() < minY) { + minY = var31.getY(); + } + } + + List var33 = bpmnModel.getFlowLocationGraphicInfo(var29.getId()); + if (var33 != null) { + Iterator var35 = var33.iterator(); + + while (var35.hasNext()) { + var37 = (GraphicInfo) var35.next(); + if (var37.getX() > maxX) { + maxX = var37.getX(); + } + + if (var37.getX() < minX) { + minX = var37.getX(); + } + + if (var37.getY() > maxY) { + maxY = var37.getY(); + } + + if (var37.getY() < minY) { + minY = var37.getY(); + } + } + } + } + + int var28 = 0; + Iterator var30 = bpmnModel.getProcesses().iterator(); + + while (var30.hasNext()) { + Process var32 = (Process) var30.next(); + Iterator var34 = var32.getLanes().iterator(); + + while (var34.hasNext()) { + Lane var36 = (Lane) var34.next(); + ++var28; + var37 = bpmnModel.getGraphicInfo(var36.getId()); + if (var37.getX() + var37.getWidth() > maxX) { + maxX = var37.getX() + var37.getWidth(); + } + + if (var37.getX() < minX) { + minX = var37.getX(); + } + + if (var37.getY() + var37.getHeight() > maxY) { + maxY = var37.getY() + var37.getHeight(); + } + + if (var37.getY() < minY) { + minY = var37.getY(); + } + } + } + + if (var23.isEmpty() && bpmnModel.getPools().isEmpty() && var28 == 0) { + minX = 0.0D; + minY = 0.0D; + } + + return new CustomProcessDiagramCanvas((int) maxX + 10, (int) maxY + 10, (int) minX, (int) minY, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader); + } + + + private static void drawHighLight(DefaultProcessDiagramCanvas processDiagramCanvas, GraphicInfo graphicInfo) { + processDiagramCanvas.drawHighLight((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight()); + + } + + private static void drawHighLightNow(CustomProcessDiagramCanvas processDiagramCanvas, GraphicInfo graphicInfo) { + processDiagramCanvas.drawHighLightNow((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight()); + + } + + private static void drawHighLightEnd(CustomProcessDiagramCanvas processDiagramCanvas, GraphicInfo graphicInfo) { + processDiagramCanvas.drawHighLightEnd((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight()); + + } + + @Override + protected void drawActivity(DefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, + FlowNode flowNode, List<String> highLightedActivities, List<String> highLightedFlows, double scaleFactor, Boolean drawSequenceFlowNameWithNoLabelDI) { + + DefaultProcessDiagramGenerator.ActivityDrawInstruction drawInstruction = activityDrawInstructions.get(flowNode.getClass()); + if (drawInstruction != null) { + + drawInstruction.draw(processDiagramCanvas, bpmnModel, flowNode); + + // Gather info on the multi instance marker + boolean multiInstanceSequential = false; + boolean multiInstanceParallel = false; + boolean collapsed = false; + if (flowNode instanceof Activity) { + Activity activity = (Activity) flowNode; + MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = activity.getLoopCharacteristics(); + if (multiInstanceLoopCharacteristics != null) { + multiInstanceSequential = multiInstanceLoopCharacteristics.isSequential(); + multiInstanceParallel = !multiInstanceSequential; + } + } + + // Gather info on the collapsed marker + GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId()); + if (flowNode instanceof SubProcess) { + collapsed = graphicInfo.getExpanded() != null && !graphicInfo.getExpanded(); + } else if (flowNode instanceof CallActivity) { + collapsed = true; + } + + if (scaleFactor == 1.0) { + // Actually draw the markers + processDiagramCanvas.drawActivityMarkers((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight(), + multiInstanceSequential, multiInstanceParallel, collapsed); + } + + // Draw highlighted activities + if (highLightedActivities.contains(flowNode.getId())) { + + if (highLightedActivities.get(highLightedActivities.size() - 1).equals(flowNode.getId()) + && !"endenv".equals(flowNode.getId())) { + if ((flowNode.getId().contains("Event_"))) { + drawHighLightEnd((CustomProcessDiagramCanvas) processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId())); + } else { + drawHighLightNow((CustomProcessDiagramCanvas) processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId())); + } + } else { + drawHighLight(processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId())); + } + + + } + + } + + // Outgoing transitions of activity + for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) { + boolean highLighted = (highLightedFlows.contains(sequenceFlow.getId())); + String defaultFlow = null; + if (flowNode instanceof Activity) { + defaultFlow = ((Activity) flowNode).getDefaultFlow(); + } else if (flowNode instanceof Gateway) { + defaultFlow = ((Gateway) flowNode).getDefaultFlow(); + } + + boolean isDefault = false; + if (defaultFlow != null && defaultFlow.equalsIgnoreCase(sequenceFlow.getId())) { + isDefault = true; + } + boolean drawConditionalIndicator = sequenceFlow.getConditionExpression() != null && !(flowNode instanceof Gateway); + + String sourceRef = sequenceFlow.getSourceRef(); + String targetRef = sequenceFlow.getTargetRef(); + FlowElement sourceElement = bpmnModel.getFlowElement(sourceRef); + FlowElement targetElement = bpmnModel.getFlowElement(targetRef); + List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(sequenceFlow.getId()); + if (graphicInfoList != null && graphicInfoList.size() > 0) { + graphicInfoList = connectionPerfectionizer(processDiagramCanvas, bpmnModel, sourceElement, targetElement, graphicInfoList); + int xPoints[] = new int[graphicInfoList.size()]; + int yPoints[] = new int[graphicInfoList.size()]; + + for (int i = 1; i < graphicInfoList.size(); i++) { + GraphicInfo graphicInfo = graphicInfoList.get(i); + GraphicInfo previousGraphicInfo = graphicInfoList.get(i - 1); + + if (i == 1) { + xPoints[0] = (int) previousGraphicInfo.getX(); + yPoints[0] = (int) previousGraphicInfo.getY(); + } + xPoints[i] = (int) graphicInfo.getX(); + yPoints[i] = (int) graphicInfo.getY(); + + } + + processDiagramCanvas.drawSequenceflow(xPoints, yPoints, drawConditionalIndicator, isDefault, highLighted, scaleFactor); + + + // Draw sequenceflow label + GraphicInfo labelGraphicInfo = bpmnModel.getLabelGraphicInfo(sequenceFlow.getId()); + if (labelGraphicInfo != null) { + processDiagramCanvas.drawLabel(sequenceFlow.getName(), labelGraphicInfo, false); + } else { + if (drawSequenceFlowNameWithNoLabelDI) { + GraphicInfo lineCenter = getLineCenter(graphicInfoList); + processDiagramCanvas.drawLabel(sequenceFlow.getName(), lineCenter, false); + } + + } + } + } + + // Nested elements + if (flowNode instanceof FlowElementsContainer) { + for (FlowElement nestedFlowElement : ((FlowElementsContainer) flowNode).getFlowElements()) { + if (nestedFlowElement instanceof FlowNode && !isPartOfCollapsedSubProcess(nestedFlowElement, bpmnModel)) { + drawActivity(processDiagramCanvas, bpmnModel, (FlowNode) nestedFlowElement, + highLightedActivities, highLightedFlows, scaleFactor, drawSequenceFlowNameWithNoLabelDI); + } + } + } + } +} + diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/FindNextNodeUtil.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/FindNextNodeUtil.java new file mode 100644 index 0000000..c3b0c12 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/FindNextNodeUtil.java @@ -0,0 +1,235 @@ +package org.jeecg.modules.flowable.flow; + +import com.google.common.collect.Maps; +import com.greenpineyu.fel.FelEngine; +import com.greenpineyu.fel.FelEngineImpl; +import com.greenpineyu.fel.context.FelContext; +import org.flowable.bpmn.model.Process; +import org.flowable.bpmn.model.*; +import org.flowable.engine.RepositoryService; +import org.flowable.engine.repository.ProcessDefinition; + +import java.util.*; + +/** + */ +public class FindNextNodeUtil { + + /** + * 鑾峰彇涓嬩竴姝ラ鐨勭敤鎴蜂换鍔� + * + * @param repositoryService + * @param map + * @return + */ + public static List<UserTask> getNextUserTasks(RepositoryService repositoryService, org.flowable.task.api.Task task, Map<String, Object> map) { + List<UserTask> data = new ArrayList<>(); + ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult(); + BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId()); + Process mainProcess = bpmnModel.getMainProcess(); + Collection<FlowElement> flowElements = mainProcess.getFlowElements(); + String key = task.getTaskDefinitionKey(); + FlowElement flowElement = bpmnModel.getFlowElement(key); + next(flowElements, flowElement, map, data); + return data; + } + + public static void next(Collection<FlowElement> flowElements, FlowElement flowElement, Map<String, Object> map, List<UserTask> nextUser) { + //濡傛灉鏄粨鏉熻妭鐐� + if (flowElement instanceof EndEvent) { + //濡傛灉鏄瓙浠诲姟鐨勭粨鏉熻妭鐐� + if (getSubProcess(flowElements, flowElement) != null) { + flowElement = getSubProcess(flowElements, flowElement); + } + } + //鑾峰彇Task鐨勫嚭绾夸俊鎭�--鍙互鎷ユ湁澶氫釜 + List<SequenceFlow> outGoingFlows = null; + if (flowElement instanceof Task) { + outGoingFlows = ((Task) flowElement).getOutgoingFlows(); + } else if (flowElement instanceof Gateway) { + outGoingFlows = ((Gateway) flowElement).getOutgoingFlows(); + } else if (flowElement instanceof StartEvent) { + outGoingFlows = ((StartEvent) flowElement).getOutgoingFlows(); + } else if (flowElement instanceof SubProcess) { + outGoingFlows = ((SubProcess) flowElement).getOutgoingFlows(); + } else if (flowElement instanceof CallActivity) { + outGoingFlows = ((CallActivity) flowElement).getOutgoingFlows(); + } + if (outGoingFlows != null && outGoingFlows.size() > 0) { + //閬嶅巻鎵�鏈夌殑鍑虹嚎--鎵惧埌鍙互姝g‘鎵ц鐨勯偅涓�鏉� + for (SequenceFlow sequenceFlow : outGoingFlows) { + //1.鏈夎〃杈惧紡锛屼笖涓簍rue + //2.鏃犺〃杈惧紡 + String expression = sequenceFlow.getConditionExpression(); + if (expression == null ||Boolean.parseBoolean( + String.valueOf( + result(map, expression.substring(expression.lastIndexOf("{") + 1, expression.lastIndexOf("}")))))) { + //鍑虹嚎鐨勪笅涓�鑺傜偣 + String nextFlowElementID = sequenceFlow.getTargetRef(); + if (checkSubProcess(nextFlowElementID, flowElements, nextUser)) { + continue; + } + + //鏌ヨ涓嬩竴鑺傜偣鐨勪俊鎭� + FlowElement nextFlowElement = getFlowElementById(nextFlowElementID, flowElements); + //璋冪敤娴佺▼ + if (nextFlowElement instanceof CallActivity) { + CallActivity ca = (CallActivity) nextFlowElement; + if (ca.getLoopCharacteristics() != null) { + UserTask userTask = new UserTask(); + userTask.setId(ca.getId()); + + userTask.setId(ca.getId()); + userTask.setLoopCharacteristics(ca.getLoopCharacteristics()); + userTask.setName(ca.getName()); + nextUser.add(userTask); + } + next(flowElements, nextFlowElement, map, nextUser); + } + //鐢ㄦ埛浠诲姟 + if (nextFlowElement instanceof UserTask) { + nextUser.add((UserTask) nextFlowElement); + } + //鎺掍粬缃戝叧 + else if (nextFlowElement instanceof ExclusiveGateway) { + next(flowElements, nextFlowElement, map, nextUser); + } + //骞惰缃戝叧 + else if (nextFlowElement instanceof ParallelGateway) { + next(flowElements, nextFlowElement, map, nextUser); + } + //鎺ユ敹浠诲姟 + else if (nextFlowElement instanceof ReceiveTask) { + next(flowElements, nextFlowElement, map, nextUser); + } + //鏈嶅姟浠诲姟 + else if (nextFlowElement instanceof ServiceTask) { + next(flowElements, nextFlowElement, map, nextUser); + } + //瀛愪换鍔$殑璧风偣 + else if (nextFlowElement instanceof StartEvent) { + next(flowElements, nextFlowElement, map, nextUser); + } + //缁撴潫鑺傜偣 + else if (nextFlowElement instanceof EndEvent) { + next(flowElements, nextFlowElement, map, nextUser); + } + } + } + } + } + + /** + * 鍒ゆ柇鏄惁鏄瀹炰緥瀛愭祦绋嬪苟涓旈渶瑕佽缃泦鍚堢被鍨嬪彉閲� + */ + public static boolean checkSubProcess(String Id, Collection<FlowElement> flowElements, List<UserTask> nextUser) { + for (FlowElement flowElement1 : flowElements) { + if (flowElement1 instanceof SubProcess && flowElement1.getId().equals(Id)) { + + SubProcess sp = (SubProcess) flowElement1; + if (sp.getLoopCharacteristics() != null) { + String inputDataItem = sp.getLoopCharacteristics().getInputDataItem(); + UserTask userTask = new UserTask(); + userTask.setId(sp.getId()); + userTask.setLoopCharacteristics(sp.getLoopCharacteristics()); + userTask.setName(sp.getName()); + nextUser.add(userTask); + return true; + } + } + } + + return false; + + } + + /** + * 鏌ヨ涓�涓妭鐐圭殑鏄惁瀛愪换鍔′腑鐨勮妭鐐癸紝濡傛灉鏄紝杩斿洖瀛愪换鍔� + * + * @param flowElements 鍏ㄦ祦绋嬬殑鑺傜偣闆嗗悎 + * @param flowElement 褰撳墠鑺傜偣 + * @return + */ + public static FlowElement getSubProcess(Collection<FlowElement> flowElements, FlowElement flowElement) { + for (FlowElement flowElement1 : flowElements) { + if (flowElement1 instanceof SubProcess) { + for (FlowElement flowElement2 : ((SubProcess) flowElement1).getFlowElements()) { + if (flowElement.equals(flowElement2)) { + return flowElement1; + } + } + } + } + return null; + } + + + /** + * 鏍规嵁ID鏌ヨ娴佺▼鑺傜偣瀵硅薄, 濡傛灉鏄瓙浠诲姟锛屽垯杩斿洖瀛愪换鍔$殑寮�濮嬭妭鐐� + * + * @param Id 鑺傜偣ID + * @param flowElements 娴佺▼鑺傜偣闆嗗悎 + * @return + */ + public static FlowElement getFlowElementById(String Id, Collection<FlowElement> flowElements) { + for (FlowElement flowElement : flowElements) { + if (flowElement.getId().equals(Id)) { + //濡傛灉鏄瓙浠诲姟锛屽垯鏌ヨ鍑哄瓙浠诲姟鐨勫紑濮嬭妭鐐� + if (flowElement instanceof SubProcess) { + return getStartFlowElement(((SubProcess) flowElement).getFlowElements()); + } + return flowElement; + } + if (flowElement instanceof SubProcess) { + FlowElement flowElement1 = getFlowElementById(Id, ((SubProcess) flowElement).getFlowElements()); + if (flowElement1 != null) { + return flowElement1; + } + } + } + return null; + } + + /** + * 杩斿洖娴佺▼鐨勫紑濮嬭妭鐐� + * + * @param flowElements 鑺傜偣闆嗗悎 + * @description: + */ + public static FlowElement getStartFlowElement(Collection<FlowElement> flowElements) { + for (FlowElement flowElement : flowElements) { + if (flowElement instanceof StartEvent) { + return flowElement; + } + } + return null; + } + + /** + * 鏍¢獙el琛ㄨ揪绀轰緥 + * + * @param map + * @param expression + * @return + */ + public static Object result(Map<String, Object> map, String expression) { + FelEngine fel = new FelEngineImpl(); + FelContext ctx = fel.getContext(); + for (Map.Entry<String, Object> entry : map.entrySet()) { + ctx.set(entry.getKey(), entry.getValue()); + } + Object result = fel.eval(expression); + return result; + } + + public static void main(String[] args) { + HashMap<String, Object> objectObjectHashMap = Maps.newHashMap(); + objectObjectHashMap.put("a",100); + objectObjectHashMap.put("b",200); + objectObjectHashMap.put("c","abc"); + Object result = result(objectObjectHashMap, "a!=00&&b=='200'&&c=='abc'"); + System.out.println(result); + } + + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/FlowableConfig.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/FlowableConfig.java new file mode 100644 index 0000000..468cb9e --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/FlowableConfig.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.flowable.flow; + +import org.flowable.spring.SpringProcessEngineConfiguration; +import org.flowable.spring.boot.EngineConfigurationConfigurer; +import org.springframework.context.annotation.Configuration; + + +/** + */ +@Configuration +public class FlowableConfig implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> { + + @Override + public void configure(SpringProcessEngineConfiguration engineConfiguration) { + engineConfiguration.setActivityFontName("瀹嬩綋"); + engineConfiguration.setLabelFontName("瀹嬩綋"); + engineConfiguration.setAnnotationFontName("瀹嬩綋"); + + } +} + diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/FlowableUtils.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/FlowableUtils.java new file mode 100644 index 0000000..cd2aac5 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/flow/FlowableUtils.java @@ -0,0 +1,587 @@ +package org.jeecg.modules.flowable.flow; + +import lombok.extern.slf4j.Slf4j; +import org.flowable.bpmn.model.*; +import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior; +import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior; +import org.flowable.task.api.history.HistoricTaskInstance; + +import java.util.*; + +/** + */ +@Slf4j +public class FlowableUtils { + + /** + * 鏍规嵁鑺傜偣锛岃幏鍙栧叆鍙h繛绾� + * @param source + * @return + */ + public static List<SequenceFlow> getElementIncomingFlows(FlowElement source) { + List<SequenceFlow> sequenceFlows = null; + if (source instanceof FlowNode) { + sequenceFlows = ((FlowNode) source).getIncomingFlows(); + } else if (source instanceof Gateway) { + sequenceFlows = ((Gateway) source).getIncomingFlows(); + } else if (source instanceof SubProcess) { + sequenceFlows = ((SubProcess) source).getIncomingFlows(); + } else if (source instanceof StartEvent) { + sequenceFlows = ((StartEvent) source).getIncomingFlows(); + } else if (source instanceof EndEvent) { + sequenceFlows = ((EndEvent) source).getIncomingFlows(); + } + return sequenceFlows; + } + + /** + * 鏍规嵁鑺傜偣锛岃幏鍙栧嚭鍙h繛绾� + * @param source + * @return + */ + public static List<SequenceFlow> getElementOutgoingFlows(FlowElement source) { + List<SequenceFlow> sequenceFlows = null; + if (source instanceof FlowNode) { + sequenceFlows = ((FlowNode) source).getOutgoingFlows(); + } else if (source instanceof Gateway) { + sequenceFlows = ((Gateway) source).getOutgoingFlows(); + } else if (source instanceof SubProcess) { + sequenceFlows = ((SubProcess) source).getOutgoingFlows(); + } else if (source instanceof StartEvent) { + sequenceFlows = ((StartEvent) source).getOutgoingFlows(); + } else if (source instanceof EndEvent) { + sequenceFlows = ((EndEvent) source).getOutgoingFlows(); + } + return sequenceFlows; + } + + /** + * 鑾峰彇鍏ㄩ儴鑺傜偣鍒楄〃锛屽寘鍚瓙娴佺▼鑺傜偣 + * @param flowElements + * @param allElements + * @return + */ + public static Collection<FlowElement> getAllElements(Collection<FlowElement> flowElements, Collection<FlowElement> allElements) { + allElements = allElements == null ? new ArrayList<>() : allElements; + + for (FlowElement flowElement : flowElements) { + allElements.add(flowElement); + if (flowElement instanceof SubProcess) { + // 缁х画娣卞叆瀛愭祦绋嬶紝杩涗竴姝ヨ幏鍙栧瓙娴佺▼ + allElements = FlowableUtils.getAllElements(((SubProcess) flowElement).getFlowElements(), allElements); + } + } + return allElements; + } + + /** + * 杩唬鑾峰彇鐖剁骇浠诲姟鑺傜偣鍒楄〃锛屽悜鍓嶆壘 + * @param source 璧峰鑺傜偣 + * @param hasSequenceFlow 宸茬粡缁忚繃鐨勮繛绾跨殑 ID锛岀敤浜庡垽鏂嚎璺槸鍚﹂噸澶� + * @param userTaskList 宸叉壘鍒扮殑鐢ㄦ埛浠诲姟鑺傜偣 + * @return + */ + public static List<UserTask> iteratorFindParentUserTasks(FlowElement source, Set<String> hasSequenceFlow, List<UserTask> userTaskList) { + userTaskList = userTaskList == null ? new ArrayList<>() : userTaskList; + hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow; + + // 濡傛灉璇ヨ妭鐐逛负寮�濮嬭妭鐐癸紝涓斿瓨鍦ㄤ笂绾у瓙鑺傜偣锛屽垯椤虹潃涓婄骇瀛愯妭鐐圭户缁凯浠� + if (source instanceof StartEvent && source.getSubProcess() != null) { + userTaskList = iteratorFindParentUserTasks(source.getSubProcess(), hasSequenceFlow, userTaskList); + } + + // 鏍规嵁绫诲瀷锛岃幏鍙栧叆鍙h繛绾� + List<SequenceFlow> sequenceFlows = getElementIncomingFlows(source); + + if (sequenceFlows != null) { + // 寰幆鎵惧埌鐩爣鍏冪礌 + for (SequenceFlow sequenceFlow: sequenceFlows) { + // 濡傛灉鍙戠幇杩炵嚎閲嶅锛岃鏄庡惊鐜簡锛岃烦杩囪繖涓惊鐜� + if (hasSequenceFlow.contains(sequenceFlow.getId())) { + continue; + } + // 娣诲姞宸茬粡璧拌繃鐨勮繛绾� + hasSequenceFlow.add(sequenceFlow.getId()); + // 绫诲瀷涓虹敤鎴疯妭鐐癸紝鍒欐柊澧炵埗绾ц妭鐐� + if (sequenceFlow.getSourceFlowElement() instanceof UserTask) { + userTaskList.add((UserTask) sequenceFlow.getSourceFlowElement()); + continue; + } + // 绫诲瀷涓哄瓙娴佺▼锛屽垯娣诲姞瀛愭祦绋嬪紑濮嬭妭鐐瑰嚭鍙e鐩歌繛鐨勮妭鐐� + if (sequenceFlow.getSourceFlowElement() instanceof SubProcess) { + // 鑾峰彇瀛愭祦绋嬬敤鎴蜂换鍔¤妭鐐� + List<UserTask> childUserTaskList = findChildProcessUserTasks((StartEvent) ((SubProcess) sequenceFlow.getSourceFlowElement()).getFlowElements().toArray()[0], null, null); + // 濡傛灉鎵惧埌鑺傜偣锛屽垯璇存槑璇ョ嚎璺壘鍒拌妭鐐癸紝涓嶇户缁悜涓嬫壘锛屽弽涔嬬户缁� + if (childUserTaskList != null && childUserTaskList.size() > 0) { + userTaskList.addAll(childUserTaskList); + continue; + } + } + // 缁х画杩唬 + userTaskList = iteratorFindParentUserTasks(sequenceFlow.getSourceFlowElement(), hasSequenceFlow, userTaskList); + } + } + return userTaskList; + } + + /** + * 鏍规嵁姝e湪杩愯鐨勪换鍔¤妭鐐癸紝杩唬鑾峰彇瀛愮骇浠诲姟鑺傜偣鍒楄〃锛屽悜鍚庢壘 + * @param source 璧峰鑺傜偣 + * @param runTaskKeyList 姝e湪杩愯鐨勪换鍔� Key锛岀敤浜庢牎楠屼换鍔¤妭鐐规槸鍚︽槸姝e湪杩愯鐨勮妭鐐� + * @param hasSequenceFlow 宸茬粡缁忚繃鐨勮繛绾跨殑 ID锛岀敤浜庡垽鏂嚎璺槸鍚﹂噸澶� + * @param userTaskList 闇�瑕佹挙鍥炵殑鐢ㄦ埛浠诲姟鍒楄〃 + * @return + */ + public static List<UserTask> iteratorFindChildUserTasks(FlowElement source, List<String> runTaskKeyList, Set<String> hasSequenceFlow, List<UserTask> userTaskList) { + hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow; + userTaskList = userTaskList == null ? new ArrayList<>() : userTaskList; + + // 濡傛灉璇ヨ妭鐐逛负寮�濮嬭妭鐐癸紝涓斿瓨鍦ㄤ笂绾у瓙鑺傜偣锛屽垯椤虹潃涓婄骇瀛愯妭鐐圭户缁凯浠� + if (source instanceof EndEvent && source.getSubProcess() != null) { + userTaskList = iteratorFindChildUserTasks(source.getSubProcess(), runTaskKeyList, hasSequenceFlow, userTaskList); + } + + // 鏍规嵁绫诲瀷锛岃幏鍙栧嚭鍙h繛绾� + List<SequenceFlow> sequenceFlows = getElementOutgoingFlows(source); + + if (sequenceFlows != null) { + // 寰幆鎵惧埌鐩爣鍏冪礌 + for (SequenceFlow sequenceFlow: sequenceFlows) { + // 濡傛灉鍙戠幇杩炵嚎閲嶅锛岃鏄庡惊鐜簡锛岃烦杩囪繖涓惊鐜� + if (hasSequenceFlow.contains(sequenceFlow.getId())) { + continue; + } + // 娣诲姞宸茬粡璧拌繃鐨勮繛绾� + hasSequenceFlow.add(sequenceFlow.getId()); + // 濡傛灉涓虹敤鎴蜂换鍔$被鍨嬶紝涓斾换鍔¤妭鐐圭殑 Key 姝e湪杩愯鐨勪换鍔′腑瀛樺湪锛屾坊鍔� + if (sequenceFlow.getTargetFlowElement() instanceof UserTask && runTaskKeyList.contains((sequenceFlow.getTargetFlowElement()).getId())) { + userTaskList.add((UserTask) sequenceFlow.getTargetFlowElement()); + continue; + } + // 濡傛灉鑺傜偣涓哄瓙娴佺▼鑺傜偣鎯呭喌锛屽垯浠庤妭鐐逛腑鐨勭涓�涓妭鐐瑰紑濮嬭幏鍙� + if (sequenceFlow.getTargetFlowElement() instanceof SubProcess) { + List<UserTask> childUserTaskList = iteratorFindChildUserTasks((FlowElement) (((SubProcess) sequenceFlow.getTargetFlowElement()).getFlowElements().toArray()[0]), runTaskKeyList, hasSequenceFlow, null); + // 濡傛灉鎵惧埌鑺傜偣锛屽垯璇存槑璇ョ嚎璺壘鍒拌妭鐐癸紝涓嶇户缁悜涓嬫壘锛屽弽涔嬬户缁� + if (childUserTaskList != null && childUserTaskList.size() > 0) { + userTaskList.addAll(childUserTaskList); + continue; + } + } + // 缁х画杩唬 + userTaskList = iteratorFindChildUserTasks(sequenceFlow.getTargetFlowElement(), runTaskKeyList, hasSequenceFlow, userTaskList); + } + } + return userTaskList; + } + + /** + * 杩唬鑾峰彇瀛愭祦绋嬬敤鎴蜂换鍔¤妭鐐� + * @param source 璧峰鑺傜偣 + * @param hasSequenceFlow 宸茬粡缁忚繃鐨勮繛绾跨殑 ID锛岀敤浜庡垽鏂嚎璺槸鍚﹂噸澶� + * @param userTaskList 闇�瑕佹挙鍥炵殑鐢ㄦ埛浠诲姟鍒楄〃 + * @return + */ + public static List<UserTask> findChildProcessUserTasks(FlowElement source, Set<String> hasSequenceFlow, List<UserTask> userTaskList) { + hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow; + userTaskList = userTaskList == null ? new ArrayList<>() : userTaskList; + + // 鏍规嵁绫诲瀷锛岃幏鍙栧嚭鍙h繛绾� + List<SequenceFlow> sequenceFlows = getElementOutgoingFlows(source); + + if (sequenceFlows != null) { + // 寰幆鎵惧埌鐩爣鍏冪礌 + for (SequenceFlow sequenceFlow: sequenceFlows) { + // 濡傛灉鍙戠幇杩炵嚎閲嶅锛岃鏄庡惊鐜簡锛岃烦杩囪繖涓惊鐜� + if (hasSequenceFlow.contains(sequenceFlow.getId())) { + continue; + } + // 娣诲姞宸茬粡璧拌繃鐨勮繛绾� + hasSequenceFlow.add(sequenceFlow.getId()); + // 濡傛灉涓虹敤鎴蜂换鍔$被鍨嬶紝涓斾换鍔¤妭鐐圭殑 Key 姝e湪杩愯鐨勪换鍔′腑瀛樺湪锛屾坊鍔� + if (sequenceFlow.getTargetFlowElement() instanceof UserTask) { + userTaskList.add((UserTask) sequenceFlow.getTargetFlowElement()); + continue; + } + // 濡傛灉鑺傜偣涓哄瓙娴佺▼鑺傜偣鎯呭喌锛屽垯浠庤妭鐐逛腑鐨勭涓�涓妭鐐瑰紑濮嬭幏鍙� + if (sequenceFlow.getTargetFlowElement() instanceof SubProcess) { + List<UserTask> childUserTaskList = findChildProcessUserTasks((FlowElement) (((SubProcess) sequenceFlow.getTargetFlowElement()).getFlowElements().toArray()[0]), hasSequenceFlow, null); + // 濡傛灉鎵惧埌鑺傜偣锛屽垯璇存槑璇ョ嚎璺壘鍒拌妭鐐癸紝涓嶇户缁悜涓嬫壘锛屽弽涔嬬户缁� + if (childUserTaskList != null && childUserTaskList.size() > 0) { + userTaskList.addAll(childUserTaskList); + continue; + } + } + // 缁х画杩唬 + userTaskList = findChildProcessUserTasks(sequenceFlow.getTargetFlowElement(), hasSequenceFlow, userTaskList); + } + } + return userTaskList; + } + + /** + * 浠庡悗鍚戝墠瀵昏矾锛岃幏鍙栨墍鏈夎剰绾胯矾涓婄殑鐐� + * @param source 璧峰鑺傜偣 + * @param passRoads 宸茬粡缁忚繃鐨勭偣闆嗗悎 + * @param hasSequenceFlow 宸茬粡缁忚繃鐨勮繛绾跨殑 ID锛岀敤浜庡垽鏂嚎璺槸鍚﹂噸澶� + * @param targets 鐩爣鑴忕嚎璺粓鐐� + * @param dirtyRoads 纭畾涓鸿剰鏁版嵁鐨勭偣锛屽洜涓轰笉闇�瑕侀噸澶嶏紝鍥犳浣跨敤 set 瀛樺偍 + * @return + */ + public static Set<String> iteratorFindDirtyRoads(FlowElement source, List<String> passRoads, Set<String> hasSequenceFlow, List<String> targets, Set<String> dirtyRoads) { + passRoads = passRoads == null ? new ArrayList<>() : passRoads; + dirtyRoads = dirtyRoads == null ? new HashSet<>() : dirtyRoads; + hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow; + + // 濡傛灉璇ヨ妭鐐逛负寮�濮嬭妭鐐癸紝涓斿瓨鍦ㄤ笂绾у瓙鑺傜偣锛屽垯椤虹潃涓婄骇瀛愯妭鐐圭户缁凯浠� + if (source instanceof StartEvent && source.getSubProcess() != null) { + dirtyRoads = iteratorFindDirtyRoads(source.getSubProcess(), passRoads, hasSequenceFlow, targets, dirtyRoads); + } + + // 鏍规嵁绫诲瀷锛岃幏鍙栧叆鍙h繛绾� + List<SequenceFlow> sequenceFlows = getElementIncomingFlows(source); + + if (sequenceFlows != null) { + // 寰幆鎵惧埌鐩爣鍏冪礌 + for (SequenceFlow sequenceFlow: sequenceFlows) { + // 濡傛灉鍙戠幇杩炵嚎閲嶅锛岃鏄庡惊鐜簡锛岃烦杩囪繖涓惊鐜� + if (hasSequenceFlow.contains(sequenceFlow.getId())) { + continue; + } + // 娣诲姞宸茬粡璧拌繃鐨勮繛绾� + hasSequenceFlow.add(sequenceFlow.getId()); + // 鏂板缁忚繃鐨勮矾绾� + passRoads.add(sequenceFlow.getSourceFlowElement().getId()); + // 濡傛灉姝ょ偣涓虹洰鏍囩偣锛岀‘瀹氱粡杩囩殑璺嚎涓鸿剰绾胯矾锛屾坊鍔犵偣鍒拌剰绾胯矾涓紝鐒跺悗鎵句笅涓繛绾� + if (targets.contains(sequenceFlow.getSourceFlowElement().getId())) { + dirtyRoads.addAll(passRoads); + continue; + } + // 濡傛灉璇ヨ妭鐐逛负寮�濮嬭妭鐐癸紝涓斿瓨鍦ㄤ笂绾у瓙鑺傜偣锛屽垯椤虹潃涓婄骇瀛愯妭鐐圭户缁凯浠� + if (sequenceFlow.getSourceFlowElement() instanceof SubProcess) { + dirtyRoads = findChildProcessAllDirtyRoad((StartEvent) ((SubProcess) sequenceFlow.getSourceFlowElement()).getFlowElements().toArray()[0], null, dirtyRoads); + // 鏄惁瀛樺湪瀛愭祦绋嬩笂锛宼rue 鏄紝false 鍚� + Boolean isInChildProcess = dirtyTargetInChildProcess((StartEvent) ((SubProcess) sequenceFlow.getSourceFlowElement()).getFlowElements().toArray()[0], null, targets, null); + if (isInChildProcess) { + // 宸插湪瀛愭祦绋嬩笂鎵惧埌锛岃璺嚎缁撴潫 + continue; + } + } + // 缁х画杩唬 + dirtyRoads = iteratorFindDirtyRoads(sequenceFlow.getSourceFlowElement(), passRoads, hasSequenceFlow, targets, dirtyRoads); + } + } + return dirtyRoads; + } + + /** + * 杩唬鑾峰彇瀛愭祦绋嬭剰璺嚎 + * 璇存槑锛屽亣濡傚洖閫�鐨勭偣灏辨槸瀛愭祦绋嬶紝閭d箞涔熻偗瀹氫細鍥為��鍒板瓙娴佺▼鏈�鍒濈殑鐢ㄦ埛浠诲姟鑺傜偣锛屽洜姝ゅ瓙娴佺▼涓殑鑺傜偣鍏ㄦ槸鑴忚矾绾� + * @param source 璧峰鑺傜偣 + * @param hasSequenceFlow 宸茬粡缁忚繃鐨勮繛绾跨殑 ID锛岀敤浜庡垽鏂嚎璺槸鍚﹂噸澶� + * @param dirtyRoads 纭畾涓鸿剰鏁版嵁鐨勭偣锛屽洜涓轰笉闇�瑕侀噸澶嶏紝鍥犳浣跨敤 set 瀛樺偍 + * @return + */ + public static Set<String> findChildProcessAllDirtyRoad(FlowElement source, Set<String> hasSequenceFlow, Set<String> dirtyRoads) { + hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow; + dirtyRoads = dirtyRoads == null ? new HashSet<>() : dirtyRoads; + + // 鏍规嵁绫诲瀷锛岃幏鍙栧嚭鍙h繛绾� + List<SequenceFlow> sequenceFlows = getElementOutgoingFlows(source); + + if (sequenceFlows != null) { + // 寰幆鎵惧埌鐩爣鍏冪礌 + for (SequenceFlow sequenceFlow: sequenceFlows) { + // 濡傛灉鍙戠幇杩炵嚎閲嶅锛岃鏄庡惊鐜簡锛岃烦杩囪繖涓惊鐜� + if (hasSequenceFlow.contains(sequenceFlow.getId())) { + continue; + } + // 娣诲姞宸茬粡璧拌繃鐨勮繛绾� + hasSequenceFlow.add(sequenceFlow.getId()); + // 娣诲姞鑴忚矾绾� + dirtyRoads.add(sequenceFlow.getTargetFlowElement().getId()); + // 濡傛灉鑺傜偣涓哄瓙娴佺▼鑺傜偣鎯呭喌锛屽垯浠庤妭鐐逛腑鐨勭涓�涓妭鐐瑰紑濮嬭幏鍙� + if (sequenceFlow.getTargetFlowElement() instanceof SubProcess) { + dirtyRoads = findChildProcessAllDirtyRoad((FlowElement) (((SubProcess) sequenceFlow.getTargetFlowElement()).getFlowElements().toArray()[0]), hasSequenceFlow, dirtyRoads); + } + // 缁х画杩唬 + dirtyRoads = findChildProcessAllDirtyRoad(sequenceFlow.getTargetFlowElement(), hasSequenceFlow, dirtyRoads); + } + } + return dirtyRoads; + } + + /** + * 鍒ゆ柇鑴忚矾绾跨粨鏉熻妭鐐规槸鍚﹀湪瀛愭祦绋嬩笂 + * @param source 璧峰鑺傜偣 + * @param hasSequenceFlow 宸茬粡缁忚繃鐨勮繛绾跨殑 ID锛岀敤浜庡垽鏂嚎璺槸鍚﹂噸澶� + * @param targets 鍒ゆ柇鑴忚矾绾胯妭鐐规槸鍚﹀瓨鍦ㄥ瓙娴佺▼涓婏紝鍙瀛樺湪涓�涓紝璇存槑鑴忚矾绾垮彧鍒板瓙娴佺▼涓烘 + * @param inChildProcess 鏄惁瀛樺湪瀛愭祦绋嬩笂锛宼rue 鏄紝false 鍚� + * @return + */ + public static Boolean dirtyTargetInChildProcess(FlowElement source, Set<String> hasSequenceFlow, List<String> targets, Boolean inChildProcess) { + hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow; + inChildProcess = inChildProcess == null ? false : inChildProcess; + + // 鏍规嵁绫诲瀷锛岃幏鍙栧嚭鍙h繛绾� + List<SequenceFlow> sequenceFlows = getElementOutgoingFlows(source); + + if (sequenceFlows != null && !inChildProcess) { + // 寰幆鎵惧埌鐩爣鍏冪礌 + for (SequenceFlow sequenceFlow: sequenceFlows) { + // 濡傛灉鍙戠幇杩炵嚎閲嶅锛岃鏄庡惊鐜簡锛岃烦杩囪繖涓惊鐜� + if (hasSequenceFlow.contains(sequenceFlow.getId())) { + continue; + } + // 娣诲姞宸茬粡璧拌繃鐨勮繛绾� + hasSequenceFlow.add(sequenceFlow.getId()); + // 濡傛灉鍙戠幇鐩爣鐐瑰湪瀛愭祦绋嬩笂瀛樺湪锛岃鏄庡彧鍒板瓙娴佺▼涓烘 + if (targets.contains(sequenceFlow.getTargetFlowElement().getId())) { + inChildProcess = true; + break; + } + // 濡傛灉鑺傜偣涓哄瓙娴佺▼鑺傜偣鎯呭喌锛屽垯浠庤妭鐐逛腑鐨勭涓�涓妭鐐瑰紑濮嬭幏鍙� + if (sequenceFlow.getTargetFlowElement() instanceof SubProcess) { + inChildProcess = dirtyTargetInChildProcess((FlowElement) (((SubProcess) sequenceFlow.getTargetFlowElement()).getFlowElements().toArray()[0]), hasSequenceFlow, targets, inChildProcess); + } + // 缁х画杩唬 + inChildProcess = dirtyTargetInChildProcess(sequenceFlow.getTargetFlowElement(), hasSequenceFlow, targets, inChildProcess); + } + } + return inChildProcess; + } + + /** + * 杩唬浠庡悗鍚戝墠鎵弿锛屽垽鏂洰鏍囪妭鐐圭浉瀵逛簬褰撳墠鑺傜偣鏄惁鏄覆琛� + * 涓嶅瓨鍦ㄧ洿鎺ュ洖閫�鍒板瓙娴佺▼涓殑鎯呭喌锛屼絾瀛樺湪浠庡瓙娴佺▼鍑哄幓鍒扮埗娴佺▼鎯呭喌 + * @param source 璧峰鑺傜偣 + * @param isSequential 鏄惁涓茶 + * @param hasSequenceFlow 宸茬粡缁忚繃鐨勮繛绾跨殑 ID锛岀敤浜庡垽鏂嚎璺槸鍚﹂噸澶� + * @param targetKsy 鐩爣鑺傜偣 + * @return + */ + public static Boolean iteratorCheckSequentialReferTarget(FlowElement source, String targetKsy, Set<String> hasSequenceFlow, Boolean isSequential) { + isSequential = isSequential == null ? true : isSequential; + hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow; + + // 濡傛灉璇ヨ妭鐐逛负寮�濮嬭妭鐐癸紝涓斿瓨鍦ㄤ笂绾у瓙鑺傜偣锛屽垯椤虹潃涓婄骇瀛愯妭鐐圭户缁凯浠� + if (source instanceof StartEvent && source.getSubProcess() != null) { + isSequential = iteratorCheckSequentialReferTarget(source.getSubProcess(), targetKsy, hasSequenceFlow, isSequential); + } + + // 鏍规嵁绫诲瀷锛岃幏鍙栧叆鍙h繛绾� + List<SequenceFlow> sequenceFlows = getElementIncomingFlows(source); + + if (sequenceFlows != null) { + // 寰幆鎵惧埌鐩爣鍏冪礌 + for (SequenceFlow sequenceFlow: sequenceFlows) { + // 濡傛灉鍙戠幇杩炵嚎閲嶅锛岃鏄庡惊鐜簡锛岃烦杩囪繖涓惊鐜� + if (hasSequenceFlow.contains(sequenceFlow.getId())) { + continue; + } + // 娣诲姞宸茬粡璧拌繃鐨勮繛绾� + hasSequenceFlow.add(sequenceFlow.getId()); + // 濡傛灉鐩爣鑺傜偣宸茶鍒ゆ柇涓哄苟琛岋紝鍚庨潰閮戒笉闇�瑕佹墽琛岋紝鐩存帴杩斿洖 + if (isSequential == false) { + break; + } + // 杩欐潯绾胯矾瀛樺湪鐩爣鑺傜偣锛岃繖鏉$嚎璺畬鎴愶紝杩涘叆涓嬩釜绾胯矾 + if (targetKsy.equals(sequenceFlow.getSourceFlowElement().getId())) { + continue; + } + if (sequenceFlow.getSourceFlowElement() instanceof StartEvent) { + isSequential = false; + break; + } + // 鍚﹀垯灏辩户缁凯浠� + isSequential = iteratorCheckSequentialReferTarget(sequenceFlow.getSourceFlowElement(), targetKsy, hasSequenceFlow, isSequential); + } + } + return isSequential; + } + + /** + * 浠庡悗鍚戝墠瀵昏矾锛岃幏鍙栧埌杈捐妭鐐圭殑鎵�鏈夎矾绾� + * 涓嶅瓨鍦ㄧ洿鎺ュ洖閫�鍒板瓙娴佺▼锛屼絾鏄瓨鍦ㄥ洖閫�鍒扮埗绾ф祦绋嬬殑鎯呭喌 + * @param source 璧峰鑺傜偣 + * @param passRoads 宸茬粡缁忚繃鐨勭偣闆嗗悎 + * @param roads 璺嚎 + * @return + */ + public static List<List<UserTask>> findRoad(FlowElement source, List<UserTask> passRoads, Set<String> hasSequenceFlow, List<List<UserTask>> roads) { + passRoads = passRoads == null ? new ArrayList<>() : passRoads; + roads = roads == null ? new ArrayList<>() : roads; + hasSequenceFlow = hasSequenceFlow == null ? new HashSet<>() : hasSequenceFlow; + + // 濡傛灉璇ヨ妭鐐逛负寮�濮嬭妭鐐癸紝涓斿瓨鍦ㄤ笂绾у瓙鑺傜偣锛屽垯椤虹潃涓婄骇瀛愯妭鐐圭户缁凯浠� + if (source instanceof StartEvent && source.getSubProcess() != null) { + roads = findRoad(source.getSubProcess(), passRoads, hasSequenceFlow, roads); + } + + // 鏍规嵁绫诲瀷锛岃幏鍙栧叆鍙h繛绾� + List<SequenceFlow> sequenceFlows = getElementIncomingFlows(source); + + if (sequenceFlows != null && sequenceFlows.size() != 0) { + for (SequenceFlow sequenceFlow: sequenceFlows) { + // 濡傛灉鍙戠幇杩炵嚎閲嶅锛岃鏄庡惊鐜簡锛岃烦杩囪繖涓惊鐜� + if (hasSequenceFlow.contains(sequenceFlow.getId())) { + continue; + } + // 娣诲姞宸茬粡璧拌繃鐨勮繛绾� + hasSequenceFlow.add(sequenceFlow.getId()); + // 娣诲姞缁忚繃璺嚎 + if (sequenceFlow.getSourceFlowElement() instanceof UserTask) { + passRoads.add((UserTask) sequenceFlow.getSourceFlowElement()); + } + // 缁х画杩唬 + roads = findRoad(sequenceFlow.getSourceFlowElement(), passRoads, hasSequenceFlow, roads); + } + } else { + // 娣诲姞璺嚎 + roads.add(passRoads); + } + return roads; + } + + /** + * 鍘嗗彶鑺傜偣鏁版嵁娓呮礂锛屾竻娲楁帀鍙堝洖婊氬鑷寸殑鑴忔暟鎹� + * @param allElements 鍏ㄩ儴鑺傜偣淇℃伅 + * @param historicTaskInstanceList 鍘嗗彶浠诲姟瀹炰緥淇℃伅锛屾暟鎹噰鐢ㄥ紑濮嬫椂闂村崌搴� + * @return + */ + public static List<String> historicTaskInstanceClean(Collection<FlowElement> allElements, List<HistoricTaskInstance> historicTaskInstanceList) { + // 浼氱鑺傜偣鏀堕泦 + List<String> multiTask = new ArrayList<>(); + allElements.forEach(flowElement -> { + if (flowElement instanceof UserTask) { + // 濡傛灉璇ヨ妭鐐圭殑琛屼负涓轰細绛捐涓猴紝璇存槑璇ヨ妭鐐逛负浼氱鑺傜偣 + if (((UserTask) flowElement).getBehavior() instanceof ParallelMultiInstanceBehavior || ((UserTask) flowElement).getBehavior() instanceof SequentialMultiInstanceBehavior) { + multiTask.add(flowElement.getId()); + } + } + }); + // 寰幆鏀惧叆鏍堬紝鏍� LIFO锛氬悗杩涘厛鍑� + Stack<HistoricTaskInstance> stack = new Stack<>(); + historicTaskInstanceList.forEach(item -> stack.push(item)); + // 娓呮礂鍚庣殑鍘嗗彶浠诲姟瀹炰緥 + List<String> lastHistoricTaskInstanceList = new ArrayList<>(); + // 缃戝叧瀛樺湪鍙兘鍙蛋浜嗛儴鍒嗗垎鏀儏鍐碉紝涓旇繕瀛樺湪璺宠浆搴熷純鏁版嵁浠ュ強鍏朵粬鍒嗘敮鏁版嵁鐨勫共鎵帮紝鍥犳闇�瑕佸鍘嗗彶鑺傜偣鏁版嵁杩涜娓呮礂 + // 涓存椂鐢ㄦ埛浠诲姟 key + StringBuilder userTaskKey = null; + // 涓存椂琚垹鎺夌殑浠诲姟 key锛屽瓨鍦ㄥ苟琛屾儏鍐� + List<String> deleteKeyList = new ArrayList<>(); + // 涓存椂鑴忔暟鎹嚎璺� + List<Set<String>> dirtyDataLineList = new ArrayList<>(); + // 鐢辨煇涓偣璺冲埌浼氱鐐�,姝ゆ椂鍑虹幇澶氫釜浼氱瀹炰緥瀵瑰簲 1 涓烦杞儏鍐碉紝闇�瑕佹妸杩欎簺杩炵画鑴忔暟鎹兘鎵惧埌 + // 浼氱鐗规畩澶勭悊涓嬫爣 + int multiIndex = -1; + // 浼氱鐗规畩澶勭悊 key + StringBuilder multiKey = null; + // 浼氱鐗规畩澶勭悊鎿嶄綔鏍囪瘑 + boolean multiOpera = false; + while (!stack.empty()) { + // 浠庤繖閲屽紑濮� userTaskKey 閮借繕鏄笂涓爤鐨� key + // 鏄惁鏄剰鏁版嵁绾胯矾涓婄殑鐐� + final boolean[] isDirtyData = {false}; + for (Set<String> oldDirtyDataLine : dirtyDataLineList) { + if (oldDirtyDataLine.contains(stack.peek().getTaskDefinitionKey())) { + isDirtyData[0] = true; + } + } + // 鍒犻櫎鍘熷洜涓嶄负绌猴紝璇存槑浠庤繖鏉℃暟鎹紑濮嬪洖璺虫垨鑰呭洖閫�鐨� + // MI_END锛氫細绛惧畬鎴愬悗锛屽叾浠栨湭绛惧埌鑺傜偣鐨勫垹闄ゅ師鍥狅紝涓嶅湪澶勭悊鑼冨洿鍐� + if (stack.peek().getDeleteReason() != null && !stack.peek().getDeleteReason().equals("MI_END")) { + // 鍙互鐞嗚В涓鸿剰绾胯矾璧风偣 + String dirtyPoint = ""; + if (stack.peek().getDeleteReason().indexOf("Change activity to ") >= 0) { + dirtyPoint = stack.peek().getDeleteReason().replace("Change activity to ", ""); + } + // 浼氱鍥為��鍒犻櫎鍘熷洜鏈夌偣涓嶅悓 + if (stack.peek().getDeleteReason().indexOf("Change parent activity to ") >= 0) { + dirtyPoint = stack.peek().getDeleteReason().replace("Change parent activity to ", ""); + } + FlowElement dirtyTask = null; + // 鑾峰彇鍙樻洿鑺傜偣鐨勫搴旂殑鍏ュ彛澶勮繛绾� + // 濡傛灉鏄綉鍏冲苟琛屽洖閫�鎯呭喌锛屼細鍙樻垚涓ゆ潯鑴忔暟鎹矾绾匡紝鏁堟灉涓�鏍� + for (FlowElement flowElement : allElements) { + if (flowElement.getId().equals(stack.peek().getTaskDefinitionKey())) { + dirtyTask = flowElement; + } + } + // 鑾峰彇鑴忔暟鎹嚎璺� + Set<String> dirtyDataLine = FlowableUtils.iteratorFindDirtyRoads(dirtyTask, null, null, Arrays.asList(dirtyPoint.split(",")), null); + // 鑷繁鏈韩涔熸槸鑴忕嚎璺笂鐨勭偣锛屽姞杩涘幓 + dirtyDataLine.add(stack.peek().getTaskDefinitionKey()); + log.info(stack.peek().getTaskDefinitionKey() + "鐐硅剰璺嚎闆嗗悎锛�" + dirtyDataLine); + // 鏄叏鏂扮殑闇�瑕佹坊鍔犵殑鑴忕嚎璺� + boolean isNewDirtyData = true; + for (int i = 0; i < dirtyDataLineList.size(); i++) { + // 濡傛灉鍙戠幇浠栫殑涓婁釜鑺傜偣鍦ㄨ剰绾胯矾鍐咃紝璇存槑杩欎釜鐐瑰彲鑳芥槸骞惰鐨勮妭鐐癸紝鎴栬�呰繛缁┏鍥� + // 杩欐椂锛岄兘浠ヤ箣鍓嶇殑鑴忕嚎璺妭鐐逛负鏍囧噯锛屽彧闇�鍚堝苟鑴忕嚎璺嵆鍙紝涔熷氨鏄矾绾胯ˉ鍏� + if (dirtyDataLineList.get(i).contains(userTaskKey.toString())) { + isNewDirtyData = false; + dirtyDataLineList.get(i).addAll(dirtyDataLine); + } + } + // 宸茬‘瀹氭椂鍏ㄦ柊鐨勮剰绾胯矾 + if (isNewDirtyData) { + // deleteKey 鍗曚竴璺嚎椹冲洖鍒板苟琛岋紝杩欑鍚屾椂鐢熸垚澶氫釜鏂板疄渚嬭褰曟儏鍐碉紝杩欐椂 deleteKey 鍏跺疄鏄敱澶氫釜鍊肩粍鎴� + // 鎸夌収閫昏緫锛屽洖閫�鍚庣珛鍒荤敓鎴愮殑瀹炰緥璁板綍灏辨槸鍥為��鐨勮褰� + // 鑷充簬椹冲洖鎵�鐢熸垚鐨� Key锛岀洿鎺ヤ粠鍒犻櫎鍘熷洜涓幏鍙栵紝鍥犱负瀛樺湪椹冲洖鍒板苟琛岀殑鎯呭喌 + deleteKeyList.add(dirtyPoint + ","); + dirtyDataLineList.add(dirtyDataLine); + } + // 娣诲姞鍚庯紝鐜板湪杩欎釜鐐瑰彉鎴愯剰绾胯矾涓婄殑鐐逛簡 + isDirtyData[0] = true; + } + // 濡傛灉涓嶆槸鑴忕嚎璺笂鐨勭偣锛岃鏄庢槸鏈夋晥鏁版嵁锛屾坊鍔犲巻鍙插疄渚� Key + if (!isDirtyData[0]) { + lastHistoricTaskInstanceList.add(stack.peek().getTaskDefinitionKey()); + } + // 鏍¢獙鑴忕嚎璺槸鍚︾粨鏉� + for (int i = 0; i < deleteKeyList.size(); i ++) { + // 濡傛灉鍙戠幇鑴忔暟鎹睘浜庝細绛撅紝璁板綍涓嬩笅鏍囦笌瀵瑰簲 Key锛屼互澶囧悗缁瘮瀵癸紝浼氱鑴忔暟鎹寖鐣村紑濮� + if (multiKey == null && multiTask.contains(stack.peek().getTaskDefinitionKey()) + && deleteKeyList.get(i).contains(stack.peek().getTaskDefinitionKey())) { + multiIndex = i; + multiKey = new StringBuilder(stack.peek().getTaskDefinitionKey()); + } + // 浼氱鑴忔暟鎹鐞嗭紝鑺傜偣閫�鍥炰細绛炬竻绌� + // 濡傛灉鍦ㄤ細绛捐剰鏁版嵁鑼冪暣涓彂鐜� Key鏀瑰彉锛岃鏄庝細绛捐剰鏁版嵁鍦ㄤ笂涓妭鐐瑰氨缁撴潫浜嗭紝鍙互鎶婁細绛捐剰鏁版嵁鍒犳帀 + if (multiKey != null && !multiKey.toString().equals(stack.peek().getTaskDefinitionKey())) { + deleteKeyList.set(multiIndex , deleteKeyList.get(multiIndex).replace(stack.peek().getTaskDefinitionKey() + ",", "")); + multiKey = null; + // 缁撴潫杩涜涓嬫牎楠屽垹闄� + multiOpera = true; + } + // 鍏朵粬鑴忔暟鎹鐞� + // 鍙戠幇璇ヨ矾绾挎渶鍚庝竴鏉¤剰鏁版嵁锛岃鏄庤繖鏉¤剰鏁版嵁绾胯矾澶勭悊瀹屼簡锛屽垹闄よ剰鏁版嵁淇℃伅 + // 鑴忔暟鎹骇鐢熺殑鏂板疄渚嬩腑鏄惁鍖呭惈杩欐潯鏁版嵁 + if (multiKey == null && deleteKeyList.get(i).contains(stack.peek().getTaskDefinitionKey())) { + // 鍒犻櫎鍖归厤鍒扮殑閮ㄥ垎 + deleteKeyList.set(i , deleteKeyList.get(i).replace(stack.peek().getTaskDefinitionKey() + ",", "")); + } + // 濡傛灉姣忕粍涓殑鍏冪礌閮戒互鍖归厤杩囷紝璇存槑鑴忔暟鎹粨鏉� + if ("".equals(deleteKeyList.get(i))) { + // 鍚屾椂鍒犻櫎鑴忔暟鎹� + deleteKeyList.remove(i); + dirtyDataLineList.remove(i); + break; + } + } + // 浼氱鏁版嵁澶勭悊闇�瑕佸湪寰幆澶栧鐞嗭紝鍚﹀垯鍙兘瀵艰嚧婧㈠嚭 + // 浼氱鐨勬暟鎹偗瀹氭槸涔嬪墠鏀捐繘鍘荤殑鎵�浠ョ悊璁轰笂涓嶄細婧㈠嚭锛屼絾杩樻槸鏍¢獙涓� + if (multiOpera && deleteKeyList.size() > multiIndex && "".equals(deleteKeyList.get(multiIndex))) { + // 鍚屾椂鍒犻櫎鑴忔暟鎹� + deleteKeyList.remove(multiIndex); + dirtyDataLineList.remove(multiIndex); + multiIndex = -1; + multiOpera = false; + } + // pop() 鏂规硶涓� peek() 鏂规硶涓嶅悓锛屽湪杩斿洖鍊肩殑鍚屾椂锛屼細鎶婂�间粠鏍堜腑绉婚櫎 + // 淇濆瓨鏂扮殑 userTaskKey 鍦ㄤ笅涓惊鐜腑浣跨敤 + userTaskKey = new StringBuilder(stack.pop().getTaskDefinitionKey()); + } + log.info("娓呮礂鍚庣殑鍘嗗彶鑺傜偣鏁版嵁锛�" + lastHistoricTaskInstanceList); + return lastHistoricTaskInstanceList; + } +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/listener/UserTaskListener.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/listener/UserTaskListener.java new file mode 100644 index 0000000..ae8f7d3 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/listener/UserTaskListener.java @@ -0,0 +1,16 @@ +package org.jeecg.modules.flowable.listener; + +import org.flowable.engine.delegate.TaskListener; +import org.flowable.task.service.delegate.DelegateTask; +import org.springframework.stereotype.Component; + +/** + */ +public class UserTaskListener implements TaskListener{ + + @Override + public void notify(DelegateTask delegateTask) { + + } + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/IFlowDefinitionService.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/IFlowDefinitionService.java new file mode 100644 index 0000000..920225e --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/IFlowDefinitionService.java @@ -0,0 +1,97 @@ +package org.jeecg.modules.flowable.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.flowable.domain.dto.FlowProcDefDto; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +/** + */ +public interface IFlowDefinitionService { + + boolean exist(String processDefinitionKey); + + + /** + * 娴佺▼瀹氫箟鍒楄〃 + * + * @param pageNum 褰撳墠椤电爜 + * @param pageSize 姣忛〉鏉℃暟 + * @param flowProcDefDto + * @return 娴佺▼瀹氫箟鍒嗛〉鍒楄〃鏁版嵁 + */ + Page<FlowProcDefDto> list(Integer pageNum, Integer pageSize, FlowProcDefDto flowProcDefDto); + + /** + * 瀵煎叆娴佺▼鏂囦欢 + * + * @param name + * @param category + * @param in + */ + void importFile(String name, String category, InputStream in); + + /** + * 璇诲彇xml + * @param deployId + * @return + */ + Result readXml(String deployId) throws IOException; + Result readXmlByDataId(String dataId) throws IOException; + /** + * 鏍规嵁娴佺▼瀹氫箟Key鍚姩娴佺▼瀹炰緥 + *鍚姩鏈�鏂颁竴涓増鏈� + * @param procDefKey + * @param variables + * @return + */ + Result startProcessInstanceByKey(String procDefKey, Map<String, Object> variables); + + /** + * 鏍规嵁娴佺▼瀹氫箟ID鍚姩娴佺▼瀹炰緥 + * + * @param procDefId + * @param variables + * @return + */ + + Result startProcessInstanceById(String procDefId, Map<String, Object> variables); + + /** + * 鏍规嵁娴佺▼鍏宠仈鐨勬暟鎹甀D鍚姩娴佺▼瀹炰緥 + * @param dataId + * @param variables + * @return + */ + Result startProcessInstanceByDataId(String dataId, Map<String, Object> variables); + + /** + * 婵�娲绘垨鎸傝捣娴佺▼瀹氫箟 + * + * @param state 鐘舵�� + * @param deployId 娴佺▼閮ㄧ讲ID + */ + void updateState(Integer state, String deployId); + + + /** + * 鍒犻櫎娴佺▼瀹氫箟 + * + * @param deployId 娴佺▼閮ㄧ讲ID act_ge_bytearray 琛ㄤ腑 deployment_id鍊� + */ + void delete(String deployId); + + + /** + * 璇诲彇鍥剧墖鏂囦欢 + * @param deployId + * @return + */ + InputStream readImage(String deployId); + + + InputStream readImageByDataId(String dataId); +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/IFlowInstanceService.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/IFlowInstanceService.java new file mode 100644 index 0000000..e4215ab --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/IFlowInstanceService.java @@ -0,0 +1,58 @@ +package org.jeecg.modules.flowable.service; + +import org.flowable.engine.history.HistoricProcessInstance; +import org.flowable.task.api.Task; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; + +import java.util.List; +import java.util.Map; + +/** + */ +public interface IFlowInstanceService { + + List<Task> queryListByInstanceId(String instanceId); + + /** + * 缁撴潫娴佺▼瀹炰緥 + * + * @param vo + */ + void stopProcessInstance(FlowTaskVo vo); + + /** + * 婵�娲绘垨鎸傝捣娴佺▼瀹炰緥 + * + * @param state 鐘舵�� + * @param instanceId 娴佺▼瀹炰緥ID + */ + void updateState(Integer state, String instanceId); + + /** + * 鍒犻櫎娴佺▼瀹炰緥ID + * + * @param instanceId 娴佺▼瀹炰緥ID + * @param deleteReason 鍒犻櫎鍘熷洜 + */ + void delete(String instanceId, String deleteReason); + void deleteByDataId(String dataId, String deleteReason); + /** + * 鏍规嵁瀹炰緥ID鏌ヨ鍘嗗彶瀹炰緥鏁版嵁 + * + * @param processInstanceId + * @return + */ + HistoricProcessInstance getHistoricProcessInstanceById(String processInstanceId); + + /** + * 鏍规嵁娴佺▼瀹氫箟ID鍚姩娴佺▼瀹炰緥 + * + * @param procDefId 娴佺▼瀹氫箟Id + * @param variables 娴佺▼鍙橀噺 + * @return + */ + Result startProcessInstanceById(String procDefId, Map<String, Object> variables); + + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/IFlowTaskService.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/IFlowTaskService.java new file mode 100644 index 0000000..313777e --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/IFlowTaskService.java @@ -0,0 +1,172 @@ +package org.jeecg.modules.flowable.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.flowable.task.api.Task; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.flowable.domain.dto.FlowViewerDto; +import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; + +import java.io.InputStream; +import java.util.List; + +/** + */ +public interface IFlowTaskService { + + /** + * 瀹℃壒浠诲姟 + * + * @param task 璇锋眰瀹炰綋鍙傛暟 + */ + Result complete(FlowTaskVo task); + Result completeByDateId(FlowTaskVo flowTaskVo); + /** + * 椹冲洖浠诲姟 + * + * @param flowTaskVo + */ + void taskReject(FlowTaskVo flowTaskVo); + void taskRejectByDataId(FlowTaskVo flowTaskVo); + + /** + * 閫�鍥炰换鍔� + * + * @param flowTaskVo 璇锋眰瀹炰綋鍙傛暟 + */ + void taskReturn(FlowTaskVo flowTaskVo); + void taskReturnByDataId(FlowTaskVo flowTaskVo); + /** + * 鑾峰彇鎵�鏈夊彲鍥為��鐨勮妭鐐� + * + * @param flowTaskVo + * @return + */ + Result findReturnTaskList(FlowTaskVo flowTaskVo); + Result findReturnTaskListByDataId(FlowTaskVo flowTaskVo); + + /** + * 鍒犻櫎浠诲姟 + * + * @param flowTaskVo 璇锋眰瀹炰綋鍙傛暟 + */ + void deleteTask(FlowTaskVo flowTaskVo); + + /** + * 璁ら/绛炬敹浠诲姟 + * + * @param flowTaskVo 璇锋眰瀹炰綋鍙傛暟 + */ + void claim(FlowTaskVo flowTaskVo); + + /** + * 鍙栨秷璁ら/绛炬敹浠诲姟 + * + * @param flowTaskVo 璇锋眰瀹炰綋鍙傛暟 + */ + void unClaim(FlowTaskVo flowTaskVo); + + /** + * 濮旀淳浠诲姟 + * + * @param flowTaskVo 璇锋眰瀹炰綋鍙傛暟 + */ + void delegateTask(FlowTaskVo flowTaskVo); + + + /** + * 杞姙浠诲姟 + * + * @param flowTaskVo 璇锋眰瀹炰綋鍙傛暟 + */ + void assignTask(FlowTaskVo flowTaskVo); + + /** + * 鎴戝彂璧风殑娴佺▼ + * @param pageNum + * @param pageSize + * @return + */ + Result myProcess(Integer pageNum, Integer pageSize); + + /** + * 鍙栨秷鐢宠 + * @param flowTaskVo + * @return + */ + Result stopProcess(FlowTaskVo flowTaskVo); + + /** + * 鎾ゅ洖娴佺▼ + * @param flowTaskVo + * @return + */ + Result revokeProcess(FlowTaskVo flowTaskVo); + + + /** + * 浠e姙浠诲姟鍒楄〃 + * + * @param pageNum 褰撳墠椤电爜 + * @param pageSize 姣忛〉鏉℃暟 + * @return + */ + Result todoList(Integer pageNum, Integer pageSize); + + + /** + * 宸插姙浠诲姟鍒楄〃 + * + * @param pageNum 褰撳墠椤电爜 + * @param pageSize 姣忛〉鏉℃暟 + * @return + */ + Result finishedList(Integer pageNum, Integer pageSize); + + /** + * 娴佺▼鍘嗗彶娴佽浆璁板綍 + * + * @param procInsId 娴佺▼瀹炰緥Id + * @return + */ + Result flowRecord(String dataId); + + /** + * 鏍规嵁浠诲姟ID鏌ヨ鎸傝浇鐨勮〃鍗曚俊鎭� + * + * @param taskId 浠诲姟Id + * @return + */ + Task getTaskForm(String taskId); + + /** + * 鑾峰彇娴佺▼杩囩▼鍥� + * @param processId + * @return + */ + InputStream diagram(String processId); + + /** + * 鑾峰彇娴佺▼鎵ц杩囩▼ + * @param procInsId + * @return + */ + List<FlowViewerDto> getFlowViewer(String procInsId); + List<FlowViewerDto> getFlowViewerByDataId(String dataId); + /** + * 鑾峰彇娴佺▼鍙橀噺 + * @param taskId + * @return + */ + Result processVariables(String taskId); + + /** + * 鑾峰彇涓嬩竴鑺傜偣 + * @param flowTaskVo 浠诲姟 + * @return + */ + Result getNextFlowNode(FlowTaskVo flowTaskVo); + + + + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowDefinitionServiceImpl.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowDefinitionServiceImpl.java new file mode 100644 index 0000000..5add0ad --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowDefinitionServiceImpl.java @@ -0,0 +1,406 @@ +package org.jeecg.modules.flowable.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.commons.io.IOUtils; +import org.flowable.bpmn.model.BpmnModel; +import org.flowable.bpmn.model.UserTask; +import org.flowable.engine.ProcessEngineConfiguration; +import org.flowable.engine.history.HistoricActivityInstance; +import org.flowable.engine.repository.Deployment; +import org.flowable.engine.repository.ProcessDefinition; +import org.flowable.engine.repository.ProcessDefinitionQuery; +import org.flowable.engine.runtime.ProcessInstance; +import org.flowable.image.ProcessDiagramGenerator; +import org.flowable.image.impl.DefaultProcessDiagramGenerator; +import org.flowable.task.api.Task; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.util.SpringContextUtils; +import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; +import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl; +import org.jeecg.modules.flowable.apithird.entity.ActStatus; +import org.jeecg.modules.flowable.apithird.entity.SysUser; +import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; +import org.jeecg.modules.flowable.apithird.service.IFlowThirdService; +import org.jeecg.modules.flowable.apithird.common.constant.ProcessConstants; +import org.jeecg.modules.flowable.apithird.common.enums.FlowComment; +import org.jeecg.modules.flowable.domain.dto.FlowNextDto; +import org.jeecg.modules.flowable.domain.dto.FlowProcDefDto; +import org.jeecg.modules.flowable.factory.FlowServiceFactory; +import org.jeecg.modules.flowable.service.IFlowDefinitionService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 娴佺▼瀹氫箟 + * + */ +@Service +public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFlowDefinitionService { + @Autowired + IFlowThirdService iFlowThirdService; + @Autowired + FlowMyBusinessServiceImpl flowMyBusinessService; + @Autowired + FlowTaskServiceImpl flowTaskService; + + private static final String BPMN_FILE_SUFFIX = ".bpmn"; + + @Override + public boolean exist(String processDefinitionKey) { + ProcessDefinitionQuery processDefinitionQuery + = repositoryService.createProcessDefinitionQuery().processDefinitionKey(processDefinitionKey); + long count = processDefinitionQuery.count(); + return count > 0 ? true : false; + } + + + /** + * 娴佺▼瀹氫箟鍒楄〃 + * + * @param pageNum 褰撳墠椤电爜 + * @param pageSize 姣忛〉鏉℃暟 + * @param flowProcDefDto + * @return 娴佺▼瀹氫箟鍒嗛〉鍒楄〃鏁版嵁 + */ + @Override + public Page<FlowProcDefDto> list(Integer pageNum, Integer pageSize, FlowProcDefDto flowProcDefDto) { + Page<FlowProcDefDto> page = new Page<>(); + // 娴佺▼瀹氫箟鍒楄〃鏁版嵁鏌ヨ + ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery(); + processDefinitionQuery + //.processDefinitionId("cs:5:15e953ed-4d09-11ec-85b8-e884a5deddfc") + .orderByProcessDefinitionKey().asc().orderByProcessDefinitionVersion().desc(); + /*=====鍙傛暟=====*/ + if (StrUtil.isNotBlank(flowProcDefDto.getName())){ + processDefinitionQuery.processDefinitionNameLike("%"+flowProcDefDto.getName()+"%"); + } + if (StrUtil.isNotBlank(flowProcDefDto.getCategory())){ + processDefinitionQuery.processDefinitionCategory(flowProcDefDto.getCategory()); + } + if (flowProcDefDto.getSuspensionState() == 1){ + processDefinitionQuery.active(); + } + if (StrUtil.isNotBlank(flowProcDefDto.getKey())){ + processDefinitionQuery.processDefinitionKey(flowProcDefDto.getKey()); + } + if (flowProcDefDto.getIsLastVersion() == 1){ + processDefinitionQuery.latestVersion(); + } + /*============*/ + page.setTotal(processDefinitionQuery.count()); + List<ProcessDefinition> processDefinitionList = processDefinitionQuery.listPage((pageNum - 1) * pageSize, pageSize); + + List<FlowProcDefDto> dataList = new ArrayList<>(); + for (ProcessDefinition processDefinition : processDefinitionList) { + String deploymentId = processDefinition.getDeploymentId(); + Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult(); + FlowProcDefDto reProcDef = new FlowProcDefDto(); + BeanUtils.copyProperties(processDefinition, reProcDef); + // 娴佺▼瀹氫箟鏃堕棿 + reProcDef.setDeploymentTime(deployment.getDeploymentTime()); + dataList.add(reProcDef); + } + page.setRecords(dataList); + return page; + } + + + /** + * 瀵煎叆娴佺▼鏂囦欢 + * + * @param name + * @param category + * @param in + */ + @Override + public void importFile(String name, String category, InputStream in) { + Deployment deploy = repositoryService.createDeployment().addInputStream(name + BPMN_FILE_SUFFIX, in).name(name).category(category).deploy(); + ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult(); + repositoryService.setProcessDefinitionCategory(definition.getId(), category); + + } + + /** + * 璇诲彇xml + * + * @param deployId + * @return + */ + @Override + public Result readXml(String deployId) throws IOException { + ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult(); + InputStream inputStream = repositoryService.getResourceAsStream(definition.getDeploymentId(), definition.getResourceName()); + String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8.name()); + return Result.OK("", result); + } + + @Override + public Result readXmlByDataId(String dataId) throws IOException { + LambdaQueryWrapper<FlowMyBusiness> flowMyBusinessLambdaQueryWrapper = new LambdaQueryWrapper<>(); + flowMyBusinessLambdaQueryWrapper.eq(FlowMyBusiness::getDataId,dataId) + ; + //濡傛灉淇濆瓨鏁版嵁鍓嶆湭璋冪敤蹇呰皟鐨凢lowCommonService.initActBusiness鏂规硶锛屽氨浼氭湁闂 + FlowMyBusiness business = flowMyBusinessService.getOne(flowMyBusinessLambdaQueryWrapper); + ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionId(business.getProcessDefinitionId()).singleResult(); + InputStream inputStream = repositoryService.getResourceAsStream(definition.getDeploymentId(), definition.getResourceName()); + String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8.name()); + return Result.OK("", result); + } + + /** + * 璇诲彇xml 鏍规嵁涓氬姟Id + * + * @param dataId + * @return + */ + @Override + public InputStream readImageByDataId(String dataId) { + FlowMyBusiness business = flowMyBusinessService.getByDataId(dataId); + + String processId = business.getProcessInstanceId(); + ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult(); + //娴佺▼璧板畬鐨� 鏄剧ず鍏ㄥ浘 + if (pi == null) { + ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(business.getProcessDefinitionId()).singleResult(); + return this.readImage(processDefinition.getDeploymentId()); + } + + List<HistoricActivityInstance> historyProcess = historyService.createHistoricActivityInstanceQuery() + .processInstanceId(processId).list(); + List<String> activityIds = new ArrayList<>(); + List<String> flows = new ArrayList<>(); + //鑾峰彇娴佺▼鍥� + BpmnModel bpmnModel = repositoryService.getBpmnModel(pi.getProcessDefinitionId()); + for (HistoricActivityInstance hi : historyProcess) { + String activityType = hi.getActivityType(); + if (activityType.equals("sequenceFlow") || activityType.equals("exclusiveGateway")) { + flows.add(hi.getActivityId()); + } else if (activityType.equals("userTask") || activityType.equals("startEvent")) { + activityIds.add(hi.getActivityId()); + } + } + List<Task> tasks = taskService.createTaskQuery().processInstanceId(processId).list(); + for (Task task : tasks) { + activityIds.add(task.getTaskDefinitionKey()); + } + ProcessEngineConfiguration engConf = processEngine.getProcessEngineConfiguration(); + //瀹氫箟娴佺▼鐢诲竷鐢熸垚鍣� + ProcessDiagramGenerator processDiagramGenerator = engConf.getProcessDiagramGenerator(); + InputStream in = processDiagramGenerator.generateDiagram(bpmnModel, "png", activityIds, flows, engConf.getActivityFontName(), engConf.getLabelFontName(), engConf.getAnnotationFontName(), engConf.getClassLoader(), 1.0, true); + return in; + } + /** + * 璇诲彇xml + * + * @param deployId + * @return + */ + @Override + public InputStream readImage(String deployId) { + ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult(); + //鑾峰緱鍥剧墖娴� + DefaultProcessDiagramGenerator diagramGenerator = new DefaultProcessDiagramGenerator(); + BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId()); + //杈撳嚭涓哄浘鐗� + return diagramGenerator.generateDiagram( + bpmnModel, + "png", + Collections.emptyList(), + Collections.emptyList(), + "瀹嬩綋", + "瀹嬩綋", + "瀹嬩綋", + null, + 1.0, + false); + + } + + /** + * 鏍规嵁娴佺▼瀹氫箟ID鍚姩娴佺▼瀹炰緥 + * + * @param procDefKey 娴佺▼瀹氫箟Id + * @param variables 娴佺▼鍙橀噺 + * @return + */ + @Override + public Result startProcessInstanceByKey(String procDefKey, Map<String, Object> variables) { + ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() + .processDefinitionKey(procDefKey) + .latestVersion().singleResult(); + return startProcessInstanceById(processDefinition.getId(),variables); + } + /** + * 鏍规嵁娴佺▼瀹氫箟ID鍚姩娴佺▼瀹炰緥 + * + * @param procDefId 娴佺▼瀹氫箟Id + * @param variables 娴佺▼鍙橀噺 + * @return + */ + @Override + @Transactional + public Result startProcessInstanceById(String procDefId, Map<String, Object> variables) { + ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() + .processDefinitionId(procDefId) + .singleResult(); + if (Objects.nonNull(processDefinition) && processDefinition.isSuspended()) { + return Result.error("娴佺▼宸茶鎸傝捣,璇峰厛婵�娲绘祦绋�"); + } +// variables.put("skip", true); +// variables.put(ProcessConstants.FLOWABLE_SKIP_EXPRESSION_ENABLED, true); + // 璁剧疆娴佺▼鍙戣捣浜篒d鍒版祦绋嬩腑 + SysUser sysUser = iFlowThirdService.getLoginUser(); + identityService.setAuthenticatedUserId(sysUser.getUsername()); + variables.put(ProcessConstants.PROCESS_INITIATOR, sysUser.getUsername()); + ProcessInstance processInstance = runtimeService.startProcessInstanceById(procDefId, variables); + // 缁欑涓�姝ョ敵璇蜂汉鑺傜偣璁剧疆浠诲姟鎵ц浜哄拰鎰忚 + Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).active().singleResult(); + if (Objects.nonNull(task)) { + taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.NORMAL.getType(), sysUser.getRealname() + "鍙戣捣娴佺▼鐢宠"); + taskService.setAssignee(task.getId(), sysUser.getUsername()); + //taskService.complete(task.getId(), variables); + } + //璁剧疆鎵�鏈夌敵璇蜂汉 + + /*======================todo 鍚姩涔嬪悗 鍥炶皟浠ュ強鍏抽敭鏁版嵁淇濆瓨======================*/ + //涓氬姟鏁版嵁id + String dataId = variables.get("dataId").toString(); + //濡傛灉淇濆瓨鏁版嵁鍓嶆湭璋冪敤蹇呰皟鐨凢lowCommonService.initActBusiness鏂规硶锛屽氨浼氭湁闂 + FlowMyBusiness business = flowMyBusinessService.getByDataId(dataId); + //璁剧疆鏁版嵁 + FlowNextDto nextFlowNode = flowTaskService.getNextFlowNode(task.getId(), variables); + taskService.complete(task.getId(), variables); + //涓嬩竴涓疄渚嬭妭鐐� 澶氬疄渚嬩細鏄竴涓猯ist,闅忔剰鍙栦竴涓嵆鍙� 鏁扮粍涓畾涔塊ey鏄竴鑷寸殑 + //Task task2 = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).active().singleResult(); + List<Task> task2List = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).active().list(); + Task task2 = null; + if(task2List.size()>0) task2 = task2List.get(0); + String doneUsers = business.getDoneUsers(); + // 澶勭悊杩囨祦绋嬬殑浜� + JSONArray doneUserList = new JSONArray(); + if (StrUtil.isNotBlank(doneUsers)){ + doneUserList = JSON.parseArray(doneUsers); + } + if (!doneUserList.contains(sysUser.getUsername())){ + doneUserList.add(sysUser.getUsername()); + } + + if (nextFlowNode!=null){ + //**鏈変笅涓�涓妭鐐� + UserTask nextTask = nextFlowNode.getUserTask(); + //鑳藉澶勭悊涓嬩釜鑺傜偣鐨勫�欓�変汉 + List<SysUser> nextFlowNodeUserList = nextFlowNode.getUserList(); + + List<String> collect_username = nextFlowNodeUserList.stream().map(SysUser::getUsername).collect(Collectors.toList()); + //spring瀹瑰櫒绫诲悕 + String serviceImplName = business.getServiceImplName(); + FlowCallBackServiceI flowCallBackService = (FlowCallBackServiceI) SpringContextUtils.getBean(serviceImplName); + List<String> beforeParamsCandidateUsernames = flowCallBackService.flowCandidateUsernamesOfTask(task2.getTaskDefinitionKey(), variables); + if (CollUtil.isNotEmpty(beforeParamsCandidateUsernames)){ + // 鍒犻櫎鍚庨噸鍐� + for (Task task2One : task2List) { + for (String oldUser : collect_username) { + taskService.deleteCandidateUser(task2One.getId(),oldUser); + } + } + // 涓氬姟灞傛湁鎸囧畾鍊欓�変汉锛岃鐩� + for (Task task2One : task2List) { + for (String newUser : beforeParamsCandidateUsernames) { + taskService.addCandidateUser(task2One.getId(),newUser); + } + } + business.setTodoUsers(JSON.toJSONString(beforeParamsCandidateUsernames)); + } + + business.setProcessDefinitionId(procDefId) + .setProcessInstanceId(processInstance.getProcessInstanceId()) + .setActStatus(ActStatus.start) + .setProposer(sysUser.getUsername()) + .setTaskId(task2.getId()) + .setTaskName(nextTask.getName()) + .setTaskNameId(nextTask.getId()) + .setPriority(nextTask.getPriority()) + .setDoneUsers(doneUserList.toJSONString()) + .setTodoUsers(JSON.toJSONString(collect_username)) + ; + } else { + // **娌℃湁涓嬩竴涓妭鐐癸紝娴佺▼宸茬粡缁撴潫浜� + business.setProcessDefinitionId(procDefId) + .setProcessInstanceId(processInstance.getProcessInstanceId()) + .setActStatus(ActStatus.pass) + .setProposer(sysUser.getUsername()) + .setDoneUsers(doneUserList.toJSONString()) + ; + } + flowMyBusinessService.updateById(business); + //spring瀹瑰櫒绫诲悕 + String serviceImplName = business.getServiceImplName(); + FlowCallBackServiceI flowCallBackService = (FlowCallBackServiceI) SpringContextUtils.getBean(serviceImplName); + // 娴佺▼澶勭悊瀹屽悗锛岃繘琛屽洖璋冧笟鍔″眰 + business.setValues(variables); + if (flowCallBackService!=null)flowCallBackService.afterFlowHandle(business); + return Result.OK("娴佺▼鍚姩鎴愬姛"); + } + + @Override + public Result startProcessInstanceByDataId(String dataId, Map<String, Object> variables) { + LambdaQueryWrapper<FlowMyBusiness> flowMyBusinessLambdaQueryWrapper = new LambdaQueryWrapper<>(); + flowMyBusinessLambdaQueryWrapper.eq(FlowMyBusiness::getDataId, dataId) + ; + FlowMyBusiness business = flowMyBusinessService.getOne(flowMyBusinessLambdaQueryWrapper); + if (business==null){ + return Result.error("鏈壘鍒癲ataId锛�"+dataId); + } + if (StrUtil.isNotBlank(business.getProcessDefinitionId())){ + return this.startProcessInstanceById(business.getProcessDefinitionId(),variables); + } + return this.startProcessInstanceByKey(business.getProcessDefinitionKey(),variables); + } + + + /** + * 婵�娲绘垨鎸傝捣娴佺▼瀹氫箟 + * + * @param state 鐘舵�� 婵�娲�1 鎸傝捣2 + * @param deployId 娴佺▼閮ㄧ讲ID + */ + @Override + public void updateState(Integer state, String deployId) { + ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult(); + // 婵�娲� + if (state == 1) { + repositoryService.activateProcessDefinitionById(procDef.getId(), true, null); + } + // 鎸傝捣 + if (state == 2) { + repositoryService.suspendProcessDefinitionById(procDef.getId(), true, null); + } + } + + + /** + * 鍒犻櫎娴佺▼瀹氫箟 + * + * @param deployId 娴佺▼閮ㄧ讲ID act_ge_bytearray 琛ㄤ腑 deployment_id鍊� + */ + @Override + public void delete(String deployId) { + // true 鍏佽绾ц仈鍒犻櫎 ,涓嶈缃細瀵艰嚧鏁版嵁搴撳閿叧鑱斿紓甯� + repositoryService.deleteDeployment(deployId, true); + } + + +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowInstanceServiceImpl.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowInstanceServiceImpl.java new file mode 100644 index 0000000..4d5a3db --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowInstanceServiceImpl.java @@ -0,0 +1,187 @@ +package org.jeecg.modules.flowable.service.impl; + + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.shiro.SecurityUtils; +import org.flowable.common.engine.api.FlowableObjectNotFoundException; +import org.flowable.engine.history.HistoricProcessInstance; +import org.flowable.engine.runtime.ProcessInstance; +import org.flowable.task.api.Task; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.util.SpringContextUtils; +import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; +import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl; +import org.jeecg.modules.flowable.apithird.entity.ActStatus; +import org.jeecg.modules.flowable.apithird.entity.SysUser; +import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; +import org.jeecg.modules.flowable.apithird.service.IFlowThirdService; +import org.jeecg.modules.flowable.apithird.common.exception.CustomException; +import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; +import org.jeecg.modules.flowable.factory.FlowServiceFactory; +import org.jeecg.modules.flowable.service.IFlowInstanceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * <p>宸ヤ綔娴佹祦绋嬪疄渚嬬鐞�<p> + * + */ +@Service +@Slf4j +public class FlowInstanceServiceImpl extends FlowServiceFactory implements IFlowInstanceService { + @Autowired + IFlowThirdService iFlowThirdService; + @Autowired + FlowMyBusinessServiceImpl flowMyBusinessService; + + @Override + public List<Task> queryListByInstanceId(String instanceId) { + List<Task> list = taskService.createTaskQuery().processInstanceId(instanceId).active().list(); + return list; + } + + /** + * 缁撴潫娴佺▼瀹炰緥 + * + * @param vo + */ + @Override + public void stopProcessInstance(FlowTaskVo vo) { + String taskId = vo.getTaskId(); + + } + + /** + * 婵�娲绘垨鎸傝捣娴佺▼瀹炰緥 + * + * @param state 鐘舵�� + * @param instanceId 娴佺▼瀹炰緥ID + */ + @Override + public void updateState(Integer state, String instanceId) { + + // 婵�娲� + if (state == 1) { + runtimeService.activateProcessInstanceById(instanceId); + } + // 鎸傝捣 + if (state == 2) { + runtimeService.suspendProcessInstanceById(instanceId); + } + } + + /** + * 鍒犻櫎娴佺▼瀹炰緥ID + * + * @param instanceId 娴佺▼瀹炰緥ID + * @param deleteReason 鍒犻櫎鍘熷洜 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String instanceId, String deleteReason) { + List<Task> task = taskService.createTaskQuery().processInstanceId(instanceId).list(); + if (CollectionUtils.isEmpty(task)) { + throw new CustomException("娴佺▼鏈惎鍔ㄦ垨宸叉墽琛屽畬鎴愶紝鍙栨秷鐢宠澶辫触"); + } + // 鏌ヨ鍘嗗彶鏁版嵁 + HistoricProcessInstance historicProcessInstance = getHistoricProcessInstanceById(instanceId); + if (historicProcessInstance.getEndTime() != null) { + historyService.deleteHistoricProcessInstance(historicProcessInstance.getId()); + return; + } + // 鍒犻櫎娴佺▼瀹炰緥 + runtimeService.deleteProcessInstance(instanceId, deleteReason); + // 鍒犻櫎鍘嗗彶娴佺▼瀹炰緥 + historyService.deleteHistoricProcessInstance(instanceId); + /*======================鎾ゅ洖鍒犻櫎 鍥炶皟浠ュ強鍏抽敭鏁版嵁淇濆瓨======================*/ + LambdaQueryWrapper<FlowMyBusiness> flowMyBusinessLambdaQueryWrapper = new LambdaQueryWrapper<>(); + flowMyBusinessLambdaQueryWrapper.eq(FlowMyBusiness::getProcessInstanceId,instanceId) + ; + //濡傛灉淇濆瓨鏁版嵁鍓嶆湭璋冪敤蹇呰皟鐨凢lowCommonService.initActBusiness鏂规硶锛屽氨浼氭湁闂 + FlowMyBusiness business = flowMyBusinessService.getOne(flowMyBusinessLambdaQueryWrapper); + //璁剧疆鏁版嵁 + String doneUsers = business.getDoneUsers(); + SysUser sysUser = iFlowThirdService.getLoginUser(); + // 澶勭悊杩囨祦绋嬬殑浜� + JSONArray doneUserList = new JSONArray(); + if (StrUtil.isNotBlank(doneUsers)){ + doneUserList = JSON.parseArray(doneUsers); + } + if (!doneUserList.contains(sysUser.getUsername())){ + doneUserList.add(sysUser.getUsername()); + } + business + .setActStatus(ActStatus.recall) + .setTaskId("") + .setTaskName("宸叉挙鍥�") + .setPriority("") + .setDoneUsers(doneUserList.toJSONString()) + .setTodoUsers("") + ; + flowMyBusinessService.updateById(business); + //spring瀹瑰櫒绫诲悕 + String serviceImplName = business.getServiceImplName(); + FlowCallBackServiceI flowCallBackService = (FlowCallBackServiceI) SpringContextUtils.getBean(serviceImplName); + // 娴佺▼澶勭悊瀹屽悗锛岃繘琛屽洖璋冧笟鍔″眰 + if (flowCallBackService!=null)flowCallBackService.afterFlowHandle(business); + + } + + @Override + public void deleteByDataId(String dataId, String deleteReason) { + LambdaQueryWrapper<FlowMyBusiness> flowMyBusinessLambdaQueryWrapper = new LambdaQueryWrapper<>(); + flowMyBusinessLambdaQueryWrapper.eq(FlowMyBusiness::getDataId, dataId) + ; + //濡傛灉淇濆瓨鏁版嵁鍓嶆湭璋冪敤蹇呰皟鐨凢lowCommonService.initActBusiness鏂规硶锛屽氨浼氭湁闂 + FlowMyBusiness business = flowMyBusinessService.getOne(flowMyBusinessLambdaQueryWrapper); + this.delete(business.getProcessInstanceId(),deleteReason); + } + + /** + * 鏍规嵁瀹炰緥ID鏌ヨ鍘嗗彶瀹炰緥鏁版嵁 + * + * @param processInstanceId + * @return + */ + @Override + public HistoricProcessInstance getHistoricProcessInstanceById(String processInstanceId) { + HistoricProcessInstance historicProcessInstance = + historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); + if (Objects.isNull(historicProcessInstance)) { + throw new FlowableObjectNotFoundException("娴佺▼瀹炰緥涓嶅瓨鍦�: " + processInstanceId); + } + return historicProcessInstance; + } + + /** + * 鏍规嵁娴佺▼瀹氫箟ID鍚姩娴佺▼瀹炰緥 + * + * @param procDefId 娴佺▼瀹氫箟Id + * @param variables 娴佺▼鍙橀噺 + * @return + */ + @Override + public Result startProcessInstanceById(String procDefId, Map<String, Object> variables) { + + // 璁剧疆娴佺▼鍙戣捣浜篒d鍒版祦绋嬩腑 + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String username = user.getUsername(); +// identityService.setAuthenticatedUserId(userId.toString()); + variables.put("initiator",username); + variables.put("_FLOWABLE_SKIP_EXPRESSION_ENABLED", true); + ProcessInstance processInstance = runtimeService.startProcessInstanceById(procDefId, variables); + processInstance.getProcessInstanceId(); + return Result.OK("娴佺▼鍚姩鎴愬姛"); + } +} diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java new file mode 100644 index 0000000..543bdc5 --- /dev/null +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java @@ -0,0 +1,1429 @@ +package org.jeecg.modules.flowable.service.impl; + + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.flowable.bpmn.model.Process; +import org.flowable.bpmn.model.*; +import org.flowable.common.engine.api.FlowableException; +import org.flowable.common.engine.api.FlowableObjectNotFoundException; +import org.flowable.common.engine.impl.identity.Authentication; +import org.flowable.engine.ProcessEngineConfiguration; +import org.flowable.engine.history.HistoricActivityInstance; +import org.flowable.engine.history.HistoricProcessInstance; +import org.flowable.engine.history.HistoricProcessInstanceQuery; +import org.flowable.engine.repository.ProcessDefinition; +import org.flowable.engine.runtime.Execution; +import org.flowable.engine.runtime.ProcessInstance; +import org.flowable.engine.task.Comment; +import org.flowable.identitylink.api.IdentityLinkType; +import org.flowable.identitylink.api.history.HistoricIdentityLink; +import org.flowable.image.ProcessDiagramGenerator; +import org.flowable.task.api.DelegationState; +import org.flowable.task.api.Task; +import org.flowable.task.api.TaskQuery; +import org.flowable.task.api.history.HistoricTaskInstance; +import org.flowable.task.api.history.HistoricTaskInstanceQuery; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.util.SpringContextUtils; +import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; +import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl; +import org.jeecg.modules.flowable.apithird.entity.ActStatus; +import org.jeecg.modules.flowable.apithird.entity.SysUser; +import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; +import org.jeecg.modules.flowable.apithird.service.IFlowThirdService; +import org.jeecg.modules.flowable.apithird.common.constant.ProcessConstants; +import org.jeecg.modules.flowable.apithird.common.enums.FlowComment; +import org.jeecg.modules.flowable.apithird.common.exception.CustomException; +import org.jeecg.modules.flowable.domain.dto.FlowCommentDto; +import org.jeecg.modules.flowable.domain.dto.FlowNextDto; +import org.jeecg.modules.flowable.domain.dto.FlowTaskDto; +import org.jeecg.modules.flowable.domain.dto.FlowViewerDto; +import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; +import org.jeecg.modules.flowable.factory.FlowServiceFactory; +import org.jeecg.modules.flowable.flow.CustomProcessDiagramGenerator; +import org.jeecg.modules.flowable.flow.FindNextNodeUtil; +import org.jeecg.modules.flowable.flow.FlowableUtils; +import org.jeecg.modules.flowable.service.IFlowTaskService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.io.InputStream; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +/** + **/ +@Service +@Slf4j +@Transactional +public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTaskService { + + @Resource + private IFlowThirdService iFlowThirdService; + @Autowired + FlowMyBusinessServiceImpl flowMyBusinessService; + /** + * 瀹屾垚浠诲姟 + * + * @param taskVo 璇锋眰瀹炰綋鍙傛暟 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public Result complete(FlowTaskVo taskVo) { + Task task = taskService.createTaskQuery().taskId(taskVo.getTaskId()).singleResult(); + if (Objects.isNull(task)){ + return Result.error("浠诲姟涓嶅瓨鍦�"); + } + if(StringUtils.isNotEmpty(taskVo.getComment())){ + task.setDescription(taskVo.getComment()); + taskService.saveTask(task); + } + SysUser loginUser = iFlowThirdService.getLoginUser(); + if (DelegationState.PENDING.equals(task.getDelegationState())) { + taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment()); + //taskService.resolveTask(taskVo.getTaskId(), taskVo.getValues()); + } else { + System.out.println("taskVo.getTaskId()--->taskVo.getInstanceId()--->FlowComment.NORMAL.getType()--->taskVo.getComment()"+taskVo.getTaskId() + "---" + taskVo.getInstanceId() + "---" + FlowComment.NORMAL.getType() + "---"+taskVo.getComment() ); + taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment()); + taskService.setAssignee(taskVo.getTaskId(), loginUser.getUsername()); + //taskService.complete(taskVo.getTaskId(), taskVo.getValues()); + } + /*======================瀹℃壒閫氳繃 鍥炶皟浠ュ強鍏抽敭鏁版嵁淇濆瓨======================*/ + //涓氬姟鏁版嵁id + String dataId = taskVo.getDataId(); + //濡傛灉淇濆瓨鏁版嵁鍓嶆湭璋冪敤蹇呰皟鐨凢lowCommonService.initActBusiness鏂规硶锛屽氨浼氭湁闂 + FlowMyBusiness business = flowMyBusinessService.getByDataId(dataId); + //spring瀹瑰櫒绫诲悕 + String serviceImplName = business.getServiceImplName(); + FlowCallBackServiceI flowCallBackService = (FlowCallBackServiceI) SpringContextUtils.getBean(serviceImplName); + // 娴佺▼鍙橀噺 + Map<String, Object> flowBeforeParamsValues = flowCallBackService.flowValuesOfTask(business.getTaskNameId(),taskVo.getValues()); + + //璁剧疆鏁版嵁 + Map<String, Object> values = taskVo.getValues(); + if (MapUtil.isNotEmpty(flowBeforeParamsValues)){ + // 涓氬姟灞傛湁璁剧疆鍙橀噺锛屼娇鐢ㄤ笟鍔″眰鐨勫彉閲� + values = flowBeforeParamsValues; + } + FlowNextDto nextFlowNode = this.getNextFlowNode(task.getId(), values); + //涓嬩竴涓疄渚嬭妭鐐� + if (DelegationState.PENDING.equals(task.getDelegationState())) { + taskService.resolveTask(taskVo.getTaskId(), values); + } else { + taskService.complete(taskVo.getTaskId(), values); + } + List<Task> task2List = taskService.createTaskQuery().processInstanceId(business.getProcessInstanceId()).active().list(); + Task task2 = null; + if (CollUtil.isNotEmpty(task2List)){ + task2 = task2List.get(0); + } + + // 涓嬩釜鑺傜偣鍊欓�変汉 + List<String> beforeParamsCandidateUsernames = Lists.newArrayList(); + if(task2!=null){ + beforeParamsCandidateUsernames = flowCallBackService.flowCandidateUsernamesOfTask(task2.getTaskDefinitionKey(),taskVo.getValues()); + } + List<String> candidateUsers = taskVo.getCandidateUsers(); + if (CollUtil.isNotEmpty(candidateUsers)){ + // 鍓嶇浼犲叆鍊欓�変汉 瑕嗙洊 + beforeParamsCandidateUsernames = candidateUsers; + } + String doneUsers = business.getDoneUsers(); + // 澶勭悊杩囨祦绋嬬殑浜� + JSONArray doneUserList = new JSONArray(); + if (StrUtil.isNotBlank(doneUsers)){ + doneUserList = JSON.parseArray(doneUsers); + } + if (!doneUserList.contains(loginUser.getUsername())){ + doneUserList.add(loginUser.getUsername()); + } + + if (task2!=null && task.getTaskDefinitionKey().equals(task2.getTaskDefinitionKey())){ + // * 褰撳墠鑺傜偣鏄細绛捐妭鐐癸紝娌℃湁璧板畬 + business.setActStatus(ActStatus.doing) + .setTaskId(task2.getId()) + .setDoneUsers(doneUserList.toJSONString()) + ; + String todoUsersStr = business.getTodoUsers(); + JSONArray todosArr = JSON.parseArray(todoUsersStr); + // 鍒犻櫎鍚庨噸鍐� + for (Task task2One : task2List) { + for (Object oldUser : todosArr) { + taskService.deleteCandidateUser(task2One.getId(),oldUser.toString()); + } + } + // 閲嶅啓 + if (CollUtil.isNotEmpty(beforeParamsCandidateUsernames)){ + beforeParamsCandidateUsernames.remove(loginUser.getUsername()); + // 涓氬姟灞傛湁鎸囧畾鍊欓�変汉锛岃鐩� + for (Task task2One : task2List) { + for (String newUser : beforeParamsCandidateUsernames) { + taskService.addCandidateUser(task2One.getId(),newUser); + } + } + business.setTodoUsers(JSON.toJSONString(beforeParamsCandidateUsernames)); + } else { + todosArr.remove(loginUser.getUsername()); + for (Task task2One : task2List) { + for (Object oldUser : todosArr) { + taskService.addCandidateUser(task2One.getId(),oldUser.toString()); + } + } + business.setTodoUsers(todosArr.toJSONString()); + } + + + } else { + // * 涓嬩竴鑺傜偣鏄細绛捐妭鐐� 鎴� 鏅�氱敤鎴疯妭鐐癸紝閫昏緫涓�鑷� + if (nextFlowNode!=null){ + //**鏈変笅涓�涓妭鐐� + UserTask nextTask = nextFlowNode.getUserTask(); + //鑳藉澶勭悊涓嬩釜鑺傜偣鐨勫�欓�変汉 + List<SysUser> nextFlowNodeUserList = nextFlowNode.getUserList(); + List<String> collect_username = nextFlowNodeUserList.stream().map(SysUser::getUsername).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(candidateUsers)){ + // 鍓嶇浼犲叆鍊欓�変汉 + collect_username = candidateUsers; + } + business.setActStatus(ActStatus.doing) + .setTaskId(task2.getId()) + .setTaskNameId(nextTask.getId()) + .setTaskName(nextTask.getName()) + .setPriority(nextTask.getPriority()) + .setDoneUsers(doneUserList.toJSONString()) + .setTodoUsers(JSON.toJSONString(collect_username)) + ; + // 鍒犻櫎鍚庨噸鍐� + for (Task task2One : task2List) { + for (String oldUser : collect_username) { + taskService.deleteCandidateUser(task2One.getId(),oldUser); + } + } + if (CollUtil.isEmpty(candidateUsers)&&CollUtil.isNotEmpty(beforeParamsCandidateUsernames)){ + // 鍓嶇娌℃湁浼犲叆鍊欓�変汉 && 涓氬姟灞傛湁鎸囧畾鍊欓�変汉锛岃鐩� + for (Task task2One : task2List) { + for (String newUser : beforeParamsCandidateUsernames) { + taskService.addCandidateUser(task2One.getId(),newUser); + } + } + business.setTodoUsers(JSON.toJSONString(beforeParamsCandidateUsernames)); + } else { + for (Task task2One : task2List) { + for (String oldUser : collect_username) { + taskService.addCandidateUser(task2One.getId(),oldUser); + } + } + } + + } else { + // **娌℃湁涓嬩竴涓妭鐐癸紝娴佺▼宸茬粡缁撴潫浜� + business.setActStatus(ActStatus.pass) + .setDoneUsers(doneUserList.toJSONString()) + .setTodoUsers("") + .setTaskId("") + .setTaskNameId("") + .setTaskName("") + ; + } + } + + flowMyBusinessService.updateById(business); + // 娴佺▼澶勭悊瀹屽悗锛岃繘琛屽洖璋冧笟鍔″眰 + business.setValues(values); + if (flowCallBackService!=null)flowCallBackService.afterFlowHandle(business); + return Result.OK(); + } + @Override + @Transactional(rollbackFor = Exception.class) + public Result completeByDateId(FlowTaskVo flowTaskVo){ + return this.complete(flowTaskVo); + } + @Override + public void taskRejectByDataId(FlowTaskVo flowTaskVo){ + FlowMyBusiness business = flowMyBusinessService.getByDataId(flowTaskVo.getDataId()); + flowTaskVo.setTaskId(business.getTaskId()); + this.taskReject(flowTaskVo); + } + /** + * 椹冲洖浠诲姟 + * + * @param flowTaskVo + */ + @Override + public void taskReject(FlowTaskVo flowTaskVo) { + if (taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult().isSuspended()) { + throw new CustomException("浠诲姟澶勪簬鎸傝捣鐘舵��"); + } + // 褰撳墠浠诲姟 task + Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult(); + // 鑾峰彇娴佺▼瀹氫箟淇℃伅 + ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult(); + // 鑾峰彇鎵�鏈夎妭鐐逛俊鎭� + Process process = repositoryService.getBpmnModel(processDefinition.getId()).getProcesses().get(0); + // 鑾峰彇鍏ㄩ儴鑺傜偣鍒楄〃锛屽寘鍚瓙鑺傜偣 + Collection<FlowElement> allElements = FlowableUtils.getAllElements(process.getFlowElements(), null); + // 鑾峰彇褰撳墠浠诲姟鑺傜偣鍏冪礌 + FlowElement source = null; + if (allElements != null) { + for (FlowElement flowElement : allElements) { + // 绫诲瀷涓虹敤鎴疯妭鐐� + if (flowElement.getId().equals(task.getTaskDefinitionKey())) { + // 鑾峰彇鑺傜偣淇℃伅 + source = flowElement; + } + } + } + + // 鐩殑鑾峰彇鎵�鏈夎烦杞埌鐨勮妭鐐� targetIds + // 鑾峰彇褰撳墠鑺傜偣鐨勬墍鏈夌埗绾х敤鎴蜂换鍔¤妭鐐� + // 娣卞害浼樺厛绠楁硶鎬濇兂锛氬欢杈硅凯浠f繁鍏� + List<UserTask> parentUserTaskList = FlowableUtils.iteratorFindParentUserTasks(source, null, null); + if (parentUserTaskList == null || parentUserTaskList.size() == 0) { + throw new CustomException("褰撳墠鑺傜偣涓哄垵濮嬩换鍔¤妭鐐癸紝涓嶈兘椹冲洖"); + } + // 鑾峰彇娲诲姩 ID 鍗宠妭鐐� Key + List<String> parentUserTaskKeyList = new ArrayList<>(); + parentUserTaskList.forEach(item -> parentUserTaskKeyList.add(item.getId())); + // 鑾峰彇鍏ㄩ儴鍘嗗彶鑺傜偣娲诲姩瀹炰緥锛屽嵆宸茬粡璧拌繃鐨勮妭鐐瑰巻鍙诧紝鏁版嵁閲囩敤寮�濮嬫椂闂村崌搴� + List<HistoricTaskInstance> historicTaskInstanceList = historyService.createHistoricTaskInstanceQuery().processInstanceId(task.getProcessInstanceId()).orderByHistoricTaskInstanceStartTime().asc().list(); + // 鏁版嵁娓呮礂锛屽皢鍥炴粴瀵艰嚧鐨勮剰鏁版嵁娓呮礂鎺� + List<String> lastHistoricTaskInstanceList = FlowableUtils.historicTaskInstanceClean(allElements, historicTaskInstanceList); + // 姝ゆ椂鍘嗗彶浠诲姟瀹炰緥涓哄�掑簭锛岃幏鍙栨渶鍚庤蛋鐨勮妭鐐� + List<String> targetIds = new ArrayList<>(); + // 寰幆缁撴潫鏍囪瘑锛岄亣鍒板綋鍓嶇洰鏍囪妭鐐圭殑娆℃暟 + int number = 0; + StringBuilder parentHistoricTaskKey = new StringBuilder(); + for (String historicTaskInstanceKey : lastHistoricTaskInstanceList) { + // 褰撲細绛炬椂鍊欎細鍑虹幇鐗规畩鐨勶紝杩炵画閮芥槸鍚屼竴涓妭鐐瑰巻鍙叉暟鎹殑鎯呭喌锛岃繖绉嶆椂鍊欒烦杩� + if (parentHistoricTaskKey.toString().equals(historicTaskInstanceKey)) { + continue; + } + parentHistoricTaskKey = new StringBuilder(historicTaskInstanceKey); + if (historicTaskInstanceKey.equals(task.getTaskDefinitionKey())) { + number++; + } + // 鍦ㄦ暟鎹竻娲楀悗锛屽巻鍙茶妭鐐瑰氨鏄敮涓�涓�鏉′粠璧峰鍒板綋鍓嶈妭鐐圭殑鍘嗗彶璁板綍锛岀悊璁轰笂姣忎釜鐐瑰彧浼氬嚭鐜颁竴娆� + // 鍦ㄦ祦绋嬩腑濡傛灉鍑虹幇寰幆锛岄偅涔堟瘡娆″惊鐜腑闂寸殑鐐逛篃鍙細鍑虹幇涓�娆★紝鍐嶅嚭鐜板氨鏄笅娆″惊鐜� + // number == 1锛岀涓�娆¢亣鍒板綋鍓嶈妭鐐� + // number == 2锛岀浜屾閬囧埌锛屼唬琛ㄦ渶鍚庝竴娆$殑寰幆鑼冨洿 + if (number == 2) { + break; + } + // 濡傛灉褰撳墠鍘嗗彶鑺傜偣锛屽睘浜庣埗绾х殑鑺傜偣锛岃鏄庢渶鍚庝竴娆$粡杩囦簡杩欎釜鐐癸紝闇�瑕侀��鍥炶繖涓偣 + if (parentUserTaskKeyList.contains(historicTaskInstanceKey)) { + targetIds.add(historicTaskInstanceKey); + } + } + + + // 鐩殑鑾峰彇鎵�鏈夐渶瑕佽璺宠浆鐨勮妭鐐� currentIds + // 鍙栧叾涓竴涓埗绾т换鍔★紝鍥犱负鍚庣画瑕佷箞瀛樺湪鍏叡缃戝叧锛岃涔堝氨鏄覆琛屽叕鍏辩嚎璺� + UserTask oneUserTask = parentUserTaskList.get(0); + // 鑾峰彇鎵�鏈夋甯歌繘琛岀殑浠诲姟鑺傜偣 Key锛岃繖浜涗换鍔′笉鑳界洿鎺ヤ娇鐢紝闇�瑕佹壘鍑哄叾涓渶瑕佹挙鍥炵殑浠诲姟 + List<Task> runTaskList = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).list(); + List<String> runTaskKeyList = new ArrayList<>(); + runTaskList.forEach(item -> runTaskKeyList.add(item.getTaskDefinitionKey())); + // 闇�椹冲洖浠诲姟鍒楄〃 + List<String> currentIds = new ArrayList<>(); + // 閫氳繃鐖剁骇缃戝叧鐨勫嚭鍙h繛绾匡紝缁撳悎 runTaskList 姣斿锛岃幏鍙栭渶瑕佹挙鍥炵殑浠诲姟 + List<UserTask> currentUserTaskList = FlowableUtils.iteratorFindChildUserTasks(oneUserTask, runTaskKeyList, null, null); + currentUserTaskList.forEach(item -> currentIds.add(item.getId())); + + + // 瑙勫畾锛氬苟琛岀綉鍏充箣鍓嶈妭鐐瑰繀椤婚渶瀛樺湪鍞竴鐢ㄦ埛浠诲姟鑺傜偣锛屽鏋滃嚭鐜板涓换鍔¤妭鐐癸紝鍒欏苟琛岀綉鍏宠妭鐐归粯璁や负缁撴潫鑺傜偣锛屽師鍥犱负涓嶈�冭檻澶氬澶氭儏鍐� + if (targetIds.size() > 1 && currentIds.size() > 1) { + throw new CustomException("浠诲姟鍑虹幇澶氬澶氭儏鍐碉紝鏃犳硶鎾ゅ洖"); + } + + // 寰幆鑾峰彇閭d簺闇�瑕佽鎾ゅ洖鐨勮妭鐐圭殑ID锛岀敤鏉ヨ缃┏鍥炲師鍥� + List<String> currentTaskIds = new ArrayList<>(); + currentIds.forEach(currentId -> runTaskList.forEach(runTask -> { + if (currentId.equals(runTask.getTaskDefinitionKey())) { + currentTaskIds.add(runTask.getId()); + } + })); + // 璁剧疆椹冲洖鎰忚 + currentTaskIds.forEach(item -> taskService.addComment(item, task.getProcessInstanceId(), FlowComment.REJECT.getType(), flowTaskVo.getComment())); + SysUser loginUser = iFlowThirdService.getLoginUser(); + try { + // 璁剧疆澶勭悊浜� + taskService.setAssignee(task.getId(), loginUser.getUsername()); + // 濡傛灉鐖剁骇浠诲姟澶氫簬 1 涓紝璇存槑褰撳墠鑺傜偣涓嶆槸骞惰鑺傜偣锛屽師鍥犱负涓嶈�冭檻澶氬澶氭儏鍐� + if (targetIds.size() > 1) { + // 1 瀵� 澶氫换鍔¤烦杞紝currentIds 褰撳墠鑺傜偣(1)锛宼argetIds 璺宠浆鍒扮殑鑺傜偣(澶�) + runtimeService.createChangeActivityStateBuilder() + .processInstanceId(task.getProcessInstanceId()). + moveSingleActivityIdToActivityIds(currentIds.get(0), targetIds).changeState(); + } + // 濡傛灉鐖剁骇浠诲姟鍙湁涓�涓紝鍥犳褰撳墠浠诲姟鍙兘涓虹綉鍏充腑鐨勪换鍔� + if (targetIds.size() == 1) { + // 1 瀵� 1 鎴� 澶� 瀵� 1 鎯呭喌锛宑urrentIds 褰撳墠瑕佽烦杞殑鑺傜偣鍒楄〃(1鎴栧)锛宼argetIds.get(0) 璺宠浆鍒扮殑鑺傜偣(1) + runtimeService.createChangeActivityStateBuilder() + .processInstanceId(task.getProcessInstanceId()) + .moveActivityIdsToSingleActivityId(currentIds, targetIds.get(0)).changeState(); + } + /*======================椹冲洖 鍥炶皟浠ュ強鍏抽敭鏁版嵁淇濆瓨======================*/ + //涓氬姟鏁版嵁id + String dataId = flowTaskVo.getDataId(); + if (dataId==null) return; + //濡傛灉淇濆瓨鏁版嵁鍓嶆湭璋冪敤蹇呰皟鐨凢lowCommonService.initActBusiness鏂规硶锛屽氨浼氭湁闂 + FlowMyBusiness business = flowMyBusinessService.getByDataId(dataId); + // 椹冲洖鍒颁簡涓婁竴涓妭鐐圭瓑寰呭鐞� + List<Task> task2List = taskService.createTaskQuery().processInstanceId(business.getProcessInstanceId()).active().list(); + Task task2 = task2List.get(0); + //spring瀹瑰櫒绫诲悕 + String serviceImplName = business.getServiceImplName(); + FlowCallBackServiceI flowCallBackService = (FlowCallBackServiceI) SpringContextUtils.getBean(serviceImplName); + Map<String, Object> values = flowTaskVo.getValues(); + if (values ==null){ + values = MapUtil.newHashMap(); + values.put("dataId",dataId); + } else { + values.put("dataId",dataId); + } + List<String> beforeParamsCandidateUsernames = flowCallBackService.flowCandidateUsernamesOfTask(task2.getTaskDefinitionKey(), values); + //璁剧疆鏁版嵁 + String doneUsers = business.getDoneUsers(); + // 澶勭悊杩囨祦绋嬬殑浜� + JSONArray doneUserList = new JSONArray(); + if (StrUtil.isNotBlank(doneUsers)){ + doneUserList = JSON.parseArray(doneUsers); + } + if (!doneUserList.contains(loginUser.getUsername())){ + doneUserList.add(loginUser.getUsername()); + } + business.setActStatus(ActStatus.reject) + .setTaskId(task2.getId()) + .setTaskNameId(task2.getTaskDefinitionKey()) + .setTaskName(task2.getName()) + .setDoneUsers(doneUserList.toJSONString()) + ; + FlowElement targetElement = null; + if (allElements != null) { + for (FlowElement flowElement : allElements) { + // 绫诲瀷涓虹敤鎴疯妭鐐� + if (flowElement.getId().equals(task2.getTaskDefinitionKey())) { + // 鑾峰彇鑺傜偣淇℃伅 + targetElement = flowElement; + } + } + } + + if (targetElement!=null){ + UserTask targetTask = (UserTask) targetElement; + business.setPriority(targetTask.getPriority()); + + if (StrUtil.equals(business.getTaskNameId(),ProcessConstants.START_NODE)){ + // 寮�濮嬭妭鐐广�傝缃鐞嗕汉涓虹敵璇蜂汉 + business.setTodoUsers(JSON.toJSONString(Lists.newArrayList(business.getProposer()))); + taskService.setAssignee(business.getTaskId(),business.getProposer()); + } else { + List<SysUser> sysUserFromTask = getSysUserFromTask(targetTask); + List<String> collect_username = sysUserFromTask.stream().map(SysUser::getUsername).collect(Collectors.toList()); + // 鍓嶇瀛樺叆鐨勫�欓�変汉 + List<String> candidateUsers = flowTaskVo.getCandidateUsers(); + if (CollUtil.isNotEmpty(candidateUsers)){ + collect_username = candidateUsers; + } + business.setTodoUsers(JSON.toJSONString(collect_username)); + // 鍒犻櫎鍚庨噸鍐� + for (Task task2One : task2List) { + for (String oldUser : collect_username) { + taskService.deleteCandidateUser(task2One.getId(),oldUser); + } + } + if (CollUtil.isNotEmpty(beforeParamsCandidateUsernames)){ + if (CollUtil.isNotEmpty(candidateUsers)){ + beforeParamsCandidateUsernames = candidateUsers; + } + // 涓氬姟灞傛湁鎸囧畾鍊欓�変汉锛岃鐩� + for (Task task2One : task2List) { + for (String newUser : beforeParamsCandidateUsernames) { + taskService.addCandidateUser(task2One.getId(), newUser); + } + } + business.setTodoUsers(JSON.toJSONString(beforeParamsCandidateUsernames)); + } else { + for (Task task2One : task2List) { + for (String oldUser : collect_username) { + taskService.addCandidateUser(task2One.getId(), oldUser); + } + } + } + } + } + + flowMyBusinessService.updateById(business); + // 娴佺▼澶勭悊瀹屽悗锛岃繘琛屽洖璋冧笟鍔″眰 + business.setValues(values); + if (flowCallBackService!=null) flowCallBackService.afterFlowHandle(business); + } catch (FlowableObjectNotFoundException e) { + throw new CustomException("鏈壘鍒版祦绋嬪疄渚嬶紝娴佺▼鍙兘宸插彂鐢熷彉鍖�"); + } catch (FlowableException e) { + throw new CustomException("鏃犳硶鍙栨秷鎴栧紑濮嬫椿鍔�"); + } + + } + @Override + public void taskReturnByDataId(FlowTaskVo flowTaskVo){ + //濡傛灉淇濆瓨鏁版嵁鍓嶆湭璋冪敤蹇呰皟鐨凢lowCommonService.initActBusiness鏂规硶锛屽氨浼氭湁闂 + FlowMyBusiness business = flowMyBusinessService.getByDataId(flowTaskVo.getDataId()); + flowTaskVo.setTaskId(business.getTaskId()); + taskReturn(flowTaskVo); + } + /** + * 閫�鍥炰换鍔� + * + * @param flowTaskVo 璇锋眰瀹炰綋鍙傛暟 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void taskReturn(FlowTaskVo flowTaskVo) { + if (taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult().isSuspended()) { + throw new CustomException("浠诲姟澶勪簬鎸傝捣鐘舵��"); + } + // 褰撳墠浠诲姟 task + Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult(); + // 鑾峰彇娴佺▼瀹氫箟淇℃伅 + ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult(); + // 鑾峰彇鎵�鏈夎妭鐐逛俊鎭� + Process process = repositoryService.getBpmnModel(processDefinition.getId()).getProcesses().get(0); + // 鑾峰彇鍏ㄩ儴鑺傜偣鍒楄〃锛屽寘鍚瓙鑺傜偣 + Collection<FlowElement> allElements = FlowableUtils.getAllElements(process.getFlowElements(), null); + // 鑾峰彇褰撳墠浠诲姟鑺傜偣鍏冪礌 + FlowElement source = null; + // 鑾峰彇璺宠浆鐨勮妭鐐瑰厓绱� + FlowElement target = null; + if (allElements != null) { + for (FlowElement flowElement : allElements) { + // 褰撳墠浠诲姟鑺傜偣鍏冪礌 + if (flowElement.getId().equals(task.getTaskDefinitionKey())) { + source = flowElement; + } + // 璺宠浆鐨勮妭鐐瑰厓绱� + if (flowElement.getId().equals(flowTaskVo.getTargetKey())) { + target = flowElement; + } + } + } + + // 浠庡綋鍓嶈妭鐐瑰悜鍓嶆壂鎻� + // 濡傛灉瀛樺湪璺嚎涓婁笉瀛樺湪鐩爣鑺傜偣锛岃鏄庣洰鏍囪妭鐐规槸鍦ㄧ綉鍏充笂鎴栭潪鍚屼竴璺嚎涓婏紝涓嶅彲璺宠浆 + // 鍚﹀垯鐩爣鑺傜偣鐩稿浜庡綋鍓嶈妭鐐癸紝灞炰簬涓茶 + Boolean isSequential = FlowableUtils.iteratorCheckSequentialReferTarget(source, flowTaskVo.getTargetKey(), null, null); + if (!isSequential) { + throw new CustomException("褰撳墠鑺傜偣鐩稿浜庣洰鏍囪妭鐐癸紝涓嶅睘浜庝覆琛屽叧绯伙紝鏃犳硶鍥為��"); + } + + + // 鑾峰彇鎵�鏈夋甯歌繘琛岀殑浠诲姟鑺傜偣 Key锛岃繖浜涗换鍔′笉鑳界洿鎺ヤ娇鐢紝闇�瑕佹壘鍑哄叾涓渶瑕佹挙鍥炵殑浠诲姟 + List<Task> runTaskList = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).list(); + List<String> runTaskKeyList = new ArrayList<>(); + runTaskList.forEach(item -> runTaskKeyList.add(item.getTaskDefinitionKey())); + // 闇�閫�鍥炰换鍔″垪琛� + List<String> currentIds = new ArrayList<>(); + // 閫氳繃鐖剁骇缃戝叧鐨勫嚭鍙h繛绾匡紝缁撳悎 runTaskList 姣斿锛岃幏鍙栭渶瑕佹挙鍥炵殑浠诲姟 + List<UserTask> currentUserTaskList = FlowableUtils.iteratorFindChildUserTasks(target, runTaskKeyList, null, null); + currentUserTaskList.forEach(item -> { + currentIds.add(item.getId()); + }); + + // 寰幆鑾峰彇閭d簺闇�瑕佽鎾ゅ洖鐨勮妭鐐圭殑ID锛岀敤鏉ヨ缃┏鍥炲師鍥� + List<String> currentTaskIds = new ArrayList<>(); + currentIds.forEach(currentId -> runTaskList.forEach(runTask -> { + if (currentId.equals(runTask.getTaskDefinitionKey())) { + currentTaskIds.add(runTask.getId()); + } + })); + // 璁剧疆鍥為��鎰忚 + for (String currentTaskId : currentTaskIds) { + taskService.addComment(currentTaskId, task.getProcessInstanceId(), FlowComment.REBACK.getType(), flowTaskVo.getComment()); + } + SysUser loginUser = iFlowThirdService.getLoginUser(); + try { + // 璁剧疆澶勭悊浜� + taskService.setAssignee(task.getId(), loginUser.getUsername()); + // 1 瀵� 1 鎴� 澶� 瀵� 1 鎯呭喌锛宑urrentIds 褰撳墠瑕佽烦杞殑鑺傜偣鍒楄〃(1鎴栧)锛宼argetKey 璺宠浆鍒扮殑鑺傜偣(1) + runtimeService.createChangeActivityStateBuilder() + .processInstanceId(task.getProcessInstanceId()) + .moveActivityIdsToSingleActivityId(currentIds, flowTaskVo.getTargetKey()).changeState(); + + /*======================閫�鍥� 鍥炶皟浠ュ強鍏抽敭鏁版嵁淇濆瓨======================*/ + //涓氬姟鏁版嵁id + String dataId = flowTaskVo.getDataId(); + if (dataId==null) return; + //濡傛灉淇濆瓨鏁版嵁鍓嶆湭璋冪敤蹇呰皟鐨凢lowCommonService.initActBusiness鏂规硶锛屽氨浼氭湁闂 + FlowMyBusiness business = flowMyBusinessService.getByDataId(dataId); + //spring瀹瑰櫒绫诲悕 + String serviceImplName = business.getServiceImplName(); + FlowCallBackServiceI flowCallBackService = (FlowCallBackServiceI) SpringContextUtils.getBean(serviceImplName); + //璁剧疆鏁版嵁 + String doneUsers = business.getDoneUsers(); + // 澶勭悊杩囨祦绋嬬殑浜� + JSONArray doneUserList = new JSONArray(); + if (StrUtil.isNotBlank(doneUsers)){ + doneUserList = JSON.parseArray(doneUsers); + } + + if (!doneUserList.contains(loginUser.getUsername())){ + doneUserList.add(loginUser.getUsername()); + } + //**璺宠浆鍒扮洰鏍囪妭鐐� + List<Task> task2List = taskService.createTaskQuery().processInstanceId(business.getProcessInstanceId()).active().list(); + Task targetTask = task2List.get(0); + business.setActStatus(ActStatus.reject) + .setTaskId(targetTask.getId()) + .setTaskNameId(targetTask.getTaskDefinitionKey()) + .setTaskName(targetTask.getName()) + .setPriority(targetTask.getPriority()+"") + .setDoneUsers(doneUserList.toJSONString()) + ; + if (target!=null){ + UserTask target2 = (UserTask) target; + business.setPriority(target2.getPriority()); + if (StrUtil.equals(business.getTaskNameId(),ProcessConstants.START_NODE)){ + // 寮�濮嬭妭鐐广�傝缃鐞嗕汉涓虹敵璇蜂汉 + business.setTodoUsers(JSON.toJSONString(Lists.newArrayList(business.getProposer()))); + taskService.setAssignee(business.getTaskId(),business.getProposer()); + } else { + List<SysUser> sysUserFromTask = getSysUserFromTask(target2); + List<String> collect_username = sysUserFromTask.stream().map(SysUser::getUsername).collect(Collectors.toList()); + List<String> candidateUsers = flowTaskVo.getCandidateUsers(); + if (CollUtil.isNotEmpty(candidateUsers)){ + collect_username = candidateUsers; + } + business.setTodoUsers(JSON.toJSONString(collect_username)); + // 鍒犻櫎鍚庨噸鍐� + for (Task task2One : task2List) { + for (String oldUser : collect_username) { + taskService.deleteCandidateUser(task2One.getId(),oldUser); + } + } + Map<String, Object> values = flowTaskVo.getValues(); + if (values==null){ + values = MapUtil.newHashMap(); + values.put("dataId",dataId); + } else { + values.put("dataId",dataId); + } + List<String> beforeParamsCandidateUsernames = flowCallBackService.flowCandidateUsernamesOfTask(targetTask.getTaskDefinitionKey(), values); + if (CollUtil.isNotEmpty(beforeParamsCandidateUsernames)){ + if (CollUtil.isNotEmpty(candidateUsers)){ + beforeParamsCandidateUsernames = candidateUsers; + } + // 涓氬姟灞傛湁鎸囧畾鍊欓�変汉锛岃鐩� + for (Task task2One : task2List) { + for (String newUser : beforeParamsCandidateUsernames) { + taskService.addCandidateUser(task2One.getId(),newUser); + } + } + business.setTodoUsers(JSON.toJSONString(beforeParamsCandidateUsernames)); + } else { + for (Task task2One : task2List) { + for (String oldUser : collect_username) { + taskService.addCandidateUser(task2One.getId(), oldUser); + } + } + } + } + } + flowMyBusinessService.updateById(business); + // 娴佺▼澶勭悊瀹屽悗锛岃繘琛屽洖璋冧笟鍔″眰 + business.setValues(flowTaskVo.getValues()); + if (flowCallBackService!=null) flowCallBackService.afterFlowHandle(business); + } catch (FlowableObjectNotFoundException e) { + throw new CustomException("鏈壘鍒版祦绋嬪疄渚嬶紝娴佺▼鍙兘宸插彂鐢熷彉鍖�"); + } catch (FlowableException e) { + throw new CustomException("鏃犳硶鍙栨秷鎴栧紑濮嬫椿鍔�"); + } + } + + @Override + public Result findReturnTaskListByDataId(FlowTaskVo flowTaskVo) { + FlowMyBusiness business = flowMyBusinessService.getByDataId(flowTaskVo.getDataId()); + flowTaskVo.setTaskId(business.getTaskId()); + return findReturnTaskList(flowTaskVo); + } + /** + * 鑾峰彇鎵�鏈夊彲鍥為��鐨勮妭鐐� + * + * @param flowTaskVo + * @return + */ + @Override + public Result findReturnTaskList(FlowTaskVo flowTaskVo) { + // 褰撳墠浠诲姟 task + Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult(); + // 鑾峰彇娴佺▼瀹氫箟淇℃伅 + ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult(); + // 鑾峰彇鎵�鏈夎妭鐐逛俊鎭紝鏆備笉鑰冭檻瀛愭祦绋嬫儏鍐� + Process process = repositoryService.getBpmnModel(processDefinition.getId()).getProcesses().get(0); + Collection<FlowElement> flowElements = process.getFlowElements(); + // 鑾峰彇褰撳墠浠诲姟鑺傜偣鍏冪礌 + UserTask source = null; + if (flowElements != null) { + for (FlowElement flowElement : flowElements) { + // 绫诲瀷涓虹敤鎴疯妭鐐� + if (flowElement.getId().equals(task.getTaskDefinitionKey())) { + source = (UserTask) flowElement; + } + } + } + // 鑾峰彇鑺傜偣鐨勬墍鏈夎矾绾� + List<List<UserTask>> roads = FlowableUtils.findRoad(source, null, null, null); + // 鍙洖閫�鐨勮妭鐐瑰垪琛� + List<UserTask> userTaskList = new ArrayList<>(); + for (List<UserTask> road : roads) { + if (userTaskList.size() == 0) { + // 杩樻病鏈夊彲鍥為��鑺傜偣鐩存帴娣诲姞 + userTaskList = road; + } else { + // 濡傛灉宸叉湁鍥為��鑺傜偣锛屽垯姣斿鍙栦氦闆嗛儴鍒� + userTaskList.retainAll(road); + } + } + return Result.OK(userTaskList); + } + + /** + * 鍒犻櫎浠诲姟 + * + * @param flowTaskVo 璇锋眰瀹炰綋鍙傛暟 + */ + @Override + public void deleteTask(FlowTaskVo flowTaskVo) { + // todo 寰呯‘璁ゅ垹闄や换鍔℃槸鐗╃悊鍒犻櫎浠诲姟 杩樻槸閫昏緫鍒犻櫎锛岃杩欎釜浠诲姟鐩存帴閫氳繃锛� + taskService.deleteTask(flowTaskVo.getTaskId(),flowTaskVo.getComment()); + } + + /** + * 璁ら/绛炬敹浠诲姟 + * + * @param flowTaskVo 璇锋眰瀹炰綋鍙傛暟 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void claim(FlowTaskVo flowTaskVo) { + taskService.claim(flowTaskVo.getTaskId(), flowTaskVo.getUserId()); + } + + /** + * 鍙栨秷璁ら/绛炬敹浠诲姟 + * + * @param flowTaskVo 璇锋眰瀹炰綋鍙傛暟 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void unClaim(FlowTaskVo flowTaskVo) { + taskService.unclaim(flowTaskVo.getTaskId()); + } + + /** + * 濮旀淳浠诲姟 + * + * @param flowTaskVo 璇锋眰瀹炰綋鍙傛暟 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void delegateTask(FlowTaskVo flowTaskVo) { + taskService.delegateTask(flowTaskVo.getTaskId(), flowTaskVo.getAssignee()); + } + + + /** + * 杞姙浠诲姟 + * + * @param flowTaskVo 璇锋眰瀹炰綋鍙傛暟 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void assignTask(FlowTaskVo flowTaskVo) { + taskService.setAssignee(flowTaskVo.getTaskId(),flowTaskVo.getAssignee()); + } + + /** + * 鎴戝彂璧风殑娴佺▼ + * + * @param pageNum + * @param pageSize + * @return + */ + @Override + public Result myProcess(Integer pageNum, Integer pageSize) { + Page<FlowTaskDto> page = new Page<>(); + String username = iFlowThirdService.getLoginUser().getUsername(); + HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery() + .startedBy(username) + .orderByProcessInstanceStartTime() + .desc(); + List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery.listPage((pageNum - 1)*pageSize, pageSize); + page.setTotal(historicProcessInstanceQuery.count()); + List<FlowTaskDto> flowList = new ArrayList<>(); + for (HistoricProcessInstance hisIns : historicProcessInstances) { + FlowTaskDto flowTask = new FlowTaskDto(); + flowTask.setCreateTime(hisIns.getStartTime()); + flowTask.setFinishTime(hisIns.getEndTime()); + flowTask.setProcInsId(hisIns.getId()); + + // 璁$畻鑰楁椂 + if (Objects.nonNull(hisIns.getEndTime())) { + long time = hisIns.getEndTime().getTime() - hisIns.getStartTime().getTime(); + flowTask.setDuration(getDate(time)); + } else { + long time = System.currentTimeMillis() - hisIns.getStartTime().getTime(); + flowTask.setDuration(getDate(time)); + } + // 娴佺▼瀹氫箟淇℃伅 + ProcessDefinition pd = repositoryService.createProcessDefinitionQuery() + .processDefinitionId(hisIns.getProcessDefinitionId()) + .singleResult(); + flowTask.setDeployId(pd.getDeploymentId()); + flowTask.setProcDefName(pd.getName()); + flowTask.setProcDefVersion(pd.getVersion()); + flowTask.setCategory(pd.getCategory()); + flowTask.setProcDefVersion(pd.getVersion()); + // 褰撳墠鎵�澶勬祦绋� todo: 鏈湴鍚姩鏀惧紑浠ヤ笅娉ㄩ噴 + List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list(); + if (CollectionUtils.isNotEmpty(taskList)) { + flowTask.setTaskId(taskList.get(0).getId()); + } else { + List<HistoricTaskInstance> historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisIns.getId()).orderByHistoricTaskInstanceEndTime().desc().list(); + flowTask.setTaskId(historicTaskInstance.get(0).getId()); + } + flowList.add(flowTask); + } + page.setRecords(flowList); + return Result.OK(page); + } + + /** + * 鍙栨秷鐢宠 + * + * @param flowTaskVo + * @return + */ + @Override + public Result stopProcess(FlowTaskVo flowTaskVo) { + List<Task> task = taskService.createTaskQuery().processInstanceId(flowTaskVo.getInstanceId()).list(); + if (CollectionUtils.isEmpty(task)) { + throw new CustomException("娴佺▼鏈惎鍔ㄦ垨宸叉墽琛屽畬鎴愶紝鍙栨秷鐢宠澶辫触"); + } + + SysUser loginUser = iFlowThirdService.getLoginUser(); + ProcessInstance processInstance = + runtimeService.createProcessInstanceQuery().processInstanceId(flowTaskVo.getInstanceId()).singleResult(); + BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId()); + if (Objects.nonNull(bpmnModel)) { + Process process = bpmnModel.getMainProcess(); + List<EndEvent> endNodes = process.findFlowElementsOfType(EndEvent.class, false); + if (CollectionUtils.isNotEmpty(endNodes)) { + Authentication.setAuthenticatedUserId(loginUser.getUsername()); + taskService.addComment(task.get(0).getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(), + StringUtils.isBlank(flowTaskVo.getComment()) ? "鍙栨秷鐢宠" : flowTaskVo.getComment()); + String endId = endNodes.get(0).getId(); + List<Execution> executions = + runtimeService.createExecutionQuery().parentId(processInstance.getProcessInstanceId()).list(); + List<String> executionIds = new ArrayList<>(); + executions.forEach(execution -> executionIds.add(execution.getId())); + runtimeService.createChangeActivityStateBuilder().moveExecutionsToSingleActivityId(executionIds, + endId).changeState(); + } + } + + return Result.OK(); + } + + /** + * 鎾ゅ洖娴佺▼ todo 鐩墠瀛樺湪閿欒 + * + * @param flowTaskVo + * @return + */ + @Override + public Result revokeProcess(FlowTaskVo flowTaskVo) { + Task task = taskService.createTaskQuery().processInstanceId(flowTaskVo.getInstanceId()).singleResult(); + if (task == null) { + throw new CustomException("娴佺▼鏈惎鍔ㄦ垨宸叉墽琛屽畬鎴愶紝鏃犳硶鎾ゅ洖"); + } + + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List<HistoricTaskInstance> htiList = historyService.createHistoricTaskInstanceQuery() + .processInstanceId(task.getProcessInstanceId()) + .orderByTaskCreateTime() + .asc() + .list(); + String myTaskId = null; + HistoricTaskInstance myTask = null; + for (HistoricTaskInstance hti : htiList) { + if (loginUser.getUsername().toString().equals(hti.getAssignee())) { + myTaskId = hti.getId(); + myTask = hti; + break; + } + } + if (null == myTaskId) { + throw new CustomException("璇ヤ换鍔¢潪褰撳墠鐢ㄦ埛鎻愪氦锛屾棤娉曟挙鍥�"); + } + + String processDefinitionId = myTask.getProcessDefinitionId(); + BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId); + + //鍙橀噺 +// Map<String, VariableInstance> variables = runtimeService.getVariableInstances(currentTask.getExecutionId()); + String myActivityId = null; + List<HistoricActivityInstance> haiList = historyService.createHistoricActivityInstanceQuery() + .executionId(myTask.getExecutionId()).finished().list(); + for (HistoricActivityInstance hai : haiList) { + if (myTaskId.equals(hai.getTaskId())) { + myActivityId = hai.getActivityId(); + break; + } + } + FlowNode myFlowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(myActivityId); + + Execution execution = runtimeService.createExecutionQuery().executionId(task.getExecutionId()).singleResult(); + String activityId = execution.getActivityId(); + FlowNode flowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(activityId); + + //璁板綍鍘熸椿鍔ㄦ柟鍚� + List<SequenceFlow> oriSequenceFlows = new ArrayList<>(flowNode.getOutgoingFlows()); + + + return Result.OK(); + } + + /** + * 浠e姙浠诲姟鍒楄〃 + * + * @param pageNum 褰撳墠椤电爜 + * @param pageSize 姣忛〉鏉℃暟 + * @return + */ + @Override + public Result todoList(Integer pageNum, Integer pageSize) { + Page<FlowTaskDto> page = new Page<>(); + String username = iFlowThirdService.getLoginUser().getUsername(); + TaskQuery taskQuery = taskService.createTaskQuery() + .active() + .includeProcessVariables() + .taskAssignee(username) + .orderByTaskCreateTime().desc(); + page.setTotal(taskQuery.count()); + List<Task> taskList = taskQuery.listPage((pageNum - 1)*pageSize, pageSize); + List<FlowTaskDto> flowList = new ArrayList<>(); + for (Task task : taskList) { + FlowTaskDto flowTask = new FlowTaskDto(); + // 褰撳墠娴佺▼淇℃伅 + flowTask.setTaskId(task.getId()); + flowTask.setTaskDefKey(task.getTaskDefinitionKey()); + flowTask.setCreateTime(task.getCreateTime()); + flowTask.setProcDefId(task.getProcessDefinitionId()); + flowTask.setTaskName(task.getName()); + // 娴佺▼瀹氫箟淇℃伅 + ProcessDefinition pd = repositoryService.createProcessDefinitionQuery() + .processDefinitionId(task.getProcessDefinitionId()) + .singleResult(); + flowTask.setDeployId(pd.getDeploymentId()); + flowTask.setProcDefName(pd.getName()); + flowTask.setProcDefVersion(pd.getVersion()); + flowTask.setProcInsId(task.getProcessInstanceId()); + + // 娴佺▼鍙戣捣浜轰俊鎭� + HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(task.getProcessInstanceId()) + .singleResult(); + SysUser startUser = iFlowThirdService.getUserByUsername(historicProcessInstance.getStartUserId()); + List<String> departNamesByUsername = iFlowThirdService.getDepartNamesByUsername(historicProcessInstance.getStartUserId()); + flowTask.setStartUserId(startUser.getUsername()); + flowTask.setStartUserName(startUser.getRealname()); + flowTask.setStartDeptName(CollUtil.join(departNamesByUsername,"锛�")); + flowList.add(flowTask); + } + + page.setRecords(flowList); + return Result.OK(page); + } + + + /** + * 宸插姙浠诲姟鍒楄〃 + * + * @param pageNum 褰撳墠椤电爜 + * @param pageSize 姣忛〉鏉℃暟 + * @return + */ + @Override + public Result finishedList(Integer pageNum, Integer pageSize) { + Page<FlowTaskDto> page = new Page<>(); + String username = iFlowThirdService.getLoginUser().getUsername(); + HistoricTaskInstanceQuery taskInstanceQuery = historyService.createHistoricTaskInstanceQuery() + .includeProcessVariables() + .finished() + .taskAssignee(username) + .orderByHistoricTaskInstanceEndTime() + .desc(); + List<HistoricTaskInstance> historicTaskInstanceList = taskInstanceQuery.listPage((pageNum - 1)*pageSize, pageSize); + List<FlowTaskDto> hisTaskList = Lists.newArrayList(); + for (HistoricTaskInstance histTask : historicTaskInstanceList) { + FlowTaskDto flowTask = new FlowTaskDto(); + // 褰撳墠娴佺▼淇℃伅 + flowTask.setTaskId(histTask.getId()); + // 瀹℃壒浜哄憳淇℃伅 + flowTask.setCreateTime(histTask.getCreateTime()); + flowTask.setFinishTime(histTask.getEndTime()); + flowTask.setDuration(getDate(histTask.getDurationInMillis())); + flowTask.setProcDefId(histTask.getProcessDefinitionId()); + flowTask.setTaskDefKey(histTask.getTaskDefinitionKey()); + flowTask.setTaskName(histTask.getName()); + + // 娴佺▼瀹氫箟淇℃伅 + ProcessDefinition pd = repositoryService.createProcessDefinitionQuery() + .processDefinitionId(histTask.getProcessDefinitionId()) + .singleResult(); + flowTask.setDeployId(pd.getDeploymentId()); + flowTask.setProcDefName(pd.getName()); + flowTask.setProcDefVersion(pd.getVersion()); + flowTask.setProcInsId(histTask.getProcessInstanceId()); + flowTask.setHisProcInsId(histTask.getProcessInstanceId()); + + // 娴佺▼鍙戣捣浜轰俊鎭� + HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(histTask.getProcessInstanceId()) + .singleResult(); + SysUser startUser = iFlowThirdService.getUserByUsername(historicProcessInstance.getStartUserId()); + flowTask.setStartUserId(startUser.getUsername()); + flowTask.setStartUserName(startUser.getRealname()); + List<String> departNamesByUsername = iFlowThirdService.getDepartNamesByUsername(historicProcessInstance.getStartUserId()); + flowTask.setStartDeptName(CollUtil.join(departNamesByUsername,"锛�")); + hisTaskList.add(flowTask); + } + page.setTotal(hisTaskList.size()); + page.setRecords(hisTaskList); +// Map<String, Object> result = new HashMap<>(); +// result.put("result",page); +// result.put("finished",true); + return Result.OK(page); + } + + private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) { + Set<Object> seen = ConcurrentHashMap.newKeySet(); + return t -> seen.add(keyExtractor.apply(t)); + } + + /** + * 娴佺▼鍘嗗彶娴佽浆璁板綍 + * + * @param dataId 娴佺▼鏁版嵁Id + * @return + */ + @Override + public Result flowRecord(String dataId) { + FlowMyBusiness business = flowMyBusinessService.getByDataId(dataId); + String procInsId = business.getProcessInstanceId(); + Map<String, Object> map = new HashMap<String, Object>(); + if (StringUtils.isNotBlank(procInsId)) { + List<HistoricActivityInstance> list = historyService + .createHistoricActivityInstanceQuery() + .processInstanceId(procInsId) + .orderByHistoricActivityInstanceStartTime() + .desc().list(); + List<FlowTaskDto> hisFlowList = new ArrayList<>(); + for (HistoricActivityInstance histIns : list) { + if (StringUtils.isNotBlank(histIns.getTaskId())) { + FlowTaskDto flowTask = new FlowTaskDto(); + flowTask.setTaskId(histIns.getTaskId()); + flowTask.setTaskName(histIns.getActivityName()); + flowTask.setTaskDefKey(histIns.getActivityId()); + flowTask.setCreateTime(histIns.getStartTime()); + flowTask.setFinishTime(histIns.getEndTime()); + if (StringUtils.isNotBlank(histIns.getAssignee())) { + SysUser sysUser = iFlowThirdService.getUserByUsername(histIns.getAssignee()); + flowTask.setAssigneeId(sysUser.getUsername()); + flowTask.setAssigneeName(sysUser.getRealname()); + List<String> departNamesByUsername = iFlowThirdService.getDepartNamesByUsername(histIns.getAssignee()); + flowTask.setDeptName(CollUtil.join(departNamesByUsername,"锛�")); + if (StrUtil.equals(histIns.getActivityId(),ProcessConstants.START_NODE)){ + // 寮�濮嬭妭鐐癸紝鎶婂�欓�変汉璁剧疆涓哄彂璧蜂汉锛岃繖涓�煎凡琚叾浠栧湴鏂硅缃繃锛屼笌瀹為檯鍔炵悊浜轰竴鑷村嵆鍙� + flowTask.setCandidate(sysUser.getRealname()); + } + } + // 灞曠ず瀹℃壒浜哄憳 + List<HistoricIdentityLink> linksForTask = historyService.getHistoricIdentityLinksForTask(histIns.getTaskId()); + StringBuilder stringBuilder = new StringBuilder(); + for (HistoricIdentityLink identityLink : linksForTask) { + if (IdentityLinkType.CANDIDATE.equals(identityLink.getType())) { + if (StringUtils.isNotBlank(identityLink.getUserId())) { + SysUser sysUser = iFlowThirdService.getUserByUsername(identityLink.getUserId()); + stringBuilder.append(sysUser.getRealname()).append(","); + } + /*宸茬粡鍏ㄩ儴璁剧疆鍒� CANDIDATE 浜嗭紝涓嶆嬁缁勪簡*/ + /*if (StringUtils.isNotBlank(identityLink.getGroupId())) { + List<SysRole> allRole = iFlowThirdService.getAllRole(); + SysRole sysRole = allRole.stream().filter(o -> StringUtils.equals(identityLink.getGroupId(), o.getId())).findAny().orElse(new SysRole()); + stringBuilder.append(sysRole.getRoleName()).append(","); + }*/ + } + } + if (StringUtils.isNotBlank(stringBuilder)) { + flowTask.setCandidate(stringBuilder.substring(0, stringBuilder.length() - 1)); + } + + flowTask.setDuration(histIns.getDurationInMillis() == null || histIns.getDurationInMillis() == 0 ? null : getDate(histIns.getDurationInMillis())); + // 鑾峰彇鎰忚璇勮鍐呭 + List<Comment> commentList = taskService.getProcessInstanceComments(histIns.getProcessInstanceId()); + commentList.forEach(comment -> { + if (histIns.getTaskId().equals(comment.getTaskId())) { + flowTask.setComment(FlowCommentDto.builder().type(comment.getType()).comment(comment.getFullMessage()).build()); + } + }); + hisFlowList.add(flowTask); + } + } + map.put("flowList", hisFlowList); + } + // 鑾峰彇鍒濆鍖栬〃鍗� + String serviceImplName = business.getServiceImplName(); + FlowCallBackServiceI flowCallBackService = (FlowCallBackServiceI) SpringContextUtils.getBean(serviceImplName); + // 娴佺▼澶勭悊瀹屽悗锛岃繘琛屽洖璋冧笟鍔″眰 + if (flowCallBackService!=null){ + Object businessDataById = flowCallBackService.getBusinessDataById(dataId); + map.put("formData",businessDataById); + } + return Result.OK(map); + } + + /** + * 鏍规嵁浠诲姟ID鏌ヨ鎸傝浇鐨勮〃鍗曚俊鎭� + * + * @param taskId 浠诲姟Id + * @return + */ + @Override + public Task getTaskForm(String taskId) { + Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); + return task; + } + + /** + * 鑾峰彇娴佺▼杩囩▼鍥� + * + * @param processId + * @return + */ + @Override + public InputStream diagram(String processId) { + String processDefinitionId; + // 鑾峰彇褰撳墠鐨勬祦绋嬪疄渚� + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult(); + // 濡傛灉娴佺▼宸茬粡缁撴潫锛屽垯寰楀埌缁撴潫鑺傜偣 + if (Objects.isNull(processInstance)) { + HistoricProcessInstance pi = historyService.createHistoricProcessInstanceQuery().processInstanceId(processId).singleResult(); + + processDefinitionId = pi.getProcessDefinitionId(); + } else {// 濡傛灉娴佺▼娌℃湁缁撴潫锛屽垯鍙栧綋鍓嶆椿鍔ㄨ妭鐐� + // 鏍规嵁娴佺▼瀹炰緥ID鑾峰緱褰撳墠澶勪簬娲诲姩鐘舵�佺殑ActivityId鍚堥泦 + ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult(); + processDefinitionId = pi.getProcessDefinitionId(); + } + + // 鑾峰緱娲诲姩鐨勮妭鐐� + List<HistoricActivityInstance> highLightedFlowList = historyService.createHistoricActivityInstanceQuery().processInstanceId(processId).orderByHistoricActivityInstanceStartTime().asc().list(); + + List<String> highLightedFlows = new ArrayList<>(); + List<String> highLightedNodes = new ArrayList<>(); + //楂樹寒绾� + for (HistoricActivityInstance tempActivity : highLightedFlowList) { + if ("sequenceFlow".equals(tempActivity.getActivityType())) { + //楂樹寒绾� + highLightedFlows.add(tempActivity.getActivityId()); + } else { + //楂樹寒鑺傜偣 + highLightedNodes.add(tempActivity.getActivityId()); + } + } + + //鑾峰彇娴佺▼鍥� + BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId); + ProcessEngineConfiguration configuration = processEngine.getProcessEngineConfiguration(); + //鑾峰彇鑷畾涔夊浘鐗囩敓鎴愬櫒 + ProcessDiagramGenerator diagramGenerator = new CustomProcessDiagramGenerator(); + InputStream in = diagramGenerator.generateDiagram(bpmnModel, "png", highLightedNodes, highLightedFlows, configuration.getActivityFontName(), + configuration.getLabelFontName(), configuration.getAnnotationFontName(), configuration.getClassLoader(), 1.0, true); + return in; + + } + + /** + * 鑾峰彇娴佺▼鎵ц杩囩▼ + * + * @param procInsId + * @return + */ + @Override + public List<FlowViewerDto> getFlowViewer(String procInsId) { + List<FlowViewerDto> flowViewerList = new ArrayList<>(); + FlowViewerDto flowViewerDto; + // 鑾峰緱娲诲姩鐨勮妭鐐� + List<HistoricActivityInstance> hisActIns = historyService.createHistoricActivityInstanceQuery() + .processInstanceId(procInsId) + .orderByHistoricActivityInstanceStartTime() + .asc().list(); + for (HistoricActivityInstance activityInstance : hisActIns) { + if (!"sequenceFlow".equals(activityInstance.getActivityType())) { + flowViewerDto = new FlowViewerDto(); + flowViewerDto.setKey(activityInstance.getActivityId()); + flowViewerDto.setCompleted(!Objects.isNull(activityInstance.getEndTime())); + + for (FlowViewerDto viewerDto : flowViewerList) { + String key = viewerDto.getKey(); + if (key.equals(flowViewerDto.getKey())){ + // 閲嶅鍒犻櫎鍚庨潰鏇存柊 + flowViewerList.remove(viewerDto); + break; + } + } + flowViewerList.add(flowViewerDto); + } + } + + return flowViewerList; + } + + @Override + public List<FlowViewerDto> getFlowViewerByDataId(String dataId) { + LambdaQueryWrapper<FlowMyBusiness> flowMyBusinessLambdaQueryWrapper = new LambdaQueryWrapper<>(); + flowMyBusinessLambdaQueryWrapper.eq(FlowMyBusiness::getDataId,dataId) + ; + //濡傛灉淇濆瓨鏁版嵁鍓嶆湭璋冪敤蹇呰皟鐨凢lowCommonService.initActBusiness鏂规硶锛屽氨浼氭湁闂 + FlowMyBusiness business = flowMyBusinessService.getOne(flowMyBusinessLambdaQueryWrapper); + // 1.鎵ц杩囩殑姝ラ + List<FlowViewerDto> flowViewers = this.getFlowViewer(business.getProcessInstanceId()); + // 2.鑾峰彇鎵�鏈夎妭鐐逛俊鎭紝鏍规嵁鎵�鏈夎妭鐐� 鎸夐『搴� 鍜屾墽琛岃繃鐨勬瘮杈冿紝椹冲洖鐨勮妭鐐瑰氨琚烦杩� + Process process = repositoryService.getBpmnModel(business.getProcessDefinitionId()).getProcesses().get(0); + List<FlowElement> flowElements = Lists.newArrayList(process.getFlowElements()); + // 鑾峰彇褰撳墠浠诲姟鑺傜偣鍏冪礌 + List<FlowViewerDto> reflowViewers = Lists.newArrayList(); + // *椤哄簭鐨凨ey + List<String> orderKeys = Lists.newArrayList(); + if (flowElements != null) { + for (FlowElement flowElement : flowElements) { + try { + // 寮�濮嬭妭鐐� + StartEvent stev = (StartEvent) flowElement; + //绗竴涓猭ey鑺傜偣锛� + String firstKey = stev.getId(); + orderKeys.add(firstKey); + //椤哄簭鑾峰彇鑺傜偣 + this.appendKeys(orderKeys, firstKey,flowElements); + } catch (Exception e) { + break; + } + + } + + for (String key : orderKeys) { + Optional<FlowViewerDto> any = flowViewers.stream().filter(o -> StrUtil.equals(o.getKey(), key)).findAny(); + if(any.isPresent()){ + FlowViewerDto viewerDto = any.get(); + reflowViewers.add(viewerDto); + if (!viewerDto.isCompleted()){ + // 宸插埌姝e湪绛夊緟鎵ц鐨勮妭鐐癸紝鍚庨潰鐨勪笉瑕佷簡 + break; + } + } + } + } + for (FlowViewerDto flowViewer : flowViewers) { + boolean present = reflowViewers.stream().filter(o -> StrUtil.equals(o.getKey(), flowViewer.getKey())).findAny().isPresent(); + flowViewer.setBack(!present); + } + //return reflowViewers; + return flowViewers; + } + + /** + * 椤哄簭鎶藉彇鑺傜偣 + * @param orderKeys 瀹瑰櫒 + * @param sourceKey 婧� + * @param flowElements 鎵�鏈夌殑鑺傜偣瀵硅薄 + */ + private void appendKeys(List<String> orderKeys, String sourceKey, List<FlowElement> flowElements) { + for (FlowElement flowElement : flowElements) { + try { + SequenceFlow sf = (SequenceFlow) flowElement; + String sourceRef = sf.getSourceRef(); + String targetRef = sf.getTargetRef(); + if (sourceKey.equals(sourceRef)&&targetRef!=null){ + orderKeys.add(targetRef); + this.appendKeys(orderKeys,targetRef,flowElements); + } + } catch (Exception e) { + continue; + } + + } + } + + /** + * 鑾峰彇娴佺▼鍙橀噺 + * + * @param taskId + * @return + */ + @Override + public Result processVariables(String taskId) { + // 娴佺▼鍙橀噺 + HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().finished().taskId(taskId).singleResult(); + if (Objects.nonNull(historicTaskInstance)) { + return Result.OK(historicTaskInstance.getProcessVariables()); + } else { + Map<String, Object> variables = taskService.getVariables(taskId); + return Result.OK(variables); + } + } + + /** + * 鑾峰彇涓嬩竴鑺傜偣 + * + * @param flowTaskVo 浠诲姟 + * @return + */ + @Override + public Result getNextFlowNode(FlowTaskVo flowTaskVo) { + // todo 浼间箮閫昏緫鏈啓瀹岋紝寰呮鏌� + FlowNextDto flowNextDto = this.getNextFlowNode(flowTaskVo.getTaskId(), flowTaskVo.getValues()); + if (flowNextDto==null) { + return Result.OK("娴佺▼宸插畬缁�", null); + } + return Result.OK(flowNextDto); + } + + /** + * 鑾峰彇涓嬩竴涓妭鐐逛俊鎭�,娴佺▼瀹氫箟涓婄殑鑺傜偣淇℃伅 + * @param taskId 褰撳墠鑺傜偣id + * @param values 娴佺▼鍙橀噺 + * @return 濡傛灉杩斿洖null锛岃〃绀烘病鏈変笅涓�涓妭鐐癸紝娴佺▼缁撴潫 + */ + public FlowNextDto getNextFlowNode(String taskId, Map<String, Object> values) { + //褰撳墠鑺傜偣 + Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); + if (Objects.nonNull(task)) { + // 涓嬩釜浠诲姟鑺傜偣 + List<UserTask> nextUserTask = FindNextNodeUtil.getNextUserTasks(repositoryService, task, values); + if (CollectionUtils.isNotEmpty(nextUserTask)) { + FlowNextDto flowNextDto = new FlowNextDto(); + for (UserTask userTask : nextUserTask) { + flowNextDto.setUserTask(userTask); + //寰呭姙浜哄憳 + List<SysUser> sysUserFromTask = this.getSysUserFromTask(userTask); + flowNextDto.setUserList(sysUserFromTask); + + MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics(); + if (Objects.nonNull(multiInstance)) { + // 浼氱 澶氬疄渚� + String collectionString = multiInstance.getInputDataItem(); + Object colObj = values.get(collectionString); + List<String> userNameList = null; + if(colObj!=null){ + userNameList = (List) colObj; + } + if (CollUtil.isNotEmpty(userNameList)){ + // 寰呭姙浜哄憳浠庡彉閲忎腑鑾峰彇 鍚﹀垯灏辨槸鑺傜偣涓厤缃殑鐢ㄦ埛 sysUserFromTask + List<SysUser> userList = Lists.newArrayList(); + for (String username : userNameList) { + SysUser userByUsername = iFlowThirdService.getUserByUsername(username); + if (userByUsername==null){ + throw new CustomException(username + " 鐢ㄦ埛鍚嶆湭鎵惧埌"); + } else { + userList.add(userByUsername); + } + } + flowNextDto.setUserList(userList); + } else { + // 鍙橀噺涓病鏈変紶鍏ワ紝鍐欏叆鑺傜偣涓厤缃殑鐢ㄦ埛 + List<String> collect_username = sysUserFromTask.stream().map(SysUser::getUsername).collect(Collectors.toList()); + values.put(collectionString,collect_username); + } + } else { + // todo 璇诲彇鑷畾涔夎妭鐐瑰睘鎬у仛浜涘暐锛� + //String dataType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_DATA_TYPE); + String userType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_USER_TYPE); + } + } + return flowNextDto; + } + } + return null; + + } + public List<SysUser> getSysUserFromTask(UserTask userTask) { + String assignee = userTask.getAssignee(); + if (StrUtil.isNotBlank(assignee)){ + // 鎸囧畾鍗曚汉 + SysUser userByUsername = iFlowThirdService.getUserByUsername(assignee); + return Lists.newArrayList(userByUsername); + } + List<String> candidateUsers = userTask.getCandidateUsers(); + if (CollUtil.isNotEmpty(candidateUsers)){ + // 鎸囧畾澶氫汉 + List<SysUser> list = iFlowThirdService.getAllUser(); + return list.stream().filter(o->candidateUsers.contains(o.getUsername())).collect(Collectors.toList()); + } + List<String> candidateGroups = userTask.getCandidateGroups(); + if (CollUtil.isNotEmpty(candidateGroups)){ + // 鎸囧畾澶氱粍 + List<SysUser> userList = Lists.newArrayList(); + for (String candidateGroup : candidateGroups) { + List<SysUser> usersByRoleId = iFlowThirdService.getUsersByRoleId(candidateGroup); + userList.addAll(usersByRoleId); + } + return userList; + } + return Lists.newArrayList(); + } + /** + * 娴佺▼瀹屾垚鏃堕棿澶勭悊 + * + * @param ms + * @return + */ + private String getDate(long ms) { + + long day = ms / (24 * 60 * 60 * 1000); + long hour = (ms / (60 * 60 * 1000) - day * 24); + long minute = ((ms / (60 * 1000)) - day * 24 * 60 - hour * 60); + long second = (ms / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60); + + if (day > 0) { + return day + "澶�" + hour + "灏忔椂" + minute + "鍒嗛挓"; + } + if (hour > 0) { + return hour + "灏忔椂" + minute + "鍒嗛挓"; + } + if (minute > 0) { + return minute + "鍒嗛挓"; + } + if (second > 0) { + return second + "绉�"; + } else { + return 0 + "绉�"; + } + } +} diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusiness.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusiness.class new file mode 100644 index 0000000..17b08d1 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusiness.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusinessDto.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusinessDto.class new file mode 100644 index 0000000..2c5b155 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/entity/FlowMyBusinessDto.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/mapper/FlowMyBusinessMapper.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/mapper/FlowMyBusinessMapper.class new file mode 100644 index 0000000..11f80f5 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/mapper/FlowMyBusinessMapper.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml new file mode 100644 index 0000000..78b00c1 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.jeecg.modules.flowable.apithird.business.mapper.FlowMyBusinessMapper"> + +</mapper> diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.class new file mode 100644 index 0000000..caffd89 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.class new file mode 100644 index 0000000..9d78758 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/common/constant/ProcessConstants.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/common/constant/ProcessConstants.class new file mode 100644 index 0000000..498dc04 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/common/constant/ProcessConstants.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/common/enums/FlowComment.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/common/enums/FlowComment.class new file mode 100644 index 0000000..fe656f6 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/common/enums/FlowComment.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/common/exception/CustomException.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/common/exception/CustomException.class new file mode 100644 index 0000000..6ecd7a7 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/common/exception/CustomException.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/ActStatus.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/ActStatus.class new file mode 100644 index 0000000..eabff01 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/ActStatus.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/FlowBeforeParams.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/FlowBeforeParams.class new file mode 100644 index 0000000..f1c7cdc --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/FlowBeforeParams.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/SysCategory.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/SysCategory.class new file mode 100644 index 0000000..699f9b1 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/SysCategory.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/SysRole.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/SysRole.class new file mode 100644 index 0000000..5c161b6 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/SysRole.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/SysUser.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/SysUser.class new file mode 100644 index 0000000..170f340 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/entity/SysUser.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/service/FlowCallBackServiceI.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/service/FlowCallBackServiceI.class new file mode 100644 index 0000000..1931e30 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/service/FlowCallBackServiceI.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/service/FlowCommonService.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/service/FlowCommonService.class new file mode 100644 index 0000000..05e17ab --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/service/FlowCommonService.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/service/IFlowThirdService.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/service/IFlowThirdService.class new file mode 100644 index 0000000..aba3434 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/apithird/service/IFlowThirdService.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/config/MyDefaultProcessDiagramCanvas.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/config/MyDefaultProcessDiagramCanvas.class new file mode 100644 index 0000000..0abbac3 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/config/MyDefaultProcessDiagramCanvas.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/controller/FlowDefinitionController.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/controller/FlowDefinitionController.class new file mode 100644 index 0000000..f9763c7 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/controller/FlowDefinitionController.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/controller/FlowInstanceController.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/controller/FlowInstanceController.class new file mode 100644 index 0000000..240b115 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/controller/FlowInstanceController.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/controller/FlowTaskController.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/controller/FlowTaskController.class new file mode 100644 index 0000000..ef057f3 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/controller/FlowTaskController.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowCommentDto$FlowCommentDtoBuilder.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowCommentDto$FlowCommentDtoBuilder.class new file mode 100644 index 0000000..28137bd --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowCommentDto$FlowCommentDtoBuilder.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowCommentDto.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowCommentDto.class new file mode 100644 index 0000000..afba285 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowCommentDto.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowNextDto.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowNextDto.class new file mode 100644 index 0000000..52d241f --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowNextDto.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowProcDefDto.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowProcDefDto.class new file mode 100644 index 0000000..a3d4d1d --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowProcDefDto.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowSaveXmlVo.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowSaveXmlVo.class new file mode 100644 index 0000000..8fda5a0 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowSaveXmlVo.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.class new file mode 100644 index 0000000..9d8fe96 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowViewerDto.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowViewerDto.class new file mode 100644 index 0000000..d620eee --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/dto/FlowViewerDto.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/vo/FlowTaskVo.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/vo/FlowTaskVo.class new file mode 100644 index 0000000..b7feede --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/domain/vo/FlowTaskVo.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/factory/FlowServiceFactory.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/factory/FlowServiceFactory.class new file mode 100644 index 0000000..959fe18 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/factory/FlowServiceFactory.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/CustomProcessDiagramCanvas.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/CustomProcessDiagramCanvas.class new file mode 100644 index 0000000..d28bf29 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/CustomProcessDiagramCanvas.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/CustomProcessDiagramGenerator.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/CustomProcessDiagramGenerator.class new file mode 100644 index 0000000..b0b2db8 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/CustomProcessDiagramGenerator.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/FindNextNodeUtil.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/FindNextNodeUtil.class new file mode 100644 index 0000000..7c15640 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/FindNextNodeUtil.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/FlowableConfig.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/FlowableConfig.class new file mode 100644 index 0000000..8b46007 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/FlowableConfig.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/FlowableUtils.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/FlowableUtils.class new file mode 100644 index 0000000..ad24e19 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/flow/FlowableUtils.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/listener/UserTaskListener.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/listener/UserTaskListener.class new file mode 100644 index 0000000..0f28a4f --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/listener/UserTaskListener.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/IFlowDefinitionService.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/IFlowDefinitionService.class new file mode 100644 index 0000000..c84498b --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/IFlowDefinitionService.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/IFlowInstanceService.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/IFlowInstanceService.class new file mode 100644 index 0000000..2f9206b --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/IFlowInstanceService.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/IFlowTaskService.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/IFlowTaskService.class new file mode 100644 index 0000000..e69fa61 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/IFlowTaskService.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/impl/FlowDefinitionServiceImpl.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/impl/FlowDefinitionServiceImpl.class new file mode 100644 index 0000000..63f491a --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/impl/FlowDefinitionServiceImpl.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/impl/FlowInstanceServiceImpl.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/impl/FlowInstanceServiceImpl.class new file mode 100644 index 0000000..02ac850 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/impl/FlowInstanceServiceImpl.class Binary files differ diff --git a/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.class b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.class new file mode 100644 index 0000000..b6e1c36 --- /dev/null +++ b/lxzn-module-flowable/target/classes/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.class Binary files differ diff --git a/lxzn-module-system/lxzn-system-biz/pom.xml b/lxzn-module-system/lxzn-system-biz/pom.xml index 548ab9c..810e691 100644 --- a/lxzn-module-system/lxzn-system-biz/pom.xml +++ b/lxzn-module-system/lxzn-system-biz/pom.xml @@ -34,11 +34,17 @@ <groupId>org.jeecgframework.jimureport</groupId> <artifactId>jimureport-spring-boot-starter</artifactId> </dependency> - <!-- 绉湪鎶ヨ〃 mongo redis 鏀寔鍖� - <dependency> - <groupId>org.jeecgframework.jimureport</groupId> - <artifactId>jimureport-nosql-starter</artifactId> - </dependency>--> + <dependency> + <groupId>org.jeecgframework.boot</groupId> + <artifactId>lxzn-module-flowable</artifactId> + <version>3.4.3</version> + <scope>compile</scope> + </dependency> + <!-- 绉湪鎶ヨ〃 mongo redis 鏀寔鍖� + <dependency> + <groupId>org.jeecgframework.jimureport</groupId> + <artifactId>jimureport-nosql-starter</artifactId> + </dependency>--> </dependencies> - + </project> diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/flow/FlowThirdServiceImpl.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/flow/FlowThirdServiceImpl.java new file mode 100644 index 0000000..4e41d2f --- /dev/null +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/flow/FlowThirdServiceImpl.java @@ -0,0 +1,112 @@ +package org.jeecg.modules.flow; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.api.ISysBaseAPI; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.flowable.apithird.entity.SysCategory; +import org.jeecg.modules.flowable.apithird.entity.SysRole; +import org.jeecg.modules.flowable.apithird.entity.SysUser; +import org.jeecg.modules.flowable.apithird.service.IFlowThirdService; +import org.jeecg.modules.system.service.impl.SysRoleServiceImpl; +import org.jeecg.modules.system.service.impl.SysUserServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * flowable妯″潡蹇呴渶瀹炵幇绫� + *@author PanMeiCheng + *@date 2021/11/22 + *@version 1.0 + */ +@Service +public class FlowThirdServiceImpl implements IFlowThirdService { + @Autowired + ISysBaseAPI sysBaseAPI; + @Autowired + SysUserServiceImpl sysUserService; + @Autowired + SysRoleServiceImpl sysRoleService; + @Override + public SysUser getLoginUser() { + LoginUser sysUser = null; + SysUser copyProperties = null; + try { + sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + + System.out.println( ); + copyProperties = BeanUtil.copyProperties(sysUser, SysUser.class); + } catch (Exception e) { + //e.printStackTrace(); + } + return copyProperties; + } + + @Override + public List<SysUser> getAllUser() { + List<org.jeecg.modules.system.entity.SysUser> list = sysUserService.list(); + List<SysUser> userList = list.stream().map(o -> BeanUtil.copyProperties(o, SysUser.class)).collect(Collectors.toList()); + return userList; + } + + @Override + public List<SysUser> getUsersByRoleId(String roleId) { + Page<org.jeecg.modules.system.entity.SysUser> page = new Page<>(1,Integer.MAX_VALUE); + IPage<org.jeecg.modules.system.entity.SysUser> userByRoleId = sysUserService.getUserByRoleId(page, roleId, null); + List<org.jeecg.modules.system.entity.SysUser> records = userByRoleId.getRecords(); + List<SysUser> userList = records.stream().map(o -> BeanUtil.copyProperties(o, SysUser.class)).collect(Collectors.toList()); + return userList; + } + + + @Override + public SysUser getUserByUsername(String username) { + LoginUser userByName = sysBaseAPI.getUserByName(username); + return userByName==null?null:BeanUtil.copyProperties(userByName, SysUser.class); + } + + @Override + public List<SysRole> getAllRole() { + List<org.jeecg.modules.system.entity.SysRole> list = sysRoleService.list(); + List<SysRole> roleList = list.stream().map(o -> BeanUtil.copyProperties(o, SysRole.class)).collect(Collectors.toList()); + return roleList; + } + @Override + public List<SysCategory> getAllCategory() { + // todo 鑾峰彇娴佺▼鍒嗙被淇℃伅锛屾澶勪负渚嬪瓙 + SysCategory category1 = new SysCategory(); + category1.setId("drApproval"); + category1.setName("瀵煎叆瀹℃壒娴佺▼"); + SysCategory category2 = new SysCategory(); + category2.setId("ggApproval"); + category2.setName("璁捐鏇存敼鍗曟祦绋�"); + SysCategory category3 = new SysCategory(); + category3.setId("jjApproval"); + category3.setName("鏈哄姞宸ヨ壓瑙勭▼娴佺▼"); + SysCategory category4 = new SysCategory(); + category4.setId("lsApproval"); + category4.setName("涓存椂宸ヨ壓瑙勭▼娴佺▼"); + SysCategory category5 = new SysCategory(); + category5.setId("fxApproval"); + category5.setName("杩斾慨宸ヨ壓瑙勭▼娴佺▼"); + SysCategory category6 = new SysCategory(); + category6.setId("jjggApproval"); + category6.setName("鏈哄姞鏇存敼鍗曟祦绋�"); + ArrayList<SysCategory> sysCategories = Lists.newArrayList(category1,category2,category3,category4,category5,category6); + return sysCategories; + } + + @Override + public List<String> getDepartNamesByUsername(String username) { + List<String> departNamesByUsername = sysBaseAPI.getDepartNamesByUsername(username); + return departNamesByUsername; + } +} diff --git a/lxzn-module-system/lxzn-system-start/pom.xml b/lxzn-module-system/lxzn-system-start/pom.xml index 8291eb6..279bc7c 100644 --- a/lxzn-module-system/lxzn-system-start/pom.xml +++ b/lxzn-module-system/lxzn-system-start/pom.xml @@ -30,10 +30,10 @@ <artifactId>lxzn-module-dnc</artifactId> <version>${jeecgboot.version}</version> </dependency> - <!-- activiti 妯″潡 --> + <!-- flowable 妯″潡 --> <dependency> <groupId>org.jeecgframework.boot</groupId> - <artifactId>lxzn-module-activiti</artifactId> + <artifactId>lxzn-module-flowable</artifactId> <version>${jeecgboot.version}</version> </dependency> diff --git a/lxzn-module-system/lxzn-system-start/src/main/java/org/jeecg/JeecgSystemApplication.java b/lxzn-module-system/lxzn-system-start/src/main/java/org/jeecg/JeecgSystemApplication.java index 10dacec..fb33d25 100644 --- a/lxzn-module-system/lxzn-system-start/src/main/java/org/jeecg/JeecgSystemApplication.java +++ b/lxzn-module-system/lxzn-system-start/src/main/java/org/jeecg/JeecgSystemApplication.java @@ -1,7 +1,6 @@ package org.jeecg; import lombok.extern.slf4j.Slf4j; -import org.activiti.spring.boot.SecurityAutoConfiguration; import org.jeecg.common.util.oConvertUtils; import org.springframework.boot.SpringApplication; import org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration; @@ -20,8 +19,7 @@ * 鎶ラ敊鎻愰啋: 鏈泦鎴恗ongo鎶ラ敊锛屽彲浠ユ墦寮�鍚姩绫讳笂闈㈢殑娉ㄩ噴 exclude={MongoAutoConfiguration.class} */ @Slf4j -@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, SecurityAutoConfiguration.class, - SecurityAutoConfiguration.class, +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class}) //@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class}) public class JeecgSystemApplication extends SpringBootServletInitializer { diff --git a/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml b/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml index 3e0af92..da6655d 100644 --- a/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml +++ b/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml @@ -126,7 +126,7 @@ connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 datasource: master: - url: jdbc:sqlserver://192.168.1.118:1433;databasename=LXZN_TEST_HANGYU + url: jdbc:sqlserver://192.168.1.118:1433;databasename=LXZN_TEST_HANGYU;nullCatalogMeansCurrent=true username: sa password: 123 driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver @@ -136,22 +136,26 @@ host: 127.0.0.1 port: 6379 password: 123456 - activiti: - #1.flase锛氶粯璁ゅ�笺�俛ctiviti鍦ㄥ惎鍔ㄦ椂锛屽姣旀暟鎹簱琛ㄤ腑淇濆瓨鐨勭増鏈紝濡傛灉娌℃湁琛ㄦ垨鑰呯増鏈笉鍖归厤锛屽皢鎶涘嚭寮傚父 - #2.true锛� activiti浼氬鏁版嵁搴撲腑鎵�鏈夎〃杩涜鏇存柊鎿嶄綔銆傚鏋滆〃涓嶅瓨鍦紝鍒欒嚜鍔ㄥ垱寤� - #3.create_drop锛� 鍦╝ctiviti鍚姩鏃跺垱寤鸿〃锛屽湪鍏抽棴鏃跺垹闄よ〃锛堝繀椤绘墜鍔ㄥ叧闂紩鎿庯紝鎵嶈兘鍒犻櫎琛級 - #4.drop-create锛� 鍦╝ctiviti鍚姩鏃跺垹闄ゅ師鏉ョ殑鏃ц〃锛岀劧鍚庡湪鍒涘缓鏂拌〃锛堜笉闇�瑕佹墜鍔ㄥ叧闂紩鎿庯級 - database-schema-update: true - # 妫�娴嬪巻鍙蹭俊鎭〃鏄惁瀛樺湪锛宎ctiviti7榛樿涓嶇敓鎴愬巻鍙蹭俊鎭〃锛屽紑鍚巻鍙茶〃 - db-history-used: true - # 鍘嗗彶璁板綍瀛樺偍绛夌骇 - history-level: full - check-process-definitions: true - #鍦ㄦ祦绋嬪紩鎿庡惎鍔ㄥ氨婵�娲籄syncExecutor,寮傛 true false 鍏抽棴 锛堝垏璁板叧闂級 - async-executor-activate: false - async-executor-enabled: true -activiti: - enable: false # true 鍚敤瀹℃壒 false 涓嶅惎鐢ㄥ鎵� +# activiti: +# #1.flase锛氶粯璁ゅ�笺�俛ctiviti鍦ㄥ惎鍔ㄦ椂锛屽姣旀暟鎹簱琛ㄤ腑淇濆瓨鐨勭増鏈紝濡傛灉娌℃湁琛ㄦ垨鑰呯増鏈笉鍖归厤锛屽皢鎶涘嚭寮傚父 +# #2.true锛� activiti浼氬鏁版嵁搴撲腑鎵�鏈夎〃杩涜鏇存柊鎿嶄綔銆傚鏋滆〃涓嶅瓨鍦紝鍒欒嚜鍔ㄥ垱寤� +# #3.create_drop锛� 鍦╝ctiviti鍚姩鏃跺垱寤鸿〃锛屽湪鍏抽棴鏃跺垹闄よ〃锛堝繀椤绘墜鍔ㄥ叧闂紩鎿庯紝鎵嶈兘鍒犻櫎琛級 +# #4.drop-create锛� 鍦╝ctiviti鍚姩鏃跺垹闄ゅ師鏉ョ殑鏃ц〃锛岀劧鍚庡湪鍒涘缓鏂拌〃锛堜笉闇�瑕佹墜鍔ㄥ叧闂紩鎿庯級 +# database-schema-update: true +# # 妫�娴嬪巻鍙蹭俊鎭〃鏄惁瀛樺湪锛宎ctiviti7榛樿涓嶇敓鎴愬巻鍙蹭俊鎭〃锛屽紑鍚巻鍙茶〃 +# db-history-used: true +# # 鍘嗗彶璁板綍瀛樺偍绛夌骇 +# history-level: full +# check-process-definitions: true +# #鍦ㄦ祦绋嬪紩鎿庡惎鍔ㄥ氨婵�娲籄syncExecutor,寮傛 true false 鍏抽棴 锛堝垏璁板叧闂級 +# async-executor-activate: false +# async-executor-enabled: true +flowable: + #鍏抽棴瀹氭椂浠诲姟JOB + async-executor-activate: false + database-schema-update: true +#activiti: +# enable: false # true 鍚敤瀹℃壒 false 涓嶅惎鐢ㄥ鎵� #mybatis plus 璁剧疆 mybatis-plus: mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml diff --git a/pom.xml b/pom.xml index 70d6ea6..414d61e 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ <!-- 鏁版嵁搴撻┍鍔� --> <postgresql.version>42.2.25</postgresql.version> <ojdbc6.version>11.2.0.3</ojdbc6.version> - <sqljdbc4.version>4.0</sqljdbc4.version> + <mssql-jdbc.version>8.4.1.jre8</mssql-jdbc.version> <mysql-connector-java.version>8.0.27</mysql-connector-java.version> <hutool.version>5.3.8</hutool.version> @@ -66,7 +66,7 @@ <module>lxzn-module-system</module> <module>lxzn-module-mdc</module> <module>lxzn-module-dnc</module> - <module>lxzn-module-activiti</module> + <module>lxzn-module-flowable</module> </modules> <repositories> -- Gitblit v1.9.3