作者 yangfu

fix: 打卡工时修改,设备采集时间使用服务器当前时间

... ... @@ -100,7 +100,7 @@ func (productAttendanceRecord *ProductAttendanceRecord) SetProductTimeByProductC
return nil
}
newNow := now.BeginningOfDay().Add(-time.Hour * 24)
if overDay && productCalendar.MatchCalendarSelected(newNow) {
if overDay { //&& productCalendar.MatchCalendarSelected(newNow)
productAttendanceRecord.ProductDate = newNow
}
return nil
... ... @@ -181,9 +181,10 @@ func (productAttendanceRecord *ProductAttendanceRecord) AttendanceBreakTime(prod
)
checkSignIn = v.GetCheckBeginTime(signIn)
checkSignOut = v.GetCheckEndTime(signIn)
if xtime.BeforeEqual(signIn, checkSignIn) && xtime.AfterEqual(signOut, checkSignOut) {
if xtime.BeforeEqual(signIn.Local(), checkSignIn) && xtime.AfterEqual(signOut.Local(), checkSignOut) {
bt += v.BreakTime
}
//log.Logger.Debug(fmt.Sprintf("range(%v,%v) actual(%v,%v)",checkSignIn,checkSignOut,signIn.Local(),signOut.Local()))
}
productAttendanceRecord.Ext.AttendanceExt.BreakTime = bt
return bt
... ...
... ... @@ -34,16 +34,16 @@ func (period *ProductCalendarBreakTimePeriod) CheckOverDay() (bool, error) {
func (period *ProductCalendarBreakTimePeriod) GetCheckBeginTime(t time.Time) time.Time {
y, m, d := t.Date()
inHour, _ := strconv.Atoi(strings.Split(period.BeginAt, ":")[0])
inMinuter, _ := strconv.Atoi(strings.Split(period.BeginAt, ":")[1])
return time.Date(y, m, d, inHour, inMinuter, 0, 0, t.Location())
inHour, _ := strconv.ParseInt(strings.Split(period.BeginAt, ":")[0], 10, 64)
inMinuter, _ := strconv.ParseInt(strings.Split(period.BeginAt, ":")[1], 10, 64)
return time.Date(y, m, d, int(inHour), int(inMinuter), 0, 0, time.Local)
}
func (period *ProductCalendarBreakTimePeriod) GetCheckEndTime(t time.Time) time.Time {
y, m, d := t.Date()
inHour, _ := strconv.Atoi(strings.Split(period.EndAt, ":")[0])
inMinuter, _ := strconv.Atoi(strings.Split(period.EndAt, ":")[1])
checkTime := time.Date(y, m, d, inHour, inMinuter, 0, 0, t.Location())
inHour, _ := strconv.ParseInt(strings.Split(period.EndAt, ":")[0], 10, 64)
inMinuter, _ := strconv.ParseInt(strings.Split(period.EndAt, ":")[1], 10, 64)
checkTime := time.Date(y, m, d, int(inHour), int(inMinuter), 0, 0, time.Local)
if overDay, err := period.CheckOverDay(); overDay && err == nil {
return checkTime.AddDate(0, 0, 1)
}
... ...