From 6a34ba0fcf140a6a886084a36c8fa56b4be2a7a1 Mon Sep 17 00:00:00 2001 From: kanade Date: Mon, 8 Jun 2026 17:26:25 +0800 Subject: [PATCH] =?UTF-8?q?refactor(audit):=20=E6=9B=B4=E6=96=B0=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E5=8F=82=E6=95=B0=E7=BB=93=E6=9E=84=E5=B9=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=B7=A5=E4=BD=9C=E6=B5=81=E8=A7=92=E8=89=B2=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将多个模块中的审核参数从 AuditStaffIds 改为 AuditItems 结构 - 添加对审核角色 ID 的支持 - 新增 bean.AuditItem 结构体定义 - 更新客户端发现逻辑以支持本地开发环境 - 在工作流节点中添加角色 ID 字段 - 调整导入包顺序并优化代码结构 --- client/client.go | 16 +++++++++++++--- erp/accounting/audit.go | 8 +++++--- erp/bean/workflow.go | 6 ++++++ erp/expense/audit.go | 7 ++++--- erp/payment/audit.go | 7 ++++--- erp/purchase/audit.go | 8 +++++--- erp/request/audit.go | 7 ++++--- erp/sale/audit.go | 22 ++++++++++++---------- erp/shipment/modify/audit.go | 8 +++++--- erp/workflow.go | 6 ++++-- erp/workflow/node.go | 4 +++- oa/role.go | 4 +++- 12 files changed, 68 insertions(+), 35 deletions(-) create mode 100644 erp/bean/workflow.go diff --git a/client/client.go b/client/client.go index 8b498d4..bf97fd0 100644 --- a/client/client.go +++ b/client/client.go @@ -57,13 +57,23 @@ func GetClient(s interface{}) (*RpcClient, error) { basePath := split[0] servicePath := split[1] xClient, ok := mClient.Load(key) + log.Println(path, key) if !ok { mutex.Lock() xClient, ok = mClient.Load(key) if !ok { - d, err := consulClient.NewConsulDiscovery(basePath, servicePath, config.RpcConfig.RegistryServer, nil) - if err != nil { - return nil, errors.New("系统异常") + var d client.ServiceDiscovery + var err error + if basePath == "ik3cloud1" { + d, err = client.NewPeer2PeerDiscovery("tcp@localhost:8081", "") + if err != nil { + return nil, errors.New("系统异常") + } + } else { + d, err = consulClient.NewConsulDiscovery(basePath, servicePath, config.RpcConfig.RegistryServer, nil) + if err != nil { + return nil, errors.New("系统异常") + } } option := client.DefaultOption option.Retries = 3 diff --git a/erp/accounting/audit.go b/erp/accounting/audit.go index 6fd5f60..1a94275 100644 --- a/erp/accounting/audit.go +++ b/erp/accounting/audit.go @@ -2,15 +2,17 @@ package accounting import ( "context" + "git.kumo.work/shama/service/client" + "git.kumo.work/shama/service/erp/bean" ) type audit struct { } type ArgsAuditSubmit struct { - StaffId int64 // 操作人 - AccountingId int64 // 做账合同id - AuditStaffIds []int64 // 审核人 + StaffId int64 // 操作人 + AccountingId int64 // 做账合同id + AuditItems []bean.AuditItem // 审核 } // Submit @TITLE 提交审核 diff --git a/erp/bean/workflow.go b/erp/bean/workflow.go new file mode 100644 index 0000000..a16c095 --- /dev/null +++ b/erp/bean/workflow.go @@ -0,0 +1,6 @@ +package bean + +type AuditItem struct { + AuditStaffId int64 // 审批人id + AuditRoleId int64 // 审批角色id +} diff --git a/erp/expense/audit.go b/erp/expense/audit.go index 9e8a784..b81d353 100644 --- a/erp/expense/audit.go +++ b/erp/expense/audit.go @@ -4,14 +4,15 @@ import ( "context" "git.kumo.work/shama/service/client" + "git.kumo.work/shama/service/erp/bean" ) type audit struct { } type ArgsAuditSubmit struct { - StaffId int64 // 操作人 - ExpenseId int64 // 报销单id - AuditStaffIds []int64 // 审核人 + StaffId int64 // 操作人 + ExpenseId int64 // 报销单id + AuditItems []bean.AuditItem // 审核 } // Submit @TITLE 提交审核 diff --git a/erp/payment/audit.go b/erp/payment/audit.go index 92b9bc6..bd41020 100644 --- a/erp/payment/audit.go +++ b/erp/payment/audit.go @@ -4,14 +4,15 @@ import ( "context" "git.kumo.work/shama/service/client" + "git.kumo.work/shama/service/erp/bean" ) type audit struct { } type ArgsAuditSubmit struct { - StaffId int64 // 操作人 - PaymentId int64 // 付款单 - AuditStaffIds []int64 // 审核人 + StaffId int64 // 操作人 + PaymentId int64 // 付款单 + AuditItems []bean.AuditItem // 审核 } // Submit @TITLE 提交审核 diff --git a/erp/purchase/audit.go b/erp/purchase/audit.go index 12ea170..66c85dd 100644 --- a/erp/purchase/audit.go +++ b/erp/purchase/audit.go @@ -2,15 +2,17 @@ package purchase import ( "context" + "git.kumo.work/shama/service/client" + "git.kumo.work/shama/service/erp/bean" ) type audit struct { } type ArgsAuditSubmit struct { - StaffId int64 // 操作人 - PurchaseId int64 // 采购合同id - AuditStaffIds []int64 // 审核人 + StaffId int64 // 操作人 + PurchaseId int64 // 采购合同id + AuditItems []bean.AuditItem // 审核 } // Submit @TITLE 提交审核 diff --git a/erp/request/audit.go b/erp/request/audit.go index 106743c..a21ba91 100644 --- a/erp/request/audit.go +++ b/erp/request/audit.go @@ -4,14 +4,15 @@ import ( "context" "git.kumo.work/shama/service/client" + "git.kumo.work/shama/service/erp/bean" ) type audit struct { } type ArgsAuditSubmit struct { - StaffId int64 // 操作人 - RequestId int64 // 申请单id - AuditStaffIds []int64 // 审核人 + StaffId int64 // 操作人 + RequestId int64 // 申请单id + AuditItems []bean.AuditItem // 审核 } // Submit @TITLE 提交审核 diff --git a/erp/sale/audit.go b/erp/sale/audit.go index 649aea1..6dc5616 100644 --- a/erp/sale/audit.go +++ b/erp/sale/audit.go @@ -2,15 +2,17 @@ package sale import ( "context" + "git.kumo.work/shama/service/client" + "git.kumo.work/shama/service/erp/bean" ) type audit struct { } type ArgsAuditSubmit struct { - StaffId int64 // 操作人 - SaleId int64 // 销售合同id - AuditStaffIds []int64 // 审核人 + StaffId int64 // 操作人 + SaleId int64 // 销售合同id + AuditItems []bean.AuditItem // 审核 } // Submit @TITLE 提交审核 @@ -46,10 +48,10 @@ func (a *audit) Append(ctx context.Context, args ArgsAuditSubmit) (workflowId in } type ArgsAuditChange struct { - StaffId int64 // 操作人 - SaleId int64 // 销售合同id - AuditStaffIds []int64 // 审核人 - Products []ChangeProductItem // 产品信息 + StaffId int64 // 操作人 + SaleId int64 // 销售合同id + AuditItems []bean.AuditItem // 审核 + Products []ChangeProductItem // 产品信息 } type ChangeProductItem struct { Id int64 // 产品id @@ -67,9 +69,9 @@ func (a *audit) Change(ctx context.Context, args ArgsAuditChange) (workflowId in } type ArgsAuditBenefit struct { - StaffId int64 // 操作人 - SaleId int64 // 销售合同id - AuditStaffIds []int64 // 审核人 + StaffId int64 // 操作人 + SaleId int64 // 销售合同id + AuditItems []bean.AuditItem // 审核 ArgsBenefitEdit } diff --git a/erp/shipment/modify/audit.go b/erp/shipment/modify/audit.go index 62498f1..165a2ac 100644 --- a/erp/shipment/modify/audit.go +++ b/erp/shipment/modify/audit.go @@ -2,15 +2,17 @@ package modify import ( "context" + "git.kumo.work/shama/service/client" + "git.kumo.work/shama/service/erp/bean" ) type audit struct { } type ArgsAuditSubmit struct { - StaffId int64 // 操作人 - ModifyId int64 // 订舱修改单id - AuditStaffIds []int64 // 审核人 + StaffId int64 // 操作人 + ModifyId int64 // 订舱修改单id + AuditItems []bean.AuditItem // 审核 } // Submit @TITLE 提交审核 diff --git a/erp/workflow.go b/erp/workflow.go index 148595a..ad44996 100644 --- a/erp/workflow.go +++ b/erp/workflow.go @@ -2,10 +2,11 @@ package erp import ( "context" + "time" + "git.kumo.work/shama/service/client" workflow2 "git.kumo.work/shama/service/erp/workflow" "git.kumo.work/shama/service/lib/bean" - "time" ) type workflow struct { @@ -22,6 +23,7 @@ type WorkflowSearch struct { BusinessTypes []string Status AuditStatus AuditStaffIds []int64 // 审核人 + RoleIds []int64 } type ReplyWorkflowList struct { List []WorkflowItem @@ -69,10 +71,10 @@ type WorkflowNodeItem struct { Id int64 `json:"id"` // 审批流节点id Status AuditStatus `json:"status"` // 审批流节点状态 ReviewStaffId int64 `json:"reviewStaffId"` // 审批流节点审核人 + ReviewRoleId int64 `json:"reviewRoleId"` // 审批流节点角色id ReviewAt *time.Time `json:"reviewAt"` // 审批流节点审核时间 ReviewComments string `json:"reviewComments"` // 审批流节点审核意见 Index int64 `json:"index"` // 审批流节点顺序 - } type ArgsWorkflowInfo struct { WorkflowId int64 // 审批流id diff --git a/erp/workflow/node.go b/erp/workflow/node.go index e4e356a..631e0f6 100644 --- a/erp/workflow/node.go +++ b/erp/workflow/node.go @@ -2,9 +2,10 @@ package workflow import ( "context" + "time" + "git.kumo.work/shama/service/client" "git.kumo.work/shama/service/lib/bean" - "time" ) type node struct { @@ -48,6 +49,7 @@ type NodeItem struct { Id int64 `json:"id"` WorkflowId int64 `json:"workflowId"` ReviewStaffId int64 `json:"reviewStaffId"` + ReviewRoleId int64 `json:"reviewRoleId"` BusinessId int64 `json:"businessId"` BusinessName string `json:"businessName"` BusinessType string `json:"businessType"` diff --git a/oa/role.go b/oa/role.go index 76aa068..c4f8aad 100644 --- a/oa/role.go +++ b/oa/role.go @@ -2,9 +2,10 @@ package oa import ( "context" + "time" + "git.kumo.work/shama/service/client" "git.kumo.work/shama/service/lib/bean" - "time" ) type role struct { @@ -97,6 +98,7 @@ func (r *role) SetStaff(ctx context.Context, args ArgsRoleSetStaff) (err error) type ArgsRoleStaffs struct { Name string // 角色名称 + Id int64 // 角色id } // Staffs @TITLE 角色员工