Browse Source

ddl 语句保存

tags/24080901
PoffyZhang 1 year ago
parent
commit
472e83d3d7
5 changed files with 78 additions and 12 deletions
  1. +28
    -0
      pgsql/nd_wlfow_org_models.sql
  2. +28
    -0
      pgsql/nd_wlfow_org_models_historys.sql
  3. +3
    -0
      pgsql/wflow_model_historys.sql
  4. +8
    -5
      pgsql/wflow_models.sql
  5. +11
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java

+ 28
- 0
pgsql/nd_wlfow_org_models.sql View File

@@ -0,0 +1,28 @@
DROP TABLE IF EXISTS nd_wflow_org_models;
CREATE TABLE nd_wflow_org_models (
process_def_id varchar(40),
process_def_name varchar(255),
deploy_id varchar(255),
version int4 NOT NULL DEFAULT 1,
org_code varchar(50),
org_name varchar(255),
settings text,
group_id int8,
form_items text,
process text,
remark varchar(125),
sort int4 not null default 0,
is_delete BOOL not null default false,
is_stop BOOL not null default false,
created timestamp,
updated timestamp,
type varchar(125),
CONSTRAINT "nd_wflow_org_models_pri" PRIMARY KEY ("process_def_id")
);

comment on column nd_wflow_org_models.process_def_id is '流程配置id';
comment on column nd_wflow_org_models.process_def_name is '流程配置名字';
comment on column nd_wflow_org_models.version is '版本号';
comment on column nd_wflow_org_models.process is '流程内容';
comment on column nd_wflow_org_models.remark is '备注';
comment on column nd_wflow_org_models.type is '类型 DEFAULT默认 SEAL盖章 OTHER其它';

+ 28
- 0
pgsql/nd_wlfow_org_models_historys.sql View File

@@ -0,0 +1,28 @@
DROP TABLE IF EXISTS nd_wflow_org_model_historys;
CREATE TABLE nd_wflow_org_model_historys (
id bigserial,
process_def_id varchar(40),
process_def_name varchar(255),
deploy_id varchar(255),
version int4 NOT NULL DEFAULT 1,
org_code varchar(50),
org_name varchar(255),
settings text,
group_id int8,
form_items text,
process text,
remark varchar(125),
sort int4 not null default 0,
is_delete BOOL not null default false,
is_stop BOOL not null default false,
created timestamp,
updated timestamp,
type varchar(125),
CONSTRAINT "nd_wflow_org_model_historys_pri" PRIMARY KEY ("id")
);
comment on column nd_wflow_org_models.process_def_id is '流程配置id';
comment on column nd_wflow_org_models.process_def_name is '流程配置名字';
comment on column nd_wflow_org_models.version is '版本号';
comment on column nd_wflow_org_models.process is '流程内容';
comment on column nd_wflow_org_models.remark is '备注';
comment on column nd_wflow_org_models.type is '类型 DEFAULT默认 SEAL盖章 OTHER其它';

+ 3
- 0
pgsql/wflow_model_historys.sql View File

@@ -12,6 +12,9 @@ CREATE TABLE wflow_model_historys (
process json NOT NULL, process json NOT NULL,
remark varchar(255), remark varchar(255),
created timestamp NULL DEFAULT NULL, created timestamp NULL DEFAULT NULL,
region_code varchar(50),
process_type int4,
node_map text,
CONSTRAINT "wflow_model_historys_pri" PRIMARY KEY ("id") CONSTRAINT "wflow_model_historys_pri" PRIMARY KEY ("id")
) )
CREATE UNIQUE INDEX form_id_uk ON wflow_model_historys(form_id,version); CREATE UNIQUE INDEX form_id_uk ON wflow_model_historys(form_id,version);

+ 8
- 5
pgsql/wflow_models.sql View File

@@ -1,20 +1,23 @@
DROP TABLE IF EXISTS wflow_models; DROP TABLE IF EXISTS wflow_models;
CREATE TABLE wflow_models ( CREATE TABLE wflow_models (
form_id varchar(40),
form_id varchar(40),
process_def_id varchar(40), process_def_id varchar(40),
deploy_id varchar(40), deploy_id varchar(40),
version int4 NOT NULL DEFAULT 1, version int4 NOT NULL DEFAULT 1,
form_name varchar(50), form_name varchar(50),
logo json,
settings json,
logo text,
settings text,
group_id int8, group_id int8,
form_items json NOT NULL,
process json NOT NULL,
form_items text NOT NULL,
process text NOT NULL,
remark varchar(125), remark varchar(125),
sort int4 NOT NULL, sort int4 NOT NULL,
is_delete BOOL, is_delete BOOL,
is_stop BOOL, is_stop BOOL,
created timestamp, created timestamp,
updated timestamp, updated timestamp,
region_code varchar(50),
process_type int4,
node_map text,
CONSTRAINT "wflow_models_pri" PRIMARY KEY ("form_id") CONSTRAINT "wflow_models_pri" PRIMARY KEY ("form_id")
) )

