From d47bf3e1e3bf56b60ea6a1649ddd618d5ae803f1 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 26 十二月 2025 09:13:14 +0800
Subject: [PATCH] bug修改
---
cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
index f3a8644..ef74165 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
@@ -1,5 +1,6 @@
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;
@@ -963,6 +964,8 @@
.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());
@@ -974,11 +977,14 @@
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());
--
Gitblit v1.7.1