package com.xiaopeng.itinerary.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaopeng.api.model.operation.XpPoint;
import com.xiaopeng.itinerary.mapper.XpPointMapper;
import com.xiaopeng.itinerary.service.XpPointService;
import com.xiaopeng.itinerary.utils.TimeRangeChecker;
import com.xiaopeng.itinerary.utils.holiday.HolidayUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalTime;
/**
*
* 点位管理 服务实现类
*
*
* @author liu
* @author WuGuanFengYue
* @since 2026-02-03
*/
@Service
public class XpPointServiceImpl extends ServiceImpl implements XpPointService {
@Resource
private HolidayUtil holidayUtil;
public boolean getInTime(LocalTime now, Integer effectivePeriod, String effectiveTimePeriod){
// 2非工作日 0工作日 1节假日 3调休日
Integer holidayToday = holidayUtil.isHolidayToday();
if(effectivePeriod==1){
boolean inTime = TimeRangeChecker.isCurrentTimeInRanges(now,effectiveTimePeriod);
if (!inTime) {
return false;
}
}else if(effectivePeriod==2){
if(holidayToday!=0){
return false;
}
boolean inTime = TimeRangeChecker.isCurrentTimeInRanges(now,effectiveTimePeriod);
if (!inTime) {
return false;
}
}else if(effectivePeriod==3){
if(holidayToday!=2){
return false;
}
boolean inTime = TimeRangeChecker.isCurrentTimeInRanges(now,effectiveTimePeriod);
if (!inTime) {
return false;
}
}else if(effectivePeriod==4){
if(holidayToday!=1){
return false;
}
boolean inTime = TimeRangeChecker.isCurrentTimeInRanges(now,effectiveTimePeriod);
if (!inTime) {
return false;
}
}
return true;
}
}