Resolved conflicts
This commit is contained in:
@@ -2,7 +2,16 @@ package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import com.amazonaws.services.s3.AmazonS3;
|
||||
import com.amazonaws.services.s3.model.*;
|
||||
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.model.response.UploadFileOnAmazonS3Response;
|
||||
import net.gepafin.tendermanagement.service.AmazonS3Service;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.env.Environment;
|
||||
@@ -86,4 +95,20 @@ public class AmazonS3ServiceImpl implements AmazonS3Service {
|
||||
throw new IOException("Error getting file from Amazon S3", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UploadFileOnAmazonS3Response uploadFileOnAmazonS3(String s3Folder, MultipartFile file) {
|
||||
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
||||
String fileName = org.springframework.util.StringUtils.cleanPath(file.getOriginalFilename());
|
||||
String firstNameContain = fileName.substring(0, fileName.lastIndexOf('.'));
|
||||
firstNameContain+=Utils.randomKey(5);
|
||||
fileName = (firstNameContain + "." + extension);
|
||||
try {
|
||||
String filepath = upload(fileName, s3Folder, file);
|
||||
return UploadFileOnAmazonS3Response.builder().fileName(fileName).filePath(filepath).build();
|
||||
} catch (Exception e) {
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||
Translator.toLocale(GepafinConstant.UPLOAD_ERROR_S3));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,12 +13,14 @@ import net.gepafin.tendermanagement.model.request.ApplicationRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationGetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationResponse;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationSignedDocumentResponse;
|
||||
import net.gepafin.tendermanagement.model.response.NextOrPreviousFormResponse;
|
||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -64,7 +66,7 @@ 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);
|
||||
CompanyEntity companyEntity = validator.validateUSerWithCompany(request, companyId);
|
||||
CompanyEntity companyEntity = validator.validateUserWithCompany(request, companyId);
|
||||
return applicationDao.createApplicationByCallId(companyEntity, applicationRequest, callId, userEntity);
|
||||
}
|
||||
|
||||
@@ -88,8 +90,26 @@ public class ApplicationServiceImpl implements ApplicationService {
|
||||
public List<ApplicationResponse> getAllApplications(HttpServletRequest request, Long callId, Long companyId) {
|
||||
UserEntity userEntity = validator.validateUser(request);
|
||||
if (companyId != null) {
|
||||
validator.validateUSerWithCompany(request, companyId);
|
||||
validator.validateUserWithCompany(request, companyId);
|
||||
}
|
||||
return applicationDao.getAllApplications(userEntity, callId, companyId);
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApplicationSignedDocumentResponse uploadSignedDocument(HttpServletRequest request, Long applicationId, MultipartFile file) {
|
||||
return applicationDao.uploadSignedDocument(request, applicationId, file);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public ApplicationSignedDocumentResponse getSignedDocument(HttpServletRequest request, Long applicationId) {
|
||||
return applicationDao.getSignedDocument(request, applicationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteSignedDocument(HttpServletRequest request, Long applicationId) {
|
||||
applicationDao.deleteSignedDocument(request, applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -92,4 +92,9 @@ public class CallServiceImpl implements CallService {
|
||||
public CallEntity validatePublishedCall(Long callId) {
|
||||
return callDao.validatePublishedCall(callId);
|
||||
}
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public byte[] downloadCallDocumentsAsZip(Long callId) {
|
||||
return callDao.downloadCallDocumentsAsZip(callId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,8 @@ public class CompanyServiceImpl implements CompanyService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CompanyDelegationResponse uploadCompanyDelegation(HttpServletRequest request, Long companyId, MultipartFile file) {
|
||||
UserEntity userEntity =validator.validateUser(request);
|
||||
UserEntity userEntity = validator.validateUser(request);
|
||||
validator.validateUserWithCompany(request, companyId);
|
||||
return delegationDao.uploadCompanyDelegation(userEntity, companyId, file);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.dao.PdfDao;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.service.PdfService;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class PdfServiceImpl implements PdfService {
|
||||
|
||||
@Autowired
|
||||
private PdfDao pdfDao;
|
||||
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
@Override
|
||||
public byte[] generatePdf(HttpServletRequest request, Long applicationId) {
|
||||
return pdfDao.generatePdf(request, applicationId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user