diff --git a/pom.xml b/pom.xml
index 1cef5d22..ab39f22b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,10 +16,11 @@
REST API for communication between DB and Platine-Management UI and Platine-My-Surveys UI
21
- 2.2.0
- 3.1.0
+ 2.6.0
+ 3.2.0
3.1.0
- 5.0.0
+ 5.0.0
+ 42.7.3
1.0.2
inseefr
https://sonarcloud.io
@@ -86,7 +87,7 @@
org.postgresql
postgresql
- 42.3.9
+ ${postgre-version}
@@ -131,7 +132,7 @@
org.jeasy
easy-random-core
- ${jeasy-version}
+ ${easy-version}
com.github.javafaker
@@ -186,7 +187,7 @@
org.jacoco
jacoco-maven-plugin
- 0.8.11
+ 0.8.12
prepare-agent
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/ContactRepository.java b/src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/ContactRepository.java
index 976e067c..0a7f36f9 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/ContactRepository.java
+++ b/src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/ContactRepository.java
@@ -29,19 +29,15 @@ public interface ContactRepository extends PagingAndSortingRepository findByParameters(String identifier, String name, String email, String city, String function, Pageable pageable);
+ Page findByParameter(String param, Pageable pageable);
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactService.java b/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactService.java
index 96d871bf..efd34e56 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactService.java
+++ b/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactService.java
@@ -28,7 +28,7 @@ public interface ContactService {
* @param identifier contact identifier
* @return contact found
*/
- Contact findByIdentifier(String identifier) ;
+ Contact findByIdentifier(String identifier);
/**
* Update an existing contact and its address, or creates a new one
@@ -40,11 +40,12 @@ public interface ContactService {
/**
* Delete a contact. Delete also the contact address.
+ *
* @param identifier contact identifier
*/
void deleteContact(String identifier);
- Page findByParameters(String identifier, String name, String email, String city, String function, Pageable pageable);
+ Page findByParameter(String param, Pageable pageable);
Contact createContactAddressEvent(Contact contact, JsonNode payload);
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactServiceImpl.java b/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactServiceImpl.java
index c3e64f39..fca64319 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactServiceImpl.java
+++ b/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactServiceImpl.java
@@ -56,8 +56,8 @@ public void deleteContact(String identifier) {
}
@Override
- public Page findByParameters(String identifier, String name, String email, String city, String function, Pageable pageable) {
- return contactRepository.findByParameters(identifier, name, email, city, function, pageable);
+ public Page findByParameter(String param, Pageable pageable) {
+ return contactRepository.findByParameter(param, pageable);
}
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 79bd7f3b..c90612f3 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
@@ -29,8 +29,6 @@
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -65,25 +63,19 @@ public class SearchContactController {
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SearchContactDto.class)))),
@ApiResponse(responseCode = "400", description = "Bad Request")
})
- public ResponseEntity> searchContacts(
- @RequestParam(required = false) String identifier,
- @RequestParam(required = false) String name,
- @RequestParam(required = false) String email,
- @RequestParam(required = false) String city,
- @RequestParam(required = false) String function,
+ public Page searchContacts(
+ @RequestParam(required = false) String param,
@RequestParam(defaultValue = "0") Integer page,
@RequestParam(defaultValue = "10") Integer pageSize,
- @RequestParam(defaultValue = "identifier") String sort) {
+ @RequestParam(defaultValue = "identifier") String sort) {
log.info(
- "Search contact: identifier = {}, name= {}, email= {}, page= {}, pageSize= {} ",
- identifier, name, email, page, pageSize);
+ "Search contact: param = {} ", param, page, pageSize);
Pageable pageable = PageRequest.of(page, pageSize, Sort.by(sort));
- Page pageSearchContact = searchContactService.searchContactCrossDomain(identifier, name, email, city, function,
- pageable);
- return new ResponseEntity<>(pageSearchContact, HttpStatus.OK);
+ Page pageSearchContact = searchContactService.searchContactCrossDomain(param, pageable);
+ return pageSearchContact;
}
@@ -94,7 +86,7 @@ public ResponseEntity> searchContacts(
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = AccreditationDetailDto.class)))),
@ApiResponse(responseCode = "400", description = "Bad Request")
})
- public ResponseEntity> getContactAccreditations(
+ public List getContactAccreditations(
@PathVariable("id") String id,
@RequestParam(defaultValue = "false") boolean isFilterOpened) {
@@ -114,6 +106,7 @@ public ResponseEntity> getContactAccreditations(
survey.getSource().getShortWording(),
survey.getYear(),
part.getCampaign().getPeriod(),
+ part.getCampaign().getId(),
part.getId(),
part.getClosingDate(),
su.getIdSu(),
@@ -127,7 +120,7 @@ public ResponseEntity> getContactAccreditations(
}
- return new ResponseEntity<>(listAccreditations, HttpStatus.OK);
+ return listAccreditations;
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AccreditationDetailDto.java b/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AccreditationDetailDto.java
index 43561200..840bb164 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AccreditationDetailDto.java
+++ b/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AccreditationDetailDto.java
@@ -14,11 +14,11 @@
public class AccreditationDetailDto {
private String sourceId;
-
private String surveyId;
private String sourceWording;
private int year;
private PeriodEnum period;
+ private String campaignId;
private String partition;
private Date partioningClosingDate;
private String surveyUnitId;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/SearchContactService.java b/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/SearchContactService.java
index c7a450cf..7723b4cf 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/SearchContactService.java
+++ b/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/SearchContactService.java
@@ -7,20 +7,11 @@
public interface SearchContactService {
/**
- * Search contact according to diffeent parameters
- * @param identifier contact identifier
- * @param name (first name or and lastName)
- * @param email contact email
- * @param city contact city
- * @param function contact function
-
- * @return
+ * Search contact according to different parameters
+ * @param param search contact parameter (mail or identifier or name
+ * @return Page SearchContactDto
*/
Page searchContactCrossDomain(
- String identifier,
- String name,
- String email,
- String city,
- String function,
+ String param,
Pageable pageable);
}
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 02378afa..db05f2c1 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
@@ -22,23 +22,17 @@ public class SearchContactServiceImpl implements SearchContactService {
private final ContactService contactService;
- private final PartitioningService partioningService;
+ private final PartitioningService partitioningService;
private final QuestioningAccreditationService questioningAccreditationService;
@Override
- public Page searchContactCrossDomain(
- String identifier,
- String name,
- String email,
- String city,
- String function,
- Pageable pageable) {
+ public Page searchContactCrossDomain(String param, Pageable pageable) {
List listSearchContact = new ArrayList<>();
- Page pageContact = contactService.findByParameters(identifier, name, email,city, function, pageable);
+ Page pageContact = contactService.findByParameter(param, pageable);
for (Contact c : pageContact) {
listSearchContact.add(transformContactTSearchContactDto(c));
@@ -60,7 +54,7 @@ private SearchContactDto transformContactTSearchContactDto(Contact c) {
searchContact.setListSurveyUnitNames(listAccreditations.stream().map(a -> a.getQuestioning().getSurveyUnit().getIdSu()).distinct().toList());
searchContact.setListSourcesId(listAccreditations.stream().
map(a ->
- partioningService.findById(a.getQuestioning().getIdPartitioning()).getCampaign().getSurvey().getSource().getId()).distinct().toList());
+ partitioningService.findById(a.getQuestioning().getIdPartitioning()).getCampaign().getSurvey().getSource().getId()).distinct().toList());
return searchContact;
}
}