|
|
@@ -2,22 +2,24 @@ package com.ruoyi.wisdomarbitrate.service.impl;
|
|
2
|
2
|
|
|
3
|
3
|
import com.ruoyi.common.constant.CaseApplicationConstants;
|
|
4
|
4
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
5
|
+import com.ruoyi.common.utils.WordUtil;
|
|
|
6
|
+import com.ruoyi.wisdomarbitrate.domain.*;
|
|
|
7
|
+import com.ruoyi.wisdomarbitrate.mapper.*;
|
|
5
|
8
|
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
|
6
|
9
|
import com.ruoyi.common.utils.SmsUtils;
|
|
7
|
|
-import com.ruoyi.wisdomarbitrate.domain.ArbitrateRecord;
|
|
8
|
|
-import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
|
|
9
|
|
-import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
|
10
|
|
-import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord;
|
|
11
|
|
-import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper;
|
|
12
|
|
-import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
|
|
13
|
|
-import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
|
|
14
|
|
-import com.ruoyi.wisdomarbitrate.mapper.CaseLogRecordMapper;
|
|
15
|
10
|
import com.ruoyi.wisdomarbitrate.service.ICaseArbitrateService;
|
|
16
|
11
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
17
|
12
|
import org.springframework.stereotype.Service;
|
|
18
|
13
|
import org.springframework.transaction.annotation.Transactional;
|
|
19
|
14
|
|
|
20
|
|
-import java.util.List;
|
|
|
15
|
+import java.io.File;
|
|
|
16
|
+import java.io.IOException;
|
|
|
17
|
+import java.nio.file.Files;
|
|
|
18
|
+import java.nio.file.Path;
|
|
|
19
|
+import java.nio.file.StandardCopyOption;
|
|
|
20
|
+import java.time.LocalDate;
|
|
|
21
|
+import java.time.ZoneId;
|
|
|
22
|
+import java.util.*;
|
|
21
|
23
|
|
|
22
|
24
|
@Service
|
|
23
|
25
|
public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
|
|
|
@@ -29,6 +31,8 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
|
|
29
|
31
|
private CaseLogRecordMapper caseLogRecordMapper;
|
|
30
|
32
|
@Autowired
|
|
31
|
33
|
private ArbitrateRecordMapper arbitrateRecordMapper;
|
|
|
34
|
+ @Autowired
|
|
|
35
|
+ private CaseAttachMapper caseAttachMapper;
|
|
32
|
36
|
|
|
33
|
37
|
@Override
|
|
34
|
38
|
@Transactional
|
|
|
@@ -109,15 +113,14 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
|
|
109
|
113
|
}
|
|
110
|
114
|
|
|
111
|
115
|
@Override
|
|
|
116
|
+ @Transactional
|
|
112
|
117
|
public AjaxResult writtenHear(ArbitrateRecord arbitrateRecord) {
|
|
113
|
118
|
//查询案件详情
|
|
114
|
119
|
CaseApplication caseApplication = new CaseApplication();
|
|
115
|
120
|
caseApplication.setId(arbitrateRecord.getCaseAppliId());
|
|
116
|
121
|
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
|
117
|
|
- String createBy = caseApplication1.getCreateBy();
|
|
118
|
|
- if (createBy!=null){
|
|
119
|
|
- arbitrateRecord.setCreateBy(createBy);
|
|
120
|
|
- }
|
|
|
122
|
+ String createBy = arbitrateRecord.getCreateBy();
|
|
|
123
|
+
|
|
121
|
124
|
//先判断案件是否已经提交过仲裁结果
|
|
122
|
125
|
ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
|
|
123
|
126
|
if (arbitrateRecord1!=null){
|
|
|
@@ -131,13 +134,9 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
|
|
131
|
134
|
caseLogRecord.setCreateBy(createBy);
|
|
132
|
135
|
}
|
|
133
|
136
|
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
|
|
134
|
|
- //修改案件状态
|
|
135
|
|
- caseApplication.setCaseStatus(CaseApplicationConstants.GENERATED_ARBITRATION);
|
|
136
|
|
- caseApplicationMapper.submitCaseApplication(caseApplication);
|
|
137
|
137
|
// 新增日志
|
|
138
|
138
|
CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.GENERATED_ARBITRATION,"");
|
|
139
|
139
|
|
|
140
|
|
- return AjaxResult.success("提交成功");
|
|
141
|
140
|
}
|
|
142
|
141
|
}else {
|
|
143
|
142
|
//提交仲裁结果
|
|
|
@@ -152,15 +151,116 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
|
|
152
|
151
|
caseLogRecord.setCreateBy(createBy);
|
|
153
|
152
|
}
|
|
154
|
153
|
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
|
|
155
|
|
- //修改案件状态
|
|
156
|
|
- caseApplication.setCaseStatus(CaseApplicationConstants.GENERATED_ARBITRATION);
|
|
157
|
|
- caseApplicationMapper.submitCaseApplication(caseApplication);
|
|
158
|
154
|
// 新增日志
|
|
159
|
155
|
CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.GENERATED_ARBITRATION,"");
|
|
160
|
156
|
|
|
161
|
|
- return AjaxResult.success("提交成功");
|
|
162
|
157
|
}
|
|
163
|
158
|
}
|
|
164
|
|
- return AjaxResult.error("暂无需要提交仲裁结果的案件");
|
|
|
159
|
+
|
|
|
160
|
+ //生成庭审笔录
|
|
|
161
|
+ try {
|
|
|
162
|
+ Map<String, Object> datas = new HashMap<>();
|
|
|
163
|
+ Long id = caseApplication.getId();
|
|
|
164
|
+
|
|
|
165
|
+
|
|
|
166
|
+ //获取案件关联人信息
|
|
|
167
|
+ CaseAffiliate caseAffiliate = new CaseAffiliate();
|
|
|
168
|
+ caseAffiliate.setCaseAppliId(id);
|
|
|
169
|
+ List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
|
|
|
170
|
+ if (caseAffiliates != null && caseAffiliates.size() > 0) {
|
|
|
171
|
+ for (CaseAffiliate affiliate : caseAffiliates) {
|
|
|
172
|
+ //获取身份类型
|
|
|
173
|
+ int identityType = affiliate.getIdentityType();
|
|
|
174
|
+ if (identityType == 1) { //申请人
|
|
|
175
|
+ datas.put("appName", affiliate.getName());
|
|
|
176
|
+ datas.put("appIDNo", affiliate.getIdentityNum());
|
|
|
177
|
+ datas.put("appAddress", affiliate.getContactAddress());
|
|
|
178
|
+ datas.put("appAgentName", affiliate.getNameAgent());
|
|
|
179
|
+ datas.put("appAgentIDNo", affiliate.getIdentityNumAgent());
|
|
|
180
|
+ } else if (identityType == 2) { //被申请人
|
|
|
181
|
+ datas.put("resName", affiliate.getName());
|
|
|
182
|
+ datas.put("resIDNo", affiliate.getIdentityNum());
|
|
|
183
|
+ datas.put("resAddress", affiliate.getContactAddress());
|
|
|
184
|
+ datas.put("resAgentName", affiliate.getNameAgent());
|
|
|
185
|
+ datas.put("resAgentIDNo", affiliate.getIdentityNumAgent());
|
|
|
186
|
+ }
|
|
|
187
|
+ }
|
|
|
188
|
+ }
|
|
|
189
|
+ String arbitratorName = caseApplication.getArbitratorName();
|
|
|
190
|
+ datas.put("caseName", caseApplication.getCaseName());
|
|
|
191
|
+ datas.put("arbitratorName", arbitratorName);
|
|
|
192
|
+ Date hearDate = caseApplication.getHearDate();
|
|
|
193
|
+ if (hearDate != null) {
|
|
|
194
|
+ LocalDate localDate = hearDate.toInstant()
|
|
|
195
|
+ .atZone(ZoneId.systemDefault())
|
|
|
196
|
+ .toLocalDate();
|
|
|
197
|
+ datas.put("hearYear", localDate.getYear());
|
|
|
198
|
+ datas.put("hearMonths", localDate.getMonthValue());
|
|
|
199
|
+ datas.put("hearDay", localDate.getDayOfMonth());
|
|
|
200
|
+ } else {
|
|
|
201
|
+ datas.put("hearYear", null);
|
|
|
202
|
+ datas.put("hearMonths", null);
|
|
|
203
|
+ datas.put("hearDay", null);
|
|
|
204
|
+ }
|
|
|
205
|
+ datas.put("appArbitrationClaims", caseApplication.getArbitratClaims());
|
|
|
206
|
+ datas.put("evidenDetermi", arbitrateRecord.getEvidenDetermi());
|
|
|
207
|
+ datas.put("factDetermi", arbitrateRecord.getFactDetermi());
|
|
|
208
|
+ datas.put("caseSketch", arbitrateRecord.getCaseSketch());
|
|
|
209
|
+ datas.put("arbitrateThink", arbitrateRecord.getArbitrateThink());
|
|
|
210
|
+ datas.put("rulingFollows", arbitrateRecord.getRulingFollows());
|
|
|
211
|
+ datas.put("legalProvisions", "仲裁法");
|
|
|
212
|
+ LocalDate now = LocalDate.now();
|
|
|
213
|
+ String year = Integer.toString(now.getYear());
|
|
|
214
|
+ String month = String.format("%02d", now.getMonthValue());
|
|
|
215
|
+ String day = String.format("%02d", now.getDayOfMonth());
|
|
|
216
|
+ datas.put("year", year);
|
|
|
217
|
+ datas.put("months", month);
|
|
|
218
|
+ datas.put("day", day);
|
|
|
219
|
+ String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
|
|
|
220
|
+// String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
|
|
|
221
|
+ String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
|
|
222
|
+// String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
|
|
|
223
|
+ String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
|
|
|
224
|
+ String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
|
225
|
+ String resultFilePath = saveFolderPath + "/" + fileName;
|
|
|
226
|
+ // 创建日期目录
|
|
|
227
|
+ File saveFolder = new File(saveFolderPath);
|
|
|
228
|
+ if (!saveFolder.exists()) {
|
|
|
229
|
+ saveFolder.mkdirs();
|
|
|
230
|
+ }
|
|
|
231
|
+ Path sourcePath = new File(modalFilePath).toPath();
|
|
|
232
|
+ Path destinationPath = new File(resultFilePath).toPath();
|
|
|
233
|
+ Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
|
|
|
234
|
+ String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
|
|
|
235
|
+ String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
|
|
|
236
|
+
|
|
|
237
|
+ //修改案件状态
|
|
|
238
|
+ caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
|
|
|
239
|
+ caseApplicationMapper.submitCaseApplication(caseApplication1);
|
|
|
240
|
+
|
|
|
241
|
+ //将裁决书保存到附件表里
|
|
|
242
|
+ CaseAttach caseAttach = CaseAttach.builder()
|
|
|
243
|
+ .caseAppliId(id)
|
|
|
244
|
+ .annexName(saveName)
|
|
|
245
|
+ .annexPath(savePath)
|
|
|
246
|
+ .annexType(3)
|
|
|
247
|
+ .build();
|
|
|
248
|
+ int i = caseAttachMapper.save(caseAttach);
|
|
|
249
|
+ if (i > 0) {
|
|
|
250
|
+ if (arbitrateRecord1 != null) {
|
|
|
251
|
+ Integer annexId = caseAttach.getAnnexId();
|
|
|
252
|
+ //将附件id保存到仲裁记录表里面
|
|
|
253
|
+ arbitrateRecord1.setAnnexId(annexId);
|
|
|
254
|
+ arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
|
|
|
255
|
+ }
|
|
|
256
|
+ }
|
|
|
257
|
+ return AjaxResult.success("裁决书已生成");
|
|
|
258
|
+
|
|
|
259
|
+ } catch (IOException e) {
|
|
|
260
|
+ e.printStackTrace();
|
|
|
261
|
+ return AjaxResult.error("裁决书生成异常");
|
|
|
262
|
+ }
|
|
|
263
|
+
|
|
|
264
|
+
|
|
165
|
265
|
}
|
|
166
|
266
|
}
|