credit_account_estimate.go 1.2 KB
package command

import (
	"fmt"

	"github.com/beego/beego/v2/core/validation"
)

type CreditAccountEstimateCommand struct {
	// 接收方用户id
	UserId     int64 `json:"userId"`
	UserBaseId int64 `json:"userBaseId" valid:"Required"`
	CompanyId  int64 `json:"companyId"`
	OrgId      int64 `json:"orgId"`
	// 结算单号
	CreditAccountOrderNum string `json:"creditAccountOrderNum" valid:"Required"`
	// 结算金额
	SettlementAmount string `json:"settlementAmount" valid:"Required"`
	// 结算单id
	CreditAccountId int64 `json:"creditAccountId" valid:"Required"`
	// 分红预算id
	DividendsEstimateId int64 `json:"dividendsEstimateId" valid:"Required"`
	//分红预算单号
	DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
}

func (creditAccountEstimateCommand *CreditAccountEstimateCommand) Valid(validation *validation.Validation) {

}

func (creditAccountEstimateCommand *CreditAccountEstimateCommand) ValidateCommand() error {
	valid := validation.Validation{}
	b, err := valid.Valid(creditAccountEstimateCommand)
	if err != nil {
		return err
	}
	if !b {
		for _, validErr := range valid.Errors {
			return fmt.Errorf("%s  %s", validErr.Key, validErr.Message)
		}
	}
	return nil
}