fix LauncherController fix specific method

This commit is contained in:
etreschenkov 2023-05-29 16:26:22 +03:00
parent e110b10cb9
commit e84a75016e

View file

@ -103,18 +103,14 @@ public class LauncherController extends AbstractQueueController {
if (!Task.startOfClearing.getKey().equals(taskEnum.getCode())) {
throw new IllegalStateException(String.format("Task %s not support request with body", taskEnum.getCode()));
}
LauncherNew launcherCommand = new LauncherNew();
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String username = KeycloakUtils.getUserNameFromAuthentication(authentication);
User user = userImdg.getSingleObjectByFieldValues(Map.of("identifier", username));
if (user == null) {
throw new IllegalStateException("cannot obtain userId from logged in user " + username);
}
launcherCommand.setTask(launcherNew.getTask());
launcherCommand.setUserId(user.getId());
launcherCommand.setCompanyId(launcherNew.getCompanyId());
launcherCommand.setSecurityId(launcherNew.getSecurityId());
return processRequest(Consts.LAUNCHER_NEW, launcherCommand);
launcherNew.setUserId(user.getId());
return processRequest(Consts.LAUNCHER_NEW, launcherNew);
}
@Autowired