refactor(audit): 更新审核参数结构并添加工作流角色支持
- 将多个模块中的审核参数从 AuditStaffIds 改为 AuditItems 结构 - 添加对审核角色 ID 的支持 - 新增 bean.AuditItem 结构体定义 - 更新客户端发现逻辑以支持本地开发环境 - 在工作流节点中添加角色 ID 字段 - 调整导入包顺序并优化代码结构
This commit is contained in:
@@ -57,14 +57,24 @@ func GetClient(s interface{}) (*RpcClient, error) {
|
|||||||
basePath := split[0]
|
basePath := split[0]
|
||||||
servicePath := split[1]
|
servicePath := split[1]
|
||||||
xClient, ok := mClient.Load(key)
|
xClient, ok := mClient.Load(key)
|
||||||
|
log.Println(path, key)
|
||||||
if !ok {
|
if !ok {
|
||||||
mutex.Lock()
|
mutex.Lock()
|
||||||
xClient, ok = mClient.Load(key)
|
xClient, ok = mClient.Load(key)
|
||||||
if !ok {
|
if !ok {
|
||||||
d, err := consulClient.NewConsulDiscovery(basePath, servicePath, config.RpcConfig.RegistryServer, nil)
|
var d client.ServiceDiscovery
|
||||||
|
var err error
|
||||||
|
if basePath == "ik3cloud1" {
|
||||||
|
d, err = client.NewPeer2PeerDiscovery("tcp@localhost:8081", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.New("系统异常")
|
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 := client.DefaultOption
|
||||||
option.Retries = 3
|
option.Retries = 3
|
||||||
option.GenBreaker = func() client.Breaker {
|
option.GenBreaker = func() client.Breaker {
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package accounting
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
|
"git.kumo.work/shama/service/erp/bean"
|
||||||
)
|
)
|
||||||
|
|
||||||
type audit struct {
|
type audit struct {
|
||||||
@@ -10,7 +12,7 @@ type audit struct {
|
|||||||
type ArgsAuditSubmit struct {
|
type ArgsAuditSubmit struct {
|
||||||
StaffId int64 // 操作人
|
StaffId int64 // 操作人
|
||||||
AccountingId int64 // 做账合同id
|
AccountingId int64 // 做账合同id
|
||||||
AuditStaffIds []int64 // 审核人
|
AuditItems []bean.AuditItem // 审核
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit @TITLE 提交审核
|
// Submit @TITLE 提交审核
|
||||||
|
|||||||
6
erp/bean/workflow.go
Normal file
6
erp/bean/workflow.go
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package bean
|
||||||
|
|
||||||
|
type AuditItem struct {
|
||||||
|
AuditStaffId int64 // 审批人id
|
||||||
|
AuditRoleId int64 // 审批角色id
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
|
"git.kumo.work/shama/service/erp/bean"
|
||||||
)
|
)
|
||||||
|
|
||||||
type audit struct {
|
type audit struct {
|
||||||
@@ -11,7 +12,7 @@ type audit struct {
|
|||||||
type ArgsAuditSubmit struct {
|
type ArgsAuditSubmit struct {
|
||||||
StaffId int64 // 操作人
|
StaffId int64 // 操作人
|
||||||
ExpenseId int64 // 报销单id
|
ExpenseId int64 // 报销单id
|
||||||
AuditStaffIds []int64 // 审核人
|
AuditItems []bean.AuditItem // 审核
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit @TITLE 提交审核
|
// Submit @TITLE 提交审核
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
|
"git.kumo.work/shama/service/erp/bean"
|
||||||
)
|
)
|
||||||
|
|
||||||
type audit struct {
|
type audit struct {
|
||||||
@@ -11,7 +12,7 @@ type audit struct {
|
|||||||
type ArgsAuditSubmit struct {
|
type ArgsAuditSubmit struct {
|
||||||
StaffId int64 // 操作人
|
StaffId int64 // 操作人
|
||||||
PaymentId int64 // 付款单
|
PaymentId int64 // 付款单
|
||||||
AuditStaffIds []int64 // 审核人
|
AuditItems []bean.AuditItem // 审核
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit @TITLE 提交审核
|
// Submit @TITLE 提交审核
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package purchase
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
|
"git.kumo.work/shama/service/erp/bean"
|
||||||
)
|
)
|
||||||
|
|
||||||
type audit struct {
|
type audit struct {
|
||||||
@@ -10,7 +12,7 @@ type audit struct {
|
|||||||
type ArgsAuditSubmit struct {
|
type ArgsAuditSubmit struct {
|
||||||
StaffId int64 // 操作人
|
StaffId int64 // 操作人
|
||||||
PurchaseId int64 // 采购合同id
|
PurchaseId int64 // 采购合同id
|
||||||
AuditStaffIds []int64 // 审核人
|
AuditItems []bean.AuditItem // 审核
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit @TITLE 提交审核
|
// Submit @TITLE 提交审核
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
|
"git.kumo.work/shama/service/erp/bean"
|
||||||
)
|
)
|
||||||
|
|
||||||
type audit struct {
|
type audit struct {
|
||||||
@@ -11,7 +12,7 @@ type audit struct {
|
|||||||
type ArgsAuditSubmit struct {
|
type ArgsAuditSubmit struct {
|
||||||
StaffId int64 // 操作人
|
StaffId int64 // 操作人
|
||||||
RequestId int64 // 申请单id
|
RequestId int64 // 申请单id
|
||||||
AuditStaffIds []int64 // 审核人
|
AuditItems []bean.AuditItem // 审核
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit @TITLE 提交审核
|
// Submit @TITLE 提交审核
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package sale
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
|
"git.kumo.work/shama/service/erp/bean"
|
||||||
)
|
)
|
||||||
|
|
||||||
type audit struct {
|
type audit struct {
|
||||||
@@ -10,7 +12,7 @@ type audit struct {
|
|||||||
type ArgsAuditSubmit struct {
|
type ArgsAuditSubmit struct {
|
||||||
StaffId int64 // 操作人
|
StaffId int64 // 操作人
|
||||||
SaleId int64 // 销售合同id
|
SaleId int64 // 销售合同id
|
||||||
AuditStaffIds []int64 // 审核人
|
AuditItems []bean.AuditItem // 审核
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit @TITLE 提交审核
|
// Submit @TITLE 提交审核
|
||||||
@@ -48,7 +50,7 @@ func (a *audit) Append(ctx context.Context, args ArgsAuditSubmit) (workflowId in
|
|||||||
type ArgsAuditChange struct {
|
type ArgsAuditChange struct {
|
||||||
StaffId int64 // 操作人
|
StaffId int64 // 操作人
|
||||||
SaleId int64 // 销售合同id
|
SaleId int64 // 销售合同id
|
||||||
AuditStaffIds []int64 // 审核人
|
AuditItems []bean.AuditItem // 审核
|
||||||
Products []ChangeProductItem // 产品信息
|
Products []ChangeProductItem // 产品信息
|
||||||
}
|
}
|
||||||
type ChangeProductItem struct {
|
type ChangeProductItem struct {
|
||||||
@@ -69,7 +71,7 @@ func (a *audit) Change(ctx context.Context, args ArgsAuditChange) (workflowId in
|
|||||||
type ArgsAuditBenefit struct {
|
type ArgsAuditBenefit struct {
|
||||||
StaffId int64 // 操作人
|
StaffId int64 // 操作人
|
||||||
SaleId int64 // 销售合同id
|
SaleId int64 // 销售合同id
|
||||||
AuditStaffIds []int64 // 审核人
|
AuditItems []bean.AuditItem // 审核
|
||||||
ArgsBenefitEdit
|
ArgsBenefitEdit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package modify
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
|
"git.kumo.work/shama/service/erp/bean"
|
||||||
)
|
)
|
||||||
|
|
||||||
type audit struct {
|
type audit struct {
|
||||||
@@ -10,7 +12,7 @@ type audit struct {
|
|||||||
type ArgsAuditSubmit struct {
|
type ArgsAuditSubmit struct {
|
||||||
StaffId int64 // 操作人
|
StaffId int64 // 操作人
|
||||||
ModifyId int64 // 订舱修改单id
|
ModifyId int64 // 订舱修改单id
|
||||||
AuditStaffIds []int64 // 审核人
|
AuditItems []bean.AuditItem // 审核
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit @TITLE 提交审核
|
// Submit @TITLE 提交审核
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ package erp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
workflow2 "git.kumo.work/shama/service/erp/workflow"
|
workflow2 "git.kumo.work/shama/service/erp/workflow"
|
||||||
"git.kumo.work/shama/service/lib/bean"
|
"git.kumo.work/shama/service/lib/bean"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type workflow struct {
|
type workflow struct {
|
||||||
@@ -22,6 +23,7 @@ type WorkflowSearch struct {
|
|||||||
BusinessTypes []string
|
BusinessTypes []string
|
||||||
Status AuditStatus
|
Status AuditStatus
|
||||||
AuditStaffIds []int64 // 审核人
|
AuditStaffIds []int64 // 审核人
|
||||||
|
RoleIds []int64
|
||||||
}
|
}
|
||||||
type ReplyWorkflowList struct {
|
type ReplyWorkflowList struct {
|
||||||
List []WorkflowItem
|
List []WorkflowItem
|
||||||
@@ -69,10 +71,10 @@ type WorkflowNodeItem struct {
|
|||||||
Id int64 `json:"id"` // 审批流节点id
|
Id int64 `json:"id"` // 审批流节点id
|
||||||
Status AuditStatus `json:"status"` // 审批流节点状态
|
Status AuditStatus `json:"status"` // 审批流节点状态
|
||||||
ReviewStaffId int64 `json:"reviewStaffId"` // 审批流节点审核人
|
ReviewStaffId int64 `json:"reviewStaffId"` // 审批流节点审核人
|
||||||
|
ReviewRoleId int64 `json:"reviewRoleId"` // 审批流节点角色id
|
||||||
ReviewAt *time.Time `json:"reviewAt"` // 审批流节点审核时间
|
ReviewAt *time.Time `json:"reviewAt"` // 审批流节点审核时间
|
||||||
ReviewComments string `json:"reviewComments"` // 审批流节点审核意见
|
ReviewComments string `json:"reviewComments"` // 审批流节点审核意见
|
||||||
Index int64 `json:"index"` // 审批流节点顺序
|
Index int64 `json:"index"` // 审批流节点顺序
|
||||||
|
|
||||||
}
|
}
|
||||||
type ArgsWorkflowInfo struct {
|
type ArgsWorkflowInfo struct {
|
||||||
WorkflowId int64 // 审批流id
|
WorkflowId int64 // 审批流id
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package workflow
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
"git.kumo.work/shama/service/lib/bean"
|
"git.kumo.work/shama/service/lib/bean"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type node struct {
|
type node struct {
|
||||||
@@ -48,6 +49,7 @@ type NodeItem struct {
|
|||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
WorkflowId int64 `json:"workflowId"`
|
WorkflowId int64 `json:"workflowId"`
|
||||||
ReviewStaffId int64 `json:"reviewStaffId"`
|
ReviewStaffId int64 `json:"reviewStaffId"`
|
||||||
|
ReviewRoleId int64 `json:"reviewRoleId"`
|
||||||
BusinessId int64 `json:"businessId"`
|
BusinessId int64 `json:"businessId"`
|
||||||
BusinessName string `json:"businessName"`
|
BusinessName string `json:"businessName"`
|
||||||
BusinessType string `json:"businessType"`
|
BusinessType string `json:"businessType"`
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package oa
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.kumo.work/shama/service/client"
|
"git.kumo.work/shama/service/client"
|
||||||
"git.kumo.work/shama/service/lib/bean"
|
"git.kumo.work/shama/service/lib/bean"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type role struct {
|
type role struct {
|
||||||
@@ -97,6 +98,7 @@ func (r *role) SetStaff(ctx context.Context, args ArgsRoleSetStaff) (err error)
|
|||||||
|
|
||||||
type ArgsRoleStaffs struct {
|
type ArgsRoleStaffs struct {
|
||||||
Name string // 角色名称
|
Name string // 角色名称
|
||||||
|
Id int64 // 角色id
|
||||||
}
|
}
|
||||||
|
|
||||||
// Staffs @TITLE 角色员工
|
// Staffs @TITLE 角色员工
|
||||||
|
|||||||
Reference in New Issue
Block a user