Merge pull request #110 from Kitzanos/feature/GEPAFINBE-104
GEPAFINBE-104 (Added field userWithCompanyId in Application)
This commit is contained in:
@@ -149,6 +149,9 @@ public class ApplicationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EmailLogDao emailLogDao;
|
private EmailLogDao emailLogDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserWithCompanyRepository userWithCompanyRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LoggingUtil loggingUtil;
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
@@ -163,7 +166,7 @@ public class ApplicationDao {
|
|||||||
// callService.validatePublishedCall(formEntity.getCall().getId());
|
// callService.validatePublishedCall(formEntity.getCall().getId());
|
||||||
validateFormFields(applicationRequestBean,formEntity);
|
validateFormFields(applicationRequestBean,formEntity);
|
||||||
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
||||||
validator.validateUserWithCompany(request, applicationEntity.getCompany().getId());
|
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
|
||||||
if(Boolean.FALSE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.DRAFT.getValue()))) {
|
if(Boolean.FALSE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.DRAFT.getValue()))) {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.APPLICATION_NOT_IN_DRAFT_STATUS));
|
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.APPLICATION_NOT_IN_DRAFT_STATUS));
|
||||||
}
|
}
|
||||||
@@ -172,12 +175,10 @@ public class ApplicationDao {
|
|||||||
createOrUpdateMultipleFormFields(applicationRequestBean.getFormFields(), applicationFormEntity, formEntity);
|
createOrUpdateMultipleFormFields(applicationRequestBean.getFormFields(), applicationFormEntity, formEntity);
|
||||||
return getApplicationById(applicationEntity.getId(),formEntity.getId());
|
return getApplicationById(applicationEntity.getId(),formEntity.getId());
|
||||||
}
|
}
|
||||||
|
public void validateDelegation(UserEntity user, UserWithCompanyEntity userWithCompany) {
|
||||||
public void validateDelegation(UserEntity user, CompanyEntity company) {
|
|
||||||
UserWithCompanyEntity userWithCompany = companyService.getUserWithCompanyEntity(user.getId(), company.getId());
|
|
||||||
|
|
||||||
UserCompanyDelegationEntity userCompanyDelegationEntity = userCompanyDelegationRepository
|
UserCompanyDelegationEntity userCompanyDelegationEntity = userCompanyDelegationRepository
|
||||||
.findByUserIdAndCompanyIdAndStatus(user.getId(), company.getId(),
|
.findByUserIdAndUserWithCompanyIdAndStatus(user.getId(), userWithCompany.getId(),
|
||||||
UserCompanyDelegationStatusEnum.ACTIVE.getValue());
|
UserCompanyDelegationStatusEnum.ACTIVE.getValue());
|
||||||
|
|
||||||
if (!userWithCompany.getIsLegalRepresentant() && userCompanyDelegationEntity == null) {
|
if (!userWithCompany.getIsLegalRepresentant() && userCompanyDelegationEntity == null) {
|
||||||
@@ -200,13 +201,14 @@ public class ApplicationDao {
|
|||||||
return applicationFormEntity;
|
return applicationFormEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationEntity createApplicationEntity(UserEntity user, CallEntity call, CompanyEntity companyEntity) {
|
public ApplicationEntity createApplicationEntity(UserEntity user, CallEntity call, UserWithCompanyEntity userWithCompany) {
|
||||||
validateDelegation(user,companyEntity);
|
validateDelegation(user,userWithCompany);
|
||||||
ApplicationEntity entity = new ApplicationEntity();
|
ApplicationEntity entity = new ApplicationEntity();
|
||||||
entity.setUserId(user.getId());
|
entity.setUserId(user.getId());
|
||||||
entity.setCompany(companyEntity);
|
entity.setCompanyId(userWithCompany.getCompanyId());
|
||||||
entity.setCall(call);
|
entity.setCall(call);
|
||||||
entity.setHubId(call.getHub().getId());
|
entity.setHubId(call.getHub().getId());
|
||||||
|
entity.setUserWithCompany(userWithCompany);
|
||||||
entity.setIsDeleted(false);
|
entity.setIsDeleted(false);
|
||||||
entity.setStatus(ApplicationStatusTypeEnum.DRAFT.getValue());
|
entity.setStatus(ApplicationStatusTypeEnum.DRAFT.getValue());
|
||||||
return entity;
|
return entity;
|
||||||
@@ -275,9 +277,11 @@ public class ApplicationDao {
|
|||||||
|
|
||||||
log.info("Deleting application with ID: {}", id);
|
log.info("Deleting application with ID: {}", id);
|
||||||
|
|
||||||
ApplicationEntity applicationEntity = validateApplication(id);
|
ApplicationEntity applicationEntity= validateApplication(id);
|
||||||
|
|
||||||
ApplicationEntity oldApplicationDataEntity = Utils.getClonedEntityForData(applicationEntity);
|
ApplicationEntity oldApplicationDataEntity = Utils.getClonedEntityForData(applicationEntity);
|
||||||
validator.validateUserWithCompany(request, applicationEntity.getCompany().getId());
|
|
||||||
|
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
|
||||||
applicationEntity.setIsDeleted(true);
|
applicationEntity.setIsDeleted(true);
|
||||||
applicationEntity = applicationRepository.save(applicationEntity);
|
applicationEntity = applicationRepository.save(applicationEntity);
|
||||||
|
|
||||||
@@ -348,9 +352,9 @@ public class ApplicationDao {
|
|||||||
if (callId != null) {
|
if (callId != null) {
|
||||||
predicate = builder.and(predicate, builder.equal(root.get("call").get("id"), callId));
|
predicate = builder.and(predicate, builder.equal(root.get("call").get("id"), callId));
|
||||||
}
|
}
|
||||||
if (companyId != null) {
|
if (companyId != null) {
|
||||||
predicate = builder.and(predicate, builder.equal(root.get("company").get("id"), companyId));
|
predicate = builder.and(predicate, builder.equal(root.get("companyId"), companyId));
|
||||||
}
|
}
|
||||||
if (statusList != null && !statusList.isEmpty()) {
|
if (statusList != null && !statusList.isEmpty()) {
|
||||||
List<String> statusNames = statusList.stream()
|
List<String> statusNames = statusList.stream()
|
||||||
.map(Enum::name)
|
.map(Enum::name)
|
||||||
@@ -381,8 +385,9 @@ public class ApplicationDao {
|
|||||||
responseBean.setSubmissionDate(applicationEntity.getSubmissionDate());
|
responseBean.setSubmissionDate(applicationEntity.getSubmissionDate());
|
||||||
responseBean.setStatus(applicationEntity.getStatus());
|
responseBean.setStatus(applicationEntity.getStatus());
|
||||||
responseBean.setComments(applicationEntity.getComments());
|
responseBean.setComments(applicationEntity.getComments());
|
||||||
responseBean.setCompanyId(applicationEntity.getCompany().getId());
|
responseBean.setCompanyId(applicationEntity.getCompanyId());
|
||||||
responseBean.setCompanyName(applicationEntity.getCompany().getCompanyName());
|
CompanyEntity company=companyService.validateCompany(applicationEntity.getCompanyId());
|
||||||
|
responseBean.setCompanyName(company.getCompanyName());
|
||||||
if(applicationEntity.getProtocol() != null) {
|
if(applicationEntity.getProtocol() != null) {
|
||||||
responseBean.setProtocolNumber(applicationEntity.getProtocol().getProtocolNumber());
|
responseBean.setProtocolNumber(applicationEntity.getProtocol().getProtocolNumber());
|
||||||
}
|
}
|
||||||
@@ -750,11 +755,12 @@ public class ApplicationDao {
|
|||||||
applicationGetResponseBean.setSubmissionDate(applicationEntity.getSubmissionDate());
|
applicationGetResponseBean.setSubmissionDate(applicationEntity.getSubmissionDate());
|
||||||
applicationGetResponseBean.setCallId(applicationEntity.getCall().getId());
|
applicationGetResponseBean.setCallId(applicationEntity.getCall().getId());
|
||||||
applicationGetResponseBean.setCallTitle(applicationEntity.getCall().getName());
|
applicationGetResponseBean.setCallTitle(applicationEntity.getCall().getName());
|
||||||
applicationGetResponseBean.setCompanyId(applicationEntity.getCompany().getId());
|
applicationGetResponseBean.setCompanyId(applicationEntity.getCompanyId());
|
||||||
if(applicationEntity.getProtocol() != null) {
|
if(applicationEntity.getProtocol() != null) {
|
||||||
applicationGetResponseBean.setProtocolNumber(applicationEntity.getProtocol().getProtocolNumber());
|
applicationGetResponseBean.setProtocolNumber(applicationEntity.getProtocol().getProtocolNumber());
|
||||||
}
|
}
|
||||||
applicationGetResponseBean.setCompanyName(applicationEntity.getCompany().getCompanyName());
|
CompanyEntity company=companyService.validateCompany(applicationEntity.getCompanyId());
|
||||||
|
applicationGetResponseBean.setCompanyName(company.getCompanyName());
|
||||||
return applicationGetResponseBean;
|
return applicationGetResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,15 +777,17 @@ public class ApplicationDao {
|
|||||||
public ApplicationResponse createApplicationByCallId(CompanyEntity companyEntity,
|
public ApplicationResponse createApplicationByCallId(CompanyEntity companyEntity,
|
||||||
ApplicationRequest applicationRequest, Long callId, UserEntity userEntity) {
|
ApplicationRequest applicationRequest, Long callId, UserEntity userEntity) {
|
||||||
CallEntity call = callService.validateCall(callId);
|
CallEntity call = callService.validateCall(callId);
|
||||||
|
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(userEntity.getId(),companyEntity.getId());
|
||||||
|
|
||||||
// call = callService.validatePublishedCall(call.getId());
|
// call = callService.validatePublishedCall(call.getId());
|
||||||
checkIfApplicationExists(call, companyEntity, userEntity);
|
checkIfApplicationExists(call, userWithCompanyEntity, userEntity);
|
||||||
ApplicationEntity applicationEntity = createApplicationEntity(userEntity, call, companyEntity);
|
ApplicationEntity applicationEntity = createApplicationEntity(userEntity, call, userWithCompanyEntity);
|
||||||
applicationEntity.setComments(applicationRequest.getComments());
|
applicationEntity.setComments(applicationRequest.getComments());
|
||||||
applicationEntity = saveApplicationEntity(applicationEntity);
|
applicationEntity = saveApplicationEntity(applicationEntity);
|
||||||
return getApplicationResponse(applicationEntity);
|
return getApplicationResponse(applicationEntity);
|
||||||
}
|
}
|
||||||
public void checkIfApplicationExists(CallEntity call, CompanyEntity companyEntity, UserEntity userEntity){
|
public void checkIfApplicationExists(CallEntity call, UserWithCompanyEntity userWithCompanyEntity, UserEntity userEntity){
|
||||||
Optional<ApplicationEntity> applicationEntity=applicationRepository.findByUserIdAndCompanyIdAndCallIdAndIsDeletedFalse(userEntity.getId(), companyEntity.getId(),call.getId());
|
Optional<ApplicationEntity> applicationEntity=applicationRepository.findByUserIdAndUserWithCompanyIdAndCallIdAndIsDeletedFalse(userEntity.getId(), userWithCompanyEntity.getId(),call.getId());
|
||||||
if(applicationEntity.isPresent()){
|
if(applicationEntity.isPresent()){
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.APPLICATION_ALREADY_EXISTS));
|
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.APPLICATION_ALREADY_EXISTS));
|
||||||
}
|
}
|
||||||
@@ -793,7 +801,7 @@ public class ApplicationDao {
|
|||||||
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(applicationEntity);
|
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(applicationEntity);
|
||||||
|
|
||||||
UserEntity userEntity = userService.validateUser(applicationEntity.getUserId());
|
UserEntity userEntity = userService.validateUser(applicationEntity.getUserId());
|
||||||
validator.validateUserWithCompany(request, applicationEntity.getCompany().getId());
|
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
|
||||||
if (ApplicationStatusTypeEnum.SUBMIT.getValue().equals(applicationEntity.getStatus())) {
|
if (ApplicationStatusTypeEnum.SUBMIT.getValue().equals(applicationEntity.getStatus())) {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_SUBMITTED_CANNOT_CHANGE));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_SUBMITTED_CANNOT_CHANGE));
|
||||||
}
|
}
|
||||||
@@ -917,7 +925,7 @@ public class ApplicationDao {
|
|||||||
|
|
||||||
private void sendMailToUserAndCompany(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
private void sendMailToUserAndCompany(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
||||||
CallEntity call =applicationEntity.getCall();
|
CallEntity call =applicationEntity.getCall();
|
||||||
CompanyEntity company = applicationEntity.getCompany();
|
CompanyEntity company=companyService.validateCompany(applicationEntity.getCompanyId());
|
||||||
ProtocolEntity protocol = applicationEntity.getProtocol();
|
ProtocolEntity protocol = applicationEntity.getProtocol();
|
||||||
HubEntity hub = hubService.valdateHub(applicationEntity.getHubId());
|
HubEntity hub = hubService.valdateHub(applicationEntity.getHubId());
|
||||||
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService
|
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService
|
||||||
@@ -960,7 +968,7 @@ public class ApplicationDao {
|
|||||||
recipientEmails.add(contactEmail);
|
recipientEmails.add(contactEmail);
|
||||||
}
|
}
|
||||||
if(Boolean.FALSE.equals(recipientEmails.isEmpty())){
|
if(Boolean.FALSE.equals(recipientEmails.isEmpty())){
|
||||||
emailLogRequest.setRecipientId(applicationEntity.getCompany().getId());
|
emailLogRequest.setRecipientId(applicationEntity.getCompanyId());
|
||||||
emailLogRequest.setRecipientType(RecipientTypeEnum.COMPANY);
|
emailLogRequest.setRecipientType(RecipientTypeEnum.COMPANY);
|
||||||
emailLogRequest.setRecipientEmails(companyEmail);
|
emailLogRequest.setRecipientEmails(companyEmail);
|
||||||
}
|
}
|
||||||
@@ -968,7 +976,7 @@ public class ApplicationDao {
|
|||||||
}
|
}
|
||||||
private void sendMailTodefaultSystemAndGepafin(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
private void sendMailTodefaultSystemAndGepafin(UserEntity userEntity, ApplicationEntity applicationEntity) {
|
||||||
CallEntity call = applicationEntity.getCall();
|
CallEntity call = applicationEntity.getCall();
|
||||||
CompanyEntity company = applicationEntity.getCompany();
|
CompanyEntity company=companyService.validateCompany(applicationEntity.getCompanyId());
|
||||||
ProtocolEntity protocol = applicationEntity.getProtocol();
|
ProtocolEntity protocol = applicationEntity.getProtocol();
|
||||||
HubEntity hub = hubService.valdateHub(applicationEntity.getHubId());
|
HubEntity hub = hubService.valdateHub(applicationEntity.getHubId());
|
||||||
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService
|
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService
|
||||||
@@ -1008,14 +1016,13 @@ public class ApplicationDao {
|
|||||||
emailLogRequest.setRecipientEmails(rinaldoEmail);
|
emailLogRequest.setRecipientEmails(rinaldoEmail);
|
||||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(rinaldoEmail),emailLogRequest);
|
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(rinaldoEmail),emailLogRequest);
|
||||||
}
|
}
|
||||||
|
public ApplicationSignedDocumentResponse uploadSignedDocument(HttpServletRequest request, Long applicationId,
|
||||||
|
MultipartFile file) {
|
||||||
|
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
||||||
|
|
||||||
public ApplicationSignedDocumentResponse uploadSignedDocument(HttpServletRequest request, Long applicationId, MultipartFile file) {
|
|
||||||
|
|
||||||
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
|
||||||
//cloned entity for old data
|
//cloned entity for old data
|
||||||
ApplicationEntity oldApplicationData = Utils.getClonedEntityForData(applicationEntity);
|
ApplicationEntity oldApplicationData = Utils.getClonedEntityForData(applicationEntity);
|
||||||
|
|
||||||
validator.validateUserWithCompany(request, applicationEntity.getCompany().getId());
|
|
||||||
validateFileTypeForCall(file, applicationEntity);
|
validateFileTypeForCall(file, applicationEntity);
|
||||||
ApplicationSignedDocumentEntity applicationSignedDocument = applicationSignedDocumentRepository.findByApplicationIdAndStatus(applicationId,
|
ApplicationSignedDocumentEntity applicationSignedDocument = applicationSignedDocumentRepository.findByApplicationIdAndStatus(applicationId,
|
||||||
ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
|
ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
|
||||||
@@ -1103,7 +1110,7 @@ public class ApplicationDao {
|
|||||||
public ApplicationSignedDocumentResponse getSignedDocument(HttpServletRequest request, Long applicationId) {
|
public ApplicationSignedDocumentResponse getSignedDocument(HttpServletRequest request, Long applicationId) {
|
||||||
|
|
||||||
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
||||||
validator.validateUserWithCompany(request, applicationEntity.getCompany().getId());
|
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
|
||||||
|
|
||||||
ApplicationSignedDocumentEntity applicationSignedDocument = applicationSignedDocumentRepository
|
ApplicationSignedDocumentEntity applicationSignedDocument = applicationSignedDocumentRepository
|
||||||
.findByApplicationIdAndStatus(applicationId, ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
|
.findByApplicationIdAndStatus(applicationId, ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
|
||||||
@@ -1114,22 +1121,21 @@ public class ApplicationDao {
|
|||||||
return convertApplicationSignedDocumentToApplicationSignedDocumentResponse(applicationSignedDocument);
|
return convertApplicationSignedDocumentToApplicationSignedDocumentResponse(applicationSignedDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteSignedDocument(HttpServletRequest request, Long applicationId) {
|
public void deleteSignedDocument(HttpServletRequest request, Long applicationId) {
|
||||||
|
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
||||||
|
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
|
||||||
|
|
||||||
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
ApplicationSignedDocumentEntity applicationSignedDocument = applicationSignedDocumentRepository
|
||||||
validator.validateUserWithCompany(request, applicationEntity.getCompany().getId());
|
.findByApplicationIdAndStatus(applicationId, ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
|
||||||
|
//cloned entity for old data
|
||||||
ApplicationSignedDocumentEntity applicationSignedDocument = applicationSignedDocumentRepository.findByApplicationIdAndStatus(applicationId,
|
|
||||||
ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
|
|
||||||
//cloned entity for old data
|
|
||||||
ApplicationSignedDocumentEntity oldApplicationSignedDocument = Utils.getClonedEntityForData(applicationSignedDocument);
|
ApplicationSignedDocumentEntity oldApplicationSignedDocument = Utils.getClonedEntityForData(applicationSignedDocument);
|
||||||
if (applicationSignedDocument == null) {
|
if(applicationSignedDocument == null) {
|
||||||
throw new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.APPLICATION_SIGNED_DOCUMENT_NOT_FOUND));
|
throw new ResourceNotFoundException(Status.NOT_FOUND,
|
||||||
}
|
Translator.toLocale(GepafinConstant.APPLICATION_SIGNED_DOCUMENT_NOT_FOUND));
|
||||||
applicationSignedDocument.setStatus(ApplicationSignedDocumentStatusEnum.INACTIVE.getValue());
|
}
|
||||||
applicationSignedDocument = applicationSignedDocumentRepository.save(applicationSignedDocument);
|
applicationSignedDocument.setStatus(ApplicationSignedDocumentStatusEnum.INACTIVE.getValue());
|
||||||
|
applicationSignedDocument = applicationSignedDocumentRepository.save(applicationSignedDocument);
|
||||||
|
|
||||||
/** This code is responsible for adding a version history log for the "Delete signed document" operation. **/
|
|
||||||
loggingUtil.addVersionHistory(
|
loggingUtil.addVersionHistory(
|
||||||
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationSignedDocument).newData(applicationSignedDocument)
|
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldApplicationSignedDocument).newData(applicationSignedDocument)
|
||||||
.build());
|
.build());
|
||||||
@@ -1138,11 +1144,10 @@ public class ApplicationDao {
|
|||||||
public ApplicationResponse validateApplication(HttpServletRequest request, Long applicationId) {
|
public ApplicationResponse validateApplication(HttpServletRequest request, Long applicationId) {
|
||||||
|
|
||||||
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
||||||
|
|
||||||
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(applicationEntity);
|
ApplicationEntity oldApplicationEntity = Utils.getClonedEntityForData(applicationEntity);
|
||||||
|
|
||||||
userService.validateUser(applicationEntity.getUserId());
|
UserEntity userEntity = userService.validateUser(applicationEntity.getUserId());
|
||||||
validator.validateUserWithCompany(request, applicationEntity.getCompany().getId());
|
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
|
||||||
if (Boolean.FALSE.equals(ApplicationStatusTypeEnum.DRAFT.getValue().equals(applicationEntity.getStatus()))) {
|
if (Boolean.FALSE.equals(ApplicationStatusTypeEnum.DRAFT.getValue().equals(applicationEntity.getStatus()))) {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_NOT_IN_DRAFT_STATUS));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.APPLICATION_NOT_IN_DRAFT_STATUS));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import net.gepafin.tendermanagement.config.Translator;
|
|||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||||
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
import net.gepafin.tendermanagement.entities.AssignedApplicationsEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
||||||
import net.gepafin.tendermanagement.entities.FaqEntity;
|
import net.gepafin.tendermanagement.entities.FaqEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
@@ -18,6 +19,7 @@ import net.gepafin.tendermanagement.model.response.AssignedApplicationsResponse;
|
|||||||
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
|
import net.gepafin.tendermanagement.repositories.AssignedApplicationsRepository;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||||
|
import net.gepafin.tendermanagement.service.CompanyService;
|
||||||
import net.gepafin.tendermanagement.service.UserService;
|
import net.gepafin.tendermanagement.service.UserService;
|
||||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
@@ -58,6 +60,9 @@ public class AssignedApplicationsDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationEvaluationDao applicationEvaluationDao;
|
private ApplicationEvaluationDao applicationEvaluationDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LoggingUtil loggingUtil;
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
@@ -155,7 +160,8 @@ public class AssignedApplicationsDao {
|
|||||||
assignedApplicationsResponse.setAssignedAt(assignedApplications.getAssignedAt());
|
assignedApplicationsResponse.setAssignedAt(assignedApplications.getAssignedAt());
|
||||||
assignedApplicationsResponse.setProtocolNumber(protocolNumber);
|
assignedApplicationsResponse.setProtocolNumber(protocolNumber);
|
||||||
assignedApplicationsResponse.setCallName(callName);
|
assignedApplicationsResponse.setCallName(callName);
|
||||||
assignedApplicationsResponse.setCompanyName(application.getCompany().getCompanyName());
|
CompanyEntity company=companyService.validateCompany(application.getCompanyId());
|
||||||
|
assignedApplicationsResponse.setCompanyName(company.getCompanyName());
|
||||||
assignedApplicationsResponse.setBeneficiaryName(beneficiaryName);
|
assignedApplicationsResponse.setBeneficiaryName(beneficiaryName);
|
||||||
assignedApplicationsResponse.setSubmissionDate(submissionDate);
|
assignedApplicationsResponse.setSubmissionDate(submissionDate);
|
||||||
assignedApplicationsResponse.setCallEndDate(callEndDate);
|
assignedApplicationsResponse.setCallEndDate(callEndDate);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import net.gepafin.tendermanagement.constants.GepafinConstant;
|
|||||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||||
import net.gepafin.tendermanagement.entities.BeneficiaryPreferredCallEntity;
|
import net.gepafin.tendermanagement.entities.BeneficiaryPreferredCallEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.UserWithCompanyEntity;
|
||||||
import net.gepafin.tendermanagement.enums.BeneficiaryCallStatus;
|
import net.gepafin.tendermanagement.enums.BeneficiaryCallStatus;
|
||||||
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.BeneficiaryPreferredCallReq;
|
import net.gepafin.tendermanagement.model.request.BeneficiaryPreferredCallReq;
|
||||||
@@ -12,6 +13,8 @@ import net.gepafin.tendermanagement.model.request.BeneficiaryPreferredCallReq;
|
|||||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.BeneficiaryPreferredCallResponseBean;
|
import net.gepafin.tendermanagement.model.response.BeneficiaryPreferredCallResponseBean;
|
||||||
import net.gepafin.tendermanagement.repositories.BeneficiaryPreferredCallRepository;
|
import net.gepafin.tendermanagement.repositories.BeneficiaryPreferredCallRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.UserWithCompanyRepository;
|
||||||
|
import net.gepafin.tendermanagement.service.CompanyService;
|
||||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
import net.gepafin.tendermanagement.util.Utils;
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
import net.gepafin.tendermanagement.util.Validator;
|
import net.gepafin.tendermanagement.util.Validator;
|
||||||
@@ -41,6 +44,12 @@ public class BeneficiaryPreferredCallDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private Validator validator;
|
private Validator validator;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserWithCompanyRepository userWithCompanyRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LoggingUtil loggingUtil;
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
@@ -50,16 +59,16 @@ public class BeneficiaryPreferredCallDao {
|
|||||||
public BeneficiaryPreferredCallResponseBean createBeneficiaryPreferredCall(HttpServletRequest httpServletRequest, BeneficiaryPreferredCallReq request, UserEntity user) {
|
public BeneficiaryPreferredCallResponseBean createBeneficiaryPreferredCall(HttpServletRequest httpServletRequest, BeneficiaryPreferredCallReq request, UserEntity user) {
|
||||||
log.info("Creating new beneficiary preferred call with details: {}", request);
|
log.info("Creating new beneficiary preferred call with details: {}", request);
|
||||||
validator.validateUserWithCompany(httpServletRequest, request.getCompanyId());
|
validator.validateUserWithCompany(httpServletRequest, request.getCompanyId());
|
||||||
|
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(user.getId(), request.getCompanyId());
|
||||||
Optional<BeneficiaryPreferredCallEntity> existingCall = beneficiaryPreferredCallRepository
|
Optional<BeneficiaryPreferredCallEntity> existingCall = beneficiaryPreferredCallRepository
|
||||||
.findByUserIdAndCallIdAndCompanyIdAndIsDeletedFalse(user.getId(), request.getCallId(), request.getCompanyId());
|
.findByUserIdAndCallIdAndUserWithCompanyIdAndIsDeletedFalse(user.getId(), request.getCallId(), userWithCompanyEntity.getId());
|
||||||
|
|
||||||
if (existingCall.isPresent()) {
|
if (existingCall.isPresent()) {
|
||||||
log.warn("Duplicate beneficiary preferred call detected: {}", existingCall.get());
|
log.warn("Duplicate beneficiary preferred call detected: {}", existingCall.get());
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.DUPLICATE_BENEFICIARY_CALL));
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.DUPLICATE_BENEFICIARY_CALL));
|
||||||
}
|
}
|
||||||
|
|
||||||
BeneficiaryPreferredCallEntity entity = convertRequestToEntity(request, user);
|
BeneficiaryPreferredCallEntity entity = convertRequestToEntity(request, user,userWithCompanyEntity);
|
||||||
entity = beneficiaryPreferredCallRepository.save(entity);
|
entity = beneficiaryPreferredCallRepository.save(entity);
|
||||||
|
|
||||||
/** This code is responsible for adding a version history log for "Create Beneficiary Preferred Call" operation. **/
|
/** This code is responsible for adding a version history log for "Create Beneficiary Preferred Call" operation. **/
|
||||||
@@ -69,7 +78,7 @@ public class BeneficiaryPreferredCallDao {
|
|||||||
return convertEntityToResponse(entity);
|
return convertEntityToResponse(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BeneficiaryPreferredCallEntity convertRequestToEntity(BeneficiaryPreferredCallReq request,UserEntity userEntity) {
|
private BeneficiaryPreferredCallEntity convertRequestToEntity(BeneficiaryPreferredCallReq request,UserEntity userEntity,UserWithCompanyEntity userWithCompanyEntity) {
|
||||||
BeneficiaryPreferredCallEntity entity = new BeneficiaryPreferredCallEntity();
|
BeneficiaryPreferredCallEntity entity = new BeneficiaryPreferredCallEntity();
|
||||||
if (userEntity.getBeneficiary()!=null) {
|
if (userEntity.getBeneficiary()!=null) {
|
||||||
entity.setBeneficiaryId(userEntity.getBeneficiary().getId());
|
entity.setBeneficiaryId(userEntity.getBeneficiary().getId());
|
||||||
@@ -77,7 +86,8 @@ public class BeneficiaryPreferredCallDao {
|
|||||||
entity.setStatus(BeneficiaryCallStatus.ENABLED.getValue());
|
entity.setStatus(BeneficiaryCallStatus.ENABLED.getValue());
|
||||||
entity.setCallId(request.getCallId());
|
entity.setCallId(request.getCallId());
|
||||||
entity.setUserId(userEntity.getId());
|
entity.setUserId(userEntity.getId());
|
||||||
entity.setCompanyId(request.getCompanyId());
|
entity.setCompanyId(userWithCompanyEntity.getCompanyId());
|
||||||
|
entity.setUserWithCompany(userWithCompanyEntity);
|
||||||
entity.setIsDeleted( false);
|
entity.setIsDeleted( false);
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
@@ -142,6 +152,7 @@ public class BeneficiaryPreferredCallDao {
|
|||||||
response.setCallId(entity.getCallId());
|
response.setCallId(entity.getCallId());
|
||||||
response.setUserId(entity.getUserId());
|
response.setUserId(entity.getUserId());
|
||||||
response.setCompanyId(entity.getCompanyId());
|
response.setCompanyId(entity.getCompanyId());
|
||||||
|
response.setUserWithCompanyId(entity.getUserWithCompany().getId());
|
||||||
response.setCreatedDate(entity.getCreatedDate());
|
response.setCreatedDate(entity.getCreatedDate());
|
||||||
response.setUpdatedDate(entity.getUpdatedDate());
|
response.setUpdatedDate(entity.getUpdatedDate());
|
||||||
|
|
||||||
@@ -160,8 +171,8 @@ public class BeneficiaryPreferredCallDao {
|
|||||||
log.info("Beneficiary preferred call status updated with ID: {}", existingEntity.getId());
|
log.info("Beneficiary preferred call status updated with ID: {}", existingEntity.getId());
|
||||||
}
|
}
|
||||||
public List<BeneficiaryPreferredCallResponseBean> getBeneficiaryPreferredCallByUserId(UserEntity userEntity, Long companyId) {
|
public List<BeneficiaryPreferredCallResponseBean> getBeneficiaryPreferredCallByUserId(UserEntity userEntity, Long companyId) {
|
||||||
|
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(userEntity.getId(),companyId);
|
||||||
List<BeneficiaryPreferredCallEntity> calls = beneficiaryPreferredCallRepository.findByUserIdAndCompanyIdAndIsDeletedFalse(userEntity.getId(), companyId);
|
List<BeneficiaryPreferredCallEntity> calls = beneficiaryPreferredCallRepository.findByUserIdAndUserWithCompanyIdAndIsDeletedFalse(userEntity.getId(), userWithCompanyEntity.getId());
|
||||||
return calls.stream()
|
return calls.stream()
|
||||||
.map(this::convertEntityToResponse)
|
.map(this::convertEntityToResponse)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|||||||
@@ -99,6 +99,9 @@ public class CallDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private Validator validator;
|
private Validator validator;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LoggingUtil loggingUtil;
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
@@ -476,8 +479,9 @@ public class CallDao {
|
|||||||
BeneficiaryPreferredCallEntity preferredCall;
|
BeneficiaryPreferredCallEntity preferredCall;
|
||||||
if (companyId != null) {
|
if (companyId != null) {
|
||||||
validator.validateUserWithCompany(request, companyId);
|
validator.validateUserWithCompany(request, companyId);
|
||||||
|
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(user.getId(),companyId);
|
||||||
preferredCall = beneficiaryPreferredCallRepository
|
preferredCall = beneficiaryPreferredCallRepository
|
||||||
.findByUserIdAndCallIdAndCompanyIdAndIsDeletedFalse(userId, callId, companyId)
|
.findByUserIdAndCallIdAndUserWithCompanyIdAndIsDeletedFalse(userId, callId, userWithCompanyEntity.getId())
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
} else {
|
} else {
|
||||||
preferredCall = beneficiaryPreferredCallRepository
|
preferredCall = beneficiaryPreferredCallRepository
|
||||||
@@ -735,8 +739,9 @@ public class CallDao {
|
|||||||
|
|
||||||
if (Boolean.TRUE.equals(onlyPreferredCall)) {
|
if (Boolean.TRUE.equals(onlyPreferredCall)) {
|
||||||
validator.validateUserWithCompany(request, companyId);
|
validator.validateUserWithCompany(request, companyId);
|
||||||
|
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(user.getId(),companyId);
|
||||||
List<BeneficiaryPreferredCallEntity> preferredCalls = beneficiaryPreferredCallRepository
|
List<BeneficiaryPreferredCallEntity> preferredCalls = beneficiaryPreferredCallRepository
|
||||||
.findByUserIdAndCompanyIdAndIsDeletedFalse(user.getId(), companyId);
|
.findByUserIdAndUserWithCompanyIdAndIsDeletedFalse(user.getId(), userWithCompanyEntity.getId());
|
||||||
List<Long> preferredCallIds = preferredCalls.stream()
|
List<Long> preferredCallIds = preferredCalls.stream()
|
||||||
.map(BeneficiaryPreferredCallEntity::getCallId)
|
.map(BeneficiaryPreferredCallEntity::getCallId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@@ -764,10 +769,11 @@ public class CallDao {
|
|||||||
public Map<String, BeneficiaryPreferredCallEntity> getBeneficiaryPreferredCallsForUser(HttpServletRequest request, UserEntity user, List<Long> callIds, Long companyId) {
|
public Map<String, BeneficiaryPreferredCallEntity> getBeneficiaryPreferredCallsForUser(HttpServletRequest request, UserEntity user, List<Long> callIds, Long companyId) {
|
||||||
List<BeneficiaryPreferredCallEntity> beneficiaryPreferredCalls;
|
List<BeneficiaryPreferredCallEntity> beneficiaryPreferredCalls;
|
||||||
|
|
||||||
if (companyId != null) {
|
if (companyId != null && Boolean.TRUE.equals(validator.checkIsBeneficiary())) {
|
||||||
validator.validateUserWithCompany(request, companyId);
|
validator.validateUserWithCompany(request, companyId);
|
||||||
|
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(user.getId(),companyId);
|
||||||
beneficiaryPreferredCalls = beneficiaryPreferredCallRepository
|
beneficiaryPreferredCalls = beneficiaryPreferredCallRepository
|
||||||
.findByUserIdAndCallIdInAndCompanyIdAndIsDeletedFalse(user.getId(), callIds, companyId);
|
.findByUserIdAndCallIdInAndUserWithCompanyIdAndIsDeletedFalse(user.getId(), callIds, userWithCompanyEntity.getId());
|
||||||
} else {
|
} else {
|
||||||
beneficiaryPreferredCalls = beneficiaryPreferredCallRepository
|
beneficiaryPreferredCalls = beneficiaryPreferredCallRepository
|
||||||
.findByUserIdAndCallIdInAndIsDeletedFalse(user.getId(), callIds);
|
.findByUserIdAndCallIdInAndIsDeletedFalse(user.getId(), callIds);
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
package net.gepafin.tendermanagement.dao;
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.entities.*;
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.UserCompanyDelegationStatusEnum;
|
||||||
|
import net.gepafin.tendermanagement.repositories.*;
|
||||||
|
import net.gepafin.tendermanagement.service.CompanyService;
|
||||||
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||||
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
||||||
@@ -19,8 +23,6 @@ import net.gepafin.tendermanagement.config.Translator;
|
|||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.model.request.CompanyRequest;
|
import net.gepafin.tendermanagement.model.request.CompanyRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.CompanyResponse;
|
import net.gepafin.tendermanagement.model.response.CompanyResponse;
|
||||||
import net.gepafin.tendermanagement.repositories.CompanyRepository;
|
|
||||||
import net.gepafin.tendermanagement.repositories.UserWithCompanyRepository;
|
|
||||||
import net.gepafin.tendermanagement.service.UserService;
|
import net.gepafin.tendermanagement.service.UserService;
|
||||||
import net.gepafin.tendermanagement.util.Utils;
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
|
|
||||||
@@ -42,6 +44,15 @@ public class CompanyDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FaqRepository faqRepository;
|
private FaqRepository faqRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BeneficiaryPreferredCallRepository beneficiaryPreferredCallRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserCompanyDelegationRepository userCompanyDelegationRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LoggingUtil loggingUtil;
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
@@ -245,40 +256,67 @@ public class CompanyDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public UserWithCompanyEntity getUserWithCompany(Long userId, Long compnayId) {
|
public UserWithCompanyEntity getUserWithCompany(Long userId, Long compnayId) {
|
||||||
return userWithCompanyRepository.findByUserIdAndCompanyIdAndIsDeletedFalse(userId, compnayId).orElseThrow(
|
return userWithCompanyRepository.findByUserIdAndCompanyIdAndIsDeletedFalse(userId, compnayId).orElseThrow(
|
||||||
() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.USER_COMPANY_RELATION_NOT_FOUND)));
|
() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.USER_COMPANY_RELATION_NOT_FOUND)));
|
||||||
}
|
}
|
||||||
public void removeCompanyFromList(UserEntity userEntity, Long companyId) {
|
public void removeCompanyFromList(UserEntity userEntity, Long companyId) {
|
||||||
|
CompanyEntity companyEntity = validateCompany(companyId);
|
||||||
CompanyEntity companyEntity = validateCompany(companyId);
|
UserWithCompanyEntity existingRelation=companyService.getUserWithCompany(userEntity.getId(),companyEntity.getId());
|
||||||
UserWithCompanyEntity existingRelation = userWithCompanyRepository.findByUserIdAndCompanyIdAndIsDeletedFalse(userEntity.getId(), companyEntity.getId())
|
List<ApplicationEntity> userApplications = applicationRepository.findByUserWithCompanyIdAndUserIdAndIsDeletedFalse(existingRelation.getId(), userEntity.getId());
|
||||||
.orElseThrow(() -> new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.USER_ALREADY_CONNECTED_TO_COMPANY)));
|
List<FaqEntity> faqs = faqRepository.findByUserWithCompanyIdAndIsDeletedFalse(existingRelation.getId());
|
||||||
List<ApplicationEntity> userApplications = applicationRepository.findByCompanyIdAndUserIdAndIsDeletedFalse(companyEntity.getId(), userEntity.getId());
|
List<BeneficiaryPreferredCallEntity> preferredCallEntities= beneficiaryPreferredCallRepository.findByUserIdAndUserWithCompanyIdAndIsDeletedFalse(userEntity.getId(),existingRelation.getId());
|
||||||
List<FaqEntity> faqs = faqRepository.findByCompanyIdAndUserIdAndIsDeletedFalse(companyEntity.getId(), userEntity.getId());
|
UserCompanyDelegationEntity userCompanyDelegationEntity = userCompanyDelegationRepository.findByUserIdAndUserWithCompanyIdAndStatus(userEntity.getId(),existingRelation.getId(), UserCompanyDelegationStatusEnum.ACTIVE.getValue());
|
||||||
for (ApplicationEntity application : userApplications) {
|
List<String> applicationStatusAllowed = List.of(
|
||||||
if (Boolean.TRUE.equals(application.getStatus().equals(ApplicationStatusTypeEnum.SUBMIT.getValue()))) {
|
ApplicationStatusTypeEnum.DRAFT.getValue(),
|
||||||
|
ApplicationStatusTypeEnum.AWAITING.getValue(),
|
||||||
|
ApplicationStatusTypeEnum.READY.getValue()
|
||||||
|
);
|
||||||
|
boolean notAllowedStatus = userApplications.stream()
|
||||||
|
.anyMatch(application -> !applicationStatusAllowed.contains(application.getStatus()));
|
||||||
|
if (notAllowedStatus) {
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.CANNOT_DELETE_COMPANY_WITH_APPLICATION_SUBMITT));
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.CANNOT_DELETE_COMPANY_WITH_APPLICATION_SUBMITT));
|
||||||
}
|
}
|
||||||
if (Boolean.TRUE.equals(application.getStatus().equals(ApplicationStatusTypeEnum.DRAFT.getValue()))) {
|
|
||||||
|
|
||||||
//cloned entity for old data
|
for(ApplicationEntity application:userApplications){
|
||||||
ApplicationEntity oldApplicationData = Utils.getClonedEntityForData(application);
|
ApplicationEntity oldApplication = Utils.getClonedEntityForData(application);
|
||||||
application.setIsDeleted(Boolean.TRUE);
|
application.setIsDeleted(Boolean.TRUE);
|
||||||
applicationRepository.save(application);
|
|
||||||
|
|
||||||
/** This code is responsible for adding a version history log for the "" operation. **/
|
/** This code is responsible for adding a version history log for the "Soft delete application" operation. **/
|
||||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldApplicationData).newData(application).build());
|
loggingUtil.addVersionHistory(
|
||||||
|
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldApplication).newData(application).build());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
applicationRepository.saveAll(userApplications);
|
||||||
for (FaqEntity faq : faqs) {
|
|
||||||
//cloned for old data
|
|
||||||
FaqEntity oldFaqEntityData = Utils.getClonedEntityForData(faq);
|
|
||||||
faq.setIsDeleted(Boolean.TRUE);
|
|
||||||
faqRepository.save(faq);
|
|
||||||
|
|
||||||
/** This code is responsible for adding a version history log for the "soft deleting faq" operation. **/
|
for(FaqEntity faq:faqs){
|
||||||
|
FaqEntity oldFaq = Utils.getClonedEntityForData(faq);
|
||||||
|
faq.setIsDeleted(Boolean.TRUE);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Soft delete Faq" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(
|
||||||
|
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldFaq).newData(faq).build());
|
||||||
|
}
|
||||||
|
faqRepository.saveAll(faqs);
|
||||||
|
|
||||||
|
for(BeneficiaryPreferredCallEntity beneficiaryPreferredCall:preferredCallEntities){
|
||||||
|
BeneficiaryPreferredCallEntity oldPreferredCall = Utils.getClonedEntityForData(beneficiaryPreferredCall);
|
||||||
|
beneficiaryPreferredCall.setIsDeleted(Boolean.TRUE);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Soft Delete BeneficiaryPreferredCall" operation. **/
|
||||||
|
loggingUtil.addVersionHistory(
|
||||||
|
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldPreferredCall).newData(beneficiaryPreferredCall).build());
|
||||||
|
|
||||||
|
}
|
||||||
|
beneficiaryPreferredCallRepository.saveAll(preferredCallEntities);
|
||||||
|
|
||||||
|
if(userCompanyDelegationEntity!=null){
|
||||||
|
UserCompanyDelegationEntity oldUserWithCompanyDelegation = Utils.getClonedEntityForData(userCompanyDelegationEntity);
|
||||||
|
userCompanyDelegationEntity.setStatus( UserCompanyDelegationStatusEnum.INACTIVE.getValue());
|
||||||
|
userCompanyDelegationRepository.save(userCompanyDelegationEntity);
|
||||||
|
|
||||||
|
/** This code is responsible for adding a version history log for the "Update UserWithCompanyDelegation" operation. **/
|
||||||
loggingUtil.addVersionHistory(
|
loggingUtil.addVersionHistory(
|
||||||
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldFaqEntityData).newData(faq).build());
|
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldUserWithCompanyDelegation).newData(userCompanyDelegationEntity).build());
|
||||||
}
|
}
|
||||||
UserWithCompanyEntity oldUserWithCompanyData = Utils.getClonedEntityForData(existingRelation);
|
UserWithCompanyEntity oldUserWithCompanyData = Utils.getClonedEntityForData(existingRelation);
|
||||||
existingRelation.setIsDeleted(Boolean.TRUE);
|
existingRelation.setIsDeleted(Boolean.TRUE);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.dao;
|
|||||||
|
|
||||||
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.UserWithCompanyEntity;
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||||
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
||||||
@@ -12,6 +13,7 @@ import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
|||||||
import net.gepafin.tendermanagement.repositories.CallRepository;
|
import net.gepafin.tendermanagement.repositories.CallRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.CompanyRepository;
|
import net.gepafin.tendermanagement.repositories.CompanyRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.UserRepository;
|
import net.gepafin.tendermanagement.repositories.UserRepository;
|
||||||
|
import net.gepafin.tendermanagement.service.CompanyService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -32,6 +34,9 @@ public class DashboardDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CompanyRepository companyRepository;
|
private CompanyRepository companyRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
public SuperAdminWidgetResponseBean getDashboardWidget(UserEntity requestedUserEntity) {
|
public SuperAdminWidgetResponseBean getDashboardWidget(UserEntity requestedUserEntity) {
|
||||||
SuperAdminWidgetResponseBean widgetResponseBean = new SuperAdminWidgetResponseBean();
|
SuperAdminWidgetResponseBean widgetResponseBean = new SuperAdminWidgetResponseBean();
|
||||||
widgetResponseBean.setWidget1(createWidget1(requestedUserEntity));
|
widgetResponseBean.setWidget1(createWidget1(requestedUserEntity));
|
||||||
@@ -108,8 +113,9 @@ public class DashboardDao {
|
|||||||
if (activeCalls != null) {
|
if (activeCalls != null) {
|
||||||
beneficiaryWidgetResponseBean.setNumberOfCalls(activeCalls);
|
beneficiaryWidgetResponseBean.setNumberOfCalls(activeCalls);
|
||||||
}
|
}
|
||||||
|
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(userEntity.getId(),company.getId());
|
||||||
Long activeApplication = applicationRepository.countSubmittedApplicationsByUserId(userEntity.getId(),
|
Long activeApplication = applicationRepository.countSubmittedApplicationsByUserId(userEntity.getId(),
|
||||||
company.getId());
|
userWithCompanyEntity.getId());
|
||||||
if (activeApplication != null) {
|
if (activeApplication != null) {
|
||||||
beneficiaryWidgetResponseBean.setNumberOfApplications(activeApplication);
|
beneficiaryWidgetResponseBean.setNumberOfApplications(activeApplication);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,14 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
import net.gepafin.tendermanagement.enums.DocOtherSourceTypeEnum;
|
import net.gepafin.tendermanagement.enums.DocOtherSourceTypeEnum;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.repositories.UserWithCompanyRepository;
|
||||||
|
import net.gepafin.tendermanagement.service.CompanyService;
|
||||||
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
@@ -21,10 +25,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.entities.CompanyEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.DocumentEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.UserCompanyDelegationEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
|
||||||
import net.gepafin.tendermanagement.enums.UserCompanyDelegationStatusEnum;
|
import net.gepafin.tendermanagement.enums.UserCompanyDelegationStatusEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.CompanyDelegationRequest;
|
import net.gepafin.tendermanagement.model.request.CompanyDelegationRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.CompanyDelegationResponse;
|
import net.gepafin.tendermanagement.model.response.CompanyDelegationResponse;
|
||||||
@@ -70,6 +70,12 @@ public class DelegationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private Validator validator;
|
private Validator validator;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserWithCompanyRepository userWithCompanyRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LoggingUtil loggingUtil;
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
@@ -191,8 +197,11 @@ public class DelegationDao {
|
|||||||
companyDao.validateCompany(companyId);
|
companyDao.validateCompany(companyId);
|
||||||
companyDao.getUserWithCompany(userEntity.getId(), companyId);
|
companyDao.getUserWithCompany(userEntity.getId(), companyId);
|
||||||
validateFileType(file);
|
validateFileType(file);
|
||||||
UserCompanyDelegationEntity userCompanyDelegationEntity = userCompanyDelegationRepository.findByUserIdAndCompanyIdAndStatus(userEntity.getId(), companyId,
|
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(userEntity.getId(),companyId);
|
||||||
UserCompanyDelegationStatusEnum.ACTIVE.getValue());
|
UserCompanyDelegationEntity userCompanyDelegationEntity = userCompanyDelegationRepository
|
||||||
|
.findByUserIdAndUserWithCompanyIdAndStatus(userEntity.getId(), userWithCompanyEntity.getId(),
|
||||||
|
UserCompanyDelegationStatusEnum.ACTIVE.getValue());
|
||||||
|
|
||||||
UserCompanyDelegationEntity oldUserCompanyDelegationEntity = Utils.getClonedEntityForData(userCompanyDelegationEntity);
|
UserCompanyDelegationEntity oldUserCompanyDelegationEntity = Utils.getClonedEntityForData(userCompanyDelegationEntity);
|
||||||
if (userCompanyDelegationEntity != null) {
|
if (userCompanyDelegationEntity != null) {
|
||||||
userCompanyDelegationEntity.setStatus(UserCompanyDelegationStatusEnum.INACTIVE.getValue());
|
userCompanyDelegationEntity.setStatus(UserCompanyDelegationStatusEnum.INACTIVE.getValue());
|
||||||
@@ -204,7 +213,8 @@ public class DelegationDao {
|
|||||||
}
|
}
|
||||||
UploadFileOnAmazonS3Response uploadFileOnAmazonS3Response = uploadFileOnAmazonS3ForCompanyDelegation(file);
|
UploadFileOnAmazonS3Response uploadFileOnAmazonS3Response = uploadFileOnAmazonS3ForCompanyDelegation(file);
|
||||||
userCompanyDelegationEntity = new UserCompanyDelegationEntity();
|
userCompanyDelegationEntity = new UserCompanyDelegationEntity();
|
||||||
userCompanyDelegationEntity.setCompanyId(companyId);
|
userCompanyDelegationEntity.setUserWithCompany(userWithCompanyEntity);
|
||||||
|
userCompanyDelegationEntity.setCompanyId(userWithCompanyEntity.getCompanyId());
|
||||||
userCompanyDelegationEntity.setUserId(userEntity.getId());
|
userCompanyDelegationEntity.setUserId(userEntity.getId());
|
||||||
if (userEntity.getBeneficiary() != null) {
|
if (userEntity.getBeneficiary() != null) {
|
||||||
userCompanyDelegationEntity.setBeneficiaryId(userEntity.getBeneficiary().getId());
|
userCompanyDelegationEntity.setBeneficiaryId(userEntity.getBeneficiary().getId());
|
||||||
@@ -254,8 +264,9 @@ public class DelegationDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CompanyDelegationResponse getCompanyDelegation(UserEntity userEntity, Long companyId) {
|
public CompanyDelegationResponse getCompanyDelegation(UserEntity userEntity, Long companyId) {
|
||||||
|
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(userEntity.getId(),companyId);
|
||||||
UserCompanyDelegationEntity userCompanyDelegationEntity = userCompanyDelegationRepository
|
UserCompanyDelegationEntity userCompanyDelegationEntity = userCompanyDelegationRepository
|
||||||
.findByUserIdAndCompanyIdAndStatus(userEntity.getId(), companyId,
|
.findByUserIdAndUserWithCompanyIdAndStatus(userEntity.getId(), userWithCompanyEntity.getId(),
|
||||||
UserCompanyDelegationStatusEnum.ACTIVE.getValue());
|
UserCompanyDelegationStatusEnum.ACTIVE.getValue());
|
||||||
companyDao.getUserWithCompany(userEntity.getId(), companyId);
|
companyDao.getUserWithCompany(userEntity.getId(), companyId);
|
||||||
if(userCompanyDelegationEntity == null) {
|
if(userCompanyDelegationEntity == null) {
|
||||||
@@ -266,9 +277,10 @@ public class DelegationDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void deleteCompanyDelegation(UserEntity userEntity, Long companyId) {
|
public void deleteCompanyDelegation(UserEntity userEntity, Long companyId) {
|
||||||
|
UserWithCompanyEntity userWithCompanyEntity=companyService.getUserWithCompany(userEntity.getId(),companyId);
|
||||||
UserCompanyDelegationEntity userCompanyDelegationEntity = userCompanyDelegationRepository.findByUserIdAndCompanyIdAndStatus(userEntity.getId(), companyId,
|
UserCompanyDelegationEntity userCompanyDelegationEntity = userCompanyDelegationRepository
|
||||||
UserCompanyDelegationStatusEnum.ACTIVE.getValue());
|
.findByUserIdAndUserWithCompanyIdAndStatus(userEntity.getId(), userWithCompanyEntity.getId(),
|
||||||
|
UserCompanyDelegationStatusEnum.ACTIVE.getValue());
|
||||||
companyDao.getUserWithCompany(userEntity.getId(), companyId);
|
companyDao.getUserWithCompany(userEntity.getId(), companyId);
|
||||||
//cloned entity for old data
|
//cloned entity for old data
|
||||||
UserCompanyDelegationEntity oldUserCompanyDelegation = Utils.getClonedEntityForData(userCompanyDelegationEntity);
|
UserCompanyDelegationEntity oldUserCompanyDelegation = Utils.getClonedEntityForData(userCompanyDelegationEntity);
|
||||||
|
|||||||
@@ -14,10 +14,7 @@ import net.gepafin.tendermanagement.model.request.EmailLogRequest;
|
|||||||
import net.gepafin.tendermanagement.model.response.SystemEmailTemplateResponse;
|
import net.gepafin.tendermanagement.model.response.SystemEmailTemplateResponse;
|
||||||
import net.gepafin.tendermanagement.repositories.EmailLogRepository;
|
import net.gepafin.tendermanagement.repositories.EmailLogRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.HubRepository;
|
import net.gepafin.tendermanagement.repositories.HubRepository;
|
||||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
import net.gepafin.tendermanagement.service.*;
|
||||||
import net.gepafin.tendermanagement.service.HubService;
|
|
||||||
import net.gepafin.tendermanagement.service.SystemEmailTemplatesService;
|
|
||||||
import net.gepafin.tendermanagement.service.UserService;
|
|
||||||
import net.gepafin.tendermanagement.service.impl.EmailService;
|
import net.gepafin.tendermanagement.service.impl.EmailService;
|
||||||
import net.gepafin.tendermanagement.service.impl.EmailServiceFactory;
|
import net.gepafin.tendermanagement.service.impl.EmailServiceFactory;
|
||||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||||
@@ -59,6 +56,9 @@ public class EmailNotificationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EmailLogRepository emailLogRepository;
|
private EmailLogRepository emailLogRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
|
|
||||||
private void sendEmail(ApplicationEntity applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum templateType,
|
private void sendEmail(ApplicationEntity applicationEntity, SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum templateType,
|
||||||
Map<String, String> bodyPlaceholders, List<String> additionalRecipients,Long amendmentId) {
|
Map<String, String> bodyPlaceholders, List<String> additionalRecipients,Long amendmentId) {
|
||||||
@@ -69,8 +69,9 @@ public class EmailNotificationDao {
|
|||||||
|
|
||||||
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService.retrieveTemplateByTypeAndCall(templateType, hubEntity, null);
|
SystemEmailTemplateResponse systemEmailTemplateResponse = systemEmailTemplatesService.retrieveTemplateByTypeAndCall(templateType, hubEntity, null);
|
||||||
Map<String, String> subjectPlaceholders = new HashMap<>();
|
Map<String, String> subjectPlaceholders = new HashMap<>();
|
||||||
|
CompanyEntity company=companyService.validateCompany(applicationEntity.getCompanyId());
|
||||||
subjectPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName());
|
subjectPlaceholders.put("{{call_name}}", applicationEntity.getCall().getName());
|
||||||
subjectPlaceholders.put("{{company_name}}", applicationEntity.getCompany().getCompanyName());
|
subjectPlaceholders.put("{{company_name}}", company.getCompanyName());
|
||||||
bodyPlaceholders.put("{{legal_mail}}", legalMail);
|
bodyPlaceholders.put("{{legal_mail}}", legalMail);
|
||||||
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
String subject = Utils.replacePlaceholders(systemEmailTemplateResponse.getSubject(), subjectPlaceholders);
|
||||||
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
String body = Utils.replacePlaceholders(systemEmailTemplateResponse.getHtmlContent(), bodyPlaceholders);
|
||||||
@@ -82,8 +83,9 @@ public class EmailNotificationDao {
|
|||||||
}
|
}
|
||||||
private List<String> getRecipientEmails(ApplicationEntity applicationEntity, UserEntity userEntity, List<String> additionalRecipients) {
|
private List<String> getRecipientEmails(ApplicationEntity applicationEntity, UserEntity userEntity, List<String> additionalRecipients) {
|
||||||
List<String> recipientEmails = new ArrayList<>();
|
List<String> recipientEmails = new ArrayList<>();
|
||||||
String companyEmail = applicationEntity.getCompany().getEmail();
|
CompanyEntity company=companyService.validateCompany(applicationEntity.getCompanyId());
|
||||||
String contactEmail = applicationEntity.getCompany().getContactEmail();
|
String companyEmail = company.getEmail();
|
||||||
|
String contactEmail = company.getContactEmail();
|
||||||
|
|
||||||
if (companyEmail != null && !companyEmail.isEmpty()) {
|
if (companyEmail != null && !companyEmail.isEmpty()) {
|
||||||
recipientEmails.add(companyEmail);
|
recipientEmails.add(companyEmail);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.dao;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||||
import net.gepafin.tendermanagement.entities.FaqEntity;
|
import net.gepafin.tendermanagement.entities.FaqEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
@@ -13,6 +14,7 @@ import net.gepafin.tendermanagement.model.request.FaqReq;
|
|||||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.FaqResponseBean;
|
import net.gepafin.tendermanagement.model.response.FaqResponseBean;
|
||||||
import net.gepafin.tendermanagement.repositories.FaqRepository;
|
import net.gepafin.tendermanagement.repositories.FaqRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.UserWithCompanyRepository;
|
||||||
import net.gepafin.tendermanagement.service.CallService;
|
import net.gepafin.tendermanagement.service.CallService;
|
||||||
import net.gepafin.tendermanagement.service.CompanyService;
|
import net.gepafin.tendermanagement.service.CompanyService;
|
||||||
import net.gepafin.tendermanagement.service.LookUpDataService;
|
import net.gepafin.tendermanagement.service.LookUpDataService;
|
||||||
@@ -30,6 +32,7 @@ import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class FaqDao {
|
public class FaqDao {
|
||||||
@@ -49,6 +52,9 @@ public class FaqDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CompanyService companyService;
|
private CompanyService companyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserWithCompanyRepository userWithCompanyRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
HttpServletRequest request;
|
HttpServletRequest request;
|
||||||
|
|
||||||
@@ -63,10 +69,15 @@ public class FaqDao {
|
|||||||
if (validator.checkIsBeneficiary() && companyId == null) {
|
if (validator.checkIsBeneficiary() && companyId == null) {
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.COMPANY_ID_MANDATORY));
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.COMPANY_ID_MANDATORY));
|
||||||
}
|
}
|
||||||
if (companyId != null) {
|
UserWithCompanyEntity userWithCompanyEntity=null;
|
||||||
companyService.validateCompany(companyId);
|
if(companyId!=null) {
|
||||||
entity.setCompanyId(companyId);
|
userWithCompanyEntity=companyService.getUserWithCompany(userEntity.getId(),companyId);
|
||||||
|
companyService.validateCompany(userWithCompanyEntity.getCompanyId());
|
||||||
|
entity.setCompanyId(userWithCompanyEntity.getCompanyId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entity.setUserWithCompany(userWithCompanyEntity);
|
||||||
faqRepository.save(entity);
|
faqRepository.save(entity);
|
||||||
|
|
||||||
if (entity.getCompanyId() != null) {
|
if (entity.getCompanyId() != null) {
|
||||||
|
|||||||
@@ -3,19 +3,15 @@ package net.gepafin.tendermanagement.dao;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.*;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
import net.gepafin.tendermanagement.repositories.*;
|
import net.gepafin.tendermanagement.repositories.*;
|
||||||
|
import net.gepafin.tendermanagement.service.CompanyService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationFormEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationFormFieldEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.FlowDataEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.FlowEdgesEntity;
|
|
||||||
import net.gepafin.tendermanagement.entities.FormEntity;
|
|
||||||
import net.gepafin.tendermanagement.enums.FormActionEnum;
|
import net.gepafin.tendermanagement.enums.FormActionEnum;
|
||||||
import net.gepafin.tendermanagement.model.response.NextOrPreviousFormResponse;
|
import net.gepafin.tendermanagement.model.response.NextOrPreviousFormResponse;
|
||||||
import net.gepafin.tendermanagement.service.FormService;
|
import net.gepafin.tendermanagement.service.FormService;
|
||||||
@@ -44,6 +40,8 @@ public class FlowFormDao {
|
|||||||
private FormService formService;
|
private FormService formService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private FormDao formDao;
|
private FormDao formDao;
|
||||||
|
@Autowired
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -290,6 +288,7 @@ public class FlowFormDao {
|
|||||||
private NextOrPreviousFormResponse setNextOrPreviousResponse(Long calculatedFormId, ApplicationEntity applicationEntity) {
|
private NextOrPreviousFormResponse setNextOrPreviousResponse(Long calculatedFormId, ApplicationEntity applicationEntity) {
|
||||||
NextOrPreviousFormResponse nextOrPreviousFormResponse = new NextOrPreviousFormResponse();
|
NextOrPreviousFormResponse nextOrPreviousFormResponse = new NextOrPreviousFormResponse();
|
||||||
Integer completedSteps=0;
|
Integer completedSteps=0;
|
||||||
|
CompanyEntity company=companyService.validateCompany(applicationEntity.getCompanyId());
|
||||||
FormEntity formEntity = formService.validateForm(calculatedFormId);
|
FormEntity formEntity = formService.validateForm(calculatedFormId);
|
||||||
nextOrPreviousFormResponse.setFormId(calculatedFormId);
|
nextOrPreviousFormResponse.setFormId(calculatedFormId);
|
||||||
nextOrPreviousFormResponse.setApplicationStatus(ApplicationStatusTypeEnum.valueOf(applicationEntity.getStatus()));
|
nextOrPreviousFormResponse.setApplicationStatus(ApplicationStatusTypeEnum.valueOf(applicationEntity.getStatus()));
|
||||||
@@ -297,8 +296,8 @@ public class FlowFormDao {
|
|||||||
applicationDao.processForm(formEntity, applicationEntity));
|
applicationDao.processForm(formEntity, applicationEntity));
|
||||||
nextOrPreviousFormResponse.setCallId(applicationEntity.getCall().getId());
|
nextOrPreviousFormResponse.setCallId(applicationEntity.getCall().getId());
|
||||||
nextOrPreviousFormResponse.setCallTitle(applicationEntity.getCall().getName());
|
nextOrPreviousFormResponse.setCallTitle(applicationEntity.getCall().getName());
|
||||||
nextOrPreviousFormResponse.setCompanyId(applicationEntity.getCompany().getId());
|
nextOrPreviousFormResponse.setCompanyId(applicationEntity.getCompanyId());
|
||||||
nextOrPreviousFormResponse.setCompanyName(applicationEntity.getCompany().getCompanyName());
|
nextOrPreviousFormResponse.setCompanyName(company.getCompanyName());
|
||||||
|
|
||||||
List<FlowEdgesEntity> flowEdgesList = flowEdgesRepository.findByCallId(applicationEntity.getCall().getId());
|
List<FlowEdgesEntity> flowEdgesList = flowEdgesRepository.findByCallId(applicationEntity.getCall().getId());
|
||||||
Long totalFormSteps = calculateTotalSteps(flowEdgesList);
|
Long totalFormSteps = calculateTotalSteps(flowEdgesList);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class PdfDao {
|
|||||||
try {
|
try {
|
||||||
UserEntity userEntity = validator.validateUser(request);
|
UserEntity userEntity = validator.validateUser(request);
|
||||||
ApplicationEntity applicationEntity = applicationDao.validateApplication(applicationId);
|
ApplicationEntity applicationEntity = applicationDao.validateApplication(applicationId);
|
||||||
validator.validateUserWithCompany(request, applicationEntity.getCompany().getId());
|
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
|
||||||
CallEntity call=callService.validateCall(applicationEntity.getCall().getId());
|
CallEntity call=callService.validateCall(applicationEntity.getCall().getId());
|
||||||
|
|
||||||
// Create a byte stream to hold the PDF
|
// Create a byte stream to hold the PDF
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ public class ApplicationEntity extends BaseEntity {
|
|||||||
@Column(name = "USER_ID")
|
@Column(name = "USER_ID")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
@ManyToOne
|
@Column(name = "COMPANY_ID")
|
||||||
@JoinColumn(name = "COMPANY_ID", nullable = false)
|
private Long companyId;
|
||||||
private CompanyEntity company;
|
|
||||||
|
|
||||||
@Column(name = "SUBMISSION_DATE")
|
@Column(name = "SUBMISSION_DATE")
|
||||||
private LocalDateTime submissionDate;
|
private LocalDateTime submissionDate;
|
||||||
@@ -39,4 +38,8 @@ public class ApplicationEntity extends BaseEntity {
|
|||||||
|
|
||||||
@Column(name = "HUB_ID")
|
@Column(name = "HUB_ID")
|
||||||
private Long hubId;
|
private Long hubId;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "USER_WITH_COMPANY_ID")
|
||||||
|
private UserWithCompanyEntity userWithCompany;
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,11 @@ public class BeneficiaryPreferredCallEntity extends BaseEntity{
|
|||||||
|
|
||||||
@Column(name = "STATUS", length = 255)
|
@Column(name = "STATUS", length = 255)
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
@Column(name="IS_DELETED")
|
@Column(name="IS_DELETED")
|
||||||
private Boolean isDeleted;
|
private Boolean isDeleted;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "USER_WITH_COMPANY_ID")
|
||||||
|
private UserWithCompanyEntity userWithCompany;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,5 +45,9 @@ public class FaqEntity extends BaseEntity {
|
|||||||
@Column(name ="COMPANY_ID")
|
@Column(name ="COMPANY_ID")
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "USER_WITH_COMPANY_ID")
|
||||||
|
private UserWithCompanyEntity userWithCompany;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package net.gepafin.tendermanagement.entities;
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.*;
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -28,4 +26,7 @@ public class UserCompanyDelegationEntity extends BaseEntity{
|
|||||||
@Column(name="STATUS")
|
@Column(name="STATUS")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "USER_WITH_COMPANY_ID")
|
||||||
|
private UserWithCompanyEntity userWithCompany;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class BeneficiaryPreferredCallResponseBean {
|
|||||||
private BeneficiaryCallStatus status;
|
private BeneficiaryCallStatus status;
|
||||||
private LocalDateTime createdDate;
|
private LocalDateTime createdDate;
|
||||||
private LocalDateTime updatedDate;
|
private LocalDateTime updatedDate;
|
||||||
|
private Long userWithCompanyId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,15 +24,17 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
|||||||
|
|
||||||
public Optional<ApplicationEntity> findByIdAndUserIdAndIsDeletedFalse(Long id,Long userId);
|
public Optional<ApplicationEntity> findByIdAndUserIdAndIsDeletedFalse(Long id,Long userId);
|
||||||
|
|
||||||
Optional<ApplicationEntity> findByUserIdAndCompanyIdAndCallIdAndIsDeletedFalse(Long userId, Long companyId, Long callId);
|
Optional<ApplicationEntity> findByUserIdAndUserWithCompanyIdAndCallIdAndIsDeletedFalse(Long userId, Long userWithCompanyId, Long callId);
|
||||||
|
|
||||||
public Optional<ApplicationEntity> findByIdAndUserIdAndCallIdAndIsDeletedFalse(Long applicationId, Long userId,
|
public Optional<ApplicationEntity> findByIdAndUserIdAndCallIdAndIsDeletedFalse(Long applicationId, Long userId,
|
||||||
Long callId);
|
Long callId);
|
||||||
|
|
||||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.userId = :userId AND a.company.id = :companyId AND a.status = 'SUBMIT' AND a.isDeleted = false")
|
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.userId = :userId AND a.userWithCompany.id = :userWithCompanyId AND a.status = 'SUBMIT' AND a.isDeleted = false")
|
||||||
Long countSubmittedApplicationsByUserId(@Param("userId") Long userId, @Param("companyId") Long companyId);
|
Long countSubmittedApplicationsByUserId(@Param("userId") Long userId, @Param("userWithCompanyId") Long userWithCompanyId);
|
||||||
|
|
||||||
|
|
||||||
|
List<ApplicationEntity> findByUserWithCompanyIdAndUserIdAndIsDeletedFalse(Long userWithCompanyId, Long userId);
|
||||||
|
|
||||||
List<ApplicationEntity> findByCompanyIdAndUserIdAndIsDeletedFalse(Long companyId,Long userId);
|
|
||||||
|
|
||||||
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.status = 'SUBMIT' And a.hubId = :hubId AND a.isDeleted = false")
|
@Query("SELECT COUNT(a) FROM ApplicationEntity a WHERE a.status = 'SUBMIT' And a.hubId = :hubId AND a.isDeleted = false")
|
||||||
public Long countSubmittedApplicationsByHubId(@Param("hubId") Long hubId);
|
public Long countSubmittedApplicationsByHubId(@Param("hubId") Long hubId);
|
||||||
|
|||||||
@@ -13,12 +13,17 @@ public interface BeneficiaryPreferredCallRepository extends JpaRepository<Benefi
|
|||||||
List<BeneficiaryPreferredCallEntity> findByBeneficiaryIdAndIsDeletedFalse(Long beneficiaryId);
|
List<BeneficiaryPreferredCallEntity> findByBeneficiaryIdAndIsDeletedFalse(Long beneficiaryId);
|
||||||
List<BeneficiaryPreferredCallEntity> findByUserIdAndIsDeletedFalse(Long userId);
|
List<BeneficiaryPreferredCallEntity> findByUserIdAndIsDeletedFalse(Long userId);
|
||||||
|
|
||||||
@Query("SELECT preferredCall FROM BeneficiaryPreferredCallEntity preferredCall where preferredCall.userId=:userId AND (:companyId is null OR preferredCall.companyId=:companyId) AND isDeleted=false")
|
@Query("SELECT preferredCall FROM BeneficiaryPreferredCallEntity preferredCall WHERE preferredCall.userId = :userId AND (:userWithCompanyId IS NULL OR preferredCall.userWithCompany.id = :userWithCompanyId) AND isDeleted = false")
|
||||||
List<BeneficiaryPreferredCallEntity> findByUserIdAndCompanyIdAndIsDeletedFalse(@Param("userId") Long userId, @Param("companyId") Long companyId);
|
List<BeneficiaryPreferredCallEntity> findByUserIdAndUserWithCompanyIdAndIsDeletedFalse(@Param("userId") Long userId, @Param("userWithCompanyId") Long userWithCompanyId);
|
||||||
|
|
||||||
List<BeneficiaryPreferredCallEntity> findByBeneficiaryIdAndCompanyId(Long beneficiaryId,Long companyId);
|
List<BeneficiaryPreferredCallEntity> findByBeneficiaryIdAndCompanyId(Long beneficiaryId,Long companyId);
|
||||||
|
|
||||||
List<BeneficiaryPreferredCallEntity> findByUserIdAndCallIdInAndIsDeletedFalse(Long userId, List<Long> callIds);
|
List<BeneficiaryPreferredCallEntity> findByUserIdAndCallIdInAndIsDeletedFalse(Long userId, List<Long> callIds);
|
||||||
|
|
||||||
Optional<BeneficiaryPreferredCallEntity> findByIdAndIsDeletedFalse(Long id);
|
Optional<BeneficiaryPreferredCallEntity> findByIdAndIsDeletedFalse(Long id);
|
||||||
Optional<BeneficiaryPreferredCallEntity> findByUserIdAndCallIdAndCompanyIdAndIsDeletedFalse(Long userId, Long callId, Long companyId);
|
|
||||||
List<BeneficiaryPreferredCallEntity> findByUserIdAndCallIdInAndCompanyIdAndIsDeletedFalse(Long userId, List<Long> callIds,Long companyId);
|
Optional<BeneficiaryPreferredCallEntity> findByUserIdAndCallIdAndUserWithCompanyIdAndIsDeletedFalse(Long userId, Long callId, Long userWithCompanyId);
|
||||||
|
|
||||||
|
List<BeneficiaryPreferredCallEntity> findByUserIdAndCallIdInAndUserWithCompanyIdAndIsDeletedFalse(Long userId, List<Long> callIds, Long userWithCompanyId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public interface FaqRepository extends JpaRepository<FaqEntity, Long> {
|
|||||||
List<FaqEntity> findByCallIdAndIsDeletedFalse(Long callId);
|
List<FaqEntity> findByCallIdAndIsDeletedFalse(Long callId);
|
||||||
|
|
||||||
Optional<FaqEntity> findByIdAndCallIdAndIsDeletedFalse(Long id, Long callId);
|
Optional<FaqEntity> findByIdAndCallIdAndIsDeletedFalse(Long id, Long callId);
|
||||||
List<FaqEntity> findByCompanyIdAndUserIdAndIsDeletedFalse(Long companyId,Long userId);
|
|
||||||
|
List<FaqEntity> findByUserWithCompanyIdAndIsDeletedFalse(Long userWithCompanyId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface UserCompanyDelegationRepository extends JpaRepository<UserCompanyDelegationEntity, Long> {
|
public interface UserCompanyDelegationRepository extends JpaRepository<UserCompanyDelegationEntity, Long> {
|
||||||
|
|
||||||
UserCompanyDelegationEntity findByUserIdAndCompanyIdAndStatus(Long userId, Long companyId, String status);
|
UserCompanyDelegationEntity findByUserIdAndUserWithCompanyIdAndStatus(Long userId, Long userWithCompanyId, String status);
|
||||||
|
|
||||||
@Query("SELECT d FROM UserCompanyDelegationEntity d where d.status = :status")
|
@Query("SELECT d FROM UserCompanyDelegationEntity d where d.status = :status")
|
||||||
List<UserCompanyDelegationEntity> findAllByStatus(@Param("status") String status);
|
List<UserCompanyDelegationEntity> findAllByStatus(@Param("status") String status);
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ public interface CompanyService {
|
|||||||
|
|
||||||
UserWithCompanyEntity validateUserWithCompny(Long userId, Long companyId);
|
UserWithCompanyEntity validateUserWithCompny(Long userId, Long companyId);
|
||||||
|
|
||||||
|
UserWithCompanyEntity getUserWithCompany(Long userId, Long companyId);
|
||||||
|
|
||||||
ByteArrayOutputStream downloadCompanyDelegation(HttpServletRequest request, Long companyId, CompanyDelegationRequest companyDelegationRequest);
|
ByteArrayOutputStream downloadCompanyDelegation(HttpServletRequest request, Long companyId, CompanyDelegationRequest companyDelegationRequest);
|
||||||
|
|
||||||
CompanyDelegationResponse uploadCompanyDelegation(HttpServletRequest request, Long companyId, MultipartFile file);
|
CompanyDelegationResponse uploadCompanyDelegation(HttpServletRequest request, Long companyId, MultipartFile file);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class ApplicationServiceImpl implements ApplicationService {
|
|||||||
public NextOrPreviousFormResponse getNextOrPreviousForm(HttpServletRequest request, Long applicationId, Long formId,
|
public NextOrPreviousFormResponse getNextOrPreviousForm(HttpServletRequest request, Long applicationId, Long formId,
|
||||||
FormActionEnum action) {
|
FormActionEnum action) {
|
||||||
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
||||||
validator.validateUserWithCompany(request, applicationEntity.getCompany().getId());
|
validator.validateUserWithCompany(request, applicationEntity.getCompanyId());
|
||||||
return flowFormDao.getNextOrPreviousForm(applicationEntity, formId, action);
|
return flowFormDao.getNextOrPreviousForm(applicationEntity, formId, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,10 @@ public class CompanyServiceImpl implements CompanyService {
|
|||||||
public UserWithCompanyEntity validateUserWithCompny(Long userId, Long companyId) {
|
public UserWithCompanyEntity validateUserWithCompny(Long userId, Long companyId) {
|
||||||
return companyDao.validateUserWithCompny(userId, companyId);
|
return companyDao.validateUserWithCompny(userId, companyId);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public UserWithCompanyEntity getUserWithCompany(Long userId, Long companyId) {
|
||||||
|
return companyDao.getUserWithCompany(userId, companyId);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public ByteArrayOutputStream downloadCompanyDelegation(HttpServletRequest request, Long companyId, CompanyDelegationRequest companyDelegationRequest) {
|
public ByteArrayOutputStream downloadCompanyDelegation(HttpServletRequest request, Long companyId, CompanyDelegationRequest companyDelegationRequest) {
|
||||||
|
|||||||
@@ -1858,6 +1858,29 @@
|
|||||||
<addColumn tableName="application_evaluation">
|
<addColumn tableName="application_evaluation">
|
||||||
<column name="MOTIVATION" type="TEXT"></column>
|
<column name="MOTIVATION" type="TEXT"></column>
|
||||||
</addColumn>
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
|
<changeSet id="26-11-2024_1" author="Rajesh Khore">
|
||||||
|
<addColumn tableName="APPLICATION">
|
||||||
|
<column name="USER_WITH_COMPANY_ID" type="INTEGER">
|
||||||
|
<constraints foreignKeyName="fk_USER_WITH_COMPANY_APPLICATION" references="user_with_company(id)"/>
|
||||||
|
</column>
|
||||||
|
</addColumn>
|
||||||
|
<dropForeignKeyConstraint baseTableName="APPLICATION" constraintName="fk_COMPANY_APPLICATION"/>
|
||||||
|
<addColumn tableName="faq">
|
||||||
|
<column name="USER_WITH_COMPANY_ID" type="INTEGER">
|
||||||
|
<constraints foreignKeyName="fk_USER_WITH_COMPANY_faq" references="user_with_company(id)"/>
|
||||||
|
</column>
|
||||||
|
</addColumn>
|
||||||
|
<addColumn tableName="beneficiary_preferred_call">
|
||||||
|
<column name="USER_WITH_COMPANY_ID" type="INTEGER">
|
||||||
|
<constraints foreignKeyName="fk_USER_WITH_COMPANY_beneficiary_preferred_call" references="user_with_company(id)"/>
|
||||||
|
</column>
|
||||||
|
</addColumn>
|
||||||
|
<addColumn tableName="user_company_delegation">
|
||||||
|
<column name="USER_WITH_COMPANY_ID" type="INTEGER">
|
||||||
|
<constraints foreignKeyName="fk_USER_WITH_COMPANY_user_company_delegation" references="user_with_company(id)"/>
|
||||||
|
</column>
|
||||||
|
</addColumn>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
<changeSet id="22-11-2024_2" author="Piyush">
|
<changeSet id="22-11-2024_2" author="Piyush">
|
||||||
|
|||||||
Reference in New Issue
Block a user