Commit 0e0655f1 by wuwenlong

脏房到次日门店保洁时段锁定房间状态不可预定,如果没有设置门店保洁时段则只锁定当日

parent 0ead1888
......@@ -24,6 +24,8 @@ public class RoomStatusServiceImpl implements RoomStatusService {
private final static String[] LOCKS = {"0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23"};
private final static String DefaultCleaningPeriod = "00:00";
@Autowired
private ISStoreService storeService;
......@@ -139,27 +141,31 @@ public class RoomStatusServiceImpl implements RoomStatusService {
}
private void checkIsDirtyRoom(RoomStatusVo vo,Date timeHourDate, SStore store, SCleanRecords cleanRecords, String day){
CleaningStatusEnum cleaningStatusEnum = null;
if (Objects.isNull(cleanRecords)) {
return;
}
cleaningStatusEnum = CleaningStatusEnum.getEnumByCode(cleanRecords.getStatus());
String cleaningPeriod = StringUtils.isNotBlank(store.getCleaningPeriod())?store.getCleaningPeriod():DefaultCleaningPeriod;
CleaningStatusEnum cleaningStatusEnum = CleaningStatusEnum.getEnumByCode(cleanRecords.getStatus());
Boolean isHold = false;
switch (cleaningStatusEnum){
case UNCLEAN:
case CLEANING:
//当天
if(StringUtils.equals(day,DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,DateUtils.getNowDate()))){
vo.setStatus(RoomStatusEnum.HOLD.getValue());
changeStartHoldTime(vo,timeHourDate);
changeEndHoldTime(vo,DateUtils.addSeconds(timeHourDate, 59 * 60 + 59));
if(DateUtils.getNowDate().getTime() < DateUtils.parseDate(day+" "+cleaningPeriod).getTime()) {
if (timeHourDate.getTime() < DateUtils.parseDate(day + " " + cleaningPeriod).getTime()) {
isHold = true;
}
}else{
isHold = true;
}
}
//次日
if(StringUtils.equals(day,DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,DateUtils.addDays(DateUtils.getNowDate(),1)))){
if(StringUtils.isNotBlank(store.getCleaningPeriod())
&&timeHourDate.getTime()<DateUtils.parseDate(day+" "+store.getCleaningPeriod()).getTime()){
vo.setStatus(RoomStatusEnum.HOLD.getValue());
changeStartHoldTime(vo,timeHourDate);
changeEndHoldTime(vo,DateUtils.addSeconds(timeHourDate, 59 * 60 + 59));
if(DateUtils.getNowDate().getTime() >= DateUtils.parseDate(DateUtils.parseDateToStr(
DateUtils.YYYY_MM_DD,DateUtils.getNowDate())+" "+cleaningPeriod).getTime()
&& timeHourDate.getTime() < DateUtils.parseDate(day+" "+cleaningPeriod).getTime()){
isHold = true;
}
}
break;
......@@ -168,6 +174,11 @@ public class RoomStatusServiceImpl implements RoomStatusService {
default:
break;
}
if(isHold){
vo.setStatus(RoomStatusEnum.HOLD.getValue());
changeStartHoldTime(vo, timeHourDate);
changeEndHoldTime(vo, DateUtils.addSeconds(timeHourDate, 59 * 60 + 59));
}
}
private void changeEndHoldTime(RoomStatusVo vo, Date date){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment