面谈/面试
This commit is contained in:
@@ -69,6 +69,7 @@ public class CommonConstants {
|
||||
|
||||
public static final String PATH_SPILT = "/";
|
||||
public static final String PATH_BAR = "-";
|
||||
public static final String COLON = ":";
|
||||
public static final String ROOT_REGION_PATH = "/1/";
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.cool.store.enums;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: AppointmentStatusEnum
|
||||
* @Description:预约状态
|
||||
* @date 2024-03-15 16:15
|
||||
*/
|
||||
public enum AppointmentStatusEnum {
|
||||
|
||||
//状态 0:不可预约 1:已被预约 2:可预约
|
||||
NOT_APPOINTMENT(0, "不可预约"),
|
||||
APPOINTMENT(1, "已被预约"),
|
||||
CAN_APPOINTMENT(2, "可预约"),
|
||||
;
|
||||
private Integer code;
|
||||
private String message;
|
||||
|
||||
|
||||
AppointmentStatusEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.cool.store.enums;
|
||||
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: InterviewTypeEnum
|
||||
* @Description:
|
||||
* @date 2024-03-15 16:12
|
||||
*/
|
||||
public enum InterviewTypeEnum {
|
||||
|
||||
MEET(0, "面谈", 120, 8, 19),
|
||||
|
||||
INTERVIEW(1, "面试", 30, 9, 18),
|
||||
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String message;
|
||||
|
||||
private Integer minute;
|
||||
|
||||
private Integer startHour;
|
||||
|
||||
private Integer endHour;
|
||||
|
||||
InterviewTypeEnum(Integer code, String message, Integer minute, Integer startHour, Integer endHour) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.minute = minute;
|
||||
this.startHour = startHour;
|
||||
this.endHour = endHour;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public Integer getMinute() {
|
||||
return minute;
|
||||
}
|
||||
|
||||
public static InterviewTypeEnum match(Integer code) {
|
||||
for (InterviewTypeEnum type : InterviewTypeEnum.values()) {
|
||||
if (type.getCode().equals(code)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Pair<String, Boolean>> getTimeSlots(InterviewTypeEnum interviewType, LocalDate localDate) {
|
||||
switch (interviewType) {
|
||||
case MEET:
|
||||
return getTimeSlots(localDate, InterviewTypeEnum.MEET);
|
||||
case INTERVIEW:
|
||||
return getTimeSlots(localDate, InterviewTypeEnum.INTERVIEW);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static List<Pair<String, Boolean>> getTimeSlots(LocalDate date, InterviewTypeEnum interviewTypeEnum) {
|
||||
List<Pair<String, Boolean>> result = new ArrayList<>();
|
||||
LocalDateTime start = LocalDateTime.of(date, LocalTime.of(interviewTypeEnum.startHour, CommonConstants.ZERO));
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
while (start.getHour() < interviewTypeEnum.endHour){
|
||||
String time = start.getHour() + CommonConstants.COLON + (start.getMinute() < CommonConstants.TEN ? "0"+ start.getMinute() : start.getMinute());
|
||||
boolean isAvailable = start.isAfter(now);
|
||||
start = start.plusMinutes(interviewTypeEnum.minute);
|
||||
time = time + CommonConstants.PATH_BAR + start.getHour() + CommonConstants.COLON + (start.getMinute() < CommonConstants.TEN ? "0"+ start.getMinute() : start.getMinute());
|
||||
result.add(Pair.of(time, isAvailable));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getTimeSlots(LocalDate.now(), InterviewTypeEnum.INTERVIEW));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user