Parcourir la source

Merge branch 'wq1' of SH-Arbitrate/Mediation-Backend into dev

wangqiong123 il y a 2 ans
Parent
révision
ed036ebecc

+ 44
- 5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/dept/DeptIdentifyController.java Voir le fichier

1
 package com.ruoyi.web.controller.wisdomarbitrate.dept;
1
 package com.ruoyi.web.controller.wisdomarbitrate.dept;
2
+
3
+import cn.hutool.core.collection.CollectionUtil;
2
 import com.ruoyi.common.core.controller.BaseController;
4
 import com.ruoyi.common.core.controller.BaseController;
3
 import com.ruoyi.common.core.domain.AjaxResult;
5
 import com.ruoyi.common.core.domain.AjaxResult;
4
 import com.ruoyi.common.core.page.TableDataInfo;
6
 import com.ruoyi.common.core.page.TableDataInfo;
5
 import com.ruoyi.common.exception.EsignDemoException;
7
 import com.ruoyi.common.exception.EsignDemoException;
8
+import com.ruoyi.framework.config.ServerConfig;
6
 import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
9
 import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
7
-import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule;
8
 import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
10
 import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
11
+import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule;
9
 import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage;
12
 import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage;
10
 import com.ruoyi.wisdomarbitrate.service.dept.IDeptIdentifyService;
13
 import com.ruoyi.wisdomarbitrate.service.dept.IDeptIdentifyService;
11
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.beans.factory.annotation.Autowired;
20
 public class DeptIdentifyController extends BaseController {
23
 public class DeptIdentifyController extends BaseController {
21
     @Autowired
24
     @Autowired
22
     private IDeptIdentifyService deptIdentifyService;
25
     private IDeptIdentifyService deptIdentifyService;
26
+    @Autowired
27
+    private ServerConfig serverConfig;
23
 
28
 
24
     /**
29
     /**
25
      * 新增机构
30
      * 新增机构
131
      * @return
136
      * @return
132
      */
137
      */
133
     @PostMapping("/insertTemplate")
138
     @PostMapping("/insertTemplate")
134
-    public AjaxResult insertTemplate(TemplateManage templateManage, @RequestParam("file") MultipartFile file){
135
-        return deptIdentifyService.insertTemplate(templateManage,file);
139
+    public AjaxResult insertTemplate( @RequestBody TemplateManage templateManage){
140
+        if(CollectionUtil.isEmpty(templateManage.getAnnexIds())||templateManage.getIdentifyId() == null ) {
141
+          return error("参数校验失败");
142
+        }
143
+        return deptIdentifyService.insertTemplate(templateManage);
144
+    }
145
+    /**
146
+     * 通用上传请求(单个)
147
+     */
148
+    @PostMapping("/upload")
149
+    public AjaxResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("annexType") Integer annexType) throws Exception
150
+    {
151
+        try
152
+        {
153
+            AjaxResult result = deptIdentifyService.uploadFile(file, annexType);
154
+            if(result.get("url")!=null){
155
+                result.put("url",serverConfig.getUrl()+result.get("url"));
156
+            }
157
+            return   result;
158
+        }
159
+        catch (Exception e)
160
+        {
161
+            return AjaxResult.error(e.getMessage());
162
+        }
136
     }
163
     }
137
     /**
164
     /**
138
      * 修改模板
165
      * 修改模板
140
      * @return
167
      * @return
141
      */
168
      */
142
     @PostMapping("/updateTemplate")
169
     @PostMapping("/updateTemplate")
143
-    public AjaxResult updateTemplate(TemplateManage templateManage,@RequestParam(value = "file", required = false) MultipartFile file){
144
-        return deptIdentifyService.updateTemplate(templateManage,file);
170
+    public AjaxResult updateTemplate(@RequestBody TemplateManage templateManage){
171
+        if(templateManage.getId()==null || CollectionUtil.isEmpty(templateManage.getAnnexIds())||templateManage.getIdentifyId() == null ) {
172
+            return error("参数校验失败");
173
+        }
174
+        return deptIdentifyService.updateTemplate(templateManage);
145
     }
175
     }
146
 
176
 
147
     /**
177
     /**
165
         List<TemplateManage> sealList = deptIdentifyService.getTemplateList(deptIdentify);
195
         List<TemplateManage> sealList = deptIdentifyService.getTemplateList(deptIdentify);
166
         return getDataTable(sealList);
196
         return getDataTable(sealList);
167
     }
197
     }
198
+    /**
199
+     * 根据模板id查询详情
200
+     * @param id
201
+     * @return
202
+     */
203
+    @GetMapping("/getTemplateDetail")
204
+    public AjaxResult getTemplateDetail( @RequestParam("id") Long id){
205
+        return deptIdentifyService.getTemplateDetail(id);
206
+    }
168
     /**
207
     /**
169
      * 根据部门id查询岗位用户信息
208
      * 根据部门id查询岗位用户信息
170
      */
209
      */

+ 68
- 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/TemplateTypeEnum.java Voir le fichier

1
+package com.ruoyi.common.enums;
2
+
3
+import com.ruoyi.common.interfaces.EnumsInterface;
4
+
5
+/**
6
+ * @Classname AnnexTypeEnum
7
+ * @Description 附件类型枚举
8
+ * @Version 1.0.0
9
+ * @Date 2024/1/12 17:50
10
+ * @Created wangqiong
11
+ */
12
+public enum TemplateTypeEnum implements EnumsInterface {
13
+    MEDIATION_APPLICATION(1, "调解申请书模板"),
14
+    MEDIATION_AGREEMENT(2, "和解协议模板"),
15
+    MEDIATE_BOOK(3, "调解书模板"),
16
+
17
+
18
+
19
+
20
+    ;
21
+
22
+    private final Integer code;
23
+    private final String text;
24
+
25
+    TemplateTypeEnum(Integer code, String text)
26
+    {
27
+        this.code = code;
28
+        this.text = text;
29
+    }
30
+
31
+    public Integer getCode()
32
+    {
33
+        return code;
34
+    }
35
+
36
+    public String getText()
37
+    {
38
+        return text;
39
+    }
40
+
41
+    /**
42
+     * 根据code获取text
43
+     * @param codeNo
44
+     * @return
45
+     */
46
+    public static String getTextByCode(Integer codeNo){
47
+        for (TemplateTypeEnum value : TemplateTypeEnum.values()) {
48
+            if (value.getCode().equals(codeNo)){
49
+                return value.getText();
50
+            }
51
+        }
52
+        return codeNo.toString();
53
+    }
54
+
55
+    /**
56
+     * 根据text获取code
57
+     * @param textStr
58
+     * @return
59
+     */
60
+    public static String getCodeByText(String textStr){
61
+        for (TemplateTypeEnum value : TemplateTypeEnum.values()) {
62
+            if (value.getText().equals(textStr)){
63
+                return value.getText();
64
+            }
65
+        }
66
+        return textStr;
67
+    }
68
+}

+ 9
- 5
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/template/TemplateManage.java Voir le fichier

1
 package com.ruoyi.wisdomarbitrate.domain.dto.template;
1
 package com.ruoyi.wisdomarbitrate.domain.dto.template;
2
 
2
 
3
 import com.ruoyi.common.core.domain.BaseEntity;
3
 import com.ruoyi.common.core.domain.BaseEntity;
4
-import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule;
5
 import lombok.Data;
4
 import lombok.Data;
6
 
5
 
7
 import java.util.List;
6
 import java.util.List;
13
      * ID
12
      * ID
14
      */
13
      */
15
     private Long id;
14
     private Long id;
15
+    /**
16
+     * 附件id
17
+     */
18
+    private Long fileId;
19
+    /**
20
+     * 附件ids
21
+     */
22
+    private List<Long> annexIds;
16
 
23
 
17
     /**
24
     /**
18
      * 机构关联id
25
      * 机构关联id
44
      * 修订后模板路径
51
      * 修订后模板路径
45
      */
52
      */
46
     private String temRevisPath;
53
     private String temRevisPath;
47
-    /**
48
-     * 删除标志(0代表存在 2代表删除)
49
-     */
50
-    private Integer delFlag;
54
+
51
     /**
55
     /**
52
      * 机构关联id
56
      * 机构关联id
53
      */
57
      */

+ 4
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java Voir le fichier

5
 import lombok.Data;
5
 import lombok.Data;
6
 import lombok.NoArgsConstructor;
6
 import lombok.NoArgsConstructor;
7
 
7
 
8
-import javax.persistence.Column;
9
 import java.util.List;
8
 import java.util.List;
10
 
9
 
11
 @NoArgsConstructor
10
 @NoArgsConstructor
20
      * 模板id
19
      * 模板id
21
      */
20
      */
22
     private String templateId;
21
     private String templateId;
22
+    /**
23
+     * 模板附件id
24
+     */
25
+    private Long fileId;
23
     /**
26
     /**
24
      * 批次
27
      * 批次
25
      */
28
      */

+ 7
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/dept/DeptIdentifyMapper.java Voir le fichier

2
 
2
 
3
 import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
3
 import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
4
 import org.apache.ibatis.annotations.Mapper;
4
 import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
5
 
6
 
6
 import java.util.List;
7
 import java.util.List;
7
 
8
 
17
 
18
 
18
     int updateDeptIdentify(DeptIdentify deptIdentify);
19
     int updateDeptIdentify(DeptIdentify deptIdentify);
19
 
20
 
21
+    /**
22
+     * 根据机构id查询名称
23
+     * @param identifyId
24
+     * @return
25
+     */
26
+    String selectById(@Param("id") Long identifyId);
20
 }
27
 }

+ 57
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/template/TemplateManageMapper.java Voir le fichier

21
      * @return
21
      * @return
22
      */
22
      */
23
     TemplateManage selectByType(@Param("type") int type);
23
     TemplateManage selectByType(@Param("type") int type);
24
+
25
+    /**
26
+     * 批量修改
27
+     * @param templateManage
28
+     * @return
29
+     */
30
+    int updateByIds(TemplateManage templateManage);
31
+
32
+    /**
33
+     * 新增模板附件表
34
+     * @param templateManage
35
+     * @return
36
+     */
37
+    int insertTemplateManageFile(TemplateManage templateManage);
38
+
39
+    /**
40
+     * 删除模板
41
+     * @param id
42
+     * @return
43
+     */
44
+    int deleteTemplateManage(@Param("id") Long id);
45
+
46
+    /**
47
+     * 根据id修改附件表
48
+     * @param templateManage
49
+     */
50
+    void updateFileByIds(@Param("manage") TemplateManage templateManage);
51
+
52
+    /**
53
+     * 根据条件删除附件
54
+     * @param id
55
+     * @param annexIds
56
+     */
57
+    void deleteTemplateManageFileById(@Param("id")Long id, @Param("fileIds")List<Long> annexIds);
58
+
59
+    /**
60
+     * 根据模板id和类型查询
61
+     * @param templateId
62
+     * @param code
63
+     * @return
64
+     */
65
+    TemplateManage selectByIdAndType(@Param("templateId")Long templateId, @Param("type")Integer code);
66
+
67
+    /**
68
+     * 根据附件id查询
69
+     * @param templateId
70
+     * @return
71
+     */
72
+
73
+    TemplateManage selectFileById(@Param("fileId") Long templateId);
74
+
75
+    /**
76
+     * 根据模板id查询
77
+     * @param id
78
+     * @return
79
+     */
80
+    List<TemplateManage> selectTemplateListById(@Param("id")Long id);
24
 }
81
 }

+ 18
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/IDeptIdentifyService.java Voir le fichier

9
 import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage;
9
 import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage;
10
 import org.springframework.web.multipart.MultipartFile;
10
 import org.springframework.web.multipart.MultipartFile;
11
 
11
 
12
+import java.io.IOException;
12
 import java.util.List;
13
 import java.util.List;
13
 
14
 
14
 public interface IDeptIdentifyService {
15
 public interface IDeptIdentifyService {
37
 
38
 
38
     AjaxResult updateDeptIdentify(DeptIdentify deptIdentify);
39
     AjaxResult updateDeptIdentify(DeptIdentify deptIdentify);
39
 
40
 
40
-    AjaxResult insertTemplate(TemplateManage templateManage , MultipartFile file);
41
+    AjaxResult insertTemplate(TemplateManage templateManage );
41
 
42
 
42
-    AjaxResult updateTemplate(TemplateManage templateManage, MultipartFile file);
43
+    AjaxResult updateTemplate(TemplateManage templateManage);
43
 
44
 
44
     AjaxResult deleteTemplate(Long id);
45
     AjaxResult deleteTemplate(Long id);
45
 
46
 
62
      * @return
63
      * @return
63
      */
64
      */
64
     List<FatchRule> getTemplateInfoById(TemplateManage templateManage);
65
     List<FatchRule> getTemplateInfoById(TemplateManage templateManage);
66
+
67
+    /**
68
+     * 上传附件
69
+     * @param file
70
+     * @param annexType
71
+     * @return
72
+     */
73
+    AjaxResult uploadFile(MultipartFile file, Integer annexType) throws IOException;
74
+
75
+    /**
76
+     * 根据模板id查询详情
77
+     * @param id
78
+     * @return
79
+     */
80
+    AjaxResult getTemplateDetail(Long id);
65
 }
81
 }

+ 72
- 45
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/dept/impl/DeptIdentifyServiceImpl.java Voir le fichier

13
 import com.ruoyi.common.core.domain.entity.SysDictData;
13
 import com.ruoyi.common.core.domain.entity.SysDictData;
14
 import com.ruoyi.common.core.domain.entity.SysUser;
14
 import com.ruoyi.common.core.domain.entity.SysUser;
15
 import com.ruoyi.common.enums.AnnexTypeEnum;
15
 import com.ruoyi.common.enums.AnnexTypeEnum;
16
+import com.ruoyi.common.enums.TemplateTypeEnum;
16
 import com.ruoyi.common.exception.EsignDemoException;
17
 import com.ruoyi.common.exception.EsignDemoException;
17
 import com.ruoyi.common.exception.ServiceException;
18
 import com.ruoyi.common.exception.ServiceException;
18
 import com.ruoyi.common.utils.SealUtil;
19
 import com.ruoyi.common.utils.SealUtil;
19
 import com.ruoyi.common.utils.file.FileUploadUtils;
20
 import com.ruoyi.common.utils.file.FileUploadUtils;
21
+import com.ruoyi.common.utils.file.FileUtils;
20
 import com.ruoyi.system.mapper.*;
22
 import com.ruoyi.system.mapper.*;
21
 import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
23
 import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
22
 import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
24
 import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
41
 import java.io.IOException;
43
 import java.io.IOException;
42
 import java.time.LocalDate;
44
 import java.time.LocalDate;
43
 import java.util.*;
45
 import java.util.*;
46
+import java.util.function.Function;
44
 import java.util.stream.Collectors;
47
 import java.util.stream.Collectors;
45
 import java.util.stream.Stream;
48
 import java.util.stream.Stream;
46
 
49
 
73
     private SysDictDataMapper dictDataMapper;
76
     private SysDictDataMapper dictDataMapper;
74
 
77
 
75
 
78
 
79
+
76
     @Override
80
     @Override
77
     @Transactional
81
     @Transactional
78
     public List<DeptIdentify> selectDeptIdentify(DeptIdentify deptIdentify) {
82
     public List<DeptIdentify> selectDeptIdentify(DeptIdentify deptIdentify) {
405
 
409
 
406
         return null;
410
         return null;
407
     }
411
     }
408
-
412
+    @Transactional
409
     @Override
413
     @Override
410
-    public AjaxResult insertTemplate(TemplateManage templateManage, MultipartFile file) {
411
-        //参数校验
412
-        if (templateManage.getIdentifyId() == null || file == null || templateManage.getTemName() == null) {
413
-            return AjaxResult.error("请检查参数是否完整");
414
-        }
415
-        if (templateManage.getTemType() == null) {
416
-            templateManage.setTemType(1); //默认模板类型为1(裁决书)
417
-        }
418
-        try {
419
-            String filePath = RuoYiConfig.getUploadPath();
420
-            // 上传
421
-            String fileName = FileUploadUtils.upload(filePath, file);
422
-
423
-            templateManage.setTemOrigPath(fileName);
424
-            String format = getFileExtension(fileName);
425
-            templateManage.setTemFormat(format);
426
-            templateManage.setFileName(file.getOriginalFilename());
414
+    public AjaxResult insertTemplate(TemplateManage templateManage) {
427
             templateManage.setCreateBy(getUsername());
415
             templateManage.setCreateBy(getUsername());
428
             int i = templateManageMapper.insertTemplateManage(templateManage);
416
             int i = templateManageMapper.insertTemplateManage(templateManage);
417
+            templateManage.setId(templateManage.getId());
418
+            templateManageMapper.updateFileByIds(templateManage);
429
             if (i > 0) {
419
             if (i > 0) {
430
                 return AjaxResult.success("新增成功");
420
                 return AjaxResult.success("新增成功");
431
             }
421
             }
432
-        } catch (IOException e) {
433
-            e.printStackTrace();
434
-        }
435
         return null;
422
         return null;
436
     }
423
     }
437
-
424
+    @Transactional
438
     @Override
425
     @Override
439
-    public AjaxResult updateTemplate(TemplateManage templateManage, MultipartFile file) {
426
+    public AjaxResult updateTemplate(TemplateManage templateManage) {
440
         Long id = templateManage.getId();
427
         Long id = templateManage.getId();
441
-        if (id == null) {
442
-            return AjaxResult.error();
443
-        }
444
-        try {
445
-            if (file != null && file.getSize() > 0) {
446
-                String filePath = RuoYiConfig.getUploadPath();
447
-                // 上传
448
-                String fileName = FileUploadUtils.upload(filePath, file);
449
-
450
-                templateManage.setTemOrigPath(fileName);
451
-                templateManage.setFileName(file.getOriginalFilename());
452
-                String format = getFileExtension(fileName);
453
-                templateManage.setTemFormat(format);
454
-            }
455
             templateManage.setUpdateBy(getUsername());
428
             templateManage.setUpdateBy(getUsername());
456
             int i = templateManageMapper.updateTemplateManage(templateManage);
429
             int i = templateManageMapper.updateTemplateManage(templateManage);
430
+            // 先删除附件
431
+        if(CollectionUtil.isNotEmpty(templateManage.getAnnexIds())) {
432
+            templateManageMapper.deleteTemplateManageFileById(id, templateManage.getAnnexIds());
433
+            // 修改附件表
434
+            templateManageMapper.updateFileByIds(templateManage);
435
+        }
436
+
457
             if (i > 0) {
437
             if (i > 0) {
458
                 return AjaxResult.success("修改成功");
438
                 return AjaxResult.success("修改成功");
459
             }
439
             }
460
-        } catch (IOException e) {
461
-            e.printStackTrace();
462
-        }
440
+
463
         return AjaxResult.error();
441
         return AjaxResult.error();
464
     }
442
     }
465
-
443
+    @Transactional
466
     @Override
444
     @Override
467
     public AjaxResult deleteTemplate(Long id) {
445
     public AjaxResult deleteTemplate(Long id) {
468
-        TemplateManage templateManage = new TemplateManage();
469
-        templateManage.setId(id);
470
-        templateManage.setDelFlag(2);
471
-        int i = templateManageMapper.updateTemplateManage(templateManage);
446
+        int i = templateManageMapper.deleteTemplateManage(id);
472
         if (i > 0) {
447
         if (i > 0) {
473
             return AjaxResult.success("删除成功");
448
             return AjaxResult.success("删除成功");
474
         }
449
         }
620
 
595
 
621
         return fatchRuleList;
596
         return fatchRuleList;
622
     }
597
     }
598
+    @Transactional
599
+    @Override
600
+    public AjaxResult uploadFile(MultipartFile file, Integer annexType) throws IOException {
601
+        // 上传文件路径
602
+        String filePath = RuoYiConfig.getUploadPath();
603
+        // 上传并返回新文件名称
604
+        String fileName = FileUploadUtils.upload(filePath, file);
605
+        TemplateManage templateManage=new TemplateManage();
606
+        templateManage.setTemOrigPath(fileName);
607
+        String format = getFileExtension(fileName);
608
+        templateManage.setTemFormat(format);
609
+        templateManage.setFileName(file.getOriginalFilename());
610
+        templateManage.setTemType(annexType);
611
+        int i = templateManageMapper.insertTemplateManageFile(templateManage);
612
+        if(i<1){
613
+            return AjaxResult.error("上传失败");
614
+        }
615
+        AjaxResult ajax = AjaxResult.success();
616
+        ajax.put("annexId", templateManage.getFileId());
617
+        ajax.put("annexType", annexType);
618
+        ajax.put("url", fileName);
619
+        ajax.put("fileName", fileName);
620
+        ajax.put("newFileName", FileUtils.getName(fileName));
621
+        ajax.put("originalFilename", file.getOriginalFilename());
622
+        return ajax;
623
+
624
+    }
625
+
626
+    @Override
627
+    public AjaxResult getTemplateDetail(Long id) {
628
+        List<TemplateManage> list = templateManageMapper.selectTemplateListById(id);
629
+        if(CollectionUtil.isEmpty(list)){
630
+            return AjaxResult.error("模板不存在");
631
+        }
632
+        Map<Integer, TemplateManage> manageMap = list.stream().collect(Collectors.toMap(TemplateManage::getTemType, Function.identity(), (oldValue, newValue) -> newValue));
633
+        AjaxResult ajax = AjaxResult.success();
634
+        ajax.put("id",id);
635
+        ajax.put("identifyId",list.get(0).getIdentifyId());
636
+        if(list.get(0).getIdentifyId()!=null) {
637
+            // 查询机构名称
638
+
639
+            ajax.put("identifyName",  deptIdentifyMapper.selectById(list.get(0).getIdentifyId()));
640
+        }
641
+        ajax.put("temName",list.get(0).getTemName());
642
+        // 调节申请书
643
+        ajax.put("applicationFile",manageMap.get(TemplateTypeEnum.MEDIATION_APPLICATION.getCode()));
644
+        // 和解协议
645
+        ajax.put("agreementFile",manageMap.get(TemplateTypeEnum.MEDIATION_AGREEMENT.getCode()));
646
+        // 调解书
647
+        ajax.put("bookFile",manageMap.get(TemplateTypeEnum.MEDIATE_BOOK.getCode()));
648
+        return ajax;
649
+    }
623
 
650
 
624
     private String getFileExtension(String fileName) {
651
     private String getFileExtension(String fileName) {
625
         int lastDotIndex = fileName.lastIndexOf(".");
652
         int lastDotIndex = fileName.lastIndexOf(".");

+ 13
- 16
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java Voir le fichier

14
 import com.ruoyi.common.core.domain.model.LoginUser;
14
 import com.ruoyi.common.core.domain.model.LoginUser;
15
 import com.ruoyi.common.enums.AnnexTypeEnum;
15
 import com.ruoyi.common.enums.AnnexTypeEnum;
16
 import com.ruoyi.common.enums.MediatorTypeEnum;
16
 import com.ruoyi.common.enums.MediatorTypeEnum;
17
+import com.ruoyi.common.enums.TemplateTypeEnum;
17
 import com.ruoyi.common.enums.YesOrNoEnum;
18
 import com.ruoyi.common.enums.YesOrNoEnum;
18
 import com.ruoyi.common.exception.EsignDemoException;
19
 import com.ruoyi.common.exception.EsignDemoException;
19
 import com.ruoyi.common.exception.ServiceException;
20
 import com.ruoyi.common.exception.ServiceException;
293
                 if (StrUtil.isNotEmpty(affiliate.getRespondentEmail())) {
294
                 if (StrUtil.isNotEmpty(affiliate.getRespondentEmail())) {
294
                     affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", ""));
295
                     affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", ""));
295
                 }
296
                 }
296
-
297
                 msCaseAffiliateMapper.insert(affiliate);
297
                 msCaseAffiliateMapper.insert(affiliate);
298
-                // 查询调解申请书模板id
299
-                TemplateManage templateManage=templateManageMapper.selectByType(2);
300
-                if(templateManage!=null) {
301
-                    // 批量生成调解申请书
298
+                     // 批量生成调解申请书
302
                     MsCaseApplicationReq req = new MsCaseApplicationReq();
299
                     MsCaseApplicationReq req = new MsCaseApplicationReq();
303
                         req.setCaseFlowId(caseFlow.getId());
300
                         req.setCaseFlowId(caseFlow.getId());
304
                     if(!caseApplication.isImportFlag()) {
301
                     if(!caseApplication.isImportFlag()) {
308
                         req.setBatchNumber(caseApplication.getBatchNumber());
305
                         req.setBatchNumber(caseApplication.getBatchNumber());
309
                     }
306
                     }
310
                     // 生成调解申请书
307
                     // 生成调解申请书
311
-                        req.setTemplateId(String.valueOf(templateManage.getId()));
308
+                       req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode());
312
                     // todo 部署放开
309
                     // todo 部署放开
313
-             //       caseApplicationService.generateApplication(req);
314
-
315
-                }
310
+                    caseApplicationService.generateApplication(req);
316
 
311
 
317
             // 保存案件附件
312
             // 保存案件附件
318
 
313
 
637
     @Override
632
     @Override
638
     public AjaxResult generateApplication(MsCaseApplicationReq req) {
633
     public AjaxResult generateApplication(MsCaseApplicationReq req) {
639
         // 根据模板id查询申请书
634
         // 根据模板id查询申请书
640
-        TemplateManage templateManage=templateManageMapper.selectById(req.getTemplateId());
635
+        if(req.getTemplateId()==null || req.getTemplateType()==null){
636
+            return AjaxResult.error("模板id不能为空");
637
+        }
638
+        TemplateManage templateManage=templateManageMapper.selectByIdAndType(Long.valueOf(req.getTemplateId()),req.getTemplateType());
641
         if(templateManage==null||StrUtil.isEmpty(templateManage.getTemOrigPath())){
639
         if(templateManage==null||StrUtil.isEmpty(templateManage.getTemOrigPath())){
642
             throw new ServiceException("未找到模板");
640
             throw new ServiceException("未找到模板");
643
         }
641
         }
879
                 }
877
                 }
880
                 smsRecordMapper.saveSmsSendRecord(smsSendRecord);
878
                 smsRecordMapper.saveSmsSendRecord(smsSendRecord);
881
             }
879
             }
882
-            // 给申请人被申请人发送短信
880
+            // 被申请人发送短信
883
             if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) {
881
             if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) {
884
-                String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
885
-                // 给被申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
886
-                // todo 发送申请人注册小程序短信
887
-                Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getRespondentPhone(), new String[]{affiliate.getRespondentName(), application.getCaseNum()});
882
+                String sendContent = "尊敬的用户,您的" + application.getCaseNum() + "的案件已经受理,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信";
883
+                // 给被申请人发送案件受理短信 2068468 待缴费通知      尊敬的用户,您编号为{1}的案件已经受理,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信
884
+                Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2068468", affiliate.getRespondentPhone(), new String[]{ application.getCaseNum()});
888
                 CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent);
885
                 CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent);
889
                 SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getRespondentPhone(), new Date(), sendContent);
886
                 SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getRespondentPhone(), new Date(), sendContent);
890
                 if (smsFlag) {
887
                 if (smsFlag) {
1281
                     }
1278
                     }
1282
                     String templateId = String.valueOf(application.getTemplateId());
1279
                     String templateId = String.valueOf(application.getTemplateId());
1283
                     req.setTemplateId(templateId);
1280
                     req.setTemplateId(templateId);
1284
-                    req.setTemplateType(1);
1281
+                    req.setTemplateType(TemplateTypeEnum.MEDIATE_BOOK.getCode());
1285
                     AjaxResult result = generateApplication(req);
1282
                     AjaxResult result = generateApplication(req);
1286
                     if (result != null && result.isSuccess()) {
1283
                     if (result != null && result.isSuccess()) {
1287
                         List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId());
1284
                         List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId());

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java Voir le fichier

374
         boolean isSecretaryRole=false;
374
         boolean isSecretaryRole=false;
375
         if(CollectionUtil.isNotEmpty(roles)){
375
         if(CollectionUtil.isNotEmpty(roles)){
376
             for (SysRole role : roles) {
376
             for (SysRole role : roles) {
377
-                if("法律顾问".equals(role.getRoleName()) || "秘书".equals(role.getRoleName())){
377
+                if("调解员".equals(role.getRoleName())){
378
                     isSecretaryRole=true;
378
                     isSecretaryRole=true;
379
                     break;
379
                     break;
380
                 }
380
                 }

+ 4
- 4
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/dept/DeptIdentifyMapper.xml Voir le fichier

126
         </where>
126
         </where>
127
     </update>
127
     </update>
128
 
128
 
129
-
130
-
131
-
132
-
129
+    <select id="selectById" resultType="java.lang.String">
130
+        SELECT   identify_name identifyName
131
+        FROM  ms_dept_identify where id=#{id}
132
+    </select>
133
 </mapper>
133
 </mapper>

+ 88
- 27
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/template/TemplateManageMapper.xml Voir le fichier

6
     <resultMap type="com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage" id="TemplateManageResult">
6
     <resultMap type="com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage" id="TemplateManageResult">
7
         <id     property="id"       column="id"      />
7
         <id     property="id"       column="id"      />
8
         <result property="identifyId"     column="identify_id"    />
8
         <result property="identifyId"     column="identify_id"    />
9
+        <result property="fileId"     column="file_id"    />
9
         <result property="temName"        column="tem_name"        />
10
         <result property="temName"        column="tem_name"        />
10
         <result property="temType"  column="tem_type"  />
11
         <result property="temType"  column="tem_type"  />
11
         <result property="temFormat"     column="tem_format"     />
12
         <result property="temFormat"     column="tem_format"     />
12
         <result property="temOrigPath"     column="tem_orig_path"     />
13
         <result property="temOrigPath"     column="tem_orig_path"     />
13
         <result property="temRevisPath"     column="tem_revis_path"     />
14
         <result property="temRevisPath"     column="tem_revis_path"     />
14
-        <result property="delFlag"     column="del_flag"     />
15
         <result property="fileName"     column="file_name"     />
15
         <result property="fileName"     column="file_name"     />
16
     </resultMap>
16
     </resultMap>
17
 
17
 
18
     <insert id="insertTemplateManage" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage" useGeneratedKeys="true" keyProperty="id">
18
     <insert id="insertTemplateManage" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage" useGeneratedKeys="true" keyProperty="id">
19
         insert into ms_template_manage(
19
         insert into ms_template_manage(
20
-        <if test="identifyId != null">identify_id,</if>
21
-        <if test="temName != null and temName != ''">tem_name,</if>
22
-        <if test="temType != null">tem_type,</if>
23
-        <if test="temFormat != null and temFormat != '' ">tem_format,</if>
24
-        <if test="temOrigPath != null and temOrigPath != '' ">tem_orig_path,</if>
25
-        <if test="temRevisPath != null and temRevisPath != '' ">tem_revis_path,</if>
26
-        <if test="createBy != null and createBy != '' ">create_by,</if>
27
-        <if test="fileName != null and fileName != '' ">file_name,</if>
28
-        del_flag,create_time
20
+        identify_id,
21
+        tem_name,
22
+        create_by,
23
+        create_time
29
         )values(
24
         )values(
30
-        <if test="identifyId != null">#{identifyId},</if>
31
-        <if test="temName != null and temName != ''">#{temName},</if>
32
-        <if test="temType != null">#{temType},</if>
33
-        <if test="temFormat != null and temFormat != ''">#{temFormat},</if>
34
-        <if test="temOrigPath != null and temOrigPath != ''">#{temOrigPath},</if>
35
-        <if test="temRevisPath != null and temRevisPath != ''">#{temRevisPath},</if>
36
-        <if test="createBy != null and createBy != ''">#{createBy},</if>
37
-        <if test="fileName != null and fileName != ''">#{fileName},</if>
38
-        0,sysdate()
25
+        #{identifyId},
26
+        #{temName},
27
+        #{createBy},
28
+       sysdate()
39
         )
29
         )
40
     </insert>
30
     </insert>
41
 
31
 
44
         <set>
34
         <set>
45
             <if test="identifyId != null">identify_id = #{identifyId},</if>
35
             <if test="identifyId != null">identify_id = #{identifyId},</if>
46
             <if test="temName != null and temName != ''">tem_name = #{temName},</if>
36
             <if test="temName != null and temName != ''">tem_name = #{temName},</if>
47
-            <if test="temType != null">tem_type = #{temType},</if>
48
-            <if test="temFormat != null and temFormat != '' ">tem_format = #{temFormat},</if>
49
-            <if test="temOrigPath != null  and temOrigPath != ''">tem_orig_path = #{temOrigPath},</if>
50
-            <if test="delFlag != null ">del_flag = #{delFlag},</if>
51
-            <if test="temRevisPath != null and temRevisPath != '' ">tem_revis_path = #{temRevisPath},</if>
52
             <if test="updateBy != null and updateBy != '' ">update_by = #{updateBy},</if>
37
             <if test="updateBy != null and updateBy != '' ">update_by = #{updateBy},</if>
53
-            <if test="fileName != null and fileName != '' ">file_name = #{fileName},</if>
54
             update_time = sysdate()
38
             update_time = sysdate()
55
         </set>
39
         </set>
56
         <where>
40
         <where>
62
     </update>
46
     </update>
63
 
47
 
64
     <select id="selectTemplateList" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage" resultMap="TemplateManageResult">
48
     <select id="selectTemplateList" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage" resultMap="TemplateManageResult">
65
-        SELECT  id, identify_id ,tem_name , tem_type,tem_format,tem_orig_path,tem_revis_path ,file_name
49
+        SELECT  id, identify_id ,tem_name
66
         FROM  ms_template_manage
50
         FROM  ms_template_manage
67
         <where>
51
         <where>
68
             <if test="id != null">
52
             <if test="id != null">
77
             <if test="temType != null ">
61
             <if test="temType != null ">
78
                 AND tem_type = #{temType}
62
                 AND tem_type = #{temType}
79
             </if>
63
             </if>
80
-            AND  del_flag =0
81
         </where>
64
         </where>
82
         ORDER BY create_time DESC
65
         ORDER BY create_time DESC
83
     </select>
66
     </select>
89
     <select id="selectByType" resultMap="TemplateManageResult">
72
     <select id="selectByType" resultMap="TemplateManageResult">
90
         select * from ms_template_manage where tem_type=#{type}
73
         select * from ms_template_manage where tem_type=#{type}
91
     </select>
74
     </select>
75
+
76
+    <update id="updateByIds">
77
+
78
+        update ms_template_manage
79
+        <set>
80
+            <if test="identifyId != null">identify_id = #{identifyId},</if>
81
+            <if test="temName != null and temName != ''">tem_name = #{temName},</if>
82
+            <if test="updateBy != null and updateBy != '' ">update_by = #{updateBy},</if>
83
+
84
+            update_time = sysdate()
85
+        </set>
86
+        where id in
87
+        <foreach collection="annexIds" item="id" open="(" separator="," close=")">
88
+            #{id}
89
+        </foreach>
90
+
91
+
92
+    </update>
93
+
94
+
95
+    <insert id="insertTemplateManageFile" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage" useGeneratedKeys="true" keyProperty="fileId">
96
+        insert into ms_template_manage_file(
97
+        template_manage_id,
98
+        tem_type,
99
+        tem_format,
100
+        tem_orig_path,
101
+
102
+        file_name
103
+
104
+        )values(
105
+        #{id},
106
+        #{temType},
107
+        #{temFormat},
108
+        #{temOrigPath},
109
+
110
+        #{fileName}
111
+
112
+        )
113
+    </insert>
114
+
115
+    <delete id="deleteTemplateManage">
116
+        delete from ms_template_manage where id = #{id};
117
+        delete from ms_template_manage_file where template_manage_id = #{id};
118
+    </delete>
119
+
120
+    <update id="updateFileByIds">
121
+        update ms_template_manage_file
122
+
123
+        set template_manage_id=#{manage.id}
124
+        where file_id in
125
+        <foreach collection="manage.annexIds" item="id" open="(" separator="," close=")">
126
+            #{id}
127
+        </foreach>
128
+    </update>
129
+
130
+    <delete id="deleteTemplateManageFileById">
131
+        delete from ms_template_manage_file where template_manage_id = #{id} and file_id not in
132
+        <foreach collection="fileIds" item="it" open="(" separator="," close=")">
133
+            #{it}
134
+        </foreach>
135
+
136
+        ;
137
+    </delete>
138
+
139
+    <select id="selectByIdAndType" resultMap="TemplateManageResult">
140
+        select f.* from ms_template_manage m join ms_template_manage_file f on m.id=f.template_manage_id
141
+        where f.template_manage_id=#{templateId} and f.tem_type=#{type} oeder by f.file_id desc limit 1
142
+    </select>
143
+
144
+    <select id="selectFileById" resultMap="TemplateManageResult">
145
+        select f.* from  ms_template_manage_file f
146
+        where f.id=#{fileId}
147
+    </select>
148
+
149
+    <select id="selectTemplateListById" resultMap="TemplateManageResult">
150
+        select m.* ,f.* from ms_template_manage m join ms_template_manage_file f on m.id=f.template_manage_id
151
+        where m.id=#{id}
152
+    </select>
92
 </mapper>
153
 </mapper>