Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions admin/admin-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,22 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-cbeffutil-api</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>io.mosip.biometric.util</groupId>
<artifactId>biometrics-util</artifactId>
<version>1.2.0</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</exclusion>
</exclusions>
</dependency>

</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.mosip.admin.bulkdataupload.entity;

import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDate;

@Data
@Entity
@Table(name = "applicant_login_detail", schema = "master")
public class ApplicantUserDetailsEntity extends BaseEntity implements Serializable {

private static final long serialVersionUID = -8541947587557590379L;

@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "org.hibernate.id.UUIDGenerator")
@Column(name = "id", nullable = false, length = 64)
private String id;

@Column(name = "usr_id", nullable = false, length = 64)
private String userId;

@Column(name = "login_date")
private LocalDate loginDate;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.mosip.admin.bulkdataupload.entity;

import io.mosip.kernel.core.dataaccess.spi.repository.BaseRepository;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;

/**
* @author Dhanendra
*
*/
@Repository
public interface ApplicantUserDetailsRepository extends BaseRepository<ApplicantUserDetailsEntity, String> {


long countByUserIdAndLoginDate(String userId, LocalDate loginDate);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.mosip.admin.constant;

public enum ApplicantDetailErrorCode {

UNABLE_TO_RETRIEVE_RID_DETAILS("ADM-AVD-001", "A technical error occurred while retrieving the data, please try again after some time."),
RID_INVALID("ADM-AVD-002","RID is invalid"),
RID_NOT_FOUND("ADM-AVD-003","The card for this request ID is not generated. Please check the status of the ID."),
DATA_NOT_FOUND("ADM-AVD-004","Applicant Photo Not Found"),
DIGITAL_CARD_RID_NOT_FOUND("ADM-AVD-005", "Digital card not found for the RID, please try after few days"),
DIGITAL_CARD_NOT_ACKNOWLEDGED("ADM-AVD-006", "Please acknowledge the details before downloading digital card"),
REQ_ID_NOT_FOUND("ADM-AVD-007","Request id not found"),

LIMIT_EXCEEDED("ADM-AVD-008","Your daily search limit has exceeded. Please try searching again tomorrow."),

DATA_SHARE_EXPIRED_EXCEPTION("ADM-AVD-008", "Data share usuage expired");

private final String errorCode;
private final String errorMessage;

private ApplicantDetailErrorCode(final String errorCode, final String errorMessage) {
this.errorCode = errorCode;
this.errorMessage = errorMessage;
}

public String getErrorCode() {
return errorCode;
}

public String getErrorMessage() {
return errorMessage;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package io.mosip.admin.controller;

import io.mosip.admin.dto.ApplicantDetailsDto;
import io.mosip.admin.dto.ApplicantUserDetailsDto;
import io.mosip.admin.packetstatusupdater.util.AuditUtil;
import io.mosip.admin.packetstatusupdater.util.EventEnum;
import io.mosip.admin.service.ApplicantDetailService;
import io.mosip.kernel.core.http.ResponseWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.ByteArrayInputStream;

@RestController
public class ApplicantDetailsController {

@Autowired
AuditUtil auditUtil;

@Autowired
ApplicantDetailService applicantDetailService;

//@PreAuthorize("hasRole(''ZONAL_ADMIN','GLOBAL_ADMIN'')")
@PreAuthorize("hasAnyRole(@authorizedRoles.getGetpacketstatusupdate())")
@GetMapping("/applicantDetails/{rid}")
public ResponseWrapper<ApplicantDetailsDto> getApplicantDetails(@PathVariable("rid") String rid) throws Exception {
auditUtil.setAuditRequestDto(EventEnum.APPLICANT_VERIFICATION_API_CALLED,null);
ResponseWrapper<ApplicantDetailsDto> responseWrapper = new ResponseWrapper<>();
responseWrapper.setResponse(applicantDetailService.getApplicantDetails(rid));
auditUtil.setAuditRequestDto(EventEnum.APPLICANT_VERIFICATION_SUCCESS,null);
return responseWrapper;
}

// @PreAuthorize("hasRole(''ZONAL_ADMIN','GLOBAL_ADMIN'')")
@PreAuthorize("hasAnyRole(@authorizedRoles.getGetpacketstatusupdate())")
@GetMapping("/applicantDetails/getLoginDetails")
public ResponseWrapper<ApplicantUserDetailsDto> getApplicantUserDetails() throws Exception {
auditUtil.setAuditRequestDto(EventEnum.APPLICANT_LOGIN_DETAILS_API_CALLED,null);
ResponseWrapper<ApplicantUserDetailsDto> responseWrapper = new ResponseWrapper<>();
responseWrapper.setResponse(applicantDetailService.getApplicantUserDetails());
auditUtil.setAuditRequestDto(EventEnum.APPLICANT_LOGIN_DETAILS_SUCCESS,null);
return responseWrapper;
}

// @PreAuthorize("hasRole(''ZONAL_ADMIN','GLOBAL_ADMIN'')")
@PreAuthorize("hasAnyRole(@authorizedRoles.getGetpacketstatusupdate())")
@GetMapping("/rid-digital-card/{rid}")
public ResponseEntity<Object> getRIDDigitalCard(
@PathVariable("rid") String rid,@RequestParam("isAcknowledged") boolean isAcknowledged) throws Exception {
auditUtil.setAuditRequestDto(EventEnum.RID_DIGITAL_CARD_REQ,null);
byte[] pdfBytes = applicantDetailService.getRIDDigitalCard(rid,isAcknowledged);
InputStreamResource resource = new InputStreamResource(new ByteArrayInputStream(pdfBytes));
auditUtil.setAuditRequestDto(EventEnum.RID_DIGITAL_CARD_REQ_SUCCESS,null);
return ResponseEntity.ok().contentType(MediaType.parseMediaType("application/pdf"))
.header("Content-Disposition", "attachment; filename=\"" +
rid + ".pdf\"")
.body((Object) resource);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.mosip.admin.dto;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ApplicantDetailsDto {

Map<String , String> applicantDataMap=new HashMap<>();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.mosip.admin.dto;

import lombok.Data;

@Data
public class ApplicantUserDetailsDto {

private int maxCount;

private int count;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.mosip.admin.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class DigitalCardStatusResponseDto {

private String id;

private String statusCode;

private String url;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
*/
public enum ApiName {

LOST_RID_API,CRYPTOMANAGERDECRYPT_API,MACHINE_GET_API;
LOST_RID_API,CRYPTOMANAGERDECRYPT_API,MACHINE_GET_API,RETRIEVE_IDENTITY_API,DIGITAL_CARD_STATUS_URL;

}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,27 @@ public enum EventEnum {
ADMIN_PROXY_ERROR("ADM-MSD-411",AuditConstant.AUDIT_SYSTEM,"Request for Admin Proxy","Failed to call Rest api - %s","ADM-MSD","Admin Proxy service","NO_ID","NO_ID_TYPE",AuditConstant.APPLICATION_ID,AuditConstant.APPLICATION_NAME),
KEYMANAGER_PROXY_API_CALLED("ADM-MSD-410", AuditConstant.AUDIT_SYSTEM, "Request for KeyManager proxy API",
"API called for KeyManager proxy", "ADM-MSD", "Admin Proxy service", "NO_ID", "NO_ID_TYPE",
AuditConstant.APPLICATION_ID, AuditConstant.APPLICATION_NAME );
AuditConstant.APPLICATION_ID, AuditConstant.APPLICATION_NAME ),
APPLICANT_VERIFICATION_API_CALLED("ADM-AVD-501", AuditConstant.AUDIT_SYSTEM, "Request for Applicant Verification API",
"API called for Applicant Verification request", "ADM-AVD", "Admin service", "NO_ID", "NO_ID_TYPE",
AuditConstant.APPLICATION_ID, AuditConstant.APPLICATION_NAME),
APPLICANT_VERIFICATION_SUCCESS("ADM-AVD-502", AuditConstant.AUDIT_SYSTEM, "Request for Applicant Verification API",
"successfully return the applicantPhoto and dob", "ADM-AVD", "admin service", "NO_ID", "NO_ID_TYPE",
AuditConstant.APPLICATION_ID, AuditConstant.APPLICATION_NAME),
APPLICANT_VERIFICATION_ERROR("ADM-AVD-503",AuditConstant.AUDIT_SYSTEM,"Request for Applicant Verification","Failed to call Rest api - %s","ADM-AVD","admin service","NO_ID","NO_ID_TYPE",AuditConstant.APPLICATION_ID,AuditConstant.APPLICATION_NAME),
RID_DIGITAL_CARD_REQ_EXCEPTION("ADM-AVD-504",AuditConstant.AUDIT_SYSTEM,"Request for Digital Card","Downloading digital card based on RID failed - %s","ADM-AVD","admin service","NO_ID","NO_ID_TYPE",AuditConstant.APPLICATION_ID,AuditConstant.APPLICATION_NAME),
RID_DIGITAL_CARD_REQ("ADM-AVD-505", AuditConstant.AUDIT_SYSTEM, "Request for Digital Card",
"API called for Digital card", "ADM-AVD", "Admin service", "NO_ID", "NO_ID_TYPE",
AuditConstant.APPLICATION_ID, AuditConstant.APPLICATION_NAME),
RID_DIGITAL_CARD_REQ_SUCCESS("ADM-AVD-506", AuditConstant.AUDIT_SYSTEM, "Request for Digital Card",
"successfully returned the digital card", "ADM-AVD", "admin service", "NO_ID", "NO_ID_TYPE",
AuditConstant.APPLICATION_ID, AuditConstant.APPLICATION_NAME),
APPLICANT_LOGIN_DETAILS_API_CALLED("ADM-AVD-507", AuditConstant.AUDIT_SYSTEM, "Request for Applicant Login Details API",
"API called for Applicant Login Details", "ADM-AVD", "Admin service", "NO_ID", "NO_ID_TYPE",
AuditConstant.APPLICATION_ID, AuditConstant.APPLICATION_NAME),
APPLICANT_LOGIN_DETAILS_SUCCESS("ADM-AVD-508", AuditConstant.AUDIT_SYSTEM, "Request for Applicant Login Details API",
"successfully return the login details", "ADM-AVD", "admin service", "NO_ID", "NO_ID_TYPE",
AuditConstant.APPLICATION_ID, AuditConstant.APPLICATION_NAME);


private final String eventId;
Expand Down
Loading