Przeglądaj źródła

Merge branch 'dev' of http://git.xayunmei.com/SH-Arbitrate/Arbitrate-Backend into qtz3

qitz 2 lat temu
rodzic
commit
ea94880fff

+ 56
- 6
ruoyi-common/src/main/java/com/ruoyi/common/utils/WordUtil.java Wyświetl plik

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

+ 12
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java Wyświetl plik

@@ -29,6 +29,18 @@ public class CaseApplication  extends BaseEntity {
29 29
     private Date registerDate;
30 30
     /** 仲裁方式 */
31 31
     private Integer arbitratMethod;
32
+    /**
33
+     * 是否导入,0手动录入,1导入,默认0
34
+     */
35
+    private Integer importFlag;
36
+
37
+    public Integer getImportFlag() {
38
+        return importFlag;
39
+    }
40
+
41
+    public void setImportFlag(Integer importFlag) {
42
+        this.importFlag = importFlag;
43
+    }
32 44
 
33 45
     public String getSelectCaseStatus() {
34 46
         return selectCaseStatus;

+ 5
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAttachMapper.java Wyświetl plik

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

+ 28
- 14
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java Wyświetl plik

@@ -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
 
@@ -108,7 +110,6 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
108 110
                             datas.put("resDateOfBirth", responBirthStr);
109 111
 
110 112
                         }
111
-
112 113
                         datas.put("resContactAddress", affiliate.getContactAddress());
113 114
                         nameAgentList.add(affiliate.getNameAgent());
114 115
                     }
@@ -160,7 +161,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
160 161
             datas.put("arbitratorName", arbitratorName);
161 162
             Integer arbitratMethod = caseApplication1.getArbitratMethod();
162 163
             Date hearDate = caseApplication1.getHearDate();
