Merge remote-tracking branch 'origin/master'
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
@@ -37,7 +37,7 @@ public class AttendanceClockDate extends TenantEntity {
|
|||||||
/**
|
/**
|
||||||
* 必须/无需打卡(0:无需打卡,1必须打卡)
|
* 必须/无需打卡(0:无需打卡,1必须打卡)
|
||||||
*/
|
*/
|
||||||
private Long mustNoCheck;
|
private Integer mustNoCheck;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期类型(0:单个日期,1:时间段)
|
* 日期类型(0:单个日期,1:时间段)
|
||||||
|
@@ -36,12 +36,12 @@ public class AttendanceClockDateBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 必须/无需打卡(0:无需打卡,1必须打卡)
|
* 必须/无需打卡(0:无需打卡,1必须打卡)
|
||||||
*/
|
*/
|
||||||
private Long mustNoCheck;
|
private Integer mustNoCheck;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期类型(0:单个日期,1:时间段)
|
* 日期类型(0:单个日期,1:时间段)
|
||||||
*/
|
*/
|
||||||
private Long dateType;
|
private Integer dateType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始日期
|
* 开始日期
|
||||||
|
@@ -52,8 +52,6 @@ public class AttendanceGroupBo extends BaseEntity {
|
|||||||
List<AttendanceScheduleCycle> numList;
|
List<AttendanceScheduleCycle> numList;
|
||||||
List<AttendanceWeekSet> weekSetList;
|
List<AttendanceWeekSet> weekSetList;
|
||||||
|
|
||||||
//前端传必须打卡还是无需打卡
|
|
||||||
private Integer mustNoCheck;
|
|
||||||
|
|
||||||
private List<AttendanceClockDate> clockDate;
|
private List<AttendanceClockDate> clockDate;
|
||||||
|
|
||||||
|
@@ -47,13 +47,13 @@ public class AttendanceClockDateVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "必须/无需打卡", converter = ExcelDictConvert.class)
|
@ExcelProperty(value = "必须/无需打卡", converter = ExcelDictConvert.class)
|
||||||
@ExcelDictFormat(readConverterExp = "0=:无需打卡,1必须打卡")
|
@ExcelDictFormat(readConverterExp = "0=:无需打卡,1必须打卡")
|
||||||
private Long mustNoCheck;
|
private Integer mustNoCheck;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期类型(0:单个日期,1:时间段)
|
* 日期类型(0:单个日期,1:时间段)
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "日期类型(0:单个日期,1:时间段)")
|
@ExcelProperty(value = "日期类型(0:单个日期,1:时间段)")
|
||||||
private Long dateType;
|
private Integer dateType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始日期
|
* 开始日期
|
||||||
|
@@ -75,7 +75,7 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|||||||
//1.6将查询后的数据封装到attendanceGroupVo中
|
//1.6将查询后的数据封装到attendanceGroupVo中
|
||||||
vo.setAttendanceList(shifts);
|
vo.setAttendanceList(shifts);
|
||||||
vo.setWeekList(weekSets);
|
vo.setWeekList(weekSets);
|
||||||
} else if(Objects.equals(attendanceType, SHIFTSCHEDULE)) {
|
} else if (Objects.equals(attendanceType, SHIFTSCHEDULE)) {
|
||||||
//2.排班制
|
//2.排班制
|
||||||
//2.1根据id参数查询考勤周期表
|
//2.1根据id参数查询考勤周期表
|
||||||
List<AttendanceWeekSet> weekSets = weekSetMapper.selectList(Wrappers.<AttendanceWeekSet>lambdaQuery().eq(AttendanceWeekSet::getGroupId, 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表
|
//根据id查询attendance_clock_date表
|
||||||
List<AttendanceClockDate> clockDates = attendanceClockDateMapper.selectList(Wrappers.<AttendanceClockDate>lambdaQuery().eq(AttendanceClockDate::getGroupId, id));
|
List<AttendanceClockDate> clockDateList = attendanceClockDateMapper.selectList(Wrappers.<AttendanceClockDate>lambdaQuery().eq(AttendanceClockDate::getGroupId, id));
|
||||||
vo.setClockDateList(clockDates);
|
vo.setClockDateList(clockDateList);
|
||||||
|
|
||||||
|
|
||||||
return vo;
|
return vo;
|
||||||
@@ -185,16 +185,21 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|||||||
|
|
||||||
//todo: 法定节假日自动排休
|
//todo: 法定节假日自动排休
|
||||||
//2.3.新增打卡日期表
|
//2.3.新增打卡日期表
|
||||||
//2.3.1判断是必须打卡还是无需打卡
|
bo.getClockDate().forEach(
|
||||||
|
clockDate -> {
|
||||||
|
//判断是必须打卡还是无需打卡
|
||||||
//(1)必须打卡,向打卡日期表中插入数据
|
//(1)必须打卡,向打卡日期表中插入数据
|
||||||
if (Objects.equals(bo.getMustNoCheck(), StatusConstant.MUSTCHECK)) {
|
if (Objects.equals(clockDate.getMustNoCheck(), StatusConstant.MUSTCHECK)) {
|
||||||
judgeDate(bo);
|
insertDate(clockDate, add);
|
||||||
}
|
}
|
||||||
//(2)无需打卡,向打卡日期表中插入数据
|
//(2)无需打卡,向打卡日期表中插入数据
|
||||||
else if (Objects.equals(bo.getMustNoCheck(), StatusConstant.NOCHECK)) {
|
else if (Objects.equals(clockDate.getMustNoCheck(), StatusConstant.NOCHECK)) {
|
||||||
judgeDate(bo);
|
insertDate(clockDate, add);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//3.排班制
|
//3.排班制
|
||||||
if (Objects.equals(add.getAttendanceType(), StatusConstant.SHIFTSCHEDULE)) {
|
if (Objects.equals(add.getAttendanceType(), StatusConstant.SHIFTSCHEDULE)) {
|
||||||
@@ -223,16 +228,10 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void judgeDate(AttendanceGroupBo bo) {
|
private void insertDate(AttendanceClockDate clockDate, AttendanceGroup add) {
|
||||||
//3.1.1判断是时间段还是单个日期
|
|
||||||
//如果为单个日期,向打卡日期表中插入数据
|
|
||||||
//循环clockDate集合
|
|
||||||
bo.getClockDate().forEach(
|
|
||||||
clockDate -> {
|
|
||||||
//向打卡日期表中插入数据
|
|
||||||
AttendanceClockDate attendanceClockDate = new AttendanceClockDate();
|
AttendanceClockDate attendanceClockDate = new AttendanceClockDate();
|
||||||
BeanUtils.copyProperties(clockDate, attendanceClockDate);
|
BeanUtils.copyProperties(clockDate, attendanceClockDate);
|
||||||
attendanceClockDate.setGroupId(bo.getId());
|
attendanceClockDate.setGroupId(add.getId());
|
||||||
attendanceClockDate.setStartDate(clockDate.getStartDate());
|
attendanceClockDate.setStartDate(clockDate.getStartDate());
|
||||||
//判断是时间段还是单个日期
|
//判断是时间段还是单个日期
|
||||||
if (Objects.equals(clockDate.getDateType(), StatusConstant.SINGLEDATE)) {
|
if (Objects.equals(clockDate.getDateType(), StatusConstant.SINGLEDATE)) {
|
||||||
@@ -240,18 +239,9 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|||||||
} else if (Objects.equals(clockDate.getDateType(), StatusConstant.DATERANGE)) {
|
} else if (Objects.equals(clockDate.getDateType(), StatusConstant.DATERANGE)) {
|
||||||
attendanceClockDate.setEndDate(clockDate.getEndDate());
|
attendanceClockDate.setEndDate(clockDate.getEndDate());
|
||||||
}
|
}
|
||||||
attendanceClockDate.setEndDate(clockDate.getEndDate());
|
|
||||||
attendanceClockDateMapper.insert(attendanceClockDate);
|
attendanceClockDateMapper.insert(attendanceClockDate);
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void insertAttendaanceClockDate(AttendanceGroupBo bo) {
|
|
||||||
//向attendance_clock_date表中插入数据
|
|
||||||
AttendanceClockDate attendanceClockDate = new AttendanceClockDate();
|
|
||||||
BeanUtils.copyProperties(bo.getClockDate(), attendanceClockDate);
|
|
||||||
attendanceClockDateMapper.insert(attendanceClockDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改考勤组基本信息
|
* 修改考勤组基本信息
|
||||||
@@ -265,6 +255,7 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
|
|
||||||
//根据参数判断当前是固定班制还是排班制
|
//根据参数判断当前是固定班制还是排班制
|
||||||
|
assert update != null;
|
||||||
if (Objects.equals(update.getAttendanceType(), FIXEDSCHEDULE)) {
|
if (Objects.equals(update.getAttendanceType(), FIXEDSCHEDULE)) {
|
||||||
//1.固定班制
|
//1.固定班制
|
||||||
//取出考勤组id
|
//取出考勤组id
|
||||||
@@ -282,9 +273,44 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|||||||
weekSetMapper.updateById(attendanceWeekSet);
|
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;
|
return baseMapper.updateById(update) > 0;
|
||||||
@@ -306,9 +332,9 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService {
|
|||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@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.固定班制
|
//1.固定班制
|
||||||
//根据id删除周期表中的数据
|
//根据id删除周期表中的数据
|
||||||
weekSetMapper.delete(Wrappers.<AttendanceWeekSet>lambdaQuery().in(AttendanceWeekSet::getGroupId, ids));
|
weekSetMapper.delete(Wrappers.<AttendanceWeekSet>lambdaQuery().in(AttendanceWeekSet::getGroupId, ids));
|
||||||
|
Reference in New Issue
Block a user