Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile app changes #51

Merged
merged 11 commits into from
Jan 18, 2024
101 changes: 57 additions & 44 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<source-properties>target/classes/common_${environment}.properties</source-properties>
<maven.test.skip>true</maven.test.skip>
<sonar.java.binaries>target</sonar.java.binaries>
<deploy.wildfly.host>127.0.0.1</deploy.wildfly.host>
<deploy.wildfly.port>9990</deploy.wildfly.port>
<deploy.wildfly.username></deploy.wildfly.username>
<deploy.wildfly.password></deploy.wildfly.password>
</properties>
<dependencies>
<dependency>
Expand All @@ -41,7 +45,24 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>

<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
Expand All @@ -52,11 +73,13 @@
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.mysql/mysql-connector-j -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.2.0</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand All @@ -83,6 +106,13 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</exclusion>
</exclusions>

</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
Expand All @@ -109,19 +139,13 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.16.1</version><!--$NO-MVN-MAN-VER$-->
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-jobs</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
Expand All @@ -135,25 +159,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
</dependency>

<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>1.19.4</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
</dependency>
<!--START NEW DEPENDENCIES ADDED-->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -178,6 +189,23 @@
<artifactId>guava</artifactId>
<version>33.0.0-jre</version>
</dependency>

<!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api -->
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<!--END NEW DEPENDENCIES ADDED-->
</dependencies>
<profiles>
Expand All @@ -197,23 +225,7 @@
<build>
<finalName>identity-0.0.1</finalName>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>9.0.8</version>
<configuration>
<format>HTML</format>
<nvdApiServerId>nvd</nvdApiServerId>
<nvdApiKey>${NVD_API_KEY}</nvdApiKey>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
Expand Down Expand Up @@ -323,6 +335,7 @@
</webResources>
</configuration>
</plugin>

</plugins>
</build>
<reporting>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,21 @@
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.iemr.common.identity.utils.IEMRApplBeans;

@SpringBootApplication
@EnableTransactionManagement
public class IdentityApplication extends SpringBootServletInitializer {

public static void main(String[] args) {
SpringApplication.run(applicationClass, args);
SpringApplication.run(IdentityApplication.class, args);
}

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(applicationClass);
return application.sources(IdentityApplication.class);
}

private static Class<IdentityApplication> applicationClass = IdentityApplication.class;

