This commit is contained in:
parent
efbc815717
commit
e016cc5528
2 changed files with 6 additions and 8 deletions
|
|
@ -90,14 +90,13 @@ public class LauncherController extends AbstractQueueController {
|
||||||
|
|
||||||
@ApiOperation(value = "create specific launcher.")
|
@ApiOperation(value = "create specific launcher.")
|
||||||
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
||||||
@RequestMapping(value = "/specific/{task-code}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/specific", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public CudResponse addSpecific(@ApiParam(value = "Код задания из taskDictionary", required = true, example = "ABLK")
|
public CudResponse addSpecific(@ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
||||||
@PathVariable("task-code") String dictionaryName,
|
|
||||||
@RequestBody LauncherNew launcherNew) throws ExecutionException, InterruptedException {
|
@RequestBody LauncherNew launcherNew) throws ExecutionException, InterruptedException {
|
||||||
AbstractDictionary taskEnum = taskDictionary.getSingleObjectByFieldValues(Map.of("code", dictionaryName));
|
AbstractDictionary taskEnum = taskDictionary.getSingleObjectByFieldValues(Map.of("code", launcherNew.getTask()));
|
||||||
if (taskEnum == null) {
|
if (taskEnum == null) {
|
||||||
throw new NotFound404Exception("task dictionary element with code '" + dictionaryName + "'");
|
throw new NotFound404Exception("task dictionary element with code '" + launcherNew.getTask() + "'");
|
||||||
}
|
}
|
||||||
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()));
|
||||||
|
|
@ -109,7 +108,7 @@ public class LauncherController extends AbstractQueueController {
|
||||||
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(dictionaryName);
|
launcherCommand.setTask(launcherNew.getTask());
|
||||||
launcherCommand.setUserId(user.getId());
|
launcherCommand.setUserId(user.getId());
|
||||||
launcherCommand.setCompanyId(launcherNew.getCompanyId());
|
launcherCommand.setCompanyId(launcherNew.getCompanyId());
|
||||||
launcherCommand.setSecurityId(launcherNew.getSecurityId());
|
launcherCommand.setSecurityId(launcherNew.getSecurityId());
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import ru.spcex.clearing.backendapi.domain.actions.IAction;
|
||||||
import ru.spcex.clearing.backendapi.errors.BackEndError;
|
import ru.spcex.clearing.backendapi.errors.BackEndError;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.ActionType;
|
import ru.spcex.clearing.platform.messaging.domain.ActionType;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandRequest;
|
||||||
import ru.spcex.platform.enumeration.Task;
|
|
||||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
@ -24,7 +23,6 @@ public class LauncherNew implements IAction<Object> {
|
||||||
@ApiModelProperty(value = "Идентификатор инструмента", example = "1000")
|
@ApiModelProperty(value = "Идентификатор инструмента", example = "1000")
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private Long securityId;
|
private Long securityId;
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
|
@ -38,6 +36,7 @@ public class LauncherNew implements IAction<Object> {
|
||||||
return taskRunnerCommandRequest;
|
return taskRunnerCommandRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(hidden = true)
|
||||||
@Override
|
@Override
|
||||||
public ActionType getActionType() {
|
public ActionType getActionType() {
|
||||||
return ActionType.NEW;
|
return ActionType.NEW;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue