Added Status in Amendment

This commit is contained in:
harish
2024-10-30 10:48:22 +05:30
parent 2f68329eee
commit 163ca6fe43
14 changed files with 107 additions and 2 deletions

View File

@@ -276,6 +276,7 @@ public class GepafinConstant {
public static final String APPLICATION_AMENDMENT_NOT_FOUND_MSG = "application.amendment.not.found";
public static final String GET_APPLICATION_AMENDMENT_SUCCESS_MSG = "application.amendment.get.success";
public static final String APPLICATION_AMENDMENT_UPDATE_SUCCESSFULLY_MSG = "application.amendment.update.successfully";
public static final String APPLICATION_AMENDMENT_CLOSED_SUCCESFULLY = "application.amendment.closed.successfully";
public static final String COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS = "added.comment.to.amendment.request.success";
public static final String COMMENT_NOT_FOUND = "comment.not.found";

View File

@@ -8,12 +8,14 @@ import jakarta.servlet.http.HttpServletRequest;
import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.entities.*;
import net.gepafin.tendermanagement.enums.ApplicationAmendmentRequestEnum;
import net.gepafin.tendermanagement.enums.ApplicationEvaluationStatusTypeEnum;
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
import net.gepafin.tendermanagement.model.request.ApplicationFormFieldRequestBean;
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
import net.gepafin.tendermanagement.model.response.AmendmentFormFieldResponse;
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
import net.gepafin.tendermanagement.repositories.*;
@@ -25,6 +27,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Component;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
@@ -186,6 +190,10 @@ public class ApplicationAmendmentRequestDao {
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = new ApplicationAmendmentRequestEntity();
applicationAmendmentRequestEntity.setNote(applicationAmendmentRequest.getNote());
applicationAmendmentRequestEntity.setResponseDays(applicationAmendmentRequest.getResponseDays());
applicationAmendmentRequestEntity.setIsEmail(applicationAmendmentRequest.getIsSendEmail());
applicationAmendmentRequestEntity.setIsNotification(applicationAmendmentRequest.getIsSendNotification());
applicationAmendmentRequestEntity.setStartDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
applicationAmendmentRequestEntity.setStatus(ApplicationAmendmentRequestEnum.AWATING.getValue());
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
applicationAmendmentRequestEntity.setApplicationEvaluationEntity(applicationEvaluationEntity);
@@ -240,7 +248,8 @@ public class ApplicationAmendmentRequestDao {
applicationAmendmentRequestResponse.setApplicationEvaluationId(applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getId());
applicationAmendmentRequestResponse.setNote(applicationAmendmentRequestEntity.getNote());
applicationAmendmentRequestResponse.setResponseDays(applicationAmendmentRequestEntity.getResponseDays());
LocalDateTime startDate = applicationAmendmentRequestEntity.getCreatedDate();
applicationAmendmentRequestResponse.setInternalNote(applicationAmendmentRequestEntity.getInternalNote());
LocalDateTime startDate = applicationAmendmentRequestEntity.getStartDate();
applicationAmendmentRequestResponse.setStartDate(startDate);
LocalDateTime expirationDate = startDate.plus(expirationDays, ChronoUnit.DAYS);
@@ -422,4 +431,17 @@ public class ApplicationAmendmentRequestDao {
.collect(Collectors.toList());
}
public ApplicationAmendmentRequestResponse closeAmendmentRequest(Long id, CloseAmendmentRequest closeAmendmentRequest){
log.info("Closing application amendement with ID: {}", id);
ApplicationAmendmentRequestEntity existingApplicationAmendment = validateApplicationAmendmentRequest(id);
setIfUpdated(existingApplicationAmendment::getInternalNote, existingApplicationAmendment::setInternalNote, closeAmendmentRequest.getInternalNote());
setIfUpdated(existingApplicationAmendment::getStatus, existingApplicationAmendment::setStatus, ApplicationAmendmentRequestEnum.CLOSE.getValue());
ApplicationAmendmentRequestEntity updatedApplicationAmendment = saveApplicationAmendmentRequestEntity(existingApplicationAmendment);
ApplicationAmendmentRequestResponse response = convertEntityToResponse(updatedApplicationAmendment);
log.info("Application Amendment closed successfully: {}", response);
return response;
}
}

View File

@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.entities;
import jakarta.persistence.*;
import lombok.Data;
import java.time.LocalDateTime;
@Entity
@Table(name="application_amendment_request")
@@ -23,12 +24,21 @@ public class ApplicationAmendmentRequestEntity extends BaseEntity {
@Column(name = "APPLICATION_ID")
private Long applicationId;
@Column(name = "START_DATE")
private LocalDateTime startDate;
@Column(name = "FORM_FIELDS")
private String formFields;
@Column(name="IS_DELETED")
private Boolean isDeleted=false;
@Column(name = "STATUS")
private String status;
@Column(name = "INTERNAL_NOTE")
private String internalNote;
@ManyToOne
@JoinColumn(name = "APPLICATION_EVALUATION_ID", nullable = false)
private ApplicationEvaluationEntity applicationEvaluationEntity;

View File

@@ -0,0 +1,21 @@
package net.gepafin.tendermanagement.enums;
import com.fasterxml.jackson.annotation.JsonValue;
public enum ApplicationAmendmentRequestEnum {
AWATING("AWATING"),
RESPONSE_RECEIVED("RESPONSE_RECEIVED"),
CLOSE("CLOSE"),
EXPIRED("EXPIRED");
private String value;
ApplicationAmendmentRequestEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
}

View File

@@ -9,4 +9,6 @@ public class ApplicationAmendmentRequest {
private String note;
private List<AmendmentFormFieldResponse> formFields;
private Long responseDays;
private Boolean isSendNotification;
private Boolean isSendEmail;
}

View File

@@ -0,0 +1,8 @@
package net.gepafin.tendermanagement.model.request;
import lombok.Data;
@Data
public class CloseAmendmentRequest {
private String InternalNote;
}

View File

@@ -23,5 +23,6 @@ public class ApplicationAmendmentRequestResponse {
private Long applicationEvaluationId;
private LocalDateTime expirationDate;
private List<CommunicationResponseBean> commentsList;
private String internalNote;
}

View File

@@ -4,6 +4,7 @@ import jakarta.servlet.http.HttpServletRequest;
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
import java.util.List;
@@ -17,5 +18,5 @@ public interface ApplicationAmendmentRequestService {
ApplicationAmendmentRequestResponse updateApplicationAmendment(HttpServletRequest request, Long id, ApplicationAmendmentRequestBean applicationAmendmentRequestBean);
ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long applicationAmendmentId);
List<ApplicationAmendmentRequestResponse> getAllAmendmentRequestByBeneficiaryId(HttpServletRequest request,Long beneficiaryId);
ApplicationAmendmentRequestResponse closeAmendmentRequest(HttpServletRequest request, Long id, CloseAmendmentRequest closeAmendmentRequest);
}

View File

@@ -6,6 +6,7 @@ import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
import net.gepafin.tendermanagement.entities.UserEntity;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
import net.gepafin.tendermanagement.util.Validator;
@@ -66,6 +67,10 @@ public class ApplicationAmendmentRequestServiceImpl implements ApplicationAmendm
return applicationAmendmentRequestDao.getAllAmendmentRequestByBeneficiaryId(beneficiaryId);
}
@Override
public ApplicationAmendmentRequestResponse closeAmendmentRequest(HttpServletRequest request, Long id, CloseAmendmentRequest closeAmendmentRequest) {
return applicationAmendmentRequestDao.closeAmendmentRequest(id,closeAmendmentRequest);
}
}

