From 9220d69d625a63029409480a85e4da0890fa3408 Mon Sep 17 00:00:00 2001 From: PandaGoAdmin <18610165312@163.com> Date: Mon, 27 Mar 2023 08:48:45 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 34 +++++ apps/flow/entity/work_classify.go | 4 +- apps/flow/entity/work_info.go | 20 +-- apps/flow/entity/work_order.go | 22 +-- apps/flow/entity/work_order_templates.go | 2 +- apps/flow/entity/work_stage.go | 22 +-- apps/flow/entity/work_task.go | 12 +- apps/flow/entity/work_templates.go | 4 +- resource/pandax-pg.sql | 167 +++++++++++++++++++++++ 9 files changed, 244 insertions(+), 43 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b3a3e3f --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +.PHONY: all build-linux build-windows build-darwin docker-build clean + +PROJECT_NAME := pandax +PKG := github.com/yourusername/$(PROJECT_NAME) +VERSION := $(shell git describe --always --long --dirty) +BUILD_TIME := $(shell date +%FT%T%z) +LDFLAGS := -X main.version=$(VERSION) -X main.buildTime=$(BUILD_TIME) + +GOARCH ?= $(shell go env GOARCH) +GOBUILD := go build -v -ldflags '$(LDFLAGS)' +GOINSTALL := go install -v -ldflags '$(LDFLAGS)' + +DOCKER_IMAGE := yourdockerhubusername/$(PROJECT_NAME) +DOCKER_TAG := latest + +all: build + +build: build-$(shell go env GOOS) + +build-linux: + GOOS=linux GOARCH=$(GOARCH) $(GOBUILD) -o build/$(PROJECT_NAME)-linux-$(GOARCH) + +build-windows: + GOOS=windows GOARCH=$(GOARCH) $(GOBUILD) -o build/$(PROJECT_NAME)-windows-$(GOARCH).exe + +build-darwin: + GOOS=darwin GOARCH=$(GOARCH) $(GOBUILD) -o build/$(PROJECT_NAME)-darwin-$(GOARCH) + +docker-build: + docker build -t $(DOCKER_IMAGE):$(DOCKER_TAG) . + +clean: + rm -rf build/* + diff --git a/apps/flow/entity/work_classify.go b/apps/flow/entity/work_classify.go index d966c0b..0608adb 100644 --- a/apps/flow/entity/work_classify.go +++ b/apps/flow/entity/work_classify.go @@ -5,8 +5,8 @@ import "github.com/XM-GO/PandaKit/model" // FlowWorkClassify 工作流流程分类 type FlowWorkClassify struct { model.BaseAutoModel - Name string `gorm:"column:name; type: varchar(128)" json:"name"` // 分类名称 - Creator int `gorm:"column:creator; type: int(11)" json:"creator"` // 创建者 + Name string `gorm:"column:name; type: varchar(128)" json:"name"` // 分类名称 + Creator int `gorm:"column:creator; type: int" json:"creator"` // 创建者 } func (FlowWorkClassify) TableName() string { diff --git a/apps/flow/entity/work_info.go b/apps/flow/entity/work_info.go index 6a83b9a..fa35939 100644 --- a/apps/flow/entity/work_info.go +++ b/apps/flow/entity/work_info.go @@ -8,16 +8,16 @@ import ( // FlowWorkInfo 工作流信息 type FlowWorkInfo struct { model.BaseAutoModel - Name string `gorm:"column:name; type:varchar(128)" json:"name"` // 流程名称 - Icon string `gorm:"column:icon; type:varchar(128)" json:"icon" ` // 流程标签 - Structure json.RawMessage `gorm:"column:structure; type:json" json:"structure" ` // 流程结构 - Classify int `gorm:"column:classify; type:int(11)" json:"classify"` // 分类ID - Templates json.RawMessage `gorm:"column:templates; type:json" json:"templates"` // 模版 - Task json.RawMessage `gorm:"column:task; type:json" json:"task"` // 任务ID, array, 可执行多个任务,可以当成通知任务,每个节点都会去执行 - SubmitCount int `gorm:"column:submit_count; type:int(11); default:0" json:"submitCount"` // 提交统计 - Creator int `gorm:"column:creator; type:int(11)" json:"creator"` // 创建者 - Notice json.RawMessage `gorm:"column:notice; type:json" json:"notice"` // 绑定通知 - Remarks string `gorm:"column:remarks; type:varchar(1024)" json:"remarks"` // 流程备注 + Name string `gorm:"column:name; type:varchar(128)" json:"name"` // 流程名称 + Icon string `gorm:"column:icon; type:varchar(128)" json:"icon" ` // 流程标签 + Structure json.RawMessage `gorm:"column:structure; type:json" json:"structure" ` // 流程结构 + Classify int `gorm:"column:classify; type:int" json:"classify"` // 分类ID + Templates json.RawMessage `gorm:"column:templates; type:json" json:"templates"` // 模版 + Task json.RawMessage `gorm:"column:task; type:json" json:"task"` // 任务ID, array, 可执行多个任务,可以当成通知任务,每个节点都会去执行 + SubmitCount int `gorm:"column:submit_count; type:int; default:0" json:"submitCount"` // 提交统计 + Creator int `gorm:"column:creator; type:int" json:"creator"` // 创建者 + Notice json.RawMessage `gorm:"column:notice; type:json" json:"notice"` // 绑定通知 + Remarks string `gorm:"column:remarks; type:varchar(1024)" json:"remarks"` // 流程备注 } func (FlowWorkInfo) TableName() string { diff --git a/apps/flow/entity/work_order.go b/apps/flow/entity/work_order.go index bced08e..e2256e1 100644 --- a/apps/flow/entity/work_order.go +++ b/apps/flow/entity/work_order.go @@ -8,17 +8,17 @@ import ( // FlowWorkOrder 工作流工单 type FlowWorkOrder struct { model.BaseAutoModel - Title string `gorm:"column:title; type:varchar(128)" json:"title"` // 工单标题 - Priority int `gorm:"column:priority; type:int(11)" json:"priority"` // 工单优先级 1,正常 2,紧急 3,非常紧急 - Process int `gorm:"column:process; type:int(11)" json:"process"` // 流程ID - Classify int `gorm:"column:classify; type:int(11)" json:"classify"` // 分类ID - IsEnd int `gorm:"column:is_end; type:int(11); default:0" json:"is_end"` // 是否结束, 0 未结束,1 已结束 - IsDenied int `gorm:"column:is_denied; type:int(11); default:0" json:"is_denied"` // 是否被拒绝, 0 没有,1 有 - State json.RawMessage `gorm:"column:state; type:json" json:"state"` // 状态信息 - RelatedPerson json.RawMessage `gorm:"column:related_person; type:json" json:"related_person"` // 工单所有处理人 - Creator int `gorm:"column:creator; type:int(11)" json:"creator"` // 创建人 - UrgeCount int `gorm:"column:urge_count; type:int(11); default:0" json:"urge_count"` // 催办次数 - UrgeLastTime int `gorm:"column:urge_last_time; type:int(11); default:0" json:"urge_last_time"` // 上一次催促时间 + Title string `gorm:"column:title; type:varchar(128)" json:"title"` // 工单标题 + Priority int `gorm:"column:priority; type:int" json:"priority"` // 工单优先级 1,正常 2,紧急 3,非常紧急 + Process int `gorm:"column:process; type:int" json:"process"` // 流程ID + Classify int `gorm:"column:classify; type:int" json:"classify"` // 分类ID + IsEnd int `gorm:"column:is_end; type:int; default:0" json:"is_end"` // 是否结束, 0 未结束,1 已结束 + IsDenied int `gorm:"column:is_denied; type:int; default:0" json:"is_denied"` // 是否被拒绝, 0 没有,1 有 + State json.RawMessage `gorm:"column:state; type:json" json:"state"` // 状态信息 + RelatedPerson json.RawMessage `gorm:"column:related_person; type:json" json:"related_person"` // 工单所有处理人 + Creator int `gorm:"column:creator; type:int" json:"creator"` // 创建人 + UrgeCount int `gorm:"column:urge_count; type:int; default:0" json:"urge_count"` // 催办次数 + UrgeLastTime int `gorm:"column:urge_last_time; type:int; default:0" json:"urge_last_time"` // 上一次催促时间 } func (FlowWorkOrder) TableName() string { diff --git a/apps/flow/entity/work_order_templates.go b/apps/flow/entity/work_order_templates.go index 92d9f73..f4f11e7 100644 --- a/apps/flow/entity/work_order_templates.go +++ b/apps/flow/entity/work_order_templates.go @@ -8,7 +8,7 @@ import ( // FlowWorkOrderTemplate 工单绑定模版数据 type FlowWorkOrderTemplate struct { model.BaseAutoModel - WorkOrder int `gorm:"column:work_order; type: int(11)" json:"work_order"` // 工单ID + WorkOrder int `gorm:"column:work_order; type: int" json:"work_order"` // 工单ID FormStructure json.RawMessage `gorm:"column:form_structure; type: json" json:"form_structure"` // 表单结构 FormData json.RawMessage `gorm:"column:form_data; type: json" json:"form_data"` // 表单数据 } diff --git a/apps/flow/entity/work_stage.go b/apps/flow/entity/work_stage.go index 2849dac..ab11f9f 100644 --- a/apps/flow/entity/work_stage.go +++ b/apps/flow/entity/work_stage.go @@ -7,17 +7,17 @@ import ( // FlowWorkStage 工作流工序(流转历史) type FlowWorkStage struct { model.BaseAutoModel - Title string `gorm:"column:title; type: varchar(128)" json:"title"` // 工单标题 - WorkOrder int `gorm:"column:work_order; type: int(11)" json:"work_order"` // 工单ID - State string `gorm:"column:state; type: varchar(128)" json:"state"` // 工单状态 - Source string `gorm:"column:source; type: varchar(128)" json:"source"` // 源节点ID - Target string `gorm:"column:target; type: varchar(128)" json:"target"` // 目标节点ID - Stage string `gorm:"column:stage; type: varchar(128)" json:"stage"` // 流转ID - Status int `gorm:"column:status; type: int(11)" json:"status"` // 流转状态 1 同意, 0 拒绝, 2 其他 - Processor string `gorm:"column:processor; type: varchar(45)" json:"processor"` // 处理人 - ProcessorId int `gorm:"column:processor_id; type: int(11)" json:"processor_id"` // 处理人ID - CostDuration int64 `gorm:"column:cost_duration; type: int(11)" json:"cost_duration"` // 处理时长 - Remarks string `gorm:"column:remarks; type: longtext" json:"remarks"` // 备注 + Title string `gorm:"column:title; type: varchar(128)" json:"title"` // 工单标题 + WorkOrder int `gorm:"column:work_order; type: int" json:"work_order"` // 工单ID + State string `gorm:"column:state; type: varchar(128)" json:"state"` // 工单状态 + Source string `gorm:"column:source; type: varchar(128)" json:"source"` // 源节点ID + Target string `gorm:"column:target; type: varchar(128)" json:"target"` // 目标节点ID + Stage string `gorm:"column:stage; type: varchar(128)" json:"stage"` // 流转ID + Status int `gorm:"column:status; type: int" json:"status"` // 流转状态 1 同意, 0 拒绝, 2 其他 + Processor string `gorm:"column:processor; type: varchar(45)" json:"processor"` // 处理人 + ProcessorId int `gorm:"column:processor_id; type: int" json:"processor_id"` // 处理人ID + CostDuration int64 `gorm:"column:cost_duration; type: int" json:"cost_duration"` // 处理时长 + Remarks string `gorm:"column:remarks; type: text" json:"remarks"` // 备注 } func (FlowWorkStage) TableName() string { diff --git a/apps/flow/entity/work_task.go b/apps/flow/entity/work_task.go index 0fc0bb5..0439350 100644 --- a/apps/flow/entity/work_task.go +++ b/apps/flow/entity/work_task.go @@ -9,9 +9,9 @@ type FlowWorkTask struct { model.BaseAutoModel Name string `gorm:"column:name; type: varchar(256)" json:"name"` // 任务名称 TaskType string `gorm:"column:task_type; type: varchar(45)" json:"task_type"` // 任务类型 - Content string `gorm:"column:content; type: longtext" json:"content"` // 任务内容 - Creator int `gorm:"column:creator; type: int(11)" json:"creator"` // 创建者 - Remarks string `gorm:"column:remarks; type: longtext" json:"remarks"` // 备注 + Content string `gorm:"column:content; type: text" json:"content"` // 任务内容 + Creator int `gorm:"column:creator; type: int" json:"creator"` // 创建者 + Remarks string `gorm:"column:remarks; type: text" json:"remarks"` // 备注 } func (FlowWorkTask) TableName() string { @@ -21,11 +21,11 @@ func (FlowWorkTask) TableName() string { // FlowWorkTaskHistory 工作流任务执行历史 type FlowWorkTaskHistory struct { model.BaseAutoModel - Task int `gorm:"column:task; type: int(11)" json:"task"` // 任务ID + Task int `gorm:"column:task; type: int" json:"task"` // 任务ID Name string `gorm:"column:name; type: varchar(256)" json:"name"` // 任务名称 - TaskType int `gorm:"column:task_type; type: int(11)" json:"task_type"` // 任务类型, python, shell + TaskType int `gorm:"column:task_type; type: int" json:"task_type"` // 任务类型, python, shell ExecutionTime string `gorm:"column:execution_time; type: varchar(128)" json:"execution_time"` // 执行时间 - Result string `gorm:"column:result; type: longtext" json:"result"` // 任务返回 + Result string `gorm:"column:result; type: text" json:"result"` // 任务返回 } func (FlowWorkTaskHistory) TableName() string { diff --git a/apps/flow/entity/work_templates.go b/apps/flow/entity/work_templates.go index 409e3a0..34505bd 100644 --- a/apps/flow/entity/work_templates.go +++ b/apps/flow/entity/work_templates.go @@ -10,8 +10,8 @@ type FlowWorkTemplates struct { model.BaseAutoModel Name string `gorm:"column:name; type: varchar(128)" json:"name" binding:"required"` // 模板名称 FormStructure json.RawMessage `gorm:"column:form_structure; type: json" json:"form_structure" binding:"required"` // 表单结构 - Creator int `gorm:"column:creator; type: int(11)" json:"creator"` // 创建者 - Remarks string `gorm:"column:remarks; type: longtext" json:"remarks"` // 备注 + Creator int `gorm:"column:creator; type: int" json:"creator"` // 创建者 + Remarks string `gorm:"column:remarks; type: text" json:"remarks"` // 备注 } func (FlowWorkTemplates) TableName() string { diff --git a/resource/pandax-pg.sql b/resource/pandax-pg.sql index 41689d1..91b6cb4 100644 --- a/resource/pandax-pg.sql +++ b/resource/pandax-pg.sql @@ -277,6 +277,173 @@ CREATE TABLE "public"."dev_gen_tables" ( -- Records of dev_gen_tables -- ---------------------------- +DROP TABLE IF EXIST public.flow_work_classify; + +CREATE TABLE public.flow_work_classify ( + id bigserial NOT NULL, + create_time timestamptz NULL, + update_time timestamptz NULL, + delete_time timestamptz NULL, + "name" varchar(128) NULL, + creator int8 NULL, + CONSTRAINT flow_work_classify_pkey PRIMARY KEY (id) +); + + +-- public.flow_work_info definition + +-- Drop table + +DROP TABLE IF EXIST public.flow_work_info; + +CREATE TABLE public.flow_work_info ( + id bigserial NOT NULL, + create_time timestamptz NULL, + update_time timestamptz NULL, + delete_time timestamptz NULL, + "name" varchar(128) NULL, + icon varchar(128) NULL, + "structure" json NULL, + classify int8 NULL, + templates json NULL, + task json NULL, + submit_count int8 NULL DEFAULT 0, + creator int8 NULL, + "notice" json NULL, + remarks varchar(1024) NULL, + CONSTRAINT flow_work_info_pkey PRIMARY KEY (id) +); + + +-- public.flow_work_order definition + +-- Drop table + +DROP TABLE IF EXIST public.flow_work_order; + +CREATE TABLE public.flow_work_order ( + id bigserial NOT NULL, + create_time timestamptz NULL, + update_time timestamptz NULL, + delete_time timestamptz NULL, + title varchar(128) NULL, + priority int8 NULL, + process int8 NULL, + classify int8 NULL, + is_end int8 NULL DEFAULT 0, + is_denied int8 NULL DEFAULT 0, + state json NULL, + related_person json NULL, + creator int8 NULL, + urge_count int8 NULL DEFAULT 0, + urge_last_time int8 NULL DEFAULT 0, + CONSTRAINT flow_work_order_pkey PRIMARY KEY (id) +); + + +-- public.flow_work_order_templates definition + +-- Drop table + +DROP TABLE IF EXIST public.flow_work_order_templates; + +CREATE TABLE public.flow_work_order_templates ( + id bigserial NOT NULL, + create_time timestamptz NULL, + update_time timestamptz NULL, + delete_time timestamptz NULL, + work_order int8 NULL, + form_structure json NULL, + form_data json NULL, + CONSTRAINT flow_work_order_templates_pkey PRIMARY KEY (id) +); + + +-- public.flow_work_stage definition + +-- Drop table + +DROP TABLE IF EXIST public.flow_work_stage; + +CREATE TABLE public.flow_work_stage ( + id bigserial NOT NULL, + create_time timestamptz NULL, + update_time timestamptz NULL, + delete_time timestamptz NULL, + title varchar(128) NULL, + work_order int8 NULL, + state varchar(128) NULL, + "source" varchar(128) NULL, + target varchar(128) NULL, + stage varchar(128) NULL, + status int8 NULL, + processor varchar(45) NULL, + processor_id int8 NULL, + cost_duration int8 NULL, + remarks text NULL, + CONSTRAINT flow_work_stage_pkey PRIMARY KEY (id) +); + + +-- public.flow_work_task definition + +-- Drop table + +DROP TABLE IF EXIST public.flow_work_task; + +CREATE TABLE public.flow_work_task ( + id bigserial NOT NULL, + create_time timestamptz NULL, + update_time timestamptz NULL, + delete_time timestamptz NULL, + "name" varchar(256) NULL, + task_type varchar(45) NULL, + "content" text NULL, + creator int8 NULL, + remarks text NULL, + CONSTRAINT flow_work_task_pkey PRIMARY KEY (id) +); + + +-- public.flow_work_task_history definition + +-- Drop table + +DROP TABLE IF EXIST public.flow_work_task_history; + +CREATE TABLE public.flow_work_task_history ( + id bigserial NOT NULL, + create_time timestamptz NULL, + update_time timestamptz NULL, + delete_time timestamptz NULL, + task int8 NULL, + "name" text NULL, + task_type int8 NULL, + execution_time varchar(128) NULL, + "result" text NULL, + CONSTRAINT flow_work_task_history_pkey PRIMARY KEY (id) +); + + +-- public.flow_work_templates definition + +-- Drop table + +DROP TABLE IF EXIST public.flow_work_templates; + +CREATE TABLE public.flow_work_templates ( + id bigserial NOT NULL, + create_time timestamptz NULL, + update_time timestamptz NULL, + delete_time timestamptz NULL, + "name" varchar(128) NULL, + form_structure json NULL, + creator int8 NULL, + remarks text NULL, + CONSTRAINT flow_work_templates_pkey PRIMARY KEY (id) +); + + -- ---------------------------- -- Table structure for log_jobs -- Gitee From b401ba02bbb621420abbaca905b5834c1726962f Mon Sep 17 00:00:00 2001 From: PandaGoAdmin <18610165312@163.com> Date: Mon, 27 Mar 2023 16:38:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d113fc5..fa5b711 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ --- 系统在线文档 --- -* 文档地址 :http://www.pandazhuan.cn/ +* 文档地址 :http://101.35.247.125/ **> 未来会补充文档和视频,方便友友们使用!** -- Gitee