approvalVacation

This commit is contained in:
jiangyong 2024-10-03 11:28:55 +08:00
parent 881eea41a9
commit 745b87acba
2 changed files with 26 additions and 0 deletions

View File

@ -81,3 +81,21 @@ func (d *ApprovalVacationDao) GetByUsername(username, month, day string) ([]*mod
}
return u, nil
}
func (d *ApprovalVacationDao) GetByUsernameDay(username, day string) (*model.ApprovalVacation, error) {
var u model.ApprovalVacation
tx := GetDB().Table(d.TableName())
tx = tx.Where("vacation_date = ?", day)
tx = tx.Where("username = ?", username)
res := tx.First(&u)
if res.Error == gorm.ErrRecordNotFound {
return nil, nil
}
if res.Error != nil {
return nil, res.Error
}
return &u, nil
}

View File

@ -314,6 +314,8 @@ func (s *Staff) getRealWorkDay(entryDate, username, month string) float64 {
realWorkdays += 1
continue
}
//有补卡申请就直接算出勤
approvalCheckin, _ := dao.NewApprovalCheckinDao().GetByUsernameDay(username, checkin.Day)
if approvalCheckin != nil {
realWorkdays += 1
@ -321,6 +323,12 @@ func (s *Staff) getRealWorkDay(entryDate, username, month string) float64 {
continue
}
//有请假申请的不算出勤
approvalVacation, _ := dao.NewApprovalVacationDao().GetByUsernameDay(username, checkin.Day)
if approvalVacation != nil {
continue
}
//入职当天考勤异常忽略
if checkin.Day == entryDate {
realWorkdays += 1