新增排班问题处理
This commit is contained in:
@@ -55,12 +55,12 @@ public class AttendanceArrangement extends TenantEntity {
|
|||||||
/**
|
/**
|
||||||
* 开始日期
|
* 开始日期
|
||||||
*/
|
*/
|
||||||
private LocalDate startDate;
|
private Date startDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结束日期(仅date_type=3时有效)
|
* 结束日期(仅date_type=3时有效)
|
||||||
*/
|
*/
|
||||||
private LocalDate endDate;
|
private Date endDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态:0-未生效,1-已生效
|
* 状态:0-未生效,1-已生效
|
||||||
|
@@ -9,6 +9,7 @@ import io.github.linpeilie.annotations.AutoMapper;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
|
import org.dromara.property.domain.AttendanceScheduleCycle;
|
||||||
import org.dromara.property.domain.AttendanceUserGroup;
|
import org.dromara.property.domain.AttendanceUserGroup;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ public class AttendanceArrangementBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 日期类型:1-单个日期,2-长期有效,3-期间有效
|
* 日期类型:1-单个日期,2-长期有效,3-期间有效
|
||||||
*/
|
*/
|
||||||
private Long dateType;
|
private Integer dateType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始日期
|
* 开始日期
|
||||||
@@ -69,8 +70,8 @@ public class AttendanceArrangementBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 前端传日历的开始时间和结束时间
|
* 前端传日历的开始时间和结束时间
|
||||||
*/
|
*/
|
||||||
private LocalDate calendarStartDate;
|
private Date calendarStartDate;
|
||||||
private LocalDate calendarEndTimeDate;
|
private Date calendarEndTimeDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 前端传某天的当前日期
|
* 前端传某天的当前日期
|
||||||
@@ -83,7 +84,15 @@ public class AttendanceArrangementBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Long status;
|
private Long status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 排班用户组
|
||||||
|
*/
|
||||||
private List<AttendanceUserGroup> userGroupList;
|
private List<AttendanceUserGroup> userGroupList;
|
||||||
|
/**
|
||||||
|
* 排班日期列表
|
||||||
|
*/
|
||||||
|
private List<AttendanceScheduleCycle> scheduleCycleList;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,5 +28,11 @@ public class StatusConstant {
|
|||||||
|
|
||||||
public static final Integer NORMAL = 1;
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@ import org.dromara.property.domain.*;
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@@ -60,13 +60,13 @@ public class AttendanceArrangementVo implements Serializable {
|
|||||||
* 开始日期
|
* 开始日期
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "开始日期")
|
@ExcelProperty(value = "开始日期")
|
||||||
private LocalDate startDate;
|
private Date startDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结束日期(仅date_type=3时有效)
|
* 结束日期(仅date_type=3时有效)
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "结束日期(仅date_type=3时有效)")
|
@ExcelProperty(value = "结束日期(仅date_type=3时有效)")
|
||||||
private LocalDate endDate;
|
private Date endDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态:0-未生效,1-已生效
|
* 状态:0-未生效,1-已生效
|
||||||
|
@@ -19,6 +19,8 @@ import org.dromara.property.service.IAttendanceArrangementService;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -75,6 +77,9 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
|
|||||||
LambdaQueryWrapper<AttendanceArrangement> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<AttendanceArrangement> lqw = buildQueryWrapper(bo);
|
||||||
Page<AttendanceArrangementVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<AttendanceArrangementVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
|
||||||
|
|
||||||
|
Page<AttendanceArrangementVo> attendanceArrangementVoPage = result.setRecords(result.getRecords().stream().peek(vo -> {
|
||||||
|
|
||||||
//1.如:在2号到10号有固定班制和排班制,根据当前日期查询出所有的考勤组id
|
//1.如:在2号到10号有固定班制和排班制,根据当前日期查询出所有的考勤组id
|
||||||
//查询指定日期在哪些排班中
|
//查询指定日期在哪些排班中
|
||||||
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()));
|
||||||
@@ -132,6 +137,9 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
}).collect(Collectors.toList()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// //1.根据当前日期查询出排班信息
|
// //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) {
|
if (flag) {
|
||||||
bo.setId(add.getId());
|
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
|
//取出当前新增的排班的id
|
||||||
Long ArrangementId = add.getId();
|
Long ArrangementId = add.getId();
|
||||||
//用获取到的排班id向attendanceUserGroup表中插入数据
|
//用获取到的排班id向attendanceUserGroup表中插入数据
|
||||||
|
Reference in New Issue
Block a user