hejinbo 2 лет назад
Родитель
Сommit
b4549fa2cc

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/ArbitrateRecord.java Просмотреть файл

26
     /** 审核裁决书意见 */
26
     /** 审核裁决书意见 */
27
     private String checkOpinion;
27
     private String checkOpinion;
28
     /** 裁决书附件id */
28
     /** 裁决书附件id */
29
-    private Long annexId;
29
+    private Integer annexId;
30
 
30
 
31
 
31
 
32
 
32
 

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java Просмотреть файл

9
 @Builder
9
 @Builder
10
 @AllArgsConstructor
10
 @AllArgsConstructor
11
 @NoArgsConstructor
11
 @NoArgsConstructor
12
-public class CaseAttach {
12
+public class  CaseAttach {
13
     /**
13
     /**
14
      *  附件id
14
      *  附件id
15
      */
15
      */

+ 73
- 50
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java Просмотреть файл

3
 import com.deepoove.poi.config.Configure;
3
 import com.deepoove.poi.config.Configure;
4
 import com.ruoyi.common.core.domain.AjaxResult;
4
 import com.ruoyi.common.core.domain.AjaxResult;
5
 import com.ruoyi.common.utils.WordUtil;
5
 import com.ruoyi.common.utils.WordUtil;
6
-import com.ruoyi.wisdomarbitrate.domain.Adjudication;
7
-import com.ruoyi.wisdomarbitrate.domain.ArbitrateRecord;
8
-import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
9
-import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
6
+import com.ruoyi.wisdomarbitrate.domain.*;
10
 import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper;
7
 import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper;
11
 import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
8
 import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
12
 import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
9
 import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
10
+import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
13
 import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
11
 import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
14
 import org.apache.poi.xwpf.usermodel.*;
12
 import org.apache.poi.xwpf.usermodel.*;
15
 import org.springframework.beans.factory.annotation.Autowired;
13
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.stereotype.Service;
14
 import org.springframework.stereotype.Service;
17
 
15
 
18
-import java.io.FileInputStream;
19
-import java.io.FileOutputStream;
20
-import java.io.IOException;
21
-import java.io.InputStream;
16
+import java.io.*;
17
+import java.nio.file.Files;
18
+import java.nio.file.Path;
19
+import java.nio.file.StandardCopyOption;
22
 import java.time.LocalDate;
20
 import java.time.LocalDate;
23
 import java.time.ZoneId;
21
 import java.time.ZoneId;
22
+import java.time.format.DateTimeFormatter;
24
 import java.util.*;
23
 import java.util.*;
25
 
24
 
26
 @Service
25
 @Service
31
     private CaseAffiliateMapper caseAffiliateMapper;
30
     private CaseAffiliateMapper caseAffiliateMapper;
32
     @Autowired
31
     @Autowired
33
     private ArbitrateRecordMapper arbitrateRecordMapper;
32
     private ArbitrateRecordMapper arbitrateRecordMapper;
33
+    @Autowired
34
+    private CaseAttachMapper caseAttachMapper;
34
 
35
 
35
     @Override
36
     @Override
36
     public AjaxResult createDocument(CaseApplication caseApplication) {
37
     public AjaxResult createDocument(CaseApplication caseApplication) {
57
                     //获取身份类型
58
                     //获取身份类型
58
                     int identityType = affiliate.getIdentityType();
59
                     int identityType = affiliate.getIdentityType();
59
                     if (identityType == 1) {    //申请人
60
                     if (identityType == 1) {    //申请人
60
-                        datas.put(adjudication.getAppName(), affiliate.getName());
61
-                        datas.put(adjudication.getAppSex(), null);
62
-                        datas.put(adjudication.getAppIDNo(), affiliate.getIdentityNum());
63
-                        datas.put(adjudication.getAppAddress(), affiliate.getContactAddress());
64
-                        datas.put(adjudication.getAppAgentName(), affiliate.getNameAgent());
65
-                        datas.put(adjudication.getAppAgentIDNo(),affiliate.getIdentityNumAgent());
61
+                        datas.put("appName", affiliate.getName());
62
+                        datas.put("appSex", null);
63
+                        datas.put("appIDNo", affiliate.getIdentityNum());
64
+                        datas.put("appAddress", affiliate.getContactAddress());
65
+                        datas.put("appAgentName", affiliate.getNameAgent());
66
+                        datas.put("appAgentIDNo",affiliate.getIdentityNumAgent());
66
                     }else if (identityType == 2){  //被申请人
67
                     }else if (identityType == 2){  //被申请人
67
-                        datas.put(adjudication.getResName(), affiliate.getName());
68
-                        datas.put(adjudication.getResSex(), null);
69
-                        datas.put(adjudication.getResIDNo(), affiliate.getIdentityNum());
70
-                        datas.put(adjudication.getResAddress(), affiliate.getContactAddress());
71
-                        datas.put(adjudication.getResAgentName(), affiliate.getNameAgent());
72
-                        datas.put(adjudication.getResAgentName(),affiliate.getIdentityNumAgent());
68
+                        datas.put("resName", affiliate.getName());
69
+                        datas.put("resSex", null);
70
+                        datas.put("resIDNo", affiliate.getIdentityNum());
71
+                        datas.put("resAddress", affiliate.getContactAddress());
72
+                        datas.put("resAgentName", affiliate.getNameAgent());
73
+                        datas.put("resAgentIDNo",affiliate.getIdentityNumAgent());
73
                     }
74
                     }
74
                 }
75
                 }
75
             }
76
             }
