전략분봉 저장 에러 문제 수정

This commit is contained in:
Macbook
2026-05-23 21:08:46 +09:00
parent eaf067db1c
commit 70ac67afe7
18 changed files with 2445 additions and 498 deletions
@@ -125,11 +125,14 @@ public class LiveStrategySettingsService {
public LiveStrategySettingsDto save(Long userId, String deviceId,
LiveStrategySettingsDto dto) {
persistGlobalTemplate(userId, deviceId, dto);
syncAllWatchlistMarkets(userId, deviceId);
syncAllWatchlistMarkets(userId, deviceId, dto);
String market = dto.getMarket() != null ? dto.getMarket() : "KRW-BTC";
log.info("[LiveStrategySettings] global saved + watchlist sync, template market={}", market);
GcAppSettings app = appSettingsService.getEntity(userId, deviceId);
LiveStrategySettingsDto out = mergeGlobalTemplate(defaultDtoFromApp(market, app), app, market);
LiveStrategySettingsDto out = findEntity(userId, deviceId, market)
.map(this::toDto)
.orElseGet(() -> defaultDtoFromApp(market, app));
out = mergeGlobalTemplate(out, app, market);
if (dto.getExecutionType() != null) {
out.setExecutionType(dto.getExecutionType());
}
@@ -153,13 +156,20 @@ public class LiveStrategySettingsService {
appSettingsService.save(userId, deviceId, patch);
}
private void syncAllWatchlistMarkets(Long userId, String deviceId) {
private void syncAllWatchlistMarkets(Long userId, String deviceId,
LiveStrategySettingsDto template) {
GcAppSettings app = appSettingsService.getEntity(userId, deviceId);
boolean active = Boolean.TRUE.equals(app.getLiveStrategyCheck())
&& app.getLiveStrategyId() != null;
String candleType = template != null && template.getCandleType() != null
? LiveStrategyTimeframeService.normalize(template.getCandleType())
: null;
for (String symbol : listWatchlistSymbols(userId, deviceId)) {
LiveStrategySettingsDto row = defaultDtoFromApp(symbol, app);
row.setLiveCheck(active);
if (candleType != null) {
row.setCandleType(candleType);
}
LiveStrategySettingsDto saved = upsertEntity(userId, deviceId, row);
if (active) {
pinIfReady(symbol, saved);