fix response dto
This commit is contained in:
parent
1219c9fdf5
commit
f936b74328
2 changed files with 8 additions and 12 deletions
|
|
@ -13,7 +13,7 @@ public class ErvuOrgResponse implements Serializable {
|
|||
private static final long serialVersionUID = 1L;
|
||||
private boolean success;
|
||||
private String message;
|
||||
private Data[] data;
|
||||
private Data data;
|
||||
|
||||
public boolean getSuccess() {
|
||||
return success;
|
||||
|
|
@ -31,11 +31,11 @@ public class ErvuOrgResponse implements Serializable {
|
|||
this.message = message;
|
||||
}
|
||||
|
||||
public Data[] getData() {
|
||||
public Data getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Data[] data) {
|
||||
public void setData(Data data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import java.time.ZonedDateTime;
|
|||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.servlet.http.Cookie;
|
||||
|
|
@ -22,11 +21,11 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import ervu.service.okopf.OkopfService;
|
||||
import org.springframework.util.StringUtils;
|
||||
import ru.micord.ervu.security.esia.config.EsiaConfig;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import ru.micord.ervu.kafka.model.Brhs;
|
||||
import ru.micord.ervu.kafka.model.Data;
|
||||
import ru.micord.ervu.kafka.model.Employee;
|
||||
import ru.micord.ervu.kafka.model.ErvuOrgResponse;
|
||||
import ru.micord.ervu.kafka.model.OrgInfo;
|
||||
|
|
@ -420,15 +419,12 @@ public class EsiaAuthService {
|
|||
requestReplyTopic, objectMapper.writeValueAsString(orgInfo)
|
||||
);
|
||||
ErvuOrgResponse ervuOrgResponse = objectMapper.readValue(kafkaResponse, ErvuOrgResponse.class);
|
||||
List<String> listErvuId = Arrays.stream(ervuOrgResponse.getData()).filter(data -> data.getPrnOid().equals(prnOid)).map(
|
||||
Data::getOrgId_ERVU).toList();
|
||||
if (listErvuId.size() > 1) {
|
||||
throw new RuntimeException("More than one ervuId for prnOid = " + prnOid);
|
||||
}
|
||||
else if (listErvuId.isEmpty()) {
|
||||
String ervuId = ervuOrgResponse.getData().getOrgId_ERVU();
|
||||
|
||||
if (!StringUtils.hasText(ervuId)) {
|
||||
throw new RuntimeException("No ervuId for prnOid = " + prnOid);
|
||||
}
|
||||
return listErvuId.get(0);
|
||||
return ervuId;
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue