http://jira.mfd.msk:8088/browse/CLS-100 добавил сохранение объектов Launcher
This commit is contained in:
parent
834150563a
commit
dcbdea0abf
1 changed files with 13 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ import ru.spcex.platform.imdg.api.ImdgProvider;
|
|||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
|
@ -39,6 +40,7 @@ public class LauncherController extends AbstractQueueController {
|
|||
private final IStateLoader stateLoader;
|
||||
private final Imdg<User> userImdg;
|
||||
private final Imdg<AbstractDictionary> taskDictionary;
|
||||
private final Imdg<Launcher> launcherImdg;
|
||||
|
||||
@Autowired
|
||||
public LauncherController(IStateLoader stateLoader, IOperator operator, ImdgProvider imdgProvider) {
|
||||
|
|
@ -46,6 +48,7 @@ public class LauncherController extends AbstractQueueController {
|
|||
this.stateLoader = stateLoader;
|
||||
this.userImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_User, User.class);
|
||||
this.taskDictionary = imdgProvider.getImdg(IMDGDistributedNames.Map_TaskDictionary, AbstractDictionary.class);
|
||||
this.launcherImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Launcher, Launcher.class);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "get all Launchers.")
|
||||
|
|
@ -78,11 +81,21 @@ public class LauncherController extends AbstractQueueController {
|
|||
}
|
||||
launcherCommand.setTask(dictionaryName);
|
||||
launcherCommand.setUserId(user.getId());
|
||||
//пока здесь
|
||||
saveLauncher(dictionaryName, user.getId());
|
||||
//топики ограничиваются наличием в taskDictionary
|
||||
//подписываются на разные топики в разных модулях, см. ru.spcex.platform.enumeration.Task#topic
|
||||
return processRequest("launcher-" + dictionaryName, launcherCommand);
|
||||
}
|
||||
|
||||
private void saveLauncher(String taskCode, Long userId) {
|
||||
Launcher launcherCommandHistory = new Launcher();
|
||||
launcherCommandHistory.setTask(taskCode);
|
||||
launcherCommandHistory.setSenderId(userId);
|
||||
launcherCommandHistory.setCreated(Instant.now());
|
||||
launcherImdg.insert(launcherCommandHistory);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private IMessageResolver errorResolver;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue