火箭时区问题处理

This commit is contained in:
tianfeng 2025-11-18 11:06:05 +08:00
parent ac034f9cc4
commit 17d212e41e
2 changed files with 7 additions and 5 deletions

View File

@ -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<RocketEnergyAddCmd> 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());
}
// 校验状态

View File

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