| | |
| | | package com.dsh.other.controller; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import com.alibaba.fastjson.JSONArray; |
| | |
| | | .stream().collect(Collectors.groupingBy(TSitePrice::getSiteId)); |
| | | List<Site> list = siteService.list(new QueryWrapper<Site>().eq("state", 1).eq("storeId", storeId) |
| | | .orderByDesc("insertTime")); |
| | | String now = DateUtil.now().substring(11, 19); |
| | | |
| | | if (list.size() > 0) { |
| | | for (Site site : list) { |
| | | List<TSitePrice> tSitePrices = priceMap.get(site.getId()); |
| | |
| | | vo.setSiteTime(""); |
| | | vo.setPrice(0.0); |
| | | if (tSitePrices!=null&& !tSitePrices.isEmpty()){ |
| | | BigDecimal bigDecimal = tSitePrices.get(0).getCashPrice(); |
| | | BigDecimal bigDecimal = BigDecimal.ZERO; |
| | | // 遍历 查询最小的价格 |
| | | for (TSitePrice tSitePrice : tSitePrices) { |
| | | if (bigDecimal.compareTo(tSitePrice.getCashPrice()) > 0) { |
| | | bigDecimal = tSitePrice.getCashPrice(); |
| | | // 当前时间再范围之内 |
| | | if (tSitePrice.getStartTime().compareTo(now) <= 0 && tSitePrice.getEndTime().compareTo(now) >= 0) { |
| | | if (tSitePrice.getCashPrice().compareTo(bigDecimal) > 0) { |
| | | bigDecimal = tSitePrice.getCashPrice(); |
| | | } |
| | | } |
| | | } |
| | | vo.setPrice(bigDecimal.doubleValue()); |