diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 79e4141..f595fd9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,42 +1,14 @@ -include: https://api.choerodon.com.cn/devops/v1/projects/1529/ci_contents/pipelines/cd3fd533-2849-4294-8fbb-54653a1b7a89/content.yaml +include: https://api.choerodon.com.cn/devops/v1/projects/261899051275677696/ci_contents/pipelines/203636d9-de7c-4e7f-9b05-24e2cb668bd7/content.yaml -#image: registry.cn-shanghai.aliyuncs.com/c7n/cibase:0.11.4 +#include: https://api.choerodon.com.cn/devops/v1/projects/1529/ci_contents/pipelines/cd3fd533-2849-4294-8fbb-54653a1b7a89/content.yaml # -#stages: -# - build -# - release -# -#build front: -# stage: build -# script: -# - npm config set "//${NPM_REPO}:_authToken" "${NPM_TOKEN}" -# - npm config set "//${NPM_REGISTRY}:_authToken" "${NPM_TOKEN}" -# - npm config set always-auth true -# - yarn install --registry "https://${NPM_REPO}" --sass-binary-site=http://npm.taobao.org/mirrors/node-sass -# - chmod -R 755 node_modules -# - npm run compile -# - npm publish --registry "https://${NPM_REGISTRY}" -# - curl -sX POST -F token=${FRONT_REPOSITORY_TOKEN} -F ref=${REF_NAME} https://code.choerodon.com.cn/api/v4/projects/7909/trigger/pipeline -# except: -# changes: -# - pom.xml -# - src/**/* -# - docker/**/* -# - chart/**/* -# - init-mysql-database.sh -# - .circleci/**/* -# - .gitignore -# - .github/**/* -# - .gitlab-ci.yml -# - "*.md" -# only: -# refs: -# - master -# - /^.*bugfix.*$/ -# - /^.*hotfix.*$/ -# - /^.*release.*$/ -# -##tag front: +##image: registry.cn-shanghai.aliyuncs.com/c7n/cibase:0.11.4 +## +##stages: +## - build +## - release +## +##build front: ## stage: build ## script: ## - npm config set "//${NPM_REPO}:_authToken" "${NPM_TOKEN}" @@ -46,86 +18,116 @@ include: https://api.choerodon.com.cn/devops/v1/projects/1529/ci_contents/pipeli ## - chmod -R 755 node_modules ## - npm run compile ## - npm publish --registry "https://${NPM_REGISTRY}" +## - curl -sX POST -F token=${FRONT_REPOSITORY_TOKEN} -F ref=${REF_NAME} https://code.choerodon.com.cn/api/v4/projects/7909/trigger/pipeline +## except: +## changes: +## - pom.xml +## - src/**/* +## - docker/**/* +## - chart/**/* +## - init-mysql-database.sh +## - .circleci/**/* +## - .gitignore +## - .github/**/* +## - .gitlab-ci.yml +## - "*.md" +## only: +## refs: +## - master +## - /^.*bugfix.*$/ +## - /^.*hotfix.*$/ +## - /^.*release.*$/ +## +###tag front: +### stage: build +### script: +### - npm config set "//${NPM_REPO}:_authToken" "${NPM_TOKEN}" +### - npm config set "//${NPM_REGISTRY}:_authToken" "${NPM_TOKEN}" +### - npm config set always-auth true +### - yarn install --registry "https://${NPM_REPO}" --sass-binary-site=http://npm.taobao.org/mirrors/node-sass +### - chmod -R 755 node_modules +### - npm run compile +### - npm publish --registry "https://${NPM_REGISTRY}" +### only: +### refs: +### - tags +## +##build backend: +## stage: build +## script: +## - update_pom_version +## - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test -Dmaven.test.failure.ignore=true -DskipTests=true -U +## - mvn package spring-boot:repackage +## - mv target/app.jar $PWD/docker +## - saveImageMetadata +## - kaniko -c $PWD/docker -f $PWD/docker/Dockerfile -d ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG} +## except: +## changes: +## - .editorconfig +## - .eslintrc.json +## - .stylelintrc.json +## - gulpfile.js +## - package.json +## - react/**/* +## - .gitignore +## - .github/**/* +## - .gitlab-ci.yml +## - "*.md" +## only: +## refs: +## - master +## - /^.*bugfix.*$/ +## - /^.*hotfix.*$/ +## - /^.*release.*$/ +## +##tag backend: +## stage: build +## script: +## - update_pom_version +## - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test -Dmaven.test.failure.ignore=true -DskipTests=true -U +## - mvn package spring-boot:repackage +## - mv target/app.jar $PWD/docker +## - saveImageMetadata +## - docker build --platform linux/arm64 -t ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG}-arm -f $PWD/docker/Dockerfile $PWD/docker +## - docker push ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG}-arm +## - kaniko -c $PWD/docker -f $PWD/docker/Dockerfile -d ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG} ## only: ## refs: ## - tags -# -#build backend: -# stage: build -# script: -# - update_pom_version -# - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test -Dmaven.test.failure.ignore=true -DskipTests=true -U -# - mvn package spring-boot:repackage -# - mv target/app.jar $PWD/docker -# - saveImageMetadata -# - kaniko -c $PWD/docker -f $PWD/docker/Dockerfile -d ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG} -# except: -# changes: -# - .editorconfig -# - .eslintrc.json -# - .stylelintrc.json -# - gulpfile.js -# - package.json -# - react/**/* -# - .gitignore -# - .github/**/* -# - .gitlab-ci.yml -# - "*.md" -# only: -# refs: -# - master -# - /^.*bugfix.*$/ -# - /^.*hotfix.*$/ -# - /^.*release.*$/ -# -#tag backend: -# stage: build -# script: -# - update_pom_version -# - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test -Dmaven.test.failure.ignore=true -DskipTests=true -U -# - mvn package spring-boot:repackage -# - mv target/app.jar $PWD/docker -# - saveImageMetadata -# - docker build --platform linux/arm64 -t ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG}-arm -f $PWD/docker/Dockerfile $PWD/docker -# - docker push ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG}-arm -# - kaniko -c $PWD/docker -f $PWD/docker/Dockerfile -d ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG} -# only: -# refs: -# - tags -# -# -#release backend: -# stage: release -# script: -# - chart_build -# except: -# changes: -# - .editorconfig -# - .eslintrc.json -# - .stylelintrc.json -# - gulpfile.js -# - package.json -# - react/**/* -# - .gitignore -# - .github/**/* -# - .gitlab-ci.yml -# - "*.md" -# -# -#tag release: -# stage: release -# script: -# - chart_build -# only: -# - tags -# -#.auto_devops: &auto_devops | -# http_status_code=`curl -o .auto_devops.sh -s -m 10 --connect-timeout 10 -w %{http_code} "${CHOERODON_URL}/devops/ci?token=${Token}&type=microservice"` -# if [ "$http_status_code" != "200" ]; then -# cat .auto_devops.sh -# exit 1 -# fi -# source .auto_devops.sh -# -#before_script: -# - *auto_devops +## +## +##release backend: +## stage: release +## script: +## - chart_build +## except: +## changes: +## - .editorconfig +## - .eslintrc.json +## - .stylelintrc.json +## - gulpfile.js +## - package.json +## - react/**/* +## - .gitignore +## - .github/**/* +## - .gitlab-ci.yml +## - "*.md" +## +## +##tag release: +## stage: release +## script: +## - chart_build +## only: +## - tags +## +##.auto_devops: &auto_devops | +## http_status_code=`curl -o .auto_devops.sh -s -m 10 --connect-timeout 10 -w %{http_code} "${CHOERODON_URL}/devops/ci?token=${Token}&type=microservice"` +## if [ "$http_status_code" != "200" ]; then +## cat .auto_devops.sh +## exit 1 +## fi +## source .auto_devops.sh +## +##before_script: +## - *auto_devops \ No newline at end of file diff --git a/charts/workflow-service/templates/deployment.yaml b/charts/workflow-service/templates/deployment.yaml index 27e7232..99aa66c 100755 --- a/charts/workflow-service/templates/deployment.yaml +++ b/charts/workflow-service/templates/deployment.yaml @@ -194,9 +194,8 @@ spec: {{- end }} {{- if .Values.startupProbe.enabled }} startupProbe: - httpGet: - path: /actuator/health - port: actuator + tcpSocket: + port: server initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }} periodSeconds: {{ .Values.startupProbe.periodSeconds }} timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }} diff --git a/charts/workflow-service/values.yaml b/charts/workflow-service/values.yaml index 28495a2..fa2150e 100755 --- a/charts/workflow-service/values.yaml +++ b/charts/workflow-service/values.yaml @@ -147,7 +147,7 @@ commonAnnotations: {} ## extraEnv: ## FOO: "bar" ## -extraEnv: +extraEnv: # 是否启用配置中心 SPRING_CLOUD_CONFIG_ENABLED: false # 配置中心地址 @@ -166,8 +166,14 @@ extraEnv: SPRING_DATASOURCE_USERNAME: choerodon # 数据库密码 SPRING_DATASOURCE_PASSWORD: password - # 环境域名地址 - HWKF_WEB_DOMAIN_NAME: http://example.com + # hzero前端地址 + HWKF_WEB_DOMAIN_NAME: www.example.com + # 工作流是否对接aPaaS模型 + HWKF_MODEL_ENABLE: false + # 是否允许工作流服务通过数据库跨schema查询组织架构信息 + HWKF_HR_CROSS_SCHEMA_ENABLED: false + # 允许工作流服务通过数据库跨schema查询组织架构信息时, 组织架构所在schema名称 + HWKF_HPFM_SCHEMA_NAME: hzero_platform # 百分比使用物理内存,预留一部分用于堆外内存以及外部程序 # JAVA_OPTS: >- # -XX:MaxRAMPercentage=90.0 @@ -195,15 +201,15 @@ args: [] # -- Scheduler name ## https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/ ## -schedulerName: +schedulerName: -# -- EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, +# -- EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, # matching the syntax of Docker links. Optional: Defaults to false. -## +## enableServiceLinks: false # -- AutomountServiceAccountToken indicates whether a service account token should be automatically mounted. -## +## automountServiceAccountToken: false ## server deployment parameters @@ -232,7 +238,7 @@ hostAliases: [] ## server container ports to open ## -containerPort: +containerPort: # -- server port serverPort: 8065 # -- server management port @@ -316,12 +322,12 @@ resources: ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. # -- The resources limits for the init container - limits: + limits: # cpu: 2 memory: 3Gi # -- The requested resources for the init container - requests: + requests: # cpu: 500m memory: 2Gi @@ -332,7 +338,7 @@ livenessProbe: # -- Enable livenessProbe enabled: true # -- Initial delay seconds for livenessProbe - initialDelaySeconds: 480 + initialDelaySeconds: 300 # -- Period seconds for livenessProbe periodSeconds: 5 # -- Timeout seconds for livenessProbe @@ -340,12 +346,12 @@ livenessProbe: # -- Success threshold for livenessProbe successThreshold: 1 # -- Failure threshold for livenessProbe - failureThreshold: 5 + failureThreshold: 2 readinessProbe: # -- Enable readinessProbe enabled: true # -- Initial delay seconds for readinessProbe - initialDelaySeconds: 30 + initialDelaySeconds: 20 # -- Period seconds for readinessProbe periodSeconds: 5 # -- Timeout seconds for readinessProbe @@ -353,16 +359,16 @@ readinessProbe: # -- Success threshold for readinessProbe successThreshold: 1 # -- Failure threshold for readinessProbe - failureThreshold: 5 + failureThreshold: 2 startupProbe: # -- Enable startupProbe - enabled: false + enabled: true # -- Initial delay seconds for startupProbe - initialDelaySeconds: 0 + initialDelaySeconds: 10 # -- Period seconds for startupProbe - periodSeconds: 5 + periodSeconds: 3 # -- Timeout seconds for startupProbe - timeoutSeconds: 3 + timeoutSeconds: 2 # -- Success threshold for startupProbe successThreshold: 1 # -- Failure threshold for startupProbe @@ -424,9 +430,9 @@ skywalking: ## Skywalking Agent Configuration ## ref: https://github.com/apache/skywalking/blob/master/docs/en/setup/service-agent/java-agent/README.md#table-of-agent-configuration-properties - # skywalking.serviceName -- The serviceName (Default .Chart.Name) to represent a logic group providing the same capabilities/logic. + # skywalking.serviceName -- The serviceName (Default .Chart.Name) to represent a logic group providing the same capabilities/logic. # Suggestion: set a unique name for every logic service group, service instance nodes share the same code,Max length is 50(UTF-8 char). - serviceName: + serviceName: # -- Negative or zero means off, by default. sampleNPer3Secs means sampling N TraceSegment in 3 seconds tops. sampleNPer3Secs: 9 @@ -435,7 +441,7 @@ skywalking: collectorService: oap.skywalking:11800 # -- String to fully override Skywalking Agent Configuration template - commandOverride: + commandOverride: # -- Add sidecars to the server pods. ## e.g: @@ -460,7 +466,7 @@ service: type: ClusterIP # -- server Service port ## - port: + port: server: 8065 actuator: 8066 # -- Specify the nodePort value for the LoadBalancer and NodePort service types. @@ -595,7 +601,7 @@ persistence: ## set, choosing the default provisioner. (gp2 on AWS, standard on ## GKE, AWS & OpenStack) ## - storageClass: + storageClass: # -- Data volume mount path ## @@ -612,7 +618,7 @@ persistence: annotations: {} # -- Enable persistence using an existing PVC ## - existingClaim: + existingClaim: # -- Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. volumePermissionsEnabled: false diff --git a/pom.xml b/pom.xml index 7cb5556..ff0cf1b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,137 +6,99 @@ io.choerodon 4.0.0 workflow-service - 2.0.0.RELEASE + 2.2.0-SNAPSHOT jar https://github.com/choerodon/workflow-service - org.springframework.boot - spring-boot-starter-parent - 2.1.2.RELEASE - + io.choerodon + choerodon-framework-parent + 2.1.0.RELEASE 8 - 7.0.109 + 7.0.0.SR1 true io.choerodon.workflow.WorkFlowServiceApplication - 1.6.1.RELEASE - 1.6.0.RELEASE - 1.6.0.RELEASE - 0.19.1.RELEASE - - - - org.activiti.dependencies - activiti-dependencies - ${activiti-dependencies.version} - import - pom - - - org.springframework.cloud - spring-cloud-dependencies - Finchley.SR2 - pom - import - - - - + - com.thoughtworks.xstream - xstream - 1.4.14 - - - commons-beanutils - commons-beanutils - 1.9.3 - - - org.springframework - spring-core - 5.1.4.RELEASE - - - org.activiti - activiti-spring-boot-starter + org.hzero + hzero-workflow + 1.11.1.RELEASE + + + org.hzero.starter + hzero-starter-dynamic-route + + + com.google.guava + guava + + + org.hzero.starter hzero-starter-core - ${hzero.version} org.hzero.starter hzero-starter-metric - ${hzero.starter.metric.version} org.hzero.starter hzero-starter-feign-replay - ${hzero.feign.replay.version} + org.hzero.starter + hzero-starter-developer-route + 1.10.0-SNAPSHOT + true + + + + io.choerodon choerodon-starter-asgard - ${choerodon.asgard.version} - - - org.springframework.boot - spring-boot-starter-actuator + + org.springframework.boot - spring-boot-starter-jdbc + spring-boot-starter-undertow org.springframework.boot spring-boot-starter-web - 2.1.2.RELEASE - - org.apache.tomcat - tomcat-jdbc + org.springframework.boot + spring-boot-starter-tomcat + + + + + + + org.springframework.cloud spring-cloud-starter-netflix-eureka-client - 2.0.2.RELEASE - org.springframework.cloud spring-cloud-config-client - 2.0.2.RELEASE - - - - org.springframework.boot - spring-boot-starter-aop - - - - org.activiti - activiti-bpmn-layout - 7.0.130 - - - - com.alibaba - fastjson - 1.2.68 + mysql mysql-connector-java @@ -146,30 +108,38 @@ org.javassist javassist - 3.24.0-GA + 3.29.0-GA + - com.google.code.gson - gson - - - org.mybatis - mybatis - 3.5.6 - - - org.hzero - hzero-workflow - 1.6.2.RELEASE + org.activiti + activiti-spring-boot-starter + ${activiti-dependencies.version} - org.hzero.starter - hzero-starter-dynamic-route + mybatis + org.mybatis + + org.activiti + activiti-bpmn-layout + ${activiti-dependencies.version} + + + com.thoughtworks.xstream + xstream + 1.4.19 + + + + com.google.code.gson + gson + + app @@ -211,14 +181,14 @@ - - alfresco - Activiti Releases - https://artifacts.alfresco.com/nexus/content/repositories/activiti-releases/ - - true - - + + + + + + + + HandPublic Hand-Public Repository diff --git a/src/main/java/io/choerodon/workflow/WorkFlowServiceApplication.java b/src/main/java/io/choerodon/workflow/WorkFlowServiceApplication.java index f8dbfea..a449d5c 100644 --- a/src/main/java/io/choerodon/workflow/WorkFlowServiceApplication.java +++ b/src/main/java/io/choerodon/workflow/WorkFlowServiceApplication.java @@ -1,7 +1,7 @@ package io.choerodon.workflow; -import io.choerodon.resource.annoation.EnableChoerodonResourceServer; -import org.hzero.autoconfigure.EnableHzeroWorkflow; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; @@ -10,6 +10,10 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.scheduling.annotation.EnableAsync; +import io.choerodon.resource.annoation.EnableChoerodonResourceServer; + +import org.hzero.autoconfigure.EnableHzeroWorkflow; + @EnableFeignClients("io.choerodon") @EnableEurekaClient @SpringBootApplication @@ -19,11 +23,16 @@ @EnableHzeroWorkflow @ComponentScan(value = {"org.hzero.workflow", "io.choerodon.workflow"}) public class WorkFlowServiceApplication { - + + private static final Logger LOGGER = LoggerFactory.getLogger(WorkFlowServiceApplication.class); + public static void main(String[] args){ - SpringApplication.run(WorkFlowServiceApplication.class, args); + try{ + SpringApplication.run(WorkFlowServiceApplication.class, args); + } catch (Throwable thr) { + LOGGER.error(thr.getMessage(), thr); + } } - - + } diff --git a/src/main/java/io/choerodon/workflow/api/controller/v1/OrganizationInvokeWorkflowConvertC7nController.java b/src/main/java/io/choerodon/workflow/api/controller/v1/OrganizationInvokeWorkflowConvertC7nController.java index d1d652d..db31839 100644 --- a/src/main/java/io/choerodon/workflow/api/controller/v1/OrganizationInvokeWorkflowConvertC7nController.java +++ b/src/main/java/io/choerodon/workflow/api/controller/v1/OrganizationInvokeWorkflowConvertC7nController.java @@ -1,18 +1,29 @@ package io.choerodon.workflow.api.controller.v1; +import java.util.List; +import java.util.Map; + +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.util.Assert; +import org.springframework.web.bind.annotation.*; + import io.choerodon.core.iam.ResourceLevel; import io.choerodon.swagger.annotation.Permission; import io.choerodon.workflow.app.service.OrganizationWorkflowC7nService; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; import org.hzero.boot.platform.lov.annotation.ProcessLovValue; +import org.hzero.core.base.BaseConstants; import org.hzero.core.base.BaseController; import org.hzero.core.util.Results; import org.hzero.mybatis.helper.SecurityTokenHelper; import org.hzero.starter.keyencrypt.core.Encrypt; +import org.hzero.workflow.engine.model.node.FlowApproverValue; import org.hzero.workflow.engine.run.action.AppointNextNodeApproverActionHandler; -import org.hzero.workflow.engine.run.dto.ProcessRebutNodeDTO; +import org.hzero.workflow.engine.run.dto.ProcessJumpNodeDTO; +import org.hzero.workflow.engine.util.EngineConstants; import org.hzero.workflow.monitor.api.dto.ProcessInstanceDTO; import org.hzero.workflow.monitor.app.service.MonitorProcessService; import org.hzero.workflow.personal.api.dto.DetailDTO; @@ -22,17 +33,9 @@ import org.hzero.workflow.personal.domain.entity.RunAttachment; import org.hzero.workflow.personal.domain.entity.RunCommentTemplate; import org.hzero.workflow.personal.domain.repository.RunCommentTemplateRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; - -import java.util.List; -import java.util.Map; /** - * @author zhaotianxin - * @date 2021-03-16 10:01 + * @author zhaotianxin 2021-03-16 10:01 */ @RestController @RequestMapping(value = "/choerodon/v1/organizations/{organization_id}/organization_invoke_workflow") @@ -58,20 +61,18 @@ public class OrganizationInvokeWorkflowConvertC7nController extends BaseControll @GetMapping("/run_comment_templates") public ResponseEntity> commentTemplateList(@PathVariable("organization_id") Long organizationId, @ApiParam(name = "审批意见",value = "commentContent") - @RequestParam(required = false) String commentContent, - @ApiIgnore @RequestParam(value = "self",required = false) String self) { - return Results.success(this.runCommentTemplateService.commentTemplateList(organizationId, commentContent, self)); + @RequestParam(required = false) String commentContent) { + return Results.success(this.runCommentTemplateService.commentTemplateList(organizationId, commentContent)); } @ApiOperation("保存自定义审批意见") @Permission(level = ResourceLevel.ORGANIZATION, permissionLogin = true) @PostMapping("/run_comment_templates") public ResponseEntity> saveCommentTemplate(@PathVariable("organization_id") Long organizationId, - @RequestBody List runCommentTemplates, - @ApiIgnore @RequestParam(value = "self",required = false) String self) { - this.validList(runCommentTemplates, new Class[0]); + @RequestBody List runCommentTemplates) { + this.validList(runCommentTemplates); SecurityTokenHelper.validTokenIgnoreInsert(runCommentTemplates); - List result = this.runCommentTemplateService.saveCommentTemplate(organizationId, runCommentTemplates, self); + List result = this.runCommentTemplateService.saveCommentTemplate(organizationId, runCommentTemplates); return Results.success(result); } @@ -82,7 +83,8 @@ public ResponseEntity enableCommentTemplate(@PathVariable("o @RequestBody RunCommentTemplate runCommentTemplate, @ApiParam(name = "启用1/禁用0",required = true) @RequestParam Integer enabledFlag) { - validObject(runCommentTemplate, new Class[0]); + Assert.notNull(organizationId, BaseConstants.ErrorCode.NOT_NULL); + validObject(runCommentTemplate); RunCommentTemplate result = this.runCommentTemplateService.enableCommentTemplate(organizationId, runCommentTemplate, enabledFlag); return Results.success(result); } @@ -92,6 +94,7 @@ public ResponseEntity enableCommentTemplate(@PathVariable("o @DeleteMapping("/run_comment_templates") public ResponseEntity removeCommentTemplate(@PathVariable("organization_id") Long organizationId, @RequestBody RunCommentTemplate runCommentTemplate) { + Assert.notNull(organizationId, BaseConstants.ErrorCode.NOT_NULL); SecurityTokenHelper.validToken(runCommentTemplate); runCommentTemplateRepository.deleteByPrimaryKey(runCommentTemplate); return Results.success(); @@ -103,7 +106,7 @@ public ResponseEntity removeCommentTemplate(@PathVariable("organization_id @GetMapping({"/monitor_process/{instanceId}/diagram"}) public ResponseEntity getProcessInstanceDiagram(@PathVariable("organization_id") Long organizationId, @PathVariable("instanceId") @Encrypt Long instanceId) { - ProcessInstanceDTO.ProcessInstanceDiagramDTO diagramDTO = monitorProcessService.getProcessInstanceDiagram(organizationId, instanceId); + ProcessInstanceDTO.ProcessInstanceDiagramDTO diagramDTO = monitorProcessService.getProcessInstanceDiagram(organizationId, instanceId, null); return Results.success(diagramDTO); } @@ -111,10 +114,9 @@ public ResponseEntity getProcessIn @Permission(level = ResourceLevel.ORGANIZATION, permissionLogin = true) @PostMapping({"/personal_process/approve"}) public ResponseEntity flowApprove(@PathVariable("organization_id") Long organizationId, - @RequestParam("taskIds") @Encrypt List taskIds, - @RequestParam("comment") String comment, - @RequestParam(name = "assignee",required = false) String assignee) { - personalActionService.approve(organizationId, taskIds, comment, assignee); + @Encrypt @RequestParam(value = "taskIds", required = false) List taskIds, + @RequestBody(required = false) Map paramMap) { + personalActionService.batchProcess(organizationId, taskIds, EngineConstants.ApproveAction.APPROVED,false,null, paramMap); return Results.success(); } @@ -122,10 +124,10 @@ public ResponseEntity flowApprove(@PathVariable("organization_id") Long or @Permission(level = ResourceLevel.ORGANIZATION, permissionLogin = true) @PostMapping({"/personal_process/reject"}) public ResponseEntity flowReject(@PathVariable("organization_id") Long organizationId, - @RequestParam("taskIds") @Encrypt List taskIds, - @RequestParam("comment") String comment, - @RequestParam(name = "assignee",required = false) String assignee) { - personalActionService.reject(organizationId, taskIds, comment, assignee); + @Encrypt @RequestParam(value = "taskIds", required = false) List taskIds, + @RequestParam(required = false) Integer reApproveFlag, + @RequestBody(required = false) Map paramMap) { + personalActionService.batchProcess(organizationId, taskIds, EngineConstants.ApproveAction.REJECTED, false, reApproveFlag, paramMap); return Results.success(); } @@ -135,7 +137,7 @@ public ResponseEntity flowReject(@PathVariable("organization_id") Long org public ResponseEntity attachmentUpload(@PathVariable("organization_id") Long organizationId, @RequestBody RunAttachment runAttachment) { runAttachment.setTenantId(organizationId); - validObject(runAttachment, new Class[0]); + validObject(runAttachment); personalProcessService.attachmentUpload(runAttachment); return Results.success(); } @@ -145,14 +147,15 @@ public ResponseEntity attachmentUpload(@PathVariable("organization_id") Lo @GetMapping({"/personal_process/{taskId}/forecastNextNode"}) public ResponseEntity> forecastNextNode(@PathVariable("organization_id") Long organizationId, @PathVariable("taskId") @Encrypt Long taskId) { + Assert.notNull(organizationId, BaseConstants.ErrorCode.NOT_NULL); return Results.success(appointNextNodeApproverActionHandler.forecastNextNode(taskId)); } @ApiOperation("我的待办-查询可驳回列表") @Permission(level = ResourceLevel.ORGANIZATION, permissionLogin = true) @GetMapping({"/personal_process/{taskId}/rebutNodeList"}) - public ResponseEntity getRebutNodes(@PathVariable("organization_id") Long organizationId, - @PathVariable("taskId") @Encrypt Long taskId) { + public ResponseEntity> getRebutNodes(@PathVariable("organization_id") Long organizationId, + @PathVariable("taskId") @Encrypt Long taskId) { return Results.success(personalActionService.getRebutNodes(organizationId, taskId)); } @ApiOperation("我的待办-根据taskId处理审批动作") @@ -161,9 +164,8 @@ public ResponseEntity getRebutNodes(@PathVariable("organiza public ResponseEntity executeTaskById(@PathVariable("organization_id") Long organizationId, @PathVariable("taskId") @Encrypt Long taskId, @RequestParam String approveAction, - @RequestBody Map paramMap, - @RequestParam(name = "assignee",required = false) String assignee) { - personalActionService.executeTaskById(organizationId, taskId, approveAction, paramMap, assignee); + @RequestBody Map paramMap) { + personalActionService.executeTaskById(organizationId, taskId, approveAction, paramMap); return Results.success(); } @@ -171,10 +173,9 @@ public ResponseEntity executeTaskById(@PathVariable("organization_id") Lon @Permission(level = ResourceLevel.ORGANIZATION, permissionLogin = true) @PostMapping({"/personal_process/carbon-copy"}) public ResponseEntity flowCarbonCopy(@PathVariable("organization_id") Long organizationId, - @RequestParam("taskId") @Encrypt Long taskId, - @RequestParam("toPerson") String toPerson, - @RequestParam(name = "assignee",required = false) String assignee) { - personalActionService.carbonCopy(organizationId, taskId, toPerson, assignee); + @Encrypt @RequestParam("taskId") Long taskId, + @RequestBody List toPersonList) { + personalActionService.carbonCopy(organizationId, taskId, toPersonList); return Results.success(); } @@ -184,7 +185,7 @@ public ResponseEntity flowCarbonCopy(@PathVariable("organization_id") Long @ProcessLovValue(targetField = {"body.taskDetail", "body.historyList"}) public ResponseEntity taskDetail(@PathVariable("organization_id") Long organizationId, @PathVariable("taskId") @Encrypt Long taskId) { - return Results.success(this.personalProcessService.taskDetail(organizationId, taskId)); + return Results.success(this.personalProcessService.taskDetail(organizationId, taskId, false)); } @ApiOperation("我参与的流程详情") @@ -193,7 +194,7 @@ public ResponseEntity taskDetail(@PathVariable("organiz @ProcessLovValue(targetField = {"body.instanceDetail", "body.historyList"}) public ResponseEntity participatedDetail(@PathVariable("organization_id") Long organizationId, @PathVariable("instanceId") @Encrypt Long instanceId) { - return Results.success(this.personalProcessService.participatedDetail(organizationId, instanceId)); + return Results.success(this.personalProcessService.participatedDetail(organizationId, instanceId, false)); } @ApiOperation("我发起的流程详情") @@ -212,7 +213,7 @@ public ResponseEntity submittedDetail(@PathVariabl public ResponseEntity carbonCopiedDetail(@PathVariable("organization_id") Long organizationId, @PathVariable("taskHistoryId") @Encrypt Long taskHistoryId, @RequestParam(required = false) Integer carbonCopyTodoFlag) { - return Results.success(this.personalProcessService.carbonCopiedDetail(organizationId, taskHistoryId, carbonCopyTodoFlag)); + return Results.success(this.personalProcessService.carbonCopiedDetail(organizationId, taskHistoryId, carbonCopyTodoFlag, false)); } @ApiOperation("我的抄送流程-评论") @@ -230,9 +231,8 @@ public ResponseEntity carbonCopyComment(@PathVariable("organization_id") L @Permission(level = ResourceLevel.ORGANIZATION, permissionLogin = true) @PostMapping({"/personal_process/urge"}) public ResponseEntity flowUrge(@PathVariable("organization_id") Long organizationId, - @RequestParam("instanceIds") @Encrypt List instanceIds, - @RequestParam(name = "starter",required = false) String starter) { - this.personalActionService.urge(organizationId, instanceIds, starter); + @RequestParam("instanceIds") @Encrypt List instanceIds) { + this.personalActionService.urge(organizationId, instanceIds); return Results.success(); } diff --git a/src/main/java/io/choerodon/workflow/api/controller/v1/ProjectInvokeWorkflowC7nController.java b/src/main/java/io/choerodon/workflow/api/controller/v1/ProjectInvokeWorkflowC7nController.java index ab85ef5..1ebded6 100644 --- a/src/main/java/io/choerodon/workflow/api/controller/v1/ProjectInvokeWorkflowC7nController.java +++ b/src/main/java/io/choerodon/workflow/api/controller/v1/ProjectInvokeWorkflowC7nController.java @@ -1,31 +1,36 @@ package io.choerodon.workflow.api.controller.v1; -import io.choerodon.core.iam.ResourceLevel; -import io.choerodon.swagger.annotation.Permission; +import java.util.List; +import java.util.Map; + import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.util.Assert; +import org.springframework.web.bind.annotation.*; + +import io.choerodon.core.iam.ResourceLevel; +import io.choerodon.swagger.annotation.Permission; + +import org.hzero.core.base.BaseConstants; import org.hzero.core.base.BaseController; import org.hzero.core.util.Results; import org.hzero.mybatis.helper.SecurityTokenHelper; +import org.hzero.starter.keyencrypt.core.Encrypt; +import org.hzero.workflow.engine.model.node.FlowApproverValue; import org.hzero.workflow.engine.run.action.AppointNextNodeApproverActionHandler; -import org.hzero.workflow.engine.run.dto.ProcessRebutNodeDTO; +import org.hzero.workflow.engine.run.dto.ProcessJumpNodeDTO; +import org.hzero.workflow.engine.util.EngineConstants; import org.hzero.workflow.personal.app.service.PersonalActionService; import org.hzero.workflow.personal.app.service.PersonalProcessService; import org.hzero.workflow.personal.app.service.RunCommentTemplateService; import org.hzero.workflow.personal.domain.entity.RunAttachment; import org.hzero.workflow.personal.domain.entity.RunCommentTemplate; import org.hzero.workflow.personal.domain.repository.RunCommentTemplateRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; - -import java.util.List; -import java.util.Map; /** - * @author zhaotianxin - * @date 2021-03-10 16:21 + * @author zhaotianxin 2021-03-10 16:21 */ @RestController @RequestMapping(value = "/choerodon/v1/projects/{project_id}/project_invoke_workflow") @@ -46,10 +51,10 @@ public class ProjectInvokeWorkflowC7nController extends BaseController { @PostMapping("/personal-process/approve") public ResponseEntity flowApprove(@PathVariable("project_id") Long projectId, @RequestParam("organizationId") Long tenantId, - @RequestParam("taskIds") List taskIds, - @RequestParam("comment") String comment, - @RequestParam(name = "assignee", required = false) String assignee) { - personalActionService.approve(tenantId, taskIds, comment, assignee); + @Encrypt @RequestParam(value = "taskIds", required = false) List taskIds, + @RequestBody(required = false) Map paramMap) { + Assert.notNull(projectId, BaseConstants.ErrorCode.NOT_NULL); + personalActionService.batchProcess(tenantId, taskIds, EngineConstants.ApproveAction.APPROVED,false,null, paramMap); return Results.success(); } @@ -58,10 +63,11 @@ public ResponseEntity flowApprove(@PathVariable("project_id") Long project @PostMapping("/personal-process/reject") public ResponseEntity flowReject(@PathVariable("project_id") Long projectId, @RequestParam("organizationId") Long tenantId, - @RequestParam("taskIds") List taskIds, - @RequestParam("comment") String comment, - @RequestParam(name = "assignee", required = false) String assignee) { - personalActionService.reject(tenantId, taskIds, comment, assignee); + @Encrypt @RequestParam(value = "taskIds", required = false) List taskIds, + @RequestParam(required = false) Integer reApproveFlag, + @RequestBody(required = false) Map paramMap) { + Assert.notNull(projectId, BaseConstants.ErrorCode.NOT_NULL); + personalActionService.batchProcess(tenantId, taskIds, EngineConstants.ApproveAction.REJECTED, false, reApproveFlag, paramMap); return Results.success(); } @@ -70,11 +76,11 @@ public ResponseEntity flowReject(@PathVariable("project_id") Long projectI @PostMapping({"/personal-process/{taskId}/executeTaskById"}) public ResponseEntity executeTaskById(@PathVariable("project_id") Long projectId, @RequestParam("organizationId") Long tenantId, - @PathVariable("taskId") Long taskId, + @PathVariable("taskId") @Encrypt Long taskId, @RequestParam String approveAction, - @RequestBody Map paramMap, - @RequestParam(name = "assignee",required = false) String assignee) { - personalActionService.executeTaskById(tenantId, taskId, approveAction, paramMap, assignee); + @RequestBody Map paramMap) { + Assert.notNull(projectId, BaseConstants.ErrorCode.NOT_NULL); + personalActionService.executeTaskById(tenantId, taskId, approveAction, paramMap); return Results.success(); } @@ -83,10 +89,10 @@ public ResponseEntity executeTaskById(@PathVariable("project_id") Long pro @PostMapping({"/personal-process/carbon-copy"}) public ResponseEntity flowCarbonCopy(@PathVariable("project_id") Long projectId, @RequestParam("organizationId") Long tenantId, - @RequestParam("taskId") Long taskId, - @RequestParam("toPerson") String toPerson, - @RequestParam(name = "assignee",required = false) String assignee) { - personalActionService.carbonCopy(tenantId, taskId, toPerson, assignee); + @Encrypt @RequestParam("taskId") Long taskId, + @RequestBody List toPersonList) { + Assert.notNull(projectId, BaseConstants.ErrorCode.NOT_NULL); + personalActionService.carbonCopy(tenantId, taskId, toPersonList); return Results.success(); } @@ -96,15 +102,18 @@ public ResponseEntity flowCarbonCopy(@PathVariable("project_id") Long proj public ResponseEntity> forecastNextNode(@PathVariable("project_id") Long projectId, @RequestParam("organizationId") Long tenantId, @PathVariable("taskId") Long taskId) { + Assert.notNull(projectId, BaseConstants.ErrorCode.NOT_NULL); + Assert.notNull(tenantId, BaseConstants.ErrorCode.NOT_NULL); return Results.success(appointNextNodeApproverActionHandler.forecastNextNode(taskId)); } @ApiOperation("项目层-我的待办-查询可驳回列表") @Permission(level = ResourceLevel.ORGANIZATION) @GetMapping({"/personal-process/{taskId}/rebutNodeList"}) - public ResponseEntity getRebutNodes(@PathVariable("project_id") Long projectId, - @RequestParam("organizationId") Long tenantId, - @PathVariable("taskId") Long taskId) { + public ResponseEntity> getRebutNodes(@PathVariable("project_id") Long projectId, + @RequestParam("organizationId") Long tenantId, + @PathVariable("taskId") Long taskId) { + Assert.notNull(projectId, BaseConstants.ErrorCode.NOT_NULL); return Results.success(personalActionService.getRebutNodes(tenantId, taskId)); } @@ -113,23 +122,10 @@ public ResponseEntity getRebutNodes(@PathVariable("project_ @GetMapping("/run-comment-templates") public ResponseEntity> commentTemplateList(@PathVariable("project_id") Long projectId, @RequestParam("organizationId") Long tenantId, - @ApiParam(name = "审批意见",value = "commentContent") - @RequestParam(required = false) String commentContent, - @ApiIgnore - @RequestParam(value = "self",required = false) String self) { - return Results.success(runCommentTemplateService.commentTemplateList(tenantId, commentContent, self)); + @ApiParam(name = "审批意见",value = "commentContent") @RequestParam(required = false) String commentContent) { + Assert.notNull(projectId, BaseConstants.ErrorCode.NOT_NULL); + return Results.success(this.runCommentTemplateService.commentTemplateList(tenantId, commentContent)); } -// @ApiOperation("项目层-查询流程定义列表") -// @Permission(level = ResourceLevel.ORGANIZATION) -// @GetMapping({"/def-workflows/page"}) -// public ResponseEntity> pageByCondition(@PathVariable("project_id") Long projectId, -// @RequestParam("organizationId") Long tenantId, -// PageRequest pageRequest, -// DefWorkflowDTO.DefWorkflowQueryDTO queryDTO) { -// queryDTO.setSiteFlag(BaseConstants.Flag.NO); -// Page page = defWorkflowService.pageByOptions(tenantId, pageRequest, queryDTO); -// return Results.success(page); -// } @ApiOperation("附件上传/删除") @Permission(level = ResourceLevel.ORGANIZATION) @@ -137,8 +133,9 @@ public ResponseEntity> commentTemplateList(@PathVariabl public ResponseEntity attachmentUpload(@PathVariable("project_id") Long projectId, @RequestParam("organizationId") Long tenantId, @RequestBody RunAttachment runAttachment) { + Assert.notNull(projectId, BaseConstants.ErrorCode.NOT_NULL); runAttachment.setTenantId(tenantId); - validObject(runAttachment, new Class[0]); + validObject(runAttachment); personalProcessService.attachmentUpload(runAttachment); return Results.success(); } @@ -148,18 +145,20 @@ public ResponseEntity attachmentUpload(@PathVariable("project_id") Long pr @PostMapping("/run_comment_templates") public ResponseEntity> saveCommentTemplate(@PathVariable("project_id") Long projectId, @RequestParam("organizationId") Long tenantId, - @RequestBody List runCommentTemplates, - @ApiIgnore @RequestParam(value = "self",required = false) String self) { - validList(runCommentTemplates, new Class[0]); + @RequestBody List runCommentTemplates) { + Assert.notNull(projectId, BaseConstants.ErrorCode.NOT_NULL); + validList(runCommentTemplates); SecurityTokenHelper.validTokenIgnoreInsert(runCommentTemplates); - List result = this.runCommentTemplateService.saveCommentTemplate(tenantId, runCommentTemplates, self); + List result = this.runCommentTemplateService.saveCommentTemplate(tenantId, runCommentTemplates); return Results.success(result); } @ApiOperation("项目层-删除自定义审批意见") @Permission(level = ResourceLevel.ORGANIZATION) @DeleteMapping("/run_comment_templates") - public ResponseEntity removeCommentTemplate(@RequestBody RunCommentTemplate runCommentTemplate) { + public ResponseEntity removeCommentTemplate(@PathVariable("project_id") Long projectId, + @RequestBody RunCommentTemplate runCommentTemplate) { + Assert.notNull(projectId, BaseConstants.ErrorCode.NOT_NULL); SecurityTokenHelper.validToken(runCommentTemplate); runCommentTemplateRepository.deleteByPrimaryKey(runCommentTemplate); return Results.success(); diff --git a/src/main/java/io/choerodon/workflow/app/eventhandler/WorkFlowSagaHandler.java b/src/main/java/io/choerodon/workflow/app/eventhandler/WorkFlowSagaHandler.java index 0e58281..8d09bba 100644 --- a/src/main/java/io/choerodon/workflow/app/eventhandler/WorkFlowSagaHandler.java +++ b/src/main/java/io/choerodon/workflow/app/eventhandler/WorkFlowSagaHandler.java @@ -1,6 +1,11 @@ package io.choerodon.workflow.app.eventhandler; import com.google.gson.Gson; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + import io.choerodon.asgard.saga.SagaDefinition; import io.choerodon.asgard.saga.annotation.SagaTask; import io.choerodon.workflow.api.vo.DevopsPipelineVO; @@ -9,13 +14,6 @@ import io.choerodon.workflow.infra.constant.SagaConstants; import io.choerodon.workflow.infra.constant.SagaTaskConstants; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.mock.web.MockHttpServletRequest; -import org.springframework.stereotype.Component; -import org.springframework.web.context.request.RequestAttributes; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; - /** * Created by Sheep on 2019/5/16. */ @@ -23,6 +21,8 @@ @Component public class WorkFlowSagaHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(WorkFlowSagaHandler.class); + private Gson gson = new Gson(); diff --git a/src/main/java/io/choerodon/workflow/app/service/impl/OrganizationWorkflowC7nServiceImpl.java b/src/main/java/io/choerodon/workflow/app/service/impl/OrganizationWorkflowC7nServiceImpl.java index db39f66..13e1a8e 100644 --- a/src/main/java/io/choerodon/workflow/app/service/impl/OrganizationWorkflowC7nServiceImpl.java +++ b/src/main/java/io/choerodon/workflow/app/service/impl/OrganizationWorkflowC7nServiceImpl.java @@ -1,36 +1,37 @@ package io.choerodon.workflow.app.service.impl; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import org.apache.commons.io.IOUtils; -import org.hzero.workflow.def.api.dto.DefTypeDTO; -import org.hzero.workflow.def.app.service.DefModelService; -import org.hzero.workflow.def.app.service.DefTypeService; -import org.hzero.workflow.def.domain.entity.*; -import org.hzero.workflow.def.domain.repository.*; -import org.hzero.workflow.engine.util.JsonUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import io.choerodon.core.exception.CommonException; import io.choerodon.mybatis.domain.AuditDomain; import io.choerodon.workflow.app.service.OrganizationWorkflowC7nService; import io.choerodon.workflow.infra.feign.BaseFeignClient; import io.choerodon.workflow.infra.feign.vo.OrganizationInfoVO; +import org.hzero.workflow.def.api.dto.DefTypeDTO; +import org.hzero.workflow.def.app.service.DefModelService; +import org.hzero.workflow.def.app.service.DefTypeService; +import org.hzero.workflow.def.domain.entity.*; +import org.hzero.workflow.def.domain.repository.*; +import org.hzero.workflow.engine.util.JsonUtils; + /** * @author chihao.ran@hand-china.com * 2021/03/30 14:54 @@ -93,7 +94,7 @@ public void initDefWorkFlows(Long tenantId) { defWorkflow.setTypeCode(newDefType.getTypeCode()); defWorkflow.setTypeId(newDefType.getTypeId()); defWorkflowRepository.insertSelective(defWorkflow); - defModelService.saveConfig(tenantId, defWorkflow.getFlowId(), defWorkflow.getModelConfigVO(), defWorkflow.getDiagramJson()); + defModelService.saveAndReturnConfig(tenantId, defWorkflow.getFlowId(), defWorkflow.getModelConfigVO(), defWorkflow.getDiagramJson()); }); } diff --git a/src/main/java/io/choerodon/workflow/app/service/impl/PersonalProcessC7nServiceImpl.java b/src/main/java/io/choerodon/workflow/app/service/impl/PersonalProcessC7nServiceImpl.java index eefb43b..668c763 100644 --- a/src/main/java/io/choerodon/workflow/app/service/impl/PersonalProcessC7nServiceImpl.java +++ b/src/main/java/io/choerodon/workflow/app/service/impl/PersonalProcessC7nServiceImpl.java @@ -1,22 +1,13 @@ package io.choerodon.workflow.app.service.impl; -import org.apache.commons.lang3.StringUtils; -import org.hzero.core.base.BaseConstants; -import org.hzero.workflow.def.infra.feign.PlatformFeignClient; -import org.hzero.workflow.def.infra.feign.dto.UserDTO; -import org.hzero.workflow.engine.dao.dto.EmployeeUserDTO; -import org.hzero.workflow.engine.dao.entity.RunTaskHistory; -import org.hzero.workflow.engine.exception.EmployeeNotFoundException; -import org.hzero.workflow.personal.api.dto.PersonalTodoDTO.*; -import org.hzero.workflow.personal.domain.repository.PersonalTodoRepository; +import java.util.*; +import java.util.stream.Collectors; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; - -import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; +import org.springframework.util.ObjectUtils; import io.choerodon.core.domain.Page; import io.choerodon.mybatis.pagehelper.PageHelper; @@ -25,7 +16,14 @@ import io.choerodon.workflow.app.service.PersonalProcessC7nService; import io.choerodon.workflow.domain.repository.PersonalTodoC7nRepository; import io.choerodon.workflow.infra.feign.BaseFeignClient; -import org.springframework.util.ObjectUtils; + +import org.hzero.core.base.BaseConstants; +import org.hzero.workflow.def.infra.feign.PlatformFeignClient; +import org.hzero.workflow.def.infra.feign.dto.UserDTO; +import org.hzero.workflow.engine.dao.entity.RunTaskHistory; +import org.hzero.workflow.engine.exception.EmployeeNotFoundException; +import org.hzero.workflow.personal.api.dto.PersonalTodoDTO.*; +import org.hzero.workflow.personal.domain.repository.PersonalTodoRepository; /** * @author huaxin.deng@hand-china.com 2021-03-12 14:21:57 @@ -54,7 +52,7 @@ public List listApproveHistoryByInstanceId(Long tenantId, Long } private void listApproveHistoryWithUserDTO(Long tenantId, Long instanceId, List runTaskHistoryVOList) { - List runTaskHistories = personalTodoRepository.selectHistory(tenantId, instanceId); + List runTaskHistories = personalTodoRepository.selectHistory(tenantId, instanceId, Collections.singletonList(instanceId)); if (CollectionUtils.isEmpty(runTaskHistories)) { return; } diff --git a/src/main/java/io/choerodon/workflow/app/service/impl/ProcessInstanceServiceImpl.java b/src/main/java/io/choerodon/workflow/app/service/impl/ProcessInstanceServiceImpl.java index fda0a70..85bdcb9 100644 --- a/src/main/java/io/choerodon/workflow/app/service/impl/ProcessInstanceServiceImpl.java +++ b/src/main/java/io/choerodon/workflow/app/service/impl/ProcessInstanceServiceImpl.java @@ -4,7 +4,6 @@ import java.util.Map; import java.util.UUID; -import com.google.gson.Gson; import org.activiti.api.process.model.ProcessInstance; import org.activiti.api.process.model.builders.ProcessPayloadBuilder; import org.activiti.api.process.model.payloads.DeleteProcessPayload; @@ -23,15 +22,10 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; -import io.choerodon.asgard.saga.feign.SagaClient; -import io.choerodon.asgard.saga.producer.TransactionalProducer; import io.choerodon.core.exception.CommonException; import io.choerodon.workflow.api.vo.DevopsPipelineVO; import io.choerodon.workflow.api.vo.HzeroDeployPipelineVO; -import io.choerodon.workflow.app.eventhandler.WorkFlowSagaHandler; import io.choerodon.workflow.app.service.ProcessInstanceService; import io.choerodon.workflow.infra.bpmnhandler.DevopsPipelineBpmnHandler; import io.choerodon.workflow.infra.feginoperator.DevopsServiceRepository; @@ -44,11 +38,10 @@ @Service public class ProcessInstanceServiceImpl implements ProcessInstanceService { - private static final Logger LOGGER = LoggerFactory.getLogger(ProcessInstanceServiceImpl.class); + private Logger LOGGER = LoggerFactory.getLogger(ProcessInstanceServiceImpl.class); @Autowired DevopsServiceRepository devopsServiceRepository; - @Autowired ActivitiUserLoginUtil activitiUserLoginUtil; @Autowired @@ -57,14 +50,6 @@ public class ProcessInstanceServiceImpl implements ProcessInstanceService { ProcessRuntime processRuntime; @Autowired TaskRuntime taskRuntime; - @Autowired - SagaClient sagaClient; - @Autowired - private TransactionalProducer producer; - - - private Logger logger = LoggerFactory.getLogger(ProcessInstanceServiceImpl.class); - @Override public void beginDevopsPipeline(DevopsPipelineVO devopsPipelineVO) { @@ -82,7 +67,7 @@ public void beginDevopsPipeline(DevopsPipelineVO devopsPipelineVO) { .deploymentId(deployment.getId()).singleResult(); String name = "部署CD流程"; - logger.info(String.format("部署CD流程:%s 开始", devopsPipelineVO.getPipelineRecordId())); + LOGGER.info(String.format("部署CD流程:%s 开始", devopsPipelineVO.getPipelineRecordId())); processRuntime.start(ProcessPayloadBuilder .start() .withProcessDefinitionKey(processDefinition.getKey()) @@ -94,7 +79,6 @@ public void beginDevopsPipeline(DevopsPipelineVO devopsPipelineVO) { @Override - @Transactional(propagation = Propagation.REQUIRES_NEW) public void beginDevopsPipelineCiCd(DevopsPipelineVO devopsPipelineVO) { Map params = new HashMap<>(); @@ -114,18 +98,14 @@ public void beginDevopsPipelineCiCd(DevopsPipelineVO devopsPipelineVO) { org.activiti.engine.repository.ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() .deploymentId(deployment.getId()).singleResult(); - logger.info(String.format("%s:%s 流程开始执行!", devopsPipelineVO.getPipelineName(), devopsPipelineVO.getPipelineRecordId())); - try { - processRuntime.start(ProcessPayloadBuilder - .start() - .withProcessDefinitionKey(processDefinition.getKey()) - .withName(devopsPipelineVO.getPipelineName()) - .withBusinessKey(devopsPipelineVO.getBusinessKey()) - .withVariables(params) - .build()); - } catch (Exception e) { - LOGGER.error("start process failed.", e); - } + LOGGER.info(String.format("%s:%s 流程开始执行!", devopsPipelineVO.getPipelineName(), devopsPipelineVO.getPipelineRecordId())); + processRuntime.start(ProcessPayloadBuilder + .start() + .withProcessDefinitionKey(processDefinition.getKey()) + .withName(devopsPipelineVO.getPipelineName()) + .withBusinessKey(devopsPipelineVO.getBusinessKey()) + .withVariables(params) + .build()); } @@ -173,7 +153,7 @@ public void createHzeroDeployPipeline(HzeroDeployPipelineVO hzeroDeployPipelineV org.activiti.engine.repository.ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() .deploymentId(deployment.getId()).singleResult(); - logger.info(String.format("Hzero部署流程开始执行!recordId: {}!", hzeroDeployPipelineVO.getDevopsHzeroDeployDetailsDTOList().get(0).getDeployRecordId())); + LOGGER.info(String.format("Hzero部署流程开始执行!recordId: {}!", hzeroDeployPipelineVO.getDevopsHzeroDeployDetailsDTOList().get(0).getDeployRecordId())); processRuntime.start(ProcessPayloadBuilder .start() .withProcessDefinitionKey(processDefinition.getKey()) diff --git a/src/main/java/io/choerodon/workflow/domain/repository/impl/PersonalTodoC7nRepositoryImpl.java b/src/main/java/io/choerodon/workflow/domain/repository/impl/PersonalTodoC7nRepositoryImpl.java index 15b838f..99d0ff9 100644 --- a/src/main/java/io/choerodon/workflow/domain/repository/impl/PersonalTodoC7nRepositoryImpl.java +++ b/src/main/java/io/choerodon/workflow/domain/repository/impl/PersonalTodoC7nRepositoryImpl.java @@ -1,27 +1,40 @@ package io.choerodon.workflow.domain.repository.impl; -import io.choerodon.workflow.domain.repository.PersonalTodoC7nRepository; +import java.util.*; +import java.util.stream.Collectors; +import javax.annotation.Resource; + import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import io.choerodon.workflow.domain.repository.PersonalTodoC7nRepository; +import io.choerodon.workflow.infra.mapper.PersonalTodoC7nMapper; + import org.hzero.core.base.BaseConstants; -import org.hzero.workflow.def.infra.common.utils.UserUtils; +import org.hzero.mybatis.domian.Condition; +import org.hzero.mybatis.util.Sqls; +import org.hzero.workflow.def.domain.entity.DefExtendField; +import org.hzero.workflow.def.domain.repository.DefExtendFieldRepository; +import org.hzero.workflow.def.infra.constant.WorkflowConstants; import org.hzero.workflow.engine.dao.entity.RunNode; import org.hzero.workflow.engine.dao.entity.RunTask; +import org.hzero.workflow.engine.dao.entity.RunVariable; +import org.hzero.workflow.engine.dao.entity.RunVariableHistory; import org.hzero.workflow.engine.dao.mapper.RunNodeMapper; import org.hzero.workflow.engine.dao.mapper.RunTaskMapper; +import org.hzero.workflow.engine.dao.service.RunVariableHistoryService; +import org.hzero.workflow.engine.dao.service.RunVariableService; import org.hzero.workflow.engine.model.FlowAssignee; import org.hzero.workflow.engine.model.node.ApproveAction; import org.hzero.workflow.engine.run.IModelService; +import org.hzero.workflow.engine.util.EngineConstants; +import org.hzero.workflow.helper.FlowAssigneeHelper; +import org.hzero.workflow.personal.api.dto.PersonalTodoDTO; import org.hzero.workflow.personal.api.dto.PersonalTodoDTO.*; import org.hzero.workflow.personal.domain.repository.PersonalTodoRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.stream.Collectors; -import javax.annotation.Resource; - -import io.choerodon.workflow.infra.mapper.PersonalTodoC7nMapper; /** * @author chihao.ran@hand-china.com @@ -30,129 +43,160 @@ @Component public class PersonalTodoC7nRepositoryImpl implements PersonalTodoC7nRepository { + @Autowired + private DefExtendFieldRepository defExtendFieldRepository; @Autowired private PersonalTodoRepository personalTodoRepository; @Resource + private FlowAssigneeHelper flowAssigneeHelper; + @Resource private PersonalTodoC7nMapper personalTodoC7nMapper; @Resource private RunTaskMapper runTaskMapper; @Resource private RunNodeMapper runNodeMapper; @Autowired - private UserUtils userUtils; - @Autowired private IModelService modelService; + @Autowired + private RunVariableService runVariableService; + @Autowired + private RunVariableHistoryService runVariableHistoryService; @Override public List selectPersonalTodo(Long tenantId, PersonalTodoQueryDTO queryDTO, List backlogIds) { + queryDTO.setPageType(WorkflowConstants.PageType.TODO); + queryDTO.setTodoCardFlag(Optional.ofNullable(queryDTO.getTodoCardFlag()).orElse(0)); queryDTO.setTenantId(tenantId); - String self = this.userUtils.selfConfirm(queryDTO.getSelf()); - queryDTO.setSelf(self); - List result = this.personalTodoC7nMapper.selectPersonalTodo(queryDTO,backlogIds); - this.processExtraFields(result, tenantId, self, queryDTO.getSeparator()); + List result = personalTodoC7nMapper.selectPersonalTodo(queryDTO, backlogIds); + processExtraFields(result, tenantId, queryDTO.getSelfUserId(), queryDTO.getSelfEmployeeNum(), queryDTO.getSeparator()); + processBusinessExtendField(tenantId,result,queryDTO); return result; } @Override public List selectMobilePersonalTask(PersonalTodoQueryDTO queryDTO, List backlogIds) { - List result = this.personalTodoC7nMapper.selectPersonalTask(queryDTO,backlogIds); - this.processExtraFields(result, queryDTO.getTenantId(), queryDTO.getSelf(), queryDTO.getSeparator()); + List result = personalTodoC7nMapper.selectPersonalTask(queryDTO, backlogIds); + processExtraFields(result, queryDTO.getTenantId(), queryDTO.getSelfUserId(), queryDTO.getSelfEmployeeNum(), queryDTO.getSeparator()); return result; } @Override public List selectMineParticipated(Long tenantId, PersonalTodoQueryDTO queryDTO, List backlogIds) { + queryDTO.setPageType(WorkflowConstants.PageType.PARTICIPATED); queryDTO.setTenantId(tenantId); - String self = this.userUtils.selfConfirm(queryDTO.getSelf()); - queryDTO.setSelf(self); - List result = this.personalTodoC7nMapper.selectMineParticipated(queryDTO, backlogIds); - this.processExtraFields(result, tenantId, self, queryDTO.getSeparator()); + List result = personalTodoC7nMapper.selectMineParticipated(queryDTO, backlogIds); + processExtraFields(result, tenantId, queryDTO.getSelfUserId(), queryDTO.getSelfEmployeeNum(), queryDTO.getSeparator()); + processBusinessExtendField(tenantId,result,queryDTO); return result; } @Override public List selectMineSubmitted(Long tenantId, PersonalTodoQueryDTO queryDTO, List backlogIds) { + queryDTO.setPageType(WorkflowConstants.PageType.SUBMITTED); queryDTO.setTenantId(tenantId); - String self = this.userUtils.selfConfirm(queryDTO.getSelf()); - queryDTO.setSelf(self); - List result = this.personalTodoC7nMapper.selectMineSubmitted(queryDTO, backlogIds); - this.processExtraFields(result, tenantId, self, queryDTO.getSeparator()); + List result = personalTodoC7nMapper.selectMineSubmitted(queryDTO, backlogIds); + processExtraFields(result, tenantId, queryDTO.getSelfUserId(), queryDTO.getSelfEmployeeNum(), queryDTO.getSeparator()); - for (SubmittedDTO submittedDTO : result) { + for (PersonalTodoDTO.SubmittedDTO submittedDTO : result) { submittedDTO.processUrgeEnableFlag(submittedDTO.getInstanceStatus()); - Integer withdrawConfig = (Integer) this.modelService.getConfig(submittedDTO.getDeploymentId(), "backFlag"); + Integer withdrawConfig = (Integer) modelService.getConfig(tenantId,submittedDTO.getFlowCode(),submittedDTO.getDeploymentId(), EngineConstants.ConfigCode.WITHDRAW_CONFIG); if (Objects.nonNull(submittedDTO.getParentInstanceId())) { + // 子流程不允许撤回 submittedDTO.setWithdrawEnableFlag(BaseConstants.Flag.NO); } else { submittedDTO.processWithdrawEnableFlag(withdrawConfig, submittedDTO.getInstanceStatus()); } } - + processBusinessExtendField(tenantId,result,queryDTO); return result; } @Override public List selectMineCarbonCopied(Long tenantId, PersonalTodoQueryDTO queryDTO, List backlogIds) { + queryDTO.setPageType(queryDTO.getCarbonCopyTodoFlag()!=null && queryDTO.getCarbonCopyTodoFlag()==1?WorkflowConstants.PageType.RECEIVE_CARBON_COPY:WorkflowConstants.PageType.CARBON_COPIED); queryDTO.setTenantId(tenantId); - String self = this.userUtils.selfConfirm(queryDTO.getSelf()); - queryDTO.setSelf(self); - List result = this.personalTodoC7nMapper.selectMineCarbonCopied(queryDTO,backlogIds); - this.processExtraFields(result, tenantId, self, queryDTO.getSeparator()); + List result = personalTodoC7nMapper.selectMineCarbonCopied(queryDTO, backlogIds); + processExtraFields(result, tenantId, queryDTO.getSelfUserId(), queryDTO.getSelfEmployeeNum(), queryDTO.getSeparator()); + processBusinessExtendField(tenantId,result,queryDTO); return result; } @Override public List selectSubProcess(PersonalTodoQueryDTO queryDTO, List backlogIds) { - String self = this.userUtils.selfConfirm(queryDTO.getSelf()); - queryDTO.setSelf(self); - List baseViewDTOS = this.personalTodoC7nMapper.selectSubProcess(queryDTO,backlogIds); - this.processExtraFields(baseViewDTOS, queryDTO.getTenantId(), queryDTO.getSelf(), queryDTO.getSeparator()); + this.personalTodoRepository.setSelfInfo(queryDTO); + List baseViewDTOS = personalTodoC7nMapper.selectSubProcess(queryDTO, backlogIds); + processExtraFields(baseViewDTOS, queryDTO.getTenantId(), queryDTO.getSelfUserId(), queryDTO.getSelfEmployeeNum(), queryDTO.getSeparator()); return baseViewDTOS; } - private void processExtraFields(List dtoList, Long tenantId, String self, String separator) { - if (!CollectionUtils.isEmpty(dtoList)) { - separator = StringUtils.isEmpty(separator) ? "," : separator; - Set instanceIdSet = dtoList.stream().map(BaseViewDTO::getInstanceId).collect(Collectors.toSet()); - List runTasks = Optional.ofNullable(this.runTaskMapper.selectByInstanceIds(tenantId, instanceIdSet)).orElse(new ArrayList<>()); - List runNodes = Optional.ofNullable(this.runNodeMapper.selectByInstanceIds(tenantId, instanceIdSet)).orElse(new ArrayList<>()); - List assignees = runTasks.stream().map(RunTask::getAssignee).collect(Collectors.toList()); - List starterEmpIdList = dtoList.stream().map(BaseViewDTO::getStarter).collect(Collectors.toList()); - Map assigneeMap = personalTodoRepository.getFlowAssigneeMap(tenantId, assignees); - Map starterMap = personalTodoRepository.getFlowAssigneeMap(tenantId, starterEmpIdList); - List carbonCopyEmpIdList = dtoList.stream().filter((d) -> { - return d instanceof CarbonCopyDTO; - }).map((d) -> { - return ((CarbonCopyDTO) d).getCarbonCopyFrom(); - }).collect(Collectors.toList()); - Map carbonCopyMap = personalTodoRepository.getFlowAssigneeMap(tenantId, carbonCopyEmpIdList); - Map> runTaskGroupMap = runTasks.stream().collect(Collectors.groupingBy(RunTask::getInstanceId)); - Map> runNodeGroupMap = runNodes.stream().filter((dtox) -> { - return StringUtils.isEmpty(dtox.getNodeType()) || StringUtils.equalsAny(dtox.getNodeType(), new CharSequence[]{"manualNode", "approveChainLineNode", "subProcessNode"}); - }).collect(Collectors.groupingBy(RunNode::getInstanceId)); - - for (T t : dtoList) { - this.nodeNameAndApproverProcess(separator, assigneeMap, runTaskGroupMap, runNodeGroupMap, t); - FlowAssignee starterAssignee = starterMap.get(t.getStarter()); - if (Objects.nonNull(starterAssignee)) { - t.setStarterNumber(starterAssignee.getKey()); - t.setStarter(String.format("%s(%s)", starterAssignee.getName(), starterAssignee.getCode())); - } + private void processExtraFields(List dtoList, Long tenantId, String selfUserId, String selfEmployeeNum, String separator) { + if (CollectionUtils.isEmpty(dtoList)) { + return; + } - if (t instanceof CarbonCopyDTO) { - ((CarbonCopyDTO) t).setReadFlag((Optional.ofNullable(t.getReadPerson()).orElse("")).contains(self) ? BaseConstants.Flag.YES : BaseConstants.Flag.NO); - String carbonCopyFromNum = ((CarbonCopyDTO) t).getCarbonCopyFrom(); - FlowAssignee carbonCopyFrom = Optional.ofNullable(carbonCopyMap.get(carbonCopyFromNum)).orElse(new FlowAssignee()); - ((CarbonCopyDTO) t).setCarbonCopyFrom(String.format("%s(%s)", carbonCopyFrom.getName(), carbonCopyFrom.getCode())); - } + separator = StringUtils.isEmpty(separator) ? BaseConstants.Symbol.COMMA : separator; + + Set instanceIdSet = dtoList.stream().map(PersonalTodoDTO.BaseViewDTO::getInstanceId).collect(Collectors.toSet()); + List runTasks = Optional.ofNullable(runTaskMapper.selectByInstanceIds(tenantId, instanceIdSet)).orElse(new ArrayList<>()); + // 非人工节点的当前节点信息 + List runNodes = Optional.ofNullable(runNodeMapper.selectByInstanceIds(tenantId, instanceIdSet)).orElse(new ArrayList<>()); + + Set employeeNums = runTasks.stream().filter(item -> EngineConstants.ApproveDimension.EMPLOYEE.equals(item.getDimension())) + .map(RunTask::getAssignee).collect(Collectors.toSet()); + Set userIds = runTasks.stream().filter(item -> EngineConstants.ApproveDimension.USER.equals(item.getDimension())) + .map(RunTask::getAssignee).collect(Collectors.toSet()); + + employeeNums.addAll(dtoList.stream().filter(item -> EngineConstants.ApproveDimension.EMPLOYEE.equals(item.getInstanceDimension())) + .map(PersonalTodoDTO.BaseViewDTO::getStarter).collect(Collectors.toList())); + userIds.addAll(dtoList.stream().filter(item -> EngineConstants.ApproveDimension.USER.equals(item.getInstanceDimension())) + .map(PersonalTodoDTO.BaseViewDTO::getStarter).collect(Collectors.toList())); - if (t instanceof PersonalTodoViewDTO) { - List actionList = this.modelService.getActionList(t.getTaskCode(), t.getDeploymentId(), t.getTaskType()); - ((PersonalTodoViewDTO) t).setActionList(actionList); - t.setSelfEmpNum(self); + // 抄送 + List carbonCopyUserIdList = dtoList.stream().filter(d -> d instanceof PersonalTodoDTO.CarbonCopyDTO) + .map(d -> ((PersonalTodoDTO.CarbonCopyDTO) d).getCarbonCopyFrom()).collect(Collectors.toList()); + userIds.addAll(carbonCopyUserIdList); + + Map assigneeMap = flowAssigneeHelper.getFlowAssigneeMap(tenantId, employeeNums, userIds); + + Map> runTaskGroupMap = runTasks.stream().collect(Collectors.groupingBy(RunTask::getInstanceId)); + Map> runNodeGroupMap = runNodes.stream() + .filter(dto -> StringUtils.isEmpty(dto.getNodeType()) + || StringUtils.equalsAny(dto.getNodeType(), EngineConstants.NodeType.MANUAL_NODE, EngineConstants.NodeType.APPROVE_CHAIN_LINE_NODE, EngineConstants.NodeType.SUB_PROCESS_NODE)) + .collect(Collectors.groupingBy(RunNode::getInstanceId)); + for (PersonalTodoDTO.BaseViewDTO dto : dtoList) { + nodeNameAndApproverProcess(separator, assigneeMap, runTaskGroupMap, runNodeGroupMap, dto); + // 流程申请人 + String key = dto.getInstanceDimension() + BaseConstants.Symbol.MIDDLE_LINE + dto.getStarter(); + FlowAssignee starterAssignee = assigneeMap.get(key); + if (Objects.nonNull(starterAssignee)) { + dto.setStarterNumber(starterAssignee.getKey()); + dto.setStarter(starterAssignee.getName()); + dto.setCode(starterAssignee.getCode()); + dto.setEmail(starterAssignee.getEmail()); + if (Objects.equals(starterAssignee.getDimension(),EngineConstants.ApproveDimension.EMPLOYEE)){ + dto.setPhone(starterAssignee.getEmployee().getMobile()); + } + if (Objects.equals(starterAssignee.getDimension(),EngineConstants.ApproveDimension.USER)){ + dto.setPhone(starterAssignee.getUser().getPhone()); } } + // 抄送 + if (dto instanceof PersonalTodoDTO.CarbonCopyDTO) { + // 抄送来源 + String carbonCopyFromNum = ((PersonalTodoDTO.CarbonCopyDTO) dto).getCarbonCopyFrom(); + String carbonCopyKey = EngineConstants.ApproveDimension.USER + BaseConstants.Symbol.MIDDLE_LINE + carbonCopyFromNum; + FlowAssignee carbonCopyFrom = Optional.ofNullable(assigneeMap.get(carbonCopyKey)).orElse(new FlowAssignee()); + ((PersonalTodoDTO.CarbonCopyDTO) dto).setCarbonCopyFrom(String.format("%s(%s)", carbonCopyFrom.getName(), carbonCopyFrom.getCode())); + } + + if (dto instanceof PersonalTodoDTO.PersonalTodoViewDTO) { + // 审批动作列表 + List actionList = modelService.getActionList(dto.getTaskCode(), dto.getDeploymentId(), dto.getTaskType(),dto.getFlowCode()); + ((PersonalTodoDTO.PersonalTodoViewDTO) dto).setActionList(actionList); + dto.setSelfEmpNum(selfEmployeeNum); + dto.setSelfUserId(selfUserId); + } } } @@ -160,18 +204,12 @@ private void nodeNameAndApproverProcess(String separator, Map dtoRunTasks = Optional.ofNullable(runTaskGroupMap.get(dto.getInstanceId())).orElse(new ArrayList<>()); List dtoRunNodes = Optional.ofNullable(runNodeGroupMap.get(dto.getInstanceId())).orElse(new ArrayList<>()); Map> taskGroupByNodeId = dtoRunTasks.stream().collect(Collectors.groupingBy(RunTask::getNodeId)); - List nodeNames = taskGroupByNodeId.values().stream().map((tasks) -> { - return (tasks.get(0)).getTaskName(); - }).collect(Collectors.toList()); - List noApproverNodeNames = dtoRunNodes.stream().filter((r) -> { - return StringUtils.isNotEmpty(r.getNodeName()) && !nodeNames.contains(r.getNodeName()); - }).map(RunNode::getNodeName).collect(Collectors.toList()); + List nodeNames = taskGroupByNodeId.values().stream().map((tasks) -> (tasks.get(0)).getTaskName()).collect(Collectors.toList()); + List noApproverNodeNames = dtoRunNodes.stream().filter((r) -> StringUtils.isNotEmpty(r.getNodeName()) && !nodeNames.contains(r.getNodeName())).map(RunNode::getNodeName).collect(Collectors.toList()); nodeNames.addAll(noApproverNodeNames); dto.setNodeName(String.join(separator, nodeNames)); Set currentAssignees = dtoRunTasks.stream().map(RunTask::getAssignee).collect(Collectors.toSet()); - dto.setAssignee(currentAssignees.stream().map((ca) -> { - return assigneeMap.containsKey(ca) ? String.format("%s(%s)", (assigneeMap.get(ca)).getName(), (assigneeMap.get(ca)).getCode()) : ca; - }).collect(Collectors.joining(separator))); + dto.setAssignee(currentAssignees.stream().map((ca) -> assigneeMap.containsKey(ca) ? String.format("%s(%s)", (assigneeMap.get(ca)).getName(), (assigneeMap.get(ca)).getCode()) : ca).collect(Collectors.joining(separator))); List currentNodeAssigneeList = new ArrayList<>(); for (List taskList : taskGroupByNodeId.values()) { @@ -186,4 +224,73 @@ private void nodeNameAndApproverProcess(String separator, Map void processBusinessExtendField(Long tenantId,List result,PersonalTodoDTO.PersonalTodoQueryDTO queryDTO){ + if(CollectionUtils.isEmpty(result)){ + return; + } + //查询字段列表 + List globalFieldList = defExtendFieldRepository.listTableFieldByPageType(tenantId,queryDTO.getPageType()); + List globalBusinessFieldList = CollectionUtils.isEmpty(globalFieldList)?new ArrayList<>():globalFieldList.stream().filter(dto->WorkflowConstants.FieldSource.BUSINESS_FIELD.equals(dto.getFieldSource())).collect(Collectors.toList()); + + Set instanceIdSet = result.stream().map(PersonalTodoDTO.BaseViewDTO::getInstanceId).collect(Collectors.toSet()); + List extendFieldList = defExtendFieldRepository.selectByInstanceIdList(instanceIdSet); + if(CollectionUtils.isEmpty(globalBusinessFieldList) && CollectionUtils.isEmpty(extendFieldList)){ + for(PersonalTodoDTO.BaseViewDTO baseViewDTO : result){ + baseViewDTO.setDefExtendFieldList(globalFieldList); + } + return; + } + + //查询流程变量 + List runVariableList = runVariableService.selectByCondition(Condition.builder(RunVariable.class).where(Sqls.custom() + .andIn(RunVariable.FIELD_INSTANCE_ID,instanceIdSet) + .andEqualTo(RunVariable.FIELD_TENANT_ID,tenantId) + .andIsNull(RunVariable.FIELD_NODE_ID)).build()); + List runVariableHistoryList = runVariableHistoryService.selectByCondition(Condition.builder(RunVariableHistory.class).where(Sqls.custom() + .andIn(RunVariableHistory.FIELD_INSTANCE_ID,instanceIdSet) + .andEqualTo(RunVariableHistory.FIELD_TENANT_ID,tenantId) + .andIsNull(RunVariableHistory.FIELD_NODE_ID)).build()); + if(CollectionUtils.isEmpty(runVariableList) && CollectionUtils.isEmpty(runVariableHistoryList)){ + return; + } + List allVariableList = new ArrayList<>(); + if(!CollectionUtils.isEmpty(runVariableList)){ + allVariableList.addAll(runVariableList); + } + if(!CollectionUtils.isEmpty(runVariableHistoryList)){ + runVariableHistoryList.forEach(dto->{ + RunVariable ru = new RunVariable(); + BeanUtils.copyProperties(dto,ru); + allVariableList.add(ru); + }); + } + + //设置业务字段 + Map> extendFieldMap = extendFieldList.stream().collect(Collectors.groupingBy(DefExtendField::getInstanceId)); + Map> runVariableMap = allVariableList.stream().collect(Collectors.groupingBy(RunVariable::getInstanceId)); + for(PersonalTodoDTO.BaseViewDTO baseViewDTO : result){ + Long instanceId = baseViewDTO.getInstanceId(); + Map variableCodeValueMap = runVariableMap.get(instanceId).stream().collect(Collectors.toMap(RunVariable::getVariableCode,RunVariable::getValue)); + + //设置业务字段值map + Map bsFieldMap = new HashMap<>(16); + globalBusinessFieldList.forEach(dto-> bsFieldMap.put(dto.getFieldCode(),variableCodeValueMap.get(dto.getFieldCode()))); + if(extendFieldMap != null && CollectionUtils.isNotEmpty(extendFieldMap.get(instanceId))){ + extendFieldMap.get(instanceId).forEach(dto-> bsFieldMap.put(dto.getFieldCode(),variableCodeValueMap.get(dto.getFieldCode()))); + } + baseViewDTO.setBusinessFieldMap(bsFieldMap); + + //卡片模式特殊处理,设置全局字段+流程定义层字段到businessFieldList中 + List allFieldList = new ArrayList<>(globalFieldList); + if(extendFieldMap != null && CollectionUtils.isNotEmpty(extendFieldMap.get(instanceId))){ + allFieldList.addAll(extendFieldMap.get(instanceId)); + allFieldList = allFieldList.stream().sorted(Comparator.comparing(DefExtendField::getFrozenFlag).reversed().thenComparing(DefExtendField::getOrderNo)).collect(Collectors.toList()); + } + baseViewDTO.setDefExtendFieldList(allFieldList); + } + } } diff --git a/src/main/java/io/choerodon/workflow/infra/config/C7nProcessEngineAutoConfiguration.java b/src/main/java/io/choerodon/workflow/infra/config/C7nProcessEngineAutoConfiguration.java index 93cc993..5ec832d 100644 --- a/src/main/java/io/choerodon/workflow/infra/config/C7nProcessEngineAutoConfiguration.java +++ b/src/main/java/io/choerodon/workflow/infra/config/C7nProcessEngineAutoConfiguration.java @@ -49,7 +49,7 @@ public C7nProcessEngineAutoConfiguration(UserGroupManager userGroupManager) { private void configureProcessDefinitionResources(ProcessDefinitionResourceFinder processDefinitionResourceFinder, SpringProcessEngineConfiguration conf) throws IOException { List procDefResources = processDefinitionResourceFinder.discoverProcessDefinitionResources(); if (!procDefResources.isEmpty()) { - conf.setDeploymentResources((Resource[])procDefResources.toArray(new Resource[0])); + conf.setDeploymentResources(procDefResources.toArray(new Resource[0])); } } @@ -105,11 +105,11 @@ public SpringProcessEngineConfiguration springProcessEngineConfiguration(DataSou } if (activitiProperties.getCustomMybatisXMLMappers() != null) { - conf.setCustomMybatisXMLMappers(new HashSet(activitiProperties.getCustomMybatisXMLMappers())); + conf.setCustomMybatisXMLMappers(new HashSet<>(activitiProperties.getCustomMybatisXMLMappers())); } if (activitiProperties.getCustomMybatisXMLMappers() != null) { - conf.setCustomMybatisXMLMappers(new HashSet(activitiProperties.getCustomMybatisXMLMappers())); + conf.setCustomMybatisXMLMappers(new HashSet<>(activitiProperties.getCustomMybatisXMLMappers())); } if (activitiProperties.isUseStrongUuids()) { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3365918..ef468ff 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -119,8 +119,8 @@ hzero: lock: pattern: single single-server: - address: ${SPRING_REDIS_HOST:localhost} - port: ${SPRING_REDIS_PORT:6379} + address: ${spring.redis.host} + port: ${spring.redis.port} scheduler: executor-code: HWKF_EXECUTOR auto-register: true @@ -128,8 +128,6 @@ hzero: cache-value: enable: true workflow: - global-dimension: ${HWKF_GLOBAL_DIMENSION:USER} - admin-temp-api: ${HWKF_ADMIN_TEMP_API:http://hzeronb.saas.hand-china.com/hadm/v1/swagger/tree} #企业微信消息发送agentId wco-agent-id: ${HWKF_WCO_AGENT_ID:1} #钉钉消息发送agentId @@ -145,10 +143,17 @@ hzero: reject-applier-template: ${HWKF_REJECT_APPLIER_TEMPLATE:HWKF.REJECT_APPLIER} # 拒绝后通知审批人消息发送配置 reject-approver-template: ${HWKF_REJECT_APPROVER_TEMPLATE:HWKF.REJECT_APPROVER} - web-domain-name: ${HWKF_WEB_DOMAIN_NAME:example.com} + # 通过后通知申请者 + approved-applier-template: ${HWKF_APPROVED_APPLIER_TEMPLATE:HWKF.APPROVED_APPLIER} + # 抄送通知 + carbon-copy-template: ${HWKF_CARBON_COPY_TEMPLATE:HWKF.CARBON_COPY} + # 海马汇系统中维护的系统ID + hippius-system-id: ${HWKF_HIPPIUS_SYSTEM_ID:HWKF} + # hzero前端地址 + web-domain-name: ${HWKF_WEB_DOMAIN_NAME:www.example.com} # 是否使用模型 model: - enabled: ${HWKF_MODEL_ENABLE:true} + enabled: ${HWKF_MODEL_ENABLE:false} # 工作流线程池配置 executor: core-pool-size: ${HWKF_EXECUTOR_CORE_POOL_SIZE:8} @@ -158,6 +163,24 @@ hzero: #数据归档批处理配置 archive: batchPageSize: ${HWKF_ARCHIVE_BATCH_PAGE_SIZE:10000} + # 流程定义信息立即生效:每次执行节点时获取最新的流程定义配置信息 + def-type-config: + effective-immediate: ${HWKF_DEFCONFIG_EFFECTIVE_IMMEDIATE:false} + crossSchema: + # 当工作流和hr数据在同一个数据源时,支持跨schema查询,加快获取审批人速度 + enabled: ${HWKF_HR_CROSS_SCHEMA_ENABLED:false} + # hr数据库对应schema名称 + schema-name: ${HWKF_HPFM_SCHEMA_NAME:hzero_platform} + # restTemplate默认配置 + rest-template-config: + # 连接超时,10ms + connect-timeout: ${REST_TEMPLATE_CONFIG_CONNECT_TIMEOUT:10000} + # 读取超时 + read-timeout: ${REST_TEMPLATE_CONFIG_READ_TIMEOUT:5000} + #接口调用重试间隔,默认3s + interface-retry-period: ${INTERFACE_RETRY_PERIOD:3000} + #接口调用重试次数 + interface-retry-policy: ${INTERFACE_RETRY_POLICY:3} resource: pattern: ${HZERO_RESOURCE_PATTERN:/v1/*,/choerodon/v1/*} eureka: @@ -209,7 +232,9 @@ logging: level: io.choerodon.event.consumer: ${LOG_LEVEL:info} com.zaxxer: ${LOG_LEVEL:info} + org.apache.ibatis.transaction.managed: error org.apache.ibatis: ${LOG_LEVEL:info} io.choerodon: ${LOG_LEVEL:info} + org.hzero.boot.platform.lov: info org.hzero: ${LOG_LEVEL:info} - org.activiti: ${LOG_LEVEL:info} \ No newline at end of file + org.activiti: ${LOG_LEVEL:info} diff --git a/src/main/resources/script/db/groovy/workflow_service/himp_tables.groovy b/src/main/resources/script/db/groovy/workflow_service/himp_tables.groovy index 26d6842..e2d25f8 100644 --- a/src/main/resources/script/db/groovy/workflow_service/himp_tables.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/himp_tables.groovy @@ -111,4 +111,4 @@ databaseChangeLog(logicalFilePath: 'classpath:config/db/himp_tables.xml') { } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_archive_rule.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_archive_rule.groovy index aeab857..7d09117 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_archive_rule.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_archive_rule.groovy @@ -36,4 +36,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_archive_rule.groovy') { addUniqueConstraint(columnNames: "ARCH_CODE,TENANT_ID", tableName: "hwkf_archive_rule", constraintName: "hwkf_archive_rule_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_archive_rule_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_archive_rule_tl.groovy index 9fbd899..6a6f376 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_archive_rule_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_archive_rule_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_archive_rule_tl.groovy') { addUniqueConstraint(columnNames: "ARCH_ID,LANG", tableName: "hwkf_archive_rule_tl", constraintName: "hwkf_archive_rule_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_account.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_account.groovy index c12b0b5..c365256 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_account.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_account.groovy @@ -28,4 +28,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_account.groovy') { addUniqueConstraint(columnNames: "TYPE_ID,ACCOUNT_TYPE", tableName: "hwkf_def_account", constraintName: "hwkf_def_account_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain.groovy index 2633969..006d273 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain.groovy @@ -35,4 +35,10 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_approve_chain.groovy') { addUniqueConstraint(columnNames: "TYPE_ID,CHAIN_CODE,VERSION", tableName: "hwkf_def_approve_chain", constraintName: "hwkf_def_approve_chain_u1") } -} \ No newline at end of file + + changeSet(author: 'hwkf@hand-china.com', id: '2021-10-20-hwkf_def_approve_chain') { + createIndex(tableName: "hwkf_def_approve_chain", indexName: "hwkf_def_approve_chain_n1") { + column(name: "SOURCE_CHAIN_ID") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_json.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_json.groovy index bd630a2..c00dbde 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_json.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_json.groovy @@ -26,4 +26,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_approve_chain_json.groovy addUniqueConstraint(columnNames: "CHAIN_LINE_ID", tableName: "hwkf_def_approve_chain_json", constraintName: "hwkf_def_approve_chain_json_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_l.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_l.groovy index bbf4c2f..d928e0c 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_l.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_l.groovy @@ -35,4 +35,8 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_approve_chain_l.groovy') addUniqueConstraint(columnNames: "CHAIN_ID,PARENT_ID,ORDER_NO", tableName: "hwkf_def_approve_chain_l", constraintName: "hwkf_def_approve_chain_l_u1") } -} \ No newline at end of file + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-04-13-hwkf_def_approve_chain_l") { + dropUniqueConstraint(tableName: 'hwkf_def_approve_chain_l', constraintName: 'hwkf_def_approve_chain_l_u1') + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_l_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_l_tl.groovy index c34c63f..6fff567 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_l_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_l_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_approve_chain_l_tl.groovy addUniqueConstraint(columnNames: "CHAIN_LINE_ID,LANG", tableName: "hwkf_def_approve_chain_l_tl", constraintName: "hwkf_def_approve_chain_l_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_tl.groovy index de8de6c..6509c7c 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approve_chain_tl.groovy @@ -22,4 +22,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_approve_chain_tl.groovy') addUniqueConstraint(columnNames: "CHAIN_ID,LANG", tableName: "hwkf_def_approve_chain_tl", constraintName: "hwkf_def_approve_chain_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_callback.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_callback.groovy index 5725c8d..a1e3ae4 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_callback.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_callback.groovy @@ -36,4 +36,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_approver_callback.groovy' } } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_line.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_line.groovy index dffbe4f..5b59634 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_line.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_line.groovy @@ -36,4 +36,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_approver_line.groovy') { addUniqueConstraint(columnNames: "RULE_ID,LINE_CODE", tableName: "hwkf_def_approver_line", constraintName: "hwkf_def_approver_line_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_line_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_line_tl.groovy index d0ab2c9..9917097 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_line_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_line_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_approver_line_tl.groovy') addUniqueConstraint(columnNames: "RULE_LINE_ID,LANG", tableName: "hwkf_def_approver_line_tl", constraintName: "hwkf_def_approver_line_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_return.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_return.groovy index bd7b7be..3617db9 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_return.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_return.groovy @@ -35,4 +35,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_approver_return.groovy') addUniqueConstraint(columnNames: "RULE_LINE_ID,FIELD_CODE", tableName: "hwkf_def_approver_return", constraintName: "hwkf_def_approver_return_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_return_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_return_tl.groovy index 3d0f0f0..5bc7957 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_return_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_return_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_approver_return_tl.groovy addUniqueConstraint(columnNames: "RETURN_ID,LANG", tableName: "hwkf_def_approver_return_tl", constraintName: "hwkf_def_approver_return_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_rule.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_rule.groovy index 2952117..ad40163 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_rule.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_rule.groovy @@ -30,4 +30,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_approver_rule.groovy') { addUniqueConstraint(columnNames: "TYPE_ID,RULE_CODE", tableName: "hwkf_def_approver_rule", constraintName: "hwkf_def_approver_rule_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_rule_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_rule_tl.groovy index 8b94c9c..aad6105 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_rule_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_rule_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_approver_rule_tl.groovy') addUniqueConstraint(columnNames: "RULE_ID,LANG", tableName: "hwkf_def_approver_rule_tl", constraintName: "hwkf_def_approver_rule_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_used.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_used.groovy new file mode 100644 index 0000000..693b68f --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_approver_used.groovy @@ -0,0 +1,35 @@ +package script.db.groovy.workflow_service + +databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_approver_used.groovy') { + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-07-14-hwkf_def_approver_used") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + if(helper.dbType().isSupportSequence()){ + createSequence(sequenceName: 'hwkf_def_approver_used_s', startValue:"1") + } + createTable(tableName: "hwkf_def_approver_used", remarks: "") { + column(name: "USED_ID", type: "bigint(20)", autoIncrement: true , remarks: "") {constraints(primaryKey: true)} + column(name: "RULE_LINE_ID", type: "bigint(20)", remarks: "规则行ID") {constraints(nullable:"false")} + column(name: "USED_TYPE", type: "varchar(" + 30 * weight + ")", remarks: "应用类型") {constraints(nullable:"false")} + column(name: "FLOW_ID", type: "bigint(20)", remarks: "流程定义ID") + column(name: "NODE_CODE", type: "varchar(" + 30 * weight + ")", remarks: "节点编码") + column(name: "NODE_NAME", type: "varchar(" + 30 * weight + ")", remarks: "节点名称") + column(name: "REMARK", type: "varchar(" + 30 * weight + ")", remarks: "备注") + column(name: "CHAIN_LINE_ID", type: "bigint(20)", remarks: "审批链行ID") + column(name: "VERSION", type: "int", remarks: "版本号") + column(name: "TENANT_ID", type: "bigint(20)", remarks: "") {constraints(nullable:"false")} + column(name: "OBJECT_VERSION_NUMBER", type: "bigint(20)", defaultValue:"1", remarks: "") {constraints(nullable:"false")} + column(name: "CREATION_DATE", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "") {constraints(nullable:"false")} + column(name: "CREATED_BY", type: "bigint(20)", remarks: "") + column(name: "LAST_UPDATED_BY", type: "bigint(20)", remarks: "") + column(name: "LAST_UPDATE_DATE", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "") {constraints(nullable:"false")} + column(name: "LAST_UPDATE_LOGIN", type: "int(11)", remarks: "") + + } + + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_auto_process_flow.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_auto_process_flow.groovy new file mode 100644 index 0000000..b1ddec5 --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_auto_process_flow.groovy @@ -0,0 +1,33 @@ +package script.db.groovy.workflow_service + +databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_auto_process_flow.groovy') { + changeSet(author: "hzero@hand-china.com", id: "2021-09-07-hwkf_def_auto_process_flow") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + if (helper.dbType().isSupportSequence()) { + createSequence(sequenceName: 'hwkf_def_auto_process_flow_s', startValue: "1") + } + createTable(tableName: "hwkf_def_auto_process_flow", remarks: "工作流自动处理-流程表") { + column(name: "AUTOMATIC_FLOW_ID", type: "bigint", autoIncrement: true, remarks: "表ID,主键,供其他表做外键") { constraints(primaryKey: true) } + column(name: "AUTOMATIC_ID", type: "bigint", remarks: "工作流自动处理表主键") { constraints(nullable: "false") } + column(name: "FLOW_CODE", type: "varchar(" + 255 * weight + ")", remarks: "HWKF_DEF_WORKFLOW表code") { constraints(nullable: "false") } + column(name: "TENANT_ID", type: "bigint", remarks: "租户ID") { constraints(nullable: "false") } + column(name: "OBJECT_VERSION_NUMBER", type: "bigint", defaultValue: "1", remarks: "行版本号,用来处理锁") { constraints(nullable: "false") } + column(name: "CREATION_DATE", type: "datetime", defaultValueComputed: "CURRENT_TIMESTAMP", remarks: "") { constraints(nullable: "false") } + column(name: "CREATED_BY", type: "bigint", remarks: "") + column(name: "LAST_UPDATED_BY", type: "bigint", remarks: "") + column(name: "LAST_UPDATE_DATE", type: "datetime", defaultValueComputed: "CURRENT_TIMESTAMP", remarks: "") { constraints(nullable: "false") } + } + + createIndex(tableName: "hwkf_def_auto_process_flow", indexName: "hwkf_def_auto_process_flow_n1") { + column(name: "FLOW_CODE") + column(name: "TENANT_ID") + } + + addUniqueConstraint(columnNames: "AUTOMATIC_ID,FLOW_CODE", tableName: "hwkf_def_auto_process_flow", constraintName: "hwkf_def_auto_process_flow_u1") + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_automatic_process.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_automatic_process.groovy index e57ff88..53089c5 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_automatic_process.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_automatic_process.groovy @@ -39,4 +39,42 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_automatic_process.groovy' addUniqueConstraint(columnNames: "FLOW_CODE,USER_ID,TENANT_ID", tableName: "hwkf_def_automatic_process", constraintName: "hwkf_def_automatic_process_u1") } -} \ No newline at end of file + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-05-08-hwkf_def_automatic_process") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_def_automatic_process') { + column(name: "DIMENSION", type: "varchar(" + 30 * weight + ")", remarks: "维度:EMPLOYEE(员工) USER(用户)") + } + addColumn(tableName: 'hwkf_def_automatic_process') { + column(name: "RULE_TYPE", type: "varchar(" + 30 * weight + ")", remarks: "规则类型:GLOBAL(适用所有流程) SINGLE(适用特定流程)") + } + addColumn(tableName: 'hwkf_def_automatic_process') { + column(name: "RULE_CODE", type: "varchar(" + 30 * weight + ")", remarks: "规则编码") + } + addColumn(tableName: 'hwkf_def_automatic_process') { + column(name: "RULE_NAME", type: "varchar(" + 80 * weight + ")", remarks: "规则名称") + } + + dropIndex(tableName: 'hwkf_def_automatic_process', indexName: 'HWKF_DEF_AUTOMATIC_PROCESS_N1') + dropUniqueConstraint(tableName: 'hwkf_def_automatic_process', constraintName: 'hwkf_def_automatic_process_u1') + dropNotNullConstraint(tableName: "hwkf_def_automatic_process", columnName: "FLOW_CODE", columnDataType: "varchar(" + 255 * weight + ")") + createIndex(tableName: "hwkf_def_automatic_process", indexName: "HWKF_DEF_AUTOMATIC_PROCESS_N1") { + column(name: "FLOW_CODE") + } + + addColumn(tableName: 'hwkf_def_automatic_process') { + column(name: "ADMIN_FLAG", type: "tinyint", defaultValue: "0", remarks: "管理员-是否是管理员功能页面配置数据") + } + addColumn(tableName: 'hwkf_def_automatic_process') { + column(name: "RELATION_AUTOMATIC_ID", type: "bigint", remarks: "管理员-部分流程,关联配置Id") + } + addColumn(tableName: 'hwkf_def_automatic_process') { + column(name: "HEADER_FLAG", type: "tinyint", defaultValue: "0", remarks: "管理员-是否是头数据,该条数据不参与后续运行中规则处理") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_condition.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_condition.groovy index a49db29..1f921d3 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_condition.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_condition.groovy @@ -32,4 +32,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_condition.groovy') { addUniqueConstraint(columnNames: "TYPE_ID,CONDITION_CODE", tableName: "hwkf_def_condition", constraintName: "hwkf_def_condition_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_condition_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_condition_tl.groovy index 7e1ade3..0496727 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_condition_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_condition_tl.groovy @@ -22,4 +22,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_condition_tl.groovy') { addUniqueConstraint(columnNames: "CONDITION_ID,LANG", tableName: "hwkf_def_condition_tl", constraintName: "hwkf_def_condition_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_config.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_config.groovy index e9db759..8243f2a 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_config.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_config.groovy @@ -25,4 +25,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_config.groovy') { } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_custom_node.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_custom_node.groovy new file mode 100644 index 0000000..2b554ff --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_custom_node.groovy @@ -0,0 +1,39 @@ +package script.db.groovy.workflow_service +databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_custom_node.groovy') { + def weight_c = 1 + if(helper.isSqlServer()){ + weight_c = 2 + } + if(helper.isOracle()){ + weight_c = 3 + } + changeSet(author: "xiuhong.chen@hand-china.com", id: "hwkf_def_custom_node-2021-09-07-version-2"){ + if(helper.dbType().isSupportSequence()){ + createSequence(sequenceName: 'hwkf_def_custom_node_s', startValue:"1") + } + createTable(tableName: "hwkf_def_custom_node", remarks: "自定义节点表") { + column(name: "custom_node_id", type: "bigint",autoIncrement: true, startWith: "1", incrementBy:"1", remarks: "") {constraints(primaryKey: true)} + column(name: "type_id", type: "bigint", remarks: "流程分类ID") { constraints(nullable: "false") } + column(name: "custom_node_code", type: "varchar(" + 30* weight_c + ")", remarks: "自定义节点编码") {constraints(nullable:"false")} + column(name: "custom_node_name", type: "varchar(" + 80* weight_c + ")", remarks: "自定义节点名称") {constraints(nullable:"false")} + column(name: "custom_node_type", type: "varchar(" + 30* weight_c + ")", remarks: "节点类型") {constraints(nullable:"false")} + column(name: "custom_node_desc", type: "varchar(" + 240* weight_c + ")", remarks: "描述") + column(name: "executor_interface_id", type: "bigint", remarks: "处理器-接口定义ID") {constraints(nullable:"false")} + column(name: "validator_interface_id", type: "bigint", remarks: "校验器-接口定义ID") + column(name: "enabled_flag", type: "tinyint", defaultValue:"1", remarks: "") + column(name: "tenant_id", type: "bigint", remarks: "") {constraints(nullable:"false")} + column(name: "created_by", type: "bigint", defaultValue:"-1", remarks: "创建人") {constraints(nullable:"false")} + column(name: "last_updated_by", type: "bigint", defaultValue:"-1", remarks: "最近更新人") {constraints(nullable:"false")} + column(name: "creation_date", type: "datetime", defaultValueComputed :"CURRENT_TIMESTAMP", remarks: "创建时间") {constraints(nullable:"false")} + column(name: "last_update_date", type: "datetime", defaultValueComputed :"CURRENT_TIMESTAMP", remarks: "最近更新时间") {constraints(nullable:"false")} + column(name: "object_version_number", type: "bigint", defaultValue:"1", remarks: "行版本号,用来处理锁") {constraints(nullable:"false")} + } + addUniqueConstraint(columnNames:"type_id,custom_node_code",tableName:"hwkf_def_custom_node",constraintName: "hwkf_def_custom_node_u1") + } + + changeSet(author: 'hzero@hand-china.com', id: '2020-10-15-hwkf_def_custom_node') { + addColumn(tableName: 'hwkf_def_custom_node') { + column(name: "record_source_type", type: "varchar(" + 30* weight_c + ")", remarks: "记录来源:PREDEFINED(预定义),CUSTOMIZE(自定义)", defaultValue:"CUSTOMIZE") {constraints(nullable:"false")} + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_custom_node_att.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_custom_node_att.groovy new file mode 100644 index 0000000..b799003 --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_custom_node_att.groovy @@ -0,0 +1,54 @@ +package script.db.groovy.workflow_service +databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_custom_node_att.groovy') { + def weight_c = 1 + if(helper.isSqlServer()){ + weight_c = 2 + } + if(helper.isOracle()){ + weight_c = 3 + } + changeSet(author: "xiuhong.chen@hand-china.com", id: "hwkf_def_custom_node_att-2021-08-31-version-1"){ + if(helper.dbType().isSupportSequence()){ + createSequence(sequenceName: 'hwkf_def_custom_node_att_s', startValue:"1") + } + createTable(tableName: "hwkf_def_custom_node_att", remarks: "自定义节点属性表") { + column(name: "attr_id", type: "bigint",autoIncrement: true, remarks: "") {constraints(primaryKey: true)} + column(name: "custom_node_id", type: "bigint", remarks: "自定义节点ID") {constraints(nullable:"false")} + column(name: "order_no", type: "int", remarks: "序号") + column(name: "attr_code", type: "varchar(" + 30* weight_c + ")", remarks: "属性编码") {constraints(nullable:"false")} + column(name: "attr_name", type: "varchar(" + 80* weight_c + ")", remarks: "属性名称") {constraints(nullable:"false")} + column(name: "attr_desc", type: "varchar(" + 240* weight_c + ")", remarks: "属性描述") + column(name: "attr_type", type: "varchar(" + 30* weight_c + ")", remarks: "属性类型:下拉框、文本框等") {constraints(nullable:"false")} + column(name: "attr_value_source", type: "varchar(" + 30* weight_c + ")", remarks: "属性值来源:下拉列表代码") + column(name: "default_value", type: "varchar(" + 30* weight_c + ")", remarks: "默认值") + column(name: "multi_select_flag", type: "tinyint", remarks: "支持多选") + column(name: "required_flag", type: "tinyint", defaultValue:"0", remarks: "是否必输") + column(name: "enabled_flag", type: "tinyint", defaultValue:"1", remarks: "是否启用") {constraints(nullable:"false")} + column(name: "tenant_id", type: "bigint", remarks: "租户ID") {constraints(nullable:"false")} + column(name: "created_by", type: "bigint", defaultValue:"-1", remarks: "创建人") {constraints(nullable:"false")} + column(name: "last_updated_by", type: "bigint", defaultValue:"-1", remarks: "最近更新人") {constraints(nullable:"false")} + column(name: "creation_date", type: "datetime", defaultValueComputed :"CURRENT_TIMESTAMP", remarks: "创建时间") {constraints(nullable:"false")} + column(name: "last_update_date", type: "datetime", defaultValueComputed :"CURRENT_TIMESTAMP", remarks: "最近更新时间") {constraints(nullable:"false")} + column(name: "object_version_number", type: "bigint", defaultValue:"1", remarks: "行版本号,用来处理锁") {constraints(nullable:"false")} + } + addUniqueConstraint(columnNames:"attr_code,custom_node_id",tableName:"hwkf_def_custom_node_att",constraintName: "hwkf_def_custom_node_att_u1") + } + + changeSet(author: "hwkf@hand-china.com", id: "2021-09-14-hwkf_def_custom_node_att") { + addColumn(tableName: 'hwkf_def_custom_node_att') { + column(name: "create_prompt", type: "varchar(" + 240* weight_c + ")", remarks: "创建提示") + } + } + + changeSet(author: "hwkf@hand-china.com", id: "2021-10-28-hwkf_def_custom_node_att") { + addColumn(tableName: 'hwkf_def_custom_node_att') { + column(name: "display_flag", type: "tinyint", defaultValue: "1", remarks: "变量是否显示") + } + } + + changeSet(author: "hwkf@hand-china.com", id: "2021-11-01-hwkf_def_custom_node_att") { + addColumn(tableName: 'hwkf_def_custom_node_att') { + column(name: "variable_id", type: "bigint", remarks: "变量ID") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_custom_node_att_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_custom_node_att_tl.groovy new file mode 100644 index 0000000..76ac87d --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_custom_node_att_tl.groovy @@ -0,0 +1,29 @@ +package script.db.groovy.workflow_service +databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_custom_node_att_tl.groovy') { + def weight_c = 1 + if(helper.isSqlServer()){ + weight_c = 2 + } + if(helper.isOracle()){ + weight_c = 3 + } + changeSet(author: "xiuhong.chen@hand-china.com", id: "hwkf_def_custom_node_att_tl-2021-09-01-version-1"){ + if(helper.dbType().isSupportSequence()){ + createSequence(sequenceName: 'hwkf_def_custom_node_att_tl_s', startValue:"1") + } + createTable(tableName: "hwkf_def_custom_node_att_tl", remarks: "工作流事件多语言") { + column(name: "attr_id", type: "bigint", remarks: "属性ID") {constraints(nullable:"false")} + column(name: "attr_name", type: "varchar(" + 80* weight_c + ")", remarks: "属性名称") {constraints(nullable:"false")} + column(name: "attr_desc", type: "varchar(" + 240* weight_c + ")", remarks: "属性描述") + column(name: "tenant_id", type: "bigint", remarks: "租户ID") {constraints(nullable:"false")} + column(name: "lang", type: "varchar(" + 30* weight_c + ")", remarks: "语言") {constraints(nullable:"false")} + } + addUniqueConstraint(columnNames:"attr_id,lang",tableName:"hwkf_def_custom_node_att_tl",constraintName: "hwkf_def_custom_node_att_tl_u1") + } + + changeSet(author: "hwkf@hand-china.com", id: "2021-09-14-hwkf_def_custom_node_att_tl") { + addColumn(tableName: 'hwkf_def_custom_node_att_tl') { + column(name: "create_prompt", type: "varchar(" + 240* weight_c + ")", remarks: "创建提示") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_custom_node_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_custom_node_tl.groovy new file mode 100644 index 0000000..adf7fd9 --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_custom_node_tl.groovy @@ -0,0 +1,28 @@ +package script.db.groovy.workflow_service +databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_custom_node_tl.groovy') { + def weight_c = 1 + if(helper.isSqlServer()){ + weight_c = 2 + } + if(helper.isOracle()){ + weight_c = 3 + } + changeSet(author: "xiuhong.chen@hand-china.com", id: "hwkf_def_custom_node_tl-2021-09-01-version-1"){ + if(helper.dbType().isSupportSequence()){ + createSequence(sequenceName: 'hwkf_def_custom_node_tl_s', startValue:"1") + } + createTable(tableName: "hwkf_def_custom_node_tl", remarks: "工作流事件多语言") { + column(name: "custom_node_id", type: "bigint", remarks: "自定义节点ID") {constraints(nullable:"false")} + column(name: "custom_node_name", type: "varchar(" + 80* weight_c + ")", remarks: "自定义节点名称") {constraints(nullable:"false")} + column(name: "\"desc\"", type: "varchar(" + 240* weight_c + ")", remarks: "自定义节点描述") + column(name: "tenant_id", type: "bigint", remarks: "租户ID") {constraints(nullable:"false")} + column(name: "lang", type: "varchar(" + 30* weight_c + ")", remarks: "语言") {constraints(nullable:"false")} + } + addUniqueConstraint(columnNames:"custom_node_id,lang",tableName:"hwkf_def_custom_node_tl",constraintName: "hwkf_def_custom_node_tl_u1") + } + + changeSet(author: "hzero@hand-china.com", id: "2021-10-15-hwkf_def_custom_node_tl") { + renameColumn(tableName: "hwkf_def_custom_node_tl", oldColumnName: "\"desc\"", + newColumnName: "custom_node_desc", columnDataType: "varchar(" + 240 * weight_c + ")", remarks: "自定义节点描述") + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_customize_act.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_customize_act.groovy index cc54e1b..456e565 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_customize_act.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_customize_act.groovy @@ -33,4 +33,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_customize_act.groovy') { addUniqueConstraint(columnNames: "TYPE_ID,ACTION_CODE", tableName: "hwkf_def_customize_act", constraintName: "hwkf_def_customize_act_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_customize_act_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_customize_act_tl.groovy index 6f02fe6..8a817b6 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_customize_act_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_customize_act_tl.groovy @@ -22,4 +22,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_customize_act_tl.groovy') addUniqueConstraint(columnNames: "ACTION_ID,LANG", tableName: "hwkf_def_customize_act_tl", constraintName: "hwkf_def_customize_act_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_deployment.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_deployment.groovy index bc114b6..7f064fc 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_deployment.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_deployment.groovy @@ -33,4 +33,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_deployment.groovy') { addUniqueConstraint(columnNames: "FLOW_KEY,VERSION,TENANT_ID", tableName: "hwkf_def_deployment", constraintName: "hwkf_def_deployment_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_event.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_event.groovy index b90df46..67adb3c 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_event.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_event.groovy @@ -33,4 +33,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_event.groovy') { addUniqueConstraint(columnNames: "TYPE_ID,EVENT_CODE", tableName: "hwkf_def_event", constraintName: "hwkf_def_event_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_event_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_event_tl.groovy index e9f6058..4bd7ef0 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_event_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_event_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_event_tl.groovy') { addUniqueConstraint(columnNames: "EVENT_ID,LANG", tableName: "hwkf_def_event_tl", constraintName: "hwkf_def_event_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_expiration_rule.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_expiration_rule.groovy index a6bd88a..cd46566 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_expiration_rule.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_expiration_rule.groovy @@ -46,4 +46,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_expiration_rule.groovy') } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_extend_field.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_extend_field.groovy new file mode 100644 index 0000000..79b18b6 --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_extend_field.groovy @@ -0,0 +1,77 @@ +package script.db.groovy.workflow_service + +databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_extend_field.groovy') { + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-07-16-hwkf_def_extend_field") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + if(helper.dbType().isSupportSequence()){ + createSequence(sequenceName: 'hwkf_def_extend_field_s', startValue:"1") + } + createTable(tableName: "hwkf_def_extend_field", remarks: "扩展字段表") { + column(name: "FIELD_ID", type: "bigint(20)", autoIncrement: true , remarks: "表ID,主键,供其他表做外键") {constraints(primaryKey: true)} + column(name: "FLOW_ID", type: "bigint(20)", remarks: "流程定义ID") {constraints(nullable:"false")} + column(name: "FIELD_CODE", type: "varchar(" + 80 * weight + ")", remarks: "字段编码") {constraints(nullable:"false")} + column(name: "FIELD_NAME", type: "varchar(" + 80 * weight + ")", remarks: "字段名称") {constraints(nullable:"false")} + column(name: "DISPLAY_FLAG", type: "tinyint", defaultValue:"1", remarks: "是否展示") {constraints(nullable:"false")} + column(name: "ORDER_NO", type: "tinyint", defaultValue:"1", remarks: "序号") {constraints(nullable:"false")} + column(name: "REMARK", type: "varchar(" + 240 * weight + ")", remarks: "备注描述") + column(name: "TENANT_ID", type: "bigint(20)", remarks: "租户ID") {constraints(nullable:"false")} + column(name: "OBJECT_VERSION_NUMBER", type: "bigint(20)", defaultValue:"1", remarks: "行版本号,用来处理锁") {constraints(nullable:"false")} + column(name: "CREATION_DATE", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "") {constraints(nullable:"false")} + column(name: "CREATED_BY", type: "bigint(20)", remarks: "") + column(name: "LAST_UPDATED_BY", type: "bigint(20)", remarks: "") + column(name: "LAST_UPDATE_DATE", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "") {constraints(nullable:"false")} + + } + createIndex(tableName: "hwkf_def_extend_field", indexName: "hwkf_def_extend_field_N1") { + column(name: "FLOW_ID") + } + + } + changeSet(author: "hzero@hand-china.com", id: "2021-11-17-hwkf_def_extend_field") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + dropNotNullConstraint(tableName: 'hwkf_def_extend_field', columnName: 'FLOW_ID', columnDataType: 'bigint(20)') + addColumn(tableName: 'hwkf_def_extend_field') { + column(name: "FIELD_SOURCE", type: "varchar(" + 30 * weight + ")", remarks: "字段来源",defaultValue: "BUSINESS_FIELD") + } + addColumn(tableName: 'hwkf_def_extend_field') { + column(name: "PAGE_TYPE", type: "varchar(" + 30 * weight + ")", remarks: "所属页面") + } + addColumn(tableName: 'hwkf_def_extend_field') { + column(name: "FROZEN_FLAG", type: "tinyint", remarks: "是否冻结",defaultValue:"0") + } + addColumn(tableName: 'hwkf_def_extend_field') { + column(name: "SELECT_FLAG", type: "tinyint", remarks: "是否查询可见",defaultValue:"0") + } + addColumn(tableName: 'hwkf_def_extend_field') { + column(name: "DETAIL_FLAG", type: "tinyint", remarks: "是否详情可见",defaultValue:"0") + } + addColumn(tableName: 'hwkf_def_extend_field') { + column(name: "JUMP_FLAG", type: "tinyint", remarks: "是否跳转",defaultValue:"0") + } + addColumn(tableName: 'hwkf_def_extend_field') { + column(name: "ENABLED_FLAG", type: "tinyint", remarks: "启用",defaultValue:"1") + } + addColumn(tableName: 'hwkf_def_extend_field') { + column(name: "RECORD_SOURCE_TYPE", type: "varchar(" + 30 * weight + ")", remarks: "记录来源:PREDEFINED(预定义)、CUSTOMIZE(自定义)",defaultValue: "CUSTOMIZE") + } + createIndex(tableName: "hwkf_def_extend_field", indexName: "hwkf_def_extend_field_N2") { + column(name: "TENANT_ID") + } + addUniqueConstraint(columnNames: "FLOW_ID,FIELD_CODE,PAGE_TYPE,TENANT_ID", tableName: "hwkf_def_extend_field", constraintName: "hwkf_def_extend_field_U1") + + } + + changeSet(author: "hzero@hand-china.com", id: "2021-11-23-hwkf_def_extend_field") { + modifyDataType(tableName: "hwkf_def_extend_field", columnName: "ORDER_NO", newDataType:"int") + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_extend_field_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_extend_field_tl.groovy new file mode 100644 index 0000000..f62a12f --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_extend_field_tl.groovy @@ -0,0 +1,25 @@ +package script.db.groovy.workflow_service + +databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_extend_field_tl.groovy') { + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-07-19-hwkf_def_extend_field_tl") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + if (helper.dbType().isSupportSequence()) { + createSequence(sequenceName: 'hwkf_def_extend_field_tl_s', startValue: "1") + } + createTable(tableName: "hwkf_def_extend_field_tl", remarks: "扩展字段表多语言") { + column(name: "FIELD_ID", type: "bigint", remarks: "字段ID") { constraints(nullable: "false") } + column(name: "LANG", type: "varchar(" + 30 * weight + ")", remarks: "语言") { constraints(nullable: "false") } + column(name: "FIELD_NAME", type: "varchar(" + 80 * weight + ")", remarks: "字段名称") { constraints(nullable: "false") } + column(name: "REMARK", type: "varchar(" + 240 * weight + ")", remarks: "描述") + column(name: "TENANT_ID", type: "bigint", remarks: "") { constraints(nullable: "false") } + } + + + addUniqueConstraint(columnNames: "FIELD_ID,LANG", tableName: "hwkf_def_extend_field_tl", constraintName: "hwkf_def_extend_field_tl_u1") + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_flow_document.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_flow_document.groovy index 0686e35..a824430 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_flow_document.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_flow_document.groovy @@ -35,4 +35,15 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_flow_document.groovy') { addUniqueConstraint(columnNames: "RELATE_CODE,COMPANY_NUM,TENANT_ID", tableName: "hwkf_def_flow_document", constraintName: "hwkf_def_flow_document_u1") } -} \ No newline at end of file + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-04-13-hwkf_def_flow_document") { + addColumn(tableName: 'hwkf_def_flow_document') { + column(name: "TYPE_ID", type: "bigint", remarks: "流程分类ID") + } + dropNotNullConstraint(tableName: 'hwkf_def_flow_document', columnName: 'FLOW_ID', columnDataType: 'bigint') + dropColumn(tableName: 'hwkf_def_flow_document') { + column(name: "FLOW_ID", type: "bigint", remarks: "流程定义ID、DEF_WORKFLOW") { constraints(nullable: "false") } + } + } + +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_flow_document_line.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_flow_document_line.groovy new file mode 100644 index 0000000..2b12c80 --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_flow_document_line.groovy @@ -0,0 +1,34 @@ +package script.db.groovy.workflow_service + +databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_flow_document_line.groovy') { + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-04-13-hwkf_def_flow_document_line") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + if(helper.dbType().isSupportSequence()){ + createSequence(sequenceName: 'hwkf_def_flow_document_line_s', startValue:"1") + } + createTable(tableName: "hwkf_def_flow_document_line", remarks: "业务单据映射行表") { + column(name: "LINE_ID", type: "bigint", autoIncrement: true , remarks: "表ID,主键,供其他表做外键") {constraints(primaryKey: true)} + column(name: "RELATE_ID", type: "bigint", remarks: "关联ID,FLOW_DOCUMENT表主键") {constraints(nullable:"false")} + column(name: "FLOW_ID", type: "bigint", remarks: "流程定义ID") {constraints(nullable:"false")} + column(name: "DESCRIPTION", type: "varchar(" + 255 * weight + ")", remarks: "备注") + column(name: "CONDITION_JSON", type: "longtext", remarks: "条件报文") {constraints(nullable:"false")} + column(name: "ENABLED_FLAG", type: "tinyint", defaultValue:"1", remarks: "启用") {constraints(nullable:"false")} + column(name: "DEFAULT_FLAG", type: "tinyint", defaultValue:"0", remarks: "默认") {constraints(nullable:"false")} + column(name: "TENANT_ID", type: "bigint", remarks: "") {constraints(nullable:"false")} + column(name: "object_version_number", type: "bigint", defaultValue:"1", remarks: "行版本号,用来处理锁") {constraints(nullable:"false")} + column(name: "CREATION_DATE", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "") {constraints(nullable:"false")} + column(name: "CREATED_BY", type: "bigint", defaultValue:"-1", remarks: "") {constraints(nullable:"false")} + column(name: "LAST_UPDATED_BY", type: "bigint", defaultValue:"-1", remarks: "") {constraints(nullable:"false")} + column(name: "LAST_UPDATE_DATE", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "") {constraints(nullable:"false")} + column(name: "LAST_UPDATE_LOGIN", type: "bigint", defaultValue:"-1", remarks: "") + + } + + addUniqueConstraint(columnNames:"RELATE_ID,FLOW_ID",tableName:"hwkf_def_flow_document_line",constraintName: "RELATE_ID") + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_flow_document_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_flow_document_tl.groovy index d87b4f7..c6a7df6 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_flow_document_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_flow_document_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_flow_document_tl.groovy') addUniqueConstraint(columnNames: "RELATE_ID,LANG", tableName: "hwkf_def_flow_document_tl", constraintName: "hwkf_def_flow_document_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_form.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_form.groovy index d825eb0..91b3860 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_form.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_form.groovy @@ -34,4 +34,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_form.groovy') { addUniqueConstraint(columnNames: "TYPE_ID,FORM_CODE", tableName: "hwkf_def_form", constraintName: "hwkf_def_form_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_form_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_form_tl.groovy index efb402d..c456681 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_form_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_form_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_form_tl.groovy') { addUniqueConstraint(columnNames: "FORM_ID,LANG", tableName: "hwkf_def_form_tl", constraintName: "hwkf_def_form_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_history.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_history.groovy index bdfe25e..be4c206 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_history.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_history.groovy @@ -36,4 +36,21 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_history.groovy') { } } -} \ No newline at end of file + changeSet(author: "hzero@hand-china.com", id: "2021-09-07-hwkf_def_history") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_def_history') { + column(name: "PRIMARY_NAME", type: "varchar(" + 255 * weight + ")", remarks: "业务名称") + } + addColumn(tableName: 'hwkf_def_history') { + column(name: "ATTRIBUTE1", type: "varchar(" + 255 * weight + ")", remarks: "ATTRIBUTE1") + } + addColumn(tableName: 'hwkf_def_history') { + column(name: "ATTRIBUTE2", type: "varchar(" + 255 * weight + ")", remarks: "ATTRIBUTE2") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface.groovy index e7de097..bd6a57b 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface.groovy @@ -33,4 +33,63 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_interface.groovy') { addUniqueConstraint(columnNames: "INTERFACE_CODE,TENANT_ID", tableName: "hwkf_def_interface", constraintName: "hwkf_def_interface_u1") } -} \ No newline at end of file + changeSet(author: "weisen.yang@hand-china.com", id: "2021-07-12-hwkf_def_interface") { + addColumn(tableName: 'hwkf_def_interface') { + column(name: "SYNC_PARAM", type: "tinyint", defaultValue: "0", remarks: "同步参数标识") + } + } + changeSet(author: "weisen.yang@hand-china.com", id: "2021-07-14-hwkf_def_interface") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_def_interface') { + column(name: "OUT_INTERFACE_ID", type: "bigint", remarks: "外部接口ID") + } + addColumn(tableName: 'hwkf_def_interface') { + column(name: "OUT_INTERFACE_FLAG", type: "tinyint", defaultValue: "0",remarks: "0内部api接口,1外部接口,2内部bean,3脚本事件,4事务处理流") + } + addColumn(tableName: 'hwkf_def_interface') { + column(name: "NAMESPACE", type: "varchar(" + 30 * weight + ")", remarks: "命名空间") + } + addColumn(tableName: 'hwkf_def_interface') { + column(name: "SERVER_CODE", type: "varchar(" + 80 * weight + ")", remarks: "服务编码") + } + addColumn(tableName: 'hwkf_def_interface') { + column(name: "OUT_INTERFACE_CODE", type: "varchar(" + 80 * weight + ")", remarks: "外部接口编码") + } + addColumn(tableName: 'hwkf_def_interface') { + column(name: "OUT_INTERFACE_NAME", type: "varchar(" + 240 * weight + ")", remarks: "外部接口名称") + } + dropNotNullConstraint(tableName: "hwkf_def_interface", columnName: "SERVICE_NAME", columnDataType: "varchar(" + 90 * weight + ")") + dropNotNullConstraint(tableName: "hwkf_def_interface", columnName: "PERMISSION_CODE", columnDataType: "varchar(" + 128 * weight + ")") + dropNotNullConstraint(tableName: "hwkf_def_interface", columnName: "METHOD", columnDataType: "varchar(" + 10 * weight + ")") + dropNotNullConstraint(tableName: "hwkf_def_interface", columnName: "PERMISSION_LEVEL", columnDataType: "varchar(" + 30 * weight + ")") + } + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-09-07-hwkf_def_interface") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_def_interface') { + column(name: "HANDLER_CODE", type: "varchar(" + 80 * weight + ")", remarks: "自定义事件处理器编码") + } + } + + changeSet(author: "like.zhang@hand-china.com", id: "2021-11-23-hwkf_def_interface") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_def_interface') { + column(name: "BODY_JSON", type: "longtext", remarks: "接口body参数") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface_param.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface_param.groovy index fde8cbd..a12c9df 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface_param.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface_param.groovy @@ -32,4 +32,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_interface_param.groovy') addUniqueConstraint(columnNames: "INTERFACE_ID,PARAMETER_CODE", tableName: "hwkf_def_interface_param", constraintName: "hwkf_def_interface_param_u") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface_param_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface_param_tl.groovy index 8b47970..d78cff0 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface_param_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface_param_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_interface_param_tl.groovy addUniqueConstraint(columnNames: "PARAMETER_ID,LANG", tableName: "hwkf_def_interface_param_tl", constraintName: "hwkf_def_interface_param_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface_tl.groovy index e4570c6..0d7c8f6 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_interface_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_interface_tl.groovy') { addUniqueConstraint(columnNames: "INTERFACE_ID,LANG", tableName: "hwkf_def_interface_tl", constraintName: "hwkf_def_interface_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_mail_template.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_mail_template.groovy index 77d032e..f789d4e 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_mail_template.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_mail_template.groovy @@ -30,4 +30,36 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_mail_template.groovy') { } -} \ No newline at end of file + + changeSet(author: "weisen.yang@hand-china.com", id: "2021-06-24-hwkf_def_mail_template") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_def_mail_template') { + column(name: "RECORD_SOURCE_TYPE", type: "varchar(" + 30 * weight + ")", defaultValue: "CUSTOMIZE", remarks: "记录来源:PREDEFINED(预定义)、CUSTOMIZE(自定义)") + } + } + changeSet(author: "like.zhang@hand-china.com", id: "2021-08-10-hwkf_def_mail_template") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + addColumn(tableName: 'hwkf_def_mail_template') { + column(name: "CONTENT_SOURCE", type: "varchar(" + 30 * weight + ")", remarks: "邮件内容来源") + } + addColumn(tableName: 'hwkf_def_mail_template') { + column(name: "CUSTOMIZE_STRUCT_TEMPLATE", type: "varchar(" + 60 * weight + ")", remarks: "自定义邮件结构模板") + } + addColumn(tableName: 'hwkf_def_mail_template') { + column(name: "REPORT_EXPORT_TYPE", type: "varchar(" + 30 * weight + ")", remarks: "报表输出类型") + } + addColumn(tableName: 'hwkf_def_mail_template') { + column(name: "REPORT_ID", type: "bigint", remarks: "关联的报表ID") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_mail_template_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_mail_template_tl.groovy index 12b9709..bc3a82c 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_mail_template_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_mail_template_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_mail_template_tl.groovy') addUniqueConstraint(columnNames: "TEMPLATE_ID,LANG", tableName: "hwkf_def_mail_template_tl", constraintName: "TEMPLATE_ID") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_model.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_model.groovy index cc6004b..b443788 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_model.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_model.groovy @@ -28,4 +28,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_model.groovy') { addUniqueConstraint(columnNames: "FLOW_ID,VERSION", tableName: "hwkf_def_model", constraintName: "hwkf_def_model_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_parameter_value.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_parameter_value.groovy index 0b60f8f..da12800 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_parameter_value.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_parameter_value.groovy @@ -42,4 +42,16 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_parameter_value.groovy') } } -} \ No newline at end of file + + changeSet(author: "hwkf@hand-china.com", id: "2021-10-18-hwkf_def_parameter_value") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_def_parameter_value') { + column(name: "BUSINESS_OBJECT_EXPR", type: "varchar(" + 240 * weight + ")", remarks: "业务对象钻取表达式") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_parameter_value_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_parameter_value_tl.groovy index e52e9d1..5dee13b 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_parameter_value_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_parameter_value_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_parameter_value_tl.groovy addUniqueConstraint(columnNames: "PARAMETER_ID,LANG", tableName: "hwkf_def_parameter_value_tl", constraintName: "hwkf_def_parameter_value_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_type.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_type.groovy index 2b848f5..31867a4 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_type.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_type.groovy @@ -34,4 +34,34 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_type.groovy') { addUniqueConstraint(columnNames: "TYPE_CODE,TENANT_ID", tableName: "hwkf_def_type", constraintName: "hwkf_def_type_u1") } -} \ No newline at end of file + + changeSet(author: "hwkf@hand-china.com", id: "2021-10-18-hwkf_def_type") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + addColumn(tableName: 'hwkf_def_type') { + column(name: "BUSINESS_OBJECT_ID", type: "bigint", remarks: "业务对象ID") + } + addColumn(tableName: 'hwkf_def_type') { + column(name: "BUSINESS_OBJECT_CODE", type: "varchar(" + 30 * weight + ")", remarks: "业务对象编码") + } + } + + changeSet(author: "hwkf@hand-china.com", id: "2022-01-06-hwkf_def_type") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + addColumn(tableName: 'hwkf_def_type') { + column(name: "SOURCE_MODE", type: "varchar(" + 30 * weight + ")", remarks: "来源方式:新建、复制、分配、导入") + } + addColumn(tableName: 'hwkf_def_type') { + column(name: "SOURCE_TYPE_ID", type: "bigint", remarks: "来源流程分类ID") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_type_role.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_type_role.groovy index 8558b50..fbafbac 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_type_role.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_type_role.groovy @@ -29,4 +29,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_type_role.groovy') { addUniqueConstraint(columnNames: "ROLE_ID,TYPE_ID", tableName: "hwkf_def_type_role", constraintName: "hwkf_def_type_role_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_type_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_type_tl.groovy index 722e35d..78da249 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_type_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_type_tl.groovy @@ -22,4 +22,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_type_tl.groovy') { addUniqueConstraint(columnNames: "TYPE_ID,LANG", tableName: "hwkf_def_type_tl", constraintName: "hwkf_def_type_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_variable.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_variable.groovy index ec6a404..d84b43f 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_variable.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_variable.groovy @@ -43,4 +43,56 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_variable.groovy') { addUniqueConstraint(columnNames: "TYPE_ID,VARIABLE_CODE", tableName: "hwkf_def_variable", constraintName: "hwkf_def_variable_u1") } -} \ No newline at end of file + + changeSet(author: "hzero@hand-china.com", id: "2021-03-31-hwkf_def_variable") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + addColumn(tableName: 'hwkf_def_variable') { + column(name: "INTERFACE_EXPRESSION", type: "varchar(" + 128 * weight + ")", remarks: "接口类型变量-取值表达式") + } + } + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-06-18-hwkf_def_variable") { + addColumn(tableName: 'hwkf_def_variable') { + column(name: "USE_SPEL_FLAG", type: "tinyint", defaultValue: "0",remarks: "是否使用表达式解析") + } + } + changeSet(author: "hzero@hand-china.com", id: "2021-09-07-hwkf_def_variable") { + addColumn(tableName: 'hwkf_def_variable') { + column(name: "FLOW_ID", type: "bigint", remarks: "hwkf_def_workflow表主键") + } + addColumn(tableName: 'hwkf_def_variable') { + column(name: "WORKFLOW_CUSTOM_FLAG", type: "tinyint", defaultValue: "0", remarks: "是否是流程自定义变量,1是/0不是") + } + dropUniqueConstraint(tableName: 'hwkf_def_variable', constraintName: 'hwkf_def_variable_u1') + addUniqueConstraint(columnNames: "TYPE_ID,VARIABLE_CODE,FLOW_ID", tableName: "hwkf_def_variable", constraintName: "hwkf_def_variable_u1") + } + changeSet(author: "hzero@hand-china.com", id: "2021-12-16-hwkf_def_variable") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + addColumn(tableName: 'hwkf_def_variable') { + column(name: "RANGE_LOV_SOURCE", type: "varchar(" + 30 * weight + ")", remarks: "数据来源类型DEFAULT/自定义,SYSTEM/已有值集") + } + } + + changeSet(author: "hzero@hand-china.com", id: "2022-01-24-hwkf_def_variable") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + addColumn(tableName: 'hwkf_def_variable') { + column(name: "BATCH_NUM", type: "varchar(" + 30 * weight + ")", remarks: "变量批量创建时的批次号") + } + } + +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_variable_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_variable_tl.groovy index 657f032..656dcf0 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_variable_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_variable_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_variable_tl.groovy') { addUniqueConstraint(columnNames: "VARIABLE_ID,LANG", tableName: "hwkf_def_variable_tl", constraintName: "hwkf_def_variable_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_workflow.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_workflow.groovy index 95b4371..6a8a6ef 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_workflow.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_workflow.groovy @@ -29,4 +29,28 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_workflow.groovy') { addUniqueConstraint(columnNames: "FLOW_CODE,TENANT_ID", tableName: "hwkf_def_workflow", constraintName: "hwkf_def_workflow_u1") } -} \ No newline at end of file + + changeSet(author: 'xiuhong.chen@hand-china.com', id: '2021-08-17-hwkf_def_workflow') { + createIndex(tableName: "hwkf_def_workflow", indexName: "hwkf_def_workflow_n1") { + column(name: "TYPE_ID") + } + } + + changeSet(author: 'hzero@hand-china.com', id: '2021-11-03-hwkf_def_workflow') { + addColumn(tableName: 'hwkf_def_workflow') { + column(name: "MSG_CONFIG_JSON", type: "longtext", remarks: "消息通知配置") + } + } + + changeSet(author: 'hzero@hand-china.com', id: '2022-02-28-hwkf_def_workflow') { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + addColumn(tableName: 'hwkf_def_workflow') { + column(name: "FORM_CODE", type: "varchar(" + 240 * weight + ")", remarks: "表单编码") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_workflow_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_workflow_tl.groovy index e0661b0..3b99726 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_def_workflow_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_def_workflow_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_def_workflow_tl.groovy') { addUniqueConstraint(columnNames: "FLOW_ID,LANG", tableName: "hwkf_def_workflow_tl", constraintName: "hwkf_def_workflow_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_notice_node.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_notice_node.groovy index 7d19def..a5a3f4a 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_notice_node.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_notice_node.groovy @@ -29,4 +29,16 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_notice_node.groovy') { addUniqueConstraint(columnNames: "TYPE_ID,NODE_CODE,TENANT_ID", tableName: "hwkf_notice_node", constraintName: "hwkf_notice_node_u1") } -} \ No newline at end of file + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-05-25-hwkf_notice_node") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_notice_node') { + column(name: "NOTICE_TYPE", type: "varchar(" + 30 * weight + ")", defaultValue: "NODE",remarks: "通知类型:EVENT通知事件、NODE通知节点") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_notice_node_line.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_notice_node_line.groovy index 0ab3e72..7d64843 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_notice_node_line.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_notice_node_line.groovy @@ -28,4 +28,14 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_notice_node_line.groovy') { addUniqueConstraint(columnNames: "NODE_ID,NOTICE_TYPE,NOTICE_TEMPLATE_CODE", tableName: "hwkf_notice_node_line", constraintName: "hwkf_notice_node_line_u1") } -} \ No newline at end of file + + changeSet(author: "like.zhang@hand-china.com", id: "2021-11-23-hwkf_notice_node_line") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + modifyDataType(tableName: "hwkf_notice_node_line", columnName: "NOTICE_TEMPLATE_CODE", newDataType:"varchar(" + 60 * weight + ")") + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_notice_node_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_notice_node_tl.groovy index 4cb9b18..8601089 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_notice_node_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_notice_node_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_notice_node_tl.groovy') { addUniqueConstraint(columnNames: "NODE_ID,LANG", tableName: "hwkf_notice_node_tl", constraintName: "hwkf_notice_node_tl_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_assignee.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_assignee.groovy new file mode 100644 index 0000000..cb53670 --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_assignee.groovy @@ -0,0 +1,43 @@ +package script.db.groovy.workflow_service + +databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_assignee.groovy') { + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-05-08-hwkf_run_assignee") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + if (helper.dbType().isSupportSequence()) { + createSequence(sequenceName: 'hwkf_run_assignee_s', startValue: "1") + } + createTable(tableName: "hwkf_run_assignee", remarks: "处理人表") { + column(name: "ASSIGNEE_ID", type: "bigint", autoIncrement: true, remarks: "表ID,主键,供其他表做外键") { constraints(primaryKey: true) } + column(name: "INSTANCE_ID", type: "bigint", remarks: "流程实例ID,hwkf_run_instance主键") { constraints(nullable: "false") } + column(name: "NODE_ID", type: "bigint", remarks: "执行节点ID,hwkf_run_node主键") + column(name: "TASK_ID", type: "bigint", remarks: "流程任务ID,hwkf_run_task主键") + column(name: "TASK_HISTORY_ID", type: "bigint", remarks: "hwkf_run_task_history主键") + column(name: "ASSIGNEE_TYPE", type: "varchar(" + 30 * weight + ")", remarks: "处理类型: SERIAL_ASSIGNEE(串行审批人)、APPOINT_NEXT_APPROVER(指定下一审批人)") { constraints(nullable: "false") } + column(name: "ASSIGNEE", type: "varchar(" + 60 * weight + ")", remarks: "处理人") { constraints(nullable: "false") } + column(name: "DIMENSION", type: "varchar(" + 30 * weight + ")", remarks: "维度:EMPLOYEE(员工) USER(用户)") { constraints(nullable: "false") } + column(name: "ORDER_NO", type: "bigint", remarks: "序号") + column(name: "NEXT_NODE_CODE", type: "varchar(" + 80 * weight + ")", remarks: "下一节点编码") + column(name: "TENANT_ID", type: "bigint", remarks: "租户ID") { constraints(nullable: "false") } + column(name: "OBJECT_VERSION_NUMBER", type: "bigint", defaultValue: "1", remarks: "行版本号,用来处理锁") { constraints(nullable: "false") } + column(name: "CREATION_DATE", type: "datetime", defaultValueComputed: "CURRENT_TIMESTAMP", remarks: "") { constraints(nullable: "false") } + column(name: "CREATED_BY", type: "bigint", defaultValue: "-1", remarks: "") { constraints(nullable: "false") } + column(name: "LAST_UPDATED_BY", type: "bigint", defaultValue: "-1", remarks: "") { constraints(nullable: "false") } + column(name: "LAST_UPDATE_DATE", type: "datetime", defaultValueComputed: "CURRENT_TIMESTAMP", remarks: "") { constraints(nullable: "false") } + + } + createIndex(tableName: "hwkf_run_assignee", indexName: "hwkf_run_assignee_N1") { + column(name: "INSTANCE_ID") + } + createIndex(tableName: "hwkf_run_assignee", indexName: "hwkf_run_assignee_N2") { + column(name: "NODE_ID") + } + createIndex(tableName: "hwkf_run_assignee", indexName: "hwkf_run_assignee_N3") { + column(name: "TASK_ID") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_assignee_his.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_assignee_his.groovy new file mode 100644 index 0000000..5dbd09f --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_assignee_his.groovy @@ -0,0 +1,43 @@ +package script.db.groovy.workflow_service + +databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_assignee_his.groovy') { + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-08-30-hwkf_run_assignee_his") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + if (helper.dbType().isSupportSequence()) { + createSequence(sequenceName: 'hwkf_run_assignee_his_s', startValue: "1") + } + createTable(tableName: "hwkf_run_assignee_his", remarks: "处理人表") { + column(name: "ASSIGNEE_ID", type: "bigint", autoIncrement: true, remarks: "表ID,主键,供其他表做外键") { constraints(primaryKey: true) } + column(name: "INSTANCE_ID", type: "bigint", remarks: "流程实例ID,hwkf_run_instance主键") { constraints(nullable: "false") } + column(name: "NODE_ID", type: "bigint", remarks: "执行节点ID,hwkf_run_node主键") + column(name: "TASK_ID", type: "bigint", remarks: "流程任务ID,hwkf_run_task主键") + column(name: "TASK_HISTORY_ID", type: "bigint", remarks: "hwkf_run_task_history主键") + column(name: "ASSIGNEE_TYPE", type: "varchar(" + 30 * weight + ")", remarks: "处理类型: SERIAL_ASSIGNEE(串行审批人)、APPOINT_NEXT_APPROVER(指定下一审批人)") { constraints(nullable: "false") } + column(name: "ASSIGNEE", type: "varchar(" + 60 * weight + ")", remarks: "处理人") { constraints(nullable: "false") } + column(name: "DIMENSION", type: "varchar(" + 30 * weight + ")", remarks: "维度:EMPLOYEE(员工) USER(用户)") { constraints(nullable: "false") } + column(name: "ORDER_NO", type: "bigint", remarks: "序号") + column(name: "NEXT_NODE_CODE", type: "varchar(" + 80 * weight + ")", remarks: "下一节点编码") + column(name: "TENANT_ID", type: "bigint", remarks: "租户ID") { constraints(nullable: "false") } + column(name: "OBJECT_VERSION_NUMBER", type: "bigint", defaultValue: "1", remarks: "行版本号,用来处理锁") { constraints(nullable: "false") } + column(name: "CREATION_DATE", type: "datetime", defaultValueComputed: "CURRENT_TIMESTAMP", remarks: "") { constraints(nullable: "false") } + column(name: "CREATED_BY", type: "bigint", defaultValue: "-1", remarks: "") { constraints(nullable: "false") } + column(name: "LAST_UPDATED_BY", type: "bigint", defaultValue: "-1", remarks: "") { constraints(nullable: "false") } + column(name: "LAST_UPDATE_DATE", type: "datetime", defaultValueComputed: "CURRENT_TIMESTAMP", remarks: "") { constraints(nullable: "false") } + + } + createIndex(tableName: "hwkf_run_assignee_his", indexName: "hwkf_run_assignee_his_N1") { + column(name: "INSTANCE_ID") + } + createIndex(tableName: "hwkf_run_assignee_his", indexName: "hwkf_run_assignee_his_N2") { + column(name: "NODE_ID") + } + createIndex(tableName: "hwkf_run_assignee_his", indexName: "hwkf_run_assignee_his_N3") { + column(name: "TASK_ID") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_assignee_his_arch.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_assignee_his_arch.groovy new file mode 100644 index 0000000..ed3960f --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_assignee_his_arch.groovy @@ -0,0 +1,43 @@ +package script.db.groovy.workflow_service + +databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_assignee_his_arch.groovy') { + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-08-30-hwkf_run_assignee_his_arch") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + if (helper.dbType().isSupportSequence()) { + createSequence(sequenceName: 'hwkf_run_assignee_his_arch_s', startValue: "1") + } + createTable(tableName: "hwkf_run_assignee_his_arch", remarks: "处理人表") { + column(name: "ASSIGNEE_ID", type: "bigint", autoIncrement: true, remarks: "表ID,主键,供其他表做外键") { constraints(primaryKey: true) } + column(name: "INSTANCE_ID", type: "bigint", remarks: "流程实例ID,hwkf_run_instance主键") { constraints(nullable: "false") } + column(name: "NODE_ID", type: "bigint", remarks: "执行节点ID,hwkf_run_node主键") + column(name: "TASK_ID", type: "bigint", remarks: "流程任务ID,hwkf_run_task主键") + column(name: "TASK_HISTORY_ID", type: "bigint", remarks: "hwkf_run_task_history主键") + column(name: "ASSIGNEE_TYPE", type: "varchar(" + 30 * weight + ")", remarks: "处理类型: SERIAL_ASSIGNEE(串行审批人)、APPOINT_NEXT_APPROVER(指定下一审批人)") { constraints(nullable: "false") } + column(name: "ASSIGNEE", type: "varchar(" + 60 * weight + ")", remarks: "处理人") { constraints(nullable: "false") } + column(name: "DIMENSION", type: "varchar(" + 30 * weight + ")", remarks: "维度:EMPLOYEE(员工) USER(用户)") { constraints(nullable: "false") } + column(name: "ORDER_NO", type: "bigint", remarks: "序号") + column(name: "NEXT_NODE_CODE", type: "varchar(" + 80 * weight + ")", remarks: "下一节点编码") + column(name: "TENANT_ID", type: "bigint", remarks: "租户ID") { constraints(nullable: "false") } + column(name: "OBJECT_VERSION_NUMBER", type: "bigint", defaultValue: "1", remarks: "行版本号,用来处理锁") { constraints(nullable: "false") } + column(name: "CREATION_DATE", type: "datetime", defaultValueComputed: "CURRENT_TIMESTAMP", remarks: "") { constraints(nullable: "false") } + column(name: "CREATED_BY", type: "bigint", defaultValue: "-1", remarks: "") { constraints(nullable: "false") } + column(name: "LAST_UPDATED_BY", type: "bigint", defaultValue: "-1", remarks: "") { constraints(nullable: "false") } + column(name: "LAST_UPDATE_DATE", type: "datetime", defaultValueComputed: "CURRENT_TIMESTAMP", remarks: "") { constraints(nullable: "false") } + + } + createIndex(tableName: "hwkf_run_assignee_his_arch", indexName: "hwkf_run_assignee_his_arch_N1") { + column(name: "INSTANCE_ID") + } + createIndex(tableName: "hwkf_run_assignee_his_arch", indexName: "hwkf_run_assignee_his_arch_N2") { + column(name: "NODE_ID") + } + createIndex(tableName: "hwkf_run_assignee_his_arch", indexName: "hwkf_run_assignee_his_arch_N3") { + column(name: "TASK_ID") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_attachment.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_attachment.groovy index d67ff9f..dd71316 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_attachment.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_attachment.groovy @@ -29,4 +29,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_attachment.groovy') { addUniqueConstraint(columnNames: "INSTANCE_ID,NODE_ID,TASK_ID", tableName: "hwkf_run_attachment", constraintName: "hwkf_run_attachment_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_attachment_arch.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_attachment_arch.groovy index a96a464..5bbf485 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_attachment_arch.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_attachment_arch.groovy @@ -31,4 +31,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_attachment_arch.groovy') addUniqueConstraint(columnNames: "INSTANCE_ID,NODE_ID,TASK_ID", tableName: "hwkf_run_attachment_arch", constraintName: "hwkf_run_attachment_arch_u2") addUniqueConstraint(columnNames: "ATTACHMENT_ID", tableName: "hwkf_run_attachment_arch", constraintName: "hwkf_run_attachment_arch_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_comment.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_comment.groovy index b89493a..f0e62a4 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_comment.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_comment.groovy @@ -37,4 +37,15 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_comment.groovy') { } } -} \ No newline at end of file + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-06-08-hwkf_run_comment") { + addColumn(tableName: 'hwkf_run_comment') { + column(name: "TASK_HISTORY_ID", type: "bigint", remarks: "流程节点历史ID,hwkf_run_task_history主键") + } + dropIndex(tableName: 'hwkf_run_comment', indexName: 'hwkf_run_comment_N1') + dropNotNullConstraint(tableName: "hwkf_run_comment", columnName: "TASK_ID", columnDataType: "bigint") + createIndex(tableName: "hwkf_run_comment", indexName: "hwkf_run_comment_N1") { + column(name: "TASK_ID") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_comment_arch.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_comment_arch.groovy new file mode 100644 index 0000000..b5fe324 --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_comment_arch.groovy @@ -0,0 +1,41 @@ +package script.db.groovy.workflow_service + +databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_comment_arch.groovy') { + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-08-30-hwkf_run_comment_arch") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + if (helper.dbType().isSupportSequence()) { + createSequence(sequenceName: 'hwkf_run_comment_arch_s', startValue: "1") + } + createTable(tableName: "hwkf_run_comment_arch", remarks: "流程任务表处理信息表") { + column(name: "COMMENT_ID", type: "bigint", autoIncrement: true, remarks: "表ID,主键,供其他表做外键") { constraints(primaryKey: true) } + column(name: "TASK_ID", type: "bigint", remarks: "流程任务ID,hwkf_run_task主键") + column(name: "INSTANCE_ID", type: "bigint", remarks: "流程实例ID,hwkf_run_instance主键") { constraints(nullable: "false") } + column(name: "NODE_ID", type: "bigint", remarks: "执行节点ID,hwkf_run_node主键") { constraints(nullable: "false") } + column(name: "TASK_HISTORY_ID", type: "bigint", remarks: "流程节点历史ID,hwkf_run_task_history主键") + column(name: "COMMENT_CONTENT", type: "varchar(" + 1000 * weight + ")", remarks: "审批意见") + column(name: "REMARK", type: "varchar(" + 1000 * weight + ")", remarks: "备注") + column(name: "TENANT_ID", type: "bigint", remarks: "租户ID") { constraints(nullable: "false") } + column(name: "OBJECT_VERSION_NUMBER", type: "bigint", defaultValue: "1", remarks: "行版本号,用来处理锁") { constraints(nullable: "false") } + column(name: "CREATION_DATE", type: "datetime", defaultValueComputed: "CURRENT_TIMESTAMP", remarks: "") { constraints(nullable: "false") } + column(name: "CREATED_BY", type: "bigint", remarks: "") + column(name: "LAST_UPDATED_BY", type: "bigint", remarks: "") + column(name: "LAST_UPDATE_DATE", type: "datetime", defaultValueComputed: "CURRENT_TIMESTAMP", remarks: "") { constraints(nullable: "false") } + } + + createIndex(tableName: "hwkf_run_comment_arch", indexName: "hwkf_run_comment_arch_N3") { + column(name: "NODE_ID") + } + createIndex(tableName: "hwkf_run_comment_arch", indexName: "hwkf_run_comment_arch_N2") { + column(name: "INSTANCE_ID") + } + createIndex(tableName: "hwkf_run_comment_arch", indexName: "hwkf_run_comment_arch_N1") { + column(name: "TASK_ID") + } + + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_comment_template.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_comment_template.groovy index a89dcef..fcbf4fe 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_comment_template.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_comment_template.groovy @@ -26,4 +26,27 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_comment_template.groovy') } -} \ No newline at end of file + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-05-08-hwkf_run_comment_template") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_run_comment_template') { + column(name: "USER_ID", type: "bigint", remarks: "用户ID") + } + dropNotNullConstraint(tableName: "hwkf_run_comment_template", columnName: "EMPLOYEE_NUM", columnDataType: "varchar(" + 30 * weight + ")") + } + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-06-18-hwkf_run_comment_template") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + modifyDataType(tableName: "hwkf_run_comment_template", columnName: "COMMENT_CONTENT", newDataType:"varchar(" + 1000 * weight + ")") + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_event_log.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_event_log.groovy new file mode 100644 index 0000000..9084a8e --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_event_log.groovy @@ -0,0 +1,55 @@ +package script.db.groovy.workflow_service +databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_event_log.groovy') { + def weight_c = 1 + if(helper.isSqlServer()){ + weight_c = 2 + } + if(helper.isOracle()){ + weight_c = 3 + } + changeSet(author: "like.zhang@hand-china.com", id: "hwkf_run_event_log-2021-09-02"){ + if(helper.dbType().isSupportSequence()){ + createSequence(sequenceName: 'hwkf_run_event_log_s', startValue:"1") + } + createTable(tableName: "hwkf_run_event_log", remarks: "工作流执行事件日志记录表") { + column(name: "EVENT_LOG_ID", type: "bigint",autoIncrement: true, remarks: "表主键") {constraints(primaryKey: true)} + column(name: "RUN_INSTANCE_ID", type: "bigint", remarks: "流程实例ID") {constraints(nullable:"false")} + column(name: "RUN_NODE_ID", type: "bigint", remarks: "运行节点ID") + column(name: "RUN_TASK_ID", type: "bigint", remarks: "运行任务ID") + column(name: "EVENT_CODE", type: "varchar(" + 60* weight_c + ")", remarks: "事件编码") {constraints(nullable:"false")} + column(name: "EVENT_TYPE", type: "varchar(" + 60* weight_c + ")", remarks: "事件类型(HWKF.EVENT_TYPE事件/服务)") {constraints(nullable:"false")} + column(name: "SYNC_FLAG", type: "tinyint", defaultValue:"0", remarks: "是否同步执行") {constraints(nullable:"false")} + column(name: "EVENT_TRIGGER", type: "varchar(" + 60* weight_c + ")", remarks: "事件触发类型(审批前/后,服务事件)") {constraints(nullable:"false")} + column(name: "EVENT_NAME", type: "varchar(" + 80* weight_c + ")", remarks: "事件名称") + column(name: "INTERFACE_CODE", type: "varchar(" + 60* weight_c + ")", remarks: "接口定义编码") + column(name: "INTERFACE_NAME", type: "varchar(" + 240* weight_c + ")", remarks: "接口定义名称") + column(name: "PERMISSION_CODE", type: "varchar(" + 128* weight_c + ")", remarks: "接口权限编码") + column(name: "METHOD", type: "varchar(" + 10* weight_c + ")", remarks: "调用方式 GET/POST/PUT/DELETE") + column(name: "INTERFACE_URL", type: "varchar(" + 1000* weight_c + ")", remarks: "接口调用地址") + column(name: "SERVICE_NAME", type: "varchar(" + 90* weight_c + ")", remarks: "接口调用服务名") + column(name: "EXECUTE_STATUS", type: "varchar(" + 10* weight_c + ")", remarks: "接口执行结果(S/E)") {constraints(nullable:"false")} + column(name: "EXECUTE_MESSAGE", type: "longtext", remarks: "接口执行结果信息") + column(name: "DEPLOYMENT_ID", type: "bigint", remarks: "流程部署ID") {constraints(nullable:"false")} + column(name: "TENANT_ID", type: "bigint", remarks: "租户ID") {constraints(nullable:"false")} + column(name: "created_by", type: "bigint", defaultValue:"-1", remarks: "创建人") {constraints(nullable:"false")} + column(name: "last_updated_by", type: "bigint", defaultValue:"-1", remarks: "最近更新人") {constraints(nullable:"false")} + column(name: "creation_date", type: "datetime", defaultValueComputed :"CURRENT_TIMESTAMP", remarks: "创建时间") {constraints(nullable:"false")} + column(name: "last_update_date", type: "datetime", defaultValueComputed :"CURRENT_TIMESTAMP", remarks: "最近更新时间") {constraints(nullable:"false")} + column(name: "object_version_number", type: "bigint", defaultValue:"1", remarks: "行版本号,用来处理锁") {constraints(nullable:"false")} + column(name: "EVENT_KEY", type: "varchar(" + 60* weight_c + ")", remarks: "事件唯一键") {constraints(nullable:"false")} + column(name: "EVENT_SORT", type: "int", remarks: "事件排序") + } + createIndex(tableName: "hwkf_run_event_log", indexName: "hwkf_run_event_log_n1") { + column(name: "EVENT_KEY") + } + createIndex(tableName: "hwkf_run_event_log", indexName: "hwkf_run_event_log_n2") { + column(name: "RUN_TASK_ID") + column(name: "RUN_NODE_ID") + column(name: "RUN_INSTANCE_ID") + } + } + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2022-03-30-hwkf_run_event_log") { + dropNotNullConstraint(tableName: 'hwkf_run_event_log', columnName: 'DEPLOYMENT_ID', columnDataType: 'bigint') + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_exception.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_exception.groovy index 3694363..b337ad9 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_exception.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_exception.groovy @@ -40,4 +40,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_exception.groovy') { changeSet(author: "like.zhang@hand-china.com", id: "2021-02-01-hwkf_run_exception") { dropNotNullConstraint(tableName: 'hwkf_run_exception', columnName: 'RUN_NODE_ID', columnDataType: 'bigint') } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_exception_arch.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_exception_arch.groovy index 36139cb..168f5c8 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_exception_arch.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_exception_arch.groovy @@ -43,4 +43,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_exception_arch.groovy') { changeSet(author: "like.zhang@hand-china.com", id: "2021-02-01-hwkf_run_exception_arch") { dropNotNullConstraint(tableName: 'hwkf_run_exception_arch', columnName: 'RUN_NODE_ID', columnDataType: 'bigint') } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_file_auth.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_file_auth.groovy new file mode 100644 index 0000000..2b50229 --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_file_auth.groovy @@ -0,0 +1,53 @@ +package script.db.groovy.workflow_service +databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_file_auth.groovy') { + def weight_c = 1 + if(helper.isSqlServer()){ + weight_c = 2 + } + if(helper.isOracle()){ + weight_c = 3 + } + changeSet(author: "hwkf@hand-china.com", id: "hwkf_run_file_auth-2021-12-15-version-1"){ + if(helper.dbType().isSupportSequence()){ + createSequence(sequenceName: 'hwkf_run_file_auth_s', startValue:"1") + } + createTable(tableName: "hwkf_run_file_auth", remarks: "附件权限表") { + column(name: "AUTH_ID", type: "bigint",autoIncrement: true, remarks: "") {constraints(primaryKey: true)} + column(name: "ATTACHMENT_UUID", type: "varchar(" + 50* weight_c + ")", remarks: "附件uuid") {constraints(nullable:"false")} + column(name: "FILE_ID", type: "bigint", remarks: "文件ID") {constraints(nullable:"false")} + column(name: "AUTH_TYPE", type: "varchar(" + 30* weight_c + ")", remarks: "权限类型,HWKF.FILE_AUTH_TYPE") {constraints(nullable:"false")} + column(name: "created_by", type: "bigint", defaultValue:"-1", remarks: "创建人") {constraints(nullable:"false")} + column(name: "last_updated_by", type: "bigint", defaultValue:"-1", remarks: "最近更新人") {constraints(nullable:"false")} + if(helper.isMysql()){ + column(name: "creation_date", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "创建时间") {constraints(nullable:"false")} + } + if(helper.isSqlServer()){ + column(name: "creation_date", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "创建时间") {constraints(nullable:"false")} + } + if(helper.isOracle()){ + column(name: "creation_date", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "创建时间") {constraints(nullable:"false")} + } + if(helper.isPostgresql()){ + column(name: "creation_date", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "创建时间") {constraints(nullable:"false")} + } + if(helper.isMysql()){ + column(name: "last_update_date", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "最近更新时间") {constraints(nullable:"false")} + } + if(helper.isSqlServer()){ + column(name: "last_update_date", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "最近更新时间") {constraints(nullable:"false")} + } + if(helper.isOracle()){ + column(name: "last_update_date", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "最近更新时间") {constraints(nullable:"false")} + } + if(helper.isPostgresql()){ + column(name: "last_update_date", type: "datetime", defaultValueComputed:"CURRENT_TIMESTAMP", remarks: "最近更新时间") {constraints(nullable:"false")} + } + column(name: "object_version_number", type: "bigint", defaultValue:"1", remarks: "行版本号,用来处理锁") {constraints(nullable:"false")} + column(name: "tenant_id", type: "bigint", defaultValue:"0", remarks: "租户ID") {constraints(nullable:"false")} + } + createIndex(tableName: "hwkf_run_file_auth", indexName: "hwkf_run_file_auth_n1") { + column(name: "ATTACHMENT_UUID") + } + addUniqueConstraint(columnNames:"FILE_ID",tableName:"hwkf_run_file_auth",constraintName: "hwkf_run_file_auth_u1") + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_instance.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_instance.groovy index 8ced1c0..4afdddd 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_instance.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_instance.groovy @@ -45,4 +45,47 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_instance.groovy') { } } -} \ No newline at end of file + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-05-08-hwkf_run_instance") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_run_instance') { + column(name: "APPROVE_RESULT", type: "varchar(" + 30 * weight + ")", remarks: "审批结果") + } + addColumn(tableName: 'hwkf_run_instance') { + column(name: "DIMENSION", type: "varchar(" + 30 * weight + ")", remarks: "维度:EMPLOYEE(员工) USER(用户)") + } + } + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-06-18-hwkf_run_instance") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_run_instance') { + column(name: "ATTACHMENT_UUID", type: "varchar(" + 50 * weight + ")", remarks: "附件集UUID") + } + } + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-09-02-hwkf_run_instance") { + dropIndex(tableName: 'hwkf_run_instance', indexName: 'hwkf_run_instance_N1') + createIndex(tableName: "hwkf_run_instance", indexName: "hwkf_run_instance_N1") { + column(name: "TENANT_ID") + } + createIndex(tableName: "hwkf_run_instance", indexName: "hwkf_run_instance_n4") { + column(name: "STATUS") + } + } + changeSet(author: "hzero@hand-china.com", id: "2021-10-15-hwkf_run_instance-1") { + createIndex(tableName: "hwkf_run_instance", indexName: "hwkf_run_instance_n5") { + column(name: "TENANT_ID") + column(name: "PARENT_INSTANCE_ID") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_instance_arch.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_instance_arch.groovy index 2e0ca59..12d5905 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_instance_arch.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_instance_arch.groovy @@ -46,4 +46,31 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_instance_arch.groovy') { addUniqueConstraint(columnNames: "INSTANCE_ID", tableName: "hwkf_run_instance_arch", constraintName: "hwkf_run_instance_arch_u1") } -} \ No newline at end of file + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-05-08-hwkf_run_instance_arch") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_run_instance_arch') { + column(name: "APPROVE_RESULT", type: "varchar(" + 30 * weight + ")", remarks: "审批结果") + } + addColumn(tableName: 'hwkf_run_instance_arch') { + column(name: "DIMENSION", type: "varchar(" + 30 * weight + ")", remarks: "维度:EMPLOYEE(员工) USER(用户)") + } + } + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-06-18-hwkf_run_instance_arch") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_run_instance_arch') { + column(name: "ATTACHMENT_UUID", type: "varchar(" + 50 * weight + ")", remarks: "附件集UUID") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_mail_approve_his.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_mail_approve_his.groovy index b08de37..eea8679 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_mail_approve_his.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_mail_approve_his.groovy @@ -34,4 +34,14 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_mail_approve_his.groovy') } -} \ No newline at end of file + + changeSet(author: "like.zhang@hand-china.com", id: "2021-10-08-hwkf_run_mail_approve_his") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + modifyDataType(tableName: "hwkf_run_mail_approve_his", columnName: "FROM_MAIL_ACCOUNT", newDataType:"varchar(" + 128 * weight + ")") + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_node.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_node.groovy index f44658b..183d5fb 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_node.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_node.groovy @@ -44,4 +44,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_node.groovy') { } } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_node_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_node_tl.groovy index 4adca53..8ed0dc3 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_node_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_node_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_node_tl.groovy') { addUniqueConstraint(columnNames: "NODE_ID,LANG", tableName: "hwkf_run_node_tl", constraintName: "hwkf_run_node_tl_ul") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task.groovy index fdca2f7..6e5f690 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task.groovy @@ -41,4 +41,43 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_task.groovy') { } } -} \ No newline at end of file + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-05-08-hwkf_run_task") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_run_task') { + column(name: "DIMENSION", type: "varchar(" + 30 * weight + ")", remarks: "维度:EMPLOYEE(员工) USER(用户)") + } + } + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-08-30-hwkf_run_task") { + addColumn(tableName: 'hwkf_run_task') { + column(name: "EXPIRATION_FLAG", type: "tinyint", defaultValue: "0", remarks: "超时标志") + } + addColumn(tableName: 'hwkf_run_task') { + column(name: "END_DATE", type: "datetime", remarks: "应完成日期") + } + + createIndex(tableName: "hwkf_run_task", indexName: "hwkf_run_task_n2") { + column(name: "ASSIGNEE") + column(name: "DIMENSION") + } + createIndex(tableName: "hwkf_run_task", indexName: "hwkf_run_task_n3") { + column(name: "SUSPEND_FLAG") + } + + + } + changeSet(author: "hzero@hand-china.com", id: "2021-10-15-hwkf_run_task-1") { + createIndex(tableName: "hwkf_run_task", indexName: "hwkf_run_task_N4") { + column(name: "NODE_ID") + } + createIndex(tableName: "hwkf_run_task", indexName: "hwkf_run_task_N5") { + column(name: "START_DATE") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_hist_arch.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_hist_arch.groovy index 9d7bc6e..b0e2a1d 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_hist_arch.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_hist_arch.groovy @@ -57,4 +57,25 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_task_hist_arch.groovy') { addUniqueConstraint(columnNames: "TASK_HISTORY_ID", tableName: "hwkf_run_task_hist_arch", constraintName: "hwkf_run_task_hist_arch_u1") } -} \ No newline at end of file + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-05-08-hwkf_run_task_hist_arch") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_run_task_hist_arch') { + column(name: "READ_FLAG", type: "tinyint", defaultValue: "0", remarks: "是否已读") + } + addColumn(tableName: 'hwkf_run_task_hist_arch') { + column(name: "DIMENSION", type: "varchar(" + 30 * weight + ")", remarks: "维度:EMPLOYEE(员工) USER(用户)") + } + } + + changeSet(author: "hzero@hand-china.com", id: "2021-11-09-hwkf_run_task_hist_arch") { + addColumn(tableName: 'hwkf_run_task_hist_arch') { + column(name: "SOURCE_TASK_HISTORY_ID", type: "bigint", remarks: "来源审批动作的task_history_id") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_history.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_history.groovy index d38077e..38524a7 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_history.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_history.groovy @@ -56,4 +56,46 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_task_history.groovy') { } } -} \ No newline at end of file + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-05-08-hwkf_run_task_history") { + def weight = 1 + if(helper.isSqlServer()){ + weight = 2 + } else if(helper.isOracle()){ + weight = 3 + } + addColumn(tableName: 'hwkf_run_task_history') { + column(name: "READ_FLAG", type: "tinyint", defaultValue: "0", remarks: "是否已读") + } + addColumn(tableName: 'hwkf_run_task_history') { + column(name: "DIMENSION", type: "varchar(" + 30 * weight + ")", remarks: "维度:EMPLOYEE(员工) USER(用户)") + } + } + + changeSet(author: "hzero@hand-china.com", id: "2021-10-15-hwkf_run_task_history-1") { + createIndex(tableName: "hwkf_run_task_history", indexName: "hwkf_run_task_history_N4") { + column(name: "NODE_TYPE") + column(name: "HISTORY_TYPE") + column(name: "ASSIGNEE") + column(name: "DIMENSION") + } + } + + changeSet(author: "hzero@hand-china.com", id: "2021-10-27-hwkf_run_task_history") { + createIndex(tableName: "hwkf_run_task_history", indexName: "hwkf_run_task_history_N5") { + column(name: "PARENT_NODE_ID") + } + } + + changeSet(author: "hzero@hand-china.com", id: "2021-11-09-hwkf_run_task_history") { + addColumn(tableName: 'hwkf_run_task_history') { + column(name: "SOURCE_TASK_HISTORY_ID", type: "bigint", remarks: "来源审批动作的task_history_id") + } + } + + changeSet(author: "hzero@hand-china.com", id: "2022-02-18-hwkf_run_task_history") { + createIndex(tableName: "hwkf_run_task_history", indexName: "hwkf_run_task_history_N6") { + column(name: "TENANT_ID") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_history_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_history_tl.groovy index 1bba142..fdfe1ab 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_history_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_history_tl.groovy @@ -21,4 +21,16 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_task_history_tl.groovy') addUniqueConstraint(columnNames: "TASK_HISTORY_ID,LANG", tableName: "hwkf_run_task_history_tl", constraintName: "hwkf_run_task_history_tl_ul") } -} \ No newline at end of file + + changeSet(author: "like.zhang@hand-china.com", id: "2021-12-09-hwkf_run_task_history_tl") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + addColumn(tableName: 'hwkf_run_task_history_tl') { + column(name: "REMARK", type: "varchar(" + 240 * weight + ")", remarks: "备注") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_history_tl_arch.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_history_tl_arch.groovy new file mode 100644 index 0000000..ffc4db6 --- /dev/null +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_history_tl_arch.groovy @@ -0,0 +1,36 @@ +package script.db.groovy.workflow_service + +databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_task_his_tl_arch.groovy') { + changeSet(author: "xiuhong.chen@hand-china.com", id: "2021-08-30-hwkf_run_task_his_tl_arch") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + if (helper.dbType().isSupportSequence()) { + createSequence(sequenceName: 'hwkf_run_task_his_tl_arch_s', startValue: "1") + } + createTable(tableName: "hwkf_run_task_his_tl_arch", remarks: "") { + column(name: "TASK_HISTORY_ID", type: "bigint", remarks: "") { constraints(nullable: "false") } + column(name: "NODE_NAME", type: "varchar(" + 100 * weight + ")", remarks: "节点名称") + column(name: "LANG", type: "varchar(" + 30 * weight + ")", remarks: "语言") { constraints(nullable: "false") } + column(name: "TENANT_ID", type: "bigint", remarks: "租户ID") { constraints(nullable: "false") } + } + + + addUniqueConstraint(columnNames: "TASK_HISTORY_ID,LANG", tableName: "hwkf_run_task_his_tl_arch", constraintName: "hwkf_run_task_his_tl_arch_ul") + } + + changeSet(author: "xiuhong.chen@hand-china.com", id: "2022-06-09-hwkf_run_task_his_tl_arch") { + def weight = 1 + if (helper.isSqlServer()) { + weight = 2 + } else if (helper.isOracle()) { + weight = 3 + } + addColumn(tableName: 'hwkf_run_task_his_tl_arch') { + column(name: "REMARK", type: "varchar(" + 240 * weight + ")", remarks: "备注") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_tl.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_tl.groovy index 2d45c91..0f4be99 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_tl.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_task_tl.groovy @@ -21,4 +21,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_task_tl.groovy') { addUniqueConstraint(columnNames: "TASK_ID,LANG", tableName: "hwkf_run_task_tl", constraintName: "hwkf_run_task_tl_ul") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_vari_hist_arch.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_vari_hist_arch.groovy index ad05bd5..634ad37 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_vari_hist_arch.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_vari_hist_arch.groovy @@ -34,4 +34,4 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_vari_hist_arch.groovy') { addUniqueConstraint(columnNames: "VARIABLE_ID", tableName: "hwkf_run_vari_hist_arch", constraintName: "hwkf_run_vari_hist_arch_u1") } -} \ No newline at end of file +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_variable.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_variable.groovy index 985501f..a39fa7a 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_variable.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_variable.groovy @@ -38,4 +38,9 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_variable.groovy') { } } -} \ No newline at end of file + changeSet(author: "hzero@hand-china.com", id: "2022-02-18-hwkf_run_variable") { + createIndex(tableName: "hwkf_run_variable", indexName: "hwkf_run_variable_N4") { + column(name: "VARIABLE_CODE") + } + } +} diff --git a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_variable_history.groovy b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_variable_history.groovy index 02f9892..2761e43 100644 --- a/src/main/resources/script/db/groovy/workflow_service/hwkf_run_variable_history.groovy +++ b/src/main/resources/script/db/groovy/workflow_service/hwkf_run_variable_history.groovy @@ -38,4 +38,10 @@ databaseChangeLog(logicalFilePath: 'script/db/hwkf_run_variable_history.groovy') } } -} \ No newline at end of file + + changeSet(author: "hzero@hand-china.com", id: "2022-02-18-hwkf_run_variable_history") { + createIndex(tableName: "hwkf_run_variable_history", indexName: "hwkf_run_variable_history_N4") { + column(name: "VARIABLE_CODE") + } + } +} diff --git a/src/main/resources/script/db/init-data/workflow_service/hzero_message/hzero-message.xlsx b/src/main/resources/script/db/init-data/workflow_service/hzero_message/hzero-message.xlsx index 9ad46a9..2220490 100644 Binary files a/src/main/resources/script/db/init-data/workflow_service/hzero_message/hzero-message.xlsx and b/src/main/resources/script/db/init-data/workflow_service/hzero_message/hzero-message.xlsx differ diff --git a/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-menu-user-role-label.xlsx b/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-menu-user-role-label.xlsx index f5f0d10..d15299c 100644 Binary files a/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-menu-user-role-label.xlsx and b/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-menu-user-role-label.xlsx differ diff --git a/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-platform-code-rule.xlsx b/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-platform-code-rule.xlsx index b5f7b48..16f85e4 100644 Binary files a/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-platform-code-rule.xlsx and b/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-platform-code-rule.xlsx differ diff --git a/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-platform-lov.xlsx b/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-platform-lov.xlsx index e467830..d096e74 100644 Binary files a/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-platform-lov.xlsx and b/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-platform-lov.xlsx differ diff --git a/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-profile.xlsx b/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-profile.xlsx new file mode 100644 index 0000000..ea02e6a Binary files /dev/null and b/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-profile.xlsx differ diff --git a/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-prompt.xlsx b/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-prompt.xlsx index e391488..953ec89 100644 Binary files a/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-prompt.xlsx and b/src/main/resources/script/db/init-data/workflow_service/hzero_platform/hzero-prompt.xlsx differ diff --git a/src/main/resources/script/db/init-data/workflow_service/workflow_service/hzero-workflow-def.xlsx b/src/main/resources/script/db/init-data/workflow_service/workflow_service/hzero-workflow-def.xlsx index fa7e561..9411b2d 100644 Binary files a/src/main/resources/script/db/init-data/workflow_service/workflow_service/hzero-workflow-def.xlsx and b/src/main/resources/script/db/init-data/workflow_service/workflow_service/hzero-workflow-def.xlsx differ