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());