Merge pull request #241 from Kitzanos/feature/GEPAFINBE-76
GEPAFINBE-76 ( Confidi Users )
This commit is contained in:
@@ -485,12 +485,11 @@ public class GepafinConstant {
|
||||
public static final String USAGE="usage";
|
||||
public static final String LIMIT="limit";
|
||||
public static final String DATA="data";
|
||||
|
||||
public static final String FILE_SELECT = "fileselect";
|
||||
public static final String INVALID_LIMIT = "error.invalid.limit";
|
||||
public static final String PREFERRED_CALL_ID="preferredCallId";
|
||||
|
||||
public static final String REGION_ID="regionId";
|
||||
public static final String DELEGATION_TEMPLATE_CONFIDI="DELEGATION_TEMPLATE_CONFIDI";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -682,7 +682,7 @@ public class ApplicationAmendmentRequestDao {
|
||||
log.info("Updating application amendement with ID: {}", id);
|
||||
ApplicationAmendmentRequestEntity existingApplicationAmendment = validateApplicationAmendmentRequest(id);
|
||||
Boolean isBeneficiary=false;
|
||||
if (Boolean.FALSE.equals(validator.checkIsBeneficiary())) {
|
||||
if (Boolean.FALSE.equals(validator.checkIsBeneficiary()) && Boolean.FALSE.equals(validator.checkIsConfidi()) ) {
|
||||
validator.validatePreInstructor(request, existingApplicationAmendment.getApplicationEvaluationEntity().getUserId());
|
||||
isBeneficiary=false;
|
||||
} else {
|
||||
@@ -1372,10 +1372,10 @@ public class ApplicationAmendmentRequestDao {
|
||||
.toList();
|
||||
predicates.add(root.get(GepafinConstant.STATUS).in(statusValues));
|
||||
}
|
||||
if(Boolean.TRUE.equals(validator.checkIsBeneficiary())) {
|
||||
if(Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
|
||||
predicates.add(root.get("applicationEvaluationEntity").get("assignedApplicationsEntity").get("application").get("userId").in(userId));
|
||||
}
|
||||
if (Boolean.FALSE.equals(validator.checkIsBeneficiary())) {
|
||||
else {
|
||||
predicates.add(root.get("applicationEvaluationEntity").get("assignedApplicationsEntity").get("userId").in(userId));
|
||||
}
|
||||
|
||||
|
||||
@@ -389,7 +389,7 @@ public class ApplicationDao {
|
||||
return (root, query, builder) -> {
|
||||
Boolean isBeneficiary = validator.checkIsBeneficiary();
|
||||
Predicate predicate = builder.isFalse(root.get("isDeleted"));
|
||||
if (isBeneficiary) {
|
||||
if (Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
|
||||
predicate = builder.and(predicate, builder.equal(root.get("userId"), userEntity.getId()));
|
||||
}
|
||||
if (callId != null) {
|
||||
@@ -742,7 +742,7 @@ public class ApplicationDao {
|
||||
List<FormApplicationResponse> formApplicationResponses = new ArrayList<>();
|
||||
List<FormEntity> formEntities = new ArrayList<>();
|
||||
UserEntity userEntity = validator.validateUser(request);
|
||||
boolean isBeneficiary = isBeneficiary(userEntity);
|
||||
boolean isBeneficiary = Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi());
|
||||
ApplicationEntity applicationEntity = isBeneficiary
|
||||
? applicationRepository.findByIdAndUserIdAndIsDeletedFalse(applicationId, userEntity.getId())
|
||||
.orElseThrow(() -> new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_NOT_FOUND_MSG)))
|
||||
@@ -1530,8 +1530,8 @@ public class ApplicationDao {
|
||||
}
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
|
||||
Boolean isBeneficiary = validator.checkIsBeneficiary();
|
||||
if (isBeneficiary) {
|
||||
// Boolean isBeneficiary = validator.checkIsBeneficiary();
|
||||
if (Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
|
||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.USER_ID), userEntity.getId()));
|
||||
}
|
||||
if (year != null && year > 0) {
|
||||
|
||||
@@ -785,17 +785,20 @@ public class CallDao {
|
||||
return createCallResponseBean;
|
||||
}
|
||||
|
||||
public List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request,UserEntity user, Long companyId,Boolean onlyPreferredCall) {
|
||||
public List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request,UserEntity user, Long companyId,Boolean onlyPreferredCall,Boolean onlyConfidiCall) {
|
||||
String type = user.getRoleEntity().getRoleType();
|
||||
List<String> callStatusList = CallStatusEnum.getStatusValues();
|
||||
if (Boolean.FALSE.equals(ROLE_SUPER_ADMIN.getValue().equals(type))) {
|
||||
callStatusList = List.of(CallStatusEnum.PUBLISH.getValue());
|
||||
}
|
||||
List<CallEntity> calls;
|
||||
// List<CallEntity> calls = List.of();
|
||||
if (Boolean.TRUE.equals(onlyPreferredCall) && companyId == null) {
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||
Translator.toLocale(GepafinConstant.COMPANY_ID_REQUIRED_FOR_PREFERRED_CALL));
|
||||
}
|
||||
Specification<CallEntity> spec = buildCallSpecification(request, user, companyId, onlyPreferredCall, onlyConfidiCall, callStatusList);
|
||||
|
||||
List<CallEntity> calls = callRepository.findAll(spec);
|
||||
|
||||
if (Boolean.TRUE.equals(onlyPreferredCall)) {
|
||||
validator.validateUserWithCompany(request, companyId);
|
||||
@@ -853,7 +856,7 @@ public class CallDao {
|
||||
public Map<String, BeneficiaryPreferredCallEntity> getBeneficiaryPreferredCallsForUser(HttpServletRequest request, UserEntity user, List<Long> callIds, Long companyId) {
|
||||
List<BeneficiaryPreferredCallEntity> beneficiaryPreferredCalls;
|
||||
|
||||
if (companyId != null && Boolean.TRUE.equals(validator.checkIsBeneficiary())) {
|
||||
if (companyId != null && (Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi()))) {
|
||||
validator.validateUserWithCompany(request, companyId);
|
||||
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(user.getId(),companyId);
|
||||
beneficiaryPreferredCalls = beneficiaryPreferredCallRepository
|
||||
@@ -1022,7 +1025,10 @@ public class CallDao {
|
||||
|
||||
// Add preferredCallIds filtering to the specification
|
||||
spec = spec.and((root, query, criteriaBuilder) ->
|
||||
root.get(GepafinConstant.ID).in(preferredCallIds)
|
||||
criteriaBuilder.and(
|
||||
root.get(GepafinConstant.ID).in(preferredCallIds),
|
||||
criteriaBuilder.isTrue(root.get("confidi"))
|
||||
)
|
||||
);
|
||||
}
|
||||
entityPage = callRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
||||
@@ -1138,6 +1144,28 @@ public class CallDao {
|
||||
predicates.add(root.get(GepafinConstant.STATUS).in(statusValues));
|
||||
}
|
||||
applyFilters(root, criteriaBuilder, predicates, filters);
|
||||
Boolean isConfidi = callPageableRequestBean.getConfidi();
|
||||
|
||||
if (validator.checkIsConfidi()) {
|
||||
|
||||
if (isConfidi == null || isConfidi.equals(Boolean.FALSE)) {
|
||||
// Ensure no records are returned
|
||||
return List.of(criteriaBuilder.disjunction());
|
||||
}
|
||||
|
||||
if (isConfidi.equals(Boolean.TRUE)) {
|
||||
predicates.add(criteriaBuilder.isTrue(root.get("confidi")));
|
||||
}
|
||||
}
|
||||
else if( Boolean.FALSE.equals(validator.checkIsConfidi()) && isConfidi!=null){
|
||||
if (isConfidi.equals(Boolean.TRUE)) {
|
||||
predicates.add(criteriaBuilder.isTrue(root.get("confidi")));
|
||||
}
|
||||
if (isConfidi.equals(Boolean.FALSE)) {
|
||||
predicates.add(criteriaBuilder.isFalse(root.get("confidi")));
|
||||
}
|
||||
}
|
||||
|
||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.HUB).get(GepafinConstant.ID), userEntity.getHub().getId()));
|
||||
|
||||
return predicates;
|
||||
@@ -1327,4 +1355,45 @@ public class CallDao {
|
||||
createCallResponseBean.setCurrentStep(GepafinConstant.EVALUATION_V2_STEP_2);
|
||||
return createCallResponseBean;
|
||||
}
|
||||
private Specification<CallEntity> buildCallSpecification(HttpServletRequest request, UserEntity user, Long companyId, Boolean onlyPreferredCall, Boolean onlyConfidiCall, List<String> callStatusList) {
|
||||
return (root, query, criteriaBuilder) -> {
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
predicates.add(root.get("status").in(callStatusList));
|
||||
|
||||
if (Boolean.TRUE.equals(onlyPreferredCall)) {
|
||||
validator.validateUserWithCompany(request, companyId);
|
||||
UserWithCompanyEntity userWithCompanyEntity = companyService.getUserWithCompany(user.getId(), companyId);
|
||||
List<BeneficiaryPreferredCallEntity> preferredCalls = beneficiaryPreferredCallRepository
|
||||
.findByUserIdAndUserWithCompanyIdAndIsDeletedFalse(user.getId(), userWithCompanyEntity.getId());
|
||||
List<Long> preferredCallIds = preferredCalls.stream()
|
||||
.map(BeneficiaryPreferredCallEntity::getCallId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
predicates.add(root.get("id").in(preferredCallIds));
|
||||
} else {
|
||||
predicates.add(criteriaBuilder.equal(root.get("hub").get("id"), user.getHub().getId()));
|
||||
}
|
||||
|
||||
if (validator.checkIsConfidi()) {
|
||||
if (onlyConfidiCall==null || Boolean.FALSE.equals(onlyConfidiCall)) {
|
||||
return criteriaBuilder.conjunction();
|
||||
}
|
||||
|
||||
if (onlyConfidiCall!=null && Boolean.TRUE.equals(onlyConfidiCall)) {
|
||||
predicates.add(criteriaBuilder.isTrue(root.get("confidi")));
|
||||
}
|
||||
}else {
|
||||
if(onlyConfidiCall!=null) {
|
||||
if (Boolean.TRUE.equals(onlyConfidiCall)) {
|
||||
predicates.add(criteriaBuilder.isTrue(root.get("confidi")));
|
||||
}
|
||||
if (Boolean.FALSE.equals(onlyConfidiCall)) {
|
||||
predicates.add(criteriaBuilder.isFalse(root.get("confidi")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class CommunicationDao {
|
||||
if(validator.checkIsPreInstructor()){
|
||||
communicationEntity.setSenderUserId(amendmentRequest.getApplicationEvaluationEntity().getUserId());
|
||||
communicationEntity.setReceiverUserId(amendmentRequest.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId());
|
||||
} else if(validator.checkIsBeneficiary()) {
|
||||
} else if(Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
|
||||
communicationEntity.setSenderUserId(amendmentRequest.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId());
|
||||
communicationEntity.setReceiverUserId(amendmentRequest.getApplicationEvaluationEntity().getUserId());
|
||||
}
|
||||
|
||||
@@ -136,8 +136,8 @@ public class DashboardDao {
|
||||
}
|
||||
|
||||
private void setRegisteredUsers(Widget1 widget1, UserEntity requestedUserEntity) {
|
||||
Long activeUsers = userRepository.countByStatusAndRoleEntityRoleTypeAndHubId(UserStatusEnum.ACTIVE.getValue(),
|
||||
RoleStatusEnum.ROLE_BENEFICIARY.getValue(), requestedUserEntity.getHub().getId());
|
||||
Long activeUsers = userRepository.countByStatusAndRoleEntityRoleTypeInAndHubId(UserStatusEnum.ACTIVE.getValue(),
|
||||
List.of(RoleStatusEnum.ROLE_BENEFICIARY.getValue(),RoleStatusEnum.ROLE_CONFIDI.getValue()), requestedUserEntity.getHub().getId());
|
||||
if (activeUsers != null) {
|
||||
widget1.setNumberOfResgisteredUsers(activeUsers);
|
||||
}
|
||||
@@ -183,10 +183,21 @@ public class DashboardDao {
|
||||
.map(BeneficiaryPreferredCallEntity::getCallId)
|
||||
.collect(Collectors.toList());
|
||||
List<CallEntity> callEntities = callRepository.findByIdIn(callIds);
|
||||
long activeCallsCount = callEntities.stream()
|
||||
.filter(call -> CallStatusEnum.PUBLISH.getValue().equals(call.getStatus())
|
||||
&& userEntity.getHub().getId().equals(call.getHub().getId()))
|
||||
.count();
|
||||
long activeCallsCount=0;
|
||||
if(Boolean.TRUE.equals(validator.checkIsBeneficiary())) {
|
||||
activeCallsCount = callEntities.stream()
|
||||
.filter(call -> CallStatusEnum.PUBLISH.getValue().equals(call.getStatus())
|
||||
&& userEntity.getHub().getId().equals(call.getHub().getId()))
|
||||
.count();
|
||||
}
|
||||
if(Boolean.TRUE.equals(validator.checkIsConfidi())) {
|
||||
activeCallsCount = callEntities.stream()
|
||||
.filter(call -> CallStatusEnum.PUBLISH.getValue().equals(call.getStatus())
|
||||
&& userEntity.getHub().getId().equals(call.getHub().getId())
|
||||
&& call.getConfidi()) // Add this condition for confidi
|
||||
.count();
|
||||
|
||||
}
|
||||
|
||||
beneficiaryWidgetResponseBean.setNumberOfCalls(activeCallsCount);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,12 @@ public class DelegationDao {
|
||||
CompanyEntity companyEntity = companyDao.validateCompany(companyId);
|
||||
companyDao.getUserWithCompany(userEntity.getId(), companyId);
|
||||
updatePlaceholdersForDelegation(user, companyEntity, placeholders, companyDelegationRequest);
|
||||
DocumentEntity documentEntity = documentRepository.findBySource(GepafinConstant.DELEGATION_TEMPLATE).get(0);
|
||||
DocumentEntity documentEntity =null;
|
||||
if(Boolean.TRUE.equals(validator.checkIsConfidi())){
|
||||
documentEntity = documentRepository.findBySource(GepafinConstant.DELEGATION_TEMPLATE_CONFIDI).get(0);
|
||||
}else {
|
||||
documentEntity = documentRepository.findBySource(GepafinConstant.DELEGATION_TEMPLATE).get(0);
|
||||
}
|
||||
return generateDocument(placeholders, documentEntity.getFilePath());
|
||||
}
|
||||
|
||||
@@ -293,7 +298,7 @@ public class DelegationDao {
|
||||
if (validator.checkIsPreInstructor()) {
|
||||
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluationByApplicationId(applicationId);
|
||||
validator.validatePreInstructor(request, applicationEvaluationEntity.getUserId());
|
||||
} else if (validator.checkIsBeneficiary()) {
|
||||
} else if (Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
|
||||
userId = validator.validateUser(request).getId();
|
||||
}
|
||||
return companyService.getUserWithCompany(userId, companyId);
|
||||
|
||||
@@ -66,7 +66,7 @@ public class FaqDao {
|
||||
CallEntity callEntity = callService.validateCall(callId);
|
||||
FaqEntity entity = createOrUpdateFaqEntity(faqRequest, callEntity, userEntity, LookUpDataTypeEnum.FAQ);
|
||||
FaqEntity oldFaqEntity = Utils.getClonedEntityForData(entity);
|
||||
if (validator.checkIsBeneficiary() && companyId == null) {
|
||||
if ((Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) && companyId == null) {
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.COMPANY_ID_MANDATORY));
|
||||
}
|
||||
UserWithCompanyEntity userWithCompanyEntity=null;
|
||||
@@ -132,7 +132,7 @@ public class FaqDao {
|
||||
oldFaqEntity = Utils.getClonedEntityForData(faqEntity);
|
||||
actionType = VersionActionTypeEnum.UPDATE;
|
||||
} else {
|
||||
if (Boolean.FALSE.equals(userEntity.getRoleEntity().getRoleType().equals(RoleStatusEnum.ROLE_BENEFICIARY.getValue()))) {
|
||||
if (Boolean.FALSE.equals(userEntity.getRoleEntity().getRoleType().equals(RoleStatusEnum.ROLE_BENEFICIARY.getValue())) && Boolean.FALSE.equals(userEntity.getRoleEntity().getRoleType().equals(RoleStatusEnum.ROLE_CONFIDI.getValue()))) {
|
||||
lookUpDataService.getOrCreateLookUpDataEntity(faqReq, type);
|
||||
}
|
||||
faqEntity = new FaqEntity();
|
||||
|
||||
@@ -169,7 +169,7 @@ public class UserDao {
|
||||
}
|
||||
private BeneficiaryEntity createBeneficiary(RoleEntity roleEntity, UserReq userReq, HubEntity hub) {
|
||||
BeneficiaryEntity beneficiaryEntity = null;
|
||||
if (RoleStatusEnum.ROLE_BENEFICIARY.getValue().equals(roleEntity.getRoleType())) {
|
||||
if (RoleStatusEnum.ROLE_BENEFICIARY.getValue().equals(roleEntity.getRoleType()) || RoleStatusEnum.ROLE_CONFIDI.getValue().equals(roleEntity.getRoleType())) {
|
||||
beneficiaryEntity = new BeneficiaryEntity();
|
||||
beneficiaryEntity.setAddress(userReq.getAddress());
|
||||
beneficiaryEntity.setCity(userReq.getCity());
|
||||
@@ -765,7 +765,7 @@ public class UserDao {
|
||||
HubEntity hubEntity = hubService.valdateHub(userEntity.getHub().getId());
|
||||
String beneficiaryRoleType = RoleStatusEnum.ROLE_BENEFICIARY.getValue();
|
||||
|
||||
if (validator.checkIsBeneficiary()) {
|
||||
if (Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())) {
|
||||
// Validate if the new email already exists for another beneficiary in the same hub
|
||||
boolean emailExistsForBeneficiary = userRepository.existsByEmailIgnoreCaseForBeneficiaries(
|
||||
userReq.getEmail(), hubEntity.getUniqueUuid(), beneficiaryRoleType);
|
||||
|
||||
@@ -14,4 +14,6 @@ public class CallPageableRequestBean {
|
||||
private List<CallStatusEnum> status;
|
||||
|
||||
private Map<String, FilterCriteria> filters;
|
||||
|
||||
private Boolean confidi;
|
||||
}
|
||||
|
||||
@@ -54,4 +54,9 @@ public interface CallRepository extends JpaRepository<CallEntity, Long>, JpaSpec
|
||||
|
||||
List<CallEntity> findByIdIn(@Param("ids") List<Long> ids);
|
||||
|
||||
@Query("SELECT c FROM CallEntity c WHERE c.id IN :ids AND c.status IN :status AND c.confidi= :confidi")
|
||||
List<CallEntity> findByIdInAndStatusInAndConfidi(@Param("ids") List<Long> ids, @Param("status") List<String> status,Boolean confidi);
|
||||
|
||||
public List<CallEntity> findByStatusInAndHubIdAndConfidi(List<String> callStatus, Long hubId,Boolean onlyConfidiCall);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
@@ -32,6 +33,10 @@ public interface UserRepository extends JpaRepository<UserEntity, Long>, JpaSpec
|
||||
|
||||
Long countByStatusAndRoleEntityRoleTypeAndHubId(String status, String roleName, Long hubId);
|
||||
|
||||
|
||||
Long countByStatusAndRoleEntityRoleTypeInAndHubId(String status,List<String> roleName, Long hubId);
|
||||
|
||||
|
||||
Optional<UserEntity> findByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
||||
|
||||
// Boolean existsByBeneficiaryCodiceFiscaleAndHubId(String codiceFiscale, Long hubId);
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface CallService {
|
||||
|
||||
CallResponse getCallById (HttpServletRequest request, Long callId,Long companyId);
|
||||
|
||||
List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request,Long companyId,Boolean onlyPreferredCall);
|
||||
List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request,Long companyId,Boolean onlyPreferredCall,Boolean onlyConfidiCall);
|
||||
|
||||
CallResponse validateCallData(HttpServletRequest request, Long callId);
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ApplicationServiceImpl implements ApplicationService {
|
||||
validator.validateUserWithCompany(request, companyId);
|
||||
}
|
||||
ApplicationEntity applicationEntity =null;
|
||||
if(validator.checkIsBeneficiary()){
|
||||
if(Boolean.TRUE.equals(validator.checkIsBeneficiary()) || Boolean.TRUE.equals(validator.checkIsConfidi())){
|
||||
if(companyId==null){
|
||||
throw new ForbiddenAccessException(Status.FORBIDDEN,Translator.toLocale(GepafinConstant.COMPANY_ID_MANDATORY));
|
||||
}
|
||||
|
||||
@@ -62,9 +62,9 @@ public class CallServiceImpl implements CallService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request,Long companyId,Boolean onlyPreferredCall) {
|
||||
public List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request,Long companyId,Boolean onlyPreferredCall,Boolean onlyConfidiCall) {
|
||||
UserEntity user = validator.validateUser(request);
|
||||
return callDao.getAllCalls(request,user,companyId,onlyPreferredCall);
|
||||
return callDao.getAllCalls(request,user,companyId,onlyPreferredCall,onlyConfidiCall);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class CommunicationServiceImpl implements CommunicationService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CommunicationResponseBean addCommentToAmendmentRequest(HttpServletRequest request ,CommunicationRequestBean communicationRequestBean, Long amendmentId) {
|
||||
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = applicationAmendmentRequestDao.validateApplicationAmendmentRequest(amendmentId);
|
||||
if (Boolean.FALSE.equals(validator.checkIsBeneficiary())) {
|
||||
if (Boolean.FALSE.equals(validator.checkIsBeneficiary()) && Boolean.FALSE.equals(validator.checkIsConfidi())) {
|
||||
validator.validatePreInstructor(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getUserId());
|
||||
} else {
|
||||
validator.validateUserId(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId());
|
||||
@@ -43,7 +43,7 @@ public class CommunicationServiceImpl implements CommunicationService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String deleteComment(HttpServletRequest request ,Long amendmentId, Long commentId) {
|
||||
ApplicationAmendmentRequestEntity applicationAmendmentRequestEntity = applicationAmendmentRequestDao.validateApplicationAmendmentRequest(amendmentId);
|
||||
if (Boolean.FALSE.equals(validator.checkIsBeneficiary())) {
|
||||
if (Boolean.FALSE.equals(validator.checkIsBeneficiary()) && Boolean.FALSE.equals(validator.checkIsConfidi())) {
|
||||
validator.validatePreInstructor(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getUserId());
|
||||
} else {
|
||||
validator.validateUserId(request, applicationAmendmentRequestEntity.getApplicationEvaluationEntity().getAssignedApplicationsEntity().getApplication().getUserId());
|
||||
|
||||
@@ -195,4 +195,15 @@ public class Validator {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public Boolean checkIsConfidi() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication != null && authentication.isAuthenticated()) {
|
||||
for (GrantedAuthority authority : authentication.getAuthorities()) {
|
||||
if (RoleStatusEnum.ROLE_CONFIDI.getValue().equals(authority.getAuthority())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public interface CallApi {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls(HttpServletRequest request,@RequestParam(value = "companyId", required = false) Long companyId , @RequestParam(value = "onlyPreferredCall", required = false, defaultValue = "false") Boolean onlyPreferredCall);
|
||||
ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls(HttpServletRequest request,@RequestParam(value = "companyId", required = false) Long companyId , @RequestParam(value = "onlyPreferredCall", required = false, defaultValue = "false") Boolean onlyPreferredCall,@RequestParam(value = "onlyConfidiCall", required = false) Boolean onlyConfidiCall);
|
||||
|
||||
|
||||
@Operation(summary = "Api to validate call",
|
||||
|
||||
@@ -33,7 +33,7 @@ public interface CommunicationApi {
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@PostMapping(value = "/{amendmentId}", produces = { "application/json" })
|
||||
@PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_INSTRUCTOR_MANAGER')")
|
||||
@PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_INSTRUCTOR_MANAGER') || hasRole('ROLE_CONFIDI')")
|
||||
ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request,
|
||||
@RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @PathVariable(value = "amendmentId") Long amendmentId);
|
||||
|
||||
@@ -55,7 +55,7 @@ public interface CommunicationApi {
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@PutMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" })
|
||||
@PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_INSTRUCTOR_MANAGER')")
|
||||
@PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_INSTRUCTOR_MANAGER') || hasRole('ROLE_CONFIDI')")
|
||||
ResponseEntity<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request,
|
||||
@RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @PathVariable(value = "amendmentId") Long amendmentId, @PathVariable(value = "commentId") Long commentId);
|
||||
|
||||
|
||||
@@ -93,13 +93,13 @@ public class CallApiController implements CallApi {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls(HttpServletRequest request,Long companyId,Boolean onlyPreferredCall) {
|
||||
public ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls(HttpServletRequest request,Long companyId,Boolean onlyPreferredCall,Boolean onlyConfidiCall) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "get all Calls" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||
.actionContext(UserActionContextEnum.GET_CALL).build());
|
||||
|
||||
List<CallDetailsResponseBean> calls = callService.getAllCalls(request, companyId, onlyPreferredCall);
|
||||
List<CallDetailsResponseBean> calls = callService.getAllCalls(request, companyId, onlyPreferredCall,onlyConfidiCall);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(calls, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_FETCH_SUCCESS_MSG)));
|
||||
|
||||
|
||||
@@ -2627,5 +2627,13 @@
|
||||
<where>role_type = 'ROLE_CONFIDI'</where>
|
||||
</update>
|
||||
</changeSet>
|
||||
<changeSet id="10-03-2025_NK_180430" author="Nisha Kashyap">
|
||||
<insert tableName="document">
|
||||
<column name="file_name" value="PROCURA_BANDI_TEMPLATE_CONFIDI.DOCX"></column>
|
||||
<column name="file_path" value="https://mementoresources.s3.eu-west-1.amazonaws.com/gepafin/local/template/PROCURA_BANDI_TEMPLATE_CONFIDI.docx"></column>
|
||||
<column name="type" value="DOCUMENT"></column>
|
||||
<column name="source" value="DELEGATION_TEMPLATE_CONFIDI"></column>
|
||||
</insert>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
||||
Reference in New Issue
Block a user