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

@@ -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,7 +1256,8 @@ 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());
if (Boolean.FALSE.equals(ApplicationStatusTypeEnum.DRAFT.getValue().equals(applicationEntity.getStatus()))) {
@@ -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

@@ -187,7 +187,8 @@ public class DashboardDao {
stats.put(GepafinConstant.APPLICATION_PER_CALL, applicationsPerCall.stream().map(result -> {
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_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,8 +264,10 @@ 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()
contentResponseBean.getSettings().stream()
.filter(setting -> "table_columns".equals(setting.getName())) // Check for "table_columns"
.map(SettingResponseBean::getValue)
.filter(Objects::nonNull) // Ensure value is not null
@@ -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 {