Merge branch 'develop' of https://github.com/Kitzanos/GEPAFIN-BE into develop

This commit is contained in:
nisha
2025-02-27 16:45:42 +05:30
21 changed files with 251 additions and 15 deletions

View File

@@ -465,6 +465,16 @@ public class GepafinConstant {
public static final String APPOINTMENT_CANNOT_BE_CREATED = "appointment.cannot.be.created";
public static final String APPOINTMENT_NOT_CREATED = "appointment.not.created";
public static final String CALL_TITLE = "callTitle";
public static final String CALL_ID="callId";
public static final String CALL_END_DATE="callEndDate";
public static final String END_DATE="endDate";
public static final String MODIFIED_DATE="modifiedDate";
public static final String CALL_END_TIME="callEndTime";
public static final String END_TIME="endTime";
public static final String UPDATED_DATE="updatedDate";
public static final String SWITCH="switch";
public static final String IS_CHECK_LIST_ITEM="isChecklistItem";
public static final String VALIDATION_FAILED_FOR_CHECKLIST="validation.failed.checklist";

View File

@@ -1,9 +1,7 @@
package net.gepafin.tendermanagement.dao;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.Root;
import jakarta.persistence.criteria.*;
import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.config.jwt.TokenProvider;
import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.entities.*;
import net.gepafin.tendermanagement.entities.SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum;
@@ -42,19 +40,21 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import jakarta.persistence.criteria.Predicate;
import jakarta.servlet.http.HttpServletRequest;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -64,6 +64,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.hibernate.validator.internal.engine.messageinterpolation.el.RootResolver.FORMATTER;
@Component
public class ApplicationDao {
@@ -1444,7 +1445,7 @@ public class ApplicationDao {
Integer pageLimit = null;
UserWithCompanyEntity userWithCompany= userWithCompanyRepository.findByUserIdAndCompanyIdAndIsDeletedFalse(userEntity.getId(), companyId).orElse(null);
Long userWithCompanyId = userWithCompany!=null?userWithCompany.getId():null;
if (applicationPageableRequestBean.getGlobalFilters() != null) {
pageNo = applicationPageableRequestBean.getGlobalFilters().getPage();
pageLimit = applicationPageableRequestBean.getGlobalFilters().getLimit();
@@ -1455,7 +1456,7 @@ public class ApplicationDao {
if (pageNo == null || pageNo <= 0) {
pageNo = GepafinConstant.DEFAULT_PAGE;
}
Specification<ApplicationEntity> spec = search(callId,companyId, userWithCompany.getId(), applicationPageableRequestBean, userEntity);
Specification<ApplicationEntity> spec = search(callId,companyId, userWithCompanyId, applicationPageableRequestBean, userEntity);
Page<ApplicationEntity> entityPage = applicationRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
// Prepare the response
@@ -1510,11 +1511,15 @@ public class ApplicationDao {
Integer year = null;
String search = null;
Integer daysRange = null;
Map<String, FilterCriteria> filters = new HashMap<>();
if (applicationPageableRequestBean.getGlobalFilters() != null) {
year = applicationPageableRequestBean.getGlobalFilters().getYear();
search = applicationPageableRequestBean.getGlobalFilters().getSearch();
daysRange = applicationPageableRequestBean.getDaysRange();
}
if (applicationPageableRequestBean.getFilters() != null) {
filters = applicationPageableRequestBean.getFilters();
}
List<Predicate> predicates = new ArrayList<>();
Boolean isBeneficiary = validator.checkIsBeneficiary();
@@ -1583,13 +1588,104 @@ public class ApplicationDao {
LocalDateTime pastDate = today.minusDays(daysRange);
predicates.add(criteriaBuilder.between(root.get(GepafinConstant.CREATED_DATE), pastDate, today));
}
predicates.add(criteriaBuilder.isFalse(root.get(GepafinConstant.IS_DELETED)));
applyFilters(root, criteriaBuilder, predicates, filters);
predicates.add(criteriaBuilder.isFalse(root.get(GepafinConstant.IS_DELETED)));
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.HUB_ID), userEntity.getHub().getId()));
return predicates;
}
private void applyFilters(Root<?> root, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Map<String, FilterCriteria> filters) {
if (Boolean.FALSE.equals(filters.isEmpty())) {
for (Map.Entry<String, FilterCriteria> entry : filters.entrySet()) {
String fieldName = entry.getKey();
FilterCriteria filterCriteria = entry.getValue();
Object value = filterCriteria.getValue();
MatchModeEnum matchMode = filterCriteria.getMatchMode();
if (value != null && matchMode != null) {
Path<?> fieldPath = getFieldPath(root, fieldName);
if (fieldPath != null) {
applyStringFilter(fieldPath, criteriaBuilder, predicates, value, matchMode);
applyNumberFilter(fieldPath, criteriaBuilder, predicates, value, matchMode);
applyDateFilter(fieldPath, criteriaBuilder, predicates, value, matchMode,root);
}
}
}
}
}
private void applyStringFilter(Path<?> fieldPath, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Object value, MatchModeEnum matchMode) {
if (value instanceof String) {
String valueStr = (String) value;
if (fieldPath.getJavaType().equals(String.class)) {
MatchModeEnum mode = MatchModeEnum.fromObject(matchMode.getValue());
switch (mode) {
case CONTAINS ->
predicates.add(criteriaBuilder.like(criteriaBuilder.lower(fieldPath.as(String.class)), "%" + valueStr.toLowerCase() + "%"));
case EQUALS -> predicates.add(criteriaBuilder.equal(fieldPath, valueStr));
case STARTSWITH ->
predicates.add(criteriaBuilder.like(criteriaBuilder.lower(fieldPath.as(String.class)), valueStr.toLowerCase() + "%"));
case ENDSWITH ->
predicates.add(criteriaBuilder.like(criteriaBuilder.lower(fieldPath.as(String.class)), "%" + valueStr.toLowerCase()));
}
}
}
}
private void applyNumberFilter(Path<?> fieldPath, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Object value, MatchModeEnum matchMode) {
if (Number.class.isAssignableFrom(fieldPath.getJavaType())) {
Number numberValue = null;
if (value instanceof Number) {
numberValue = (Number) value;
}
MatchModeEnum mode = MatchModeEnum.fromObject(matchMode.getValue());
switch (mode) {
case EQUALS -> predicates.add(criteriaBuilder.equal(fieldPath, numberValue));
}
}
}
private void applyDateFilter(Path<?> fieldPath, CriteriaBuilder criteriaBuilder, List<Predicate> predicates, Object value, MatchModeEnum matchMode, Root<?> root) {
if (fieldPath.getJavaType().equals(LocalDateTime.class)) {
LocalDateTime testDateTime = DateTimeUtil.parseStringToLocalDateTime(value.toString());
MatchModeEnum mode = MatchModeEnum.fromObject(matchMode.getValue());
switch (mode) {
// case DATEIS -> predicates.add(criteriaBuilder.equal(fieldPath.as(Timestamp.class), Timestamp.valueOf(testDateTime)));
case DATEISNOT -> predicates.add(criteriaBuilder.notEqual(fieldPath.as(Timestamp.class), Timestamp.valueOf(testDateTime)));
case BEFORE -> predicates.add(criteriaBuilder.lessThan(fieldPath.as(Timestamp.class), Timestamp.valueOf(testDateTime)));
case AFTER -> predicates.add(criteriaBuilder.greaterThan(fieldPath.as(Timestamp.class), Timestamp.valueOf(testDateTime)));
}
}
}
private Path<?> getFieldPath(Root<?> root, String fieldName) {
try {
return switch (fieldName) {
case GepafinConstant.CALL_ID -> root.get(GepafinConstant.CALL).get(GepafinConstant.ID);
case GepafinConstant.CALL_TITLE -> root.get(GepafinConstant.CALL).get(GepafinConstant.NAME);
case GepafinConstant.CALL_END_DATE -> root.get(GepafinConstant.CALL).get(GepafinConstant.END_DATE);
case GepafinConstant.CALL_END_TIME -> root.get(GepafinConstant.CALL).get(GepafinConstant.END_TIME);
case GepafinConstant.MODIFIED_DATE -> root.get(GepafinConstant.CALL).get(GepafinConstant.UPDATED_DATE);
case GepafinConstant.PROTOCOL_NUMBER-> root.get(GepafinConstant.PROTOCOL).get(GepafinConstant.PROTOCOL_NUMBER);
default -> root.get(fieldName);
};
} catch (IllegalArgumentException e) {
return null;
}
}
public void checkCallEndDate(CallEntity call) {
LocalDateTime now = DateTimeUtil.DateServerToUTC(LocalDateTime.now());

View File

@@ -86,7 +86,7 @@ public class CompanyDocumentDao {
@Autowired
private Validator validator;
public List<CompanyDocumentResponseBean> uploadFileForCompany(HttpServletRequest request, Long userId, List<MultipartFile> files, Long companyId, Long documentCategoryId, CompanyDocumentTypeEnum companyDocumentSourceTypeEnum, LocalDateTime expirationDate){
public List<CompanyDocumentResponseBean> uploadFileForCompany(HttpServletRequest request, Long userId, List<MultipartFile> files, Long companyId, Long documentCategoryId, CompanyDocumentTypeEnum companyDocumentSourceTypeEnum, LocalDateTime expirationDate,String name){
DocumentCategoryEntity categoryEntity = categoryDao.validateCategory(documentCategoryId);
validator.validateUserWithCompany(request,companyId);
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(userId,companyId);
@@ -106,6 +106,7 @@ public class CompanyDocumentDao {
companyDocumentEntity.setFilePath(uploadFileOnAmazonS3Response.getFilePath());
companyDocumentEntity.setIsDeleted(false);
companyDocumentEntity.setUploadedBy(userId);
companyDocumentEntity.setName(name);
if (expirationDate.isBefore(currentDate.plusDays(7))) {
companyDocumentEntity.setStatus(CompanyDocumentStatusEnum.DUE.getValue());
} else {
@@ -159,7 +160,7 @@ public class CompanyDocumentDao {
DocumentCategoryEntity categoryEntity = entity.getCategoryEntity();
DocumentCategoryResponse responseCategory = categoryDao.convertToResponseBean(categoryEntity);
responseBean.setId(entity.getId());
responseBean.setName(entity.getFileName());
responseBean.setFileName(entity.getFileName());
responseBean.setType(CompanyDocumentTypeEnum.valueOf(entity.getType()));
responseBean.setFilePath(entity.getFilePath());
responseBean.setCompanyId(entity.getCompanyId());
@@ -167,9 +168,11 @@ public class CompanyDocumentDao {
responseBean.setStatus(entity.getStatus());
responseBean.setUploadedBy(entity.getUploadedBy());
responseBean.setCategory(responseCategory);
responseBean.setName(entity.getName());
responseBean.setUserWithCompanyId(entity.getUserWithCompany().getId());
responseBean.setCreatedDate(entity.getCreatedDate());
responseBean.setUpdatedDate(entity.getUpdatedDate());
return responseBean;
}
@@ -194,6 +197,7 @@ public class CompanyDocumentDao {
DocumentCategoryEntity categoryEntity = categoryDao.validateCategory(companyDocumentRequest.getCategoryId());
setIfUpdated(companyDocumentEntity::getCategoryEntity, companyDocumentEntity::setCategoryEntity, categoryEntity);
}
setIfUpdated(companyDocumentEntity::getName, companyDocumentEntity::setName, companyDocumentRequest.getName());
companyDocumentRepository.save(companyDocumentEntity);
/** This code is responsible for adding a version history log for the "updating company document" operation. **/

View File

@@ -1,6 +1,7 @@
package net.gepafin.tendermanagement.dao;
import jakarta.servlet.http.HttpServletRequest;
import jdk.jfr.Category;
import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.entities.DocumentCategoryEntity;
@@ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
@@ -108,4 +110,11 @@ public class DocumentCategoryDao {
return entity;
}
public List<DocumentCategoryResponse> getAllDocumentCategory(){
List<DocumentCategoryEntity> documentCategoryEntityList = categoryRepository.findAll();
return documentCategoryEntityList.stream()
.map(this::convertToResponseBean)
.collect(Collectors.toList());
}
}

View File

@@ -16,6 +16,9 @@ public class CompanyDocumentEntity extends BaseEntity {
@Column(name = "FILE_PATH")
private String filePath;
@Column(name ="name")
private String name;
@Column(name="TYPE")
private String type;

View File

@@ -0,0 +1,39 @@
package net.gepafin.tendermanagement.enums;
import com.fasterxml.jackson.annotation.JsonValue;
public enum MatchModeEnum {
STARTSWITH("Starts with"),
ENDSWITH("Ends with"),
CONTAINS("Contains"),
EQUALS("Equals"),
DATEIS("Date is"),
DATEISNOT("Date is not"),
BEFORE("Date is before"),
AFTER("Date is after");
private String value;
MatchModeEnum(String value) {
this.value = value;
}
public static MatchModeEnum fromObject(Object value) {
if (value instanceof String) {
String strValue = ((String) value).trim();
for (MatchModeEnum mode : MatchModeEnum.values()) {
if (mode.getValue().equalsIgnoreCase(strValue)) {
return mode;
}
}
}
throw new IllegalArgumentException("Invalid MatchModeEnum: " + value);
}
@JsonValue
public String getValue() {
return value;
}
}

View File

@@ -207,6 +207,7 @@ public enum UserActionContextEnum {
DELETE_DOCUMENT_CATEGORY("DELETE_DOCUMENT_CATEGORY"),
UPDATE_DOCUMENT_CATEGORY("UPDATE_DOCUMENT_CATEGORY"),
COMPANY_DOCUMENT_EXPIRATION_SCHEDULER("COMPANY_DOCUMENT_EXPIRATION_SCHEDULER"),
GET_ALL_DOCUMENT_CATEGORY("GET_ALL_DOCUMENT_CATEGORY"),
GET_ALL_ASSIGNED_APPLICATION_BY_PAGINATION("GET_ALL_ASSIGNED_APPLICATION_BY_PAGINATION"),
GET_ALL_APPLICATION_AMENDMENT_BY_PAGINATION("GET_ALL_APPLICATION_AMENDMENT_BY_PAGINATION"),

View File

@@ -4,6 +4,7 @@ import lombok.Data;
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
import java.util.List;
import java.util.Map;
@Data
public class ApplicationPageableRequestBean {
@@ -13,4 +14,6 @@ public class ApplicationPageableRequestBean {
private Integer daysRange;
private List<ApplicationStatusTypeEnum> status;
private Map<String, FilterCriteria> filters;
}

View File

@@ -8,5 +8,6 @@ import java.time.LocalDateTime;
@Data
public class CompanyDocumentRequest {
private Long categoryId;
private String name ;
private LocalDateTime expirationDate;
}

View File

@@ -0,0 +1,11 @@
package net.gepafin.tendermanagement.model.request;
import lombok.Data;
import net.gepafin.tendermanagement.enums.MatchModeEnum;
@Data
public class FilterCriteria {
private Object value;
private MatchModeEnum matchMode;
}

View File

@@ -8,7 +8,7 @@ import java.time.LocalDateTime;
@Data
public class CompanyDocumentResponseBean extends BaseBean {
private String name;
private String fileName;
private String filePath;
@@ -16,6 +16,8 @@ public class CompanyDocumentResponseBean extends BaseBean {
private Long companyId;
private String name;
private String status;
private LocalDateTime expirationDate;

View File

@@ -12,7 +12,7 @@ import java.time.LocalDateTime;
import java.util.List;
public interface CompanyDocumentService {
List<CompanyDocumentResponseBean> uploadFileForCompany(HttpServletRequest request, List<MultipartFile> files, Long companyId, Long documentCategoryId, CompanyDocumentTypeEnum documentSourceTypeEnum, LocalDateTime expirationDate);
List<CompanyDocumentResponseBean> uploadFileForCompany(HttpServletRequest request, List<MultipartFile> files, Long companyId, Long documentCategoryId, CompanyDocumentTypeEnum documentSourceTypeEnum, LocalDateTime expirationDate,String name);
CompanyDocumentResponseBean updateCompanyDocument(HttpServletRequest httpServletRequest, Long companyDocumentId, CompanyDocumentRequest companyDocumentRequest);

View File

@@ -4,10 +4,13 @@ import jakarta.servlet.http.HttpServletRequest;
import net.gepafin.tendermanagement.model.request.DocumentCategoryRequest;
import net.gepafin.tendermanagement.model.response.DocumentCategoryResponse;
import java.util.List;
public interface DocumentCategoryService {
DocumentCategoryResponse createDocumentCategory(HttpServletRequest request, DocumentCategoryRequest categoryRequest);
DocumentCategoryResponse getDocumentCategoryById(HttpServletRequest request, Long id);
void deleteDocumentCategory(HttpServletRequest request,Long id);
DocumentCategoryResponse updateDocumentCategory(HttpServletRequest request, Long id, DocumentCategoryRequest categoryRequest);
List<DocumentCategoryResponse> getAllDocumentCategory(HttpServletRequest request);
}

View File

@@ -28,10 +28,10 @@ public class CompanyDocumentServiceImpl implements CompanyDocumentService {
private CompanyDocumentDao companyDocumentDao;
@Override
public List<CompanyDocumentResponseBean> uploadFileForCompany(HttpServletRequest request, List<MultipartFile> files, Long companyId, Long documentCategoryId , CompanyDocumentTypeEnum documentSourceTypeEnum, LocalDateTime expirationDate) {
public List<CompanyDocumentResponseBean> uploadFileForCompany(HttpServletRequest request, List<MultipartFile> files, Long companyId, Long documentCategoryId , CompanyDocumentTypeEnum documentSourceTypeEnum, LocalDateTime expirationDate,String name) {
Map<String, Object> userInfo = validator.getUserInfoFromToken(request);
Long userId = validator.getUserId(userInfo);
return companyDocumentDao.uploadFileForCompany(request,userId,files,companyId,documentCategoryId,documentSourceTypeEnum,expirationDate);
return companyDocumentDao.uploadFileForCompany(request,userId,files,companyId,documentCategoryId,documentSourceTypeEnum,expirationDate,name);
}
@Override

View File

@@ -10,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class DocumentCategoryServiceImpl implements DocumentCategoryService {
@@ -47,5 +49,11 @@ public class DocumentCategoryServiceImpl implements DocumentCategoryService {
return categoryDao.updateDocumentCategory(request,id,categoryRequest);
}
@Override
public List<DocumentCategoryResponse> getAllDocumentCategory(HttpServletRequest request) {
validator.validateUser(request);
return categoryDao.getAllDocumentCategory();
}
}

View File

@@ -92,6 +92,10 @@ public class DateTimeUtil {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
return LocalDateTime.parse(dateTimeStr, formatter);
}
public static LocalDateTime parseStringToLocalDateTime(String timestampStr) {
// Use ISO_LOCAL_DATE_TIME to parse the input string
return LocalDateTime.parse(timestampStr, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
}
public static String parseLocalTimeToString(LocalTime time, String format) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);

View File

@@ -41,6 +41,7 @@ public interface CompanyDocumentApi {
default ResponseEntity<Response<List<CompanyDocumentResponseBean>>> uploadFileForCompany(HttpServletRequest httpServletRequest,
@Parameter(description = "Company Id", required = true) @PathVariable("companyId") Long companyId,
@Parameter(description = "The Document Category id", required = true) @RequestParam(value = "documentCategoryId", required = false) Long documentCategoryId,
@Parameter(description = "The Document Name", required = true) @RequestParam(value = "name", required = false) String name,
@RequestParam("documentType") CompanyDocumentTypeEnum documentTypeEnum,
@RequestParam("expirationDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime expirationDate,
@RequestParam("file") List<MultipartFile> files) {

View File

@@ -16,6 +16,8 @@ import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Validated
public interface DocumentCategoryApi {
@@ -79,4 +81,16 @@ public interface DocumentCategoryApi {
@PathVariable("id") Long id,
@Parameter(description = "Category request object", required = true)
@Valid @RequestBody DocumentCategoryRequest categoryRequest);
@Operation(summary = "Api to get all document category",
responses = {
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@GetMapping(value = "", produces = "application/json")
ResponseEntity<Response<List<DocumentCategoryResponse>>> getAllDocumentCategory(HttpServletRequest request);
}

View File

@@ -41,7 +41,7 @@ public class CompanyDocumentApiControlller implements CompanyDocumentApi {
private CompanyDocumentDao companyDocumentDao;
@Override
public ResponseEntity<Response<List<CompanyDocumentResponseBean>>> uploadFileForCompany(HttpServletRequest request, Long companyId, Long documentCategoryId, CompanyDocumentTypeEnum companyDocumentSourceTypeEnum, LocalDateTime expirationDate,
public ResponseEntity<Response<List<CompanyDocumentResponseBean>>> uploadFileForCompany(HttpServletRequest request, Long companyId, Long documentCategoryId, String name ,CompanyDocumentTypeEnum companyDocumentSourceTypeEnum, LocalDateTime expirationDate,
List<MultipartFile> files) {
try {
UserActionContextEnum userActionContext = companyDocumentDao.getUserActionContextEnum(companyDocumentSourceTypeEnum);
@@ -49,7 +49,7 @@ public class CompanyDocumentApiControlller implements CompanyDocumentApi {
/** This code is responsible for creating user action logs for the "upload document for company" operation. **/
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPLOAD).actionContext(userActionContext).build());
List<CompanyDocumentResponseBean> responseBeans = companyDocumentService.uploadFileForCompany(request,files, companyId, documentCategoryId ,companyDocumentSourceTypeEnum,expirationDate);
List<CompanyDocumentResponseBean> responseBeans = companyDocumentService.uploadFileForCompany(request,files, companyId, documentCategoryId ,companyDocumentSourceTypeEnum,expirationDate,name);
return ResponseEntity.status(HttpStatus.CREATED)
.body(new Response<List<CompanyDocumentResponseBean>>(responseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.FILES_UPLOADED_MSG)));
} catch (CustomValidationException ex) {

View File

@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.web.rest.api.impl;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
import lombok.extern.log4j.Log4j2;
import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
@@ -20,8 +21,11 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("${openapi.gepafin.base-path:/v1/documentCategory}")
@Log4j2
public class DocumentCategoryApiController implements DocumentCategoryApi {
@Autowired
@@ -79,4 +83,18 @@ public class DocumentCategoryApiController implements DocumentCategoryApi {
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(categoryResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.DOCUMENT_CATEGORY_UPDATE_SUCCESS)));
}
@Override
public ResponseEntity<Response<List<DocumentCategoryResponse>>> getAllDocumentCategory(HttpServletRequest request) {
log.info("Get All Document Category");
/** This code is responsible for creating user action logs for the "get all document category" operation. **/
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
.actionContext(UserActionContextEnum.GET_ALL_DOCUMENT_CATEGORY).build());
List<DocumentCategoryResponse> documentCategoryResponseList = categoryService.getAllDocumentCategory(request);
return ResponseEntity.status(HttpStatus.CREATED)
.body(new Response<>(documentCategoryResponseList, Status.SUCCESS, Translator.toLocale(GepafinConstant.DOCUMENT_CATEGORY_GET_SUCCESS)));
}
}

View File

@@ -2537,4 +2537,13 @@
path="db/dump/updated_hub_data_for_email_service_config_25-02-2025.sql"/>
</changeSet>
<changeSet id="27-02-2025_RK_270225" author="Rajesh Khore">
<addColumn tableName="company_document">
<column name="name" type="VARCHAR(255)">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>