From bff00b7b4a90d588cf3dc652296b634dfd5692e9 Mon Sep 17 00:00:00 2001 From: dy <2389062315@qq.com> Date: Tue, 29 Jul 2025 11:06:29 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=92=E7=8F=AD?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/AttendanceArrangement.java | 4 +- .../domain/bo/AttendanceArrangementBo.java | 15 +- .../domain/constant/StatusConstant.java | 6 + .../domain/vo/AttendanceArrangementVo.java | 6 +- .../AttendanceArrangementServiceImpl.java | 129 +++++++++++------- 5 files changed, 100 insertions(+), 60 deletions(-) diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/AttendanceArrangement.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/AttendanceArrangement.java index c5143b1..fb83467 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/AttendanceArrangement.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/AttendanceArrangement.java @@ -55,12 +55,12 @@ public class AttendanceArrangement extends TenantEntity { /** * 开始日期 */ - private LocalDate startDate; + private Date startDate; /** * 结束日期(仅date_type=3时有效) */ - private LocalDate endDate; + private Date endDate; /** * 状态:0-未生效,1-已生效 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceArrangementBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceArrangementBo.java index 99cdc10..f935281 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceArrangementBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceArrangementBo.java @@ -9,6 +9,7 @@ import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; +import org.dromara.property.domain.AttendanceScheduleCycle; import org.dromara.property.domain.AttendanceUserGroup; import org.springframework.format.annotation.DateTimeFormat; @@ -52,7 +53,7 @@ public class AttendanceArrangementBo extends BaseEntity { /** * 日期类型:1-单个日期,2-长期有效,3-期间有效 */ - private Long dateType; + private Integer dateType; /** * 开始日期 @@ -69,8 +70,8 @@ public class AttendanceArrangementBo extends BaseEntity { /** * 前端传日历的开始时间和结束时间 */ - private LocalDate calendarStartDate; - private LocalDate calendarEndTimeDate; + private Date calendarStartDate; + private Date calendarEndTimeDate; /** * 前端传某天的当前日期 @@ -83,7 +84,15 @@ public class AttendanceArrangementBo extends BaseEntity { */ private Long status; + /** + * + * 排班用户组 + */ private List userGroupList; + /** + * 排班日期列表 + */ + private List scheduleCycleList; } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/constant/StatusConstant.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/constant/StatusConstant.java index efc6f43..188b613 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/constant/StatusConstant.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/constant/StatusConstant.java @@ -28,5 +28,11 @@ public class StatusConstant { public static final Integer NORMAL = 1; + //日期类型:1-单个日期,2-长期有效,3-期间有效 + public static final Integer SINGLE = 1; + public static final Integer LONGTIME = 2; + public static final Integer SHORTTIME = 3; + + } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AttendanceArrangementVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AttendanceArrangementVo.java index c6ca7b0..9f9fc29 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AttendanceArrangementVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AttendanceArrangementVo.java @@ -8,7 +8,7 @@ import org.dromara.property.domain.*; import java.io.Serial; import java.io.Serializable; -import java.time.LocalDate; +import java.util.Date; import java.util.List; @@ -60,13 +60,13 @@ public class AttendanceArrangementVo implements Serializable { * 开始日期 */ @ExcelProperty(value = "开始日期") - private LocalDate startDate; + private Date startDate; /** * 结束日期(仅date_type=3时有效) */ @ExcelProperty(value = "结束日期(仅date_type=3时有效)") - private LocalDate endDate; + private Date endDate; /** * 状态:0-未生效,1-已生效 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java index 5181dec..42261de 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java @@ -19,6 +19,8 @@ import org.dromara.property.service.IAttendanceArrangementService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; +import java.time.ZoneId; import java.util.*; import java.util.stream.Collectors; @@ -75,63 +77,69 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); - //1.如:在2号到10号有固定班制和排班制,根据当前日期查询出所有的考勤组id - //查询指定日期在哪些排班中 - List arrangementList = baseMapper.selectList(Wrappers.lambdaQuery().ge(AttendanceArrangement::getStartDate, bo.getCurrentDate()).le(AttendanceArrangement::getEndDate, bo.getCurrentDate())); - //根据排班查询出考勤组id - List groupIds = arrangementList.stream().map(AttendanceArrangement::getGroupId).distinct().toList(); - // 2.循环将所有的考勤组id设置到考勤组中 - //循环groupIds,循环和AttendanceGroup中的id做对比,如果有相同的,则取出attendanceGroup中的所有数据 - groupIds.forEach( - groupId -> { - //从数据库查询出当前考勤组的所有数据 - AttendanceGroup group = attendanceGroupMapper.selectOne(Wrappers.lambdaQuery().eq(AttendanceGroup::getId, groupId)); + Page attendanceArrangementVoPage = result.setRecords(result.getRecords().stream().peek(vo -> { - // 3.查询出当前考勤组的所有数据,从考勤组判断当前id是固定班制还是排班制 - if (group.getAttendanceType().equals(StatusConstant.FIXEDSCHEDULE)) { - // 3.1固定班制:将当前的日期转为周几,然后与数据库中的班次周数作对比,取出当前日期的班次信息 - //将传来的日期参数转为周几 - int week = DateUtil.dayOfWeek(bo.getCurrentDate()); - //取出当前日期的周数,与数据库中的班次周数作对比,取出当前日期的班次信息 - AttendanceWeekSet weekSet = weekSetMapper.selectOne(Wrappers.lambdaQuery().eq(AttendanceWeekSet::getGroupId, groupId).eq(AttendanceWeekSet::getDayOfWeek, week)); - //将weekSet存到结果中 - AttendanceArrangementVo arrangementVo = new AttendanceArrangementVo(); - arrangementVo.setWeekSet(weekSet); - //根据weekSet取出id,根据id查询出attendanceWeekSetShift表中的shiftId - Long shiftId = weekSet.getId(); - //根据shiftId查询attendanceShift表中对应的id的数据 - AttendanceShift shift = attendanceShiftMapper.selectById(shiftId); - //将shift存到结果中 - arrangementVo.setShift(shift); + //1.如:在2号到10号有固定班制和排班制,根据当前日期查询出所有的考勤组id + //查询指定日期在哪些排班中 + List arrangementList = baseMapper.selectList(Wrappers.lambdaQuery().ge(AttendanceArrangement::getStartDate, bo.getCurrentDate()).le(AttendanceArrangement::getEndDate, bo.getCurrentDate())); + //根据排班查询出考勤组id + List groupIds = arrangementList.stream().map(AttendanceArrangement::getGroupId).distinct().toList(); - } else if (group.getAttendanceType().equals(StatusConstant.SHIFTSCHEDULE)) { - // 3.2排班制:判断第一天是从几号开始,循环判断,判断当前是循环中的第几天,取出当前天数的班次信息。 - //取出排班中的开始时间和结束时间 - Date startDate = bo.getStartDate(); - Date endDate = bo.getEndDate(); - Date currentDate = bo.getCurrentDate(); - //取出attendanceScheduleCycle表中的天数 - Integer cycleDays = scheduleCycleMapper.selectOne(Wrappers.lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)).getDayNumber(); - //在startDate和endDate之间循环,判端当前日期是cycleDays中的第几天 - int cycleDay = 0; - while (startDate.before(currentDate) || endDate.after(currentDate)) { - cycleDay++; - startDate = DateUtil.offsetDay(startDate, 1); - //判断当前日期是clcleDays中的第几天 - if (cycleDay > cycleDays) { - cycleDay = 1; + // 2.循环将所有的考勤组id设置到考勤组中 + //循环groupIds,循环和AttendanceGroup中的id做对比,如果有相同的,则取出attendanceGroup中的所有数据 + groupIds.forEach( + groupId -> { + //从数据库查询出当前考勤组的所有数据 + AttendanceGroup group = attendanceGroupMapper.selectOne(Wrappers.lambdaQuery().eq(AttendanceGroup::getId, groupId)); + + // 3.查询出当前考勤组的所有数据,从考勤组判断当前id是固定班制还是排班制 + if (group.getAttendanceType().equals(StatusConstant.FIXEDSCHEDULE)) { + // 3.1固定班制:将当前的日期转为周几,然后与数据库中的班次周数作对比,取出当前日期的班次信息 + //将传来的日期参数转为周几 + int week = DateUtil.dayOfWeek(bo.getCurrentDate()); + //取出当前日期的周数,与数据库中的班次周数作对比,取出当前日期的班次信息 + AttendanceWeekSet weekSet = weekSetMapper.selectOne(Wrappers.lambdaQuery().eq(AttendanceWeekSet::getGroupId, groupId).eq(AttendanceWeekSet::getDayOfWeek, week)); + //将weekSet存到结果中 + AttendanceArrangementVo arrangementVo = new AttendanceArrangementVo(); + arrangementVo.setWeekSet(weekSet); + //根据weekSet取出id,根据id查询出attendanceWeekSetShift表中的shiftId + Long shiftId = weekSet.getId(); + //根据shiftId查询attendanceShift表中对应的id的数据 + AttendanceShift shift = attendanceShiftMapper.selectById(shiftId); + //将shift存到结果中 + arrangementVo.setShift(shift); + + } else if (group.getAttendanceType().equals(StatusConstant.SHIFTSCHEDULE)) { + // 3.2排班制:判断第一天是从几号开始,循环判断,判断当前是循环中的第几天,取出当前天数的班次信息。 + //取出排班中的开始时间和结束时间 + Date startDate = bo.getStartDate(); + Date endDate = bo.getEndDate(); + Date currentDate = bo.getCurrentDate(); + //取出attendanceScheduleCycle表中的天数 + Integer cycleDays = scheduleCycleMapper.selectOne(Wrappers.lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId)).getDayNumber(); + //在startDate和endDate之间循环,判端当前日期是cycleDays中的第几天 + int cycleDay = 0; + while (startDate.before(currentDate) || endDate.after(currentDate)) { + cycleDay++; + startDate = DateUtil.offsetDay(startDate, 1); + //判断当前日期是clcleDays中的第几天 + if (cycleDay > cycleDays) { + cycleDay = 1; + } } - } - //根据cycleDay查询出当前日期的班次信息 - AttendanceScheduleCycle cycle = scheduleCycleMapper.selectOne(Wrappers.lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId).eq(AttendanceScheduleCycle::getDayNumber, cycleDay)); - //将cycle存到结果中 - AttendanceArrangementVo arrangementVo = new AttendanceArrangementVo(); - arrangementVo.setCycle(cycle); + //根据cycleDay查询出当前日期的班次信息 + AttendanceScheduleCycle cycle = scheduleCycleMapper.selectOne(Wrappers.lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, groupId).eq(AttendanceScheduleCycle::getDayNumber, cycleDay)); + //将cycle存到结果中 + AttendanceArrangementVo arrangementVo = new AttendanceArrangementVo(); + arrangementVo.setCycle(cycle); + } } - } - ); + ); + }).collect(Collectors.toList())); + + // //1.根据当前日期查询出排班信息 @@ -154,7 +162,7 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS // } - return TableDataInfo.build(result); + return TableDataInfo.build(attendanceArrangementVoPage); } /** @@ -244,6 +252,23 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS if (flag) { bo.setId(add.getId()); } + + //判断排班日期是单个日期还是从此日期开始循环有效还是从此日期开始有效 + //1.单个日期 + if (bo.getDateType().equals(StatusConstant.SINGLE)) { + add.setEndDate(null); + } + //2.从此日期开始长期有效 + if (bo.getDateType().equals(StatusConstant.LONGTIME)) { + //设置长期时间为2099年12月31日 + LocalDate longTimeEndDate = LocalDate.of(2099, 12, 31); + add.setEndDate(Date.from(longTimeEndDate.atStartOfDay(ZoneId.systemDefault()).toInstant())); + } + if (bo.getDateType().equals(StatusConstant.SHORTTIME)){ + add.setEndDate(bo.getEndDate()); + } + + //取出当前新增的排班的id Long ArrangementId = add.getId(); //用获取到的排班id向attendanceUserGroup表中插入数据 From da0ba9aa0a0b0d805b6d1ca17f75f0b359a516e7 Mon Sep 17 00:00:00 2001 From: dy <2389062315@qq.com> Date: Tue, 29 Jul 2025 11:08:59 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=8A=BD=E5=8F=96=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AttendanceArrangementServiceImpl.java | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java index 42261de..5a87edc 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java @@ -253,20 +253,7 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS bo.setId(add.getId()); } - //判断排班日期是单个日期还是从此日期开始循环有效还是从此日期开始有效 - //1.单个日期 - if (bo.getDateType().equals(StatusConstant.SINGLE)) { - add.setEndDate(null); - } - //2.从此日期开始长期有效 - if (bo.getDateType().equals(StatusConstant.LONGTIME)) { - //设置长期时间为2099年12月31日 - LocalDate longTimeEndDate = LocalDate.of(2099, 12, 31); - add.setEndDate(Date.from(longTimeEndDate.atStartOfDay(ZoneId.systemDefault()).toInstant())); - } - if (bo.getDateType().equals(StatusConstant.SHORTTIME)){ - add.setEndDate(bo.getEndDate()); - } + judgeDate(bo, add); //取出当前新增的排班的id @@ -282,6 +269,23 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS return flag; } + private static void judgeDate(AttendanceArrangementBo bo, AttendanceArrangement add) { + //判断排班日期是单个日期还是从此日期开始循环有效还是从此日期开始有效 + //1.单个日期 + if (bo.getDateType().equals(StatusConstant.SINGLE)) { + add.setEndDate(null); + } + //2.从此日期开始长期有效 + if (bo.getDateType().equals(StatusConstant.LONGTIME)) { + //设置长期时间为2099年12月31日 + LocalDate longTimeEndDate = LocalDate.of(2099, 12, 31); + add.setEndDate(Date.from(longTimeEndDate.atStartOfDay(ZoneId.systemDefault()).toInstant())); + } + if (bo.getDateType().equals(StatusConstant.SHORTTIME)){ + add.setEndDate(bo.getEndDate()); + } + } + /** * 修改排班 * @@ -293,6 +297,8 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS AttendanceArrangement update = MapstructUtils.convert(bo, AttendanceArrangement.class); validEntityBeforeSave(update); + judgeDate(bo, update); + //取出当前排班的id Long ArrangementId = update.getId(); //用获取到的排班id向attendanceUserGroup表中更新数据 From b303ab6faaae0ae183a3db883688659f4026e99c Mon Sep 17 00:00:00 2001 From: dy <2389062315@qq.com> Date: Tue, 29 Jul 2025 15:47:40 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E7=8F=AD=E5=88=B6=E4=B8=BB=E9=94=AE=E9=87=8D=E5=A4=8D=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/dromara/property/domain/bo/AttendanceGroupBo.java | 1 + .../service/impl/AttendanceArrangementServiceImpl.java | 6 +++++- .../property/service/impl/AttendanceGroupServiceImpl.java | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java index 222f8a8..01e3fd5 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java @@ -50,6 +50,7 @@ public class AttendanceGroupBo extends BaseEntity { List numList; + List weekSetList; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java index 5a87edc..6c5c3c5 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java @@ -174,7 +174,11 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS @Override public List queryList(AttendanceArrangementBo bo) { - //1.根据开始时间和结束时间查询所有的排班信息 + //查看日历开始时间、结束时间和开始时间、结束时间的交集 + + + + //1.根据日历的开始时间和日历的结束时间查询所有的排班信息 List arrangementList = baseMapper.selectList(Wrappers.lambdaQuery().ge(AttendanceArrangement::getStartDate, bo.getCalendarStartDate()).le(AttendanceArrangement::getEndDate, bo.getCalendarEndTimeDate())); //2.查询人员组的信息 //根据开始时间查询排班的id diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java index 838dbad..878466d 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java @@ -203,11 +203,11 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService { //3.排班制 if (Objects.equals(add.getAttendanceType(), StatusConstant.SHIFTSCHEDULE)) { - //2.2排班制,向天数表中插入数据 - AttendanceScheduleCycle attendanceScheduleCycle = new AttendanceScheduleCycle(); //循环向周期表中插入数据 bo.getNumList().forEach( num -> { + //2.2排班制,向天数表中插入数据 + AttendanceScheduleCycle attendanceScheduleCycle = new AttendanceScheduleCycle(); attendanceScheduleCycle.setGroupId(add.getId()); attendanceScheduleCycle.setDayNumber(num.getDayNumber()); attendanceScheduleCycleMapper.insert(attendanceScheduleCycle); From 28143d17e7a8234a77a7fac17139d46753c66aa4 Mon Sep 17 00:00:00 2001 From: dy <2389062315@qq.com> Date: Tue, 29 Jul 2025 16:59:17 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=AF=A6=E6=83=85bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/AttendanceScheduleCycle.java | 2 +- .../property/domain/bo/AttendanceGroupBo.java | 1 - .../property/domain/vo/AttendanceGroupVo.java | 4 ++ .../AttendanceArrangementServiceImpl.java | 7 +++- .../impl/AttendanceGroupServiceImpl.java | 38 ++++++++++++++----- 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/AttendanceScheduleCycle.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/AttendanceScheduleCycle.java index d935277..8787667 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/AttendanceScheduleCycle.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/AttendanceScheduleCycle.java @@ -42,7 +42,7 @@ public class AttendanceScheduleCycle extends TenantEntity { */ private Long isRest; - private Long scheduleId; + private Long shiftId; } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java index 01e3fd5..222f8a8 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java @@ -50,7 +50,6 @@ public class AttendanceGroupBo extends BaseEntity { List numList; - List weekSetList; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AttendanceGroupVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AttendanceGroupVo.java index 44c1c8f..b8ae394 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AttendanceGroupVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/AttendanceGroupVo.java @@ -61,5 +61,9 @@ public class AttendanceGroupVo implements Serializable { List clockDateList; + List scheduleCycleList; + + + } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java index 6c5c3c5..2271d73 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java @@ -174,7 +174,12 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS @Override public List queryList(AttendanceArrangementBo bo) { - //查看日历开始时间、结束时间和开始时间、结束时间的交集 + Date startDate = bo.getStartDate(); + Date endDate = bo.getEndDate(); + Date calendarStartDate = bo.getCalendarStartDate(); + Date calendarEndTimeDate = bo.getCalendarEndTimeDate(); + + diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java index 878466d..6e9a839 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java @@ -78,18 +78,38 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService { vo.setWeekList(weekSets); } else if (Objects.equals(attendanceType, SHIFTSCHEDULE)) { //2.排班制 - //2.1根据id参数查询考勤周期表 - List weekSets = weekSetMapper.selectList(Wrappers.lambdaQuery().eq(AttendanceWeekSet::getGroupId, id)); + //2.1根据id参数查询考勤天数表 + List scheduleCycles = attendanceScheduleCycleMapper.selectList(Wrappers.lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, id)); //2.2根据id参数取出所有考勤天数id - List weekSetIds = weekSets.stream().map(AttendanceWeekSet::getId).toList(); - //2.3根据天数id查询出中间表 - List scheduleCycles = attendanceScheduleCycleMapper.selectList(Wrappers.lambdaQuery().in(AttendanceScheduleCycle::getGroupId, weekSetIds)); - //2.4根据中间表的班次id查询出班次表id List scheduleCycleIds = scheduleCycles.stream().map(AttendanceScheduleCycle::getId).toList(); - //2.5根据班次id查询出班次表 - List shifts = attendanceShiftMapper.selectList(Wrappers.lambdaQuery().in(AttendanceShift::getId, scheduleCycleIds)); + //2.3根据天数id查询出中间表 + List weeksetShifts = attendanceWeeksetShiftMapper.selectList(Wrappers.lambdaQuery().in(AttendanceWeeksetShift::getWeekSetId, scheduleCycleIds)); + //2.4根据中间表的班次id查询出班次表id + List weeksetShiftIds = weeksetShifts.stream().map(AttendanceWeeksetShift::getId).toList(); + //根据id查询出shiftId + List shiftIds = weeksetShifts.stream().map(AttendanceWeeksetShift::getShiftId).toList(); + //2.5根据shiftId查询出班次表 + List shifts = attendanceShiftMapper.selectList(Wrappers.lambdaQuery().in(AttendanceShift::getId, shiftIds)); + + +// //2.5根据班次id查询出班次表 +// List shifts = attendanceShiftMapper.selectList(Wrappers.lambdaQuery().in(AttendanceShift::getId, weeksetShiftIds)); //2.6将查询后的数据封装到attendanceGroupVo中 vo.setAttendanceList(shifts); + vo.setScheduleCycleList(scheduleCycles); + + +// List weekSets = weekSetMapper.selectList(Wrappers.lambdaQuery().eq(AttendanceWeekSet::getGroupId, id)); +// //2.2根据id参数取出所有考勤天数id +// List weekSetIds = weekSets.stream().map(AttendanceWeekSet::getId).toList(); +// //2.3根据天数id查询出中间表 +// List scheduleCycles = attendanceScheduleCycleMapper.selectList(Wrappers.lambdaQuery().in(AttendanceScheduleCycle::getGroupId, weekSetIds)); +// //2.4根据中间表的班次id查询出班次表id +// List scheduleCycleIds = scheduleCycles.stream().map(AttendanceScheduleCycle::getId).toList(); +// //2.5根据班次id查询出班次表 +// List shifts = attendanceShiftMapper.selectList(Wrappers.lambdaQuery().in(AttendanceShift::getId, scheduleCycleIds)); +// //2.6将查询后的数据封装到attendanceGroupVo中 +// vo.setAttendanceList(shifts); } //根据id查询attendance_clock_date表 @@ -216,7 +236,7 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService { //向中间表插入周期的id AttendanceWeeksetShift attendanceWeeksetShift = new AttendanceWeeksetShift(); attendanceWeeksetShift.setWeekSetId(scheduleId); - attendanceWeeksetShift.setShiftId(num.getScheduleId()); + attendanceWeeksetShift.setShiftId(num.getShiftId()); attendanceWeeksetShiftMapper.insert(attendanceWeeksetShift); } ); From d42e2c627fae618857daca06c308a40e1586b24b Mon Sep 17 00:00:00 2001 From: dy <2389062315@qq.com> Date: Tue, 29 Jul 2025 17:15:45 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=8F=AD=E6=AC=A1id=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/AttendanceGroupServiceImpl.java | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java index 6e9a839..158d2db 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java @@ -90,26 +90,10 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService { List shiftIds = weeksetShifts.stream().map(AttendanceWeeksetShift::getShiftId).toList(); //2.5根据shiftId查询出班次表 List shifts = attendanceShiftMapper.selectList(Wrappers.lambdaQuery().in(AttendanceShift::getId, shiftIds)); - - -// //2.5根据班次id查询出班次表 -// List shifts = attendanceShiftMapper.selectList(Wrappers.lambdaQuery().in(AttendanceShift::getId, weeksetShiftIds)); //2.6将查询后的数据封装到attendanceGroupVo中 vo.setAttendanceList(shifts); vo.setScheduleCycleList(scheduleCycles); - -// List weekSets = weekSetMapper.selectList(Wrappers.lambdaQuery().eq(AttendanceWeekSet::getGroupId, id)); -// //2.2根据id参数取出所有考勤天数id -// List weekSetIds = weekSets.stream().map(AttendanceWeekSet::getId).toList(); -// //2.3根据天数id查询出中间表 -// List scheduleCycles = attendanceScheduleCycleMapper.selectList(Wrappers.lambdaQuery().in(AttendanceScheduleCycle::getGroupId, weekSetIds)); -// //2.4根据中间表的班次id查询出班次表id -// List scheduleCycleIds = scheduleCycles.stream().map(AttendanceScheduleCycle::getId).toList(); -// //2.5根据班次id查询出班次表 -// List shifts = attendanceShiftMapper.selectList(Wrappers.lambdaQuery().in(AttendanceShift::getId, scheduleCycleIds)); -// //2.6将查询后的数据封装到attendanceGroupVo中 -// vo.setAttendanceList(shifts); } //根据id查询attendance_clock_date表 @@ -230,6 +214,7 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService { AttendanceScheduleCycle attendanceScheduleCycle = new AttendanceScheduleCycle(); attendanceScheduleCycle.setGroupId(add.getId()); attendanceScheduleCycle.setDayNumber(num.getDayNumber()); + attendanceScheduleCycle.setShiftId(num.getShiftId()); attendanceScheduleCycleMapper.insert(attendanceScheduleCycle); //获取周期表的id Long scheduleId = attendanceScheduleCycle.getId();