workerhour
This commit is contained in:
parent
2ca063b072
commit
ca7c87bb6d
|
@ -38,7 +38,7 @@ func (vacation *ApprovalVacation) From(d *qyweixin.ApproveDetail) {
|
||||||
vacation.VacationDate = goutil.TimeToDate(dTime)
|
vacation.VacationDate = goutil.TimeToDate(dTime)
|
||||||
vacation.VacationStartTime = goutil.TimeToDateTime(cast.ToInt64(fields[1]))
|
vacation.VacationStartTime = goutil.TimeToDateTime(cast.ToInt64(fields[1]))
|
||||||
vacation.VacationEndTime = goutil.TimeToDateTime(cast.ToInt64(fields[2]))
|
vacation.VacationEndTime = goutil.TimeToDateTime(cast.ToInt64(fields[2]))
|
||||||
vacation.VacationDuration = float64(cast.ToInt64(fields[3])) / float64(3600*8)
|
vacation.VacationDuration = float64(cast.ToInt64(fields[3]))
|
||||||
vacation.VacationRemark = d.GetValue("请假事由")
|
vacation.VacationRemark = d.GetValue("请假事由")
|
||||||
vacation.Month = time.Unix(dTime, 0).Format("200601")
|
vacation.Month = time.Unix(dTime, 0).Format("200601")
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ type CorpConfig struct {
|
||||||
|
|
||||||
SocialDeduct string `json:"social_deduct"`
|
SocialDeduct string `json:"social_deduct"`
|
||||||
HouseDeduct string `json:"house_deduct"`
|
HouseDeduct string `json:"house_deduct"`
|
||||||
|
WorkerHouer string `json:"worker_houer"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Corp struct {
|
type Corp struct {
|
||||||
|
|
|
@ -136,6 +136,7 @@ func (a *Approve) handleVacation(detail *qyweixin.ApproveDetail, spStatus int) {
|
||||||
newData := new(model.ApprovalVacation)
|
newData := new(model.ApprovalVacation)
|
||||||
newData.From(detail)
|
newData.From(detail)
|
||||||
newData.CorpId = a.corp.Id
|
newData.CorpId = a.corp.Id
|
||||||
|
newData.VacationDuration = newData.VacationDuration / cast.ToFloat64(a.corp.GetConfig().WorkerHouer)
|
||||||
dbDao := dao.NewApprovalVacationDao()
|
dbDao := dao.NewApprovalVacationDao()
|
||||||
|
|
||||||
old, err := dbDao.GetBySpNo(a.corp.Id, detail.SpNo)
|
old, err := dbDao.GetBySpNo(a.corp.Id, detail.SpNo)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"enterprise/common/model"
|
"enterprise/common/model"
|
||||||
"git.u8t.cn/open/gosdk/qyweixin"
|
"git.u8t.cn/open/gosdk/qyweixin"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"github.com/spf13/cast"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -138,6 +139,8 @@ func (s *Approval) saveVacation(detail *qyweixin.ApproveDetail) {
|
||||||
dbDao := dao.NewApprovalVacationDao()
|
dbDao := dao.NewApprovalVacationDao()
|
||||||
newData := new(model.ApprovalVacation)
|
newData := new(model.ApprovalVacation)
|
||||||
newData.From(detail)
|
newData.From(detail)
|
||||||
|
newData.VacationDuration = newData.VacationDuration / cast.ToFloat64(s.corpConfig.WorkerHouer)
|
||||||
|
|
||||||
old, err := dbDao.GetBySpNo(s.corp.Id, detail.SpNo)
|
old, err := dbDao.GetBySpNo(s.corp.Id, detail.SpNo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("db error :%s", err.Error())
|
log.Errorf("db error :%s", err.Error())
|
||||||
|
|
Loading…
Reference in New Issue