fixed s3 call document download issue
This commit is contained in:
@@ -115,8 +115,8 @@ public class ApplicationDao {
|
||||
@Autowired
|
||||
private ApplicationSignedDocumentRepository applicationSignedDocumentRepository;
|
||||
|
||||
@Value("${aws.s3.url.folder.signed.document}")
|
||||
private String signedDocumentS3Folder;
|
||||
// @Value("${aws.s3.url.folder.signed.document}")
|
||||
// private String signedDocumentS3Folder;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@@ -21,7 +21,6 @@ import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import org.h2.util.IOUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -94,14 +93,17 @@ public class CallDao {
|
||||
@Autowired
|
||||
private FormDao formDao;
|
||||
|
||||
@Value("${aws.s3.url.folder}")
|
||||
private String s3Folder;
|
||||
// @Value("${aws.s3.url.folder}")
|
||||
// private String s3Folder;
|
||||
|
||||
@Autowired
|
||||
private AmazonS3Service amazonS3Service;
|
||||
|
||||
@Autowired
|
||||
private CriteriaFormFieldRepository criteriaFormFieldRepository;
|
||||
|
||||
@Autowired
|
||||
private S3PathConfig s3PathConfig;
|
||||
|
||||
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, UserEntity userEntity) {
|
||||
createCallRequest.setRegionId(userEntity.getRoleEntity().getRegion().getId());
|
||||
@@ -127,6 +129,7 @@ public class CallDao {
|
||||
ZipOutputStream zos = new ZipOutputStream(zipOutputStream)) {
|
||||
|
||||
for (DocumentEntity document : documents) {
|
||||
String s3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.CALL, callId, 0L);
|
||||
try (InputStream fileInputStream = amazonS3Service.getFile(s3Folder, document.getFilePath())) {
|
||||
String fileName = Utils.extractFileName(document.getFilePath());
|
||||
ZipEntry zipEntry = new ZipEntry(fileName);
|
||||
|
||||
@@ -8,10 +8,10 @@ import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.gepafin.tendermanagement.enums.DocOtherSourceTypeEnum;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -58,8 +58,8 @@ public class DelegationDao {
|
||||
@Autowired
|
||||
private S3PathConfig s3ConfigBean;
|
||||
|
||||
@Value("${aws.s3.url.folder.delegation}")
|
||||
private String s3Folder;
|
||||
// @Value("${aws.s3.url.folder.delegation}")
|
||||
// private String s3Folder;
|
||||
|
||||
@Autowired
|
||||
private UserCompanyDelegationRepository userCompanyDelegationRepository;
|
||||
@@ -67,9 +67,9 @@ public class DelegationDao {
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
|
||||
public ByteArrayOutputStream generateDocument(Map<String, String> placeholders, String templateName) {
|
||||
try {
|
||||
String s3Folder = s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.USER_DELEGATION, 0L, 0L);
|
||||
InputStream templateStream = amazonS3Service.getFile(s3Folder ,templateName);
|
||||
XWPFDocument doc = loadTemplate(templateStream);
|
||||
replacePlaceholders(doc, placeholders);
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -49,8 +48,8 @@ public class DocumentDao {
|
||||
@Autowired
|
||||
private ApplicationRepository applicationFormRepository;
|
||||
|
||||
@Value("${aws.s3.url.folder}")
|
||||
private String s3Folder;
|
||||
// @Value("${aws.s3.url.folder}")
|
||||
// private String s3Folder;
|
||||
|
||||
public List<DocumentResponseBean> uploadFiles(List<MultipartFile> files, Long sourceId, DocumentSourceTypeEnum sourceType, DocumentTypeEnum fileType) {
|
||||
List<DocumentEntity> documentEntities = new ArrayList<>();
|
||||
@@ -141,7 +140,7 @@ public class DocumentDao {
|
||||
try {
|
||||
Long callId;
|
||||
Long applicationId;
|
||||
if(type.equals("APPLICATION")){
|
||||
if(type.equals(DocumentSourceTypeEnum.APPLICATION)){
|
||||
callId = applicationFormRepository.findCallIdById(id);
|
||||
applicationId = id;
|
||||
}else{
|
||||
|
||||
@@ -4,7 +4,7 @@ spring.application.name=tendermanagement
|
||||
spring.servlet.multipart.max-file-size=300MB
|
||||
spring.servlet.multipart.max-request-size=300MB
|
||||
|
||||
spring.profiles.active=testing
|
||||
spring.profiles.active=local
|
||||
|
||||
|
||||
# JPA Configuration
|
||||
@@ -30,9 +30,9 @@ aws.secret.access.key=FtnkzF8E3vtqPrVnloqMyNSUSqg0f9Z9L0R7qQOu
|
||||
aws.s3.region=eu-west-1
|
||||
aws.s3.bucket.name=mementoresources
|
||||
aws.s3.url = https://mementoresources.s3.eu-west-1.amazonaws.com/
|
||||
aws.s3.url.folder=gepafin
|
||||
aws.s3.url.folder.delegation=gepafin/delegation
|
||||
aws.s3.url.folder.signed.document=gepafin/signed-document
|
||||
#aws.s3.url.folder=gepafin
|
||||
#aws.s3.url.folder.delegation=gepafin/delegation
|
||||
#aws.s3.url.folder.signed.document=gepafin/signed-document
|
||||
# JWT configuration
|
||||
# Ensure these values match your expectations
|
||||
security.authentication.jwt.secret=my-secret-token-to-change-in-prod-environment-your-super-secure-randomly-generated-key
|
||||
|
||||
Reference in New Issue
Block a user