|
|
|
@@ -75,7 +75,7 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|
|
|
|
//1.6将查询后的数据封装到attendanceGroupVo中
|
|
|
|
|
vo.setAttendanceList(shifts);
|
|
|
|
|
vo.setWeekList(weekSets);
|
|
|
|
|
} else if(Objects.equals(attendanceType, SHIFTSCHEDULE)) {
|
|
|
|
|
} else if (Objects.equals(attendanceType, SHIFTSCHEDULE)) {
|
|
|
|
|
//2.排班制
|
|
|
|
|
//2.1根据id参数查询考勤周期表
|
|
|
|
|
List<AttendanceWeekSet> weekSets = weekSetMapper.selectList(Wrappers.<AttendanceWeekSet>lambdaQuery().eq(AttendanceWeekSet::getGroupId, id));
|
|
|
|
@@ -92,8 +92,8 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据id查询attendance_clock_date表
|
|
|
|
|
List<AttendanceClockDate> clockDates = attendanceClockDateMapper.selectList(Wrappers.<AttendanceClockDate>lambdaQuery().eq(AttendanceClockDate::getGroupId, id));
|
|
|
|
|
vo.setClockDateList(clockDates);
|
|
|
|
|
List<AttendanceClockDate> clockDateList = attendanceClockDateMapper.selectList(Wrappers.<AttendanceClockDate>lambdaQuery().eq(AttendanceClockDate::getGroupId, id));
|
|
|
|
|
vo.setClockDateList(clockDateList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return vo;
|
|
|
|
@@ -185,15 +185,20 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|
|
|
|
|
|
|
|
|
//todo: 法定节假日自动排休
|
|
|
|
|
//2.3.新增打卡日期表
|
|
|
|
|
//2.3.1判断是必须打卡还是无需打卡
|
|
|
|
|
//(1)必须打卡,向打卡日期表中插入数据
|
|
|
|
|
if (Objects.equals(bo.getMustNoCheck(), StatusConstant.MUSTCHECK)) {
|
|
|
|
|
judgeDate(bo);
|
|
|
|
|
}
|
|
|
|
|
//(2)无需打卡,向打卡日期表中插入数据
|
|
|
|
|
else if (Objects.equals(bo.getMustNoCheck(), StatusConstant.NOCHECK)) {
|
|
|
|
|
judgeDate(bo);
|
|
|
|
|
}
|
|
|
|
|
bo.getClockDate().forEach(
|
|
|
|
|
clockDate -> {
|
|
|
|
|
//判断是必须打卡还是无需打卡
|
|
|
|
|
//(1)必须打卡,向打卡日期表中插入数据
|
|
|
|
|
if (Objects.equals(clockDate.getMustNoCheck(), StatusConstant.MUSTCHECK)) {
|
|
|
|
|
insertDate(clockDate, add);
|
|
|
|
|
}
|
|
|
|
|
//(2)无需打卡,向打卡日期表中插入数据
|
|
|
|
|
else if (Objects.equals(clockDate.getMustNoCheck(), StatusConstant.NOCHECK)) {
|
|
|
|
|
insertDate(clockDate, add);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//3.排班制
|
|
|
|
@@ -223,36 +228,21 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|
|
|
|
return flag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void judgeDate(AttendanceGroupBo bo) {
|
|
|
|
|
//3.1.1判断是时间段还是单个日期
|
|
|
|
|
//如果为单个日期,向打卡日期表中插入数据
|
|
|
|
|
//循环clockDate集合
|
|
|
|
|
bo.getClockDate().forEach(
|
|
|
|
|
clockDate -> {
|
|
|
|
|
//向打卡日期表中插入数据
|
|
|
|
|
AttendanceClockDate attendanceClockDate = new AttendanceClockDate();
|
|
|
|
|
BeanUtils.copyProperties(clockDate, attendanceClockDate);
|
|
|
|
|
attendanceClockDate.setGroupId(bo.getId());
|
|
|
|
|
attendanceClockDate.setStartDate(clockDate.getStartDate());
|
|
|
|
|
//判断是时间段还是单个日期
|
|
|
|
|
if (Objects.equals(clockDate.getDateType(), StatusConstant.SINGLEDATE)) {
|
|
|
|
|
attendanceClockDate.setEndDate(clockDate.getStartDate());
|
|
|
|
|
} else if (Objects.equals(clockDate.getDateType(), StatusConstant.DATERANGE)) {
|
|
|
|
|
attendanceClockDate.setEndDate(clockDate.getEndDate());
|
|
|
|
|
}
|
|
|
|
|
attendanceClockDate.setEndDate(clockDate.getEndDate());
|
|
|
|
|
attendanceClockDateMapper.insert(attendanceClockDate);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void insertAttendaanceClockDate(AttendanceGroupBo bo) {
|
|
|
|
|
//向attendance_clock_date表中插入数据
|
|
|
|
|
private void insertDate(AttendanceClockDate clockDate, AttendanceGroup add) {
|
|
|
|
|
AttendanceClockDate attendanceClockDate = new AttendanceClockDate();
|
|
|
|
|
BeanUtils.copyProperties(bo.getClockDate(), attendanceClockDate);
|
|
|
|
|
BeanUtils.copyProperties(clockDate, attendanceClockDate);
|
|
|
|
|
attendanceClockDate.setGroupId(add.getId());
|
|
|
|
|
attendanceClockDate.setStartDate(clockDate.getStartDate());
|
|
|
|
|
//判断是时间段还是单个日期
|
|
|
|
|
if (Objects.equals(clockDate.getDateType(), StatusConstant.SINGLEDATE)) {
|
|
|
|
|
attendanceClockDate.setEndDate(clockDate.getStartDate());
|
|
|
|
|
} else if (Objects.equals(clockDate.getDateType(), StatusConstant.DATERANGE)) {
|
|
|
|
|
attendanceClockDate.setEndDate(clockDate.getEndDate());
|
|
|
|
|
}
|
|
|
|
|
attendanceClockDateMapper.insert(attendanceClockDate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 修改考勤组基本信息
|
|
|
|
|
*
|
|
|
|
@@ -265,6 +255,7 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|
|
|
|
validEntityBeforeSave(update);
|
|
|
|
|
|
|
|
|
|
//根据参数判断当前是固定班制还是排班制
|
|
|
|
|
assert update != null;
|
|
|
|
|
if (Objects.equals(update.getAttendanceType(), FIXEDSCHEDULE)) {
|
|
|
|
|
//1.固定班制
|
|
|
|
|
//取出考勤组id
|
|
|
|
@@ -282,9 +273,44 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|
|
|
|
weekSetMapper.updateById(attendanceWeekSet);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//2.3.修改打卡日期表
|
|
|
|
|
//先删除原有数据
|
|
|
|
|
attendanceClockDateMapper.delete(Wrappers.<AttendanceClockDate>lambdaQuery().eq(AttendanceClockDate::getGroupId, groupId));
|
|
|
|
|
//再插入新数据
|
|
|
|
|
bo.getClockDate().forEach(
|
|
|
|
|
clockDate -> {
|
|
|
|
|
//判断是必须打卡还是无需打卡
|
|
|
|
|
//(1)必须打卡,向打卡日期表中插入数据
|
|
|
|
|
if (Objects.equals(clockDate.getMustNoCheck(), StatusConstant.MUSTCHECK)) {
|
|
|
|
|
insertDate(clockDate, update);
|
|
|
|
|
}
|
|
|
|
|
//(2)无需打卡,向打卡日期表中插入数据
|
|
|
|
|
else if (Objects.equals(clockDate.getMustNoCheck(), StatusConstant.NOCHECK)) {
|
|
|
|
|
insertDate(clockDate, update);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
//2.排班制
|
|
|
|
|
if (Objects.equals(update.getAttendanceType(), SHIFTSCHEDULE)) {
|
|
|
|
|
//1.排班制
|
|
|
|
|
//取出考勤组id
|
|
|
|
|
Long groupId = update.getId();
|
|
|
|
|
//根据考勤组id查询出attendance_schedule_cycle表中的数据
|
|
|
|
|
List<AttendanceScheduleCycle> scheduleCycles = attendanceScheduleCycleMapper.selectList(Wrappers.<AttendanceScheduleCycle>lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId));
|
|
|
|
|
//根据scheduleCycles修改考勤周期表中的数据
|
|
|
|
|
scheduleCycles.forEach(
|
|
|
|
|
scheduleCycle -> {
|
|
|
|
|
AttendanceScheduleCycle attendanceScheduleCycle = new AttendanceScheduleCycle();
|
|
|
|
|
BeanUtils.copyProperties(scheduleCycle, attendanceScheduleCycle);
|
|
|
|
|
attendanceScheduleCycle.setGroupId(update.getId());
|
|
|
|
|
attendanceScheduleCycle.setDayNumber(scheduleCycle.getDayNumber());
|
|
|
|
|
attendanceScheduleCycleMapper.updateById(attendanceScheduleCycle);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return baseMapper.updateById(update) > 0;
|
|
|
|
@@ -306,9 +332,9 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|
|
|
|
*/
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid,Integer attendanceType) {
|
|
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid, Integer attendanceType) {
|
|
|
|
|
//判断删除固定班次还是排班制
|
|
|
|
|
if (Objects.equals(attendanceType, FIXEDSCHEDULE)){
|
|
|
|
|
if (Objects.equals(attendanceType, FIXEDSCHEDULE)) {
|
|
|
|
|
//1.固定班制
|
|
|
|
|
//根据id删除周期表中的数据
|
|
|
|
|
weekSetMapper.delete(Wrappers.<AttendanceWeekSet>lambdaQuery().in(AttendanceWeekSet::getGroupId, ids));
|
|
|
|
|