163
-            if (hearDate!=null){
164
+            if (hearDate != null) {
164 165
                 String hearDateStr = sdf.format(hearDate);
165 166
                 //线上开庭时
166 167
                 if (arbitratMethod == 1) {
@@ -280,26 +281,39 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
280 281
             Path destinationPath = new File(resultFilePath).toPath();
281 282
             Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
282 283
             String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
284
+            File file = new File(docFilePath);
285
+            if (file.exists()) {
286
+                InputStream in = new FileInputStream(file);
287
+                XWPFDocument xwpfDocument = new XWPFDocument(in);
288
+                WordUtil.changeText(xwpfDocument);
289
+            }
283 290
             String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
284
-            //修改案件状态
285
-            caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
286
-            caseApplicationMapper.submitCaseApplication(caseApplication1);
287
-            //将裁决书保存到附件表里
288 291
             CaseAttach caseAttach = CaseAttach.builder()
289 292
                     .caseAppliId(id)
290 293
                     .annexName(saveName)
291 294
                     .annexPath(savePath)
292 295
                     .annexType(3)
293 296
                     .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);
297
+            //保存到附件表里,先判断之前有没有,有的话更新,没有的话新增
298
+            List<CaseAttach> caseAttachList = caseAttachMapper.getCaseAttachByCaseIdAndType(caseAttach);
299
+            if (caseAttachList != null && caseAttachList.size()>0) {
300
+                //之前已经生成过了,更新
301
+                int i = caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
302
+            }else {
303
+                //之前没生成过,新增
304
+                int i = caseAttachMapper.save(caseAttach);
305
+                if (i > 0) {
306
+                    if (arbitrateRecord1 != null) {
307
+                        Integer annexId = caseAttach.getAnnexId();
308
+                        //将附件id保存到仲裁记录表里面
309
+                        arbitrateRecord1.setAnnexId(annexId);
310
+                        arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
311
+                    }
301 312
                 }
302 313
             }
314
+            //修改案件状态
315
+            caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
316
+            caseApplicationMapper.submitCaseApplication(caseApplication1);
303 317
             return AjaxResult.success("裁决书已生成");
304 318
         } catch (IOException e) {
305 319
             return AjaxResult.error(e + "请检查文件路径是否有误");

+ 54
- 27
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Wyświetl plik

@@ -44,6 +44,7 @@ import org.springframework.web.multipart.MultipartFile;
44 44
 
45 45
 import java.io.*;
46 46
 import java.math.BigDecimal;
47
+import java.math.RoundingMode;
47 48
 import java.nio.file.Files;
48 49
 import java.nio.file.Path;
49 50
 import java.nio.file.StandardCopyOption;
@@ -147,7 +148,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
147 148
                 }
148 149
                 if (role.getRoleName().equals("法律顾问")) {
149 150
                     // 查询角色有关的用户部门
150
-                    List<Long> deptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
151
+              //      List<Long> deptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
152
+                    List<Long> deptIds =new ArrayList<>();
153
+                    deptIds.add(sysUser.getDeptId());
151 154
                     caseApplication.setDeptIds(deptIds);
152 155
                 }
153 156
                 if (StrUtil.isEmpty(caseApplication.getNameId()) && role.getRoleName().equals("申请人")) {
@@ -205,7 +208,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
205 208
             }
206 209
             if(role.getRoleName().equals("法律顾问")){
207 210
                 // 查询角色有关的用户部门
208
-                List<Long> deptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
211
+               // List<Long> deptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
212
+                List<Long> deptIds =new ArrayList<>();
213
+                deptIds.add(sysUser.getDeptId());
209 214
                 caseApplication.setDeptIds(deptIds);
210 215
             }
211 216
             if(StrUtil.isEmpty(caseApplication.getNameId())&&role.getRoleName().equals("申请人")){
@@ -901,8 +906,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
901 906
     public int editCaseApplication(CaseApplication caseApplication) {
902 907
         //根据仲裁费用计费规则计算应缴费用
903 908
         //暂时设置计费比率为0.01
904
-        BigDecimal feeRate = new BigDecimal(0.01);
905
-        BigDecimal feePayable  = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
909
+        BigDecimal feeRate = new BigDecimal("0.01");
910
+        BigDecimal feePayable  = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, RoundingMode.HALF_UP);
906 911
         caseApplication.setFeePayable(feePayable);
907 912
         caseApplication.setUpdateBy(getUsername());
908 913
 
@@ -965,6 +970,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
965 970
         return rows;
966 971
     }
967 972
 
973
+
968 974
     /**
969 975
      * 组装申请代理人信息
970 976
      * @param caseAffiliate
@@ -1172,34 +1178,21 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1172 1178
                 CaseApplication caseApplication = caseApplicationList.get(i);
1173 1179
 
1174 1180
                 // 导入校验
1175
-                importValid(caseApplication);
1181
+                importValid(caseApplication,deptMap);
1176 1182
                 // 校验成功的数据
1177 1183
                 if(StrUtil.isEmpty(caseApplication.getErrorMsg())) {
1178 1184
                     //根据仲裁费用计费规则计算应缴费用
1179 1185
                     //暂时设置计费比率为0.01
1180
-                    BigDecimal feeRate = new BigDecimal(0.01);
1181
-                    BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP);
1186
+                    BigDecimal feeRate = new BigDecimal("0.01");
1187
+                    BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, RoundingMode.HALF_UP);
1182 1188
                     caseApplication.setFeePayable(feePayable);
1183 1189
 
1184 1190
                     //赋值CaseApplication的案件关联人信息
1185 1191
                     List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
1186 1192
                     // 组装案件关联人信息
1187 1193
                     assignmentCaseAffiliates(caseApplication, caseAffiliatesnew, deptMap,roleId);
1188
-
1189
-//                int caseApplicationCount = selectCaseApplicationCount(caseApplication);
1190
-//                if(caseApplicationCount>0){
1191
-//                    failureNum++;
1192
-//                    failureMsg.append("<br/>" + failureNum + "、立案编号 " + caseApplication.getCaseNum() + " 已存在");
1193
-//                }else {
1194
-//                    caseApplicationListinsert.add(caseApplication);
1195
-//                }
1196
-                    if(StrUtil.isEmpty(caseApplication.getErrorMsg())) {
1197
-                        caseApplicationListinsert.add(caseApplication);
1198
-                    }else {
1199
-                        // 拼接错误信息
1200
-                        failureMsg.append("<br/>").append("第").append(i+2).append("行:").append(caseApplication.getErrorMsg().toString());
1201
-
1202
-                    }
1194
+                    caseApplication.setImportFlag(1);
1195
+                    caseApplicationListinsert.add(caseApplication);
1203 1196
                 }else {
1204 1197
                     // 拼接错误信息
1205 1198
                     failureMsg.append("<br/>").append("第").append(i+2).append("行:").append(caseApplication.getErrorMsg().toString());
@@ -1279,7 +1272,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1279 1272
      * @param caseApplication
1280 1273
      * @param
1281 1274
      */
1282
-    private void importValid(CaseApplication caseApplication) {
1275
+    private void importValid(CaseApplication caseApplication,Map<String, Long> deptMap) {
1283 1276
         StringBuilder failureMsg=new StringBuilder();
1284 1277
         caseApplication.setErrorMsg(failureMsg);
1285 1278
         // 校验基本字段
@@ -1287,7 +1280,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1287 1280
         // 校验申请人信息
1288 1281
         validApplicationColumn(caseApplication,failureMsg);
1289 1282
         // 校验申请人代理信息
1290
-        validApplicationAgentColumn(caseApplication,failureMsg);
1283
+        validApplicationAgentColumn(caseApplication,failureMsg,deptMap);
1291 1284
         // 校验被申请人信息
1292 1285
         validDebtorApplicationColumn(caseApplication,failureMsg);
1293 1286
         // 校验被申请人代理信息
@@ -1378,7 +1371,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1378 1371
      * @param caseApplication
1379 1372
      * @param failureMsg
1380 1373
      */
1381
-    private void validApplicationAgentColumn(CaseApplication caseApplication, StringBuilder failureMsg) {
1374
+    private void validApplicationAgentColumn(CaseApplication caseApplication, StringBuilder failureMsg,Map<String, Long> deptMap) {
1382 1375
         if( StrUtil.isEmpty(caseApplication.getNameAgent())){
1383 1376
             failureMsg.append("【申请人主体信息-代理人姓名】字段不能为空;");
1384 1377
         }else if(caseApplication.getNameAgent().length()>50){
@@ -1389,6 +1382,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1389 1382
         }else if(caseApplication.getIdentityNumAgent().length()>50){
1390 1383
             failureMsg.append("【申请人主体信息-代理人身份证号】字段超出指定长度,最大长度为50;");
1391 1384
         }
1385
+        validAgentInfo(caseApplication,failureMsg,deptMap);
1392 1386
         String contactTelphoneAgent = caseApplication.getContactTelphoneAgent();
1393 1387
         if( StrUtil.isEmpty(contactTelphoneAgent)){
1394 1388
             failureMsg.append("【申请人主体信息-代理人联系电话】字段不能为空;");
@@ -1401,7 +1395,34 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1401 1395
             failureMsg.append("【申请人主体信息-代理人联系地址】字段超出指定长度,最大长度为50;");
1402 1396
         }
1403 1397
     }
1398
+    /**
1399
+     * 校验代理人与组织机构关系
1400
+     * @param caseApplication
1401
+     * @param failureMsg
1402
+     * @return
1403
+     */
1404
+    private void validAgentInfo(CaseApplication caseApplication, StringBuilder failureMsg,Map<String, Long> deptMap) {
1405
+        // 申请机构与代理人都不为空,校验代理人与组织机构关系(代理人必须在该部门下)
1406
+        if (StrUtil.isNotEmpty(caseApplication.getName())&&StrUtil.isNotEmpty(caseApplication.getNameAgent())) {
1407
+            String applicationOrganId="";
1408
+            // 申请机构已经存在
1409
+            if(deptMap.containsKey(caseApplication.getName())){
1410
+                applicationOrganId=String.valueOf(deptMap.get(caseApplication.getName()));
1411
+            }
1412
+            // 根据代理人身份证去用户表查询
1413
+            SysUser agentUser = sysUserMapper.selectUserByIdCard(caseApplication.getIdentityNumAgent());
1414
+            // 代理人的部门和申请机构不匹配
1415
+            if (null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(applicationOrganId)) {
1416
+//                return "该申请代理人已在"+agentUser.getDeptName()+"申请机构下存在,请检查填写信息是否正确";
1417
+                if (null != agentUser.getDept() && StrUtil.isNotEmpty(agentUser.getDept().getDeptName())) {
1418
+                    failureMsg.append("该申请代理人已在【").append(agentUser.getDept().getDeptName()).append("】申请机构下存在,请检查填写信息是否正确");
1419
+                } else {
1420
+                    failureMsg.append( "该申请代理人已存在,与申请机构不匹配,请检查填写信息是否正确");
1421
+                }
1422
+            }
1404 1423
 
1424
+        }
1425
+    }
1405 1426
     /**
1406 1427
      * 校验申请人主题信息
1407 1428
      * @param caseApplication
@@ -1463,6 +1484,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1463 1484
         if( caseApplication.getLoanEndDate()== null){
1464 1485
             failureMsg.append("【借款结束日期】字段不合法;");
1465 1486
         }
1487
+        if( caseApplication.getLoanStartDate()!= null && caseApplication.getLoanEndDate()!= null && caseApplication.getLoanStartDate().after(caseApplication.getLoanEndDate()) ){
1488
+            failureMsg.append("【借款结束日期】不能早于【借款开始日期】;");
1489
+        }
1466 1490
         if( StrUtil.isEmpty(caseApplication.getContractNumber())){
1467 1491
             failureMsg.append("【合同编号】字段不能为空;");
1468 1492
         }else if(caseApplication.getContractNumber().length()>50){
@@ -1502,9 +1526,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1502 1526
             }
1503 1527
         }
1504 1528
         if( StrUtil.isEmpty(caseApplication.getArbitratClaims())){
1505
-            failureMsg.append("【申请人仲裁诉求】字段不能为空;");
1529
+            failureMsg.append("【申请人仲裁请求及事实和理由】字段不能为空;");
1506 1530
         }else if(caseApplication.getArbitratClaims().length()>10000){
1507
-            failureMsg.append("【申请人仲裁诉求】字段超出指定长度,最大长度为10000;");
1531
+            failureMsg.append("【申请人仲裁请求及事实和理由】字段超出指定长度,最大长度为10000;");
1532
+        }
1533
+        if(StrUtil.isNotEmpty(caseApplication.getArbitratClaims())&&caseApplication.getArbitratClaims().length()>10000){
1534
+            failureMsg.append("【申请人请求仲裁庭裁决】字段超出指定长度,最大长度为10000;");
1508 1535
         }
1509 1536
     }
1510 1537
 

+ 337
- 28
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java Wyświetl plik

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

+ 7
- 7
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java Wyświetl plik

@@ -246,13 +246,13 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
246 246
                         .build();
247 247
                 int count = caseAttachMapper.save(caseAttach);
248 248
                 if (count > 0 && annexType != null && annexType != 8) {
249
-                    if (id != null) {
250
-                        //修改案件状态
251
-                        CaseApplication caseApplication = new CaseApplication();
252
-                        caseApplication.setId(id);
253
-                        caseApplication.setCaseStatus(4);
254
-                        caseApplicationMapper.submitCaseApplication(caseApplication);
255
-                    }
249
+//                    if (id != null) {
250
+//                        //修改案件状态
251
+//                        CaseApplication caseApplication = new CaseApplication();
252
+//                        caseApplication.setId(id);
253
+//                        caseApplication.setCaseStatus(4);
254
+//                        caseApplicationMapper.submitCaseApplication(caseApplication);
255
+//                    }
256 256
                     CaseAttach caseAttachselect = new CaseAttach();
257 257
                     caseAttachselect.setAnnexId(caseAttach.getAnnexId());
258 258
                     caseAttachselect.setAnnexName(caseAttach.getAnnexName());

+ 4
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/CaseLogUtils.java Wyświetl plik

@@ -36,6 +36,10 @@ public class CaseLogUtils
36 36
             operLog.setCreateBy(sysUser.getUserName());
37 37
             operLog.setCreateNickName(sysUser.getNickName());
38 38
             operLog.setUpdateBy(sysUser.getUserName());
39
+        }else {
40
+            operLog.setCreateBy("admin");
41
+            operLog.setCreateNickName("管理员");
42
+            operLog.setUpdateBy("admin");
39 43
         }
40 44
         operLog.setCaseAppliId(caseAppliId);
41 45
         operLog.setCaseNode(caseNode);

+ 37
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/MyTest.java Wyświetl plik

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

+ 3
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml Wyświetl plik

@@ -402,6 +402,7 @@
402 402
         <if test="properPreser != null ">proper_preser,</if>
403 403
 
404 404
         <if test="createBy != null  and createBy != ''">create_by,</if>
405
+        <if test="importFlag != null ">import_flag,</if>
405 406
         create_time
406 407
         )values(
407 408
         <if test="caseNum != null and caseNum != ''">#{caseNum},</if>
@@ -428,6 +429,7 @@
428 429
         <if test="properPreser != null ">#{properPreser},</if>
429 430
 
430 431
         <if test="createBy != null  and createBy != ''">#{createBy},</if>
432
+        <if test="importFlag != null ">#{importFlag},</if>
431 433
         sysdate()
432 434
         )
433 435
     </insert>
@@ -539,6 +541,7 @@
539 541
                 AND c.id = #{id}
540 542
             </if>
541 543
         </where>
544
+order by c.create_time desc limit 1
542 545
     </select>
543 546
     <select id="listCaseApplicationByIds" resultMap="CaseApplicationResult">
544 547
         select c.id ,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,

+ 13
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml Wyświetl plik

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