| | |
| | | import cn.hutool.http.HttpResponse; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.other.entity.*; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.DayOfWeek; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private ITSitePriceService sitePriceService; |
| | | @ResponseBody |
| | | @PostMapping("/base/site/querySiteList") |
| | | @ApiOperation(value = "获取场地列表", tags = {"用户—预约场地"}) |
| | |
| | | }) |
| | | public ResultUtil<List<QuerySiteListVo>> querySiteList(QuerySiteList querySiteList) { |
| | | try { |
| | | |
| | | |
| | | List<QuerySiteListVo> querySiteListVos = siteService.querySiteList(querySiteList); |
| | | return ResultUtil.success(querySiteListVos); |
| | | } catch (Exception e) { |
| | |
| | | System.err.println("订场类型:"+targetAudience); |
| | | |
| | | map.put("name", site.getName()); |
| | | map.put("targetAudience", targetAudience); |
| | | |
| | | |
| | | List<Integer> ids = getIds(siteBooking.getSiteId()); |
| | |
| | | @PostMapping("/base/site/getNewAddSiteList") |
| | | public List<SiteVo> getAppUserSiteList(@RequestBody Integer storeId) { |
| | | List<SiteVo> siteVos = new ArrayList<>(); |
| | | |
| | | DayOfWeek dayOfWeek = LocalDate.now().getDayOfWeek(); |
| | | Map<Integer, List<TSitePrice>> priceMap = sitePriceService.lambdaQuery().eq(TSitePrice::getDayOfWeek, dayOfWeek.getValue()) |
| | | .list() |
| | | .stream().collect(Collectors.groupingBy(TSitePrice::getSiteId)); |
| | | List<Site> list = siteService.list(new QueryWrapper<Site>().eq("state", 1).eq("storeId", storeId) |
| | | .orderByDesc("insertTime")); |
| | | if (list.size() > 0) { |
| | | for (Site site : list) { |
| | | List<TSitePrice> tSitePrices = priceMap.get(site.getId()); |
| | | |
| | | SiteVo vo = new SiteVo(); |
| | | vo.setIsCanBeBooked(site.getIsCanBeBooked()); |
| | | vo.setSiteId(site.getId()); |
| | | vo.setSiteName(site.getName()); |
| | | vo.setSiteTime(site.getAppointmentStartTime() + "-" + site.getAppointmentEndTime()); |
| | | vo.setSiteTime(""); |
| | | vo.setPrice(0.0); |
| | | if (tSitePrices!=null&& !tSitePrices.isEmpty()){ |
| | | BigDecimal bigDecimal = tSitePrices.get(0).getCashPrice(); |
| | | // 遍历 查询最小的价格 |
| | | for (TSitePrice tSitePrice : tSitePrices) { |
| | | if (bigDecimal.compareTo(tSitePrice.getCashPrice()) > 0) { |
| | | bigDecimal = tSitePrice.getCashPrice(); |
| | | } |
| | | } |
| | | vo.setPrice(bigDecimal.doubleValue()); |
| | | vo.setSiteTime(tSitePrices.get(0).getStartTime() + "-" + tSitePrices.get(tSitePrices.size()-1).getEndTime()); |
| | | } |
| | | SiteType byId = siteTypeService.getById(site.getSiteTypeId()); |
| | | vo.setSiteType(byId.getName()); |
| | | vo.setPrice(site.getCashPrice()); |
| | | |
| | | siteVos.add(vo); |
| | | } |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | } |