|
|
|
|
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.klp.common.utils.StringUtils;
|
|
|
|
|
import com.klp.domain.vo.WmsAttendanceShiftRuleVo;
|
|
|
|
|
import com.klp.domain.vo.WmsAttendanceShiftVo;
|
|
|
|
|
import com.klp.domain.WmsEmployeeInfo;
|
|
|
|
|
import com.klp.mapper.WmsEmployeeInfoMapper;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -42,6 +44,7 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
|
|
|
|
private final WmsAttendanceScheduleMapper baseMapper;
|
|
|
|
|
private final IWmsAttendanceShiftRuleService shiftRuleService;
|
|
|
|
|
private final IWmsAttendanceShiftService shiftService;
|
|
|
|
|
private final WmsEmployeeInfoMapper employeeInfoMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询排班(谁在哪天上班)
|
|
|
|
|
@@ -65,7 +68,7 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public TableDataInfo<WmsAttendanceScheduleVo> queryPageList(WmsAttendanceScheduleBo bo, PageQuery pageQuery) {
|
|
|
|
|
// 1. 构建 MP 标准分页对象
|
|
|
|
|
resolveEmployeeNameAndDept(bo);
|
|
|
|
|
Page<WmsAttendanceScheduleVo> page = pageQuery.build();
|
|
|
|
|
|
|
|
|
|
// 2. 调用 Mapper
|
|
|
|
|
@@ -80,10 +83,35 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<WmsAttendanceScheduleVo> queryList(WmsAttendanceScheduleBo bo) {
|
|
|
|
|
resolveEmployeeNameAndDept(bo);
|
|
|
|
|
return baseMapper.selectScheduleWithDetails(bo.getUserId(), bo.getWorkDate(), bo.getShiftId(),
|
|
|
|
|
bo.getStartDate(), bo.getEndDate(), bo.getUserIds());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void resolveEmployeeNameAndDept(WmsAttendanceScheduleBo bo) {
|
|
|
|
|
boolean hasName = StringUtils.isNotBlank(bo.getEmployeeName());
|
|
|
|
|
boolean hasDept = StringUtils.isNotBlank(bo.getEmployeeDept());
|
|
|
|
|
if (!hasName && !hasDept) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
LambdaQueryWrapper<WmsEmployeeInfo> qw = Wrappers.lambdaQuery();
|
|
|
|
|
qw.select(WmsEmployeeInfo::getInfoId);
|
|
|
|
|
if (hasName) {
|
|
|
|
|
qw.like(WmsEmployeeInfo::getName, bo.getEmployeeName());
|
|
|
|
|
}
|
|
|
|
|
if (hasDept) {
|
|
|
|
|
qw.like(WmsEmployeeInfo::getDept, bo.getEmployeeDept());
|
|
|
|
|
}
|
|
|
|
|
List<Long> ids = employeeInfoMapper.selectList(qw).stream()
|
|
|
|
|
.map(WmsEmployeeInfo::getInfoId)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
if (ids.isEmpty()) {
|
|
|
|
|
bo.setUserIds(java.util.Collections.singletonList(-1L));
|
|
|
|
|
} else {
|
|
|
|
|
bo.setUserIds(ids);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增排班(谁在哪天上班)
|
|
|
|
|
*/
|
|
|
|
|
|