Updated response

This commit is contained in:
rajesh
2024-12-27 17:31:58 +05:30
parent 549478b610
commit f8099fd423
6 changed files with 31 additions and 2 deletions

View File

@@ -110,6 +110,8 @@ public class ApplicationAmendmentRequestDao {
@Autowired @Autowired
private DocumentRepository documentRepository; private DocumentRepository documentRepository;
@Autowired
private CompanyService companyService;
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(Long applicationEvaluationId) { public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(Long applicationEvaluationId) {
log.info("Fetching the application data for the Amendment process {}", applicationEvaluationId); log.info("Fetching the application data for the Amendment process {}", applicationEvaluationId);
@@ -454,7 +456,8 @@ public class ApplicationAmendmentRequestDao {
UserEntity userEntity = userService.validateUser(application.getUserId()); UserEntity userEntity = userService.validateUser(application.getUserId());
response.setBeneficiaryName(buildBeneficiaryName(userEntity)); response.setBeneficiaryName(buildBeneficiaryName(userEntity));
CompanyEntity company = companyService.validateCompany(application.getCompanyId());
response.setCompanyName(company.getCompanyName());
Long protocolNumber = entity.getProtocol() != null ? entity.getProtocol().getProtocolNumber() : null; Long protocolNumber = entity.getProtocol() != null ? entity.getProtocol().getProtocolNumber() : null;
response.setProtocolNumber(protocolNumber); response.setProtocolNumber(protocolNumber);

View File

@@ -387,6 +387,16 @@ public class ApplicationDao {
responseBean.setStatus(applicationEntity.getStatus()); responseBean.setStatus(applicationEntity.getStatus());
responseBean.setComments(applicationEntity.getComments()); responseBean.setComments(applicationEntity.getComments());
responseBean.setCompanyId(applicationEntity.getCompanyId()); responseBean.setCompanyId(applicationEntity.getCompanyId());
Optional<AssignedApplicationsEntity> assignedApplicationsOptional =
assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(applicationEntity.getId());
if(assignedApplicationsOptional.isPresent()){
responseBean.setAssignedUserId(assignedApplicationsOptional.get().getUserId());
UserEntity user = userService.validateUser(assignedApplicationsOptional.get().getUserId());
String firstName = user.getFirstName() != null ? user.getFirstName() : "";
String lastName = user.getLastName() != null ? user.getLastName() : "";
String userName = String.join(" ", firstName, lastName).trim();
responseBean.setAssignedUserName(userName);
}
CompanyEntity company=companyService.validateCompany(applicationEntity.getCompanyId()); CompanyEntity company=companyService.validateCompany(applicationEntity.getCompanyId());
responseBean.setCompanyName(company.getCompanyName()); responseBean.setCompanyName(company.getCompanyName());
if(applicationEntity.getProtocol() != null) { if(applicationEntity.getProtocol() != null) {

View File

@@ -558,7 +558,16 @@ public class ApplicationEvaluationDao {
response.setAssignedAt(assignedApplications.getAssignedAt()); response.setAssignedAt(assignedApplications.getAssignedAt());
} }
response.setEvaluationEndDate(entity.getEndDate()); response.setEvaluationEndDate(entity.getEndDate());
Optional<AssignedApplicationsEntity> assignedApplicationsOptional =
assignedApplicationsRepository.findByApplicationIdAndIsDeletedFalse(application.getId());
if(assignedApplicationsOptional.isPresent()){
response.setAssignedUserId(assignedApplicationsOptional.get().getUserId());
UserEntity assignedUser = userService.validateUser(assignedApplicationsOptional.get().getUserId());
String assignedUserFirstName = assignedUser.getFirstName() != null ? assignedUser.getFirstName() : "";
String assignedUserLastName = assignedUser.getLastName() != null ? assignedUser.getLastName() : "";
String userName = String.join(" ", assignedUserFirstName, assignedUserLastName).trim();
response.setAssignedUserName(userName);
}
LocalDateTime callEndDate = application.getCall().getEndDate(); LocalDateTime callEndDate = application.getCall().getEndDate();
response.setCallEndDate(callEndDate); response.setCallEndDate(callEndDate);
if (application.getCompanyId() != null) { if (application.getCompanyId() != null) {

View File

@@ -19,6 +19,7 @@ public class ApplicationAmendmentRequestResponse {
private Long protocolNumber; private Long protocolNumber;
private String callName; private String callName;
private String beneficiaryName; private String beneficiaryName;
private String companyName;
private List<AmendmentFormFieldResponse> formFields; private List<AmendmentFormFieldResponse> formFields;
private List<ApplicationFormFieldResponseBean> applicationFormFields; private List<ApplicationFormFieldResponseBean> applicationFormFields;
private List<DocumentResponseBean> amendmentDocuments; private List<DocumentResponseBean> amendmentDocuments;

View File

@@ -26,6 +26,8 @@ public class ApplicationEvaluationResponse {
private LocalDateTime createdDate; private LocalDateTime createdDate;
private LocalDateTime updatedDate; private LocalDateTime updatedDate;
private String beneficiary; private String beneficiary;
private Long assignedUserId;
private String assignedUserName;
private Long protocolNumber; private Long protocolNumber;
private String callName; private String callName;
private String motivation; private String motivation;

View File

@@ -33,4 +33,8 @@ public class ApplicationResponse{
private Long protocolNumber; private Long protocolNumber;
private Long assignedUserId;
private String assignedUserName;
} }