This commit is contained in:
AKurakin 2023-04-20 16:30:44 +03:00
parent 849130f8b3
commit 43ae4b26d8
5 changed files with 826 additions and 312 deletions

View file

@ -0,0 +1,44 @@
package ru.spcex.clearing.backendapi.controller.queue.execution;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import ru.clearing.classes.statics.data.execution.ExecutionFond;
import ru.spcex.clearing.backendapi.controller.queue.AbstractQueueController;
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
import ru.spcex.clearing.backendapi.service.IOperator;
import ru.spcex.clearing.backendapi.service.IStateLoader;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import java.util.Collection;
import java.util.Map;
@Controller
@RequestMapping("/execution-fonds")
public class ExecutionFondController extends AbstractQueueController {
private final IStateLoader stateLoader;
@Autowired
public ExecutionFondController(IOperator operator, IStateLoader stateLoader) {
super(operator);
this.stateLoader = stateLoader;
}
@ApiOperation(value = "get all ExecutionFond.")
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CommonGetAllResponse.class)})
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public CommonGetAllResponse getAll() {
Collection<Map<String, Object>> all = stateLoader.getAllMetaTransform(
IMDGDistributedNames.Map_ExecutionFond,
ExecutionFond.class);
CommonGetAllResponse response = new CommonGetAllResponse();
response.fromEntity(all);
return response;
}
}

View file

@ -1281,7 +1281,7 @@
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" visible="false" searchable="true" sortable="true"/>
<clearingDate type="6" name="Дата клиринга" shortname="Дата клиринга" visible="false" searchable="true" sortable="true"/>
</executionDeposit>
<executionFond name="Сделки на Фондовой секции" destination="execution-fonds" class="" logUpdates="true" table="execution_fond">
<executionFond name="Сделки на Фондовой секции" destination="execution-fonds" class="ru.clearing.classes.statics.data.execution.ExecutionFond" logUpdates="true" table="execution_fond">
<id type="1" name="Идентификатор записи" shortname="ID" visible="false" searchable="true" sortable="true"/>
<createdAt field="created" type="4" webtype="5" dbname="Дата-время создания записи" name="Время создания записи" shortname="Создано" visible="false" searchable="true" sortable="true"/>
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" visible="false" searchable="true" sortable="true"/>

View file

@ -31,6 +31,7 @@ import ru.spcex.clearing.backendapi.controller.config.*;
import ru.spcex.clearing.backendapi.controller.queue.account.*;
import ru.spcex.clearing.backendapi.controller.queue.company.*;
import ru.spcex.clearing.backendapi.controller.queue.execution.ExecutionDepositController;
import ru.spcex.clearing.backendapi.controller.queue.execution.ExecutionFondController;
import ru.spcex.clearing.backendapi.controller.queue.journal.InDocumentJournalController;
import ru.spcex.clearing.backendapi.controller.queue.journal.ManagementJournalController;
import ru.spcex.clearing.backendapi.controller.queue.journal.OutDocumentJournalController;
@ -101,6 +102,7 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
RelationController.class,
//execution
ExecutionDepositController.class,
ExecutionFondController.class,
//journal
InDocumentJournalController.class,
ManagementJournalController.class,

View file

@ -0,0 +1,57 @@
package ru.spcex.clearing.backendapi.controller.queue.execution;
import org.junit.jupiter.api.Test;
import ru.clearing.classes.statics.data.execution.ExecutionFond;
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDate;
class ExecutionFondControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/execution-fonds/";
/**
* {@link ExecutionFondController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /execution-fonds/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ExecutionFond executionFond = new ExecutionFond();
executionFond.setId(currentId.get());
executionFond.setExchangeExecutionId(currentId.get());
executionFond.setExchangeExecutionTime(Instant.now());
executionFond.setTradingDate(LocalDate.now());
executionFond.setTradingClearingRegistryId(currentId.get());
executionFond.setMarket("mark");
executionFond.setPrice(new BigDecimal(0));
executionFond.setLots(new BigDecimal(0));
executionFond.setQuantity(new BigDecimal(0));
executionFond.setInterestAmount(new BigDecimal(0));
executionFond.setSide("sid");
executionFond.setSettlementCurrency("set");
executionFond.setCompanyId(currentId.get());
executionFond.setDuration(currentId.get());
executionFond.setSecurityFullName("sec");
executionFond.setSecuritySymbol("sec");
executionFond.setSecurityId(currentId.get());
executionFond.setCounterPartyId(currentId.get());
executionFond.setCoverageStatus("cov");
executionFond.setSessionId(currentId.get());
executionFond.setClearingDate(LocalDate.now());
executionFond.setExchangeOrderId(123L);
executionFond.setSettlementAmount(new BigDecimal(10));
executionFond.setComment("comment - hello world fond");
executionFond.setClientCodeId(444L);
executionFond.setSettlementCode("settl1");
executionFond.setSettlementDate(LocalDate.now());
executionFond.setExchangeExecutionMicroseconds(Instant.now());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ExecutionFond, executionFond, REST_URL);
}
}

File diff suppressed because it is too large Load diff