查询预约时间段预约情况返回时间格式修改&查询SQL错误修改

This commit is contained in:
feng.li
2023-11-08 17:49:21 +08:00
parent f1c458a280
commit e0577b1ddc
3 changed files with 30 additions and 30 deletions

View File

@@ -753,14 +753,15 @@ public class InterviewServiceImpl implements InterviewService {
List<FreeBusyInfo> freeBusyList = daySlot.getFreeBusyList();
for (FreeBusyInfo freeBusyInfo : freeBusyList) {
//把日期和时间拼接成yyyy-MM-dd HH:mm格式
String startStr = daySlot.getDateStr() + " " + freeBusyInfo.getStartTime();
String endStr = daySlot.getDateStr() + " " + freeBusyInfo.getEndTime();
String startStr = daySlot.getDateStr() + " " + freeBusyInfo.getStartTime() + ":00";
String endStr = daySlot.getDateStr() + " " + freeBusyInfo.getEndTime() + ":00";
for (HyPartnerInterviewBookSituation bookSituation : bookSituations) {
//比较两个时间段是否有重叠,重叠的就 set 数据进去
if (startStr.compareTo(bookSituation.getStartTime()) >= 0 && endStr.compareTo(bookSituation.getEndTime()) <= 0) {
freeBusyInfo.setFree(Boolean.FALSE);
freeBusyInfo.setBooked(Boolean.TRUE);
freeBusyInfo.setAppointmentCount(bookSituation.getBookingCount());
bookSituations.remove(bookSituation);
break;
}
}

View File

@@ -86,8 +86,8 @@ public class TimeSlotGenerator {
List<FreeBusyInfo> hourSlots = new ArrayList<>();
for (int hour = 10; hour < 17; hour++) {
String startTime = String.format("%02d:00:00", hour);
String endTime = String.format("%02d:00:00", hour + 1);
String startTime = String.format("%02d:00", hour);
String endTime = String.format("%02d:00", hour + 1);
//默认空闲
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true, 0, false);
hourSlots.add(hourSlot);
@@ -104,14 +104,14 @@ public class TimeSlotGenerator {
if(hour == 12){
continue;
}
String startTime = String.format("%02d:00:00", hour);
String endTime = String.format("%02d:30:00", hour);
String startTime = String.format("%02d:00", hour);
String endTime = String.format("%02d:30", hour);
//默认空闲
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true, 0, false);
hourSlots.add(hourSlot);
String startTime2 = String.format("%02d:30:00", hour);
String endTime2 = String.format("%02d:00:00", hour + 1);
String startTime2 = String.format("%02d:30", hour);
String endTime2 = String.format("%02d:00", hour + 1);
//默认空闲
FreeBusyInfo hourSlot2 = new FreeBusyInfo(startTime2, endTime2, true, 0, false);
hourSlots.add(hourSlot2);
@@ -124,14 +124,14 @@ public class TimeSlotGenerator {
//循环打印半小时的时间段
for (int hour = 8; hour < 24; hour++) {
String startTime = String.format("%02d:00:00", hour);
String endTime = String.format("%02d:30:00", hour);
String startTime = String.format("%02d:00", hour);
String endTime = String.format("%02d:30", hour);
//默认空闲
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true, 0, false);
hourSlots.add(hourSlot);
String startTime2 = String.format("%02d:30:00", hour);
String endTime2 = String.format("%02d:00:00", hour + 1);
String startTime2 = String.format("%02d:30", hour);
String endTime2 = String.format("%02d:00", hour + 1);
//默认空闲,预约人数为 0
FreeBusyInfo hourSlot2 = new FreeBusyInfo(startTime2, endTime2, true, 0, false);
hourSlots.add(hourSlot2);