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