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