Commit ca433f57 by wuwenlong

room status opt;

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