优化下载功能

This commit is contained in:
qitz
2023-11-04 18:32:21 +08:00
parent 37717366ab
commit 2bbc030c40
3 changed files with 38 additions and 9 deletions
@@ -21,6 +21,8 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.io.IOException;
import java.time.LocalDate;
import java.util.List;
import java.util.UUID;
@@ -38,6 +40,7 @@ public class FixSelectFlowDetailUtils {
private DeptIdentifyMapper deptIdentifyMapper;
@Scheduled(cron = "0/10 * * * * ?")
// @Scheduled(cron = "0/30 * * * * ?")
@Transactional
public void fixExecuteSelectFlowDetailUtils(){
Gson gson = new Gson();
@@ -118,18 +121,29 @@ public class FixSelectFlowDetailUtils {
caseApplication.setFilearbitraUrl(filearbitraUrl);
caseApplicationMapper.submitCaseApplication(caseApplication);
/* LocalDate now = LocalDate.now();
LocalDate now = LocalDate.now();
String year = Integer.toString(now.getYear());
String month = String.format("%02d", now.getMonthValue());
String day = String.format("%02d", now.getDayOfMonth());
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
String savePath = "/home/ruoyi/uploadPath/upload";
String savePath = "/home/ruoyi/uploadPath/upload/";
// 创建日期目录
File saveFolder = new File(saveFolderPath);
if (!saveFolder.exists()) {
saveFolder.mkdirs();
}
String resultFilePath = saveFolderPath + "/" + fileName;
String fileDownloadUrlnew = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1);
boolean b = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
if(b) {
File resultFilePathFile = new File(resultFilePath);
if (!resultFilePathFile.exists()) {
resultFilePathFile.createNewFile();
}
String fileDownloadUrlnew = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1);
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
if(downLoadFile) {
Long caseAppliId = sealSignRecord.getCaseAppliId();
CaseAttach caseAttach = new CaseAttach();
caseAttach.setCaseAppliId(caseAppliId);
@@ -137,7 +151,7 @@ public class FixSelectFlowDetailUtils {
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
}*/
}
}
}
@@ -149,6 +163,8 @@ public class FixSelectFlowDetailUtils {
}
} catch (EsignDemoException e) {
e.printStackTrace();
}catch (IOException e) {
e.printStackTrace();
}
}