Commit ca433f57 by wuwenlong

room status opt;

parent 99234a00
...@@ -31,9 +31,10 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils ...@@ -31,9 +31,10 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
private static String[] parsePatterns = { private static String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM-dd HH", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"
};
/** /**
* 获取当前Date型日期 * 获取当前Date型日期
......
...@@ -62,7 +62,7 @@ public class SStoreController extends BaseController ...@@ -62,7 +62,7 @@ public class SStoreController extends BaseController
*/ */
@ApiOperation(value = "按距离排序查询门店列表") @ApiOperation(value = "按距离排序查询门店列表")
@RequestMapping(value = "/listVo", method = RequestMethod.POST) @RequestMapping(value = "/listVo", method = RequestMethod.POST)
public R<List<SStoreVo>> listByDistance(@RequestBody SStoreRequest request) public R<List<SStoreVo>> listVo(@RequestBody SStoreRequest request)
{ {
startPage(); startPage();
return R.ok(sStoreService.listVo(request)); return R.ok(sStoreService.listVo(request));
......
...@@ -64,6 +64,7 @@ public class WebConfig implements WebMvcConfigurer { ...@@ -64,6 +64,7 @@ public class WebConfig implements WebMvcConfigurer {
"/front/wechat/**", "/front/wechat/**",
"/front/login/**", "/front/login/**",
"/front/store/**", "/front/store/**",
"/front/room/**",
"**" "**"
).addPathPatterns("/**"); ).addPathPatterns("/**");
} }
......
...@@ -78,29 +78,32 @@ public class RoomStatusServiceImpl implements RoomStatusService { ...@@ -78,29 +78,32 @@ public class RoomStatusServiceImpl implements RoomStatusService {
//设置时间段房间可预约状态(可预约:大于营业开始时间,小于营业结束时间,大于当前时间,当前时间没有订单) //设置时间段房间可预约状态(可预约:大于营业开始时间,小于营业结束时间,大于当前时间,当前时间没有订单)
private void setTimeHourStatus(RoomStatusVo vo,Date timeHourDate, SStore store, List<SOrder> orderList, String day, String finalNowTime){ private void setTimeHourStatus(RoomStatusVo vo,Date timeHourDate, SStore store, List<SOrder> orderList, String day, String finalNowTime){
vo.setStatus(RoomStatusEnum.FREE.getValue()); vo.setStatus(RoomStatusEnum.FREE.getValue());
//当前时段小于营业开始时间 //门店存在营业时间
if(timeHourDate.compareTo(DateUtils.parseDate(day+" "+store.getOpenStartTime()))==-1){ if(StringUtils.isNotBlank(store.getOpenStartTime())) {
vo.setStatus(RoomStatusEnum.HOLD.getValue()); //当前时段小于营业开始时间
vo.setStartHoldTime(timeHourDate); if (timeHourDate.compareTo(DateUtils.parseDate(day + " " + store.getOpenStartTime())) == -1) {
//判断是否是同一个小时,如果是同一个小时,占用结束时间为营业开始时间 vo.setStatus(RoomStatusEnum.HOLD.getValue());
if(timeHourDate.compareTo(DateUtils.parseDate(day+" "+store.getOpenStartTime().split(":")[0])) == 0){ vo.setStartHoldTime(timeHourDate);
vo.setEndHoldTime(DateUtils.parseDate(day+" "+store.getOpenStartTime())); //判断是否是同一个小时,如果是同一个小时,占用结束时间为营业开始时间
}else { if (timeHourDate.compareTo(DateUtils.parseDate(day + " " + store.getOpenStartTime().split(":")[0])) == 0) {
vo.setEndHoldTime(DateUtils.parseDate(day + " " + store.getOpenStartTime()));
} else {
//占用结束时间为当前时段59分59秒
vo.setEndHoldTime(DateUtils.addSeconds(timeHourDate, 59 * 60 + 59));
}
}
//当前时段大于营业结束时间
if (timeHourDate.compareTo(DateUtils.parseDate(day + " " + store.getOpenEndTime())) == 1) {
vo.setStatus(RoomStatusEnum.HOLD.getValue());
//占用结束时间为当前时段59分59秒 //占用结束时间为当前时段59分59秒
vo.setEndHoldTime(DateUtils.addSeconds(timeHourDate, 59 * 60 + 59)); vo.setEndHoldTime(DateUtils.addSeconds(timeHourDate, 59 * 60 + 59));
} //判断是否是同一个小时,如果是同一个小时,占用开始时间为营业结束时间
} if (timeHourDate.compareTo(DateUtils.parseDate(day + " " + store.getOpenEndTime().split(":")[0])) == 0) {
//当前时段大于营业结束时间 vo.setStartHoldTime(DateUtils.parseDate(day + " " + store.getOpenEndTime()));
if(timeHourDate.compareTo(DateUtils.parseDate(day+" "+store.getOpenEndTime()))==1){ } else {
vo.setStatus(RoomStatusEnum.HOLD.getValue()); //占用开始时间为当前时段0分0秒
//占用结束时间为当前时段59分59秒 vo.setStartHoldTime(timeHourDate);
vo.setEndHoldTime(DateUtils.addSeconds(timeHourDate, 59 * 60 + 59)); }
//判断是否是同一个小时,如果是同一个小时,占用开始时间为营业结束时间
if(timeHourDate.compareTo(DateUtils.parseDate(day+" "+store.getOpenEndTime().split(":")[0])) == 0){
vo.setStartHoldTime(DateUtils.parseDate(day+" "+store.getOpenEndTime()));
}else {
//占用开始时间为当前时段0分0秒
vo.setStartHoldTime(timeHourDate);
} }
} }
//当前时段小于当前时间 //当前时段小于当前时间
......
...@@ -102,14 +102,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -102,14 +102,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
@Override @Override
public List<SOrder> listByRoomInfo(Long storeId, Long roomId, Date day) { public List<SOrder> listByRoomInfo(Long storeId, Long roomId, Date day) {
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
//TODO order表待调整
queryWrapper.eq(SOrder::getStoreId,storeId); queryWrapper.eq(SOrder::getStoreId,storeId);
queryWrapper.eq(SOrder::getRoomId,roomId); queryWrapper.eq(SOrder::getRoomId,roomId);
String nowDayStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,day); String nowDayStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,day);
String nextDayStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,DateUtils.addDays(day,1)); String nextDayStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,DateUtils.addDays(day,1));
queryWrapper.apply("(DATE_FORMAT(IFNULL(start_date,per_start_date), '%Y-%m-%d') = '"+nowDayStr+"' " + queryWrapper.apply("(DATE_FORMAT(IFNULL(start_date,pre_start_date), '%Y-%m-%d') = '"+nowDayStr+"' " +
" OR DATE_FORMAT(IFNULL(start_date,per_start_date), '%Y-%m-%d') = '"+nextDayStr+"')"); " OR DATE_FORMAT(IFNULL(start_date,pre_start_date), '%Y-%m-%d') = '"+nextDayStr+"')");
queryWrapper.apply("ORDER BY IFNULL(start_date,per_start_date) "); queryWrapper.last("ORDER BY IFNULL(start_date,pre_start_date) ");
return list(queryWrapper); return list(queryWrapper);
} }
} }
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