View File

@@ -9,6 +9,7 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
import net.gepafin.tendermanagement.model.util.Response;
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
@@ -113,4 +114,17 @@ public interface ApplicationAmendmentRequestApi {
ResponseEntity<Response<List<ApplicationAmendmentRequestResponse>>> getAllAmendmentRequestByBeneficiaryId(HttpServletRequest request,
@Parameter(description = "Id", required = false) @PathVariable(value = "id",required = false) Long beneficiaryId);
@Operation(summary = "Api to close the application amendment request",
responses = {
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@PutMapping(value = "", produces = "application/json")
ResponseEntity<Response<ApplicationAmendmentRequestResponse>> closeApplicationAmendmentRequest(HttpServletRequest request,
@Parameter(description = "The Application Amendment id", required = true) @RequestParam("id") Long id,
@Valid @RequestBody CloseAmendmentRequest closeAmendmentRequest);
}

View File

@@ -6,6 +6,7 @@ import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequest;
import net.gepafin.tendermanagement.model.request.ApplicationAmendmentRequestBean;
import net.gepafin.tendermanagement.model.request.CloseAmendmentRequest;
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
import net.gepafin.tendermanagement.model.util.Response;
import net.gepafin.tendermanagement.service.ApplicationAmendmentRequestService;
@@ -79,4 +80,12 @@ public class ApplicationAmendmentRequestController implements ApplicationAmendme
return ResponseEntity.status(HttpStatus.CREATED)
.body(new Response<>(applicationAmendmentRequestResponseList, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_APPLICATION_AMENDMENT_SUCCESS_MSG)));
}
@Override
public ResponseEntity<Response<ApplicationAmendmentRequestResponse>> closeApplicationAmendmentRequest(HttpServletRequest request, Long id, CloseAmendmentRequest closeAmendmentRequest) {
log.info("Closing Amendment Request");
ApplicationAmendmentRequestResponse amendmentRequestResponse = applicationAmendmentRequestService.closeAmendmentRequest(request, id,closeAmendmentRequest);
return ResponseEntity.status(HttpStatus.CREATED)
.body(new Response<>(amendmentRequestResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_CLOSED_SUCCESFULLY)));
}
}

View File

@@ -1645,5 +1645,14 @@
constraintName="fk_application_amendment_request_protocol"/>
</changeSet>
<changeSet id="29-10-2024_1" author="Rajesh Khore">
<addColumn tableName="application_amendment_request">
<column name="start_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="status" type="VARCHAR(50)"/>
<column name="internal_note" type="TEXT"></column>
</addColumn>
</changeSet>
</databaseChangeLog>

View File

@@ -292,6 +292,7 @@ create.application.data.amendment.msg = Application amendment submited succesful
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.update.successfully = Application Amendment Updated Successfully.
application.amendment.closed.successfully = Application Amendment Closed Successfully.
added.comment.to.amendment.request.success = Application Amendment Comment Added Successfully.
comment.not.found = Comment Not Found.

View File

@@ -287,6 +287,7 @@ delete.application.amendment.success =Emendamento all'applicazione eliminato con
application.amendment.not.found = Richiesta di modifica dell'applicazione non trovata con l'ID indicato.
application.amendment.get.success = Dettagli della modifica dell'applicazione recuperati correttamente con l'ID fornito.
application.amendment.update.successfully = Emendamento all'applicazione aggiornato con successo.
application.amendment.closed.successfully = Emendamento alla domanda chiuso con successo.
added.comment.to.amendment.request.success = Commento aggiunto con successo alla richiesta di emendamento.
comment.not.found = Commento non trovato.