/
vorotov.a.vikt
/
MathEquGen
Обзор
Документация
Войти
/
vorotov.a.vikt
/
MathEquGen
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
src/main/java/com/example/chat/telegram/service/ChatWizard.java
29 строк
1 KB
DudnikSlava
логирование запросов в модель, дополнительные опции копилки, исправление багов
30 ноя 2025, 16:04
30 ноя 2025, 16:04
f416784
Код
Авторство
О чём код?
package com.example.chat.telegram.service; import com.example.chat.helper.listener.ThreadLocalListenerContext; import com.example.chat.logic.component.EquationWizard; import org.springframework.beans.factory.ObjectProvider; import org.springframework.stereotype.Service; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @Service public class ChatWizard { private final Map<Long, EquationWizard> wizards = new ConcurrentHashMap<>(); private final ObjectProvider<EquationWizard> equationWizardProvider; private final ThreadLocalListenerContext<String> listenerContext; public ChatWizard(ObjectProvider<EquationWizard> equationWizardProvider, ThreadLocalListenerContext<String> listenerContext) { this.equationWizardProvider = equationWizardProvider; this.listenerContext = listenerContext; } public EquationWizard getEquationWizard(Long chatId) { listenerContext.setValue(chatId.toString()); return wizards.computeIfAbsent(chatId, key -> equationWizardProvider.getObject()); } }