Merge branch 'dev' into CLS-536-Assets5StepExtractStatusChange
This commit is contained in:
commit
83581ace61
4 changed files with 16 additions and 7 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
package ru.spcex.clearing.company.config.validation;
|
package ru.spcex.clearing.company.config.validation;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import ru.clearing.classes.statics.data.company.Company;
|
import ru.clearing.classes.statics.data.company.Company;
|
||||||
|
|
@ -41,7 +42,8 @@ public class CompanyValidationConfig {
|
||||||
addImdg.accept(IMDGDistributedNames.Map_WorkflowStatusDictionary);
|
addImdg.accept(IMDGDistributedNames.Map_WorkflowStatusDictionary);
|
||||||
addImdg.accept(IMDGDistributedNames.Map_Company);
|
addImdg.accept(IMDGDistributedNames.Map_Company);
|
||||||
return new ValidatorImpl<>(context,
|
return new ValidatorImpl<>(context,
|
||||||
FieldRequiredRule.instance("shortName", CompanyNewRequest::getShortName, CompanyErrors.RequiredFieldEmpty),
|
FieldRequiredRule.instance("shortName", CompanyNewRequest::getShortName, CompanyErrors.RequiredFieldEmpty,
|
||||||
|
shortName -> StringUtils.isBlank(shortName) ? CompanyErrors.RequiredFieldEmpty : null),
|
||||||
FieldRequiredRule.instance("companySymbol", CompanyNewRequest::getCompanySymbol, CompanyErrors.RequiredFieldEmpty),
|
FieldRequiredRule.instance("companySymbol", CompanyNewRequest::getCompanySymbol, CompanyErrors.RequiredFieldEmpty),
|
||||||
FieldRequiredRule.instance("companySymbolValue", CompanyNewRequest::getCompanySymbolValue, CompanyErrors.RequiredFieldEmpty),
|
FieldRequiredRule.instance("companySymbolValue", CompanyNewRequest::getCompanySymbolValue, CompanyErrors.RequiredFieldEmpty),
|
||||||
DictionaryPresentRule.instance("workflowStatus",
|
DictionaryPresentRule.instance("workflowStatus",
|
||||||
|
|
@ -73,7 +75,8 @@ public class CompanyValidationConfig {
|
||||||
return new ValidatorImpl<>(context,
|
return new ValidatorImpl<>(context,
|
||||||
FieldRequiredRule.instance("id", CompanyNewRequest::getId, CompanyErrors.RequiredFieldEmpty),
|
FieldRequiredRule.instance("id", CompanyNewRequest::getId, CompanyErrors.RequiredFieldEmpty),
|
||||||
|
|
||||||
FieldRequiredRule.instance("shortName", CompanyNewRequest::getShortName, CompanyErrors.RequiredFieldEmpty),
|
FieldRequiredRule.instance("shortName", CompanyNewRequest::getShortName, CompanyErrors.RequiredFieldEmpty,
|
||||||
|
shortName -> StringUtils.isBlank(shortName) ? CompanyErrors.RequiredFieldEmpty : null),
|
||||||
// FieldRequiredRule.instance("companySymbol", CompanyNewRequest::getCompanySymbol, CompanyErrors.RequiredFieldEmpty),
|
// FieldRequiredRule.instance("companySymbol", CompanyNewRequest::getCompanySymbol, CompanyErrors.RequiredFieldEmpty),
|
||||||
// FieldRequiredRule.instance("companySymbolValue", CompanyNewRequest::getCompanySymbolValue, CompanyErrors.RequiredFieldEmpty),
|
// FieldRequiredRule.instance("companySymbolValue", CompanyNewRequest::getCompanySymbolValue, CompanyErrors.RequiredFieldEmpty),
|
||||||
FieldRequiredRule.instance("workflowStatus", CompanyNewRequest::getWorkflowStatus, CompanyErrors.RequiredFieldEmpty),
|
FieldRequiredRule.instance("workflowStatus", CompanyNewRequest::getWorkflowStatus, CompanyErrors.RequiredFieldEmpty),
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package ru.spcex.clearing.company.service;
|
package ru.spcex.clearing.company.service;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.kafka.clients.consumer.Consumer;
|
import org.apache.kafka.clients.consumer.Consumer;
|
||||||
import org.apache.kafka.clients.producer.Producer;
|
import org.apache.kafka.clients.producer.Producer;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
@ -87,8 +88,10 @@ public class CompanyInfoService extends QueueConsumer implements InitializingBea
|
||||||
return requestHelper.makeErrorResponse(companyInfoReq, CompanyErrors.CompanyNotFound, companyInfoReq.getId());
|
return requestHelper.makeErrorResponse(companyInfoReq, CompanyErrors.CompanyNotFound, companyInfoReq.getId());
|
||||||
}
|
}
|
||||||
company.setUpdated(Instant.now());
|
company.setUpdated(Instant.now());
|
||||||
company.setShortName(req.getShortName());
|
if (StringUtils.isNotEmpty(req.getShortName()))
|
||||||
company.setFullName(req.getFullName());
|
company.setShortName(req.getShortName());
|
||||||
|
if (StringUtils.isNotEmpty(req.getFullName()))
|
||||||
|
company.setFullName(req.getFullName());
|
||||||
CompanyInfo companyInfo = company.getProfile();
|
CompanyInfo companyInfo = company.getProfile();
|
||||||
|
|
||||||
companyInfo.setCountryCode(req.getCountryCode());
|
companyInfo.setCountryCode(req.getCountryCode());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package ru.spcex.clearing.company.service;
|
package ru.spcex.clearing.company.service;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.kafka.clients.consumer.Consumer;
|
import org.apache.kafka.clients.consumer.Consumer;
|
||||||
import org.apache.kafka.clients.producer.Producer;
|
import org.apache.kafka.clients.producer.Producer;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
@ -211,8 +212,10 @@ public class CompanyService extends QueueConsumer implements InitializingBean {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
company.setUpdated(Instant.now());
|
company.setUpdated(Instant.now());
|
||||||
company.setShortName(updateRequest.getShortName());
|
if (StringUtils.isNotEmpty(updateRequest.getShortName()))
|
||||||
company.setFullName(updateRequest.getFullName());
|
company.setShortName(updateRequest.getShortName());
|
||||||
|
if (StringUtils.isNotEmpty(updateRequest.getFullName()))
|
||||||
|
company.setFullName(updateRequest.getFullName());
|
||||||
|
|
||||||
if (updateRequest.getCompanySymbol() != null || updateRequest.getCompanySymbolValue() != null) {
|
if (updateRequest.getCompanySymbol() != null || updateRequest.getCompanySymbolValue() != null) {
|
||||||
log.trace("Request field CompanySymbol, CompanySymbolValue ignore for update company request.");
|
log.trace("Request field CompanySymbol, CompanySymbolValue ignore for update company request.");
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ public class MultiCompanyService
|
||||||
txOk = true;
|
txOk = true;
|
||||||
} catch (ValidationException vex) {
|
} catch (ValidationException vex) {
|
||||||
log.error("For gateway request.id={}, companyId={} error validate: {}", baseRequest.getId(), companyId, messageResolver.resolve(vex.getEnumMsg()));
|
log.error("For gateway request.id={}, companyId={} error validate: {}", baseRequest.getId(), companyId, messageResolver.resolve(vex.getEnumMsg()));
|
||||||
log.debug("For companyId={} error validation: {}", companyId, ExceptionUtils.getStackTrace(vex));
|
log.trace("For companyId={} error validation: {}", companyId, ExceptionUtils.getStackTrace(vex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (txOk) {
|
if (txOk) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue