enterprise/common/model/approval_payment.go

48 lines
1.1 KiB
Go

package model
import (
"github.com/smbrave/goutil"
"github.com/spf13/cast"
"gitlab.batiao8.com/open/gosdk/qyweixin"
"strings"
"time"
)
type ApprovalPayment struct {
Id int64
Username string
Month string
SpNo string
ApplyTime string
CreateTime int64
UpdateTime int64
PaymentType string
PaymentDate string
PaymentAmount float64
PaymentRemark string
PaymentPayer string
PaymentPayee string
}
func (a *ApprovalPayment) From(d *qyweixin.ApproveDetail) {
a.SpNo = d.SpNo
a.Username = d.GetUserid()
a.ApplyTime = goutil.TimeToDateTime(d.ApplyTime)
paymentTime := cast.ToInt64(d.GetValue("付款日期"))
a.Month = time.Unix(paymentTime, 0).Format("200601")
a.PaymentType = d.GetValue("付款类型")
a.PaymentPayer = d.GetValue("付款主体")
a.PaymentDate = goutil.TimeToDateTime(paymentTime)
a.PaymentAmount = cast.ToFloat64(d.GetValue("付款金额"))
a.PaymentRemark = d.GetValue("备注说明")
account := d.GetValue("收款账户")
accountFields := strings.Split(account, ",")
if len(accountFields) >= 3 {
a.PaymentPayee = accountFields[1]
}
}