| | |
| | | List<TSitePrice> sitePrice = itSitePriceService.list(tSitePriceLambdaQueryWrapper); |
| | | |
| | | |
| | | SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | for (TSitePrice tSitePrice : sitePrice) { |
| | | QuerySiteTimes querySiteTimes = new QuerySiteTimes(); |
| | | querySiteTimes.setTime(tSitePrice.getStartTime().substring(0, tSitePrice.getStartTime().length() - 3) + "-" + tSitePrice.getEndTime().substring(0, tSitePrice.getEndTime().length() - 3)); |
| | |
| | | String temp = tSitePrice.getStartTime().substring(0, tSitePrice.getStartTime().length() - 3) + "-" + tSitePrice.getEndTime().substring(0, tSitePrice.getEndTime().length() - 3); |
| | | String timePriceStart = day + " " + tSitePrice.getStartTime().substring(0, tSitePrice.getStartTime().length() - 3); |
| | | String timePriceEnd = day + " " + tSitePrice.getEndTime().substring(0, tSitePrice.getEndTime().length() - 3); |
| | | Date now = new Date(); |
| | | Date start = simpleDateFormat1.parse(timePriceStart); |
| | | Date end = simpleDateFormat1.parse(timePriceEnd); |
| | | // 已经预约了 判断是散客模式还是订场模式 |
| | | Integer flag = 0; |
| | | // 散客预约人数 |
| | |
| | | String[] split = timeRange.split("-"); |
| | | String bookingStart = day + " " + split[0]; |
| | | String bookingEnd = day + " " + split[1]; |
| | | |
| | | |
| | | if (!isTimePeriodsIntersect(timePriceStart, timePriceEnd, bookingStart, bookingEnd)) { |
| | | // 不相交 |
| | | } else { |
| | |
| | | } |
| | | count++; |
| | | } |
| | | |
| | | } |
| | | if (querySiteTimes.getSelectable() == 1&&end.before(now)){ |
| | | querySiteTimes.setSelectable(0); |
| | | } |
| | | querySiteTimes.setSelectCount(count); |
| | | if (flag == 0) { |
| | | if (flag == 0 && querySiteTimes.getSelectable() == 1) { |
| | | // 当前时间段还没有预约 |
| | | Integer walkinCapacity = site.getWalkinCapacity(); |
| | | // 计算散客预约人数和最大散客容纳数 |
| | | System.err.println("预约人数" + count); |
| | | System.err.println("最大散客容纳数" + walkinCapacity); |
| | | if (walkinCapacity <= count) { |
| | | // 不可预约 也不能散客 |
| | | if (targetAudience==1 && walkinCapacity!=0){ |
| | | // 不可预约 |
| | | System.err.println("不可预约 也不能散客"); |
| | | querySiteTimes.setSelectable(0); |
| | | querySiteTimes.setIsReserve(0); |
| | | }else{ |
| | | // 不能散客 |
| | | System.err.println("不可预约 也不能散客"); |
| | | querySiteTimes.setSelectable(0); |
| | | querySiteTimes.setIsReserve(0); |
| | | } |
| | | |
| | | }else{ |
| | | if (targetAudience==2){ |
| | | // 散客只能预约当前时间段 |
| | | Date now = new Date(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | String nowStr = simpleDateFormat.format(now); |
| | | // 判断当前时间有没有在timePriceStart和timePriceEnd之间 |