火箭时区问题处理
This commit is contained in:
parent
ac034f9cc4
commit
17d212e41e
@ -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.cache.key.RocketKeys;
|
||||||
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
||||||
import com.red.circle.other.infra.gateway.RocketStatusGatewayImpl;
|
import com.red.circle.other.infra.gateway.RocketStatusGatewayImpl;
|
||||||
|
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -242,11 +243,11 @@ public class RocketEnergyAggregator {
|
|||||||
* 处理单个房间的能量批次
|
* 处理单个房间的能量批次
|
||||||
*/
|
*/
|
||||||
private void processRoomEnergyBatch(Long roomId, List<RocketEnergyAddCmd> batch) {
|
private void processRoomEnergyBatch(Long roomId, List<RocketEnergyAddCmd> batch) {
|
||||||
String today = LocalDate.now().toString();
|
String riyadhToday = ZonedDateTimeAsiaRiyadhUtils.nowFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
// 查询当前火箭状态
|
// 查询当前火箭状态
|
||||||
RocketStatus rocketStatus = rocketStatusGatewayImpl
|
RocketStatus rocketStatus = rocketStatusGatewayImpl
|
||||||
.findByRoomIdAndDateWithoutContributors(roomId, today);
|
.findByRoomIdAndDateWithoutContributors(roomId, riyadhToday);
|
||||||
|
|
||||||
if (rocketStatus == null) {
|
if (rocketStatus == null) {
|
||||||
// 初始化火箭
|
// 初始化火箭
|
||||||
@ -256,7 +257,8 @@ public class RocketEnergyAggregator {
|
|||||||
throw new RuntimeException("一级火箭配置不存在");
|
throw new RuntimeException("一级火箭配置不存在");
|
||||||
}
|
}
|
||||||
rocketStatus = RocketStatus.init(roomId, level1Config);
|
rocketStatus = RocketStatus.init(roomId, level1Config);
|
||||||
log.info("初始化房间火箭, roomId={}, maxEnergy={}", roomId, level1Config.getMaxEnergy());
|
rocketStatus.setDate(riyadhToday);
|
||||||
|
log.info("初始化房间火箭, roomId={}, date={}, maxEnergy={}", roomId, riyadhToday, level1Config.getMaxEnergy());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验状态
|
// 校验状态
|
||||||
|
|||||||
@ -153,7 +153,7 @@ public class RocketStatusGatewayImpl implements RocketStatusGateway {
|
|||||||
RocketStatusDocument doc = new RocketStatusDocument();
|
RocketStatusDocument doc = new RocketStatusDocument();
|
||||||
doc.setId(status.getId());
|
doc.setId(status.getId());
|
||||||
doc.setRoomId(status.getRoomId());
|
doc.setRoomId(status.getRoomId());
|
||||||
doc.setDate(status.getDate() != null ? status.getDate() : LocalDate.now().toString());
|
doc.setDate(status.getDate());
|
||||||
doc.setLevel(status.getLevel().getLevel());
|
doc.setLevel(status.getLevel().getLevel());
|
||||||
doc.setCurrentEnergy(status.getCurrentEnergy());
|
doc.setCurrentEnergy(status.getCurrentEnergy());
|
||||||
doc.setMaxEnergy(status.getMaxEnergy());
|
doc.setMaxEnergy(status.getMaxEnergy());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user