|
|
@@ -11,6 +11,7 @@ import com.google.gson.Gson;
|
|
11
|
11
|
import com.google.gson.JsonArray;
|
|
12
|
12
|
import com.google.gson.JsonObject;
|
|
13
|
13
|
import com.ruoyi.common.constant.CaseApplicationConstants;
|
|
|
14
|
+import com.ruoyi.common.constant.FileTransformation;
|
|
14
|
15
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
15
|
16
|
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
|
|
16
|
17
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
@@ -56,6 +57,7 @@ import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
|
56
|
57
|
|
|
57
|
58
|
import javax.annotation.Resource;
|
|
58
|
59
|
import java.io.File;
|
|
|
60
|
+import java.time.LocalDate;
|
|
59
|
61
|
import java.util.*;
|
|
60
|
62
|
import java.util.stream.Collectors;
|
|
61
|
63
|
|
|
|
@@ -541,7 +543,59 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
541
|
543
|
File file = new File(path);
|
|
542
|
544
|
// todo 部署放开
|
|
543
|
545
|
if (!file.exists()) {
|
|
544
|
|
- return AjaxResult.error("未生成裁决书");
|
|
|
546
|
+ Gson gson = new Gson();
|
|
|
547
|
+ MsSealSignRecord sealSignRecord = new MsSealSignRecord();
|
|
|
548
|
+ sealSignRecord.setCaseAppliId(id);
|
|
|
549
|
+ List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecord(sealSignRecord);
|
|
|
550
|
+ if (sealSignRecords != null && sealSignRecords.size() > 0) {
|
|
|
551
|
+ String signFlowid = sealSignRecords.get(0).getSignFlowId();
|
|
|
552
|
+ EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowid);
|
|
|
553
|
+ JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
|
|
|
554
|
+ JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
|
|
|
555
|
+ JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
|
|
|
556
|
+ if (filesArray != null && filesArray.size() > 0) {
|
|
|
557
|
+ JsonObject fileObject = (JsonObject) filesArray.get(0);
|
|
|
558
|
+ String fileDownloadUrl = fileObject.get("downloadUrl").toString();
|
|
|
559
|
+ String filearbitraUrl = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
|
|
|
560
|
+
|
|
|
561
|
+ LocalDate now = LocalDate.now();
|
|
|
562
|
+ String year = Integer.toString(now.getYear());
|
|
|
563
|
+ String month = String.format("%02d", now.getMonthValue());
|
|
|
564
|
+ String day = String.format("%02d", now.getDayOfMonth());
|
|
|
565
|
+ String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
|
|
566
|
+ String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
|
|
|
567
|
+
|
|
|
568
|
+// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
|
569
|
+// String savePath = "/home/ruoyi/uploadPath/upload/";
|
|
|
570
|
+ String saveName = fileName;
|
|
|
571
|
+ String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
|
572
|
+
|
|
|
573
|
+ // 创建日期目录
|
|
|
574
|
+ File saveFolder = new File(saveFolderPath);
|
|
|
575
|
+ if (!saveFolder.exists()) {
|
|
|
576
|
+ saveFolder.mkdirs();
|
|
|
577
|
+ }
|
|
|
578
|
+ String resultFilePath = saveFolderPath + "/" + fileName;
|
|
|
579
|
+ File resultFilePathFile = new File(resultFilePath);
|
|
|
580
|
+ if (!resultFilePathFile.exists()) {
|
|
|
581
|
+ resultFilePathFile.createNewFile();
|
|
|
582
|
+ }
|
|
|
583
|
+
|
|
|
584
|
+ boolean downLoadFile = FileTransformation.downLoadFileByUrl(filearbitraUrl, resultFilePath);
|
|
|
585
|
+ if (downLoadFile) {
|
|
|
586
|
+ MsCaseAttach caseAttach1 = new MsCaseAttach();
|
|
|
587
|
+ caseAttach1.setCaseAppliId(id);
|
|
|
588
|
+ caseAttach1.setAnnexType(7);
|
|
|
589
|
+ caseAttach1.setAnnexPath(savePath);
|
|
|
590
|
+ caseAttach1.setAnnexName(saveName);
|
|
|
591
|
+ msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach1);
|
|
|
592
|
+
|
|
|
593
|
+ caseAttach.setAnnexPath(savePath);
|
|
|
594
|
+ caseAttach.setAnnexName(saveName);
|
|
|
595
|
+ }
|
|
|
596
|
+ }
|
|
|
597
|
+ }
|
|
|
598
|
+
|
|
545
|
599
|
}
|
|
546
|
600
|
|
|
547
|
601
|
}
|