fix: 企标计划xls导出接口解密报错

This commit is contained in:
2024-02-21 15:03:36 +08:00
parent 7ce4549fc4
commit 86d47c17ef
2 changed files with 11 additions and 1 deletions
@@ -5,6 +5,7 @@ import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.docking.download.service.DownloadDecryptFileService;
import com.jero.modules.docking.utils.IntekeyUtils;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -158,7 +159,8 @@ public class DownloadDecryptFileServiceImpl implements DownloadDecryptFileServic
String fileName = "";
String headerField = response.getHeader("Content-Disposition");
if (!StringUtils.isBlank(headerField) || headerField.contains("fileName=") || headerField.contains("filename=")){
if (headerField != null &&
(!StringUtils.isBlank(headerField) || headerField.contains("fileName=") || headerField.contains("filename="))){
String name = "";
if(headerField.contains("fileName=")){
name = "fileName";
@@ -166,6 +168,9 @@ public class DownloadDecryptFileServiceImpl implements DownloadDecryptFileServic
name = "filename";
}
fileName = headerField.substring(headerField.lastIndexOf(name + "=") + 9);
if (headerField.contains("filename*=UTF-8")){
fileName = headerField.substring(headerField.lastIndexOf("filename*=UTF-8") + 17);
}
}else {
fileName = UUID.randomUUID().toString();
}