分控材料 文件名相同 导致打成zip包失败

master
dalong306 4 years ago
parent 541a74da48
commit 2eb1818500

@ -572,13 +572,13 @@ public class RiskBusinessServiceImpl implements RiskBusinessService, ManagerTodo
try {
String downloadFilename = clientMoniker + "_audit_materials_" + DateFormatUtils.format(new Date(), "dd/MM/yyyy HH:mm:ss").toString() + ".zip";
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + downloadFilename);
response.setHeader("Content-Disposition", "attachment;filename="+downloadFilename);
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
for (int i = 1; i <= 6; i++) {
if (riskMaterial.containsKey("file" + i)) {
List<String> fileList = (List<String>) riskMaterial.get("file" + i);
for (String fileUrl : fileList) {
zos.putNextEntry(new ZipEntry("file" + i + fileUrl.substring(fileUrl.lastIndexOf("/"))));
zos.putNextEntry(new ZipEntry("file" + i +"/"+System.currentTimeMillis()+"_"+fileUrl.substring(fileUrl.lastIndexOf("/")+1)));
InputStream inputStream = new URL(fileUrl).openConnection().getInputStream();
byte[] buffer = new byte[1024];
int result = 0;

Loading…
Cancel
Save