hejinbo пре 2 година
родитељ
комит
2238224e83

+ 56
- 6
ruoyi-common/src/main/java/com/ruoyi/common/utils/WordUtil.java Прегледај датотеку

@@ -7,8 +7,14 @@ import com.deepoove.poi.data.*;
7 7
 import com.deepoove.poi.data.style.ParagraphStyle;
8 8
 import com.deepoove.poi.data.style.Style;
9 9
 import com.deepoove.poi.util.PoitlIOUtils;
10
-import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
10
+import org.apache.poi.ss.usermodel.Cell;
11
+import org.apache.poi.ss.usermodel.CellType;
12
+import org.apache.poi.ss.usermodel.Row;
13
+import org.apache.poi.ss.usermodel.Sheet;
14
+import org.apache.poi.wp.usermodel.Paragraph;
15
+import org.apache.poi.xwpf.usermodel.*;
11 16
 
17
+import javax.print.Doc;
12 18
 import javax.servlet.http.HttpServletResponse;
13 19
 import java.io.BufferedOutputStream;
14 20
 import java.io.FileOutputStream;
@@ -93,7 +99,7 @@ public class WordUtil {
93 99
             style.setFontSize(12.0);
94 100
             ParagraphStyle paragraphStyle = ParagraphStyle.builder()
95 101
                     .withAlign(ParagraphAlignment.CENTER)
96
-                  //  .withBackgroundColor(headerBackgroundColor)
102
+                    //  .withBackgroundColor(headerBackgroundColor)
97 103
                     .withDefaultTextStyle(style)
98 104
                     .build();
99 105
             paragraphRenderData.addText(headerList.get(i));
@@ -139,18 +145,62 @@ public class WordUtil {
139 145
     public static PictureRenderData rebuildImageContent(Integer with, Integer height, String imageUrl, String relatedPath, Byte[] imageBytes) {
140 146
         PictureRenderData pictureRenderData = null;
141 147
         if (!StringUtils.isBlank(imageUrl)) {
142
-           // pictureRenderData = Pictures.of(imageUrl).size(with, height).create();
148
+            // pictureRenderData = Pictures.of(imageUrl).size(with, height).create();
143 149
             //Pictures.PictureBuilder pictureBuilder = Pictures.of("https://res.wx.qq.com/a/wx_fed/weixin_portal/res/static/img/1EtCRvm.png");
144
-        }else  if (!StringUtils.isBlank(relatedPath)) {
145
-            pictureRenderData = Pictures.ofLocal(relatedPath).size(with,height).create();
150
+        } else if (!StringUtils.isBlank(relatedPath)) {
151
+            pictureRenderData = Pictures.ofLocal(relatedPath).size(with, height).create();
146 152
 //            Pictures.PictureBuilder pictureBuilder = Pictures.of("https://res.wx.qq.com/a/wx_fed/weixin_portal/res/static/img/1EtCRvm.png");
147 153
         }
148 154
         return pictureRenderData;
149 155
     }
156
+
150 157
     public static String getResultFilePath(Map<String, Object> datas, Configure config, String modalFilePath, String resultFilePath) throws IOException {
151 158
         //获取word模板和填充数据
152
-        XWPFTemplate template = XWPFTemplate.compile(modalFilePath,config).render(datas);
159
+        XWPFTemplate template = XWPFTemplate.compile(modalFilePath, config).render(datas);
153 160
         template.writeAndClose(new FileOutputStream(resultFilePath));
154 161
         return resultFilePath;
155 162
     }
163
+
164
+    public static void changeText(XWPFDocument document) {
165
+        //获取文字段落集合
166
+        List<XWPFParagraph> paragraphs = document.getParagraphs();
167
+        //所有类型集合(文字段落、表格、图片等)
168
+        List<IBodyElement> listBe = document.getBodyElements();
169
+        List<Integer> runList = new ArrayList<>();
170
+        int n = 0;
171
+
172
+        for (int i = 0; i < listBe.size(); i++) {
173
+
174
+            //BodyElementType.PARAGRAPH : 枚举中的文字段落
175
+            //文字为空时,先添加到list中;
176
+            //注意picture类型也在PARAGRAPH中,需要校验embeddedPictures的长度是否为0
177
+            //为0表示空行,大于0表示有图片,可能还有其他类型,暂时没遇到,各位自行斟酌
178
+            if (paragraphs.size() > n && !paragraphs.get(n).getRuns().isEmpty()) {
179
+                if (StringUtils.isEmpty(paragraphs.get(n).getRuns().get(0).text())
180
+                        && paragraphs.get(n).getRuns().get(0).getEmbeddedPictures().size() == 0) {
181
+
182
+                    runList.add(i);
183
+
184
+                }
185
+            }
186
+            n++;
187
+
188
+            //非文字段落n-1
189
+            if (listBe.get(i).getElementType() != BodyElementType.PARAGRAPH) {
190
+                n--;
191
+            }
192
+
193
+        }
194
+
195
+        //遍历list删除
196
+        if (!runList.isEmpty()) {
197
+            for (int i = runList.size() - 1; i >= 0; i--) {
198
+                int index = runList.get(i);
199
+                if (index >= 0 && index < document.getBodyElements().size()) {
200
+                    document.removeBodyElement(index);
201
+                }
202
+            }
203
+        }
204
+    }
205
+
156 206
 }

+ 5
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAttachMapper.java Прегледај датотеку

@@ -2,15 +2,16 @@ package com.ruoyi.wisdomarbitrate.mapper;
2 2
 
3 3
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
4 4
 import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
5
-import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
5
+import org.apache.ibatis.annotations.Mapper;
6 6
 import org.apache.ibatis.annotations.Param;
7 7
 
8 8
 import java.util.List;
9 9
 
10
+@Mapper
10 11
 public interface CaseAttachMapper {
11 12
     int save(CaseAttach caseAttach);
12 13
 
13
-    List<CaseAttach> queryAnnexPathByCaseId(Long id);
14
+    List<CaseAttach>  queryAnnexPathByCaseId(Long id);
14 15
 
15 16
     List<CaseAttach> queryCaseAttachList(CaseApplication caseApplication);
16 17
 
@@ -20,4 +21,6 @@ public interface CaseAttachMapper {
20 21
     int updateCaseAttachBycaseid(CaseAttach caseAttach);
21 22
 
22 23
     int deleteByFileIds(@Param("ids") List<Integer> fileIds);
24
+
25
+    List<CaseAttach> getCaseAttachByCaseIdAndType(CaseAttach caseAttach);
23 26
 }

+ 29
- 17
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java Прегледај датотеку

@@ -17,6 +17,9 @@ import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
17 17
 import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
18 18
 import com.ruoyi.wisdomarbitrate.service.ICaseLogRecordService;
19 19
 import lombok.extern.slf4j.Slf4j;
20
+import org.apache.poi.ss.usermodel.Sheet;
21
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
22
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
20 23
 import org.springframework.beans.factory.annotation.Autowired;
21 24
 import org.springframework.mail.MailSendException;
22 25
 import org.springframework.mail.javamail.JavaMailSender;
@@ -57,7 +60,6 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
57 60
     private ICaseLogRecordService caseLogRecordService;
58 61
     @Autowired
59 62
     private RedisCache redisCache;
60
-
61 63
     @Autowired
62 64
     private SendMailRecordMapper sendMailRecordMapper;
63 65
 
@@ -160,7 +162,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
160 162
             datas.put("arbitratorName", arbitratorName);
161 163
             Integer arbitratMethod = caseApplication1.getArbitratMethod();
162 164
             Date hearDate = caseApplication1.getHearDate();
163
-            if (hearDate!=null){
165
+            if (hearDate != null) {
164 166
                 String hearDateStr = sdf.format(hearDate);
165 167
                 //线上开庭时
166 168
                 if (arbitratMethod == 1) {
@@ -264,10 +266,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
264 266
             datas.put("year", year);
265 267
             String month = String.format("%02d", now.getMonthValue());
266 268
             String day = String.format("%02d", now.getDayOfMonth());
267
-            String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
268
-            //String modalFilePath = "D:/develop/新裁决书模板.docx";
269
-            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
270
-            //String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day;
269
+            //String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
270
+            String modalFilePath = "D:/develop/新裁决书模板.docx";
271
+            //String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
272
+            String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day;
271 273
             String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
272 274
             String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
273 275
             String resultFilePath = saveFolderPath + "/" + fileName;
@@ -280,24 +282,34 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
280 282
             Path destinationPath = new File(resultFilePath).toPath();
281 283
             Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
282 284
             String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
285
+            File file = new File(docFilePath);
286
+            if (file.exists()) {
287
+                InputStream in = new FileInputStream(file);
288
+                XWPFDocument xwpfDocument = new XWPFDocument(in);
289
+                WordUtil.changeText(xwpfDocument);
290
+            }
283 291
             String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
284
-            //修改案件状态
285
-            caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
286
-            caseApplicationMapper.submitCaseApplication(caseApplication1);
287
-            //将裁决书保存到附件表里
288 292
             CaseAttach caseAttach = CaseAttach.builder()
289 293
                     .caseAppliId(id)
290 294
                     .annexName(saveName)
291 295
                     .annexPath(savePath)
292 296
                     .annexType(3)
293 297
                     .build();
294
-            int i = caseAttachMapper.save(caseAttach);
295
-            if (i > 0) {
296
-                if (arbitrateRecord1 != null) {
297
-                    Integer annexId = caseAttach.getAnnexId();
298
-                    //将附件id保存到仲裁记录表里面
299
-                    arbitrateRecord1.setAnnexId(annexId);
300
-                    arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
298
+            //保存到附件表里,先判断之前有没有,有的话更新,没有的话新增
299
+            List<CaseAttach> caseAttachList = caseAttachMapper.getCaseAttachByCaseIdAndType(caseAttach);
300
+            if (caseAttachList != null ) {
301
+                //之前已经生成过了,更新
302
+                caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
303
+            }else {
304
+                //之前没生成过,新增
305
+                int i = caseAttachMapper.save(caseAttach);
306
+                if (i > 0) {
307
+                    if (arbitrateRecord1 != null) {
308
+                        Integer annexId = caseAttach.getAnnexId();
309
+                        //将附件id保存到仲裁记录表里面
310
+                        arbitrateRecord1.setAnnexId(annexId);
311
+                        arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
312
+                    }
301 313
                 }
302 314
             }
303 315
             return AjaxResult.success("裁决书已生成");

+ 0
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Прегледај датотеку

@@ -2037,7 +2037,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2037 2037
                 caseApplication.setFilearbitraUrl(filearbitraUrl);
2038 2038
             }
2039 2039
         }
2040
-
2041 2040
         return caseApplication;
2042 2041
     }
2043 2042
 

+ 353
- 30
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java Прегледај датотеку

@@ -3,21 +3,27 @@ package com.ruoyi.wisdomarbitrate.service.impl;
3 3
 import cn.hutool.core.collection.CollectionUtil;
4 4
 import com.ruoyi.common.constant.CaseApplicationConstants;
5 5
 import com.ruoyi.common.core.domain.AjaxResult;
6
+import com.ruoyi.common.core.redis.RedisCache;
6 7
 import com.ruoyi.common.utils.WordUtil;
7 8
 import com.ruoyi.wisdomarbitrate.domain.*;
8 9
 import com.ruoyi.wisdomarbitrate.mapper.*;
10
+import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
9 11
 import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
10 12
 import com.ruoyi.common.utils.SmsUtils;
11 13
 import com.ruoyi.wisdomarbitrate.service.ICaseArbitrateService;
14
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
12 15
 import org.springframework.beans.factory.annotation.Autowired;
13 16
 import org.springframework.stereotype.Service;
14 17
 import org.springframework.transaction.annotation.Transactional;
15 18
 
16 19
 import java.io.File;
20
+import java.io.FileInputStream;
17 21
 import java.io.IOException;
22
+import java.io.InputStream;
18 23
 import java.nio.file.Files;
19 24
 import java.nio.file.Path;
20 25
 import java.nio.file.StandardCopyOption;
26
+import java.text.SimpleDateFormat;
21 27
 import java.time.LocalDate;
22 28
 import java.time.ZoneId;
23 29
 import java.util.*;
@@ -40,7 +46,10 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
40 46
     private CaseAttachMapper caseAttachMapper;
41 47
     @Autowired
42 48
     private SmsRecordMapper smsRecordMapper;
43
-
49
+    @Autowired
50
+    private IAdjudicationService adjudicationService;
51
+    @Autowired
52
+    private RedisCache redisCache;
44 53
     @Override
45 54
     @Transactional
46 55
     public AjaxResult examineArbitrateMethod(CaseApplication caseApplication, Integer opinion) {
@@ -155,7 +164,6 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
155 164
         } else {
156 165
             //提交仲裁结果
157 166
             int i = arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecord);
158
-
159 167
             if (i > 0) {
160 168
                 //案件日志表里添加数据
161 169
                 CaseLogRecord caseLogRecord = new CaseLogRecord();
@@ -167,16 +175,50 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
167 175
                 caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
168 176
                 // 新增日志
169 177
                 CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.GENERATED_ARBITRATION, "");
178
+            }
179
+        }
170 180
 
181
+
182
+        //根据仲裁方式决定生成裁决书还是庭审笔录
183
+        Integer arbitratMethod = caseApplication1.getArbitratMethod();
184
+        if (arbitratMethod == 1) {
185
+            //开庭审理,需要生成裁决书和庭审笔录
186
+            Boolean aBoolean = generateTrialTranscripts(arbitrateRecord);
187
+            Boolean aBoolean1 = generateAward(arbitrateRecord);
188
+            if (aBoolean && aBoolean1){
189
+                //修改案件状态
190
+                caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
191
+                int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
192
+                if (i > 0) {
193
+                    return AjaxResult.success("审理成功");
194
+                }
195
+            }
196
+        } else if (arbitratMethod == 2) {
197
+            //书面审理,只生成裁决书
198
+            Boolean aBoolean = generateAward(arbitrateRecord);
199
+            if (aBoolean){
200
+                //修改案件状态
201
+                caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
202
+                int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
203
+                if (i > 0) {
204
+                    return AjaxResult.success("审理成功");
205
+                }
171 206
             }
207
+        } else {
208
+            return AjaxResult.error("请确认仲裁方式");
172 209
         }
210
+        return null;
211
+    }
212
+
173 213
 
174
-        //生成庭审笔录
214
+    //生成庭审笔录
215
+    private Boolean generateTrialTranscripts(ArbitrateRecord arbitrateRecord) {
175 216
         try {
176 217
             Map<String, Object> datas = new HashMap<>();
177
-            Long id = caseApplication.getId();
178
-
179
-
218
+            Long id = arbitrateRecord.getCaseAppliId();
219
+            CaseApplication caseApplication = new CaseApplication();
220
+            caseApplication.setId(id);
221
+            CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
180 222
             //获取案件关联人信息
181 223
             CaseAffiliate caseAffiliate = new CaseAffiliate();
182 224
             caseAffiliate.setCaseAppliId(id);
@@ -200,10 +242,10 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
200 242
                     }
201 243
                 }
202 244
             }
