diff --git a/pom.xml b/pom.xml index a8eb2a15..0ae3d0b9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.iemr.common-API common-api - 3.2.1 + 3.4.0 war Common-API diff --git a/src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java b/src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java index aee6b8f7..dfb76d00 100644 --- a/src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java +++ b/src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java @@ -35,6 +35,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; import com.google.gson.JsonObject; import com.google.gson.annotations.Expose; import com.iemr.common.model.user.TitleModel; @@ -211,16 +212,19 @@ public class BeneficiaryModel implements Comparable { @Expose private Integer occupationId; @Expose + @JsonProperty("occupationOther") private String occupationName; @Expose private String occupation; @Expose + @JsonProperty("incomeName") private String incomeStatus; @Expose private BigInteger religionId; @Expose private String religion; @Expose + @JsonProperty("educationQualificationName") private String education; @Expose private Integer providerServiceMapID; diff --git a/src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java b/src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java index 1d829d17..7f6f6266 100644 --- a/src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java +++ b/src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java @@ -37,7 +37,6 @@ import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; -import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; import com.iemr.common.data.beneficiary.Beneficiary; import com.iemr.common.data.mctshistory.MctsOutboundCallDetail; @@ -112,7 +111,6 @@ private void updateBeneficiaryID(String beneficiaryID, Long beneficiaryRegID) { @Override public Integer updateBenificiary(BeneficiaryModel benificiaryDetails, String auth) throws IEMRException { Integer updatedRows = 0; - IdentityEditDTO identityEditDTO = identityBenEditMapper.BenToIdentityEditMapper(benificiaryDetails); setDemographicDetails(identityEditDTO,benificiaryDetails); @@ -122,11 +120,9 @@ public Integer updateBenificiary(BeneficiaryModel benificiaryDetails, String aut benificiaryDetails.getCreatedBy())); } identityEditDTO.setDob(benificiaryDetails.getDOB()); - // identityEditDTO.setOtherFields(benificiaryDetails.getOtherFields()); - // String jsoninput=new Gson().toJson(identityEditDTO); updatedRows = identityBeneficiaryService.editIdentityEditDTO(identityEditDTO, auth, benificiaryDetails.getIs1097()); - + return updatedRows; } @@ -140,11 +136,22 @@ else if(null != benificiaryDetails.getI_bendemographics().getReligion()) identityEditDTO.setReligion(benificiaryDetails.getI_bendemographics().getReligion()); else identityEditDTO.setReligion(benificiaryDetails.getI_bendemographics().getReligionName()); - if(null != benificiaryDetails.getOccupation()) - identityEditDTO.setOccupationName(benificiaryDetails.getOccupation()); - else - identityEditDTO.setOccupationName(benificiaryDetails.getI_bendemographics().getOccupation()); - identityEditDTO.setEducation(benificiaryDetails.getI_bendemographics().getEducationName()); + + if (null != benificiaryDetails.getOccupation()) { + identityEditDTO.setOccupationName(benificiaryDetails.getOccupation()); + } else if (null != benificiaryDetails.getI_bendemographics() && + null != benificiaryDetails.getI_bendemographics().getOccupation()) { + identityEditDTO.setOccupationName(benificiaryDetails.getI_bendemographics().getOccupation()); + } else { + identityEditDTO.setOccupationName(benificiaryDetails.getOccupationName()); + } + + if (null != benificiaryDetails.getEducation()) { + identityEditDTO.setEducation(benificiaryDetails.getEducation()); + } else if (null != benificiaryDetails.getI_bendemographics() && + null != benificiaryDetails.getI_bendemographics().getEducationName()) { + identityEditDTO.setEducation(benificiaryDetails.getI_bendemographics().getEducationName()); + } if(null != benificiaryDetails.getIncomeStatus()) identityEditDTO.setIncomeStatus(benificiaryDetails.getIncomeStatus()); else @@ -206,12 +213,25 @@ else if(null != beneficiaryModel.getI_bendemographics().getReligion()) identityDTO.setReligion(beneficiaryModel.getI_bendemographics().getReligion()); else identityDTO.setReligion(beneficiaryModel.getI_bendemographics().getReligionName()); - if(null != beneficiaryModel.getOccupation()) - identityDTO.setOccupationName(beneficiaryModel.getOccupation()); - else - identityDTO.setOccupationName(beneficiaryModel.getI_bendemographics().getOccupation()); - if(null != beneficiaryModel.getI_bendemographics().getEducationName()) - identityDTO.setEducation(beneficiaryModel.getI_bendemographics().getEducationName()); + + if (null != beneficiaryModel.getOccupation()) { + identityDTO.setOccupationName(beneficiaryModel.getOccupation()); + } else if (null != beneficiaryModel.getI_bendemographics() && + null != beneficiaryModel.getI_bendemographics().getOccupation()) { + identityDTO.setOccupationName(beneficiaryModel.getI_bendemographics().getOccupation()); + } else { + identityDTO.setOccupationName(beneficiaryModel.getOccupationName()); + } + + if (null != beneficiaryModel.getEducation()) { + identityDTO.setEducation(beneficiaryModel.getEducation()); + } else if (null != beneficiaryModel.getI_bendemographics() && + null != beneficiaryModel.getI_bendemographics().getEducationName()) { + identityDTO.setEducation(beneficiaryModel.getI_bendemographics().getEducationName()); + } + + + if(null != beneficiaryModel.getIncomeStatus()) identityDTO.setIncomeStatus(beneficiaryModel.getIncomeStatus()); else diff --git a/src/main/java/com/iemr/common/utils/JwtUserIdValidationFilter.java b/src/main/java/com/iemr/common/utils/JwtUserIdValidationFilter.java index 0b8f6f94..13eaea2f 100644 --- a/src/main/java/com/iemr/common/utils/JwtUserIdValidationFilter.java +++ b/src/main/java/com/iemr/common/utils/JwtUserIdValidationFilter.java @@ -1,6 +1,7 @@ package com.iemr.common.utils; import java.io.IOException; +import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -15,7 +16,6 @@ import jakarta.servlet.http.Cookie; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; -import java.util.Arrays; public class JwtUserIdValidationFilter implements Filter { @@ -39,11 +39,11 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo logger.debug("Incoming Origin: {}", origin); logger.debug("Allowed Origins Configured: {}", allowedOrigins); - + logger.info("Add server authorization header to response"); if (origin != null && isOriginAllowed(origin)) { response.setHeader("Access-Control-Allow-Origin", origin); response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS"); - response.setHeader("Access-Control-Allow-Headers", "Authorization, Content-Type, Accept, Jwttoken"); + response.setHeader("Access-Control-Allow-Headers", "Authorization, Content-Type, Accept, Jwttoken, serverAuthorization, ServerAuthorization, serverauthorization, Serverauthorization"); response.setHeader("Access-Control-Allow-Credentials", "true"); } else { logger.warn("Origin [{}] is NOT allowed. CORS headers NOT added.", origin); @@ -150,7 +150,9 @@ private boolean isMobileClient(String userAgent) { if (userAgent == null) return false; userAgent = userAgent.toLowerCase(); - return userAgent.contains("okhttp"); // iOS (custom clients) + logger.info(userAgent); + // return userAgent.contains("okhttp"); // iOS (custom clients) + return userAgent.contains("okhttp") || userAgent.contains("java/"); // iOS (custom clients) } private boolean shouldSkipAuthentication(String path, String contextPath) {