@Bean
public IEMRApplBeans instantiateBeans(){

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.List;
import java.util.Objects;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -114,25 +115,13 @@
@Operation(summary = "Search beneficiary based on beneficiary registration id")
@PostMapping(path = "/getByBenRegId", headers = "Authorization")
public String getBeneficiariesByBeneficiaryRegId(
@Param(value = "\"Integer\"") @RequestParam String benRegId) {
logger.info("IdentityController.getBeneficiary - start. benId = " + benRegId);
@Param(value = "\"Integer\"") @RequestParam("benRegId") String benRegId) {
String response;
try {
String benRegIdValue = "";
JsonElement json = JsonParser.parseString(benRegId);

if (json instanceof JsonNull) {
if (null == benRegId || StringUtils.isEmpty(benRegId)) {
return getErrorResponseString("Null/Empty Beneficiary Id.", 5000, "failure", "");

}

if (json instanceof JsonPrimitive) {
benRegIdValue = benRegId;
} else {
benRegIdValue = InputMapper.getInstance().gson().fromJson(json, String.class);
}

List<BeneficiariesDTO> list = svc.getBeneficiariesByBenRegId(new BigInteger(benRegIdValue));
List<BeneficiariesDTO> list = svc.getBeneficiariesByBenRegId(new BigInteger(benRegId));
list.removeIf(Objects::isNull);
Collections.sort(list);
response = getSuccessResponseString(list, 200, "success", "getBeneficiariesByBeneficiaryRegId");
Expand All @@ -151,9 +140,7 @@
@Operation(summary = "Search identity based on beneficiary registration id")
@PostMapping(path = "/getByBenId", headers = "Authorization")
public String getBeneficiariesByBeneficiaryId(
@Param(value = "\"Integer\"") @RequestParam String benId) {
logger.info("IdentityController.getBeneficiary - start. benId = " + benId);

@Param(value = "\"Integer\"") @RequestParam("benId") String benId) {
String response;
try {
String benIdValue = "";
Expand Down Expand Up @@ -188,8 +175,7 @@
@Operation(summary = "Search beneficiary based on phone number")
@PostMapping(path = "/getByPhoneNum", headers = "Authorization")
public String getBeneficiariesByPhoneNum(
@Param(value = "\"String\"") @RequestParam String phoneNum) {
logger.info("IdentityController.getBeneficiary - start. phoneNum = " + phoneNum);
@Param(value = "\"String\"") @RequestParam("phoneNum") String phoneNum) {
String response;
try {
String phoneNumValue = "";
Expand Down Expand Up @@ -220,8 +206,7 @@
@Operation(summary = "Search beneficiary based on health ID / ABHA Address")
@PostMapping(path = "/getByAbhaAddress", headers = "Authorization")
public String searhBeneficiaryByABHAAddress(
@Param(value = "\"String\"") @RequestParam String healthID) {
logger.info("IdentityController.getBeneficiary - start. Health ID / ABHA Address = " + healthID);
@Param(value = "\"String\"") @RequestParam("healthID") String healthID) {
String response;
try {
String healthIDValue = "";
Expand Down Expand Up @@ -253,8 +238,7 @@
@Operation(summary = "Search beneficiary based on health ID number / ABHA ID number")
@PostMapping(path = "/getByAbhaIdNo", headers = "Authorization")
public String searhBeneficiaryByABHAIdNo(
@Param(value = "\"String\"") @RequestParam String healthIDNo) {
logger.info("IdentityController.getBeneficiary - start. HealthIDNo / ABHA Id No = " + healthIDNo);
@Param(value = "\"String\"") @RequestParam("healthIDNo") String healthIDNo) {
String response;
try {
String healthIDNoValue = "";
Expand Down Expand Up @@ -286,8 +270,7 @@
@Operation(summary = "Search beneficiary based on family id")
@PostMapping(path = "/searchByFamilyId", headers = "Authorization")
public String searhBeneficiaryByFamilyId(
@Param(value = "\"String\"") @RequestParam String familyId) {
logger.info("IdentityController.getBeneficiary - start. family id = " + familyId);
@Param(value = "\"String\"") @RequestParam("familyId") String familyId) {
String response;
try {

Expand All @@ -314,9 +297,9 @@

// search beneficiary by lastModDate and districtID
@CrossOrigin(origins = { "*commonapi*" })
@Operation(summary ="Search beneficiary by blockId and last modified date")
@PostMapping(path = "/searchByDistrictId")
public String searchBeneficiaryByBlockIdAndLastModDate(
@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;
Expand All @@ -325,25 +308,45 @@
JsonElement json = JsonParser.parseString(object);

SearchSyncDTO search = InputMapper.getInstance().gson().fromJson(json, SearchSyncDTO.class);
List<BeneficiariesDTO> list = svc.searchBeneficiaryByBlockIdAndLastModifyDate(search.getBlockID(), new Timestamp(search.getLastModifDate()));
List<BeneficiariesDTO> list = svc.searchBeneficiaryByVillageIdAndLastModifyDate(search.getVillageID(), new Timestamp(search.getLastModifiedDate()));

response = getSuccessResponseString(list, 200, "success", "getIdentityByAgent");
response = getSuccessResponseString(list, 200, "success", "getIdentityByVillageAndLastSyncTime");

logger.info("IdentityController.getBeneficiary - end");
} catch (Exception e) {
logger.error("error in beneficiary search by Family Id : " + e.getLocalizedMessage());
response = getErrorResponseString("error in beneficiary search by block Id : " + e.getLocalizedMessage(),
logger.error("error in beneficiary search by village Ids and last sync date : " + e.getLocalizedMessage());
response = getErrorResponseString("error in beneficiary search by village Ids and last sync date : " + e.getLocalizedMessage(),
5000, "failure", "");
}
return response;
}

// search beneficiary by lastModDate and districtID
@CrossOrigin(origins = { "*commonapi*" })
@Operation(summary ="Get count of beneficiary by villageId and last modified date-time")
@PostMapping(path = "/countBenByVillageIdAndLastModifiedDate")
public String countBeneficiaryByVillageIdAndLastModDate(
@Param(value = "\"String\"") @RequestBody String object) {
logger.info("IdentityController.getBeneficiaryCount- start. search object = " + object);
Fixed Show fixed Hide fixed
String response;
try {

JsonElement json = JsonParser.parseString(object);
SearchSyncDTO search = InputMapper.getInstance().gson().fromJson(json, SearchSyncDTO.class);
Long beneficiaryCount = svc.countBeneficiaryByVillageIdAndLastModifyDate(search.getVillageID(), new Timestamp(search.getLastModifiedDate()));
response = getSuccessResponseString(String.valueOf(beneficiaryCount), 200, "success", "getIdentityCountByVillageAndLastSyncTime");
logger.info("IdentityController.getBeneficiaryCount - end");
} catch (Exception e) {
logger.error("error in getting beneficiary count by village Ids and last sync date : " + e.getLocalizedMessage());
response = getErrorResponseString("error in getting beneficiary count by village Ids and last sync date : " + e.getLocalizedMessage(),
5000, "failure", "");
}
return response;
}
@CrossOrigin(origins = { "*commonapi*" })
@Operation(summary = "Search beneficiary based on government identity number")
@PostMapping(path = "/searhByGovIdentity", headers = "Authorization")
public String searhBeneficiaryByGovIdentity(
@Param(value = "\"String\"") @RequestParam String identity) {
logger.info("IdentityController.getBeneficiary - start. Gov Identity = " + identity);
@Param(value = "\"String\"") @RequestParam("identity") String identity) {
String response;
try {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,17 @@ public String syncDataToAmrit(@Param(value = "{\r\n" + " \"beneficiaryDetails\"
+ " \"nishchayPregnancyStatusPosition\": \"Integer\",\r\n"
+ " \"nishchayDeliveryStatus\": \"String\",\r\n"
+ " \"nishchayDeliveryStatusPosition\": \"Integer\",\r\n" + " \"relatedBeneficiaryIds\": [\r\n"
+ " \"Long\"\r\n" + " ]\r\n" + " }\r\n" + " ],\r\n" + " \"bornBirthDeatils\": [\r\n"
+ " \"Long\"\r\n" + " ],\r\n"
+ " \"beneficiaryRegID\":\"Long\",\"firstName\":\"String\",\"lastName\":\"String\",\"\n"
+ " \"dob\":\"Timestamp\",\"fatherName\":\"String\",\"spouseName\":\"String\",\"\n"
+ " \"govtIdentityNo\":\"String\",\"govtIdentityTypeID\":\"Integer\",\"emergencyRegistration\":\"Boolean\",\"\n"
+ " \"maritalstatusId\":\"Short\",\"maritalstatus\":\"String\",\"gender\":\"String\",\"genderId\":\"Integer\",\"i_bendemographics\":{\"educationID\":\"Long\",\"\n"
+ " \"beneficiaryRegID\":\"Long\",\"occupationID\":\"Integer\",\"healthCareWorkerID\":\"Short\",\"incomeStatusID\":\"Integer\",\"\n"
+ " \"communityID\":\"Integer\",\"preferredLangID\":\"Integer\",\"districtID\":\"Integer\",\"stateID\":\"Integer\",\"\n"
+ " \"pinCode\":\"String\",\"blockID\":\"Integer\",\"districtBranchID\":\"Integer\",\"createdBy\":\"String\",\"addressLine1\":\"String\"},\"\n"
+ " \"benPhoneMaps\":{\"parentBenRegID\":\"Long\",\"phoneNo\":\"String\",\"phoneTypeID\":\"Integer\",\"benRelationshipID\":\"Integer\",\"\n"
+ " \"deleted\":\"Boolean\",\"createdBy\":\"String\"},\"\n"
+ " }\r\n" + " ],\r\n" + " \"bornBirthDeatils\": [\r\n"
+ " {\r\n" + " \"BenRegId\": \"Long\",\r\n" + " \"Countyid\": \"Integer\",\r\n"
+ " \"Processed\": \"String\",\r\n" + " \"ProviderServiceMapID\": \"Integer\",\r\n"
+ " \"VanID\": \"Integer\",\r\n" + " \"bcdBatchNo\": \"String\",\r\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@
import java.math.BigInteger;
import java.sql.Timestamp;

import com.google.gson.annotations.Expose;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;

import org.hibernate.validator.constraints.Email;

import com.google.gson.annotations.Expose;

import jakarta.validation.constraints.Email;
import lombok.Data;

@Entity
Expand Down
Loading