added protocol in amendment request

This commit is contained in:
harish
2024-10-28 11:52:19 +05:30
23 changed files with 197 additions and 136 deletions

View File

@@ -13,6 +13,7 @@ import net.gepafin.tendermanagement.model.response.AmendmentFormFieldResponse;
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse; import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean; import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
import net.gepafin.tendermanagement.repositories.*; import net.gepafin.tendermanagement.repositories.*;
import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
import net.gepafin.tendermanagement.service.ApplicationService; import net.gepafin.tendermanagement.service.ApplicationService;
import net.gepafin.tendermanagement.service.UserService; import net.gepafin.tendermanagement.service.UserService;
import net.gepafin.tendermanagement.util.DateTimeUtil; import net.gepafin.tendermanagement.util.DateTimeUtil;
@@ -33,9 +34,6 @@ public class ApplicationAmendmentRequestDao {
@Autowired @Autowired
private ApplicationService applicationService; private ApplicationService applicationService;
@Autowired
private FormRepository formRepository;
@Autowired @Autowired
private UserService userService; private UserService userService;
@@ -52,13 +50,22 @@ public class ApplicationAmendmentRequestDao {
private DocumentRepository documentRepository; private DocumentRepository documentRepository;
@Autowired @Autowired
CommunicationRepository communicationRepository; private CommunicationRepository communicationRepository;
@Autowired @Autowired
CommunicationDao communicationDao; private CommunicationDao communicationDao;
public List<ApplicationAmendmentRequestResponse> getApplicationDataForAmendment(HttpServletRequest request,Long applicationId){ @Autowired
log.info("Fetching the application data for the Amendment process {}", applicationId); private ApplicationEvaluationService applicationEvaluationService;
@Autowired
private ProtocolDao protocolDao;
public List<ApplicationAmendmentRequestResponse> getApplicationDataForAmendment(HttpServletRequest request,Long applicationEvaluationId){
log.info("Fetching the application data for the Amendment process {}", applicationEvaluationId);
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
Long applicationId = applicationEvaluationEntity.getApplicationId();
ApplicationEntity application = applicationService.validateApplication(applicationId); ApplicationEntity application = applicationService.validateApplication(applicationId);
String callName = application.getCall().getName(); String callName = application.getCall().getName();
Long protocolNumber = (application.getProtocol() != null && application.getProtocol().getProtocolNumber() != null) Long protocolNumber = (application.getProtocol() != null && application.getProtocol().getProtocolNumber() != null)
@@ -84,7 +91,7 @@ public class ApplicationAmendmentRequestDao {
ApplicationAmendmentRequestResponse response = convertEntityToResponse( ApplicationAmendmentRequestResponse response = convertEntityToResponse(
protocolNumber, callName, formFields, beneficiaryName); protocolNumber, callName, formFields, beneficiaryName);
List<CommunicationResponseBean> communicationList = communicationRepository.findCommentsById(response.getId()); List<CommunicationResponseBean> communicationList = communicationRepository.findCommentsByApplicationAmendmentRequestId(response.getId());
response.setCommentsList(communicationList); response.setCommentsList(communicationList);
responses.add(response); responses.add(response);
} }
@@ -157,23 +164,26 @@ public class ApplicationAmendmentRequestDao {
return filteredList; return filteredList;
} }
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(Long applicationId, ApplicationAmendmentRequest applicationAmendmentRequest){ public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(Long applicationEvaluationId, ApplicationAmendmentRequest applicationAmendmentRequest){
log.info("Submiting application data for amendment Process with details: {}", applicationId); log.info("Submiting application data for amendment Process with details: {}", applicationEvaluationId);
ApplicationEntity applicationEntity = applicationService.validateApplication(applicationId); ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = createApplicationAmendmentRequestEntity(applicationAmendmentRequest, applicationEvaluationId);
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = createApplicationAmendmentRequestEntity(applicationAmendmentRequest);
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = convertEntityToResponse(applicationAmendmentRequestEntity); ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = convertEntityToResponse(applicationAmendmentRequestEntity);
log.info("Application submitted successfully for amendment", applicationAmendmentRequestResponse); log.info("Application submitted successfully for amendment", applicationAmendmentRequestResponse);
if(!applicationAmendmentRequestResponse.isSendEmail()){ if(Boolean.TRUE.equals(applicationAmendmentRequestResponse.isSendEmail())){
communicationDao.sendMailToNotifyBeneficiaryRegardingNewAmendment(applicationEntity); communicationDao.sendMailToNotifyBeneficiaryRegardingNewAmendment(applicationAmendmentRequestEntity);
} }
return applicationAmendmentRequestResponse; return applicationAmendmentRequestResponse;
} }
public ApplicationAmendmentRequestEntity createApplicationAmendmentRequestEntity(ApplicationAmendmentRequest applicationAmendmentRequest){ public ApplicationAmendmentRequestEntity createApplicationAmendmentRequestEntity(ApplicationAmendmentRequest applicationAmendmentRequest,Long applicationEvaluationId){
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = new ApplicationAmendmentRequestEntity(); ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = new ApplicationAmendmentRequestEntity();
applicationAmendmentRequestEntity.setNote(applicationAmendmentRequest.getNote()); applicationAmendmentRequestEntity.setNote(applicationAmendmentRequest.getNote());
applicationAmendmentRequestEntity.setResponseDays(applicationAmendmentRequest.getResponseDays()); applicationAmendmentRequestEntity.setResponseDays(applicationAmendmentRequest.getResponseDays());
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
applicationAmendmentRequestEntity.setApplicationEvaluationEntity(applicationEvaluationEntity);
applicationAmendmentRequestEntity.setApplicationId(applicationEvaluationEntity.getApplicationId());
if (applicationAmendmentRequest.getFormFields() != null) { if (applicationAmendmentRequest.getFormFields() != null) {
String fieldIdsString = applicationAmendmentRequest.getFormFields().stream() String fieldIdsString = applicationAmendmentRequest.getFormFields().stream()
@@ -182,7 +192,12 @@ public class ApplicationAmendmentRequestDao {
.collect(Collectors.joining(",")); .collect(Collectors.joining(","));
applicationAmendmentRequestEntity.setFormFields(fieldIdsString); applicationAmendmentRequestEntity.setFormFields(fieldIdsString);
} }
UserEntity userEntity = userService.validateUser(applicationEvaluationId);
Long protocolNumber = protocolDao.getProtocolNumber(userEntity.getHub());
ProtocolEntity protocolEntity = protocolDao.createProtocolEntity(
applicationEvaluationEntity.getAssignedApplicationsEntity().getApplication(), protocolNumber,
userEntity.getHub().getId());
applicationAmendmentRequestEntity.setProtocol(protocolEntity);
applicationAmendmentRequestEntity.setIsEmail(false); applicationAmendmentRequestEntity.setIsEmail(false);
applicationAmendmentRequestEntity.setIsNotification(false); applicationAmendmentRequestEntity.setIsNotification(false);
ApplicationAmendmentRequestEntity applicationAmendment = saveApplicationAmendmentRequestEntity(applicationAmendmentRequestEntity); ApplicationAmendmentRequestEntity applicationAmendment = saveApplicationAmendmentRequestEntity(applicationAmendmentRequestEntity);
@@ -197,16 +212,19 @@ public class ApplicationAmendmentRequestDao {
public ApplicationAmendmentRequestResponse convertEntityToResponse(ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity){ public ApplicationAmendmentRequestResponse convertEntityToResponse(ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity){
ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = new ApplicationAmendmentRequestResponse(); ApplicationAmendmentRequestResponse applicationAmendmentRequestResponse = new ApplicationAmendmentRequestResponse();
applicationAmendmentRequestResponse.setId(applicationAmendmentRequestEntity.getId()); applicationAmendmentRequestResponse.setId(applicationAmendmentRequestEntity.getId());
Long applicationId = 20L; Long applicationId= applicationAmendmentRequestEntity.getApplicationId();
ApplicationEntity application = applicationService.validateApplication(applicationId); ApplicationEntity application = applicationService.validateApplication(applicationId);
applicationAmendmentRequestResponse.setApplicationId(applicationId);
applicationAmendmentRequestResponse.setApplicationEvaluationId(applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getId());
applicationAmendmentRequestResponse.setNote(applicationAmendmentRequestEntity.getNote()); applicationAmendmentRequestResponse.setNote(applicationAmendmentRequestEntity.getNote());
applicationAmendmentRequestResponse.setResponseDays(applicationAmendmentRequestEntity.getResponseDays()); applicationAmendmentRequestResponse.setResponseDays(applicationAmendmentRequestEntity.getResponseDays());
applicationAmendmentRequestResponse.setStartDate(applicationAmendmentRequestEntity.getCreatedDate()); applicationAmendmentRequestResponse.setStartDate(applicationAmendmentRequestEntity.getCreatedDate());
applicationAmendmentRequestResponse.setSendEmail(applicationAmendmentRequestEntity.getIsEmail()); applicationAmendmentRequestResponse.setSendEmail(applicationAmendmentRequestEntity.getIsEmail());
applicationAmendmentRequestResponse.setSendNotification(applicationAmendmentRequestEntity.getIsNotification()); applicationAmendmentRequestResponse.setSendNotification(applicationAmendmentRequestEntity.getIsNotification());
String callName = application.getCall().getName(); String callName = application.getCall().getName();
Long protocolNumber = (application.getProtocol() != null && application.getProtocol().getProtocolNumber() != null) Long protocolNumber = (applicationAmendmentRequestEntity.getProtocol() != null && applicationAmendmentRequestEntity.getProtocol().getProtocolNumber() != null)
? application.getProtocol().getProtocolNumber() ? applicationAmendmentRequestEntity.getProtocol().getProtocolNumber()
: null; : null;
UserEntity userEntity = userService.validateUser(application.getUserId()); UserEntity userEntity = userService.validateUser(application.getUserId());
String firstName = userEntity.getBeneficiary() != null ? userEntity.getBeneficiary().getFirstName() : ""; String firstName = userEntity.getBeneficiary() != null ? userEntity.getBeneficiary().getFirstName() : "";
@@ -256,6 +274,7 @@ public class ApplicationAmendmentRequestDao {
} return applicationAmendmentRequestEntity; } return applicationAmendmentRequestEntity;
} }
public void deleteById(Long id) { public void deleteById(Long id) {
log.info("Deleting assigned application with ID: {}", id); log.info("Deleting assigned application with ID: {}", id);
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity= validateApplicationAmendmentRequest(id); ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity= validateApplicationAmendmentRequest(id);

View File

@@ -44,7 +44,6 @@ import jakarta.servlet.http.HttpServletRequest;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -92,9 +91,6 @@ public class ApplicationDao {
@Autowired @Autowired
private CompanyService companyService; private CompanyService companyService;
@Autowired
private ProtocolRepository protocolRepository;
@Autowired @Autowired
private SystemEmailTemplatesService systemEmailTemplatesService; private SystemEmailTemplatesService systemEmailTemplatesService;
@@ -122,14 +118,14 @@ public class ApplicationDao {
@Value("${aws.s3.url.folder.signed.document}") @Value("${aws.s3.url.folder.signed.document}")
private String signedDocumentS3Folder; private String signedDocumentS3Folder;
@Value("${default.hub.uuid}")
private String defaultHubUuid;
@Autowired @Autowired
private UserService userService; private UserService userService;
@Autowired @Autowired
S3PathConfig s3ConfigBean; private S3PathConfig s3ConfigBean;
@Autowired
private ProtocolDao protocolDao;
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) { public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
@@ -606,8 +602,8 @@ public class ApplicationDao {
} }
if (status.equals(ApplicationStatusTypeEnum.SUBMIT) && Boolean.TRUE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.READY.getValue()))) { if (status.equals(ApplicationStatusTypeEnum.SUBMIT) && Boolean.TRUE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.READY.getValue()))) {
callService.validatePublishedCall(applicationEntity.getCall().getId(), userEntity.getHub().getId()); callService.validatePublishedCall(applicationEntity.getCall().getId(), userEntity.getHub().getId());
Long protocolNumber = getProtocolNumber(userEntity.getHub()); Long protocolNumber = protocolDao.getProtocolNumber(userEntity.getHub());
ProtocolEntity protocolEntity = createProtocolEntity(applicationEntity,protocolNumber, userEntity.getHub().getId()); ProtocolEntity protocolEntity = protocolDao.createProtocolEntity(applicationEntity,protocolNumber, userEntity.getHub().getId());
applicationEntity.setProtocol(protocolEntity); applicationEntity.setProtocol(protocolEntity);
applicationEntity.setStatus(ApplicationStatusTypeEnum.SUBMIT.getValue()); applicationEntity.setStatus(ApplicationStatusTypeEnum.SUBMIT.getValue());
applicationEntity.setSubmissionDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now())); applicationEntity.setSubmissionDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
@@ -622,14 +618,7 @@ public class ApplicationDao {
return getApplicationResponse(applicationEntity); return getApplicationResponse(applicationEntity);
} }
private Long getProtocolNumber(HubEntity hubEntity) {
Long maxProtocolNumber = protocolRepository.findMaxProtocolNumberAndHubId(hubEntity.getId());
Long startNumber = 10000001L;
if(Boolean.FALSE.equals(defaultHubUuid.equals(hubEntity.getUniqueUuid()))) {
startNumber = 20000001L;
}
return (maxProtocolNumber != null) ? maxProtocolNumber + 1 : startNumber;
}
public Integer calculateProgress(Long totalSteps, Long completedSteps) { public Integer calculateProgress(Long totalSteps, Long completedSteps) {
if (FieldValidator.isNullOrZero(totalSteps)) { if (FieldValidator.isNullOrZero(totalSteps)) {
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.TOTAL_STEPS_NOT_BE_ZERO)); throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.TOTAL_STEPS_NOT_BE_ZERO));
@@ -703,18 +692,6 @@ public class ApplicationDao {
} }
} }
public ProtocolEntity createProtocolEntity(ApplicationEntity applicationEntity,Long protocolNumber, Long hubId){
ProtocolEntity protocolEntity=new ProtocolEntity();
protocolEntity.setCall(applicationEntity.getCall().getId());
LocalDateTime utcDateTime = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
protocolEntity.setYear(utcDateTime.getYear());
protocolEntity.setProtocolNumber(protocolNumber);
protocolEntity.setTime(LocalTime.now());
protocolEntity.setApplicationId(applicationEntity.getId());
protocolEntity.setHubId(hubId);
protocolRepository.save(protocolEntity);
return protocolEntity;
}
private void sendMailToUserAndCompany(UserEntity userEntity, ApplicationEntity applicationEntity) { private void sendMailToUserAndCompany(UserEntity userEntity, ApplicationEntity applicationEntity) {
CallEntity call =applicationEntity.getCall(); CallEntity call =applicationEntity.getCall();
CompanyEntity company = applicationEntity.getCompany(); CompanyEntity company = applicationEntity.getCompany();

View File

@@ -459,7 +459,7 @@ public class ApplicationEvaluationDao {
return updatedFieldList; return updatedFieldList;
} }
private ApplicationEvaluationEntity validateApplicationEvaluation(Long id) { public ApplicationEvaluationEntity validateApplicationEvaluation(Long id) {
Optional<ApplicationEvaluationEntity> entityOptional = applicationEvaluationRepository.findById(id); Optional<ApplicationEvaluationEntity> entityOptional = applicationEvaluationRepository.findById(id);
if (entityOptional.isEmpty()) { if (entityOptional.isEmpty()) {
throw new ResourceNotFoundException(Status.NOT_FOUND, throw new ResourceNotFoundException(Status.NOT_FOUND,

View File

@@ -1,6 +1,5 @@
package net.gepafin.tendermanagement.dao; package net.gepafin.tendermanagement.dao;
import jakarta.transaction.Transactional;
import net.gepafin.tendermanagement.config.Translator; import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant; import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity; import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
@@ -15,12 +14,9 @@ import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse; import net.gepafin.tendermanagement.model.response.ApplicationAmendmentResponse;
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean; import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
import net.gepafin.tendermanagement.model.response.SystemEmailTemplateResponse; import net.gepafin.tendermanagement.model.response.SystemEmailTemplateResponse;
import net.gepafin.tendermanagement.repositories.ApplicationAmendmentRequestRepository;
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
import net.gepafin.tendermanagement.repositories.CallRepository;
import net.gepafin.tendermanagement.repositories.CommunicationRepository; import net.gepafin.tendermanagement.repositories.CommunicationRepository;
import net.gepafin.tendermanagement.repositories.CompanyRepository; import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
import net.gepafin.tendermanagement.repositories.UserWithCompanyRepository; import net.gepafin.tendermanagement.service.ApplicationService;
import net.gepafin.tendermanagement.service.SystemEmailTemplatesService; import net.gepafin.tendermanagement.service.SystemEmailTemplatesService;
import net.gepafin.tendermanagement.service.UserService; import net.gepafin.tendermanagement.service.UserService;
import net.gepafin.tendermanagement.util.DateTimeUtil; import net.gepafin.tendermanagement.util.DateTimeUtil;
@@ -43,10 +39,10 @@ public class CommunicationDao {
private static final Logger log = LoggerFactory.getLogger(CommunicationDao.class); private static final Logger log = LoggerFactory.getLogger(CommunicationDao.class);
@Autowired @Autowired
CommunicationRepository communicationRepository; private CommunicationRepository communicationRepository;
@Autowired @Autowired
ApplicationAmendmentRequestRepository applicationAmendmentRepository; ApplicationAmendmentRequestService applicationAmendmentRequestService;
@Autowired @Autowired
private MailUtil mailUtil; private MailUtil mailUtil;
@@ -55,12 +51,12 @@ public class CommunicationDao {
private SystemEmailTemplatesService systemEmailTemplatesService; private SystemEmailTemplatesService systemEmailTemplatesService;
@Autowired @Autowired
UserService userService; private ApplicationService applicationService;
@Autowired @Autowired
ApplicationRepository applicationRepository; private UserService userService;
@Transactional(rollbackOn = Exception.class)
public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationReq, Long amendmentId) { public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationReq, Long amendmentId) {
log.info("Adding communication request..."); log.info("Adding communication request...");
@@ -84,10 +80,7 @@ public class CommunicationDao {
public ApplicationAmendmentResponse getAmendmentComments(Long amendmentId) { public ApplicationAmendmentResponse getAmendmentComments(Long amendmentId) {
ApplicationAmendmentRequestEntity amendmentData = applicationAmendmentRepository.findByIdAndIsDeletedFalse(amendmentId); ApplicationAmendmentRequestEntity amendmentData = applicationAmendmentRequestService.validateApplicationAmendmentRequest(amendmentId);
if (amendmentData == null) {
throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG));
}
List<CommunicationResponseBean> commentsList = communicationRepository.findCommentDetailsByAmendmentId(amendmentId); List<CommunicationResponseBean> commentsList = communicationRepository.findCommentDetailsByAmendmentId(amendmentId);
if (commentsList == null) { if (commentsList == null) {
throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND)); throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND));
@@ -95,7 +88,6 @@ public class CommunicationDao {
return new ApplicationAmendmentResponse(amendmentData, commentsList); return new ApplicationAmendmentResponse(amendmentData, commentsList);
} }
@Transactional(rollbackOn = Exception.class)
public CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) { public CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) {
log.info("Updating communication comment..."); log.info("Updating communication comment...");
@@ -126,7 +118,7 @@ public class CommunicationDao {
private CommunicationEntity convertToCommunicationCommentEntity(CommunicationRequestBean communicationReq, Long amendmentId) { private CommunicationEntity convertToCommunicationCommentEntity(CommunicationRequestBean communicationReq, Long amendmentId) {
ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRepository.findByIdAndIsDeletedFalse(amendmentId); ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRequestService.validateApplicationAmendmentRequest(amendmentId);
CommunicationEntity communicationEntity = new CommunicationEntity(); CommunicationEntity communicationEntity = new CommunicationEntity();
communicationEntity.setApplicationAmendmentRequest(amendmentRequest); communicationEntity.setApplicationAmendmentRequest(amendmentRequest);
communicationEntity.setCommunicationTitle(communicationReq.getTitle()); communicationEntity.setCommunicationTitle(communicationReq.getTitle());
@@ -136,9 +128,10 @@ public class CommunicationDao {
return communicationEntity; return communicationEntity;
} }
public void sendMailToNotifyBeneficiaryRegardingNewAmendment(ApplicationEntity applicationEntity) { public void sendMailToNotifyBeneficiaryRegardingNewAmendment(ApplicationAmendmentRequestEntity applicationAmendmentRequest) {
ApplicationEntity applicationEntity = applicationService.validateApplication(applicationAmendmentRequest.getApplicationId());
// UserEntity user = userService.validateUser(applicationEntity.getUserId());
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService.retrieveTemplateByTypeAndCall( SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService.retrieveTemplateByTypeAndCall(
SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.DOCUMENTATION_INTEGRATION_REQUEST, applicationEntity.getCall(), null); SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum.DOCUMENTATION_INTEGRATION_REQUEST, applicationEntity.getCall(), null);
@@ -151,14 +144,15 @@ public class CommunicationDao {
Map<String, String> bodyPlaceholders = new HashMap<>(); Map<String, String> bodyPlaceholders = new HashMap<>();
bodyPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName()); bodyPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName());
bodyPlaceholders.put("{{protocol_number}}", applicationEntity.getProtocol().getProtocolNumber().toString()); bodyPlaceholders.put("{{protocol_number}}", applicationEntity.getProtocol().getProtocolNumber().toString());
bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatCreatedDate(applicationEntity.getProtocol().getCreatedDate())); bodyPlaceholders.put("{{protocol_date}}", DateTimeUtil.formatLocalDateTime(applicationAmendmentRequest.getProtocol().getCreatedDate(), GepafinConstant.DD_MM_YYYY));
bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(applicationEntity.getProtocol().getTime(), GepafinConstant.HH_MM_SS)); bodyPlaceholders.put("{{protocol_time}}", DateTimeUtil.parseLocalTimeToString(applicationAmendmentRequest.getProtocol().getTime(), GepafinConstant.HH_MM_SS));
bodyPlaceholders.put("{{form_dataInput}}", ""); bodyPlaceholders.put("{{form_dataInput}}", "");
// Replace placeholders in the subject and body // Replace placeholders in the subject and body
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders); String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders); String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
mailUtil.sendByMailGun(subject, body, List.of("piyush1.kag1@gmail.com"), null); UserEntity userEntity = userService.validateUser(applicationEntity.getUserId());
mailUtil.sendByMailGun(subject, body, List.of(userEntity.getBeneficiary().getEmail()), null);
} }
public void sendApplicationFailureNotificationEmail(String userEmail, ApplicationEntity applicationEntity) { public void sendApplicationFailureNotificationEmail(String userEmail, ApplicationEntity applicationEntity) {

View File

@@ -0,0 +1,48 @@
package net.gepafin.tendermanagement.dao;
import java.time.LocalDateTime;
import java.time.LocalTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import net.gepafin.tendermanagement.entities.ApplicationEntity;
import net.gepafin.tendermanagement.entities.HubEntity;
import net.gepafin.tendermanagement.entities.ProtocolEntity;
import net.gepafin.tendermanagement.repositories.ProtocolRepository;
import net.gepafin.tendermanagement.util.DateTimeUtil;
@Component
public class ProtocolDao {
@Autowired
private ProtocolRepository protocolRepository;
@Value("${default.hub.uuid}")
private String defaultHubUuid;
public Long getProtocolNumber(HubEntity hubEntity) {
Long maxProtocolNumber = protocolRepository.findMaxProtocolNumberAndHubId(hubEntity.getId());
Long startNumber = 10000001L;
if(Boolean.FALSE.equals(defaultHubUuid.equals(hubEntity.getUniqueUuid()))) {
startNumber = 20000001L;
}
return (maxProtocolNumber != null) ? maxProtocolNumber + 1 : startNumber;
}
public ProtocolEntity createProtocolEntity(ApplicationEntity applicationEntity,Long protocolNumber, Long hubId){
ProtocolEntity protocolEntity=new ProtocolEntity();
protocolEntity.setCall(applicationEntity.getCall().getId());
LocalDateTime utcDateTime = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
protocolEntity.setYear(utcDateTime.getYear());
protocolEntity.setProtocolNumber(protocolNumber);
protocolEntity.setTime(LocalTime.now());
protocolEntity.setApplicationId(applicationEntity.getId());
protocolEntity.setHubId(hubId);
protocolRepository.save(protocolEntity);
return protocolEntity;
}
}

View File

@@ -1,15 +1,8 @@
package net.gepafin.tendermanagement.entities; package net.gepafin.tendermanagement.entities;
import com.fasterxml.jackson.annotation.JsonIgnore; import jakarta.persistence.*;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import lombok.Data; import lombok.Data;
import java.util.List;
@Entity @Entity
@Table(name="application_amendment_request") @Table(name="application_amendment_request")
@Data @Data
@@ -27,14 +20,21 @@ public class ApplicationAmendmentRequestEntity extends BaseEntity {
@Column(name = "IS_EMAIL") @Column(name = "IS_EMAIL")
private Boolean isEmail=false; private Boolean isEmail=false;
@Column(name = "APPLICATION_ID")
private Long applicationId;
@Column(name = "FORM_FIELDS") @Column(name = "FORM_FIELDS")
private String formFields; private String formFields;
@Column(name="IS_DELETED") @Column(name="IS_DELETED")
private Boolean isDeleted=false; private Boolean isDeleted=false;
@OneToMany(mappedBy = "applicationAmendmentRequest", fetch = FetchType.LAZY) @ManyToOne
@JsonIgnore @JoinColumn(name = "APPLICATION_EVALUATION_ID", nullable = false)
private List<CommunicationEntity> communicationList; private ApplicationEvaluationEntity applicationEvaluationEntity;
@OneToOne
@JoinColumn(name = "PROTOCOL_Id")
private ProtocolEntity protocol;
} }

View File

@@ -8,9 +8,6 @@ import java.time.LocalDateTime;
@Entity @Entity
@Table(name = "APPLICATION") @Table(name = "APPLICATION")
@Data @Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ApplicationEntity extends BaseEntity { public class ApplicationEntity extends BaseEntity {
@Column(name = "USER_ID") @Column(name = "USER_ID")

View File

@@ -3,14 +3,14 @@ package net.gepafin.tendermanagement.entities;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Data @Data
@Entity @Entity
@Table(name = "application_evaluation") @Table(name = "application_evaluation")
public class ApplicationEvaluationEntity extends BaseEntity{ public class ApplicationEvaluationEntity extends BaseEntity{
@Column(name = "application_Id") @Column(name = "application_Id")
private Long applicationId; private Long applicationId;
@Column(name = "user_id") @Column(name = "user_id")
private Long userId; private Long userId;
@@ -35,4 +35,5 @@ public class ApplicationEvaluationEntity extends BaseEntity{
@ManyToOne @ManyToOne
@JoinColumn(name = "assigned_applications_id", nullable = true) @JoinColumn(name = "assigned_applications_id", nullable = true)
private AssignedApplicationsEntity assignedApplicationsEntity; private AssignedApplicationsEntity assignedApplicationsEntity;
} }

View File

@@ -1,9 +1,7 @@
package net.gepafin.tendermanagement.entities; package net.gepafin.tendermanagement.entities;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn; import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne; import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table; import jakarta.persistence.Table;
@@ -23,13 +21,12 @@ public class CommunicationEntity extends BaseEntity {
private String communicationComment; private String communicationComment;
@Column(name = "IS_DELETED") @Column(name = "IS_DELETED")
private Boolean isDeleted; private Boolean isDeleted = false;
@Column(name = "COMMENTED_DATE") @Column(name = "COMMENTED_DATE")
private LocalDateTime commentedDate; private LocalDateTime commentedDate;
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne
@JsonIgnore
@JoinColumn(name = "AMENDMENT_ID", referencedColumnName = "id", nullable = false) @JoinColumn(name = "AMENDMENT_ID", referencedColumnName = "id", nullable = false)
private ApplicationAmendmentRequestEntity applicationAmendmentRequest; private ApplicationAmendmentRequestEntity applicationAmendmentRequest;

View File

@@ -1,6 +1,7 @@
package net.gepafin.tendermanagement.model.response; package net.gepafin.tendermanagement.model.response;
import lombok.Data; import lombok.Data;
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@@ -17,7 +18,9 @@ public class ApplicationAmendmentRequestResponse {
private String callName; private String callName;
private String beneficiaryName; private String beneficiaryName;
private List<AmendmentFormFieldResponse> formFields; private List<AmendmentFormFieldResponse> formFields;
private List<ApplicationFormFieldResponseBean> updatedFormFields; private List<ApplicationFormFieldResponseBean> applicationFormFields;
private Long applicationId;
private Long applicationEvaluationId;
private List<CommunicationResponseBean> commentsList; private List<CommunicationResponseBean> commentsList;
} }

View File

@@ -11,8 +11,8 @@ import java.util.List;
public interface CommunicationRepository extends JpaRepository<CommunicationEntity, Long> { public interface CommunicationRepository extends JpaRepository<CommunicationEntity, Long> {
@Query("Select new net.gepafin.tendermanagement.model.response.CommunicationResponseBean(c.commentedDate, c.communicationComment, c.communicationTitle, c.createdDate, c.updatedDate, c.applicationAmendmentRequest.id) " + @Query("Select new net.gepafin.tendermanagement.model.response.CommunicationResponseBean(c.commentedDate, c.communicationComment, c.communicationTitle, c.createdDate, c.updatedDate, c.applicationAmendmentRequest.id) " +
"from CommunicationEntity c Where c.applicationAmendmentRequest.id = :id") "from CommunicationEntity c Where c.applicationAmendmentRequest.id = :applicationAmendmentRequestId")
List<CommunicationResponseBean> findCommentsById(@Param("id") Long id); List<CommunicationResponseBean> findCommentsByApplicationAmendmentRequestId(@Param("applicationAmendmentRequestId") Long amendmentRequestId);
@Query("SELECT new net.gepafin.tendermanagement.model.response.CommunicationResponseBean( " + "c.commentedDate, c.communicationComment, c.communicationTitle, c.createdDate, c" + @Query("SELECT new net.gepafin.tendermanagement.model.response.CommunicationResponseBean( " + "c.commentedDate, c.communicationComment, c.communicationTitle, c.createdDate, c" +
".updatedDate, c.applicationAmendmentRequest.id) " + "FROM CommunicationEntity c " + "WHERE c.applicationAmendmentRequest.id = :amendmentId AND c.isDeleted = false") ".updatedDate, c.applicationAmendmentRequest.id) " + "FROM CommunicationEntity c " + "WHERE c.applicationAmendmentRequest.id = :amendmentId AND c.isDeleted = false")

View File

@@ -1,6 +1,7 @@
package net.gepafin.tendermanagement.service; package net.gepafin.tendermanagement.service;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest; import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean; import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse; import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
@@ -8,11 +9,12 @@ import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestRe
import java.util.List; import java.util.List;
public interface ApplicationAmendmentRequestService { public interface ApplicationAmendmentRequestService {
public List<ApplicationAmendmentRequestResponse> getApplicationDataForAmendment(HttpServletRequest request,Long applicationId); public List<ApplicationAmendmentRequestResponse> getApplicationDataForAmendment(HttpServletRequest request,Long applicationEvaluationId);
public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , ApplicationAmendmentRequest applicationAmendmentRequest); public ApplicationAmendmentRequestResponse createApplicationAmendmentRequest(HttpServletRequest request, Long applicationEvaluationId , ApplicationAmendmentRequest applicationAmendmentRequest);
void deleteApplicationAmendmentRequest(HttpServletRequest request, Long id); void deleteApplicationAmendmentRequest(HttpServletRequest request, Long id);
ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id); ApplicationAmendmentRequestResponse getApplicationAmendmentRequestById(HttpServletRequest request,Long id);
List<ApplicationAmendmentRequestResponse> getAllApplicationAmendmentRequest(HttpServletRequest request); List<ApplicationAmendmentRequestResponse> getAllApplicationAmendmentRequest(HttpServletRequest request);
ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean); ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long applicationAmendmentId);
} }

View File

@@ -1,12 +1,11 @@
package net.gepafin.tendermanagement.service; package net.gepafin.tendermanagement.service;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum; import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest; import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
import net.gepafin.tendermanagement.model.request.UpdateApplicationEvaluationRequest;
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse; import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
import java.util.List; import java.util.List;
@@ -18,4 +17,5 @@ public interface ApplicationEvaluationService {
ApplicationEvaluationResponse updateApplicationEvaluationStatus(HttpServletRequest request, Long applicationEvaluationId, ApplicationEvaluationStatusTypeEnum status); ApplicationEvaluationResponse updateApplicationEvaluationStatus(HttpServletRequest request, Long applicationEvaluationId, ApplicationEvaluationStatusTypeEnum status);
ApplicationEvaluationEntity validateApplicationEvaluation(Long applicationEvaluationId);
} }

View File

@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.service.impl;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import net.gepafin.tendermanagement.dao.ApplicationAmendmentRequestDao; import net.gepafin.tendermanagement.dao.ApplicationAmendmentRequestDao;
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
import net.gepafin.tendermanagement.entities.UserEntity; import net.gepafin.tendermanagement.entities.UserEntity;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest; import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean; import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
@@ -23,9 +24,9 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
private ApplicationAmendmentRequestDao applicationAmendmentRequestDao; private ApplicationAmendmentRequestDao applicationAmendmentRequestDao;
@Override @Override
public List<ApplicationAmendmentRequestResponse> getApplicationDataForAmendment(HttpServletRequest request, Long applicationId) { public List<ApplicationAmendmentRequestResponse> getApplicationDataForAmendment(HttpServletRequest request, Long applicationEvaluationId) {
UserEntity user= validator.validateUser(request); UserEntity user= validator.validateUser(request);
return applicationAmendmentRequestDao.getApplicationDataForAmendment(request,applicationId); return applicationAmendmentRequestDao.getApplicationDataForAmendment(request,applicationEvaluationId);
} }
@Override @Override
@@ -34,8 +35,6 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
return applicationAmendmentRequestDao.createApplicationAmendmentRequest(applicationEvaluationId,applicationAmendmentRequest); return applicationAmendmentRequestDao.createApplicationAmendmentRequest(applicationEvaluationId,applicationAmendmentRequest);
} }
@Override @Override
public void deleteApplicationAmendmentRequest(HttpServletRequest request, Long id) { public void deleteApplicationAmendmentRequest(HttpServletRequest request, Long id) {
applicationAmendmentRequestDao.deleteById(id); applicationAmendmentRequestDao.deleteById(id);
@@ -57,5 +56,10 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
return applicationAmendmentRequestDao.updateApplicationAmendment(id,applicationAmendmentRequestBean); return applicationAmendmentRequestDao.updateApplicationAmendment(id,applicationAmendmentRequestBean);
} }
@Override
public ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long applicationAmendmentId) {
return applicationAmendmentRequestDao.validateApplicationAmendmentRequest(applicationAmendmentId);
}
} }