76
             String arbitratorName = caseApplication1.getArbitratorName();
77
             String arbitratorName = caseApplication1.getArbitratorName();
77
-            datas.put(adjudication.getCaseName(),caseApplication1.getCaseName());
78
-            datas.put(adjudication.getArbitratorName(),arbitratorName);
78
+            datas.put("caseName",caseApplication1.getCaseName());
79
+            datas.put("arbitratorName",arbitratorName);
79
             LocalDate localDate = caseApplication1.getHearDate()
80
             LocalDate localDate = caseApplication1.getHearDate()
80
                     .toInstant()
81
                     .toInstant()
81
                     .atZone(ZoneId.systemDefault())
82
                     .atZone(ZoneId.systemDefault())
82
                     .toLocalDate();
83
                     .toLocalDate();
83
-            datas.put(adjudication.getHearYear(),  localDate.getYear());
84
-            datas.put(adjudication.getHearMonths(),  localDate.getMonthValue());
85
-            datas.put(adjudication.getHearDay(),  localDate.getDayOfMonth());
86
-            datas.put(adjudication.getAppArbitrationClaims(), null);
87
-            datas.put(adjudication.getAppEvidenceName(), null);
88
-            datas.put(adjudication.getAppProveFacts(), null);
89
-            datas.put(adjudication.getResDefenseContentToApp(), null);
90
-            datas.put(adjudication.getResArbitrationClaims(), null);
91
-            datas.put(adjudication.getResEvidenceName(), null);
92
-            datas.put(adjudication.getResProveFacts(), null);
93
-            datas.put(adjudication.getAppDefenseContentToRes(), null);
94
-            datas.put(adjudication.getEvidenDetermi(), arbitrateRecord1.getEvidenDetermi());
95
-            datas.put(adjudication.getFactDetermi(), arbitrateRecord1.getFactDetermi());
96
-            datas.put(adjudication.getCaseSketch(), arbitrateRecord1.getCaseSketch());
97
-            datas.put(adjudication.getArbitrateThink(), arbitrateRecord1.getArbitrateThink());
98
-            datas.put(adjudication.getLegalProvisions(), null);
99
-            datas.put(adjudication.getRulingFollows(), arbitrateRecord1.getRulingFollows());
100
-            datas.put(adjudication.getUmpire(), null);
84
+            datas.put("hearYear",  localDate.getYear());
85
+            datas.put("hearMonths",  localDate.getMonthValue());
86
+            datas.put("hearDay",  localDate.getDayOfMonth());
87
+            datas.put("appArbitrationClaims", null);
88
+            datas.put("appEvidenceName", null);
89
+            datas.put("appProveFacts", null);
90
+            datas.put("resDefenseContentToApp", null);
91
+            datas.put("resArbitrationClaims", null);
92
+            datas.put("resEvidenceName", null);
93
+            datas.put("resProveFacts", null);
94
+            datas.put("appDefenseContentToRes", null);
95
+            datas.put("evidenDetermi", arbitrateRecord1.getEvidenDetermi());
96
+            datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
97
+            datas.put("caseSketch", arbitrateRecord1.getCaseSketch());
98
+            datas.put("arbitrateThink", arbitrateRecord1.getArbitrateThink());
99
+            datas.put("legalProvisions", null);
100
+            datas.put("rulingFollows", arbitrateRecord1.getRulingFollows());
101
+            datas.put("umpire", null);
101
             if (arbitratorName.contains(",")){
102
             if (arbitratorName.contains(",")){
102
                 String[] nameArray = arbitratorName.split(",");
103
                 String[] nameArray = arbitratorName.split(",");
103
                 String firstName = nameArray[0];
104
                 String firstName = nameArray[0];
104
                 String secondName = nameArray[1];
105
                 String secondName = nameArray[1];
105
-                datas.put(adjudication.getArbitratorName1(), firstName);
106
-                datas.put(adjudication.getArbitratorName2(), secondName);
106
+                datas.put("arbitratorName1", firstName);
107
+                datas.put("arbitratorName2", secondName);
107
             }else {
108
             }else {
108
                 String secondName = "";
109
                 String secondName = "";
109
-                datas.put(adjudication.getArbitratorName1(), arbitratorName);
110
-                datas.put(adjudication.getArbitratorName2(), secondName);
110
+                datas.put("arbitratorName1", arbitratorName);
111
+                datas.put("arbitratorName2", secondName);
111
             }
112
             }
112
             LocalDate now = LocalDate.now();
113
             LocalDate now = LocalDate.now();
113
-            datas.put(adjudication.getYear(), now.getYear());
114
-            datas.put(adjudication.getMonths(), now.getMonthValue());
115
-            datas.put(adjudication.getDay(), now.getDayOfMonth());
116
-            datas.put(adjudication.getClerk(), null);
117
-            String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
114
+            datas.put("year", now.getYear());
115
+            datas.put("months", now.getMonthValue());
116
+            datas.put("day", now.getDayOfMonth());
117
+            datas.put("clerk", null);
118
+            String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
119
+
120
+            String currentDateStr = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
121
+            String saveFolderPath = "/data/arbitrate-document/formal/" + currentDateStr;
122
+            // 创建日期目录
123
+            File saveFolder = new File(saveFolderPath);
124
+            if (!saveFolder.exists()) {
125
+                saveFolder.mkdirs();
126
+            }
118
             String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
127
             String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
119
-            String resultFilePath = "D:/data/" + fileName;
128
+            String resultFilePath = saveFolderPath+ fileName;
120
             String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
129
             String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
130
+            //将裁决书保存到附件表里
131
+            CaseAttach caseAttach = CaseAttach.builder()
132
+                    .caseAppliId(id)
133
+                    .annexName(fileName)
134
+                    .annexPath(docFilePath)
135
+                    .annexType(3)
136
+                    .build();
137
+            int i = caseAttachMapper.save(caseAttach);
138
+            if (i>0){
139
+                Integer annexId = caseAttach.getAnnexId();
140
+                //将附件id保存到仲裁记录表里面
141
+                arbitrateRecord1.setAnnexId(annexId);
142
+                arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
143
+            }
121
             return AjaxResult.success("裁决书保存路径为" + docFilePath);
144
             return AjaxResult.success("裁决书保存路径为" + docFilePath);
122
         } catch (IOException e) {
145
         } catch (IOException e) {
123
             e.printStackTrace();
146
             e.printStackTrace();

+ 4
- 9
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java Просмотреть файл

40
         int arbitratMethod = caseApplication1.getArbitratMethod();
40
         int arbitratMethod = caseApplication1.getArbitratMethod();
41
         String caseNum = caseApplication1.getCaseNum();
41
         String caseNum = caseApplication1.getCaseNum();
42
         if (opinion==0){   //拒绝
42
         if (opinion==0){   //拒绝
43
-            switch (arbitratMethod) {
44
-                case 1:
45
-                    caseApplication1.setArbitratMethod(2);  // 更改仲裁方式
46
-                    break;
47
-                case 2:
48
-                    caseApplication1.setArbitratMethod(1);
49
-                    break;
50
-                default:
51
-                    return AjaxResult.error();
43
+            if (arbitratMethod == 2){
44
+                caseApplication1.setArbitratMethod(1);  // 更改仲裁方式
45
+            }else {
46
+                caseApplication1.setArbitratMethod(2);
52
             }
47
             }
53
         }
48
         }
54
         //修改案件状态为待开庭
49
         //修改案件状态为待开庭

+ 1
- 1
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml Просмотреть файл

13
         <result property="userId"     column="use_id"    />
13
         <result property="userId"     column="use_id"    />
14
         <result property="userName"     column="use_account"    />
14
         <result property="userName"     column="use_account"    />
15
     </resultMap>
15
     </resultMap>
16
-    <insert id="save">
16
+    <insert id="save" useGeneratedKeys="true" keyProperty="annexId">
17
         INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account)
17
         INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account)
18
         VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{userId},#{userName})
18
         VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{userId},#{userName})
19
     </insert>
19
     </insert>