|
@@ -290,20 +290,21 @@ public class AdjustShiftServiceImpl implements AdjustShiftService {
|
|
|
WorkPersonScheduling workPersonScheduling = workPersonSchedulingService.findByPersonIdSchedulingDay(Long.valueOf(personId), dateTime);
|
|
|
String schedulingId = "";
|
|
|
String oldShiftIds = "";
|
|
|
+
|
|
|
if (workPersonScheduling == null) {
|
|
|
- WorkPersonScheduling workPersonScheduling1 = new WorkPersonScheduling();
|
|
|
- workPersonScheduling1.setId(UUID.randomUUID().toString());
|
|
|
- workPersonScheduling1.setPersonId(Long.valueOf(personId));
|
|
|
- workPersonScheduling1.setYear(DateUtil.year(dateTime));
|
|
|
- workPersonScheduling1.setMonth(DateUtil.month(dateTime));
|
|
|
- workPersonScheduling1.setDay(DateUtil.dayOfMonth(dateTime));
|
|
|
- workPersonScheduling1.setSchedulingDay(dateTime);
|
|
|
- workPersonScheduling1.setShiftIds(shiftIds);
|
|
|
- workPersonScheduling1.setShiftNumbers(shiftNums);
|
|
|
- workPersonScheduling1.setCreateTime(new Date());
|
|
|
- workPersonScheduling1.setCreateBy(personPopedom.getId());
|
|
|
- workPersonSchedulingService.insert(workPersonScheduling1);
|
|
|
- schedulingId = workPersonScheduling1.getId();
|
|
|
+ workPersonScheduling = new WorkPersonScheduling();
|
|
|
+ workPersonScheduling.setId(UUID.randomUUID().toString());
|
|
|
+ workPersonScheduling.setPersonId(Long.valueOf(personId));
|
|
|
+ workPersonScheduling.setYear(DateUtil.year(dateTime));
|
|
|
+ workPersonScheduling.setMonth(DateUtil.month(dateTime));
|
|
|
+ workPersonScheduling.setDay(DateUtil.dayOfMonth(dateTime));
|
|
|
+ workPersonScheduling.setSchedulingDay(dateTime);
|
|
|
+ workPersonScheduling.setShiftIds(shiftIds);
|
|
|
+ workPersonScheduling.setShiftNumbers(shiftNums);
|
|
|
+ workPersonScheduling.setCreateTime(new Date());
|
|
|
+ workPersonScheduling.setCreateBy(personPopedom.getId());
|
|
|
+ workPersonSchedulingService.insert(workPersonScheduling);
|
|
|
+ schedulingId = workPersonScheduling.getId();
|
|
|
oldShiftIds = shiftIds;
|
|
|
} else {
|
|
|
oldShiftIds = workPersonScheduling.getShiftIds();
|
|
@@ -332,7 +333,9 @@ public class AdjustShiftServiceImpl implements AdjustShiftService {
|
|
|
//todo 如果调整当天之前的班次则重新生成考勤
|
|
|
Date now = new Date();
|
|
|
|
|
|
- if(workPersonScheduling.getSchedulingDay()!=null && workPersonScheduling.getSchedulingDay().before(now)) {
|
|
|
+ if(workPersonScheduling!=null
|
|
|
+ && workPersonScheduling.getSchedulingDay()!=null
|
|
|
+ && workPersonScheduling.getSchedulingDay().before(now)) {
|
|
|
DateTime startTime = new DateTime(workPersonScheduling.getSchedulingDay());
|
|
|
DateTime endTime = startTime; //updatePersonAttendance会自动加一天
|
|
|
|