203
-            String arbitratorName = caseApplication.getArbitratorName();
204
-            datas.put("caseName", caseApplication.getCaseName());
245
+            String arbitratorName = caseApplication1.getArbitratorName();
246
+            datas.put("caseName", caseApplication1.getCaseName());
205 247
             datas.put("arbitratorName", arbitratorName);
206
-            Date hearDate = caseApplication.getHearDate();
248
+            Date hearDate = caseApplication1.getHearDate();
207 249
             if (hearDate != null) {
208 250
                 LocalDate localDate = hearDate.toInstant()
209 251
                         .atZone(ZoneId.systemDefault())
@@ -216,7 +258,7 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
216 258
                 datas.put("hearMonths", null);
217 259
                 datas.put("hearDay", null);
218 260
             }
219
-            datas.put("appArbitrationClaims", caseApplication.getArbitratClaims());
261
+            datas.put("appArbitrationClaims", caseApplication1.getArbitratClaims());
220 262
             datas.put("evidenDetermi", arbitrateRecord.getEvidenDetermi());
221 263
             datas.put("factDetermi", arbitrateRecord.getFactDetermi());
222 264
             datas.put("caseSketch", arbitrateRecord.getCaseSketch());
@@ -230,10 +272,10 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
230 272
             datas.put("year", year);
231 273
             datas.put("months", month);
232 274
             datas.put("day", day);
233
-            String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
234
-//            String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
235
-            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
236
-//            String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
275
+           // String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
276
+            String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
277
+           // String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
278
+           String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
237 279
             String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
238 280
             String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
239 281
             String resultFilePath = saveFolderPath + "/" + fileName;
@@ -247,34 +289,315 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
247 289
             Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
248 290
             String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
249 291
             String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
250
-
251
-            //修改案件状态
252
-            caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
253
-            caseApplicationMapper.submitCaseApplication(caseApplication1);
254
-
255
-            //将裁决书保存到附件表里
256 292
             CaseAttach caseAttach = CaseAttach.builder()
257 293
                     .caseAppliId(id)
258 294
                     .annexName(saveName)
259 295
                     .annexPath(savePath)
260
-                    .annexType(3)
296
+                    .annexType(7)
261 297
                     .build();
262
-            int i = caseAttachMapper.save(caseAttach);
263
-            if (i > 0) {
264
-                if (arbitrateRecord1 != null) {
265
-                    Integer annexId = caseAttach.getAnnexId();
266
-                    //将附件id保存到仲裁记录表里面
267
-                    arbitrateRecord1.setAnnexId(annexId);
268
-                    arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
298
+            //保存到附件表里,先判断之前有没有,有的话更新,没有的话新增
299
+            Long caseAppliId = id;
300
+            Integer annexType = 7;
301
+            List<CaseAttach> caseAttach1 = caseAttachMapper.getCaseAttachByCaseIdAndType(caseAttach);
302
+            if (caseAttach1 != null ) {
303
+                //之前已经生成过了,更新
304
+                caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
305
+            }else {
306
+                //之前没生成过,新增
307
+                int i = caseAttachMapper.save(caseAttach);
308
+                ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
309
+                if (i > 0) {
310
+                    if (arbitrateRecord1 != null) {
311
+                        Integer annexId = caseAttach.getAnnexId();
312
+                        //将附件id保存到仲裁记录表里面
313
+                        arbitrateRecord1.setAnnexId(annexId);
314
+                        arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
315
+                    }
269 316
                 }
270 317
             }
271
-            return AjaxResult.success("裁决书已生成");
318
+            return Boolean.TRUE;
272 319
 
273 320
         } catch (IOException e) {
274 321
             e.printStackTrace();
275
-            return AjaxResult.error("裁决书生成异常");
322
+            return Boolean.FALSE;
276 323
         }
324
+    }
325
+    //生成仲裁文书
326
+    private Boolean generateAward(ArbitrateRecord arbitrateRecord){
327
+        try {
328
+            Map<String, Object> datas = new HashMap<>();
329
+            Long id = arbitrateRecord.getId();
330
+            if (id == null) {
331
+                return null;
332
+            }
333
+            //获取案件详细信息
334
+            CaseApplication caseApplication = new CaseApplication();
335
+            caseApplication.setId(id);
336
+            CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
337
+            //生成编码
338
+            String equipmentNo = getNewEquipmentNo();
339
+            datas.put("num", equipmentNo);
340
+            //获取仲裁记录表里的相关信息
341
+            ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
342
+            //获取案件关联人信息
343
+            CaseAffiliate caseAffiliate = new CaseAffiliate();
344
+            caseAffiliate.setCaseAppliId(id);
345
+            List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
346
+            List<String> nameAgentList = new ArrayList<>();
347
+            if (caseAffiliates != null && caseAffiliates.size() > 0) {
348
+                for (CaseAffiliate affiliate : caseAffiliates) {
349
+                    //获取身份类型
350
+                    int identityType = affiliate.getIdentityType();
351
+                    if (identityType == 1) {    //申请人
352
+                        datas.put("appName", affiliate.getName());
353
+                        datas.put("appAddress", affiliate.getResidenAffili());
354
+                        datas.put("appContactAddress", affiliate.getContactAddress());
355
+                        datas.put("appLegalPerson", affiliate.getCompLegalPerson());
356
+                        datas.put("appLegalPersonTitle", affiliate.getCompLegalperPost());
357
+                        datas.put("appAgentName", affiliate.getNameAgent());
358
+                        datas.put("appAgentTitle", affiliate.getAppliAgentTitle());
359
+                        nameAgentList.add(affiliate.getNameAgent());
360
+                    } else if (identityType == 2) {  //被申请人
361
+                        datas.put("resName", affiliate.getName());
362
+                        datas.put("resAddress", affiliate.getResidenAffili());
363
+                        datas.put("resSex", affiliate.getResponSex());
364
+                        Date responBirth = affiliate.getResponBirth();
365
+                        if (responBirth != null) {
366
+                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
367
+                            String responBirthStr = sdf.format(responBirth);
368
+                            datas.put("resDateOfBirth", responBirthStr);
277 369
 
370
+                        }
278 371
 
372
+                        datas.put("resContactAddress", affiliate.getContactAddress());
373
+                        nameAgentList.add(affiliate.getNameAgent());
374
+                    }
375
+                }
376
+            }
377
+            Date createTime = caseApplication1.getCreateTime();
378
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
379
+            // 将日期格式化为字符串
380
+            String createTimeStr = sdf.format(createTime);
381
+            datas.put("submissionDate", createTimeStr);
382
+            Date registerDate = caseApplication1.getRegisterDate();
383
+            String registerDateStr = sdf.format(registerDate);
384
+            datas.put("acceptDate", registerDateStr);
385
+            //反请求
386
+            Integer adjudicaCounter = caseApplication1.getAdjudicaCounter();
387
+            String counterclaim = "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" +
388
+                    "《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" +
389
+                    "仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。";
390
+            if (adjudicaCounter == null) {
391
+                datas.put("counterclaim", null);
392
+            } else if (adjudicaCounter == 1) {
393
+                datas.put("counterclaim", counterclaim);
394
+            } else {
395
+                datas.put("counterclaim", null);
396
+            }
397
+            //财产保全
398
+            Integer properPreser = caseApplication1.getProperPreser();
399
+            String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" +
400
+                    "第二十八条之规定,将该申请提交至法院。";
401
+            if (properPreser == null) {
402
+                datas.put("preservation", null);
403
+            } else if (properPreser == 1) {
404
+                datas.put("preservation", preservation);
405
+            } else {
406
+                datas.put("preservation", null);
407
+            }
408
+            //管辖权异议
409
+            Integer objectiJuris = caseApplication1.getObjectiJuris();
410
+            String jurisdictionalObjection = "本案受理后,被申请人向仲裁委提交了《XX管辖异议申请书》,认为XXXXXX" +
411
+                    ",仲裁委经审理,当庭驳回了被申请人的管辖异议申请,并告知被申请人具体的事实和理由将在裁决书中一并列明。";
412
+            if (objectiJuris == null) {
413
+                datas.put("jurisdictionalObjection", null);
414
+            } else if (objectiJuris == 1) {
415
+                datas.put("jurisdictionalObjection", jurisdictionalObjection);
416
+            } else {
417
+                datas.put("jurisdictionalObjection", null);
418
+            }
419
+            String arbitratorName = caseApplication1.getArbitratorName();
420
+            datas.put("arbitratorName", arbitratorName);
421
+            Integer arbitratMethod = caseApplication1.getArbitratMethod();
422
+            Date hearDate = caseApplication1.getHearDate();
423
+            if (hearDate != null) {
424
+                String hearDateStr = sdf.format(hearDate);
425
+                //线上开庭时
426
+                if (arbitratMethod == 1) {
427
+                    String onLine1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于";
428
+                    String onLine2 = "通过仲裁委智慧仲裁平台开庭审理了本案。";
429
+                    datas.put("onLine1", onLine1);
430
+                    datas.put("hearDate", hearDateStr);
431
+                    datas.put("onLine2", onLine2);
432
+                } else {
433
+                    //书面仲裁时
434
+                    String written1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于";
435
+                    String written2 = "在仲裁委所在地开庭审理了本案。";
436
+                    datas.put("written1", written1);
437
+                    datas.put("hearDate1", hearDateStr);
438
+                    datas.put("written2", written2);
439
+                }
440
+            }
441
+            Integer isAbsence = caseApplication1.getIsAbsence();
442
+            if (isAbsence == null) {
443
+                datas.put("absent1", null);
444
+                datas.put("absent2", null);
445
+                datas.put("absent3", null);
446
+                datas.put("absent4", null);
447
+                datas.put("absent5", null);
448
+                datas.put("attend1", null);
449
+                datas.put("attend2", null);
450
+                datas.put("attend3", null);
451
+                datas.put("attend4", null);
452
+                datas.put("attend5", null);
453
+                datas.put("attend6", null);
454
+                datas.put("attend7", null);
455
+                datas.put("appAgentName1", null);
456
+                datas.put("appAgentName2", null);
457
+                datas.put("resAgentName", null);
458
+            } else if (isAbsence == 1) {
459
+                //缺席审理
460
+                String absent1 = "申请人的特别授权委托代理人";
461
+                String absent2 = "出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" +
462
+                        "《2022年版仲裁规则》第四十条第(二)项的规定,对本案进行了缺席审理。";
463
+                String absent3 = "庭审中,申请人陈述了仲裁请求事项及事实与理由,出示了证据材料并进行了说明," +
464
+                        "发表了意见,回答了仲裁庭的提问,并作了最后陈述。因被申请人缺席庭审,故仲裁庭无法组织调解。";
465
+                String absent4 = "(二/三)当事人提供的证据材料\n" +
466
+                        "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:";
467
+                String absent5 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" +
468
+                        "第四十条第(二)项、第五十一条的规定,缺席裁决如下:";
469
+                datas.put("absent1", absent1);
470
+                datas.put("absent2", absent2);
471
+                datas.put("absent3", absent3);
472
+                datas.put("absent4", absent4);
473
+                datas.put("absent5", absent5);
474
+                datas.put("appAgentName1", nameAgentList.get(0));
475
+            } else {
476
+                //出席审理
477
+                String attend1 = "申请人的特别授权委托代理人";
478
+                String attend2 = "和被申请人本人/的特别授权委托代理人";
479
+                String attend3 = "出席了庭审。";
480
+                String attend4 = "庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;" +
481
+                        "双方当事人均出示了证据材料并对对方的证据材料进行了质证;申请人出示了证据材料," +
482
+                        "被申请人对对方的证据材料进行了质证;双方当事人均回答了仲裁庭的提问,进行了辩论," +
483
+                        "并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。";
484
+                String attend5 = "(二)被申请人的答辩意见";
485
+                String attend6 = "(二/三)当事人提供的证据材料及对方的质证意见\n" +
486
+                        "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:";
487
+                String attend7 = "被申请人对上述材料的质证意见为:";
488
+                datas.put("attend1", attend1);
489
+                datas.put("attend2", attend2);
490
+                datas.put("attend3", attend3);
491
+                datas.put("attend4", attend4);
492
+                datas.put("attend5", attend5);
493
+                datas.put("attend6", attend6);
494
+                datas.put("attend7", attend7);
495
+                datas.put("responCrossOpin", caseApplication1.getResponCrossOpin());
496
+                datas.put("appAgentName2", nameAgentList.get(0));
497
+                datas.put("resAgentName", nameAgentList.get(1));
498
+                if (arbitratMethod == 1) {
499
+                    //被申出席+开庭
500
+                    String attend8 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" +
501
+                            "第五十一条的规定,裁决如下:";
502
+                    datas.put("attend8", attend8);
503
+                } else {
504
+                    //被申出席+书面
505
+                    String attend9 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" +
506
+                            "第五十一条、第五十八条的规定,裁决如下:";
507
+                    datas.put("attend9", attend9);
508
+                }
509
+            }
510
+            datas.put("claims", caseApplication1.getArbitratClaims());
511
+            datas.put("request", caseApplication1.getRequestRule());
512
+            //申请人证据材料
513
+            datas.put("appEvidenceMaterial", null);
514
+            //被申请人证据材料
515
+            datas.put("resEvidenceMaterial", null);
516
+            datas.put("applicaCrossOpin", caseApplication1.getApplicaCrossOpin());
517
+            if (arbitrateRecord1 != null) {
518
+                datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
519
+                datas.put("arbitrateThink", arbitrateRecord1.getArbitrateThink());
520
+                datas.put("rulingFollows", arbitrateRecord1.getRulingFollows());
521
+            }
522
+            LocalDate now = LocalDate.now();
523
+            String year = Integer.toString(now.getYear());
524
+            datas.put("year", year);
525
+            String month = String.format("%02d", now.getMonthValue());
526
+            String day = String.format("%02d", now.getDayOfMonth());
527
+            //String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
528
+            String modalFilePath = "D:/develop/新裁决书模板.docx";
529
+            //String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
530
+            String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day;
531
+            String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
532
+            String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
533
+            String resultFilePath = saveFolderPath + "/" + fileName;
534
+            // 创建日期目录
535
+            File saveFolder = new File(saveFolderPath);
536
+            if (!saveFolder.exists()) {
537
+                saveFolder.mkdirs();
538
+            }
539
+            Path sourcePath = new File(modalFilePath).toPath();
540
+            Path destinationPath = new File(resultFilePath).toPath();
541
+            Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
542
+            String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
543
+            File file = new File(docFilePath);
544
+            if (file.exists()) {
545
+                InputStream in = new FileInputStream(file);
546
+                XWPFDocument xwpfDocument = new XWPFDocument(in);
547
+                WordUtil.changeText(xwpfDocument);
548
+            }
549
+            String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
550
+            CaseAttach caseAttach = CaseAttach.builder()
551
+                    .caseAppliId(id)
552
+                    .annexName(saveName)
553
+                    .annexPath(savePath)
554
+                    .annexType(3)
555
+                    .build();
556
+            //保存到附件表里,先判断之前有没有,有的话更新,没有的话新增
557
+            List<CaseAttach> caseAttachList = caseAttachMapper.getCaseAttachByCaseIdAndType(caseAttach);
558
+            if (caseAttachList != null ) {
559
+                //之前已经生成过了,更新
560
+                caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
561
+            }else {
562
+                //之前没生成过,新增
563
+                int i = caseAttachMapper.save(caseAttach);
564
+                if (i > 0) {
565
+                    if (arbitrateRecord1 != null) {
566
+                        Integer annexId = caseAttach.getAnnexId();
567
+                        //将附件id保存到仲裁记录表里面
568
+                        arbitrateRecord1.setAnnexId(annexId);
569
+                        arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
570
+                    }
571
+                }
572
+            }
573
+            return Boolean.TRUE;
574
+        } catch (IOException e) {
575
+            return Boolean.FALSE;
576
+        }
577
+    }
578
+    public String getNewEquipmentNo() {
579
+        Object awardNum = redisCache.getCacheObject("awardNum");
580
+        if (awardNum == null) {
581
+            redisCache.setCacheObject("awardNum", "00001");
582
+            String s = redisCache.getCacheObject("awardNum").toString();
583
+            // 字符串数字解析为整数
584
+            int no = Integer.parseInt(s);
585
+            // 最新设备编号自增1
586
+            int newEquipment = ++no;
587
+            // 将整数格式化为5位数字
588
+            s = String.format("%05d", newEquipment);
589
+            redisCache.setCacheObject("awardNum", s);
590
+            return s;
591
+        } else {
592
+            String s = awardNum.toString();
593
+            // 字符串数字解析为整数
594
+            int no = Integer.parseInt(s);
595
+            // 最新设备编号自增1
596
+            int newEquipment = ++no;
597
+            // 将整数格式化为5位数字
598
+            s = String.format("%05d", newEquipment);
599
+            redisCache.setCacheObject("awardNum", s);
600
+            return s;
601
+        }
279 602
     }
280 603
 }

+ 37
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/MyTest.java Прегледај датотеку

@@ -0,0 +1,37 @@
1
+package com.ruoyi.wisdomarbitrate.utils;
2
+
3
+import java.io.BufferedInputStream;
4
+import java.io.FileOutputStream;
5
+import java.io.IOException;
6
+import java.io.InputStream;
7
+import java.net.URL;
8
+
9
+public class MyTest {
10
+    public static void download(String fileUrl, String saveFilePath) throws IOException {
11
+        URL url = new URL(fileUrl);
12
+        InputStream inputStream = url.openStream();
13
+        BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
14
+        FileOutputStream fileOutputStream = new FileOutputStream(saveFilePath);
15
+
16
+        byte[] buffer = new byte[1024];
17
+        int bytesRead = 0;
18
+        while ((bytesRead = bufferedInputStream.read(buffer, 0, buffer.length)) != -1) {
19
+            fileOutputStream.write(buffer, 0, bytesRead);
20
+        }
21
+
22
+        fileOutputStream.close();
23
+        bufferedInputStream.close();
24
+        inputStream.close();
25
+    }
26
+
27
+    public static void main(String[] args) {
28
+        String fileUrl = "https://esignoss.esign.cn/1111563786/0e16cc53-fe2e-403b-b901-587778a8ea92/3ed8f1b0bd2640e895fcfbaffdec0a1e.pdf?Expires=1698742492&OSSAccessKeyId=LTAI4G23YViiKnxTC28ygQzF&Signature=K%2Bb5k7DqNmaxeu%2Fct5qis4qor7s%3D";
29
+        String saveFilePath = "D:\\home\\example.pdf";
30
+        try {
31
+            download(fileUrl, saveFilePath);
32
+            System.out.println("File downloaded successfully.");
33
+        } catch (IOException e) {
34
+            e.printStackTrace();
35
+        }
36
+    }
37
+}

+ 13
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml Прегледај датотеку

@@ -31,6 +31,19 @@
31 31
         where case_appli_id =#{id}
32 32
     </select>
33 33
 
34
+    <select id="getCaseAttachByCaseIdAndType" resultType="com.ruoyi.wisdomarbitrate.domain.CaseAttach" resultMap="CaseAttachResult">
35
+        select annex_id,case_appli_id,annex_name,annex_path,annex_type,note,use_id,use_account
36
+        from case_attach
37
+        <where>
38
+            <if test="caseAppliId != null ">
39
+                AND case_appli_id = #{caseAppliId}
40
+            </if>
41
+            <if test="annexType != null ">
42
+                AND annex_type = #{annexType}
43
+            </if>
44
+        </where>
45
+    </select>
46
+
34 47
     <select id="queryCaseAttachList" resultMap="CaseAttachResult">
35 48
         select annex_id,case_appli_id,annex_name,annex_path,annex_type,note,use_id,use_account
36 49
         from case_attach