fixed s3 call document download issue

This commit is contained in:
piyushkag
2024-10-29 21:31:35 +05:30
parent 8f55a96825
commit 51f1e97dd5
5 changed files with 19 additions and 17 deletions

View File

@@ -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);