|
|
@@ -147,177 +147,63 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
|
|
147
|
147
|
|
|
148
|
148
|
@Override
|
|
149
|
149
|
@Transactional
|
|
150
|
|
- public AjaxResult writtenHear(ArbitrateRecord arbitrateRecord) {
|
|
151
|
|
- //查询案件详情
|
|
152
|
|
- CaseApplication caseApplication = new CaseApplication();
|
|
153
|
|
- caseApplication.setId(arbitrateRecord.getCaseAppliId());
|
|
154
|
|
- CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
|
155
|
|
- String createBy = arbitrateRecord.getCreateBy();
|
|
156
|
|
-
|
|
157
|
|
- //先判断案件是否已经提交过仲裁结果
|
|
158
|
|
- ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
|
|
159
|
|
- if (arbitrateRecord1 != null) {
|
|
160
|
|
- int i = arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord);
|
|
161
|
|
- if (i > 0) {
|
|
162
|
|
- //案件日志表里添加数据
|
|
163
|
|
- CaseLogRecord caseLogRecord = new CaseLogRecord();
|
|
164
|
|
- caseLogRecord.setCaseAppliId(caseApplication1.getId());
|
|
165
|
|
- caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
|
|
166
|
|
- if (createBy != null) {
|
|
167
|
|
- caseLogRecord.setCreateBy(createBy);
|
|
168
|
|
- }
|
|
169
|
|
- caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
|
|
170
|
|
- // 新增日志
|
|
171
|
|
- CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.GENERATED_ARBITRATION, "");
|
|
172
|
|
-
|
|
173
|
|
- }
|
|
174
|
|
- } else {
|
|
175
|
|
- //提交仲裁结果
|
|
176
|
|
- int i = arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecord);
|
|
177
|
|
- if (i > 0) {
|
|
178
|
|
- //案件日志表里添加数据
|
|
179
|
|
- CaseLogRecord caseLogRecord = new CaseLogRecord();
|
|
180
|
|
- caseLogRecord.setCaseAppliId(caseApplication1.getId());
|
|
181
|
|
- caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
|
|
182
|
|
- if (createBy != null) {
|
|
183
|
|
- caseLogRecord.setCreateBy(createBy);
|
|
184
|
|
- }
|
|
185
|
|
- caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
|
|
186
|
|
- // 新增日志
|
|
187
|
|
- CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.GENERATED_ARBITRATION, "");
|
|
188
|
|
- }
|
|
189
|
|
- }
|
|
190
|
|
- Boolean aBoolean1 = generateAward(arbitrateRecord);
|
|
191
|
|
- if (aBoolean1) {
|
|
192
|
|
- //修改案件状态
|
|
193
|
|
- caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
|
|
194
|
|
- int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
|
|
195
|
|
- if (i > 0) {
|
|
196
|
|
- return AjaxResult.success("审理成功");
|
|
197
|
|
- }
|
|
198
|
|
- }
|
|
199
|
|
- return AjaxResult.error("裁决书生成有误");
|
|
200
|
|
- }
|
|
201
|
|
-
|
|
|
150
|
+ public AjaxResult writtenHear(CaseIds caseIds) {
|
|
|
151
|
+ if (caseIds!=null){
|
|
|
152
|
+ List<Long> ids = caseIds.getIds();
|
|
|
153
|
+ for (Long caseId : ids) {
|
|
|
154
|
+ //查询案件详情
|
|
|
155
|
+ CaseApplication caseApplication = new CaseApplication();
|
|
|
156
|
+ caseApplication.setId(caseId);
|
|
|
157
|
+ CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
|
|
158
|
+ //先判断案件是否已经提交过仲裁结果
|
|
|
159
|
+ ArbitrateRecord arbitrateRecord = new ArbitrateRecord();
|
|
|
160
|
+ arbitrateRecord.setCaseAppliId(caseId);
|
|
|
161
|
+ ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
|
|
|
162
|
+ if (arbitrateRecord1 != null) {
|
|
|
163
|
+ int i = arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord);
|
|
|
164
|
+ if (i > 0) {
|
|
|
165
|
+ //案件日志表里添加数据
|
|
|
166
|
+ CaseLogRecord caseLogRecord = new CaseLogRecord();
|
|
|
167
|
+ caseLogRecord.setCaseAppliId(caseApplication1.getId());
|
|
|
168
|
+ caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
|
|
|
169
|
+ caseLogRecord.setCreateBy(getUsername());
|
|
|
170
|
+ caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
|
|
|
171
|
+ // 新增日志
|
|
|
172
|
+ CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.GENERATED_ARBITRATION, "");
|
|
202
|
173
|
|
|
203
|
|
- //生成庭审笔录
|
|
204
|
|
- private Boolean generateTrialTranscripts(ArbitrateRecord arbitrateRecord) {
|
|
205
|
|
- try {
|
|
206
|
|
- Map<String, Object> datas = new HashMap<>();
|
|
207
|
|
- Long id = arbitrateRecord.getCaseAppliId();
|
|
208
|
|
- CaseApplication caseApplication = new CaseApplication();
|
|
209
|
|
- caseApplication.setId(id);
|
|
210
|
|
- CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
|
211
|
|
- //获取案件关联人信息
|
|
212
|
|
- CaseAffiliate caseAffiliate = new CaseAffiliate();
|
|
213
|
|
- caseAffiliate.setCaseAppliId(id);
|
|
214
|
|
- List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
|
|
215
|
|
- if (caseAffiliates != null && caseAffiliates.size() > 0) {
|
|
216
|
|
- for (CaseAffiliate affiliate : caseAffiliates) {
|
|
217
|
|
- //获取身份类型
|
|
218
|
|
- int identityType = affiliate.getIdentityType();
|
|
219
|
|
- if (identityType == 1) { //申请人
|
|
220
|
|
- datas.put("appName", affiliate.getName());
|
|
221
|
|
- datas.put("appIDNo", affiliate.getIdentityNum());
|
|
222
|
|
- datas.put("appAddress", affiliate.getContactAddress());
|
|
223
|
|
- datas.put("appAgentName", affiliate.getNameAgent());
|
|
224
|
|
- datas.put("appAgentIDNo", affiliate.getIdentityNumAgent());
|
|
225
|
|
- } else if (identityType == 2) { //被申请人
|
|
226
|
|
- datas.put("resName", affiliate.getName());
|
|
227
|
|
- datas.put("resIDNo", affiliate.getIdentityNum());
|
|
228
|
|
- datas.put("resAddress", affiliate.getContactAddress());
|
|
229
|
|
- datas.put("resAgentName", affiliate.getNameAgent());
|
|
230
|
|
- datas.put("resAgentIDNo", affiliate.getIdentityNumAgent());
|
|
231
|
174
|
}
|
|
232
|
|
- }
|
|
233
|
|
- }
|
|
234
|
|
- String arbitratorName = caseApplication1.getArbitratorName();
|
|
235
|
|
- datas.put("caseName", caseApplication1.getCaseName());
|
|
236
|
|
- datas.put("arbitratorName", arbitratorName);
|
|
237
|
|
- Date hearDate = caseApplication1.getHearDate();
|
|
238
|
|
- if (hearDate != null) {
|
|
239
|
|
- LocalDate localDate = hearDate.toInstant()
|
|
240
|
|
- .atZone(ZoneId.systemDefault())
|
|
241
|
|
- .toLocalDate();
|
|
242
|
|
- datas.put("hearYear", localDate.getYear());
|
|
243
|
|
- datas.put("hearMonths", localDate.getMonthValue());
|
|
244
|
|
- datas.put("hearDay", localDate.getDayOfMonth());
|
|
245
|
|
- } else {
|
|
246
|
|
- datas.put("hearYear", null);
|
|
247
|
|
- datas.put("hearMonths", null);
|
|
248
|
|
- datas.put("hearDay", null);
|
|
249
|
|
- }
|
|
250
|
|
- datas.put("appArbitrationClaims", caseApplication1.getArbitratClaims());
|
|
251
|
|
- datas.put("evidenDetermi", arbitrateRecord.getEvidenDetermi());
|
|
252
|
|
- datas.put("factDetermi", arbitrateRecord.getFactDetermi());
|
|
253
|
|
- datas.put("caseSketch", arbitrateRecord.getCaseSketch());
|
|
254
|
|
- datas.put("arbitrateThink", arbitrateRecord.getArbitrateThink());
|
|
255
|
|
- datas.put("rulingFollows", arbitrateRecord.getRulingFollows());
|
|
256
|
|
- datas.put("legalProvisions", "仲裁法");
|
|
257
|
|
- LocalDate now = LocalDate.now();
|
|
258
|
|
- String year = Integer.toString(now.getYear());
|
|
259
|
|
- String month = String.format("%02d", now.getMonthValue());
|
|
260
|
|
- String day = String.format("%02d", now.getDayOfMonth());
|
|
261
|
|
- datas.put("year", year);
|
|
262
|
|
- datas.put("months", month);
|
|
263
|
|
- datas.put("day", day);
|
|
264
|
|
- String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
|
|
265
|
|
- //String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
|
|
266
|
|
- String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
|
267
|
|
- //String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
|
|
268
|
|
- String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
|
|
269
|
|
- String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
270
|
|
- String resultFilePath = saveFolderPath + "/" + fileName;
|
|
271
|
|
- // 创建日期目录
|
|
272
|
|
- File saveFolder = new File(saveFolderPath);
|
|
273
|
|
- if (!saveFolder.exists()) {
|
|
274
|
|
- saveFolder.mkdirs();
|
|
275
|
|
- }
|
|
276
|
|
- Path sourcePath = new File(modalFilePath).toPath();
|
|
277
|
|
- Path destinationPath = new File(resultFilePath).toPath();
|
|
278
|
|
- Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
|
|
279
|
|
- String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
|
|
280
|
|
- String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
|
|
281
|
|
- CaseAttach caseAttach = CaseAttach.builder()
|
|
282
|
|
- .caseAppliId(id)
|
|
283
|
|
- .annexName(saveName)
|
|
284
|
|
- .annexPath(savePath)
|
|
285
|
|
- .annexType(7)
|
|
286
|
|
- .build();
|
|
287
|
|
- //保存到附件表里,先判断之前有没有,有的话更新,没有的话新增
|
|
288
|
|
- CaseAttach caseAttach1 = new CaseAttach();
|
|
289
|
|
- caseAttach1.setAnnexType(7);
|
|
290
|
|
- caseAttach1.setCaseAppliId(id);
|
|
291
|
|
- List<CaseAttach> caseAttachList = caseAttachMapper.getCaseAttachByCaseIdAndType(caseAttach1);
|
|
292
|
|
- if (caseAttachList != null && caseAttachList.size() > 0) {
|
|
293
|
|
- //之前已经生成过了,更新
|
|
294
|
|
- caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
|
|
295
|
|
- } else {
|
|
296
|
|
- //之前没生成过,新增
|
|
297
|
|
- int i = caseAttachMapper.save(caseAttach);
|
|
298
|
|
- ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
|
|
299
|
|
- if (i > 0) {
|
|
300
|
|
- if (arbitrateRecord1 != null) {
|
|
301
|
|
- Integer annexId = caseAttach.getAnnexId();
|
|
302
|
|
- //将附件id保存到仲裁记录表里面
|
|
303
|
|
- arbitrateRecord1.setAnnexId(annexId);
|
|
304
|
|
- arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
|
|
|
175
|
+ } else {
|
|
|
176
|
+ //提交仲裁结果
|
|
|
177
|
+ int i = arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecord);
|
|
|
178
|
+ if (i > 0) {
|
|
|
179
|
+ //案件日志表里添加数据
|
|
|
180
|
+ CaseLogRecord caseLogRecord = new CaseLogRecord();
|
|
|
181
|
+ caseLogRecord.setCaseAppliId(caseApplication1.getId());
|
|
|
182
|
+ caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
|
|
|
183
|
+ caseLogRecord.setCreateBy(getUsername());
|
|
|
184
|
+ caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
|
|
|
185
|
+ // 新增日志
|
|
|
186
|
+ CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.GENERATED_ARBITRATION, "");
|
|
305
|
187
|
}
|
|
306
|
188
|
}
|
|
|
189
|
+ Boolean aBoolean1 = generateAward(caseId);
|
|
|
190
|
+ if (aBoolean1) {
|
|
|
191
|
+ //修改案件状态
|
|
|
192
|
+ caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
|
|
|
193
|
+ int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
|
|
|
194
|
+ }else {
|
|
|
195
|
+ return AjaxResult.error("裁决书生成失败");
|
|
|
196
|
+ }
|
|
307
|
197
|
}
|
|
308
|
|
- return Boolean.TRUE;
|
|
309
|
|
-
|
|
310
|
|
- } catch (IOException e) {
|
|
311
|
|
- e.printStackTrace();
|
|
312
|
|
- return Boolean.FALSE;
|
|
|
198
|
+ return AjaxResult.success("审理成功");
|
|
313
|
199
|
}
|
|
|
200
|
+ return AjaxResult.error("请检查参数");
|
|
314
|
201
|
}
|
|
315
|
202
|
|
|
316
|
203
|
//生成仲裁文书
|
|
317
|
|
- private Boolean generateAward(ArbitrateRecord arbitrateRecord) {
|
|
|
204
|
+ private Boolean generateAward(Long id) {
|
|
318
|
205
|
try {
|
|
319
|
206
|
Map<String, Object> datas = new HashMap<>();
|
|
320
|
|
- Long id = arbitrateRecord.getCaseAppliId();
|
|
321
|
207
|
if (id == null) {
|
|
322
|
208
|
return null;
|
|
323
|
209
|
}
|
|
|
@@ -329,6 +215,8 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
|
|
329
|
215
|
String equipmentNo = getNewEquipmentNo();
|
|
330
|
216
|
datas.put("num", equipmentNo);
|
|
331
|
217
|
//获取仲裁记录表里的相关信息
|
|
|
218
|
+ ArbitrateRecord arbitrateRecord = new ArbitrateRecord();
|
|
|
219
|
+ arbitrateRecord.setCaseAppliId(id);
|
|
332
|
220
|
ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
|
|
333
|
221
|
//获取案件关联人信息
|
|
334
|
222
|
CaseAffiliate caseAffiliate = new CaseAffiliate();
|