View File

@@ -5,14 +5,13 @@ import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant; import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.dao.ApplicationEvaluationDao; import net.gepafin.tendermanagement.dao.ApplicationEvaluationDao;
import net.gepafin.tendermanagement.entities.ApplicationEvaluationEntity;
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity; import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
import net.gepafin.tendermanagement.entities.UserEntity; import net.gepafin.tendermanagement.entities.UserEntity;
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum; import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest; import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
import net.gepafin.tendermanagement.model.request.UpdateApplicationEvaluationRequest;
import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse; import net.gepafin.tendermanagement.model.response.ApplicationEvaluationResponse;
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository; import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
import net.gepafin.tendermanagement.service.ApplicationEvaluationService; import net.gepafin.tendermanagement.service.ApplicationEvaluationService;
import net.gepafin.tendermanagement.util.Validator; import net.gepafin.tendermanagement.util.Validator;
@@ -23,7 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Optional; import java.util.Optional;
@Service @Service
@@ -84,4 +83,9 @@ public class ApplicationEvaluationServiceImpl implements ApplicationEvaluationSe
return applicationEvaluationDao.updateApplicationEvaluationStatus(applicationId, status); return applicationEvaluationDao.updateApplicationEvaluationStatus(applicationId, status);
} }
@Override
public ApplicationEvaluationEntity validateApplicationEvaluation(Long applicationEvaluationId) {
return applicationEvaluationDao.validateApplicationEvaluation(applicationEvaluationId);
}
} }

