Commit 9d34d6ce by 吕明尚

Merge remote-tracking branch 'origin/dev' into dev

parents f3f93af5 bf6d268c
......@@ -15,6 +15,15 @@ public enum CleaningStatusEnum {
CleaningStatusEnum() {
}
public static CleaningStatusEnum getEnumByCode(Integer code) {
for (CleaningStatusEnum status : CleaningStatusEnum.values()) {
if (status.getCode().compareTo(code)==0) {
return status;
}
}
return null;
}
public Integer getCode() {
return code;
}
......
......@@ -120,12 +120,40 @@ public class RoomStatusServiceImpl implements RoomStatusService {
//设置时间段房间可预约状态(可预约:大于营业开始时间,小于营业结束时间,大于当前时间,当前时间没有订单)
private void setTimeHourStatus(RoomStatusVo vo,Date timeHourDate, SStore store, List<SOrder> orderList, SCleanRecords cleanRecords, String day, String finalNowTime, Boolean isToday, Integer orderType, SConsumer user){
vo.setStatus(RoomStatusEnum.FREE.getValue());
checkIsDirtyRoom(vo,timeHourDate,store,cleanRecords,day);
checkTimeHourToSysDate(vo,timeHourDate,day,finalNowTime,isToday);
checkTimeHourToBusiness(vo,timeHourDate,store,day);
checkTimeHourToOrder(vo,timeHourDate,orderList,cleanRecords,orderType, user);
}
private void checkIsDirtyRoom(RoomStatusVo vo,Date timeHourDate, SStore store, SCleanRecords cleanRecords, String day){
CleaningStatusEnum cleaningStatusEnum = CleaningStatusEnum.getEnumByCode(cleanRecords.getStatus());
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(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));
}
}
break;
case CLEANED:
break;
default:
break;
}
}
private void changeEndHoldTime(RoomStatusVo vo, Date date){
if(Objects.isNull(vo.getEndHoldTime())||vo.getEndHoldTime().compareTo(date)<0){
vo.setEndHoldTime(date);
......
......@@ -428,7 +428,7 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
public SCleanRecords lastCleanByRoomId(Long roomId) {
LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SCleanRecords::getRoomId, roomId);
queryWrapper.gt(SCleanRecords::getCreateTime,DateUtils.addDays(new Date(),-1));
queryWrapper.gt(SCleanRecords::getCreateTime,DateUtils.addDays(new Date(),-7));
List<SCleanRecords> records = list(queryWrapper);
if(CollectionUtils.isNotEmpty(records)){
Optional<SCleanRecords> cleanRecords = records.stream().max(Comparator.comparing(SCleanRecords::getCreateTime));
......
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