|
|
@@ -1100,6 +1100,48 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 检查员工今日是否有演出
|
|
|
+ *
|
|
|
+ * @param staffId 员工ID
|
|
|
+ * @return true-今日有演出,false-今日无演出
|
|
|
+ */
|
|
|
+ private Boolean checkHasPerformanceToday(Integer staffId) {
|
|
|
+ if (staffId == null || staffId <= 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 获取今天的时间范围
|
|
|
+ TodayTimeRange todayTimeRange = getTodayTimeRange();
|
|
|
+
|
|
|
+ // 查询包含该员工的所有演出
|
|
|
+ LambdaQueryWrapper<BarPerformance> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(BarPerformance::getDeleteFlag, CommonConstant.DELETE_FLAG_UNDELETE)
|
|
|
+ .eq(BarPerformance::getReviewStatus, CommonConstant.PERFORMANCE_REVIEW_STATUS_APPROVED)
|
|
|
+ .eq(BarPerformance::getOnlineStatus, CommonConstant.PERFORMANCE_ONLINE_STATUS_ONLINE)
|
|
|
+ .like(BarPerformance::getStaffConfigIds, staffId.toString());
|
|
|
+
|
|
|
+ List<BarPerformance> performances = barPerformanceMapper.selectList(queryWrapper);
|
|
|
+
|
|
|
+ if (performances == null || performances.isEmpty()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断是否有今日的演出
|
|
|
+ for (BarPerformance performance : performances) {
|
|
|
+ if (isPerformanceToday(performance, todayTimeRange)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("检查员工今日是否有演出异常,staffId={},异常信息:{}", staffId, e.getMessage(), e);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取今天的时间范围
|
|
|
*
|
|
|
* @return 今天的时间范围对象
|
|
|
@@ -1214,14 +1256,18 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
|
|
|
List<PerformanceScheduleVo> performanceScheduleList =
|
|
|
queryPerformanceScheduleList(id);
|
|
|
|
|
|
+ // 判断今日是否有演出
|
|
|
+ Boolean hasPerformanceToday = checkHasPerformanceToday(id);
|
|
|
+
|
|
|
// 构建返回对象
|
|
|
StoreStaffDetailWithPerformanceVo result =
|
|
|
new StoreStaffDetailWithPerformanceVo();
|
|
|
result.setStaffInfo(staffConfig);
|
|
|
result.setPerformanceScheduleList(performanceScheduleList);
|
|
|
+ result.setHasPerformanceToday(hasPerformanceToday);
|
|
|
|
|
|
- log.info("查询员工详情(包含演出列表)成功,id={},演出安排数量:{}",
|
|
|
- id, performanceScheduleList != null ? performanceScheduleList.size() : 0);
|
|
|
+ log.info("查询员工详情(包含演出列表)成功,id={},演出安排数量:{},今日是否有演出:{}",
|
|
|
+ id, performanceScheduleList != null ? performanceScheduleList.size() : 0, hasPerformanceToday);
|
|
|
return result;
|
|
|
} catch (Exception e) {
|
|
|
log.error("查询员工详情(包含演出列表)异常,id={},异常信息:{}", id, e.getMessage(), e);
|
|
|
@@ -1353,6 +1399,13 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ // 获取演出时间(使用dailyStartTime和dailyEndTime)
|
|
|
+ java.time.LocalTime dailyStartTime = performance.getDailyStartTime();
|
|
|
+ java.time.LocalTime dailyEndTime = performance.getDailyEndTime();
|
|
|
+ if (dailyStartTime == null || dailyEndTime == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 确定查询的起始日期(取今天和演出开始日期的较大者)
|
|
|
Date queryStart = dailyStart.before(todayStart) ? todayStart : dailyStart;
|
|
|
// 确定查询的结束日期(取未来30天和演出结束日期的较小者)
|
|
|
@@ -1367,13 +1420,12 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
|
|
|
cal.setTime(queryStart);
|
|
|
while (!cal.getTime().after(queryEnd)) {
|
|
|
Date currentDate = cal.getTime();
|
|
|
- // 这里需要从演出信息中获取时间,但BarPerformance中没有存储具体时间
|
|
|
- // 假设使用singleStartDatetime和singleEndDatetime的时间部分
|
|
|
- Date scheduleStart = combineDateAndTime(currentDate, performance.getSingleStartDatetime());
|
|
|
- Date scheduleEnd = combineDateAndTime(currentDate, performance.getSingleEndDatetime());
|
|
|
+ // 使用dailyStartTime和dailyEndTime
|
|
|
+ Date scheduleStart = combineDateAndLocalTime(currentDate, dailyStartTime);
|
|
|
+ Date scheduleEnd = combineDateAndLocalTime(currentDate, dailyEndTime);
|
|
|
|
|
|
- // 如果结束时间小于开始时间,说明跨天了
|
|
|
- if (scheduleEnd.before(scheduleStart)) {
|
|
|
+ // 如果结束时间小于或等于开始时间,说明跨天了
|
|
|
+ if (!scheduleEnd.after(scheduleStart)) {
|
|
|
java.util.Calendar endCal = java.util.Calendar.getInstance();
|
|
|
endCal.setTime(scheduleEnd);
|
|
|
endCal.add(java.util.Calendar.DAY_OF_MONTH, 1);
|
|
|
@@ -1405,6 +1457,13 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ // 获取演出时间(使用dailyStartTime和dailyEndTime)
|
|
|
+ java.time.LocalTime dailyStartTime = performance.getDailyStartTime();
|
|
|
+ java.time.LocalTime dailyEndTime = performance.getDailyEndTime();
|
|
|
+ if (dailyStartTime == null || dailyEndTime == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 确定查询的起始日期
|
|
|
Date queryStart = weeklyStart.before(todayStart) ? todayStart : weeklyStart;
|
|
|
// 确定查询的结束日期
|
|
|
@@ -1434,11 +1493,12 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
|
|
|
|
|
|
if (weekDaySet.contains(todayWeekDayStr)) {
|
|
|
Date currentDate = cal.getTime();
|
|
|
- Date scheduleStart = combineDateAndTime(currentDate, performance.getSingleStartDatetime());
|
|
|
- Date scheduleEnd = combineDateAndTime(currentDate, performance.getSingleEndDatetime());
|
|
|
+ // 使用dailyStartTime和dailyEndTime
|
|
|
+ Date scheduleStart = combineDateAndLocalTime(currentDate, dailyStartTime);
|
|
|
+ Date scheduleEnd = combineDateAndLocalTime(currentDate, dailyEndTime);
|
|
|
|
|
|
- // 如果结束时间小于开始时间,说明跨天了
|
|
|
- if (scheduleEnd.before(scheduleStart)) {
|
|
|
+ // 如果结束时间小于或等于开始时间,说明跨天了
|
|
|
+ if (!scheduleEnd.after(scheduleStart)) {
|
|
|
java.util.Calendar endCal = java.util.Calendar.getInstance();
|
|
|
endCal.setTime(scheduleEnd);
|
|
|
endCal.add(java.util.Calendar.DAY_OF_MONTH, 1);
|
|
|
@@ -1542,6 +1602,35 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
|
|
|
return dateCal.getTime();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 合并日期和LocalTime
|
|
|
+ *
|
|
|
+ * @param date 日期
|
|
|
+ * @param localTime 时间(LocalTime类型)
|
|
|
+ * @return 合并后的日期时间
|
|
|
+ */
|
|
|
+ private Date combineDateAndLocalTime(Date date, java.time.LocalTime localTime) {
|
|
|
+ if (date == null || localTime == null) {
|
|
|
+ return date;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 将Date转换为LocalDateTime
|
|
|
+ java.time.Instant instant = date.toInstant();
|
|
|
+ java.time.ZoneId zoneId = java.time.ZoneId.systemDefault();
|
|
|
+ java.time.LocalDate localDate = instant.atZone(zoneId).toLocalDate();
|
|
|
+
|
|
|
+ // 合并日期和时间
|
|
|
+ java.time.LocalDateTime localDateTime = localDate.atTime(localTime);
|
|
|
+
|
|
|
+ // 转换回Date
|
|
|
+ return Date.from(localDateTime.atZone(zoneId).toInstant());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("合并日期和LocalTime异常,date={},localTime={},异常信息:{}", date, localTime, e.getMessage(), e);
|
|
|
+ return date;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<StoreStaffConfig> getFoodStaffConfigList(int page, int size, Integer storeId, String staffPosition, String status) {
|
|
|
IPage<StoreStaffConfig> storePage = new Page<>(page, size);
|