+ 11
- 7
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/InitProcessTask.java View File

@@ -3,12 +3,15 @@ package com.ningdatech.pmapi.scheduler.task;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.StopWatch; import cn.hutool.core.date.StopWatch;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.exception.BizException;
import com.ningdatech.pmapi.common.constant.RegionConst; import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
import com.ningdatech.pmapi.scheduler.contants.TaskContant; import com.ningdatech.pmapi.scheduler.contants.TaskContant;
import com.ningdatech.pmapi.sys.model.dto.RegionDTO;
import com.ningdatech.pmapi.sys.model.entity.Region; import com.ningdatech.pmapi.sys.model.entity.Region;
import com.ningdatech.pmapi.sys.service.IRegionService; import com.ningdatech.pmapi.sys.service.IRegionService;
import com.wflow.bean.dto.WflowModelHistorysDto; import com.wflow.bean.dto.WflowModelHistorysDto;
@@ -45,16 +48,16 @@ public class InitProcessTask {


private final WflowFormsService formsService; private final WflowFormsService formsService;


@Scheduled(cron = "0 22 17 30 1 ?")
private final RegionCacheHelper regionCacheHelper;

@Scheduled(cron = "0 31 15 07 3 ?")
public void doTask() throws UnknownHostException { public void doTask() throws UnknownHostException {
if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) { if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) {
log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务开始"); log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务开始");
StopWatch stopWatch = new StopWatch(); StopWatch stopWatch = new StopWatch();
stopWatch.start(); stopWatch.start();
//1.查出丽水市下的 区县 分别去初始化 表单和流程配置数据 //1.查出丽水市下的 区县 分别去初始化 表单和流程配置数据
List<Region> regions = regionService.list(Wrappers.lambdaQuery(Region.class)
.eq(Region::getDeleted,Boolean.FALSE)
.eq(Region::getParentCode, RegionConst.RC_LS));
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_COUNTY);


if(CollUtil.isEmpty(regions)){ if(CollUtil.isEmpty(regions)){
throw new BizException("丽水地区数据为空 任务结束!"); throw new BizException("丽水地区数据为空 任务结束!");
@@ -62,7 +65,7 @@ public class InitProcessTask {


Map<String, WflowForms> formsMap = Maps.newConcurrentMap(); Map<String, WflowForms> formsMap = Maps.newConcurrentMap();
//2.首先插入表单默认配置 //2.首先插入表单默认配置
for(Region region : regions){
for(RegionDTO region : regions){
log.info("当前初始化的是 【{}】 表单信息",region.getRegionName()); log.info("当前初始化的是 【{}】 表单信息",region.getRegionName());


WflowForms existsForm = formsService.getOne(Wrappers.lambdaQuery(WflowForms.class) WflowForms existsForm = formsService.getOne(Wrappers.lambdaQuery(WflowForms.class)
@@ -90,7 +93,7 @@ public class InitProcessTask {
} }


//3.接着插入流程默认配置 //3.接着插入流程默认配置
for(Region region : regions){
for(RegionDTO region : regions){
log.info("当前初始化的是 【{}】 流程配置",region.getRegionName()); log.info("当前初始化的是 【{}】 流程配置",region.getRegionName());


if(processModelService.count(Wrappers.lambdaQuery(WflowModels.class) if(processModelService.count(Wrappers.lambdaQuery(WflowModels.class)
@@ -116,7 +119,8 @@ public class InitProcessTask {
models.setFormName(formName); models.setFormName(formName);
models.setProcessType(processType); models.setProcessType(processType);
models.setRegionCode(region.getRegionCode()); models.setRegionCode(region.getRegionCode());
ProcessNode processNode = new ProcessNode();
String process = "{\"children\":{\"children\":{},\"id\":\"node_039152532706\",\"name\":\"审批人\",\"parentId\":\"root\",\"props\":{\"mode\":\"AND\",\"role\":[],\"refuse\":{\"type\":\"TO_END\",\"target\":\"\"},\"assignedOrg\":[{\"orgName\":\"数转办\",\"orgCode\":\"GO_3bc86256687a4884ae410af00682b762\",\"type\":\"DEFAULT\",\"processDefId\":\"\"}],\"sign\":false,\"assignedType\":\"ASSIGN_ORG\",\"assignedDept\":[]},\"type\":\"SUB\"},\"id\":\"root\",\"name\":\"发起人\",\"props\":{\"formPerms\":[],\"assignedUser\":[]},\"type\":\"ROOT\"}";
ProcessNode processNode = JSON.parseObject(process,ProcessNode.class);
models.setProcess(processNode); models.setProcess(processNode);
models.setSettings("{\"sign\":false,\"admin\":[],\"notify\":{},\"commiter\":[]}"); models.setSettings("{\"sign\":false,\"admin\":[],\"notify\":{},\"commiter\":[]}");
models.setFormItems("[]"); models.setFormItems("[]");


Loading…
Cancel
Save