| | |
| | | .stream().collect(Collectors.groupingBy(TSitePrice::getSiteId)); |
| | | List<QuerySiteListVo> querySiteListVos = this.baseMapper.querySiteList(querySiteList); |
| | | for (QuerySiteListVo querySiteListVo : querySiteListVos) { |
| | | querySiteListVo.setPrice(0.0); |
| | | if (ToolUtil.isEmpty(querySiteList.getLon())) { |
| | | querySiteListVo.setDistance(0D); |
| | | continue; |
| | |
| | | } |
| | | List<TSitePrice> sitePrice = sitePriceService.list(tSitePriceLambdaQueryWrapper); |
| | | |
| | | SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | for (TSitePrice tSitePrice : sitePrice) { |
| | | QuerySiteTimes querySiteTimes = new QuerySiteTimes(); |
| | |
| | | querySiteTimes.setSelectCount(0); |
| | | querySiteTimes.setSelectMaxCount(site.getWalkinCapacity()); |
| | | querySiteTimes.setIsReserve(0); |
| | | querySiteTimes.setTimeAfter(0); |
| | | querySiteTimes.setCashPrice(tSitePrice.getCashPrice()); |
| | | querySiteTimes.setCoinPrice(tSitePrice.getCoinPrice()); |
| | | 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; |
| | | // 散客预约人数 |
| | |
| | | count++; |
| | | } |
| | | } |
| | | if (querySiteTimes.getSelectable() == 1&&end.before(now)){ |
| | | querySiteTimes.setSelectable(0); |
| | | querySiteTimes.setTimeAfter(1); |
| | | } |
| | | if (end.before(now)){ |
| | | querySiteTimes.setSelectable(0); |
| | | querySiteTimes.setTimeAfter(1); |
| | | } |
| | | 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) { |
| | | // 不可预约 也不能散客 |
| | | System.err.println("不可预约 也不能散客"); |
| | | querySiteTimes.setSelectable(0); |
| | | querySiteTimes.setIsReserve(0); |
| | | if (targetAudience==1 && walkinCapacity!=0){ |
| | | // 不可预约 |
| | | System.err.println("不可预约 也不能散客"); |
| | | querySiteTimes.setSelectable(0); |
| | | querySiteTimes.setIsReserve(0); |
| | | }else if (targetAudience==2){ |
| | | // 不能散客 |
| | | System.err.println("不可预约 也不能散客"); |
| | | querySiteTimes.setSelectable(0); |
| | | querySiteTimes.setIsReserve(0); |
| | | }else{ |
| | | querySiteTimes.setSelectable(1); |
| | | } |
| | | }else{ |
| | | if (targetAudience==2){ |
| | | // 散客只能预约当前时间段 |
| | | Date now = new Date(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | String nowStr = simpleDateFormat.format(now); |
| | | // 判断当前时间有没有在timePriceStart和timePriceEnd之间 |
| | |
| | | siteBooking.setState(1); |
| | | siteBooking.setTargetAudience(reservationSite.getTargetAudience()); |
| | | siteBooking.setInsertTime(new Date()); |
| | | |
| | | siteBooking.setMoney(money+","+playCoin); |
| | | siteBooking.setNextName(reservationSite.getNextName()); |
| | | siteBooking.setIsHalf(reservationSite.getIsHalf()); |
| | | siteBooking.setHalfName(reservationSite.getHalfName()); |