作者 yangfu

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

@@ -100,7 +100,7 @@ func (productAttendanceRecord *ProductAttendanceRecord) SetProductTimeByProductC @@ -100,7 +100,7 @@ func (productAttendanceRecord *ProductAttendanceRecord) SetProductTimeByProductC
100 return nil 100 return nil
101 } 101 }
102 newNow := now.BeginningOfDay().Add(-time.Hour * 24) 102 newNow := now.BeginningOfDay().Add(-time.Hour * 24)
103 - if overDay && productCalendar.MatchCalendarSelected(newNow) { 103 + if overDay { //&& productCalendar.MatchCalendarSelected(newNow)
104 productAttendanceRecord.ProductDate = newNow 104 productAttendanceRecord.ProductDate = newNow
105 } 105 }
106 return nil 106 return nil
@@ -181,9 +181,10 @@ func (productAttendanceRecord *ProductAttendanceRecord) AttendanceBreakTime(prod @@ -181,9 +181,10 @@ func (productAttendanceRecord *ProductAttendanceRecord) AttendanceBreakTime(prod
181 ) 181 )
182 checkSignIn = v.GetCheckBeginTime(signIn) 182 checkSignIn = v.GetCheckBeginTime(signIn)
183 checkSignOut = v.GetCheckEndTime(signIn) 183 checkSignOut = v.GetCheckEndTime(signIn)
184 - if xtime.BeforeEqual(signIn, checkSignIn) && xtime.AfterEqual(signOut, checkSignOut) { 184 + if xtime.BeforeEqual(signIn.Local(), checkSignIn) && xtime.AfterEqual(signOut.Local(), checkSignOut) {
185 bt += v.BreakTime 185 bt += v.BreakTime
186 } 186 }
  187 + //log.Logger.Debug(fmt.Sprintf("range(%v,%v) actual(%v,%v)",checkSignIn,checkSignOut,signIn.Local(),signOut.Local()))
187 } 188 }
188 productAttendanceRecord.Ext.AttendanceExt.BreakTime = bt 189 productAttendanceRecord.Ext.AttendanceExt.BreakTime = bt
189 return bt 190 return bt
@@ -34,16 +34,16 @@ func (period *ProductCalendarBreakTimePeriod) CheckOverDay() (bool, error) { @@ -34,16 +34,16 @@ func (period *ProductCalendarBreakTimePeriod) CheckOverDay() (bool, error) {
34 34
35 func (period *ProductCalendarBreakTimePeriod) GetCheckBeginTime(t time.Time) time.Time { 35 func (period *ProductCalendarBreakTimePeriod) GetCheckBeginTime(t time.Time) time.Time {
36 y, m, d := t.Date() 36 y, m, d := t.Date()
37 - inHour, _ := strconv.Atoi(strings.Split(period.BeginAt, ":")[0])  
38 - inMinuter, _ := strconv.Atoi(strings.Split(period.BeginAt, ":")[1])  
39 - return time.Date(y, m, d, inHour, inMinuter, 0, 0, t.Location()) 37 + inHour, _ := strconv.ParseInt(strings.Split(period.BeginAt, ":")[0], 10, 64)
  38 + inMinuter, _ := strconv.ParseInt(strings.Split(period.BeginAt, ":")[1], 10, 64)
  39 + return time.Date(y, m, d, int(inHour), int(inMinuter), 0, 0, time.Local)
40 } 40 }
41 41
42 func (period *ProductCalendarBreakTimePeriod) GetCheckEndTime(t time.Time) time.Time { 42 func (period *ProductCalendarBreakTimePeriod) GetCheckEndTime(t time.Time) time.Time {
43 y, m, d := t.Date() 43 y, m, d := t.Date()
44 - inHour, _ := strconv.Atoi(strings.Split(period.EndAt, ":")[0])  
45 - inMinuter, _ := strconv.Atoi(strings.Split(period.EndAt, ":")[1])  
46 - checkTime := time.Date(y, m, d, inHour, inMinuter, 0, 0, t.Location()) 44 + inHour, _ := strconv.ParseInt(strings.Split(period.EndAt, ":")[0], 10, 64)
  45 + inMinuter, _ := strconv.ParseInt(strings.Split(period.EndAt, ":")[1], 10, 64)
  46 + checkTime := time.Date(y, m, d, int(inHour), int(inMinuter), 0, 0, time.Local)
47 if overDay, err := period.CheckOverDay(); overDay && err == nil { 47 if overDay, err := period.CheckOverDay(); overDay && err == nil {
48 return checkTime.AddDate(0, 0, 1) 48 return checkTime.AddDate(0, 0, 1)
49 } 49 }