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

This commit is contained in:
rajesh
2025-02-27 19:20:29 +05:30
30 changed files with 412 additions and 21 deletions

View File

@@ -465,10 +465,26 @@ 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";
public static final String INSUFFICIENT_SCORE_MESSAGE ="insufficient.score.msg";
public static final String PEC_SERVICE_URL="https://ws.pecmassiva.com";
public static final String PEC_SERVICE_SEND_MAIL="/send";
public static final String PEC_SERVICE_INBOX_MAIL="/quota/inbox";
public static final String USAGE="usage";
public static final String LIMIT="limit";
public static final String DATA="data";
}

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.Root;
import jakarta.persistence.criteria.*;
import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.entities.*;
@@ -43,19 +44,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;
@@ -65,6 +68,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 {
@@ -1492,7 +1496,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();
@@ -1503,7 +1507,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
@@ -1558,11 +1562,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();
@@ -1631,6 +1639,8 @@ public class ApplicationDao {
LocalDateTime pastDate = today.minusDays(daysRange);
predicates.add(criteriaBuilder.between(root.get(GepafinConstant.CREATED_DATE), pastDate, today));
}
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()));
@@ -1638,6 +1648,95 @@ public class ApplicationDao {
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

@@ -571,7 +571,7 @@ public class CallDao {
}
}
public CallResponse updateCallStep1(CallEntity callEntity, UpdateCallRequestStep1 updateCallRequest, UserEntity userEntity) {
public CallResponse updateCallStep1(HttpServletRequest request,CallEntity callEntity, UpdateCallRequestStep1 updateCallRequest, UserEntity userEntity) {
CallEntity oldCallEntity = Utils.getClonedEntityForData(callEntity);
isValidDateRange(updateCallRequest, callEntity);
setIfUpdated(callEntity::getName, callEntity::setName, updateCallRequest.getName());
@@ -580,15 +580,41 @@ public class CallDao {
setIfUpdated(callEntity::getDescriptionLong, callEntity::setDescriptionLong,
updateCallRequest.getDescriptionLong());
List<LocalDateTime> dates=updateCallRequest.getDates();
boolean isEndDateUpdated = false;
boolean isEndTimeUpdated = false;
if (dates != null && dates.size()>1) {
if (dates.size() > 0) {
setIfUpdated(callEntity::getStartDate, callEntity::setStartDate, dates.get(0));
}
if (dates.size() > 1) {
LocalDate requestEndDate = dates.get(1).toLocalDate(); // Extract only the date
LocalDate storedEndDate = callEntity.getEndDate().toLocalDate(); // Extract only the date
if (!requestEndDate.equals(storedEndDate)) { // Check if dates are different
setIfUpdated(callEntity::getEndDate, callEntity::setEndDate, dates.get(1));
isEndDateUpdated = true;
}
}
}
if (updateCallRequest.getEndTime() != null) {
LocalTime requestEndTime = DateTimeUtil.parseTime(updateCallRequest.getEndTime());
LocalTime storedEndTime = callEntity.getEndTime();
if (!requestEndTime.equals(storedEndTime)) {
setIfUpdated(callEntity::getEndTime, callEntity::setEndTime, DateTimeUtil.parseTime(updateCallRequest.getEndTime()));
isEndTimeUpdated = true;
}
}
if (isEndDateUpdated || isEndTimeUpdated) {
loggingUtil.logUserAction(UserActionRequest.builder()
.request(request)
.actionType(UserActionLogsEnum.UPDATE)
.actionContext(UserActionContextEnum.UPDATE_CALL_END_DATE_AND_TIME)
.build());
}
// setIfUpdated(callEntity::getStartDate, callEntity::setStartDate, updateCallRequest.getStartDate());
// setIfUpdated(callEntity::getEndDate, callEntity::setEndDate, updateCallRequest.getEndDate());
setIfUpdated(callEntity::getAmount, callEntity::setAmount, updateCallRequest.getAmount());
@@ -606,7 +632,6 @@ public class CallDao {
setIfUpdated(callEntity::getEmail, callEntity::setEmail, updateCallRequest.getEmail());
setIfUpdated(callEntity::getPhoneNumber, callEntity::setPhoneNumber, updateCallRequest.getPhoneNumber());
setIfUpdated(callEntity::getStartTime, callEntity::setStartTime, DateTimeUtil.parseTime(updateCallRequest.getStartTime()));
setIfUpdated(callEntity::getEndTime, callEntity::setEndTime, DateTimeUtil.parseTime(updateCallRequest.getEndTime()));
setIfUpdated(callEntity::getConfidi, callEntity::setConfidi, updateCallRequest.getConfidi());
setIfUpdated(callEntity::getEvaluationVersion, callEntity::setEvaluationVersion, updateCallRequest.getEvaluationVersion().getValue());
setIfUpdated(callEntity::getNumberOfCheck, callEntity::setNumberOfCheck, updateCallRequest.getNumberOfCheck());

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,5 +1,6 @@
package net.gepafin.tendermanagement.dao;
import com.amazonaws.services.dynamodbv2.xspec.S;
import jakarta.servlet.http.HttpServletRequest;
import net.gepafin.tendermanagement.config.Translator;
import net.gepafin.tendermanagement.constants.GepafinConstant;
@@ -16,6 +17,7 @@ import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationExceptio
import net.gepafin.tendermanagement.web.rest.api.errors.ForbiddenAccessException;
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
@@ -62,14 +64,36 @@ public class DashboardDao {
@Autowired
private Validator validator;
@Autowired
private PecDao pecDao;
@Value("${default.hub.uuid}")
private String defaultHubUuid;
public SuperAdminWidgetResponseBean getDashboardWidget(UserEntity requestedUserEntity) {
SuperAdminWidgetResponseBean widgetResponseBean = new SuperAdminWidgetResponseBean();
widgetResponseBean.setWidget1(createWidget1(requestedUserEntity));
Map<String, Object> widgetBars = getStatistics(requestedUserEntity);
widgetResponseBean.setWidgetBars(widgetBars);
if(requestedUserEntity.getHub().getUniqueUuid().equals(defaultHubUuid)) {
getEmailUsageForGepafin(requestedUserEntity, widgetResponseBean);
}
return widgetResponseBean;
}
private void getEmailUsageForGepafin(UserEntity requestedUserEntity, SuperAdminWidgetResponseBean widgetResponseBean) {
Map<String,Object> emailData=pecDao.getUsageDetails(requestedUserEntity.getHub().getId());
Map<String,Object> data= (Map<String, Object>) emailData.get(GepafinConstant.DATA);
Object usage=data.get(GepafinConstant.USAGE);
Object limit=data.get(GepafinConstant.LIMIT);
if(usage!=null) {
widgetResponseBean.setPecUsage(String.valueOf(usage));
}
if (limit!=null) {
widgetResponseBean.setPecLimit(String.valueOf(limit));
}
}
private Widget1 createWidget1(UserEntity requestedUserEntity) {
Widget1 widget1 = initializeWidget1();

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

@@ -0,0 +1,59 @@
package net.gepafin.tendermanagement.dao;
import feign.FeignException;
import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.model.request.EmailConfig;
import net.gepafin.tendermanagement.service.feignClient.PecFeignService;
import net.gepafin.tendermanagement.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import java.net.URI;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@Component
public class PecDao {
public final Logger log = LoggerFactory.getLogger(PecDao.class);
@Autowired
private PecFeignService pecFeignService;
@Autowired
private EmailNotificationDao emailNotificationDao;
public Map<String, Object> getUsageDetails(Long hubId) {
EmailConfig emailConfig = emailNotificationDao.retrieveEmailConfig(hubId);
Map<String, Object> responseBody = new HashMap<>();
try {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set(GepafinConstant.AUTHORIZATION, "Bearer " + emailConfig.getAuthToken());
headers.set("x-username", emailConfig.getUsername());
headers.set("x-password", emailConfig.getPassword());
headers.add(org.apache.http.HttpHeaders.USER_AGENT, "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0");
URI baseUrl = URI.create(GepafinConstant.PEC_SERVICE_URL+GepafinConstant.PEC_SERVICE_INBOX_MAIL);
ResponseEntity<Object> response = pecFeignService.getUsageDetails(baseUrl,headers);
if (response.getStatusCode() == HttpStatus.OK && response.hasBody()) {
log.info("Successfully fetched usage and limit");
responseBody = (Map<String, Object>) response.getBody();
}
} catch (FeignException ex) {
}
return responseBody;
}
}

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,11 +207,13 @@ 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"),
GET_ALL_USER_ACTION_BY_PAGINATION("GET_ALL_USER_ACTION_BY_PAGINATION"),
GET_ALL_USER_BY_PAGINATION("GET_ALL_USER_BY_PAGINATION");
GET_ALL_USER_BY_PAGINATION("GET_ALL_USER_BY_PAGINATION"),
UPDATE_CALL_END_DATE_AND_TIME("UPDATE_CALL_END_DATE_AND_TIME");
private final String value;

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

@@ -1,5 +1,6 @@
package net.gepafin.tendermanagement.model.response;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import net.gepafin.tendermanagement.entities.UserActionEntity;
import org.springframework.data.domain.Page;
@@ -12,6 +13,12 @@ public class SuperAdminWidgetResponseBean {
private Widget1 widget1;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String pecUsage;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String pecLimit;
private Map<String, Object> widgetBars;
}

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

@@ -0,0 +1,19 @@
package net.gepafin.tendermanagement.service.feignClient;
import net.gepafin.tendermanagement.constants.GepafinConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import java.net.URI;
@FeignClient(value = "pec-service" ,url = GepafinConstant.PEC_SERVICE_URL)
public interface PecFeignService {
@GetMapping(GepafinConstant.PEC_SERVICE_INBOX_MAIL)
ResponseEntity<Object> getUsageDetails(URI uri,@RequestHeader HttpHeaders headers
);
}

View File

@@ -50,7 +50,7 @@ public class CallServiceImpl implements CallService {
UpdateCallRequestStep1 updateCallRequest) {
UserEntity user = validator.validateUser(request);
CallEntity call = validator.validateUserWithCall(user, callId);
return callDao.updateCallStep1(call, updateCallRequest, user);
return callDao.updateCallStep1(request,call, updateCallRequest, user);
}
@Override
@Transactional(readOnly = true)

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

@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.service.impl;
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import lombok.extern.slf4j.Slf4j;
import net.gepafin.tendermanagement.constants.GepafinConstant;
import net.gepafin.tendermanagement.dao.EmailLogDao;
import net.gepafin.tendermanagement.entities.EmailLogEntity;
import net.gepafin.tendermanagement.enums.EmailServiceTypeEnum;
@@ -13,6 +14,7 @@ import net.gepafin.tendermanagement.model.request.PecEmailRequest;
import net.gepafin.tendermanagement.util.Utils;
import net.gepafin.tendermanagement.util.Validator;
import org.opensaml.xmlsec.signature.G;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -49,7 +51,7 @@ public class PecEmailService implements EmailService {
emailRequest.setUsername(emailConfig.getUsername());
emailRequest.setPassword(emailConfig.getPassword());
emailRequest.setRecipient(recipientEmails);
String url=emailConfig.getUrl();
String url=emailConfig.getUrl()+ GepafinConstant.PEC_SERVICE_SEND_MAIL;
String authToken = emailConfig.getAuthToken();
HttpResponse<String> response2=null;
if (Boolean.FALSE.equals(validator.isTestProfileActivated())) {

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

@@ -35,7 +35,7 @@ public interface DashboardApi {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@GetMapping(value = "",
produces = { "application/json" })
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')")
ResponseEntity<Response<SuperAdminWidgetResponseBean>> getDashboardWidgetForSuperAdmin(HttpServletRequest request);
@Operation(summary = "Api to get dashboard widget for beneficiary",

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,18 @@
path="db/dump/updated_system_email_template_email_scenario_27_02_2025.sql"/>
</changeSet>
<changeSet id="26-02-2025_NK_180530" author="Nisha Kashyap">
<sqlFile dbms="postgresql"
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>

View File

@@ -0,0 +1,4 @@
UPDATE hub
SET email_service_type = 'PEC_SERVICE',
email_service_config = 'JkFbBfuVvq7VWwp5LcWIi+hAa1RJ1ekI0jq3w7gLTXETZiTaN8zC4OBWD53x8FtbfFTh3L/5805CIYTH1BQGa3X9q16q9SDzMy7DKHdmJzOnLKhn74C5akoXKaeXUCGnzp0cSk2c01FV6lwefC29IshijFSumCHtVlgWNeZigBzmWK+M7NS+EXf4goIMzguL5bHpYXfoQunQozeY1SpOoxf4XZfd/MNPeVOA/ZNHDGU='
WHERE UNIQUE_UUID = 'p4lk3bcx1RStqTaIVVbXs';