Done ticket GEPAFINBE-221

This commit is contained in:
nisha
2025-05-28 14:02:00 +05:30
parent 1f711f407b
commit b63373d3de
9 changed files with 31 additions and 16 deletions

View File

@@ -2510,8 +2510,8 @@ public class ApplicationEvaluationDao {
ApplicationEvaluationEntity evaluationEntity = evaluationEntityOpt.get();
String criteriaJson = evaluationEntity.getCriteria();
if (criteriaJson != null){
Integer totalScore = calculateTotalScore(evaluationEntity.getCriteria());
if (totalScore > 40) {
BigDecimal totalScore = calculateTotalScore(evaluationEntity.getCriteria());
if (totalScore.compareTo(new BigDecimal("40")) > 0) {
applicationEntity.setStatus(status.getValue());
log.info("Status updated to TECHNICAL_EVALUATION for applicationId: " + applicationId);
}
@@ -2522,7 +2522,7 @@ public class ApplicationEvaluationDao {
}
}
private Integer calculateTotalScore(String criteriaJson){
private BigDecimal calculateTotalScore(String criteriaJson){
try {
ObjectMapper objectMapper = new ObjectMapper();
// Convert JSON string to List of Maps
@@ -2530,15 +2530,18 @@ public class ApplicationEvaluationDao {
});
// Sum all scores (ignoring null scores)
Integer totalScore = criteriaList.stream()
.mapToInt(obj -> obj.get("score") != null ? ((Number) obj.get("score")).intValue() : 0)
.sum();
BigDecimal totalScore = criteriaList.stream()
.map(obj -> {
Object score = obj.get("score");
return score != null ? new BigDecimal(score.toString()) : BigDecimal.ZERO;
})
.reduce(BigDecimal.ZERO, BigDecimal::add);
return totalScore;
}
catch (Exception e) {
log.error(" Error parsing criteria JSON: {}", e.getMessage());
return 0;
return BigDecimal.ZERO;
}
}

View File

@@ -277,7 +277,7 @@ public class CallDao {
criteriaEntity = new EvaluationCriteriaEntity();
criteriaEntity.setCall(callEntity);
criteriaEntity.setLookupData(lookupDataEntity);
criteriaEntity.setScore(0L);
criteriaEntity.setScore(BigDecimal.ZERO);
criteriaEntity.setIsDeleted(false);
actionType = VersionActionTypeEnum.INSERT;
}

View File

@@ -20,6 +20,7 @@ import net.gepafin.tendermanagement.util.Utils;
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
import java.math.BigDecimal;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
@@ -68,7 +69,7 @@ public class EvaluationCriteriaDao {
LookUpDataEntity lookupDataEntity = lookUpDataService.getOrCreateLookUpDataEntity(evaluationCriteriaRequest, LookUpDataEntity.LookUpDataTypeEnum.EVALUATION_CRITERIA);
entity.setCall(callEntity);
entity.setLookupData(lookupDataEntity);
entity.setScore(0L);
entity.setScore(BigDecimal.ZERO);
if (evaluationCriteriaRequest.getScore() != null) {
entity.setScore(evaluationCriteriaRequest.getScore());
}