From b31c33103d1f779a8ebe85fbf2fb0109cca67bfa Mon Sep 17 00:00:00 2001 From: rajesh Date: Wed, 22 Jan 2025 16:38:46 +0530 Subject: [PATCH 1/2] Added validation for the requested amount in the application. --- .../gepafin/tendermanagement/constants/GepafinConstant.java | 1 + .../java/net/gepafin/tendermanagement/dao/ApplicationDao.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java b/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java index 34a05ca6..faf9570e 100644 --- a/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java +++ b/src/main/java/net/gepafin/tendermanagement/constants/GepafinConstant.java @@ -387,5 +387,6 @@ public class GepafinConstant { public static final String APPLICATION_PER_CALL="applicationPerCall"; public static final String APPLICATION_PER_STATUS="applicationPerStatus"; public static final String CALL_EXPIRED="call.expired"; + public static final String AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO = "amount.request.should.greated.then.zero"; } diff --git a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationDao.java b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationDao.java index d9938639..84131b9b 100644 --- a/src/main/java/net/gepafin/tendermanagement/dao/ApplicationDao.java +++ b/src/main/java/net/gepafin/tendermanagement/dao/ApplicationDao.java @@ -1260,6 +1260,9 @@ public class ApplicationDao { if (Boolean.FALSE.equals(ApplicationStatusTypeEnum.DRAFT.getValue().equals(applicationEntity.getStatus()))) { throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_NOT_IN_DRAFT_STATUS)); } + if (applicationEntity.getAmountRequested() == null || applicationEntity.getAmountRequested().compareTo(BigDecimal.ZERO) <= 0 ) { + throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.AMOUNT_REQUEST_SHOULD_GREATED_THEN_ZERO)); + } List flowEdgesList = flowEdgesRepository.findByCallId(applicationEntity.getCall().getId()); Long totalSteps = flowFormDao.calculateTotalSteps(flowEdgesList); Integer completedSteps = flowFormDao.getCompletedSteps(applicationEntity); From c8580317bac566cb7e80164e0c0a2735219c41f3 Mon Sep 17 00:00:00 2001 From: rajesh Date: Wed, 22 Jan 2025 16:39:10 +0530 Subject: [PATCH 2/2] updated code --- src/main/resources/message_en.properties | 1 + src/main/resources/message_it.properties | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/resources/message_en.properties b/src/main/resources/message_en.properties index 4559736c..4839b210 100644 --- a/src/main/resources/message_en.properties +++ b/src/main/resources/message_en.properties @@ -351,3 +351,4 @@ user.action.fetched.successfully = User action details fetched successfully. action.context.labels.fetched.successfully = Action Context Labels Fetched Successfully. amount.accepted.required=Amount accepted is required while approving the application. call.expired=Call has been expired. +amount.request.should.greated.then.zero=Requested amount should not be empty and should be greater than zero. diff --git a/src/main/resources/message_it.properties b/src/main/resources/message_it.properties index 1ab08cbd..65fa7094 100644 --- a/src/main/resources/message_it.properties +++ b/src/main/resources/message_it.properties @@ -341,4 +341,5 @@ user.with.company.not.found = Utente con azienda non trovato per utente o aziend user.action.fetched.successfully = Dettagli sull'azione dell'utente recuperati correttamente. action.context.labels.fetched.successfully = Etichette del contesto dell'azione recuperate correttamente. amount.accepted.required=L'importo accettato � obbligatorio durante l'approvazione della domanda. -call.expired=La chiamata è scaduta. \ No newline at end of file +call.expired=La chiamata è scaduta. +amount.request.should.greated.then.zero=L'importo richiesto non deve essere vuoto e deve essere maggiore di zero.