|
|
@@ -44,6 +44,7 @@ import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
|
|
44
|
44
|
import com.ruoyi.wisdomarbitrate.utils.OCRUtils;
|
|
45
|
45
|
import com.ruoyi.wisdomarbitrate.utils.SignAward;
|
|
46
|
46
|
import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils;
|
|
|
47
|
+import com.ruoyi.wisdomarbitrate.utils.ZipFileUtils;
|
|
47
|
48
|
import com.tencentyun.TLSSigAPIv2;
|
|
48
|
49
|
|
|
49
|
50
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
|
@@ -78,6 +79,7 @@ import java.util.function.Function;
|
|
78
|
79
|
import java.util.regex.Matcher;
|
|
79
|
80
|
import java.util.regex.Pattern;
|
|
80
|
81
|
import java.util.stream.Collectors;
|
|
|
82
|
+import java.util.zip.ZipOutputStream;
|
|
81
|
83
|
|
|
82
|
84
|
import static com.ruoyi.common.core.domain.AjaxResult.error;
|
|
83
|
85
|
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
|
|
@@ -2620,6 +2622,127 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
2620
|
2622
|
return success();
|
|
2621
|
2623
|
}
|
|
2622
|
2624
|
|
|
|
2625
|
+ @Override
|
|
|
2626
|
+ @Transactional
|
|
|
2627
|
+ public CaseAttach downloadCaseZipFile(CaseApplication caseApplication) {
|
|
|
2628
|
+ caseApplication.setAnnexType(12);
|
|
|
2629
|
+ CaseAttach caseAttach = new CaseAttach();
|
|
|
2630
|
+ List<CaseAttach> caseAttachs = caseAttachMapper.queryCaseAttachList( caseApplication);
|
|
|
2631
|
+ if(caseAttachs!=null&&caseAttachs.size()>0){
|
|
|
2632
|
+ caseAttach = caseAttachs.get(0);
|
|
|
2633
|
+
|
|
|
2634
|
+ String annexName = caseAttach.getAnnexName();
|
|
|
2635
|
+ String prefix = "/profile";
|
|
|
2636
|
+ int startIndex = annexName.indexOf(prefix);
|
|
|
2637
|
+ if(startIndex!=-1) {
|
|
|
2638
|
+ startIndex += prefix.length();
|
|
|
2639
|
+
|
|
|
2640
|
+ String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
|
|
2641
|
+ caseAttach.setAnnexPath(annexPath);
|
|
|
2642
|
+ }
|
|
|
2643
|
+ int startIndexnew = annexName.lastIndexOf("/");
|
|
|
2644
|
+ if (startIndexnew != -1) {
|
|
|
2645
|
+ String annexNamenew = annexName.substring(startIndexnew + 1);
|
|
|
2646
|
+ caseAttach.setAnnexName(annexNamenew);
|
|
|
2647
|
+ }
|
|
|
2648
|
+
|
|
|
2649
|
+ }else {
|
|
|
2650
|
+ CaseApplication caseApplicationsel = new CaseApplication();
|
|
|
2651
|
+ caseApplicationsel.setId(caseApplication.getId());
|
|
|
2652
|
+ List<Integer> annexTypeList = new ArrayList<>();
|
|
|
2653
|
+ annexTypeList.add(1);
|
|
|
2654
|
+ annexTypeList.add(2);
|
|
|
2655
|
+ annexTypeList.add(3);
|
|
|
2656
|
+ annexTypeList.add(6);
|
|
|
2657
|
+ annexTypeList.add(7);
|
|
|
2658
|
+ annexTypeList.add(9);
|
|
|
2659
|
+ annexTypeList.add(11);
|
|
|
2660
|
+ caseApplicationsel.setAnnexTypeList(annexTypeList);
|
|
|
2661
|
+ List<CaseAttach> caseAttachList = caseAttachMapper.queryCaseAttachList( caseApplicationsel);
|
|
|
2662
|
+ if(caseAttachList!=null&&caseAttachList.size()>0){
|
|
|
2663
|
+ List<String> pathList = new ArrayList<>();
|
|
|
2664
|
+ for (CaseAttach caseAttach1 : caseAttachList) {
|
|
|
2665
|
+ String annexName = caseAttach1.getAnnexName();
|
|
|
2666
|
+ String annexPathsel = caseAttach1.getAnnexPath();
|
|
|
2667
|
+ String prefix = "/profile";
|
|
|
2668
|
+ int startIndex = annexName.indexOf(prefix);
|
|
|
2669
|
+ if(startIndex!=-1) {
|
|
|
2670
|
+ startIndex += prefix.length();
|
|
|
2671
|
+
|
|
|
2672
|
+ String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
|
|
2673
|
+ String path = "/home/ruoyi" + annexPath;
|
|
|
2674
|
+ pathList.add(path);
|
|
|
2675
|
+ }else if(annexPathsel.contains(annexName)){
|
|
|
2676
|
+ pathList.add(annexPathsel);
|
|
|
2677
|
+ }
|
|
|
2678
|
+ }
|
|
|
2679
|
+ //将案件相关附件压缩zip文件
|
|
|
2680
|
+ if(pathList!=null&&pathList.size()>0){
|
|
|
2681
|
+ LocalDate now = LocalDate.now();
|
|
|
2682
|
+ String year = Integer.toString(now.getYear());
|
|
|
2683
|
+ String month = String.format("%02d", now.getMonthValue());
|
|
|
2684
|
+ String day = String.format("%02d", now.getDayOfMonth());
|
|
|
2685
|
+ String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
|
|
2686
|
+// String saveFolderPath = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
|
|
2687
|
+ String fileName = UUID.randomUUID().toString().replace("-", "") + ".zip";
|
|
|
2688
|
+ File saveFolder = new File(saveFolderPath);
|
|
|
2689
|
+ if (!saveFolder.exists()) {
|
|
|
2690
|
+ saveFolder.mkdirs();
|
|
|
2691
|
+ }
|
|
|
2692
|
+ String zipFileOutPath = saveFolderPath + "/" + fileName;
|
|
|
2693
|
+ try {
|
|
|
2694
|
+
|
|
|
2695
|
+ FileOutputStream zfous = new FileOutputStream(zipFileOutPath);
|
|
|
2696
|
+ ZipOutputStream zipFileOutstream = new ZipOutputStream(zfous);
|
|
|
2697
|
+
|
|
|
2698
|
+ for (String pathstr : pathList) {
|
|
|
2699
|
+ FileInputStream fis1 = new FileInputStream(pathstr);
|
|
|
2700
|
+ ZipFileUtils.zipFile(pathstr, fis1, zipFileOutstream);
|
|
|
2701
|
+ }
|
|
|
2702
|
+ zipFileOutstream.close();
|
|
|
2703
|
+ zfous.close();
|
|
|
2704
|
+ } catch (IOException e) {
|
|
|
2705
|
+ e.printStackTrace();
|
|
|
2706
|
+ }
|
|
|
2707
|
+
|
|
|
2708
|
+ //保存压缩文件附件
|
|
|
2709
|
+ String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
|
2710
|
+// String saveName = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
|
2711
|
+ String savePath = "/home/ruoyi/uploadPath/upload";
|
|
|
2712
|
+ caseAttach = CaseAttach.builder()
|
|
|
2713
|
+ .caseAppliId(caseApplication.getId())
|
|
|
2714
|
+ .annexName(saveName)
|
|
|
2715
|
+ .annexPath(savePath)
|
|
|
2716
|
+ .annexType(12)
|
|
|
2717
|
+ .build();
|
|
|
2718
|
+ int i = caseAttachMapper.save(caseAttach);
|
|
|
2719
|
+
|
|
|
2720
|
+ String annexName = caseAttach.getAnnexName();
|
|
|
2721
|
+ String prefix = "/profile";
|
|
|
2722
|
+ int startIndex = annexName.indexOf(prefix);
|
|
|
2723
|
+ if(startIndex!=-1) {
|
|
|
2724
|
+ startIndex += prefix.length();
|
|
|
2725
|
+
|
|
|
2726
|
+ String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
|
|
2727
|
+ caseAttach.setAnnexPath(annexPath);
|
|
|
2728
|
+ }
|
|
|
2729
|
+ int startIndexnew = annexName.lastIndexOf("/");
|
|
|
2730
|
+ if (startIndexnew != -1) {
|
|
|
2731
|
+ String annexNamenew = annexName.substring(startIndexnew + 1);
|
|
|
2732
|
+ caseAttach.setAnnexName(annexNamenew);
|
|
|
2733
|
+ }
|
|
|
2734
|
+
|
|
|
2735
|
+ return caseAttach;
|
|
|
2736
|
+
|
|
|
2737
|
+ }
|
|
|
2738
|
+ }
|
|
|
2739
|
+ }
|
|
|
2740
|
+ return caseAttach;
|
|
|
2741
|
+ }
|
|
|
2742
|
+
|
|
|
2743
|
+
|
|
|
2744
|
+
|
|
|
2745
|
+
|
|
2623
|
2746
|
@Override
|
|
2624
|
2747
|
public CaseApplication selectSignSealUrl(CaseApplication caseApplication) throws EsignDemoException {
|
|
2625
|
2748
|
Gson gson = new Gson();
|