backend-api команда GREP для reports-service
This commit is contained in:
parent
ef3c8046ad
commit
30a9c39726
5 changed files with 26 additions and 18 deletions
|
|
@ -81,20 +81,20 @@ public class LauncherController extends AbstractQueueController {
|
|||
}
|
||||
launcherCommand.setTask(dictionaryName);
|
||||
launcherCommand.setUserId(user.getId());
|
||||
//пока здесь
|
||||
saveLauncher(dictionaryName, 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);
|
||||
}
|
||||
// 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;
|
||||
|
|
|
|||
|
|
@ -6,14 +6,16 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import ru.spcex.clearing.backendapi.domain.actions.IAction;
|
||||
import ru.spcex.clearing.backendapi.errors.BackEndError;
|
||||
import ru.spcex.clearing.platform.messaging.domain.ActionType;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.reports.ReportWithPeriodRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandRequest;
|
||||
import ru.spcex.platform.enumeration.Task;
|
||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class LauncherNew implements IAction<LauncherCommandRequest> {
|
||||
public class LauncherNew implements IAction<Object> {
|
||||
@ApiModelProperty(value = "Идентификатор единоличного исполнительного органа", example = "ABCD")
|
||||
@JsonProperty
|
||||
private String task;
|
||||
|
|
@ -22,11 +24,17 @@ public class LauncherNew implements IAction<LauncherCommandRequest> {
|
|||
private Long userId;
|
||||
|
||||
@Override
|
||||
public LauncherCommandRequest toRequest() {
|
||||
LauncherCommandRequest taskRunnerCommandRequest = new LauncherCommandRequest();
|
||||
taskRunnerCommandRequest.setTaskName(task);
|
||||
taskRunnerCommandRequest.setUserId(userId);
|
||||
return taskRunnerCommandRequest;
|
||||
public Object toRequest() {
|
||||
if (Task.createReport_GREP.equalsByKey(task)) {
|
||||
ReportWithPeriodRequest reportCommand = new ReportWithPeriodRequest();
|
||||
reportCommand.setReportId(task);
|
||||
return reportCommand;
|
||||
} else {
|
||||
LauncherCommandRequest taskRunnerCommandRequest = new LauncherCommandRequest();
|
||||
taskRunnerCommandRequest.setTaskName(task);
|
||||
taskRunnerCommandRequest.setUserId(userId);
|
||||
return taskRunnerCommandRequest;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class QCommandExecutor extends QueueConsumer implements InitializingBean
|
|||
log.info("Init queue listener {}", getClass().getSimpleName());
|
||||
callback(ReportWithPeriodRequest.class)
|
||||
.setConsumer(this::newReportWithPeriod)
|
||||
.forDestination(Task.createReport.topic(), callbacks::put);
|
||||
.forDestination(Task.createReport_GREP.topic(), callbacks::put);
|
||||
init();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class MapUtil {
|
|||
K key = indexFieldExtractor.apply(obj);
|
||||
V exist = index.put(key, obj);
|
||||
if (exist != null) {
|
||||
throw new IllegalStateException(String.format("%s with id=%s,%s has duplicate key=\"{}\"",
|
||||
throw new IllegalStateException(String.format("%s with id=%s,%s has duplicate key=\"%s\"",
|
||||
exist.getClass().getSimpleName(), exist.getId(), obj.getId(), key
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public enum Task implements IEnumKey {
|
|||
createOrder("CORD"),
|
||||
createOrderConfirm("CORC"),
|
||||
getAllBalance("GALB"),
|
||||
createReport("RPRT");// Создание отчёта (report-service)
|
||||
createReport_GREP("GREP");// Создание отчёта (report-service) RPRT нескольких видов, этот GREP
|
||||
|
||||
|
||||
private final String key;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue