This commit is contained in:
jiangyong 2025-03-10 00:02:15 +08:00
parent 7d1ce1d31c
commit 0055cab5c6
1 changed files with 9 additions and 17 deletions

View File

@ -9,7 +9,6 @@ import (
"github.com/smbrave/goutil" "github.com/smbrave/goutil"
"github.com/spf13/cast" "github.com/spf13/cast"
"math" "math"
"strings"
"time" "time"
) )
@ -162,24 +161,24 @@ func (s *StaffSalary) getRealWorkDay(month string) float64 {
realWorkdays += 1 realWorkdays += 1
} }
corp, _ := dao.NewCorpDao().Get(s.user.CorpId)
for _, checkin := range userCheckins { for _, checkin := range userCheckins {
//入职离职当天已经算过了 //入职离职当天已经算过了
if entryTime.Format("2006-01-02") == checkin.Day || leaveTime.Format("2006-01-02") == checkin.Day { if entryTime.Format("2006-01-02") == checkin.Day || leaveTime.Format("2006-01-02") == checkin.Day {
continue continue
} }
if checkin.Exception == "" {
realWorkdays += 1
continue
}
//有请假申请的不算出勤 //有请假申请的不算出勤
approvalVacation, _ := dao.NewApprovalVacationDao().GetByUsernameDay(s.user.CorpId, s.user.Username, checkin.Day) approvalVacation, _ := dao.NewApprovalVacationDao().GetByUsernameDay(s.user.CorpId, s.user.Username, checkin.Day)
if approvalVacation != nil { if approvalVacation != nil {
continue continue
} }
if checkin.Exception == "" {
realWorkdays += 1
continue
}
//有补卡申请就直接算出勤 //有补卡申请就直接算出勤
approvalCheckin, _ := dao.NewApprovalCheckinDao().GetByUsernameDay(s.user.CorpId, s.user.Username, checkin.Day) approvalCheckin, _ := dao.NewApprovalCheckinDao().GetByUsernameDay(s.user.CorpId, s.user.Username, checkin.Day)
if approvalCheckin != nil { if approvalCheckin != nil {
@ -188,16 +187,9 @@ func (s *StaffSalary) getRealWorkDay(month string) float64 {
continue continue
} }
// 迟到的按时间折算 //其他按工作时长结算
if strings.Contains(checkin.Exception, "上班打卡:时间异常") { duration := float64(checkin.EndTime-checkin.StartTime) / cast.ToFloat64(corp.GetConfig().WorkerHouer)
stTime := time.Unix(checkin.StartTime, 0) realWorkdays += goutil.If(duration > 1, 1, duration)
later := float64(stTime.Hour() - 8) //迟到小时数从9点算
if later > 8 {
later = 8
}
realWorkdays += (8 - later) / 8
continue
}
} }
return realWorkdays return realWorkdays
} }