Merge remote-tracking branch 'origin/feature/SUPPORT-9605_new' into develop
This commit is contained in:
commit
c932407854
6 changed files with 75 additions and 28 deletions
|
|
@ -0,0 +1,14 @@
|
|||
package ru.micord.ervu.exception;
|
||||
|
||||
/**
|
||||
* @author Adel Kalimullin
|
||||
*/
|
||||
public class JournalException extends RuntimeException {
|
||||
public JournalException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public JournalException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package ru.micord.ervu.journal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* @author ya.kuznetsova
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class JournalFileData {
|
||||
|
||||
@JsonProperty("orgId_ERVU")
|
||||
private String orgIdErvu; // идентификатор организации в ЕРВУ
|
||||
|
||||
@JsonProperty("filesInfo")
|
||||
private List<JournalFileInfo> filesInfo;
|
||||
|
||||
public String getOrgIdErvu() {
|
||||
return orgIdErvu;
|
||||
}
|
||||
|
||||
public JournalFileData setOrgIdErvu(String orgIdErvu) {
|
||||
this.orgIdErvu = orgIdErvu;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<JournalFileInfo> getFilesInfo() {
|
||||
return filesInfo;
|
||||
}
|
||||
|
||||
public JournalFileData setFilesInfo(List<JournalFileInfo> filesInfo) {
|
||||
this.filesInfo = filesInfo;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +1,25 @@
|
|||
package ru.micord.ervu.journal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* @author ya.kuznetsova
|
||||
* @author Adel Kalimullin
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class JournalFileDataResponse {
|
||||
private boolean success;
|
||||
private String message;
|
||||
private JournalFileData data;
|
||||
|
||||
@JsonProperty("orgId_ERVU")
|
||||
private String orgIdErvu; // идентификатор организации в ЕРВУ
|
||||
|
||||
@JsonProperty("filesInfo")
|
||||
private List<JournalFileInfo> filesInfo;
|
||||
|
||||
public String getOrgIdErvu() {
|
||||
return orgIdErvu;
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public JournalFileDataResponse setOrgIdErvu(String orgIdErvu) {
|
||||
this.orgIdErvu = orgIdErvu;
|
||||
return this;
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public List<JournalFileInfo> getFilesInfo() {
|
||||
return filesInfo;
|
||||
}
|
||||
|
||||
public JournalFileDataResponse setFilesInfo(List<JournalFileInfo> filesInfo) {
|
||||
this.filesInfo = filesInfo;
|
||||
return this;
|
||||
public JournalFileData getData() {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.kafka.requestreply.ReplyingKafkaTemplate;
|
||||
import org.springframework.kafka.requestreply.RequestReplyFuture;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.micord.ervu.kafka.exception.KafkaMessageException;
|
||||
import ru.micord.ervu.kafka.exception.KafkaMessageReplyTimeoutException;
|
||||
import ru.micord.ervu.kafka.service.ReplyingKafkaService;
|
||||
|
|
@ -18,7 +17,6 @@ import ru.micord.ervu.kafka.service.ReplyingKafkaService;
|
|||
/**
|
||||
* @author Eduard Tihomirov
|
||||
*/
|
||||
@Service
|
||||
public abstract class BaseReplyingKafkaService<T, V> implements ReplyingKafkaService<T, V> {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
|
|
|
|||
|
|
@ -470,6 +470,11 @@ public class EsiaAuthService {
|
|||
requestReplyTopic, objectMapper.writeValueAsString(orgInfo)
|
||||
);
|
||||
ErvuOrgResponse ervuOrgResponse = objectMapper.readValue(kafkaResponse, ErvuOrgResponse.class);
|
||||
if (!ervuOrgResponse.getSuccess()) {
|
||||
throw new EsiaException("Failed to get organization ervuId for prnOid = " + prnOid +
|
||||
". ErrorMessage: " + ervuOrgResponse.getMessage());
|
||||
}
|
||||
|
||||
String ervuId = ervuOrgResponse.getData().getErvuId();
|
||||
if (!StringUtils.isValidUUID(ervuId)) {
|
||||
throw new EsiaException("No valid ervuId for prnOid = " + prnOid);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package ru.micord.ervu.service.grid.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
|
@ -14,7 +13,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import ru.micord.ervu.exception.JsonParsingException;
|
||||
import ru.micord.ervu.exception.JournalException;
|
||||
import ru.micord.ervu.journal.JournalDto;
|
||||
import ru.micord.ervu.journal.JournalFileDataRequest;
|
||||
import ru.micord.ervu.journal.JournalFileDataResponse;
|
||||
|
|
@ -71,7 +70,13 @@ public class JournalInMemoryStaticGridLoadService implements
|
|||
replyTopic, objectMapper.writeValueAsString(journalFileDataRequest));
|
||||
JournalFileDataResponse journalFileDataResponse = objectMapper.readValue(responseJsonString,
|
||||
JournalFileDataResponse.class);
|
||||
ervuJournalList = journalFileDataResponse.getFilesInfo().stream()
|
||||
|
||||
if (!journalFileDataResponse.isSuccess()) {
|
||||
throw new JournalException(
|
||||
"Failed to retrieve journal data from ervu: " + journalFileDataResponse.getMessage());
|
||||
}
|
||||
|
||||
ervuJournalList = journalFileDataResponse.getData().getFilesInfo().stream()
|
||||
.flatMap(fileInfo -> fileInfo.getPackFiles().stream()
|
||||
.filter(fileDetail -> DOCUMENT.equals(fileDetail.getType()))
|
||||
.map(fileDetail -> JournalDtoMapper.mapToJournalDto(fileInfo, fileDetail))
|
||||
|
|
@ -79,7 +84,7 @@ public class JournalInMemoryStaticGridLoadService implements
|
|||
.toList();
|
||||
}
|
||||
catch (JsonProcessingException e) {
|
||||
throw new JsonParsingException("Failed to parse JournalFileDataResponse.", e);
|
||||
throw new JournalException("Failed to parse journalFileDataResponse.", e);
|
||||
}
|
||||
|
||||
AtomicInteger counter = new AtomicInteger(1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue