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

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