diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/SearchContactController.java b/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/SearchContactController.java index 6349a159..77a21146 100644 --- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/SearchContactController.java +++ b/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/SearchContactController.java @@ -69,18 +69,18 @@ public ResponseEntity> searchContacts( @RequestParam(required = false) String identifier, @RequestParam(required = false) String name, @RequestParam(required = false) String email, - @RequestParam(defaultValue = "0") Integer pageNo, + @RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer pageSize) { log.info( - "Search contact: identifier = {}, name= {}, email= {}, pageNo= {}, pageSize= {} ", - identifier, name, email, pageNo, pageSize); + "Search contact: identifier = {}, name= {}, email= {}, page= {}, pageSize= {} ", + identifier, name, email, page, pageSize); - Pageable pageable = PageRequest.of(pageNo, pageSize); + Pageable pageable = PageRequest.of(page, pageSize); - Page page = searchContactService.searchContactCrossDomain(identifier, name, email, + Page pageSearchContact = searchContactService.searchContactCrossDomain(identifier, name, email, pageable); - return new ResponseEntity<>(page, HttpStatus.OK); + return new ResponseEntity<>(pageSearchContact, HttpStatus.OK); } diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchContactDto.java b/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchContactDto.java index b13d888f..85afbfcc 100644 --- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchContactDto.java +++ b/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchContactDto.java @@ -13,6 +13,8 @@ public class SearchContactDto { private String firstName; private String lastName; private String email; + private String phone; + private String city; private String function; private List listSurveyUnitNames; private List listSourcesId; diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/SearchContactServiceImpl.java b/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/SearchContactServiceImpl.java index 70c549c9..23c7d5f4 100644 --- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/SearchContactServiceImpl.java +++ b/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/SearchContactServiceImpl.java @@ -42,7 +42,7 @@ public Page searchContactCrossDomain( if (!StringUtils.isEmpty(identifier)) { Contact c = contactService.findByIdentifier(identifier.toUpperCase()); - pageContact = new PageImpl<>(Collections.singletonList(c),pageable,1); + pageContact = new PageImpl<>(Collections.singletonList(c), pageable, 1); } else if (!StringUtils.isEmpty(email)) { pageContact = contactService.findByEmail(email, pageable); @@ -65,6 +65,8 @@ private SearchContactDto transformContactTSearchContactDto(Contact c) { searchContact.setFirstName(c.getFirstName()); searchContact.setLastName(c.getLastName()); searchContact.setEmail(c.getEmail()); + searchContact.setPhone(c.getPhone()); + searchContact.setCity(c.getAddress() != null ? c.getAddress().getCityName() : ""); searchContact.setFunction(c.getFunction()); List listAccreditations = questioningAccreditationService.findByContactIdentifier(c.getIdentifier()); searchContact.setListSurveyUnitNames(listAccreditations.stream().map(a -> a.getQuestioning().getSurveyUnit().getIdSu()).distinct().toList());