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/supplier/enterprise.go

116 lines
3.2 KiB

package supplier
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
)
const (
EnterpriseAuditStatusNone = 1 // 未审核
EnterpriseAuditStatusAdopt = 2 // 通过
EnterpriseAuditStatusReject = 3 // 驳回
)
type enterprise struct {
}
type ArgsEnterpriseLists struct {
bean.Page
}
type EnterpriseSearch struct {
Name string // 企业名称
AuditStatus uint // 审核状态 1=待审核 2=通过 3=驳回
}
type ReplyEnterpriseLists struct {
Lists []EnterpriseItem `json:"lists"`
Total int64 `json:"total"`
}
type EnterpriseItem struct {
Id uint `json:"id"`
Name string `json:"name"`
CreatedAt int64 `json:"createdAt"`
AuditStatus uint `json:"auditStatus"`
AuditUserId uint `json:"auditUserId"`
AuditAt int64 `json:"auditAt"`
}
// Lists @Title 审核列表
func (e *enterprise) Lists(ctx context.Context, args ArgsEnterpriseLists) (reply ReplyEnterpriseLists, err error) {
xClient, err := client.GetClient(e)
if err != nil {
return ReplyEnterpriseLists{}, err
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
type ReplyEnterpriseInfo struct {
Id uint `json:"id"`
AuditStatus uint `json:"auditStatus"`
AuditUserId uint `json:"auditUserId"`
AuditAt int64 `json:"auditAt"`
Reason string `json:"reason"`
Name string `json:"name"`
BusinessAddress string `json:"businessAddress"`
LegalPersonName string `json:"legalPersonName"`
PayTaxes uint `json:"payTaxes"`
TaxNumber string `json:"taxNumber"`
BankName string `json:"bankName"`
BankCode string `json:"bankCode"`
BankAddress string `json:"bankAddress"`
Phone string `json:"phone"`
CreatedAt int64 `json:"createdAt"`
BusinessLicense string `json:"businessLicense"`
IdPhotoFront string `json:"idPhotoFront"`
IdPhotoBack string `json:"idPhotoBack"`
AccountPhoto string `json:"accountPhoto"`
ContactName string `json:"contactName"`
ContactEmail string `json:"contactEmail"`
ContactPhone string `json:"contactPhone"`
Position string `json:"position"`
}
// Info @Title 审核详情
func (e *enterprise) Info(ctx context.Context, enterpriseId uint) (reply ReplyEnterpriseInfo, err error) {
xClient, err := client.GetClient(e)
if err != nil {
return ReplyEnterpriseInfo{}, err
}
err = xClient.Call(ctx, "Info", enterpriseId, &reply)
return
}
type ArgsEnterpriseAdopt struct {
AuditUserId uint // 审核人id
EnterpriseId uint // 企业id
Account string // 账号
Password string // 密码
PayType uint
}
// Adopt @Title 审核通过
func (e *enterprise) Adopt(ctx context.Context, args ArgsEnterpriseAdopt) error {
xClient, err := client.GetClient(e)
if err != nil {
return err
}
reply := 0
return xClient.Call(ctx, "Adopt", args, &reply)
}
type ArgsEnterpriseReject struct {
AuditUserId uint // 审核人id
EnterpriseId uint // 企业id
Reason string // 驳回原因
}
// Reject @Title 审核驳回
func (e *enterprise) Reject(ctx context.Context, args ArgsEnterpriseReject) error {
xClient, err := client.GetClient(e)
if err != nil {
return err
}
reply := 0
return xClient.Call(ctx, "Reject", args, &reply)
}