预约时间列表增加是否本人预约时段字段

This commit is contained in:
feng.li
2023-11-09 16:19:02 +08:00
parent 80f0f5b6d2
commit ff86296106
6 changed files with 48 additions and 11 deletions

View File

@@ -27,7 +27,7 @@ public class HyPartnerInterviewBookSituation {
@ApiModelProperty("预约的面试结束时间")
private String endTime;
@ApiModelProperty("是否已被预定")
@ApiModelProperty("是否已被预定成功")
private Boolean booked;
@ApiModelProperty("预约成功人的 partnerId")

View File

@@ -85,7 +85,7 @@ public class PartnerInterviewInfoVO {
@ApiModelProperty("来源名称")
private String userChannelName;
@ApiModelProperty("是否已被预约")
@ApiModelProperty("是否已被预约成功")
private Boolean booked;
@ApiModelProperty("该时间段面试预约人数")

View File

@@ -27,7 +27,7 @@ public class CalendarInfo {
@ApiModelProperty("日期字符串")
private String dateStr;
@ApiModelProperty("飞书日程忙闲清单")
@ApiModelProperty("忙闲清单")
private List<FreeBusyInfo> freeBusyList;
public CalendarInfo(Integer dayOfWeek, String year, String month, String day, String dateStr, List<FreeBusyInfo> freeBusyList) {

View File

@@ -20,9 +20,12 @@ public class FreeBusyInfo {
@ApiModelProperty("预约人数")
private Integer appointmentCount;
@ApiModelProperty("是否被预约")
@ApiModelProperty("是否被成功预约")
private Boolean booked;
@ApiModelProperty("是否是自己预约的时间段")
private Boolean selfBooked;
public FreeBusyInfo(String startTime, String endTime, boolean free) {
this.startTime = startTime;
this.endTime = endTime;
@@ -42,6 +45,15 @@ public class FreeBusyInfo {
this.booked = booked;
}
public FreeBusyInfo(String startTime, String endTime, boolean free, Integer appointmentCount, Boolean booked, Boolean selfBooked) {
this.startTime = startTime;
this.endTime = endTime;
this.free = free;
this.appointmentCount = appointmentCount;
this.booked = booked;
this.selfBooked = selfBooked;
}
public String getStartTime() {
return startTime;
}
@@ -81,4 +93,16 @@ public class FreeBusyInfo {
public void setBooked(Boolean booked) {
this.booked = booked;
}
public boolean isFree() {
return free;
}
public Boolean getSelfBooked() {
return selfBooked;
}
public void setSelfBooked(Boolean selfBooked) {
this.selfBooked = selfBooked;
}
}

View File

@@ -39,6 +39,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@@ -728,6 +729,17 @@ public class InterviewServiceImpl implements InterviewService {
String startTimeStr = DateUtil.format(startDateTime, "yyyy-MM-dd") + startTimeSuffix;
String endTimeStr = DateUtil.format(endDateTime, "yyyy-MM-dd") + endTimeSuffix;
List<HyPartnerInterviewBookSituation> bookSituations = hyPartnerInterviewPlanMapper.getInterviewBookSituation(interviewerId, startTimeStr, endTimeStr);
//2.2 查询该线索已有的面试预约开始时间
HyPartnerInterviewPlanDO interviewPlanDO = new HyPartnerInterviewPlanDO();
interviewPlanDO.setPartnerId(request.getPartnerId());
interviewPlanDO.setDeleted(false);
List<HyPartnerInterviewPlanDO> hyPartnerInterviewPlanDOS = hyPartnerInterviewPlanMapper.selectBySelective(interviewPlanDO);
String partnerAppointStartTime = "";
if (CollectionUtils.isNotEmpty(hyPartnerInterviewPlanDOS)) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
interviewPlanDO = hyPartnerInterviewPlanDOS.get(0);
partnerAppointStartTime = dateFormat.format(interviewPlanDO.getStartTime());
}
//3. 把数据装到各个时间槽里
//3.1 创建时间槽
@@ -758,8 +770,9 @@ public class InterviewServiceImpl implements InterviewService {
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.setBooked(bookSituation.getBooked());
freeBusyInfo.setSelfBooked(partnerAppointStartTime.equals(bookSituation.getStartTime()));
freeBusyInfo.setFree(!bookSituation.getBooked());
freeBusyInfo.setAppointmentCount(bookSituation.getBookingCount());
bookSituations.remove(bookSituation);
break;

View File

@@ -89,7 +89,7 @@ public class TimeSlotGenerator {
String startTime = String.format("%02d:00", hour);
String endTime = String.format("%02d:00", hour + 1);
//默认空闲
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true, 0, false);
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true, 0, false, false);
hourSlots.add(hourSlot);
}
@@ -107,13 +107,13 @@ public class TimeSlotGenerator {
String startTime = String.format("%02d:00", hour);
String endTime = String.format("%02d:30", hour);
//默认空闲
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true, 0, false);
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true, 0, false, false);
hourSlots.add(hourSlot);
String startTime2 = String.format("%02d:30", hour);
String endTime2 = String.format("%02d:00", hour + 1);
//默认空闲
FreeBusyInfo hourSlot2 = new FreeBusyInfo(startTime2, endTime2, true, 0, false);
FreeBusyInfo hourSlot2 = new FreeBusyInfo(startTime2, endTime2, true, 0, false, false);
hourSlots.add(hourSlot2);
}
return hourSlots;
@@ -127,13 +127,13 @@ public class TimeSlotGenerator {
String startTime = String.format("%02d:00", hour);
String endTime = String.format("%02d:30", hour);
//默认空闲
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true, 0, false);
FreeBusyInfo hourSlot = new FreeBusyInfo(startTime, endTime, true, 0, false, false);
hourSlots.add(hourSlot);
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);
FreeBusyInfo hourSlot2 = new FreeBusyInfo(startTime2, endTime2, true, 0, false, false);
hourSlots.add(hourSlot2);
}
return hourSlots;