Skip to content

Commit

Permalink
Merge branch 'develop' into feature/version/upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
ravishanigarapu authored Jul 18, 2024
2 parents e96e831 + fe8c560 commit 92968ab
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,12 @@ public String searhBeneficiaryByFamilyId(

// search beneficiary by lastModDate and districtID
@CrossOrigin(origins = { "*commonapi*" })

@Operation(summary ="Search beneficiary by villageId and last modified date-time")
@PostMapping(path = "/searchByVillageIdAndLastModifiedDate")
public String searchBeneficiaryByVillageIdAndLastModDate(
@Param(value = "\"String\"") @RequestBody String object) {

logger.info("IdentityController.getBeneficiary - start. search object = " + object);
String response;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class RMNCHMobileAppController {
@PostMapping(value = "/syncDataToAmrit", consumes = "application/json", produces = "application/json")
@Operation(summary = "Sync data to AMRIT for already regestered beneficiary with AMRIT beneficiary id ")
public String syncDataToAmrit(@RequestBody String requestOBJ) {

OutputResponse response = new OutputResponse();
try {
if (requestOBJ != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.List;

import lombok.Data;
import java.util.List;

@Data
public class SearchSyncDTO {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,15 @@ public List<Object[]> getBenMappingByVanSerialNo(@Param("benMapIds") BigInteger
@Query(value = "select m from MBeneficiarymapping m where m.mBeneficiaryaddress.permVillageId IN :villageIDs and "
+ "(m.mBeneficiaryaddress.lastModDate > :lastModDate or m.mBeneficiarycontact.lastModDate > :lastModDate "
+ "or m.mBeneficiarydetail.lastModDate > :lastModDate ) order by m.benMapId Desc")

List<MBeneficiarymapping> findByBeneficiaryDetailsByVillageIDAndLastModifyDate(
@Param("villageIDs") List<Integer> villageID, @Param("lastModDate") Timestamp lastModifiedDate);


@Query(value = "select COUNT(m) from MBeneficiarymapping m where m.mBeneficiaryaddress.permVillageId IN :villageIDs and "
+ "(m.mBeneficiaryaddress.lastModDate > :lastModDate or m.mBeneficiarycontact.lastModDate > :lastModDate "
+ "or m.mBeneficiarydetail.lastModDate > :lastModDate ) order by m.benMapId Desc")

Long getBeneficiaryCountsByVillageIDAndLastModifyDate(@Param("villageIDs") List<Integer> villageID,
@Param("lastModDate") Timestamp lastModifiedDate);

Expand All @@ -135,4 +138,5 @@ Long getBeneficiaryCountsByVillageIDAndLastModifyDate(@Param("villageIDs") List<
*
* List<VBenAdvanceSearch> dynamicFilterSearchNew(IdentitySearchDTO searchDTO);
*/

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface RMNCHBenDetailsRepo extends CrudRepository<RMNCHMBeneficiarydet
@Query(" SELECT t FROM RMNCHMBeneficiarydetail t WHERE t.id = :vanSerialNo AND t.VanID = :vanID")
public RMNCHMBeneficiarydetail getByIdAndVanID(@Param("vanSerialNo") BigInteger vanSerialNo,
@Param("vanID") int vanID);

@Query(" SELECT t FROM RMNCHMBeneficiarydetail t WHERE t.id = " +
"(SELECT m.benDetailsId from RMNCHMBeneficiarymapping m where m.benRegId = :beneficiaryRegID)")
public RMNCHMBeneficiarydetail getByBenRegID(@Param("beneficiaryRegID") BigInteger beneficiaryRegID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,11 @@ public List<BeneficiariesDTO> searchBeneficiaryByVillageIdAndLastModifyDate(List
// find benmap ids
List<MBeneficiarymapping> benMappingsList = mappingRepo.findByBeneficiaryDetailsByVillageIDAndLastModifyDate(villageIDs, lastModifiedDate);
if (benMappingsList != null && !benMappingsList.isEmpty()){

for (MBeneficiarymapping benMapOBJ : benMappingsList) {
beneficiaryList.add(this.getBeneficiariesDTO(benMapOBJ));
}
}

} catch (Exception e) {
logger.error(
"error in beneficiary search to sync to CHO App with villageIDs: {} " , villageIDs + " error : " + e.getLocalizedMessage());
Expand All @@ -535,6 +535,7 @@ public Long countBeneficiaryByVillageIdAndLastModifyDate(List<Integer> villageID
}
return beneficiaryCount;
}

public List<BeneficiariesDTO> searhBeneficiaryByGovIdentity(String identity)
throws NoResultException, QueryTimeoutException {
List<BeneficiariesDTO> beneficiaryList = new ArrayList<>();
Expand Down Expand Up @@ -1543,7 +1544,6 @@ public void editIdentityEducationOrCommunity(IdentityEditDTO identity) throws Mi
identity.getEducationId());
}
}

}

public int importBenIdToLocalServer(List<BenIdImportDTO> benIdImportDTOList) {
Expand Down Expand Up @@ -1576,7 +1576,6 @@ public int importBenIdToLocalServer(List<BenIdImportDTO> benIdImportDTOList) {
return i.length;
} else
return 0;

}

public Long checkBenIDAvailabilityLocal() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public String syncDataToAmrit(String requestOBJ) throws Exception {
.fromJson(jsnOBJ.get("beneficiaryDetails"), RMNCHBeneficiaryDetailsRmnch[].class);
List<RMNCHBeneficiaryDetailsRmnch> benDetailsExtraList = Arrays.asList(objArr);
List<RMNCHMBeneficiarydetail> benDetailsList = new ArrayList<>();

if (benDetailsExtraList != null && benDetailsExtraList.size() > 0) {
// benRegID = rMNCHMBenRegIdMapRepo.getRegID(benDetailsExtraList.get(0).getBenficieryid());
//
Expand All @@ -165,6 +166,7 @@ public String syncDataToAmrit(String requestOBJ) throws Exception {
}
obj.setRelatedBeneficiaryIdsDB(sb.toString());
}

RMNCHMBeneficiarydetail rmnchmBeneficiarydetail =
rMNCHBenDetailsRepo.getByBenRegID(obj.getBenRegId());
if (rmnchmBeneficiarydetail != null) {
Expand All @@ -181,6 +183,21 @@ public String syncDataToAmrit(String requestOBJ) throws Exception {
benDetailsList.add(rmnchmBeneficiarydetail);
}

RMNCHMBeneficiarydetail rmnchmBeneficiarydetail =
rMNCHBenDetailsRepo.getByBenRegID(BigInteger.valueOf(obj.getBenRegId()));
if (rmnchmBeneficiarydetail != null) {
rmnchmBeneficiarydetail.setFirstName(obj.getFirstName());
rmnchmBeneficiarydetail.setLastName(obj.getLastName());
rmnchmBeneficiarydetail.setFatherName(obj.getFatherName());
rmnchmBeneficiarydetail.setMotherName(obj.getMotherName());
rmnchmBeneficiarydetail.setDob(obj.getDob());
rmnchmBeneficiarydetail.setSpousename(obj.getSpousename());
rmnchmBeneficiarydetail.setGender(obj.getGender());
rmnchmBeneficiarydetail.setGenderId(obj.getGenderId());
rmnchmBeneficiarydetail.setMaritalstatus(obj.getMaritalstatus());
rmnchmBeneficiarydetail.setMaritalstatusId(obj.getMaritalstatusId());
benDetailsList.add(rmnchmBeneficiarydetail);
}
}

benDetailsExtraList = (ArrayList<RMNCHBeneficiaryDetailsRmnch>) rMNCHBeneficiaryDetailsRmnchRepo
Expand Down

0 comments on commit 92968ab

Please sign in to comment.