From 17d212e41e7beb254c6fb9a82790880ee1e9f821 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Tue, 18 Nov 2025 11:06:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=81=AB=E7=AE=AD=E6=97=B6=E5=8C=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../other/app/manager/RocketEnergyAggregator.java | 10 ++++++---- .../other/infra/gateway/RocketStatusGatewayImpl.java | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/manager/RocketEnergyAggregator.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/manager/RocketEnergyAggregator.java index 7ea6e85a..e4ae01bd 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/manager/RocketEnergyAggregator.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/manager/RocketEnergyAggregator.java @@ -13,6 +13,7 @@ import com.red.circle.other.domain.rocket.RocketStatusEnum; import com.red.circle.other.infra.database.cache.key.RocketKeys; import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService; import com.red.circle.other.infra.gateway.RocketStatusGatewayImpl; +import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @@ -242,11 +243,11 @@ public class RocketEnergyAggregator { * 处理单个房间的能量批次 */ private void processRoomEnergyBatch(Long roomId, List batch) { - String today = LocalDate.now().toString(); - + String riyadhToday = ZonedDateTimeAsiaRiyadhUtils.nowFormat("yyyy-MM-dd"); + // 查询当前火箭状态 RocketStatus rocketStatus = rocketStatusGatewayImpl - .findByRoomIdAndDateWithoutContributors(roomId, today); + .findByRoomIdAndDateWithoutContributors(roomId, riyadhToday); if (rocketStatus == null) { // 初始化火箭 @@ -256,7 +257,8 @@ public class RocketEnergyAggregator { throw new RuntimeException("一级火箭配置不存在"); } rocketStatus = RocketStatus.init(roomId, level1Config); - log.info("初始化房间火箭, roomId={}, maxEnergy={}", roomId, level1Config.getMaxEnergy()); + rocketStatus.setDate(riyadhToday); + log.info("初始化房间火箭, roomId={}, date={}, maxEnergy={}", roomId, riyadhToday, level1Config.getMaxEnergy()); } // 校验状态 diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/RocketStatusGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/RocketStatusGatewayImpl.java index af649f3c..2ba57d99 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/RocketStatusGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/RocketStatusGatewayImpl.java @@ -153,7 +153,7 @@ public class RocketStatusGatewayImpl implements RocketStatusGateway { RocketStatusDocument doc = new RocketStatusDocument(); doc.setId(status.getId()); doc.setRoomId(status.getRoomId()); - doc.setDate(status.getDate() != null ? status.getDate() : LocalDate.now().toString()); + doc.setDate(status.getDate()); doc.setLevel(status.getLevel().getLevel()); doc.setCurrentEnergy(status.getCurrentEnergy()); doc.setMaxEnergy(status.getMaxEnergy());