approvalVacation
This commit is contained in:
parent
881eea41a9
commit
745b87acba
|
@ -81,3 +81,21 @@ func (d *ApprovalVacationDao) GetByUsername(username, month, day string) ([]*mod
|
||||||
}
|
}
|
||||||
return u, nil
|
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
|
||||||
|
}
|
||||||
|
|
|
@ -314,6 +314,8 @@ func (s *Staff) getRealWorkDay(entryDate, username, month string) float64 {
|
||||||
realWorkdays += 1
|
realWorkdays += 1
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//有补卡申请就直接算出勤
|
||||||
approvalCheckin, _ := dao.NewApprovalCheckinDao().GetByUsernameDay(username, checkin.Day)
|
approvalCheckin, _ := dao.NewApprovalCheckinDao().GetByUsernameDay(username, checkin.Day)
|
||||||
if approvalCheckin != nil {
|
if approvalCheckin != nil {
|
||||||
realWorkdays += 1
|
realWorkdays += 1
|
||||||
|
@ -321,6 +323,12 @@ func (s *Staff) getRealWorkDay(entryDate, username, month string) float64 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//有请假申请的不算出勤
|
||||||
|
approvalVacation, _ := dao.NewApprovalVacationDao().GetByUsernameDay(username, checkin.Day)
|
||||||
|
if approvalVacation != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
//入职当天考勤异常忽略
|
//入职当天考勤异常忽略
|
||||||
if checkin.Day == entryDate {
|
if checkin.Day == entryDate {
|
||||||
realWorkdays += 1
|
realWorkdays += 1
|
||||||
|
|
Loading…
Reference in New Issue