diff --git a/goonj/src/main/java/org/avni_integration_service/goonj/domain/DistributionConstants.java b/goonj/src/main/java/org/avni_integration_service/goonj/domain/DistributionConstants.java index a32a4e5c..f8b6464a 100644 --- a/goonj/src/main/java/org/avni_integration_service/goonj/domain/DistributionConstants.java +++ b/goonj/src/main/java/org/avni_integration_service/goonj/domain/DistributionConstants.java @@ -69,5 +69,8 @@ public interface DistributionConstants { String ONLY_S_2_S = "Only S2S"; String TYPE_OF_SCHOOL = "Type of school"; String SCHOOL_ANGANWADI_NAME = "School / Aanganwadi / Learning Center Name"; - + String DISCLAIMER_PHOTOGRAPHS = "Disclaimer Photographs"; + String RECEIVER_LIST_PHOTOGRAPHS = "Receiver List Photographs"; + String TYPE_OF_COMMUNITY = "Type Of Community"; + String TOTAL_NUMBER_OF_RECEIVERS = "Total Number of Receivers inventory"; } diff --git a/goonj/src/main/java/org/avni_integration_service/goonj/dto/DistributionDTO.java b/goonj/src/main/java/org/avni_integration_service/goonj/dto/DistributionDTO.java index ca8be2a7..db1b7cd7 100644 --- a/goonj/src/main/java/org/avni_integration_service/goonj/dto/DistributionDTO.java +++ b/goonj/src/main/java/org/avni_integration_service/goonj/dto/DistributionDTO.java @@ -10,12 +10,12 @@ //@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonPropertyOrder({"source_id", "state", "district", "block", "localityVillageName", "tolaMohalla", "dateOfDistribution", "accountCode", "nameOfAccount", "typeOfCommunity", "typeOfInitiative", "photographInformation", "createdBy", - "modifiedBy", "distributionLines", "distributedTo", "inventoryIds", "numberOfDistributions", "quantity", "unit", + "modifiedBy", "distributionLines", "distributedTo", "inventoryIds", "quantity", "unit", "activities", "surveyedBy", "monitoredByOrDistributor", "approvedOrVerifiedBy", "teamOrExternal", "nameOfPOC", "pocContactNo", "reachedTo", "totalNumberOfReceivers", "groupName", "anyOtherDocumentSubmitted", "reportsCrosschecked", "name", "gender", "age", "fatherMotherName", "phoneNumber", "presentOccupation", "monthlyIncome", "noOfFamilyMember", "centreName", "shareABriefProvidedMaterial", "howtheMaterialMakesaDifference", "materialGivenFor", "noOfIndividualReached", - "remarks", "TypeOfSchool", "SchoolAanganwadiLearningCenterName"}) + "remarks", "TypeOfSchool", "SchoolAanganwadiLearningCenterName","DisclaimerPhotographs","ReceiverListPhotographs"}) public class DistributionDTO { @JsonProperty("sourceId") @@ -112,7 +112,10 @@ public class DistributionDTO { private String TypeOfSchool; @JsonProperty("SchoolAanganwadiLearningCenterName") private String SchoolAanganwadiLearningCenterName; - + @JsonProperty("DisclaimerPhotographs") + private String disclaimerPhotographs; + @JsonProperty("ReceiverListPhotographs") + private String receiverListPhotographs; /** * No args constructor for use in serialization */ @@ -181,7 +184,8 @@ public DistributionDTO(String source_id, String state, String district, String b Integer monthlyIncome, Integer noOfFamilyMember, String centreName, String shareABriefProvidedMaterial, String howtheMaterialMakesaDifference, String materialGivenFor, Integer noOfIndividualReached, Integer noOfFamiliesReached, - String remarks, String TypeOfSchool, String SchoolAanganwadiLearningCenterName) { + String remarks, String TypeOfSchool, String SchoolAanganwadiLearningCenterName, + String disclaimerPhotographs,String receiverListPhotographs) { super(); this.source_id = source_id; this.state = state; @@ -230,6 +234,8 @@ public DistributionDTO(String source_id, String state, String district, String b this.remarks = remarks; this.TypeOfSchool = TypeOfSchool; this.SchoolAanganwadiLearningCenterName = SchoolAanganwadiLearningCenterName; + this.disclaimerPhotographs = disclaimerPhotographs; + this.receiverListPhotographs = receiverListPhotographs; } @JsonProperty("sourceId") @@ -701,4 +707,22 @@ public String getSchoolAanganwadiLearningCenterName() { public void setSchoolAanganwadiLearningCenterName(String schoolAanganwadiLearningCenterName) { SchoolAanganwadiLearningCenterName = schoolAanganwadiLearningCenterName; } + + @JsonProperty("DisclaimerPhotographs") + public String getDisclaimerPhotographs() { + return disclaimerPhotographs; + } + + @JsonProperty("DisclaimerPhotographs") + public void setDisclaimerPhotographs(String disclaimerPhotographs) { + this.disclaimerPhotographs = disclaimerPhotographs; + } + @JsonProperty("ReceiverListPhotographs") + public String getReceiverListPhotographs() { + return receiverListPhotographs; + } + @JsonProperty("ReceiverListPhotographs") + public void setReceiverListPhotographs(String receiverListPhotographs) { + this.receiverListPhotographs = receiverListPhotographs; + } } diff --git a/goonj/src/main/java/org/avni_integration_service/goonj/repository/DistributionRepository.java b/goonj/src/main/java/org/avni_integration_service/goonj/repository/DistributionRepository.java index 37a08d57..a31dc243 100644 --- a/goonj/src/main/java/org/avni_integration_service/goonj/repository/DistributionRepository.java +++ b/goonj/src/main/java/org/avni_integration_service/goonj/repository/DistributionRepository.java @@ -91,11 +91,22 @@ private DistributionDTO createDistributionRequest(Subject subject) { Date distributionDate = DateTimeUtil.convertToDate((String) subject.getObservation(DISTRIBUTION_DATE)); distributionDate = DateTimeUtil.offsetTimeZone(distributionDate, DateTimeUtil.UTC, DateTimeUtil.IST); distributionDTO.setDateOfDistribution(DateTimeUtil.formatDate(distributionDate)); - distributionDTO.setTypeOfCommunity((String) subject.getObservation(TARGET_COMMUNITY)); + List typeOfCommunity = (ArrayList) subject.getObservation(TYPE_OF_COMMUNITY); + if(typeOfCommunity!= null){ + distributionDTO.setTypeOfCommunity(String.join(";",typeOfCommunity)); + }else{ + distributionDTO.setTypeOfCommunity((String) subject.getObservation(TARGET_COMMUNITY)); + } distributionDTO.setDisasterType((String) subject.getObservation(TYPE_OF_DISASTER)); List images = subject.getObservation(IMAGES) == null ? new ArrayList<>() : (ArrayList) subject.getObservation(IMAGES); distributionDTO.setPhotographInformation(images.stream().map( x -> goonjContextProvider.get().getMediaUrl() + x).collect(Collectors.joining(";"))); + List disclaimerImage = subject.getObservation(DISCLAIMER_PHOTOGRAPHS) == null ? new ArrayList<>() : (ArrayList) subject.getObservation(DISCLAIMER_PHOTOGRAPHS); + distributionDTO.setDisclaimerPhotographs(disclaimerImage.stream().map( + x -> goonjContextProvider.get().getMediaUrl() + x).collect(Collectors.joining(";"))); + List receiverImages = subject.getObservation(RECEIVER_LIST_PHOTOGRAPHS) == null ? new ArrayList<>() : (ArrayList) subject.getObservation(RECEIVER_LIST_PHOTOGRAPHS); + distributionDTO.setReceiverListPhotographs(receiverImages.stream().map( + x -> goonjContextProvider.get().getMediaUrl() + x).collect(Collectors.joining(";"))); List d = fetchDistributionLineItems(subject); distributionDTO.setDistributionLines(d); List activities = fetchActivities(subject);