Просмотр исходного кода

Merge branch 'qtz' of SH-Arbitrate/Mediation-Backend into dev

qtz 2 лет назад
Родитель
Сommit
0975a28364

+ 14
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/dept/MsSealSignRecordMapper.java Просмотреть файл

@@ -4,6 +4,7 @@ import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
4 4
 import com.ruoyi.wisdomarbitrate.domain.entity.dept.MsSealSignRecord;
5 5
 import org.apache.ibatis.annotations.Select;
6 6
 import tk.mybatis.mapper.common.Mapper;
7
+import org.apache.ibatis.annotations.Param;
7 8
 
8 9
 import java.util.List;
9 10
 
@@ -12,4 +13,17 @@ public interface MsSealSignRecordMapper extends Mapper<MsSealSignRecord> {
12 13
 
13 14
     @Select("SELECT s.id id ,s.case_appli_id caseAppliId ,s.file_id fileId ,s.sign_flow_id signFlowId ,s.sign_flow_status signFlowStatus  from ms_seal_sign_record s join ms_case_application c on s.case_appli_id=c.id   where s.sign_flow_status  in (1,2) ")
14 15
     List<MsSealSignRecord> selectSealSignRecordbyStat();
16
+
17
+    @Select("<script> SELECT s.id id ,s.case_appli_id caseAppliId ,s.file_id fileId ,s.sign_flow_id signFlowId,s.penson_account pensonAccount ,s.orgnize_name orgnizeName ,s.orgn_name_psn_acc orgnNamePsnAcc " +
18
+            "    from ms_seal_sign_record s " +
19
+            "    <where> " +
20
+            "       <if test=\"sealSignRecord.signFlowStatus != null \"> " +
21
+            "           AND s.sign_flow_status  = #{sealSignRecord.signFlowStatus} " +
22
+            "       </if> " +
23
+            "       <if test=\"sealSignRecord.caseAppliId != null \"> " +
24
+            "           AND s.case_appli_id  = #{sealSignRecord.caseAppliId} " +
25
+            "       </if> " +
26
+            "    </where> " +
27
+            " </script>")
28
+    List<MsSealSignRecord> selectSealSignRecord(@Param("sealSignRecord") MsSealSignRecord sealSignRecord);
15 29
 }

+ 55
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java Просмотреть файл

@@ -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
                         }