Skip to content

Commit

Permalink
#121 | changes done for Distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
vedfordev committed Apr 12, 2024
1 parent 10fa130 commit f0d365c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> typeOfCommunity = (ArrayList<String>) 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<String> images = subject.getObservation(IMAGES) == null ? new ArrayList<>() : (ArrayList<String>) subject.getObservation(IMAGES);
distributionDTO.setPhotographInformation(images.stream().map(
x -> goonjContextProvider.get().getMediaUrl() + x).collect(Collectors.joining(";")));
List<String> disclaimerImage = subject.getObservation(DISCLAIMER_PHOTOGRAPHS) == null ? new ArrayList<>() : (ArrayList<String>) subject.getObservation(DISCLAIMER_PHOTOGRAPHS);
distributionDTO.setDisclaimerPhotographs(disclaimerImage.stream().map(
x -> goonjContextProvider.get().getMediaUrl() + x).collect(Collectors.joining(";")));
List<String> receiverImages = subject.getObservation(RECEIVER_LIST_PHOTOGRAPHS) == null ? new ArrayList<>() : (ArrayList<String>) subject.getObservation(RECEIVER_LIST_PHOTOGRAPHS);
distributionDTO.setReceiverListPhotographs(receiverImages.stream().map(
x -> goonjContextProvider.get().getMediaUrl() + x).collect(Collectors.joining(";")));
List<DistributionLine> d = fetchDistributionLineItems(subject);
distributionDTO.setDistributionLines(d);
List<DistributionActivities> activities = fetchActivities(subject);
Expand Down

0 comments on commit f0d365c

Please sign in to comment.