Merge pull request #388 from Kitzanos/feature/GEPAFINBE-6233/6268-prod
Cherry-pick ( GEPAFINBE- 6233 & GEPAFINBE-6268) Gestione Aziende Costituende Possibilità di rifiutare pec
This commit is contained in:
@@ -14,7 +14,7 @@ public class MessageSourceConfig {
|
||||
public ResourceBundleMessageSource messageSource() {
|
||||
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
|
||||
messageSource.setBasenames("message");
|
||||
messageSource.setDefaultEncoding("UTF-8");
|
||||
messageSource.setDefaultEncoding("ISO-8859-1");
|
||||
messageSource.setUseCodeAsDefaultMessage(true);
|
||||
return messageSource;
|
||||
}
|
||||
|
||||
@@ -23,10 +23,22 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
|
||||
@Value("${spring.rabbitmq.password}")
|
||||
private String clientPassword;
|
||||
|
||||
@Value("${rabbitmq.enabled:false}")
|
||||
private boolean rabbitmqEnabled;
|
||||
|
||||
@Override
|
||||
public void configureMessageBroker(MessageBrokerRegistry config) {
|
||||
|
||||
config.enableStompBrokerRelay("/topic").setRelayHost(relayHost).setRelayPort(relayPort).setClientLogin(clientUserName).setClientPasscode(clientPassword);
|
||||
if (rabbitmqEnabled) {
|
||||
// Use external RabbitMQ broker
|
||||
config.enableStompBrokerRelay("/topic")
|
||||
.setRelayHost(relayHost)
|
||||
.setRelayPort(relayPort)
|
||||
.setClientLogin(clientUserName)
|
||||
.setClientPasscode(clientPassword);
|
||||
} else {
|
||||
// Use in-memory simple broker
|
||||
config.enableSimpleBroker("/topic");
|
||||
}
|
||||
config.setApplicationDestinationPrefixes("/app");
|
||||
}
|
||||
|
||||
|
||||
@@ -199,6 +199,7 @@ public class GepafinConstant {
|
||||
public static final String VALIDATION_ERROR_FILE_EMPTY = "validation.error.file.empty";
|
||||
public static final String VALIDATION_ERROR_FILE_INVALIDTYPE = "validation.error.file.invalidType";
|
||||
public static final String UPLOAD_ERROR_S3 = "upload.error.s3";
|
||||
public static final String VAT_OR_TAX_CODE_REQUIRED = "vat.or.tax.code.required";
|
||||
|
||||
public static final String CALL_NOT_STARTED_YET = "call.not.started.yet";
|
||||
public static final String CALL_ALREADY_ENDED = "call.already.ended";
|
||||
@@ -633,12 +634,13 @@ public class GepafinConstant {
|
||||
public static final String APPLICATION_NOT_APPROVED="application.not.approved";
|
||||
public static final String SUBJECT_AND_BODY_REQUIRED="subject.body.required";
|
||||
public static final String MAIL_SENT_SUCCESSFULLY="mail.send.successfully";
|
||||
public static final String PEC_EMAIL_REJECTED_SUCCESSFULLY="pec.email.rejected.successfully";
|
||||
public static final String EMAIL_LOG_FETCHED="email.log.fetched";
|
||||
public static final String APPLICATION_AMENDMENT_APPROPIATE_STATUS="amendment.appropiate.status";
|
||||
public static final String UPLOAD_COMPANY_DOCUMENT_TO_APPLICATION_MSG="upload.company.document.to.application";
|
||||
public static final String COMPANY_DOCUMENT_NOT_FOUND_WITH_IDS="company.document.not.found.with.ids";
|
||||
public static final String REQUIRED_AMOUNT_FIELD_NOT_PROVIDED = "amount.field.not.provided";
|
||||
|
||||
public static final String PLEASE_PROVIDE_VALID_VAT_NUMBER="provide.valid.vat.number";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -163,6 +163,9 @@ public class AppointmentDao {
|
||||
|
||||
NdgResponse ndgResponse = new NdgResponse();
|
||||
CompanyEntity company = companyService.validateCompany(application.getCompanyId());
|
||||
if(Boolean.FALSE.equals(company.getValidVat())){
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,Translator.toLocale(GepafinConstant.PLEASE_PROVIDE_VALID_VAT_NUMBER));
|
||||
}
|
||||
NdganagEntity ndganagEntity = ndganagRepository.findByVatNumber(company.getVatNumber());
|
||||
if (ndganagEntity != null && ndganagEntity.getNdg() != null) {
|
||||
ndgResponse.setNdg(ndganagEntity.getNdg());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import net.gepafin.tendermanagement.model.util.NanoIdUtils;
|
||||
import org.springframework.data.domain.Pageable; // Correct package
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -69,13 +70,26 @@ public class CompanyDao {
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
@Autowired
|
||||
private VatCheckDao vatCheckDao;
|
||||
|
||||
|
||||
private static final String NOT_FOUND_JSON = "{\"data\": \"not found\"}";
|
||||
|
||||
public CompanyResponse createCompany(UserEntity userEntity, CompanyRequest companyRequest) {
|
||||
|
||||
log.info("Initiating company creation by userId: {}", userEntity.getId());
|
||||
CompanyEntity existingCompany = companyRepository.findByVatNumberAndHubId(companyRequest.getVatNumber(), userEntity.getHub().getId());
|
||||
Boolean validVat=Boolean.FALSE;
|
||||
if(companyRequest.getVatNumber()!=null){
|
||||
VatCheckResponseBean vatCheckResponseBean=vatCheckDao.checkVatNumber(companyRequest.getVatNumber(), userEntity.getHub().getId());
|
||||
if(vatCheckResponseBean!=null && Boolean.TRUE.equals(vatCheckResponseBean.getValid())){
|
||||
validVat=Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
CompanyEntity existingCompany = null;
|
||||
if (!StringUtils.isEmpty(companyRequest.getVatNumber())) {
|
||||
existingCompany = companyRepository.findByVatNumberAndHubId(companyRequest.getVatNumber(), userEntity.getHub().getId());
|
||||
}
|
||||
UserWithCompanyEntity userWithCompanyEntity = null;
|
||||
if (existingCompany != null) {
|
||||
UserWithCompanyEntity existingRelation = userWithCompanyRepository.findByUserIdAndCompanyIdAndIsDeletedFalse(userEntity.getId(), existingCompany.getId()).orElse(null);
|
||||
@@ -93,6 +107,7 @@ public class CompanyDao {
|
||||
} else {
|
||||
validateCompany(userEntity, companyRequest);
|
||||
CompanyEntity companyEntity = convertCompanyRequestToCompanyEntity(userEntity, companyRequest);
|
||||
companyEntity.setValidVat(validVat);
|
||||
CompanyEntity companyData = companyRepository.save(companyEntity);
|
||||
|
||||
/** This code is responsible for adding a version history log for "creating company" operation. **/
|
||||
@@ -112,12 +127,16 @@ public class CompanyDao {
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||
Translator.toLocale(GepafinConstant.INVALID_EMAIL));
|
||||
}
|
||||
if (StringUtils.isEmpty(companyRequest.getVatNumber())) {
|
||||
// At least one identifier required
|
||||
if (StringUtils.isEmpty(companyRequest.getVatNumber())
|
||||
&& StringUtils.isEmpty(companyRequest.getCodiceFiscale())) {
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||
Translator.toLocale(GepafinConstant.VATNUMBER_MANDATORY));
|
||||
Translator.toLocale(GepafinConstant.VAT_OR_TAX_CODE_REQUIRED));
|
||||
}
|
||||
if (companyRepository.existsByVatNumberAndHubId(companyRequest.getVatNumber(), userEntity.getHub().getId())) {
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||
// Only check VAT uniqueness if VAT provided
|
||||
if (!StringUtils.isEmpty(companyRequest.getVatNumber())
|
||||
&& companyRepository.existsByVatNumberAndHubId(companyRequest.getVatNumber(), userEntity.getHub().getId())) {
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||
Translator.toLocale(GepafinConstant.VATNUMBER_ALREADY_EXISTS));
|
||||
}
|
||||
}
|
||||
@@ -140,7 +159,7 @@ public class CompanyDao {
|
||||
UserWithCompanyEntity userWithCompany = userWithCompanyRepository.save(userWithCompanyEntity);
|
||||
/** This code is responsible for adding a version history log for the "adding user with company" operation. **/
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.INSERT).oldData(null).newData(userWithCompany).build());
|
||||
if (StringUtils.isEmpty(companyEntity.getJson())) {
|
||||
if (StringUtils.isEmpty(companyEntity.getJson()) && companyRequest.getVatCheckResponse() != null) {
|
||||
companyEntity.setJson(Utils.convertMapIntoJsonString(companyRequest.getVatCheckResponse()));
|
||||
updateCodiceAtecoFieldWithNewJson(companyEntity);
|
||||
companyEntity = companyRepository.save(companyEntity);
|
||||
@@ -161,7 +180,11 @@ public class CompanyDao {
|
||||
private CompanyEntity convertCompanyRequestToCompanyEntity(UserEntity userEntity, CompanyRequest request) {
|
||||
CompanyEntity entity = new CompanyEntity();
|
||||
entity.setCompanyName(request.getCompanyName());
|
||||
entity.setVatNumber(request.getVatNumber());
|
||||
if(request.getVatNumber()==null){
|
||||
entity.setVatNumber(NanoIdUtils.randomNanoId());
|
||||
}else {
|
||||
entity.setVatNumber(request.getVatNumber());
|
||||
}
|
||||
entity.setCodiceFiscale(request.getCodiceFiscale());
|
||||
entity.setAddress(request.getAddress());
|
||||
entity.setPhoneNumber(request.getPhoneNumber());
|
||||
@@ -182,7 +205,11 @@ public class CompanyDao {
|
||||
CompanyResponse response = new CompanyResponse();
|
||||
response.setId(entity.getId());
|
||||
response.setCompanyName(entity.getCompanyName());
|
||||
response.setVatNumber(entity.getVatNumber());
|
||||
if(entity.getVatNumber()==null){
|
||||
response.setVatNumber(entity.getCodiceFiscale());
|
||||
}else {
|
||||
response.setVatNumber(entity.getVatNumber());
|
||||
}
|
||||
response.setCodiceFiscale(entity.getCodiceFiscale());
|
||||
response.setAddress(entity.getAddress());
|
||||
response.setPhoneNumber(entity.getPhoneNumber());
|
||||
@@ -202,6 +229,7 @@ public class CompanyDao {
|
||||
response.setUpdatedDate(entity.getUpdatedDate());
|
||||
response.setContactName(userWithCompanyEntity.getContactName());
|
||||
response.setContactEmail(userWithCompanyEntity.getContactEmail());
|
||||
response.setValidVat(entity.getValidVat());
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -222,15 +250,27 @@ public class CompanyDao {
|
||||
setIfUpdated(companyEntity::getCountry, companyEntity::setCountry, companyRequest.getCountry());
|
||||
setIfUpdated(companyEntity::getNumberOfEmployees, companyEntity::setNumberOfEmployees, companyRequest.getNumberOfEmployees());
|
||||
setIfUpdated(companyEntity::getAnnualRevenue, companyEntity::setAnnualRevenue, companyRequest.getAnnualRevenue());
|
||||
//
|
||||
// if(StringUtils.isNotBlank(companyRequest.getVatNumber())) {
|
||||
// CompanyEntity existingCompany = companyRepository.findByVatNumberAndHubId(companyRequest.getVatNumber(), userEntity.getHub().getId());
|
||||
// if(existingCompany!=null){
|
||||
// throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.VATNUMBER_ALREADY_EXISTS));
|
||||
// }
|
||||
// companyEntity.setVatNumber(companyRequest.getVatNumber());
|
||||
//
|
||||
// }
|
||||
|
||||
// Same VAT logic as updateCompanyVatNumber: run VAT check, set validVat, json, and codiceAteco when vatNumber is provided
|
||||
if (StringUtils.isNotBlank(companyRequest.getVatNumber())) {
|
||||
Long hubId = userEntity.getHub().getId();
|
||||
CompanyEntity existingCompany = companyRepository.findByVatNumberAndHubId(companyRequest.getVatNumber(), hubId);
|
||||
if (existingCompany != null) {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.VATNUMBER_ALREADY_EXISTS));
|
||||
}
|
||||
VatCheckResponseBean vatCheckResponseBean = vatCheckDao.checkVatNumber(companyRequest.getVatNumber(), hubId);
|
||||
Boolean validVat = Boolean.FALSE;
|
||||
if (vatCheckResponseBean != null && Boolean.TRUE.equals(vatCheckResponseBean.getValid())) {
|
||||
validVat = Boolean.TRUE;
|
||||
}
|
||||
companyEntity.setVatNumber(companyRequest.getVatNumber());
|
||||
companyEntity.setValidVat(validVat);
|
||||
if (vatCheckResponseBean != null && vatCheckResponseBean.getVatCheckResponse() != null) {
|
||||
companyEntity.setJson(Utils.convertMapIntoJsonString(vatCheckResponseBean.getVatCheckResponse()));
|
||||
updateCodiceAtecoFieldWithNewJson(companyEntity);
|
||||
}
|
||||
}
|
||||
|
||||
companyRepository.save(companyEntity);
|
||||
log.info("Company updated and saved. companyId: {}", companyEntity.getId());
|
||||
|
||||
@@ -261,6 +301,40 @@ public class CompanyDao {
|
||||
return convertCompanyEntityToCompanyResponse(companyEntity, userWithCompanyEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates only the VAT number for the given company: runs VAT check, sets validVat and json (vat check response), and updates codiceAteco from response.
|
||||
*/
|
||||
public CompanyResponse updateCompanyVatNumber(UserEntity userEntity, Long companyId, String vatNumber) {
|
||||
log.info("Updating company VAT number. companyId: {}, userId: {}", companyId, userEntity.getId());
|
||||
if (StringUtils.isBlank(vatNumber)) {
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.VAT_OR_TAX_CODE_REQUIRED));
|
||||
}
|
||||
CompanyEntity companyEntity = validateCompany(companyId);
|
||||
Long hubId = userEntity.getHub().getId();
|
||||
CompanyEntity existingCompany = companyRepository.findByVatNumberAndHubId(vatNumber, hubId);
|
||||
if (existingCompany != null && !existingCompany.getId().equals(companyId)) {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.VATNUMBER_ALREADY_EXISTS));
|
||||
}
|
||||
VatCheckResponseBean vatCheckResponseBean = vatCheckDao.checkVatNumber(vatNumber, hubId);
|
||||
Boolean validVat = Boolean.FALSE;
|
||||
if (vatCheckResponseBean != null && Boolean.TRUE.equals(vatCheckResponseBean.getValid())) {
|
||||
validVat = Boolean.TRUE;
|
||||
}
|
||||
CompanyEntity oldCompanyData = Utils.getClonedEntityForData(companyEntity);
|
||||
companyEntity.setVatNumber(vatNumber);
|
||||
companyEntity.setValidVat(validVat);
|
||||
if (vatCheckResponseBean != null && vatCheckResponseBean.getVatCheckResponse() != null) {
|
||||
companyEntity.setJson(Utils.convertMapIntoJsonString(vatCheckResponseBean.getVatCheckResponse()));
|
||||
updateCodiceAtecoFieldWithNewJson(companyEntity);
|
||||
}
|
||||
companyRepository.save(companyEntity);
|
||||
log.info("Company VAT number updated and saved. companyId: {}", companyEntity.getId());
|
||||
loggingUtil.addVersionHistory(
|
||||
VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.UPDATE).oldData(oldCompanyData).newData(companyEntity).build());
|
||||
UserWithCompanyEntity userWithCompanyEntity = getUserWithCompany(userEntity.getId(), companyId);
|
||||
return convertCompanyEntityToCompanyResponse(companyEntity, userWithCompanyEntity);
|
||||
}
|
||||
|
||||
public CompanyEntity validateCompany(Long companyId) {
|
||||
log.info("Validating company. companyId: {}", companyId);
|
||||
return companyRepository.findById(companyId).orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.gepafin.tendermanagement.repositories.EmailLogRepository;
|
||||
import net.gepafin.tendermanagement.repositories.UserActionsRepository;
|
||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||
import net.gepafin.tendermanagement.service.CallService;
|
||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
@@ -24,6 +25,7 @@ import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -74,6 +76,21 @@ public class PecMailDao {
|
||||
return pecMailResponses;
|
||||
}
|
||||
|
||||
public PecMailResponse rejectPecMail(HttpServletRequest request, Long userActionId, String motivation) {
|
||||
List<EmailLogEntity> emailLogs = getEmailLogEntities(request, userActionId);
|
||||
LocalDateTime rejectedAt = DateTimeUtil.DateServerToUTC(LocalDateTime.now());
|
||||
for (EmailLogEntity log : emailLogs) {
|
||||
log.setSendStatus(StatusTypeEnum.REJECTED.getValue());
|
||||
log.setMotivation(motivation);
|
||||
log.setSendDateTime(rejectedAt);
|
||||
}
|
||||
emailLogRepository.saveAll(emailLogs);
|
||||
EmailLogEntity firstLog = emailLogs.get(0);
|
||||
ApplicationEntity applicationEntity = applicationService.validateApplication(firstLog.getApplicationId());
|
||||
String callName = applicationEntity.getCall().getName();
|
||||
return createPecMailResponse(firstLog.getUserAction().getId(), firstLog, callName);
|
||||
}
|
||||
|
||||
private List<EmailLogEntity> getEmailLogEntities(HttpServletRequest request, Long userActionId) {
|
||||
UserActionEntity userActionEntity = userActionsRepository.findUserActionByIdAndIsDeletedFalse(userActionId);
|
||||
if (userActionEntity == null) {
|
||||
@@ -117,6 +134,7 @@ public class PecMailDao {
|
||||
pecEmailLogResponse.setSubject(emailLogEntity.getEmailSubject());
|
||||
pecEmailLogResponse.setHtmlContent(emailLogEntity.getEmailBody());
|
||||
pecEmailLogResponse.setCallId(emailLogEntity.getCallId());
|
||||
pecEmailLogResponse.setMotivation(emailLogEntity.getMotivation());
|
||||
return pecEmailLogResponse;
|
||||
}
|
||||
private PecMailResponse createPecMailResponse(Long userActionId, EmailLogEntity emailLogEntity, String callName) {
|
||||
|
||||
@@ -64,4 +64,7 @@ public class CompanyEntity extends BaseEntity{
|
||||
|
||||
@Column(name = "PEC")
|
||||
private String pec;
|
||||
|
||||
@Column(name = "VALID_VAT")
|
||||
private Boolean validVat;
|
||||
}
|
||||
|
||||
@@ -62,5 +62,8 @@ public class EmailLogEntity extends BaseEntity{
|
||||
|
||||
@Column(name = "ATTACHMENTS")
|
||||
private String attachments;
|
||||
|
||||
@Column(name = "MOTIVATION", columnDefinition = "TEXT")
|
||||
private String motivation;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
public enum StatusTypeEnum {
|
||||
PENDING ("PENDING"),
|
||||
SUCCESS ("SUCCESS"),
|
||||
FAILED("FAILED");
|
||||
FAILED("FAILED"),
|
||||
REJECTED("REJECTED");
|
||||
|
||||
private String value;
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ public enum UserActionContextEnum {
|
||||
CREATE_COMPANY("CREATE_COMPANY"),
|
||||
GET_COMPANY("GET_COMPANY"),
|
||||
UPDATE_COMPANY("UPDATE_COMPANY"),
|
||||
UPDATE_COMPANY_VAT_NUMBER("UPDATE_COMPANY_VAT_NUMBER"),
|
||||
DELETE_COMPANY("DELETE_COMPANY"),
|
||||
UPLOAD_COMPANY_DELEGATION("UPLOAD_COMPANY_DELEGATION"),
|
||||
DOWNLOAD_COMPANY_DELEGATION_TEMPLATE("DOWNLOAD_COMPANY_DELEGATION_TEMPLATE"),
|
||||
@@ -231,6 +232,7 @@ public enum UserActionContextEnum {
|
||||
FETCH_APPLICATION_CONTRACT_BY_APPLICATION_ID("FETCH_APPLICATION_CONTRACT_BY_APPLICATION_ID"),
|
||||
FETCH_APPLICATION_CONTRACT_BY_BENEFICIARY_USER_ID("FETCH_APPLICATION_CONTRACT_BY_BENEFICIARY_USER_ID"),
|
||||
SEND_PEC_MAIL("SEND_PEC_MAIL"),
|
||||
REJECT_PEC_MAIL("REJECT_PEC_MAIL"),
|
||||
FETCH_EMAIL_LOG("FETCH_EMAIL_LOG"),
|
||||
FETCH_ALL_EMAIL_LOG("FETCH_ALL_EMAIL_LOG"),
|
||||
UPLOAD_COMPANY_DOCUMENT_TO_APPLICATION("UPLOAD_COMPANY_DOCUMENT_TO_APPLICATION");
|
||||
|
||||
@@ -25,4 +25,5 @@ public class CompanyResponse extends BaseBean{
|
||||
private String contactName;
|
||||
private String contactEmail;
|
||||
private String codiceAteco;
|
||||
private Boolean validVat;
|
||||
}
|
||||
|
||||
@@ -27,4 +27,6 @@ public class PecEmailLogResponse {
|
||||
|
||||
private Long callId;
|
||||
|
||||
private String motivation;
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ public interface CompanyService {
|
||||
|
||||
CompanyResponse updateCompany(HttpServletRequest request, Long companyId, CompanyRequest companyRequest);
|
||||
|
||||
CompanyResponse updateCompanyVatNumber(HttpServletRequest request, Long companyId, String vatNumber);
|
||||
|
||||
CompanyResponse getCompany(HttpServletRequest request, Long companyId);
|
||||
|
||||
void deleteCompany(HttpServletRequest request, Long companyId);
|
||||
|
||||
@@ -10,6 +10,8 @@ public interface PecMailService {
|
||||
|
||||
public List<PecMailResponse> sendPecMail(HttpServletRequest request, List<Long> userActionIds);
|
||||
|
||||
public PecMailResponse rejectPecMail(HttpServletRequest request, Long userActionId, String motivation);
|
||||
|
||||
public List<PecEmailLogResponse> getEmailLogByUserActionId(HttpServletRequest request, Long userActionId);
|
||||
|
||||
public List<PecMailResponse> getAllEmailLogs(HttpServletRequest request);
|
||||
|
||||
@@ -56,6 +56,14 @@ public class CompanyServiceImpl implements CompanyService {
|
||||
validator.validateUserWithCompany(request, companyId);
|
||||
return companyDao.updateCompany(userEntity, companyId, companyRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CompanyResponse updateCompanyVatNumber(HttpServletRequest request, Long companyId, String vatNumber) {
|
||||
UserEntity userEntity = validator.validateUser(request);
|
||||
validator.validateUserWithCompany(request, companyId);
|
||||
return companyDao.updateCompanyVatNumber(userEntity, companyId, vatNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
|
||||
@@ -21,6 +21,11 @@ public class PecMailSerivceImpl implements PecMailService {
|
||||
return pecMailDao.sendPecMail(request,userActionIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PecMailResponse rejectPecMail(HttpServletRequest request, Long userActionId, String motivation) {
|
||||
return pecMailDao.rejectPecMail(request, userActionId, motivation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PecEmailLogResponse> getEmailLogByUserActionId(HttpServletRequest request, Long userActionId) {
|
||||
return pecMailDao.getEmailLogByUserActionId(request,userActionId);
|
||||
|
||||
@@ -55,6 +55,19 @@ public interface CompanyApi {
|
||||
@Parameter(description = "The company id", required = true) @PathVariable("companyId") Long companyId,
|
||||
@Parameter(description = "Company request object", required = true) @RequestBody CompanyRequest companyRequest);
|
||||
|
||||
@Operation(summary = "Api to update only company VAT number", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@PutMapping(value = "/{companyId}/vatNumber", produces = { "application/json" })
|
||||
ResponseEntity<Response<CompanyResponse>> updateCompanyVatNumber(HttpServletRequest request,
|
||||
@Parameter(description = "The company id", required = true) @PathVariable("companyId") Long companyId,
|
||||
@Parameter(description = "VAT number", required = true) @RequestParam("vatNumber") String vatNumber);
|
||||
|
||||
|
||||
@Operation(summary = "Api to delete company", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||
|
||||
@@ -31,6 +31,17 @@ public interface PecMailApi {
|
||||
ResponseEntity<Response< List<PecMailResponse>>> sendPecMail(HttpServletRequest request,
|
||||
@Parameter(description = "The user action id", required = true) @RequestParam("userActionIds") List<Long> userActionIds);
|
||||
|
||||
@Operation(summary = "Api to reject PEC email for a user action with motivation.", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.NOTFOUND_ERROR_EXAMPLE))),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE))),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.BADREQUEST_ERROR_EXAMPLE))) })
|
||||
@PostMapping(value = "/userAction/{userActionId}/reject", produces = "application/json")
|
||||
ResponseEntity<Response<PecMailResponse>> rejectPecMail(HttpServletRequest request,
|
||||
@Parameter(description = "The user action id", required = true) @PathVariable("userActionId") Long userActionId,
|
||||
@Parameter(description = "Motivation for rejection", required = true) @RequestParam("motivation") String motivation);
|
||||
|
||||
@Operation(summary = "Api to get email log by user action id", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
|
||||
@@ -73,6 +73,15 @@ public class CompanyApiController implements CompanyApi{
|
||||
.body(new Response<>(data, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_UPDATED_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<CompanyResponse>> updateCompanyVatNumber(HttpServletRequest request, Long companyId, String vatNumber) {
|
||||
log.info("Update company VAT number with companyId: {}, vatNumber: {}", companyId, vatNumber);
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.UPDATE_COMPANY_VAT_NUMBER).build());
|
||||
CompanyResponse data = companyService.updateCompanyVatNumber(request, companyId, vatNumber);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(data, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_UPDATED_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<CompanyResponse>> getCompany(HttpServletRequest request, Long companyId) {
|
||||
|
||||
|
||||
@@ -44,6 +44,17 @@ public class PecMailController implements PecMailApi {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<PecMailResponse>> rejectPecMail(HttpServletRequest request, Long userActionId, String motivation) {
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.EMAIL)
|
||||
.actionContext(UserActionContextEnum.REJECT_PEC_MAIL).build());
|
||||
|
||||
PecMailResponse pecMailResponse = pecMailService.rejectPecMail(request, userActionId, motivation);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(pecMailResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.PEC_EMAIL_REJECTED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<List<PecEmailLogResponse>>> getEmailLogByUserActionId(HttpServletRequest request, Long userActionId) {
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.EMAIL)
|
||||
|
||||
@@ -29,4 +29,6 @@ spring.rabbitmq.host=172.18.0.7
|
||||
spring.rabbitmq.port=61613
|
||||
spring.rabbitmq.username=guest
|
||||
spring.rabbitmq.password=guest
|
||||
spring.rabbitmq.virtual-host=/
|
||||
spring.rabbitmq.virtual-host=/
|
||||
|
||||
rabbitmq.enabled=false
|
||||
@@ -26,4 +26,5 @@ spring.rabbitmq.host=localhost
|
||||
spring.rabbitmq.port=61613
|
||||
spring.rabbitmq.username=guest
|
||||
spring.rabbitmq.password=guest
|
||||
spring.rabbitmq.virtual-host=/
|
||||
spring.rabbitmq.virtual-host=/
|
||||
rabbitmq.enabled=false
|
||||
@@ -38,4 +38,6 @@ spring.rabbitmq.username=guest
|
||||
spring.rabbitmq.password=guest
|
||||
spring.rabbitmq.virtual-host=/
|
||||
|
||||
isSviluppumbriaProtocolEnabled = false
|
||||
isSviluppumbriaProtocolEnabled = false
|
||||
|
||||
rabbitmq.enabled=true
|
||||
@@ -24,4 +24,5 @@ spring.rabbitmq.host=rabbitmq.bflows.ai
|
||||
spring.rabbitmq.port=61613
|
||||
spring.rabbitmq.username=guest
|
||||
spring.rabbitmq.password=guest
|
||||
spring.rabbitmq.virtual-host=/
|
||||
spring.rabbitmq.virtual-host=/
|
||||
rabbitmq.enabled=false
|
||||
@@ -3193,5 +3193,16 @@
|
||||
<column name="blue_tongue_field_2" type="numeric"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
<changeSet id="10-03-2026_RK_133852" author="Rajesh Khore">
|
||||
<addColumn tableName="company">
|
||||
<column name="valid_vat" type="BOOLEAN"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="10-03-2026_RK_184231" author="Rajesh Khore">
|
||||
<addColumn tableName="email_log">
|
||||
<column name="motivation" type="TEXT"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
||||
@@ -426,11 +426,14 @@ application.contract.already.exist=Application contract already exist for this a
|
||||
application.not.approved=Application is not approved.
|
||||
subject.body.required=Subject and body is required to create contract.
|
||||
mail.send.successfully=Mail sent succesfully.
|
||||
pec.email.rejected.successfully=Email rejected successfully.
|
||||
email.log.fetched=Email log fetched successfully.
|
||||
amendment.appropiate.status=Application amendment is not in appropiate status for this operation.
|
||||
upload.company.document.to.application=Uploaded company document to application successfully.
|
||||
company.document.not.found.with.ids=Company document not found. Missing IDs: {0}.
|
||||
amount.field.not.provided= Please provide the required amount fields.
|
||||
vat.or.tax.code.required=VAT Number or Tax Code is required.
|
||||
provide.valid.vat.number=Please provide a valid vat number to proceed NDG.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ email.already.exists=Esiste gi? un utente con questa email.
|
||||
invalid_user=Validazione utente fallita. Controlla le informazioni, lo stato dell'account e la scadenza del token.
|
||||
|
||||
#Global messages
|
||||
common_message=qualcosa <EFBFBD> andato storto. Per favore riprova
|
||||
common_message=Qualcosa è andato storto. Riprova.
|
||||
invalid_signature=Gettone non valido.
|
||||
invalid_login=Nome utente o password errati
|
||||
req_validation_er=Errore di convalida
|
||||
@@ -417,8 +417,11 @@ application.contract.already.exist=Il contratto di applicazione esiste gi<67> per
|
||||
application.not.approved=La domanda non � stata approvata.
|
||||
subject.body.required=Per creare un contratto sono necessari oggetto e corpo.
|
||||
mail.send.successfully=Email inviata con successo.
|
||||
pec.email.rejected.successfully=Email rifiutata con successo.
|
||||
email.log.fetched=Registro email recuperato correttamente.
|
||||
amendment.appropiate.status=L'emendamento dell'applicazione non � in stato appropriato per questa operazione.
|
||||
upload.company.document.to.application=Documento aziendale caricato correttamente nell'applicazione.
|
||||
company.document.not.found.with.ids=Documento aziendale non trovato. ID mancanti: {0}
|
||||
amount.field.not.provided= Si prega di fornire i campi obbligatori per l'importo.
|
||||
vat.or.tax.code.required=È obbligatorio il numero di partita IVA o il codice fiscale.
|
||||
provide.valid.vat.number=Inserisci un numero di partita IVA valido per procedere con NDG.
|
||||
Reference in New Issue
Block a user