backend-api мелкий рефакторинг 3
This commit is contained in:
parent
41faf64289
commit
4968bce3a5
4 changed files with 81 additions and 27 deletions
|
|
@ -0,0 +1,59 @@
|
||||||
|
package ru.spcex.clearing.backendapi.controller.request.cud.company;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import ru.spcex.clearing.backendapi.domain.actions.IAction;
|
||||||
|
import ru.spcex.clearing.platform.messaging.domain.ActionType;
|
||||||
|
import ru.spcex.clearing.platform.messaging.domain.cud.company.CompanySymbolUpdateRequest;
|
||||||
|
|
||||||
|
public class CompanySymbolNewAction implements IAction<CompanySymbolUpdateRequest> {
|
||||||
|
@ApiModelProperty(value = "Идентификатор Компании", example = "1234")
|
||||||
|
@JsonProperty
|
||||||
|
private Long companyId;
|
||||||
|
@ApiModelProperty(value = "Идентификатор справочника", example = "ABCD")
|
||||||
|
@JsonProperty
|
||||||
|
private String companySymbol;
|
||||||
|
@ApiModelProperty(value = "Значение справочника", example = "Company description example")
|
||||||
|
@JsonProperty
|
||||||
|
private String companySymbolValue;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompanySymbolUpdateRequest toRequest() {
|
||||||
|
CompanySymbolUpdateRequest request = new CompanySymbolUpdateRequest();
|
||||||
|
request.setCompanyId(this.companyId);
|
||||||
|
request.setCompanySymbol(this.companySymbol);
|
||||||
|
request.setCompanySymbolValue(this.companySymbolValue);
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(hidden = true)
|
||||||
|
@Override
|
||||||
|
public ActionType getActionType() {
|
||||||
|
return ActionType.NEW;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Long getCompanyId() {
|
||||||
|
return companyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompanyId(Long companyId) {
|
||||||
|
this.companyId = companyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompanySymbol() {
|
||||||
|
return companySymbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompanySymbol(String companySymbol) {
|
||||||
|
this.companySymbol = companySymbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompanySymbolValue() {
|
||||||
|
return companySymbolValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompanySymbolValue(String companySymbolValue) {
|
||||||
|
this.companySymbolValue = companySymbolValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,9 +14,6 @@ public class CompanySymbolUpdateAction implements IAction<CompanySymbolUpdateReq
|
||||||
@ApiModelProperty(value = "Идентификатор Компании", example = "1234")
|
@ApiModelProperty(value = "Идентификатор Компании", example = "1234")
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
@ApiModelProperty(value = "Идентификатор справочника", example = "ABCD")
|
|
||||||
@JsonProperty
|
|
||||||
private String companySymbol;
|
|
||||||
@ApiModelProperty(value = "Значение справочника", example = "Company description example")
|
@ApiModelProperty(value = "Значение справочника", example = "Company description example")
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private String companySymbolValue;
|
private String companySymbolValue;
|
||||||
|
|
@ -26,7 +23,6 @@ public class CompanySymbolUpdateAction implements IAction<CompanySymbolUpdateReq
|
||||||
CompanySymbolUpdateRequest request = new CompanySymbolUpdateRequest();
|
CompanySymbolUpdateRequest request = new CompanySymbolUpdateRequest();
|
||||||
request.setId(this.id);
|
request.setId(this.id);
|
||||||
request.setCompanyId(this.companyId);
|
request.setCompanyId(this.companyId);
|
||||||
request.setCompanySymbol(this.companySymbol);
|
|
||||||
request.setCompanySymbolValue(this.companySymbolValue);
|
request.setCompanySymbolValue(this.companySymbolValue);
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
@ -53,14 +49,6 @@ public class CompanySymbolUpdateAction implements IAction<CompanySymbolUpdateReq
|
||||||
this.companyId = companyId;
|
this.companyId = companyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCompanySymbol() {
|
|
||||||
return companySymbol;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCompanySymbol(String companySymbol) {
|
|
||||||
this.companySymbol = companySymbol;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCompanySymbolValue() {
|
public String getCompanySymbolValue() {
|
||||||
return companySymbolValue;
|
return companySymbolValue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
|
||||||
import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountNewAction;
|
import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountNewAction;
|
||||||
import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountUpdateAction;
|
import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountUpdateAction;
|
||||||
import ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction;
|
import ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction;
|
||||||
import ru.spcex.clearing.backendapi.controller.response.entity.account.BankAccountBackendGetById;
|
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
||||||
import ru.spcex.clearing.backendapi.controller.response.entity.account.BankAccountBackendGetFields;
|
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetByIdResponse;
|
||||||
import ru.spcex.clearing.backendapi.domain.actions.IAction;
|
import ru.spcex.clearing.backendapi.domain.actions.IAction;
|
||||||
import ru.spcex.clearing.backendapi.errors.ActionValidationException;
|
import ru.spcex.clearing.backendapi.errors.ActionValidationException;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
|
@ -18,6 +18,9 @@ import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest;
|
||||||
import ru.spcex.platform.imdg.api.Imdg;
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
|
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||||
|
|
@ -159,19 +162,20 @@ class BankAccountControllerTest extends AbstractControllerTest {
|
||||||
|
|
||||||
Imdg<BankAccount> inDocumentJournalImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_BankAccount, BankAccount.class);
|
Imdg<BankAccount> inDocumentJournalImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_BankAccount, BankAccount.class);
|
||||||
inDocumentJournalImdg.insert(existBankAccount);
|
inDocumentJournalImdg.insert(existBankAccount);
|
||||||
|
|
||||||
BankAccountBackendGetById expected = new BankAccountBackendGetById();
|
CommonGetByIdResponse expected = new CommonGetByIdResponse();
|
||||||
BankAccountBackendGetFields payload = new BankAccountBackendGetFields();
|
//expected.getPayload().
|
||||||
payload.setBankName("ooo tinkoff");
|
Map<String, Object> payload = new HashMap<>();
|
||||||
payload.setBankIdentificationCode("99999");
|
payload.put("bankName", "ooo tinkoff");
|
||||||
payload.setCorrespondentAccount("9294189285498598598");
|
payload.put("bankIdentificationCode", "99999");
|
||||||
payload.setCorrespondentAccountName("BIK OF TINKOFF");
|
payload.put("correspondentAccount", "9294189285498598598");
|
||||||
payload.setCurrency("RUB");
|
payload.put("correspondentAccountName", "BIK OF TINKOFF");
|
||||||
payload.setDestination("OOO ROGA I KOPITA");
|
payload.put("currency", "RUB");
|
||||||
payload.setTaxpayerIdentificationNumber("848484848484");
|
payload.put("destination", "OOO ROGA I KOPITA");
|
||||||
payload.setTaxRegistrationReasonCode("886886");
|
payload.put("taxpayerIdentificationNumber", "848484848484");
|
||||||
payload.setId(existBankAccount.getId());
|
payload.put("taxRegistrationReasonCode", "886886");
|
||||||
expected.setPayload(payload);
|
payload.put("id", existBankAccount.getId());
|
||||||
|
expected.fromEntity(payload);
|
||||||
//ACT
|
//ACT
|
||||||
perform(MockMvcRequestBuilders.get(REST_URL + existBankAccount.getId())
|
perform(MockMvcRequestBuilders.get(REST_URL + existBankAccount.getId())
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ public class CompanySymbolUpdateRequest {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@Deprecated // todo новая мета без этого поля
|
||||||
private String companySymbol;
|
private String companySymbol;
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private String companySymbolValue;
|
private String companySymbolValue;
|
||||||
|
|
@ -29,10 +30,12 @@ public class CompanySymbolUpdateRequest {
|
||||||
this.companyId = companyId;
|
this.companyId = companyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public String getCompanySymbol() {
|
public String getCompanySymbol() {
|
||||||
return companySymbol;
|
return companySymbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public void setCompanySymbol(String companySymbol) {
|
public void setCompanySymbol(String companySymbol) {
|
||||||
this.companySymbol = companySymbol;
|
this.companySymbol = companySymbol;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue