|
|
@@ -1,6 +1,8 @@
|
|
1
|
1
|
package com.ruoyi.wisdomarbitrate.service.impl;
|
|
2
|
2
|
|
|
3
|
3
|
import com.alibaba.fastjson.JSONObject;
|
|
|
4
|
+import com.github.pagehelper.PageHelper;
|
|
|
5
|
+import com.github.pagehelper.PageInfo;
|
|
4
|
6
|
import com.google.gson.Gson;
|
|
5
|
7
|
import com.google.gson.JsonObject;
|
|
6
|
8
|
import com.ruoyi.common.config.RuoYiConfig;
|
|
|
@@ -17,12 +19,15 @@ import com.ruoyi.system.mapper.SysUserMapper;
|
|
17
|
19
|
import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
|
|
18
|
20
|
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
|
|
19
|
21
|
import com.ruoyi.wisdomarbitrate.domain.SealManage;
|
|
|
22
|
+import com.ruoyi.wisdomarbitrate.domain.TemplateManage;
|
|
20
|
23
|
import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
|
|
21
|
24
|
import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
|
|
22
|
25
|
import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper;
|
|
23
|
26
|
import com.ruoyi.wisdomarbitrate.mapper.SealManageMapper;
|
|
|
27
|
+import com.ruoyi.wisdomarbitrate.mapper.TemplateManageMapper;
|
|
24
|
28
|
import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
|
|
25
|
29
|
import com.ruoyi.wisdomarbitrate.utils.SignAward;
|
|
|
30
|
+import org.springframework.beans.BeanUtils;
|
|
26
|
31
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
27
|
32
|
import org.springframework.stereotype.Service;
|
|
28
|
33
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -33,6 +38,9 @@ import java.io.IOException;
|
|
33
|
38
|
import java.time.LocalDate;
|
|
34
|
39
|
import java.util.*;
|
|
35
|
40
|
|
|
|
41
|
+import static com.ruoyi.common.utils.PageUtils.startPage;
|
|
|
42
|
+import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
|
|
43
|
+
|
|
36
|
44
|
@Service
|
|
37
|
45
|
public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
|
38
|
46
|
|
|
|
@@ -46,6 +54,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
|
46
|
54
|
private SysDeptMapper sysDeptMapper;
|
|
47
|
55
|
@Autowired
|
|
48
|
56
|
private SysUserMapper sysUserMapper;
|
|
|
57
|
+ @Autowired
|
|
|
58
|
+ private TemplateManageMapper templateManageMapper;
|
|
49
|
59
|
|
|
50
|
60
|
|
|
51
|
61
|
@Override
|
|
|
@@ -252,21 +262,15 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
|
252
|
262
|
}
|
|
253
|
263
|
|
|
254
|
264
|
@Override
|
|
255
|
|
- public List<SealListVO> getSealList(DeptIdentify deptIdentify) {
|
|
|
265
|
+ public List<SealManage> getSealList(DeptIdentify deptIdentify) {
|
|
256
|
266
|
if (deptIdentify.getId() == null) {
|
|
257
|
267
|
return null;
|
|
258
|
268
|
}
|
|
259
|
269
|
SealManage sealManage = new SealManage();
|
|
260
|
270
|
sealManage.setIdentifyId(deptIdentify.getId());
|
|
261
|
271
|
List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
|
|
262
|
|
- List<SealListVO> sealListVOS = new ArrayList<>();
|
|
263
|
272
|
if (selectSealList != null && selectSealList.size() > 0) {
|
|
264
|
273
|
for (SealManage sealManage1 : selectSealList) {
|
|
265
|
|
- SealListVO sealListVO = new SealListVO();
|
|
266
|
|
- sealListVO.setId(sealManage1.getId());
|
|
267
|
|
- sealListVO.setSealId(sealManage1.getSealId());
|
|
268
|
|
- sealListVO.setSealName(sealManage1.getSealName());
|
|
269
|
|
- sealListVO.setSealStatus(sealManage1.getSealStatus());
|
|
270
|
274
|
Integer annexId = sealManage1.getAnnexId();
|
|
271
|
275
|
if (annexId != null) {
|
|
272
|
276
|
//根据附件id查询路径
|
|
|
@@ -276,17 +280,13 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
|
276
|
280
|
int startIndex = annexName.indexOf(prefix);
|
|
277
|
281
|
startIndex += prefix.length();
|
|
278
|
282
|
String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
|
279
|
|
- sealListVO.setAnnexPath(annexPath);
|
|
280
|
|
- sealListVO.setAnnexType(caseAttach.getAnnexType());
|
|
|
283
|
+ sealManage1.setAnnexPath(annexPath);
|
|
281
|
284
|
} else {
|
|
282
|
|
- sealListVO.setAnnexPath(null);
|
|
283
|
|
- sealListVO.setAnnexType(null);
|
|
|
285
|
+ sealManage1.setAnnexPath(null);
|
|
284
|
286
|
}
|
|
285
|
|
- sealListVO.setIsUse(sealManage1.getIsUse());
|
|
286
|
|
- sealListVOS.add(sealListVO);
|
|
287
|
287
|
}
|
|
288
|
288
|
}
|
|
289
|
|
- return sealListVOS;
|
|
|
289
|
+ return selectSealList;
|
|
290
|
290
|
}
|
|
291
|
291
|
|
|
292
|
292
|
@Override
|
|
|
@@ -374,6 +374,91 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
|
374
|
374
|
return null;
|
|
375
|
375
|
}
|
|
376
|
376
|
|
|
|
377
|
+ @Override
|
|
|
378
|
+ public AjaxResult insertTemplate(TemplateManage templateManage , MultipartFile file) {
|
|
|
379
|
+ //参数校验
|
|
|
380
|
+ if (templateManage.getIdentifyId() == null || file == null || templateManage.getTemName() == null){
|
|
|
381
|
+ return AjaxResult.error("请检查参数是否完整");
|
|
|
382
|
+ }
|
|
|
383
|
+ if (templateManage.getTemType() == null){
|
|
|
384
|
+ templateManage.setTemType(1); //默认模板类型为1(裁决书)
|
|
|
385
|
+ }
|
|
|
386
|
+ try {
|
|
|
387
|
+ String filePath = RuoYiConfig.getUploadPath();
|
|
|
388
|
+ // 上传
|
|
|
389
|
+ String fileName = FileUploadUtils.upload(filePath, file);
|
|
|
390
|
+ String prefix = "/profile";
|
|
|
391
|
+ int startIndex = fileName.indexOf(prefix);
|
|
|
392
|
+ startIndex += prefix.length();
|
|
|
393
|
+ String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex);
|
|
|
394
|
+ templateManage.setTemOrigPath(annexPath);
|
|
|
395
|
+ String format = getFileExtension(fileName);
|
|
|
396
|
+ templateManage.setTemFormat(format);
|
|
|
397
|
+ templateManage.setCreateBy(getUsername());
|
|
|
398
|
+ int i = templateManageMapper.insertTemplateManage(templateManage);
|
|
|
399
|
+ if (i>0){
|
|
|
400
|
+ return AjaxResult.success("新增成功");
|
|
|
401
|
+ }
|
|
|
402
|
+ } catch (IOException e) {
|
|
|
403
|
+ e.printStackTrace();
|
|
|
404
|
+ }
|
|
|
405
|
+ return null;
|
|
|
406
|
+ }
|
|
|
407
|
+
|
|
|
408
|
+ @Override
|
|
|
409
|
+ public AjaxResult updateTemplate(TemplateManage templateManage, MultipartFile file) {
|
|
|
410
|
+ Long id = templateManage.getId();
|
|
|
411
|
+ if (id == null) {
|
|
|
412
|
+ return AjaxResult.error();
|
|
|
413
|
+ }
|
|
|
414
|
+ try {
|
|
|
415
|
+ String filePath = RuoYiConfig.getUploadPath();
|
|
|
416
|
+ // 上传
|
|
|
417
|
+ String fileName = FileUploadUtils.upload(filePath, file);
|
|
|
418
|
+ String prefix = "/profile";
|
|
|
419
|
+ int startIndex = fileName.indexOf(prefix);
|
|
|
420
|
+ startIndex += prefix.length();
|
|
|
421
|
+ String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex);
|
|
|
422
|
+ templateManage.setTemOrigPath(annexPath);
|
|
|
423
|
+ String format = getFileExtension(fileName);
|
|
|
424
|
+ templateManage.setTemFormat(format);
|
|
|
425
|
+ templateManage.setUpdateBy(getUsername());
|
|
|
426
|
+ int i = templateManageMapper.updateTemplateManage(templateManage);
|
|
|
427
|
+ if (i>0){
|
|
|
428
|
+ return AjaxResult.success("修改成功");
|
|
|
429
|
+ }
|
|
|
430
|
+ } catch (IOException e) {
|
|
|
431
|
+ e.printStackTrace();
|
|
|
432
|
+ }
|
|
|
433
|
+ return AjaxResult.error();
|
|
|
434
|
+ }
|
|
|
435
|
+
|
|
|
436
|
+ @Override
|
|
|
437
|
+ public AjaxResult deleteTemplate(Long id) {
|
|
|
438
|
+ TemplateManage templateManage = new TemplateManage();
|
|
|
439
|
+ templateManage.setId(id);
|
|
|
440
|
+ templateManage.setDelFlag(2);
|
|
|
441
|
+ int i = templateManageMapper.updateTemplateManage(templateManage);
|
|
|
442
|
+ if (i > 0) {
|
|
|
443
|
+ return AjaxResult.success("删除成功");
|
|
|
444
|
+ }
|
|
|
445
|
+ return AjaxResult.error();
|
|
|
446
|
+ }
|
|
|
447
|
+
|
|
|
448
|
+ @Override
|
|
|
449
|
+ public List<TemplateManage> getTemplateList(DeptIdentify deptIdentify) {
|
|
|
450
|
+ if (deptIdentify.getId() == null) {
|
|
|
451
|
+ return null;
|
|
|
452
|
+ }
|
|
|
453
|
+ TemplateManage templateManage = new TemplateManage();
|
|
|
454
|
+ templateManage.setIdentifyId(deptIdentify.getId());
|
|
|
455
|
+ List<TemplateManage> templateManages = templateManageMapper.selectTemplateList(templateManage);
|
|
|
456
|
+ if (templateManages != null && templateManages.size() > 0) {
|
|
|
457
|
+ return templateManages;
|
|
|
458
|
+ }
|
|
|
459
|
+ return null;
|
|
|
460
|
+ }
|
|
|
461
|
+
|
|
377
|
462
|
private String generateUniqueUsername() {
|
|
378
|
463
|
final Random random = new Random();
|
|
379
|
464
|
final Set<String> generatedUsernames = new HashSet<>();
|
|
|
@@ -387,5 +472,11 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
|
387
|
472
|
}
|
|
388
|
473
|
}
|
|
389
|
474
|
}
|
|
390
|
|
-
|
|
|
475
|
+ private String getFileExtension(String fileName) {
|
|
|
476
|
+ int lastDotIndex = fileName.lastIndexOf(".");
|
|
|
477
|
+ if (lastDotIndex > 0 && lastDotIndex < fileName.length() - 1) {
|
|
|
478
|
+ return fileName.substring(lastDotIndex + 1);
|
|
|
479
|
+ }
|
|
|
480
|
+ return "";
|
|
|
481
|
+ }
|
|
391
|
482
|
}
|