Done ticket GEPAFINBE-102
This commit is contained in:
@@ -292,5 +292,6 @@ public class GepafinConstant {
|
||||
public static final String ENCRYPT_KEY = "U2VjdXJlRW5jcnlwdEtleQ==";
|
||||
public static final String APPLICATION_DOCUMENTS_NOT_FOUND_MSG = "application.documents.not.found";
|
||||
public static final String DUPLICATE_BENEFICIARY_CALL = "beneficiary.call.duplicate";
|
||||
public static final String USER_MUST_BE_ASSOCIATED_WITH_COMPANY="user.must.be.associated.with.company.to.create.application";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.dao.ApplicationDao;
|
||||
import net.gepafin.tendermanagement.dao.FlowFormDao;
|
||||
import net.gepafin.tendermanagement.entities.ApplicationEntity;
|
||||
@@ -17,6 +19,8 @@ import net.gepafin.tendermanagement.model.response.ApplicationSignedDocumentResp
|
||||
import net.gepafin.tendermanagement.model.response.NextOrPreviousFormResponse;
|
||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -64,6 +68,9 @@ public class ApplicationServiceImpl implements ApplicationService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApplicationResponse createApplication(HttpServletRequest request, Long companyId, ApplicationRequest applicationRequest, Long callId) {
|
||||
UserEntity userEntity = validator.validateUser(request);
|
||||
if(companyId==null){
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.USER_MUST_BE_ASSOCIATED_WITH_COMPANY));
|
||||
}
|
||||
CompanyEntity companyEntity = validator.validateUserWithCompany(request, companyId);
|
||||
validator.validateUserWithCall(userEntity, callId);
|
||||
return applicationDao.createApplicationByCallId(companyEntity, applicationRequest, callId, userEntity);
|
||||
|
||||
@@ -99,7 +99,7 @@ public interface ApplicationApi {
|
||||
@PostMapping(value = "/call/{callId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<ApplicationResponse>> createApplicationByCallId(HttpServletRequest request,
|
||||
@Parameter(description = "The company ID", required = true) @RequestParam(value = "companyId", required = true) Long companyId,
|
||||
@Parameter(description = "The company ID") @RequestParam(value = "companyId", required = false) Long companyId,
|
||||
@Parameter(description = " Flow request object", required = true) @Valid @RequestBody ApplicationRequest applicationRequest,
|
||||
@Parameter(description = "The call ID", required = true) @PathVariable("callId") Long callId);
|
||||
|
||||
|
||||
@@ -308,3 +308,4 @@ invalid.amendment.for.comment = Invalid Amendment Request for the Given Comment.
|
||||
DD_MM_YYYY_HH_MM = dd_MM_yyyy HH:mm
|
||||
application.documents.not.found=No documents found for the application.
|
||||
beneficiary.call.duplicate = A preferred call with this call ID and company ID already exists for this user.
|
||||
user.must.be.associated.with.company.to.create.application=You must be associated with a company to apply for this application.
|
||||
|
||||
@@ -303,3 +303,4 @@ beneficiary.email.not.found.msg=L'indirizzo email per il beneficiario non <20> st
|
||||
reminder.email.sent.success.msg=Email di promemoria inviata con successo!
|
||||
application.documents.not.found=Nessun documento trovato per la domanda.
|
||||
beneficiary.call.duplicate = Una chiamata preferita con questo ID di chiamata e ID azienda esiste gi<67> per questo utente.
|
||||
user.must.be.associated.with.company.to.create.application=Devi essere associato a un'azienda per poter presentare domanda per questa applicazione.
|
||||
|
||||
Reference in New Issue
Block a user