2023-08-13 21:24:54 +08:00
|
|
|
package model
|
|
|
|
|
2024-01-22 23:06:30 +08:00
|
|
|
import (
|
|
|
|
"github.com/smbrave/goutil"
|
|
|
|
"github.com/spf13/cast"
|
|
|
|
"gitlab.batiao8.com/open/gosdk/qyweixin"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2023-08-13 21:24:54 +08:00
|
|
|
var (
|
|
|
|
ApprovalRefundStatusCreated = 1
|
|
|
|
ApprovalRefundStatusPayed = 2
|
2024-01-07 22:54:33 +08:00
|
|
|
ApprovalTypeRefund = "refund"
|
|
|
|
ApprovalTypeCheckin = "checkin"
|
|
|
|
ApprovalTypeVacation = "vacation"
|
2024-01-07 23:23:37 +08:00
|
|
|
|
|
|
|
ApprovalTpIdCheckin = "C4UCJS891Afmu1rE1Ws6cvph7YHqebWtt7KRFqh8c"
|
|
|
|
ApprovalTpIdRefund = "C4UE6NT3ZE7XzER9TBk2ynHEeqA11NE2GGCuBq5yH"
|
|
|
|
ApprovalTpIdVacation = "3WLJF6naF5jhnXvwisuPmE85wVMYcy1S1ZvYibkw"
|
2024-03-09 20:09:51 +08:00
|
|
|
ApprovalTpIdPayment = "C4WqcQBRQZoB5d15uKtjwuG6k32mc7ykJYuLF1ois"
|
2023-08-13 21:24:54 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
type ApprovalRefund struct {
|
|
|
|
Id int64
|
|
|
|
Username string
|
2024-01-07 22:54:33 +08:00
|
|
|
Month string
|
2023-08-13 21:24:54 +08:00
|
|
|
SpNo string
|
|
|
|
RefundType string
|
|
|
|
RefundDate string
|
|
|
|
RefundAmount float64
|
|
|
|
RefundRemark string
|
2024-01-07 18:53:21 +08:00
|
|
|
ApplyTime string
|
2023-08-13 21:24:54 +08:00
|
|
|
Status int
|
|
|
|
CreateTime int64
|
|
|
|
UpdateTime int64
|
|
|
|
}
|
2024-01-22 23:06:30 +08:00
|
|
|
|
|
|
|
func (refund *ApprovalRefund) From(d *qyweixin.ApproveDetail) {
|
|
|
|
refund.SpNo = d.SpNo
|
|
|
|
refund.Username = d.GetUserid()
|
|
|
|
refund.ApplyTime = goutil.TimeToDateTime(d.ApplyTime)
|
|
|
|
refund.Status = ApprovalRefundStatusCreated
|
|
|
|
refund.RefundType = d.GetValue("报销类型")
|
|
|
|
refundTime := cast.ToInt64(d.GetValue("发生时间"))
|
|
|
|
refund.Month = time.Unix(refundTime, 0).Format("200601")
|
|
|
|
refund.RefundDate = goutil.TimeToDateTime(refundTime)
|
|
|
|
refund.RefundAmount = cast.ToFloat64(d.GetValue("报销费用"))
|
|
|
|
refund.RefundRemark = d.GetValue("报销说明")
|
|
|
|
}
|