company-service http://jira.mfd.msk:8088/browse/CLS-259 часть правок (доделать relation)

This commit is contained in:
AKurakin 2023-06-05 20:42:24 +03:00
parent 3db1ef31b8
commit e99d83fb4f
4 changed files with 15 additions and 11 deletions

View file

@ -42,8 +42,8 @@ public class ProfileDocumentValidationConfig {
IMDGDistributedNames.Map_Company,
Company.class,
CompanyErrors.RequiredFieldEmpty,
CompanyErrors.CompanyNotFound,
company -> WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus()) ? null : CompanyErrors.CompanyDisabled),
CompanyErrors.CompanyNotFound
),
DictionaryPresentRule.instance("documentType",
ProfileDocumentNewRequest::getDocumentType,
IMDGDistributedNames.Map_DocumentTypeDictionary,

View file

@ -154,9 +154,9 @@ public class CompanySymbolService extends QueueConsumer implements InitializingB
if (companySymbols == null) {
throw new ClearingBaseException(new EnumMessage(CompanyErrors.CompanyInfoNotFound, req.getId()));
}
if (!companySymbols.getCompanySymbol().equalsIgnoreCase(req.getCompanySymbolValue())) {
throw new ClearingBaseException(new EnumMessage(CompanyErrors.EditCompanySymbols, req.getId()));
}
// if (!companySymbols.getCompanySymbol().equalsIgnoreCase(req.getCompanySymbolValue())) {
// throw new ClearingBaseException(new EnumMessage(CompanyErrors.EditCompanySymbols, req.getId()));
// }
companySymbols.setCompanySymbolValue(req.getCompanySymbolValue());
companySymbolsTMap.update(companySymbols);
companyService.updateCompanyBySymbol(transaction, companySymbols, false);

View file

@ -146,10 +146,6 @@ public class ProfileDocumentService extends QueueConsumer implements Initializin
log.warn("Company {} not found by profileDocument {}", profileDocument.getCompanyId(), profileDocument.getId());
return requestHelper.makeErrorResponse(deleteRequest, CompanyErrors.CompanyNotFound, profileDocument.getCompanyId());
}
if (!WorkflowStatus.Active.equalsByKey(existCompany.getWorkflowStatus())) {
log.debug("Company {} not active", profileDocument.getCompanyId());
return requestHelper.makeErrorResponse(deleteRequest, CompanyErrors.CompanyNotFound, profileDocument.getCompanyId());
}
ImdgTransaction transaction = imdgProvider.newTransaction();
transaction.beginTransaction();

View file

@ -335,7 +335,7 @@ public class RelationService extends QueueConsumer implements InitializingBean {
boolean txOk = false;
try {
tx.beginTransaction();
relationUpdate0(tx, req, relation); // первоначальное ТЗ.
//relationUpdate0(tx, req, relation); // первоначальное ТЗ.
boolean needAddNewRelation = false; // call relationNew0(req, companyId, firstCMC);
if (ru.spcex.platform.enumeration.Service.MKR.equalsByKey(relation.getService())) { // relation B or I or V
@ -467,6 +467,9 @@ public class RelationService extends QueueConsumer implements InitializingBean {
log.debug("Relation {} already reopened(resumed)", relation.getId());
return relation;
}
if (req.getComment() != null) {
relation.setComment(req.getComment());
}
relation.setServiceStatus(ServiceStatus.Reopened.getKey());
relation.setUpdated(Instant.now());
@ -504,7 +507,7 @@ public class RelationService extends QueueConsumer implements InitializingBean {
Relation relation = relationMap.getSingleObjectByID(req.getId());
Long companyId = relation.getConsumerId();
//fixme relation.getService() // mkr/fond - это с учётом сервиса - на какой он удаляется и какие буквы остаются. Если ни одного CMC нету по этим буквам то удалить.
Collection<String> companyCMC = selectCompanyClearingMemberCategory(companyId);
boolean companyCMCisBIV = companyCMC.contains(ClearingCategory.B.getKey()) || companyCMC.contains(ClearingCategory.I.getKey())
|| companyCMC.contains(ClearingCategory.V.getKey());
@ -598,7 +601,12 @@ public class RelationService extends QueueConsumer implements InitializingBean {
ClearingCategory clearingCategory = getEnumByKey(ClearingCategory.class, clearingMemberCategory.getClearingMemberCategory());
serviceStatus = serviceForCMC(clearingCategory).getKey();
}
/*
//todo here...
1) коммент обновить. сейчас не обязательно.
2)это от КМК приходит.
*/
Relation relation = searchRelation(transaction, clearingMemberCategory.getClearingMemberCategory(), companyId);
if (relation == null) {
log.debug("Relation for clearingMemberCategory.id={} {} not found", clearingMemberCategory.getId(), clearingMemberCategory.getClearingMemberCategory());