enterprise/common/model/approval_vacation.go

44 lines
1.2 KiB
Go
Raw Normal View History

2024-01-07 22:54:33 +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"
"strings"
"time"
)
2024-01-07 22:54:33 +08:00
var ()
type ApprovalVacation struct {
Id int64
Username string
Month string
SpNo string
VacationType string
VacationDate string
VacationStartTime string
VacationEndTime string
VacationDuration float64
VacationRemark string
ApplyTime string
CreateTime int64
UpdateTime int64
}
2024-01-22 23:06:30 +08:00
func (vacation *ApprovalVacation) From(d *qyweixin.ApproveDetail) {
vacation.SpNo = d.SpNo
vacation.Username = d.GetUserid()
vacation.ApplyTime = goutil.TimeToDateTime(d.ApplyTime)
fields := strings.SplitN(d.GetValue("请假类型"), ",", 4)
dTime := cast.ToInt64(fields[1])
vacation.VacationType = fields[0]
vacation.VacationDate = goutil.TimeToDate(dTime)
vacation.VacationStartTime = goutil.TimeToDateTime(cast.ToInt64(fields[1]))
vacation.VacationEndTime = goutil.TimeToDateTime(cast.ToInt64(fields[2]))
vacation.VacationDuration = float64(cast.ToInt64(fields[3])) / float64(3600*8)
vacation.VacationRemark = d.GetValue("请假事由")
vacation.Month = time.Unix(dTime, 0).Format("200601")
}