排班按月查询bug修改
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:
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.beanutils.BeanUtils;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
@@ -82,8 +83,12 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
|
|||||||
|
|
||||||
Page<AttendanceArrangementVo> attendanceArrangementVoPage = result.setRecords(result.getRecords().stream().peek(vo -> {
|
Page<AttendanceArrangementVo> attendanceArrangementVoPage = result.setRecords(result.getRecords().stream().peek(vo -> {
|
||||||
//1.根据当前日期查询在开始时间和结束时间之间的排班信息
|
//1.根据当前日期查询在开始时间和结束时间之间的排班信息
|
||||||
//查询指定日期在哪些排班中,并返回arrangementList
|
//查询指定日期查询在哪些排班中,并返回arrangementList
|
||||||
List<AttendanceArrangement> arrangementList = baseMapper.selectList(Wrappers.<AttendanceArrangement>lambdaQuery().ge(AttendanceArrangement::getStartDate, bo.getCurrentDate()).le(AttendanceArrangement::getEndDate, bo.getCurrentDate()));
|
List<AttendanceArrangement> arrangementList = baseMapper.selectList(
|
||||||
|
Wrappers.<AttendanceArrangement>lambdaQuery()
|
||||||
|
.ge(AttendanceArrangement::getStartDate, bo.getCurrentDate())
|
||||||
|
.le(AttendanceArrangement::getEndDate, bo.getCurrentDate())
|
||||||
|
);
|
||||||
//根据排班查询出考勤组id
|
//根据排班查询出考勤组id
|
||||||
List<Long> groupIds = arrangementList.stream().map(AttendanceArrangement::getGroupId).distinct().toList();
|
List<Long> groupIds = arrangementList.stream().map(AttendanceArrangement::getGroupId).distinct().toList();
|
||||||
|
|
||||||
@@ -191,17 +196,11 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
|
|||||||
.between(AttendanceArrangement::getStartDate, date.atStartOfDay(ZoneId.systemDefault()).toInstant(),
|
.between(AttendanceArrangement::getStartDate, date.atStartOfDay(ZoneId.systemDefault()).toInstant(),
|
||||||
date.atStartOfDay(ZoneId.systemDefault()).plusDays(1).toInstant().minusSeconds(1)));
|
date.atStartOfDay(ZoneId.systemDefault()).plusDays(1).toInstant().minusSeconds(1)));
|
||||||
|
|
||||||
|
// //根据arrangementList查询出排班的id
|
||||||
|
// List<Long> scheduleIdList = arrangementList.stream().map(AttendanceArrangement::getId).toList();
|
||||||
|
// //根据排班的id查询出排班的人员详细信息
|
||||||
|
// List<AttendanceUserGroup> userGroupList = userGroupMapper.selectList(Wrappers.<AttendanceUserGroup>lambdaQuery().in(AttendanceUserGroup::getScheduleId, scheduleIdList));
|
||||||
|
|
||||||
//查询出的多个排班进行循环,取出所有的考勤组
|
|
||||||
arrangementList.forEach(arrangement -> {
|
|
||||||
// // 2.3 根据排班查询出考勤组id
|
|
||||||
// List<Long> groupIds = arrangementList.stream()
|
|
||||||
// .map(AttendanceArrangement::getGroupId)
|
|
||||||
// .distinct()
|
|
||||||
// .toList();
|
|
||||||
//将考勤组信息添加到排班信息中
|
|
||||||
result.add(MapstructUtils.convert(arrangement, AttendanceArrangementVo.class));
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// 根据排班查询出考勤组id
|
// 根据排班查询出考勤组id
|
||||||
@@ -221,25 +220,32 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
|
|||||||
if (attendanceGroup != null) {
|
if (attendanceGroup != null) {
|
||||||
// 创建 AttendanceArrangementVo 对象并设置属性
|
// 创建 AttendanceArrangementVo 对象并设置属性
|
||||||
AttendanceArrangementVo vo = new AttendanceArrangementVo();
|
AttendanceArrangementVo vo = new AttendanceArrangementVo();
|
||||||
//vo中设置开始时间和结束时间分别加一天
|
vo.setStartDate(arrangementList.get(0).getStartDate());
|
||||||
vo.setStartDate(date.plusDays(1));
|
vo.setEndDate(arrangementList.get(0).getEndDate());
|
||||||
vo.setEndDate(date.plusDays(1));
|
|
||||||
|
//获取到第一个排班的id
|
||||||
|
Long arrangementId = arrangementList.get(0).getId();
|
||||||
|
//根据arrangementId查询出人员组的详细信息
|
||||||
|
AttendanceGroup group = attendanceGroupMapper.selectById(arrangementId);
|
||||||
|
//将group存到vo中
|
||||||
|
vo.setAttendanceGroup(group);
|
||||||
|
|
||||||
|
//根据arrangementList查询出排班的id
|
||||||
|
List<Long> scheduleIdList = arrangementList.stream().map(AttendanceArrangement::getId).distinct().toList();
|
||||||
|
//根据排班的id查询出排班的人员详细信息
|
||||||
|
List<AttendanceUserGroup> userGroupList = userGroupMapper.selectList(Wrappers.<AttendanceUserGroup>lambdaQuery().in(AttendanceUserGroup::getScheduleId, scheduleIdList));
|
||||||
|
|
||||||
|
|
||||||
//新建attendanceGroup对象,将排班信息和考勤组信息添加到vo中
|
//新建attendanceGroup对象,将排班信息和考勤组信息添加到vo中
|
||||||
vo.setAttendanceGroup(attendanceGroup);
|
vo.setAttendanceGroup(attendanceGroup);
|
||||||
|
//将排班人员信息添加到排班信息中
|
||||||
|
vo.setUserGroupList(userGroupList);
|
||||||
|
|
||||||
result.add(vo);
|
result.add(vo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果 collected 不为空,则返回 result
|
|
||||||
if (result.isEmpty()) {
|
|
||||||
return TableDataInfo.build();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 循环结束后如果 result 仍为空,则返回空列表
|
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
|
|
||||||
// // 计算交集的开始时间(取较晚的开始时间)和结束时间(取较早的结束时间)
|
// // 计算交集的开始时间(取较晚的开始时间)和结束时间(取较早的结束时间)
|
||||||
@@ -265,6 +271,7 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
|
|||||||
lqw.eq(bo.getStartDate() != null, AttendanceArrangement::getStartDate, bo.getStartDate());
|
lqw.eq(bo.getStartDate() != null, AttendanceArrangement::getStartDate, bo.getStartDate());
|
||||||
lqw.eq(bo.getEndDate() != null, AttendanceArrangement::getEndDate, bo.getEndDate());
|
lqw.eq(bo.getEndDate() != null, AttendanceArrangement::getEndDate, bo.getEndDate());
|
||||||
lqw.eq(bo.getStatus() != null, AttendanceArrangement::getStatus, bo.getStatus());
|
lqw.eq(bo.getStatus() != null, AttendanceArrangement::getStatus, bo.getStatus());
|
||||||
|
// lqw.eq(bo.getCurrentDate() != null, AttendanceArrangement::getCurrentDate, bo.getCurrentDate());
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user