Resolved Conflicts

This commit is contained in:
Piyush
2025-01-21 14:40:23 +05:30
15 changed files with 114 additions and 16 deletions

View File

@@ -58,14 +58,16 @@ public class SamlFailureHandler implements AuthenticationFailureHandler {
feBaseUrl = hub.getDomainName();
}
}
response.sendRedirect(feBaseUrl + "/login");
String redirectUrl = feBaseUrl + "/login";
response.sendRedirect(redirectUrl);
logger.info("SAML redirect Url: " + redirectUrl);
} catch (Exception e) {
logger.error("Error processing SAML failure handler", e);
}
}
public static String extractInResponseTo(String message) {
String regex = "InResponseTo attribute \\[([a-zA-Z0-9\\-]+)\\]";
String regex = "InResponseTo attribute \\[([a-zA-Z0-9\\-_]+)\\]";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(message);

View File

@@ -381,11 +381,11 @@ public class GepafinConstant {
public static final String NUMERIC="numeric";
public static final String AMOUNT_ACCEPTED_REQUIRED_WHILE_APPROVING_APPLICATION="amount.accepted.required";
public static final String CALL_NAME="callName";
public static final String NUMBER_OF_APPLICATIONS="numberOfApplications";
public static final String NUMBER_OF_APPLICATIONS="numberOfSubmitedApplications";
public static final String NUMBER_OF_DRAFT_APPLICATIONS="numberOfDraftApplications";
public static final String COUNT="count";
public static final String APPLICATION_PER_CALL="applicationPerCall";
public static final String APPLICATION_PER_STATUS="applicationPerStatus";
public static final String CALL_EXPIRED="call.expired";
}

View File

@@ -49,7 +49,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.MessageFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
@@ -186,6 +188,7 @@ public class ApplicationDao {
// callService.validatePublishedCall(formEntity.getCall().getId());
validateFormFields(applicationRequestBean,formEntity);
ApplicationEntity applicationEntity = validateApplication(applicationId);
checkCallEndDate(applicationEntity.getCall());
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
if(Boolean.FALSE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.DRAFT.getValue()))) {
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.APPLICATION_NOT_IN_DRAFT_STATUS));
@@ -405,6 +408,7 @@ public class ApplicationDao {
responseBean.setProgress(progress);
responseBean.setCallTitle(applicationEntity.getCall().getName());
responseBean.setCallEndDate(applicationEntity.getCall().getEndDate());
responseBean.setCallEndTime(applicationEntity.getCall().getEndTime());
responseBean.setModifiedDate(applicationEntity.getCall().getUpdatedDate());
responseBean.setCallId(applicationEntity.getCall().getId());
responseBean.setSubmissionDate(applicationEntity.getSubmissionDate());
@@ -872,7 +876,7 @@ public class ApplicationDao {
ApplicationRequest applicationRequest, Long callId, UserEntity userEntity) {
CallEntity call = callService.validateCall(callId);
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(userEntity.getId(),companyEntity.getId());
checkCallEndDate(call);
// call = callService.validatePublishedCall(call.getId());
// checkIfApplicationExists(call, userWithCompanyEntity, userEntity);
ApplicationEntity applicationEntity = createApplicationEntity(userEntity, call, userWithCompanyEntity);
@@ -890,7 +894,7 @@ public class ApplicationDao {
public ApplicationResponse updateApplicationStatus(HttpServletRequest request, Long applicationId, ApplicationStatusTypeEnum status) {
ApplicationEntity applicationEntity = validateApplication(applicationId);
checkCallEndDate(applicationEntity.getCall());
//cloned entity for old application data
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(applicationEntity);
@@ -1119,7 +1123,7 @@ public class ApplicationDao {
public ApplicationSignedDocumentResponse uploadSignedDocument(HttpServletRequest request, Long applicationId,
MultipartFile file) {
ApplicationEntity applicationEntity = validateApplication(applicationId);
checkCallEndDate(applicationEntity.getCall());
//cloned entity for old data
ApplicationEntity oldApplicationData = Utils.getClonedEntityForData(applicationEntity);
@@ -1252,6 +1256,7 @@ public class ApplicationDao {
ApplicationEntity applicationEntity = validateApplication(applicationId);
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(applicationEntity);
checkCallEndDate(applicationEntity.getCall());
UserEntity userEntity = userService.validateUser(applicationEntity.getUserId());
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
@@ -1516,4 +1521,21 @@ public class ApplicationDao {
return predicates;
}
public void checkCallEndDate(CallEntity call) {
LocalDateTime now = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
LocalDateTime callEndDateTime = LocalDateTime.of(
call.getEndDate().toLocalDate(),
call.getEndTime()
);
if (now.isAfter(callEndDateTime)) {
throw new CustomValidationException(
Status.BAD_REQUEST,
Translator.toLocale(GepafinConstant.CALL_EXPIRED)
);
}
}
}

View File

@@ -113,12 +113,21 @@ public class ApplicationEvaluationDao {
@Autowired
private ApplicationAmendmentRequestDao applicationAmendmentRequestDao;
@Autowired
private HubService hubService;
private ApplicationEvaluationEntity convertToEntity(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
ApplicationEvaluationEntity entity = new ApplicationEvaluationEntity();
AssignedApplicationsEntity assignedApplications = assignedApplicationsService.validateAssignedApplication(assignedApplciationId);
ApplicationEntity application = applicationService.validateApplication(assignedApplications.getApplication().getId());
Long hubId = application.getHubId();
HubEntity hub = hubService.valdateHub(hubId);
Long initialDays = (hub != null) ? hub.getEvaluationExpirationDays() : 0L;
entity.setApplicationId(application.getId());
entity.setAssignedApplicationsEntity(assignedApplications);
entity.setUserId(user.getId());
@@ -128,7 +137,7 @@ public class ApplicationEvaluationDao {
entity.setNote(req.getNote());
entity.setMotivation(req.getMotivation());
entity.setIsDeleted(false);
entity.setInitialDays(30L);
entity.setInitialDays(initialDays);
entity.setRemainingDays(30L);
entity.setSuspendedDays(0L);
entity.setStartDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));

View File

@@ -188,6 +188,7 @@ public class DashboardDao {
Map<String, Object> callData = new HashMap<>();
callData.put(GepafinConstant.CALL_NAME, result[0]); // Call name
callData.put(GepafinConstant.NUMBER_OF_APPLICATIONS, result[1]);// Application count
callData.put(GepafinConstant.NUMBER_OF_DRAFT_APPLICATIONS, result[2]);// Application count
return callData;
}).toList());

View File

@@ -296,6 +296,8 @@ public class FlowFormDao {
applicationDao.processForm(formEntity, applicationEntity));
nextOrPreviousFormResponse.setCallId(applicationEntity.getCall().getId());
nextOrPreviousFormResponse.setCallTitle(applicationEntity.getCall().getName());
nextOrPreviousFormResponse.setCallEndDate(applicationEntity.getCall().getEndDate());
nextOrPreviousFormResponse.setCallEndTime(applicationEntity.getCall().getEndTime());
nextOrPreviousFormResponse.setCompanyId(applicationEntity.getCompanyId());
nextOrPreviousFormResponse.setCompanyName(company.getCompanyName());

View File

@@ -264,6 +264,8 @@ public class PdfDao {
Map<String, Boolean> formulaEnabledMap = new HashMap<>();
Map<String, String> formulaTypeMap = new HashMap<>();
Map<String, String> fieldTypeMap = new HashMap<>();
Font lightGrayFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new BaseColor(110, 110, 110)); // Light gray
contentResponseBean.getSettings().stream()
.filter(setting -> "table_columns".equals(setting.getName())) // Check for "table_columns"
@@ -375,9 +377,17 @@ public class PdfDao {
if (columnSums.containsKey(key)) {
double total = columnSums.getOrDefault(key, 0.0); // Get the total for the column
PdfPCell sumCell = PdfUtils.htmlToPdfPCell(Utils.convertToItalianFormat(String.valueOf(total)), textFont);
// PdfPCell sumCell = PdfUtils.htmlToPdfPCell(Utils.convertToItalianFormat(String.valueOf(total)), textFont);
// Convert total to Italian format, defaulting to "0" if null
String formattedTotal = Utils.convertToItalianFormat(String.valueOf(total));
// Create a table cell with the formatted value
PdfPCell sumCell = new PdfPCell(new Phrase(formattedTotal,lightGrayFont));
sumCell.setBackgroundColor(new BaseColor(239, 243, 248)); // Light blue for totals
sumCell.setHorizontalAlignment(Element.ALIGN_CENTER);
sumCell.setPaddingTop(8f);
sumCell.setMinimumHeight(30f);
table.addCell(sumCell); // Add total for the column
} else {

View File

@@ -63,4 +63,7 @@ public class HubEntity extends BaseEntity{
@Column(name = "AREA_CODE")
private String areaCode;
@Column(name = "EVALUATION_EXPIRATION_DAYS")
private Long evaluationExpirationDays;
}

View File

@@ -5,6 +5,7 @@ import net.gepafin.tendermanagement.model.response.ApplicationFormFieldResponseB
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;
@Data
@@ -18,6 +19,8 @@ public class ApplicationResponse{
private LocalDateTime callEndDate;
private LocalTime callEndTime;
private LocalDateTime modifiedDate;
private Integer progress;

View File

@@ -5,6 +5,7 @@ import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalTime;
@Data
public class NextOrPreviousFormResponse {
@@ -21,6 +22,10 @@ public class NextOrPreviousFormResponse {
private Long currentStep;
private LocalDateTime callEndDate;
private LocalTime callEndTime;
private Long companyId;
private String companyName;

View File

@@ -45,9 +45,25 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
@Query("SELECT a.call.id FROM ApplicationEntity a WHERE a.id = :id AND a.isDeleted = false")
Long findCallIdById(@Param("id") Long id);
@Query("SELECT a.call.name, COUNT(a.id) FROM ApplicationEntity a WHERE a.isDeleted = false AND a.call.hub.id = :hubId GROUP BY a.call.name")
// @Query(value = "SELECT c.name AS callName, " +
// "SUM(CASE WHEN a.status IN ('DISCARD', 'SOCCORSO', 'APPROVED', 'REJECTED', 'EVALUATION', 'APPOINTMENT', 'NDG', 'ADMISSIBLE', 'SUBMIT') THEN 1 ELSE 0 END) AS totalApplications, " +
// "SUM(CASE WHEN a.status IN ('DRAFT', 'AWAITING', 'READY') THEN 1 ELSE 0 END) AS draftApplications " +
// "FROM application a " +
// "JOIN call c ON a.call_id = c.id " +
// "WHERE a.is_deleted = false AND c.hub_id = :hubId " +
// "GROUP BY c.name", nativeQuery = true)
// List<Object[]> findApplicationsPerCallWithName(@Param("hubId") Long hubId);
@Query(value = "SELECT c.name AS callName, " +
"SUM(CASE WHEN a.status IN ('DISCARD', 'SOCCORSO', 'APPROVED', 'REJECTED', 'EVALUATION', 'APPOINTMENT', 'NDG', 'ADMISSIBLE', 'SUBMIT') THEN 1 ELSE 0 END) AS totalApplications, " +
"SUM(CASE WHEN a.status IN ('DRAFT', 'AWAITING', 'READY') THEN 1 ELSE 0 END) AS draftApplications " +
"FROM ApplicationEntity a " +
"JOIN a.call c " +
"WHERE a.isDeleted = false AND c.hub.id = :hubId " +
"GROUP BY c.name")
List<Object[]> findApplicationsPerCallWithName(@Param("hubId") Long hubId);
// Count Applications by Status by Hub ID
@Query("SELECT a.status, COUNT(a.id) FROM ApplicationEntity a WHERE a.isDeleted = false AND a.call.hub.id = :hubId GROUP BY a.status")
List<Object[]> findApplicationsByStatus(@Param("hubId") Long hubId);

View File

@@ -153,11 +153,17 @@ public class AmazonS3ServiceImpl implements AmazonS3Service {
}
}
private String decodeS3Key(String key) {
return URLDecoder.decode(key, StandardCharsets.UTF_8);
}
@Override
public UploadFileOnAmazonS3Response moveFile(String fileName, String oldPath, String newPath) {
try {
log.info("Original Paths - oldPath: {}, newPath: {}", oldPath, newPath);
oldPath = decodeS3Key(cleanOldPath(oldPath));
newPath = cleanNewPath(oldPath, newPath);
oldPath = cleanOldPath(oldPath);
log.info("Moving file from {} to {} in bucket {}", oldPath, newPath, bucketName);
CopyObjectRequest copyRequest = new CopyObjectRequest(bucketName, oldPath, bucketName, newPath);

View File

@@ -2236,4 +2236,22 @@
</addColumn>
</changeSet>
<changeSet id="16-01-2025_RK_173515" author="Rajesh Khore">
<addColumn tableName="hub">
<column name="evaluation_expiration_days" type="INTEGER"/>
</addColumn>
</changeSet>
<changeSet id="16-01-2025_RK_173616" author="Rajesh Khore">
<update tableName="hub">
<column name="evaluation_expiration_days" valueNumeric="999"/>
<where>unique_uuid = 't7jh5wfg9QXylNaTZkPoE'</where>
</update>
<update tableName="hub">
<column name="evaluation_expiration_days" valueNumeric="30"/>
<where>unique_uuid = 'p4lk3bcx1RStqTaIVVbXs'</where>
</update>
</changeSet>
</databaseChangeLog>

View File

@@ -350,3 +350,4 @@ user.with.company.not.found = User with company not found for user or company.
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.

View File

@@ -304,7 +304,6 @@ beneficiary.call.duplicate = Una chiamata preferita con questo ID di chiamata e
user.must.be.associated.with.company.to.create.application=Devi essere associato a un'azienda per poter presentare domanda per questa applicazione.
company.id.required.for.preferred.call=ID azienda obbligatorio quando si richiedono solo chiamate preferite.
response.days.not.null=I giorni di risposta non devono essere nulli e maggiori di zero.
application.cannot.approved.or.rejected=La domanda non pu<70> essere approvata o rifiutata perch<63> l'emendamento <20> attivo.
valid.vatnumber.message=Il numero di partita IVA � valido.
application.cannot.approved.or.rejected=La domanda non pu? essere approvata o rifiutata perch? l'emendamento ? attivo.
@@ -342,3 +341,4 @@ 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.