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.setTask(dictionaryName);
|
||||||
launcherCommand.setUserId(user.getId());
|
launcherCommand.setUserId(user.getId());
|
||||||
//пока здесь
|
// //пока здесь
|
||||||
saveLauncher(dictionaryName, user.getId());
|
// saveLauncher(dictionaryName, user.getId());
|
||||||
//топики ограничиваются наличием в taskDictionary
|
//топики ограничиваются наличием в taskDictionary
|
||||||
//подписываются на разные топики в разных модулях, см. ru.spcex.platform.enumeration.Task#topic
|
//подписываются на разные топики в разных модулях, см. ru.spcex.platform.enumeration.Task#topic
|
||||||
return processRequest("launcher-" + dictionaryName, launcherCommand);
|
return processRequest("launcher-" + dictionaryName, launcherCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveLauncher(String taskCode, Long userId) {
|
// private void saveLauncher(String taskCode, Long userId) {
|
||||||
Launcher launcherCommandHistory = new Launcher();
|
// Launcher launcherCommandHistory = new Launcher();
|
||||||
launcherCommandHistory.setTask(taskCode);
|
// launcherCommandHistory.setTask(taskCode);
|
||||||
launcherCommandHistory.setSenderId(userId);
|
// launcherCommandHistory.setSenderId(userId);
|
||||||
launcherCommandHistory.setCreated(Instant.now());
|
// launcherCommandHistory.setCreated(Instant.now());
|
||||||
launcherImdg.insert(launcherCommandHistory);
|
// launcherImdg.insert(launcherCommandHistory);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMessageResolver errorResolver;
|
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.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.reports.ReportWithPeriodRequest;
|
||||||
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;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class LauncherNew implements IAction<LauncherCommandRequest> {
|
public class LauncherNew implements IAction<Object> {
|
||||||
@ApiModelProperty(value = "Идентификатор единоличного исполнительного органа", example = "ABCD")
|
@ApiModelProperty(value = "Идентификатор единоличного исполнительного органа", example = "ABCD")
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private String task;
|
private String task;
|
||||||
|
|
@ -22,11 +24,17 @@ public class LauncherNew implements IAction<LauncherCommandRequest> {
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LauncherCommandRequest toRequest() {
|
public Object toRequest() {
|
||||||
LauncherCommandRequest taskRunnerCommandRequest = new LauncherCommandRequest();
|
if (Task.createReport_GREP.equalsByKey(task)) {
|
||||||
taskRunnerCommandRequest.setTaskName(task);
|
ReportWithPeriodRequest reportCommand = new ReportWithPeriodRequest();
|
||||||
taskRunnerCommandRequest.setUserId(userId);
|
reportCommand.setReportId(task);
|
||||||
return taskRunnerCommandRequest;
|
return reportCommand;
|
||||||
|
} else {
|
||||||
|
LauncherCommandRequest taskRunnerCommandRequest = new LauncherCommandRequest();
|
||||||
|
taskRunnerCommandRequest.setTaskName(task);
|
||||||
|
taskRunnerCommandRequest.setUserId(userId);
|
||||||
|
return taskRunnerCommandRequest;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class QCommandExecutor extends QueueConsumer implements InitializingBean
|
||||||
log.info("Init queue listener {}", getClass().getSimpleName());
|
log.info("Init queue listener {}", getClass().getSimpleName());
|
||||||
callback(ReportWithPeriodRequest.class)
|
callback(ReportWithPeriodRequest.class)
|
||||||
.setConsumer(this::newReportWithPeriod)
|
.setConsumer(this::newReportWithPeriod)
|
||||||
.forDestination(Task.createReport.topic(), callbacks::put);
|
.forDestination(Task.createReport_GREP.topic(), callbacks::put);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public class MapUtil {
|
||||||
K key = indexFieldExtractor.apply(obj);
|
K key = indexFieldExtractor.apply(obj);
|
||||||
V exist = index.put(key, obj);
|
V exist = index.put(key, obj);
|
||||||
if (exist != null) {
|
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
|
exist.getClass().getSimpleName(), exist.getId(), obj.getId(), key
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ public enum Task implements IEnumKey {
|
||||||
createOrder("CORD"),
|
createOrder("CORD"),
|
||||||
createOrderConfirm("CORC"),
|
createOrderConfirm("CORC"),
|
||||||
getAllBalance("GALB"),
|
getAllBalance("GALB"),
|
||||||
createReport("RPRT");// Создание отчёта (report-service)
|
createReport_GREP("GREP");// Создание отчёта (report-service) RPRT нескольких видов, этот GREP
|
||||||
|
|
||||||
|
|
||||||
private final String key;
|
private final String key;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue