Merge branch 'develop' of https://github.com/Kitzanos/GEPAFIN-BE into develop
This commit is contained in:
@@ -277,7 +277,8 @@ public class ApplicationDao {
|
|||||||
for (ApplicationFormFieldEntity applicationFormFieldEntity : applicationFormFieldEntities) {
|
for (ApplicationFormFieldEntity applicationFormFieldEntity : applicationFormFieldEntities) {
|
||||||
|
|
||||||
Optional<ContentResponseBean> fileUploadContent = contentResponseBeans.stream()
|
Optional<ContentResponseBean> fileUploadContent = contentResponseBeans.stream()
|
||||||
.filter(contentResponseBean -> "fileupload".equals(contentResponseBean.getName()) &&
|
.filter(contentResponseBean -> ("fileupload".equals(contentResponseBean.getName()) ||
|
||||||
|
"fileselect".equals(contentResponseBean.getName())) &&
|
||||||
contentResponseBean.getId().equals(applicationFormFieldEntity.getFieldId()))
|
contentResponseBean.getId().equals(applicationFormFieldEntity.getFieldId()))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
@@ -613,7 +614,7 @@ public class ApplicationDao {
|
|||||||
|
|
||||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
for (ContentResponseBean contentResponseBean : contentResponseBeans) {
|
for (ContentResponseBean contentResponseBean : contentResponseBeans) {
|
||||||
if (Boolean.FALSE.equals(contentResponseBean.getName().equals("fileupload"))) {
|
if (Boolean.FALSE.equals(contentResponseBean.getName().equals("fileupload") || contentResponseBean.getName().equals("fileselect"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -669,7 +670,7 @@ public class ApplicationDao {
|
|||||||
// List<ContentResponseBean> contentResponseBeans=Utils.convertJsonStringToList(formEntity.getContent(),ContentResponseBean.class);
|
// List<ContentResponseBean> contentResponseBeans=Utils.convertJsonStringToList(formEntity.getContent(),ContentResponseBean.class);
|
||||||
List<ContentResponseBean> contentResponseBeans=formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
List<ContentResponseBean> contentResponseBeans=formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
for (ContentResponseBean contentResponseBean:contentResponseBeans){
|
for (ContentResponseBean contentResponseBean:contentResponseBeans){
|
||||||
if(Boolean.TRUE.equals(contentResponseBean.getName().equals("fileupload"))) {
|
if(Boolean.TRUE.equals(contentResponseBean.getName().equals("fileupload")) || Boolean.TRUE.equals(contentResponseBean.getName().equals("fileselect"))) {
|
||||||
if (contentResponseBean.getId().equals(applicationFormFieldRequestBean.getFieldId())) {
|
if (contentResponseBean.getId().equals(applicationFormFieldRequestBean.getFieldId())) {
|
||||||
Object fieldValueObject = applicationFormFieldRequestBean.getFieldValue();
|
Object fieldValueObject = applicationFormFieldRequestBean.getFieldValue();
|
||||||
if (fieldValueObject instanceof String) {
|
if (fieldValueObject instanceof String) {
|
||||||
@@ -1405,7 +1406,7 @@ public class ApplicationDao {
|
|||||||
FormEntity formEntity = applicationForm.getForm();
|
FormEntity formEntity = applicationForm.getForm();
|
||||||
if (formEntity != null) {
|
if (formEntity != null) {
|
||||||
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
List<ContentResponseBean> contentResponseBeans = formDao.convertFormEntityToFormResponseBean(formEntity).getContent();
|
||||||
contentResponseBeans.stream().filter(content -> "fileupload".equals(content.getName())).forEach(content -> {
|
contentResponseBeans.stream().filter(content -> "fileupload".equals(content.getName()) || "fileselect".equals(content.getName())).forEach(content -> {
|
||||||
Optional<ApplicationFormFieldEntity> formField = applicationFormFieldRepository.findByFieldIdAndApplicationFormIdAndApplicationFormApplicationId(
|
Optional<ApplicationFormFieldEntity> formField = applicationFormFieldRepository.findByFieldIdAndApplicationFormIdAndApplicationFormApplicationId(
|
||||||
content.getId(), applicationForm.getId(), applicationId);
|
content.getId(), applicationForm.getId(), applicationId);
|
||||||
formField.ifPresent(field -> {
|
formField.ifPresent(field -> {
|
||||||
|
|||||||
@@ -612,11 +612,15 @@ public class CallDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isEndDateUpdated || isEndTimeUpdated) {
|
if (isEndDateUpdated || isEndTimeUpdated) {
|
||||||
|
|
||||||
loggingUtil.logUserAction(UserActionRequest.builder()
|
loggingUtil.logUserAction(UserActionRequest.builder()
|
||||||
.request(request)
|
.request(request)
|
||||||
.actionType(UserActionLogsEnum.UPDATE)
|
.actionType(UserActionLogsEnum.UPDATE)
|
||||||
.actionContext(UserActionContextEnum.UPDATE_CALL_END_DATE_AND_TIME)
|
.actionContext(UserActionContextEnum.UPDATE_CALL_END_DATE_AND_TIME)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "update call end date and time" operation **/
|
||||||
|
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldCallEntity).newData(callEntity).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
// setIfUpdated(callEntity::getStartDate, callEntity::setStartDate, updateCallRequest.getStartDate());
|
// setIfUpdated(callEntity::getStartDate, callEntity::setStartDate, updateCallRequest.getStartDate());
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import org.springframework.data.repository.query.Param;
|
|||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -112,24 +110,31 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
|||||||
@Param("userId") Long userId,
|
@Param("userId") Long userId,
|
||||||
@Param("userWithCompanyId") Long userWithCompanyId);
|
@Param("userWithCompanyId") Long userWithCompanyId);
|
||||||
|
|
||||||
@Query("""
|
@Query(value = """
|
||||||
SELECT TO_CHAR(a.submissionDate, 'Mon') AS month,
|
WITH months AS (
|
||||||
SUM(a.amountRequested) AS totalRequested,
|
SELECT TO_CHAR(generate_series(CURRENT_DATE - INTERVAL '5 months', CURRENT_DATE, INTERVAL '1 month'), 'Mon') AS month_label,
|
||||||
SUM(a.amountAccepted) AS totalApproved
|
EXTRACT(YEAR FROM generate_series(CURRENT_DATE - INTERVAL '5 months', CURRENT_DATE, INTERVAL '1 month')) AS year_value,
|
||||||
FROM ApplicationEntity a
|
EXTRACT(MONTH FROM generate_series(CURRENT_DATE - INTERVAL '5 months', CURRENT_DATE, INTERVAL '1 month')) AS month_value
|
||||||
WHERE a.isDeleted = false
|
)
|
||||||
AND a.status = 'APPROVED'
|
SELECT m.month_label AS month,
|
||||||
AND a.call.hub.id = :hubId
|
COALESCE(SUM(a.amount_requested), 0) AS totalRequested,
|
||||||
AND a.userId = :userId
|
COALESCE(SUM(a.amount_accepted), 0) AS totalApproved
|
||||||
AND a.userWithCompany.id = :userWithCompanyId
|
FROM months m
|
||||||
GROUP BY TO_CHAR(a.submissionDate, 'Mon'), EXTRACT(YEAR FROM a.submissionDate), EXTRACT(MONTH FROM a.submissionDate)
|
LEFT JOIN {h-schema}application a ON EXTRACT(YEAR FROM a.date_accepted) = m.year_value
|
||||||
ORDER BY EXTRACT(YEAR FROM a.submissionDate), EXTRACT(MONTH FROM a.submissionDate)
|
AND EXTRACT(MONTH FROM a.date_accepted) = m.month_value
|
||||||
""")
|
AND a.is_deleted = false
|
||||||
List<Object[]> findRequestedVsApprovedAmountsPerMonth(
|
AND a.status = 'APPROVED'
|
||||||
@Param("hubId") Long hubId,
|
AND a.hub_id = :hubId
|
||||||
@Param("userId") Long userId,
|
AND a.user_id = :userId
|
||||||
@Param("userWithCompanyId") Long userWithCompanyId
|
AND a.user_with_company_id = :userWithCompanyId
|
||||||
);
|
GROUP BY m.month_label, m.year_value, m.month_value
|
||||||
|
ORDER BY m.year_value, m.month_value
|
||||||
|
""", nativeQuery = true)
|
||||||
|
List<Object[]> findRequestedVsApprovedAmountsPerMonth(@Param("hubId") Long hubId,
|
||||||
|
@Param("userId") Long userId,
|
||||||
|
@Param("userWithCompanyId") Long userWithCompanyId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a " +
|
@Query("SELECT COUNT(a) FROM ApplicationEntity a " +
|
||||||
"WHERE a.hubId = :hubId " +
|
"WHERE a.hubId = :hubId " +
|
||||||
@@ -164,4 +169,5 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
|||||||
);
|
);
|
||||||
|
|
||||||
ApplicationEntity findByIdAndCompanyIdAndIsDeletedFalse(Long id,Long companyId);
|
ApplicationEntity findByIdAndCompanyIdAndIsDeletedFalse(Long id,Long companyId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import org.springframework.security.authorization.AuthorizationDeniedException;
|
|||||||
import org.springframework.security.core.AuthenticationException;
|
import org.springframework.security.core.AuthenticationException;
|
||||||
import org.springframework.validation.FieldError;
|
import org.springframework.validation.FieldError;
|
||||||
import org.springframework.validation.ObjectError;
|
import org.springframework.validation.ObjectError;
|
||||||
|
import org.springframework.web.servlet.resource.NoResourceFoundException;
|
||||||
|
|
||||||
@ControllerAdvice
|
@ControllerAdvice
|
||||||
public class GlobalExceptionHandler {
|
public class GlobalExceptionHandler {
|
||||||
@@ -49,6 +50,7 @@ public class GlobalExceptionHandler {
|
|||||||
return new Response<>(ex.getErrors(), ex.getStatus(), ex.getMessage());
|
return new Response<>(ex.getErrors(), ex.getStatus(), ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseStatus(value = HttpStatus.NOT_FOUND)
|
||||||
@ExceptionHandler(ResourceNotFoundException.class)
|
@ExceptionHandler(ResourceNotFoundException.class)
|
||||||
public ResponseEntity<Response<Void>> handleResourceNotFoundException(ResourceNotFoundException ex) {
|
public ResponseEntity<Response<Void>> handleResourceNotFoundException(ResourceNotFoundException ex) {
|
||||||
log.error(ex.getMessage());
|
log.error(ex.getMessage());
|
||||||
@@ -178,5 +180,14 @@ public class GlobalExceptionHandler {
|
|||||||
String exceptionString = ex.getMessage().substring(ex.getMessage().indexOf("]: [") + 4, ex.getMessage().length() - 1);
|
String exceptionString = ex.getMessage().substring(ex.getMessage().indexOf("]: [") + 4, ex.getMessage().length() - 1);
|
||||||
return Utils.convertIntoJson(exceptionString);
|
return Utils.convertIntoJson(exceptionString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseStatus(value = HttpStatus.NOT_FOUND)
|
||||||
|
@ExceptionHandler(NoResourceFoundException.class)
|
||||||
|
public ResponseEntity<Response<Void>> handlNoeResourceNotFoundException(NoResourceFoundException ex) {
|
||||||
|
log.error(ex.getMessage());
|
||||||
|
// log.error(ex.getLocalizedMessage(), ex);
|
||||||
|
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||||
|
.body(new Response<>(null, Status.NOT_FOUND, ex.getMessage()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2550,5 +2550,16 @@
|
|||||||
</column>
|
</column>
|
||||||
</addColumn>
|
</addColumn>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="03-03-2025_RK_120515" author="Rajesh Khore">
|
||||||
|
|
||||||
|
<sql dbms="postgresql">select
|
||||||
|
setval('gepafin_schema.form_field_id_seq', (select
|
||||||
|
max(id)+1
|
||||||
|
from gepafin_schema.form_field), false)
|
||||||
|
</sql>
|
||||||
|
<sqlFile dbms="postgresql"
|
||||||
|
path="db/dump/update_form_field_data_03-03-2025.sql"/>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
INSERT INTO FORM_FIELD (SORT_ORDER, NAME, LABEL, DESCRIPTION, SETTINGS, VALIDATORS, CREATED_DATE, UPDATED_DATE)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
23,
|
||||||
|
'fileselect',
|
||||||
|
'Caricamento File',
|
||||||
|
'Per selezionare di documenti o immagini',
|
||||||
|
'[{name: "label",value: "Seleziona File"},{ name: "isDelegation", value: false }]',
|
||||||
|
'{"isRequired":false}',
|
||||||
|
CURRENT_TIMESTAMP,
|
||||||
|
CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
Reference in New Issue
Block a user