|
@@ -19,12 +19,13 @@ import com.jpsoft.shinestar.modules.common.utils.StringUtils;
|
|
|
import com.jpsoft.shinestar.modules.common.utils.WechatMessageUtil;
|
|
|
import com.jpsoft.shinestar.modules.sys.entity.DataDictionary;
|
|
|
import com.jpsoft.shinestar.modules.sys.service.DataDictionaryService;
|
|
|
-import com.sun.corba.se.spi.orbutil.threadpool.Work;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.joda.time.DateTime;
|
|
|
import org.joda.time.Days;
|
|
|
import org.joda.time.Hours;
|
|
|
import org.joda.time.Minutes;
|
|
|
+import org.joda.time.format.DateTimeFormat;
|
|
|
+import org.joda.time.format.DateTimeFormatter;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.redis.core.ValueOperations;
|
|
@@ -611,6 +612,33 @@ public class WorkScheduleAttendanceServiceImpl implements WorkScheduleAttendance
|
|
|
private void saveWorkAttendance(Long personId, BigDecimal temperature, Date recordTime, String attendanceDate,
|
|
|
String personScheduleId, String workShiftId, String result, Integer minutes,
|
|
|
String classify, String workStatus, WorkOverPerson workOverPerson) {
|
|
|
+ long offsetMinute = 0;
|
|
|
+
|
|
|
+ try {
|
|
|
+ WorkShiftInfo workShiftInfo = workShiftInfoService.get(workShiftId);
|
|
|
+
|
|
|
+ if (workShiftInfo != null) {
|
|
|
+ DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm");
|
|
|
+
|
|
|
+ if ("1".equals(classify)) {
|
|
|
+ //上班
|
|
|
+ DateTime workTime = DateTime.parse(attendanceDate + " " + workShiftInfo.getWorkTime(), formatter);
|
|
|
+ workTime = workTime.plusDays(workShiftInfo.getWorkDayType());
|
|
|
+
|
|
|
+ offsetMinute = Minutes.minutesBetween(new DateTime(recordTime), workTime).getMinutes();
|
|
|
+ } else {
|
|
|
+ //下班
|
|
|
+ DateTime closingTime = DateTime.parse(attendanceDate + " " + workShiftInfo.getClosingTime(), formatter);
|
|
|
+ closingTime = closingTime.plusDays(workShiftInfo.getClosingDayType());
|
|
|
+
|
|
|
+ offsetMinute = Minutes.minutesBetween(new DateTime(recordTime), closingTime).getMinutes();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
+ }
|
|
|
+
|
|
|
WorkScheduleAttendance workEndAttendance = new WorkScheduleAttendance();
|
|
|
|
|
|
List<WorkScheduleAttendance> attendanceList = workScheduleAttendanceDAO.findByPersonScheduleIdAndClassify(personScheduleId, workShiftId, classify);
|
|
@@ -629,6 +657,7 @@ public class WorkScheduleAttendanceServiceImpl implements WorkScheduleAttendance
|
|
|
workEndAttendance.setTemperature(temperature);
|
|
|
workEndAttendance.setRecordTime(recordTime);
|
|
|
workEndAttendance.setCreateTime(new Date());
|
|
|
+ workEndAttendance.setOffsetMinute(new BigDecimal(offsetMinute));
|
|
|
|
|
|
if(workOverPerson!=null){
|
|
|
workEndAttendance.setWorkOverPersonId(workOverPerson.getId());
|
|
@@ -645,6 +674,7 @@ public class WorkScheduleAttendanceServiceImpl implements WorkScheduleAttendance
|
|
|
workEndAttendance.setTemperature(temperature);
|
|
|
workEndAttendance.setRecordTime(recordTime);
|
|
|
workEndAttendance.setUpdateTime(new Date());
|
|
|
+ workEndAttendance.setOffsetMinute(new BigDecimal(offsetMinute));
|
|
|
|
|
|
if(workOverPerson!=null){
|
|
|
workEndAttendance.setWorkOverPersonId(workOverPerson.getId());
|