vacationDuration6
This commit is contained in:
parent
0c43367e1e
commit
c8004cd0f1
|
@ -3,10 +3,8 @@ package main
|
|||
import (
|
||||
"enterprise/common/config"
|
||||
"enterprise/common/global"
|
||||
"enterprise/common/model"
|
||||
_ "enterprise/plugin"
|
||||
"enterprise/server"
|
||||
"enterprise/worker"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -15,8 +13,8 @@ func main() {
|
|||
config.LoadCorpConfig()
|
||||
global.InitGlobal()
|
||||
|
||||
worker.NewApproval(1000).Sync("202504", model.ApprovalTypeVacation)
|
||||
worker.NewApproval(1002).Sync("202504", model.ApprovalTypeRefund)
|
||||
//worker.NewApproval(1000).Sync("202504", model.ApprovalTypeVacation)
|
||||
//worker.NewApproval(1002).Sync("202504", model.ApprovalTypeRefund)
|
||||
if err := server.Start(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -147,6 +147,7 @@ func (a *Approve) handleVacation(detail *qyweixin.ApproveDetail, spStatus int) {
|
|||
for st := startTime; st.Format("2006-01-02") != endTime.Format("2006-01-02"); st = st.AddDate(0, 0, 1) {
|
||||
cnt += 1
|
||||
}
|
||||
|
||||
if newData.VacationDuration > float64(cnt) {
|
||||
newData.VacationDuration = float64(cnt)
|
||||
}
|
||||
|
|
|
@ -150,6 +150,17 @@ func (s *Approval) saveVacation(detail *qyweixin.ApproveDetail) {
|
|||
newData.From(detail)
|
||||
newData.VacationDuration = newData.VacationDuration / (cast.ToFloat64(s.corpConfig.WorkerHour) * float64(3600))
|
||||
|
||||
startTime, _ := time.ParseInLocation("2006-01-02 15:04:05", newData.VacationStartTime, time.Local)
|
||||
endTime, _ := time.ParseInLocation("2006-01-02 15:04:05", newData.VacationEndTime, time.Local)
|
||||
cnt := 1
|
||||
for st := startTime; st.Format("2006-01-02") != endTime.Format("2006-01-02"); st = st.AddDate(0, 0, 1) {
|
||||
cnt += 1
|
||||
}
|
||||
|
||||
if newData.VacationDuration > float64(cnt) {
|
||||
newData.VacationDuration = float64(cnt)
|
||||
}
|
||||
|
||||
old, err := dbDao.GetBySpNo(s.corp.Id, detail.SpNo)
|
||||
if err != nil {
|
||||
log.Errorf("db error :%s", err.Error())
|
||||
|
|
Loading…
Reference in New Issue