You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
service/customer/service/audit.go

230 lines
6.2 KiB

package service
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
"time"
)
const (
AuditHistoryAuditStatusNone = 1 // 待审核
AuditHistoryAuditStatusAdopt = 2 // 审核通过
AuditHistoryAuditStatusReject = 3 // 审核驳回
AuditHistoryAuditApplyTypeManage = 1 // 平台业务申请
AuditHistoryAuditApplyTypeCustomer = 2 // 客户自主申请
)
type audit struct {
}
type AuditSearch struct {
ApplyUserId uint // 申请人
Status uint // 审核状态 1=未审核 2=通过 3=驳回
Name string // 用户名称
}
type ArgsAuditLists struct {
Search AuditSearch // 筛选
Page bean.Page // 分页
}
type AuditItem struct {
Id uint `json:"id"`
ServiceId uint `json:"serviceId"`
UserId uint `json:"userId"`
UserName string `json:"userName"`
ServiceName string `json:"serviceName"`
ApplyUserId uint `json:"applyUserId"`
ApplyType uint `json:"ApplyType"`
ApplyAt int64 `json:"applyAt"`
AuditStatus uint `json:"auditStatus"`
AuditUserId uint `json:"auditUserId"`
AuditAt int64 `json:"auditAt"`
}
type ReplyAuditLists struct {
Lists []AuditItem `json:"lists"`
Total int64 `json:"total"`
}
// Lists @Title 服务审核列表
func (a *audit) Lists(ctx context.Context, args ArgsAuditLists) (reply ReplyAuditLists, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
type ArgsHistory struct {
Page bean.Page
CustomerId uint
AuditStatus uint
}
type ReplyHistoryLists struct {
Lists []HistoryItem `json:"lists"`
Total int64 `json:"total"`
AuditStatus uint `json:"auditStatus"` // 审核状态
}
type HistoryItem struct {
ServiceId uint `json:"serviceId"`
Remark string `json:"remark"`
ExpirationAt int64 `json:"expirationAt"`
ApplyAt int64 `json:"applyAt"`
AuditStatus uint `json:"auditStatus"`
}
// History @Title 服务申请记录
func (a *audit) History(ctx context.Context, args ArgsHistory) (reply ReplyHistoryLists, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "History", args, &reply)
return
}
type ArgsAuditApply struct {
ServiceId uint `json:"serviceId"` // 服务id
ApplyType uint `json:"applyType"` // 申请类型
ApplyUserId uint `json:"applyUserId"` // 申请人id
CustomerId uint `json:"customerId"` // 客户id
ExpirationAt time.Time `json:"expirationAt"` // 到期时间
Enclosure string `json:"enclosure"` // 附件
Expand any `json:"expand"` // 拓展参数
}
// Apply @Title 申请
func (a *audit) Apply(ctx context.Context, args ArgsAuditApply) error {
reply := 0
xClient, err := client.GetClient(a)
if err != nil {
return err
}
return xClient.Call(ctx, "Apply", args, &reply)
}
type ArgsAuditAdopt struct {
AuditUserId uint // 审核人id
UserServiceId uint // 客户服务id
Expand any `json:"expand"` // 拓展参数
}
// Adopt @Title 审核通过
func (a *audit) Adopt(ctx context.Context, args ArgsAuditAdopt) error {
reply := 0
xClient, err := client.GetClient(a)
if err != nil {
return err
}
return xClient.Call(ctx, "Adopt", args, &reply)
}
type ArgsAuditReject struct {
AuditUserId uint // 审核人id
UserServiceId uint // 客户服务id
Reason string // 驳回原因
}
// Reject @Title 驳回
func (a *audit) Reject(ctx context.Context, args ArgsAuditReject) error {
reply := 0
xClient, err := client.GetClient(a)
if err != nil {
return err
}
return xClient.Call(ctx, "Reject", args, &reply)
}
type ReplyAuditInfo struct {
Id uint `json:"id"`
UserName string `json:"userName"`
ApplyUserId uint `json:"applyUserId"`
ApplyAt int64 `json:"applyAt"`
ServiceId uint `json:"serviceId"`
ServiceName string `json:"serviceName"`
ExpirationAt int64 `json:"expirationAt"`
AuditStatus uint `json:"auditStatus"`
AuditAt int64 `json:"auditAt"`
Reason string `json:"reason"`
AuditUserId uint `json:"auditUserId"`
Expand any `json:"expand"`
Enclosure string `json:"enclosure"`
ApplyType uint `json:"applyType"`
}
// Info @Title 详情
func (a *audit) Info(ctx context.Context, userServiceId uint) (reply ReplyAuditInfo, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", userServiceId, &reply)
return
}
type ReplyProof struct {
Name string `json:"name"`
ChannelId uint `json:"channelId"` // 用户Id
AppKey string `json:"appKey"`
AppSecret string `json:"appSecret"`
}
// GetProof @Title 获取凭证
func (a *audit) GetProof(ctx context.Context, userServiceId uint) (reply ReplyProof, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "GetProof", userServiceId, &reply)
return
}
type ArgsRateChange struct {
UserServiceId uint // 客户服务id
ChangeUserId uint // 修改人id
NewRateId uint // 新费率id
}
// Change @Title 修改费率
func (a *audit) Change(ctx context.Context, args ArgsRateChange) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Change", args, &reply)
return
}
type ArgsRateChangeHistory struct {
UserId uint
Page bean.Page
}
type ReplyRateChangeHistory struct {
Lists []RateChangeHistoryItem `json:"lists"`
Total int64 `json:"total"`
}
type RateChangeHistoryItem struct {
Id uint `json:"id"`
UserId uint `json:"userId"` // 用户id
ChangeUserId uint `json:"changeUserId"` // 修改人
ServiceId uint `json:"serviceId"` // 服务id
OldRateId uint `json:"oldRateId"` // 老费率
NewRateId uint `json:"newRateId"` // 新费率
CreatedAt int64 `json:"createdAt"` // 调整时间
}
// RateChangeHistory @Title 服务修改记录
func (a *audit) RateChangeHistory(ctx context.Context, args ArgsRateChangeHistory) (reply ReplyRateChangeHistory, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "RateChangeHistory", args, &reply)
return
}