View File

@@ -7,6 +7,8 @@ import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
import net.gepafin.tendermanagement.service.CommunicationService; import net.gepafin.tendermanagement.service.CommunicationService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class CommunicationServiceImpl implements CommunicationService { public class CommunicationServiceImpl implements CommunicationService {
@@ -15,21 +17,25 @@ public class CommunicationServiceImpl implements CommunicationService {
CommunicationDao communicationDao; CommunicationDao communicationDao;
@Override @Override
@Transactional(rollbackFor = Exception.class)
public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean, Long amendmentId) { public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean, Long amendmentId) {
return communicationDao.addCommentToAmendmentRequest(communicationRequestBean, amendmentId); return communicationDao.addCommentToAmendmentRequest(communicationRequestBean, amendmentId);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public String deleteComment(Long amendmentId, Long commentId) { public String deleteComment(Long amendmentId, Long commentId) {
return communicationDao.deleteComment(amendmentId, commentId); return communicationDao.deleteComment(amendmentId, commentId);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) { public CommunicationResponseBean updateAmendmentComment(CommunicationRequestBean communicationRequestBean, Long amendmentId, Long commentId) {
return communicationDao.updateAmendmentComment(communicationRequestBean, amendmentId, commentId); return communicationDao.updateAmendmentComment(communicationRequestBean, amendmentId, commentId);
} }
@Override @Override
@Transactional(readOnly = true)
public ApplicationAmendmentResponse getAmendmentComments(Long id) { public ApplicationAmendmentResponse getAmendmentComments(Long id) {
return communicationDao.getAmendmentComments(id); return communicationDao.getAmendmentComments(id);

View File

@@ -181,16 +181,10 @@ public class S3ReUploadMigrationService {
private void updateDocumentPathAndDeleteOldEntry(DocumentEntity document, String newPath) { private void updateDocumentPathAndDeleteOldEntry(DocumentEntity document, String newPath) {
String fileName = extractFileName(newPath); String fileName = extractFileName(newPath);
DocumentEntity newDocument = new DocumentEntity(); DocumentEntity newDocument = document;
newDocument.setFilePath(newPath); newDocument.setFilePath(newPath);
newDocument.setSource(document.getSource());
newDocument.setType(document.getType());
newDocument.setIsDeleted(false);
newDocument.setSourceId(document.getSourceId());
newDocument.setFileName(fileName); newDocument.setFileName(fileName);
documentRepository.save(newDocument); documentRepository.save(newDocument);
documentRepository.delete(document);
log.info("Migrated document ID: {} to new path: {}", document.getId(), newPath); log.info("Migrated document ID: {} to new path: {}", document.getId(), newPath);
} }

View File

@@ -229,15 +229,11 @@ public class UserSignedAndDelegationServiceImpl {
private void updateDocumentPathAndDeleteOldEntry(ApplicationSignedDocumentEntity document, String newPath) { private void updateDocumentPathAndDeleteOldEntry(ApplicationSignedDocumentEntity document, String newPath) {
ApplicationSignedDocumentEntity newDocument = new ApplicationSignedDocumentEntity(); ApplicationSignedDocumentEntity newDocument = document;
String fileName = extractFileNameFromPath(newPath); String fileName = extractFileNameFromPath(newPath);
newDocument.setFilePath(newPath); newDocument.setFilePath(newPath);
newDocument.setFileName(fileName); newDocument.setFileName(fileName);
newDocument.setApplication(document.getApplication());
newDocument.setStatus("ACTIVE");
applicationSignedDocumentRepository.save(newDocument); applicationSignedDocumentRepository.save(newDocument);
applicationSignedDocumentRepository.delete(document);
log.info("Migrated document ID: {} to new path: {}", document.getId(), newPath); log.info("Migrated document ID: {} to new path: {}", document.getId(), newPath);
} }
@@ -245,17 +241,10 @@ public class UserSignedAndDelegationServiceImpl {
private void updateDelegatedDocumentPathAndDeleteOldEntry(UserCompanyDelegationEntity document, String newPath) { private void updateDelegatedDocumentPathAndDeleteOldEntry(UserCompanyDelegationEntity document, String newPath) {
String fileName = extractFileNameFromPath(newPath); String fileName = extractFileNameFromPath(newPath);
UserCompanyDelegationEntity newDocument = new UserCompanyDelegationEntity(); UserCompanyDelegationEntity newDocument = document;
newDocument.setFilePath(newPath); newDocument.setFilePath(newPath);
newDocument.setFileName(fileName); newDocument.setFileName(fileName);
newDocument.setBeneficiaryId(document.getBeneficiaryId());
newDocument.setUserId(document.getUserId());
newDocument.setCompanyId(document.getCompanyId());
newDocument.setStatus("ACTIVE");
userCompanyDelegationRepository.save(newDocument); userCompanyDelegationRepository.save(newDocument);
userCompanyDelegationRepository.delete(document);
log.info("Migrated document ID: {} to new path: {}", document.getId(), newPath); log.info("Migrated document ID: {} to new path: {}", document.getId(), newPath);
} }
} }

View File

@@ -30,8 +30,8 @@ public interface ApplicationAmendmentRequestApi {
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })), @ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = { @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) }) @ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@GetMapping(value = "/{applicationId}", produces = "application/json") @GetMapping(value = "applicationEvaluation/{id}", produces = "application/json")
ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getApplicationDataForAmendment(HttpServletRequest request, @Parameter(description = "The application id", required = true) @PathVariable(value = "applicationId", required = true) Long applicationId); ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getApplicationDataForAmendment(HttpServletRequest request, @Parameter(description = "The Application Evaluation id", required = true) @PathVariable(value = "id", required = true) Long applicationEvaluationId);
@Operation(summary = "Api to submit the application data for the Amendment", @Operation(summary = "Api to submit the application data for the Amendment",
responses = { responses = {

View File

@@ -27,8 +27,8 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
ApplicationAmendmentRequestService applicationAmendmentRequestService; ApplicationAmendmentRequestService applicationAmendmentRequestService;
@Override @Override
public ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getApplicationDataForAmendment(HttpServletRequest request, Long applicationId) { public ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getApplicationDataForAmendment(HttpServletRequest request, Long applicationEvaluationId) {
List<ApplicationAmendmentRequestResponse> applicationAmendmentBean = applicationAmendmentRequestService.getApplicationDataForAmendment(request,applicationId); List<ApplicationAmendmentRequestResponse> applicationAmendmentBean = applicationAmendmentRequestService.getApplicationDataForAmendment(request,applicationEvaluationId);
return ResponseEntity.status(HttpStatus.OK) return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(applicationAmendmentBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_DATA_FOR_AMENDMENT_SUCCESS_MSG))); .body(new Response<>(applicationAmendmentBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_DATA_FOR_AMENDMENT_SUCCESS_MSG)));
} }

View File

@@ -1569,6 +1569,17 @@
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false"> <column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false"/> <constraints nullable="false"/>
</column> </column>
<column name="application_id" type="INTEGER">
<constraints nullable="true"/>
</column>
<column name="application_evaluation_id" type="INTEGER">
<constraints nullable="false"
foreignKeyName="fk_application_evaluation_application_amendment_request"
references="application_evaluation(id)"/>
</column>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"> <column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
<constraints nullable="true"/> <constraints nullable="true"/>
</column> </column>
@@ -1621,5 +1632,18 @@
path="db/dump/insert_system_email_template_for_notification_mail_27_10_2024.sql"/> path="db/dump/insert_system_email_template_for_notification_mail_27_10_2024.sql"/>
</changeSet> </changeSet>
<changeSet id="28-10-2024_3" author="Rajesh Khore">
<addColumn tableName="application_amendment_request">
<column name="protocol_id" type="INTEGER"/>
</addColumn>
<addForeignKeyConstraint
baseTableName="application_amendment_request"
baseColumnNames="protocol_id"
referencedTableName="protocol"
referencedColumnNames="id"
constraintName="fk_application_amendment_request_protocol"/>
</changeSet>
</databaseChangeLog> </databaseChangeLog>

View File

@@ -287,6 +287,7 @@ invalid.application.status = Invalid Application status.
application.data.amendment.success = Successfully retrieved the application data for the amendment process. application.data.amendment.success = Successfully retrieved the application data for the amendment process.
delete.application.amendment.success = Application Amendment successfully deleted. delete.application.amendment.success = Application Amendment successfully deleted.
create.application.data.amendment.msg = Application amendment submited succesfully.
application.amendment.not.found = Application Amendment Request not found with the given ID. application.amendment.not.found = Application Amendment Request not found with the given ID.
application.amendment.get.success = Application Amendment details fetched successfully with given ID. application.amendment.get.success = Application Amendment details fetched successfully with given ID.
application.amendment.update.successfully = Application Amendment Updated Successfully. application.amendment.update.successfully = Application Amendment Updated Successfully.

View File

@@ -290,7 +290,8 @@ added.comment.to.amendment.request.success = Commento aggiunto con successo alla
comment.not.found = Commento non trovato. comment.not.found = Commento non trovato.
comment.updated.successfully = Commento aggiornato con successo. comment.updated.successfully = Commento aggiornato con successo.
comment.deleted.successfully = Commento eliminato con successo. comment.deleted.successfully = Commento eliminato con successo.
comment.not.associate.with.amendment = Il commento non è associato alla richiesta di emendamento. comment.not.associate.with.amendment = Il commento non <EFBFBD> associato alla richiesta di emendamento.
amendment.found.success = Richiesta di emendamento trovata con successo. amendment.found.success = Richiesta di emendamento trovata con successo.
invalid.amendment.for.comment = Richiesta di emendamento non valida per il commento fornito. invalid.amendment.for.comment = Richiesta di emendamento non valida per il commento fornito.
DD_MM_YYYY_HH_MM = DD-MM-YYYY HH:MM. DD_MM_YYYY_HH_MM = DD-MM-YYYY HH:MM.
create.application.data.amendment.msg =Emendamento alla domanda inviato con successo