company-service улучшил валидацию для Relation companyId

This commit is contained in:
AKurakin 2023-05-29 14:36:41 +03:00
parent 537f8a3ff6
commit fe241653b5

View file

@ -118,7 +118,9 @@ public class RelationService extends QueueConsumer implements InitializingBean {
String serviceStatus = req.getServiceStatus();
if (serviceStatus == null || serviceStatus.isEmpty()) {
Company company = companyMap.getSingleObjectByID(req.getCompanyId());
req.setServiceStatus(company.getWorkflowStatus());
if (company != null) {
req.setServiceStatus(company.getWorkflowStatus());
}
}
}
{ // Валидация
@ -281,6 +283,7 @@ public class RelationService extends QueueConsumer implements InitializingBean {
// --- internal API ---
protected void createNewRelation(ImdgTransaction transaction, Long companyId, ClearingMemberCategory clearingMemberCategory) {
Objects.requireNonNull(companyId, "companyId");
Imdg<Relation> relationMap = transaction.getImdg(IMDGDistributedNames.Map_Relation, Relation.class);
Relation relation = new Relation();
Company company = transaction.getImdg(IMDGDistributedNames.Map_Company, Company.class).getSingleObjectByFieldValues(Map.of("id", companyId));