hejinbo 2 лет назад
Родитель
Сommit
35a9faeb6a

+ 42
- 12
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java Просмотреть файл

104
      * @return
104
      * @return
105
      */
105
      */
106
     @GetMapping("/sealList")
106
     @GetMapping("/sealList")
107
-    public TableDataInfo getSealList( DeptIdentify deptIdentify){
107
+    public  TableDataInfo getSealList( DeptIdentify deptIdentify ){
108
         startPage();
108
         startPage();
109
-        List<SealListVO> list = deptIdentifyService.getSealList(deptIdentify);
110
-        return getDataTable(list);
109
+        List<SealManage> sealList = deptIdentifyService.getSealList(deptIdentify);
110
+        return getDataTable(sealList);
111
     }
111
     }
112
 
112
 
113
     /**
113
     /**
123
         return deptIdentifyService.updateSealLockStatus(sealManage);
123
         return deptIdentifyService.updateSealLockStatus(sealManage);
124
     }
124
     }
125
 
125
 
126
-//    /**
127
-//     * 新增模板
128
-//     * @param deptIdentify
129
-//     * @return
130
-//     */
131
-//    @PostMapping("/insert")
132
-//    public AjaxResult insertDeptIdentify(@RequestBody DeptIdentify deptIdentify){
133
-//        return deptIdentifyService.insertDeptIdentify(deptIdentify);
134
-//    }
126
+    /**
127
+     * 新增模板
128
+     * @param templateManage
129
+     * @return
130
+     */
131
+    @PostMapping("/insertTemplate")
132
+    public AjaxResult insertTemplate(@RequestBody TemplateManage templateManage,@RequestParam("file") MultipartFile file){
133
+        return deptIdentifyService.insertTemplate(templateManage,file);
134
+    }
135
+    /**
136
+     * 修改模板
137
+     * @param templateManage
138
+     * @return
139
+     */
140
+    @PostMapping("/updateTemplate")
141
+    public AjaxResult updateTemplate(@RequestBody TemplateManage templateManage,@RequestParam("file") MultipartFile file){
142
+        return deptIdentifyService.updateTemplate(templateManage,file);
143
+    }
135
 
144
 
145
+    /**
146
+     * 删除模板
147
+     * @param id
148
+     * @return
149
+     */
150
+    @DeleteMapping("/deleteTemplate")
151
+    public AjaxResult deleteTemplate(Long id){
152
+        return deptIdentifyService.deleteTemplate(id);
153
+    }
154
+
155
+    /**
156
+     * 根据机构id查询模板
157
+     * @param deptIdentify
158
+     * @return
159
+     */
160
+    @GetMapping("/getTemplate")
161
+    public TableDataInfo getTemplateList( DeptIdentify deptIdentify){
162
+        startPage();
163
+        List<TemplateManage> sealList = deptIdentifyService.getTemplateList(deptIdentify);
164
+        return getDataTable(sealList);
165
+    }
136
 }
166
 }

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java Просмотреть файл

6
 
6
 
7
 import java.util.Date;
7
 import java.util.Date;
8
 @Data
8
 @Data
9
-public class DeptIdentify   extends BaseEntity {
9
+public class DeptIdentify  extends BaseEntity {
10
     private static final long serialVersionUID = 1L;
10
     private static final long serialVersionUID = 1L;
11
 
11
 
12
     /** ID */
12
     /** ID */

+ 6
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/SealManage.java Просмотреть файл

39
      * 印章使用状态(0禁用,1启用)
39
      * 印章使用状态(0禁用,1启用)
40
      */
40
      */
41
     private  Integer isUse;
41
     private  Integer isUse;
42
+
43
+    /**
44
+     * 附件路径
45
+     */
46
+    private String annexPath;
47
+
42
 }
48
 }

+ 2
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java Просмотреть файл

1
 package com.ruoyi.wisdomarbitrate.domain.vo;
1
 package com.ruoyi.wisdomarbitrate.domain.vo;
2
 
2
 
3
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4
+import com.fasterxml.jackson.annotation.JsonInclude;
3
 import lombok.Data;
5
 import lombok.Data;
4
 
6
 
5
 @Data
7
 @Data

+ 16
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/TemplateManageMapper.java Просмотреть файл

1
+package com.ruoyi.wisdomarbitrate.mapper;
2
+
3
+import com.ruoyi.wisdomarbitrate.domain.SealManage;
4
+import com.ruoyi.wisdomarbitrate.domain.TemplateManage;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+import java.util.List;
8
+
9
+@Mapper
10
+public interface TemplateManageMapper {
11
+    List<TemplateManage> selectTemplateList(TemplateManage templateManage);
12
+
13
+    int insertTemplateManage(TemplateManage templateManage);
14
+
15
+    int updateTemplateManage(TemplateManage templateManage);
16
+}

+ 11
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java Просмотреть файл

4
 import com.ruoyi.common.exception.EsignDemoException;
4
 import com.ruoyi.common.exception.EsignDemoException;
5
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
5
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
6
 import com.ruoyi.wisdomarbitrate.domain.SealManage;
6
 import com.ruoyi.wisdomarbitrate.domain.SealManage;
7
+import com.ruoyi.wisdomarbitrate.domain.TemplateManage;
7
 import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
8
 import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
8
 import org.springframework.web.multipart.MultipartFile;
9
 import org.springframework.web.multipart.MultipartFile;
9
 
10
 
24
 
25
 
25
     AjaxResult receiveNotify(String body);
26
     AjaxResult receiveNotify(String body);
26
 
27
 
27
-    List<SealListVO> getSealList(DeptIdentify deptIdentify);
28
+    List<SealManage> getSealList(DeptIdentify deptIdentify);
28
 
29
 
29
     AjaxResult updateSealLockStatus(SealManage sealManage);
30
     AjaxResult updateSealLockStatus(SealManage sealManage);
30
 
31
 
34
     AjaxResult deleteDeptIdentify(Long id);
35
     AjaxResult deleteDeptIdentify(Long id);
35
 
36
 
36
     AjaxResult updateDeptIdentify(DeptIdentify deptIdentify);
37
     AjaxResult updateDeptIdentify(DeptIdentify deptIdentify);
38
+
39
+    AjaxResult insertTemplate(TemplateManage templateManage , MultipartFile file);
40
+
41
+    AjaxResult updateTemplate(TemplateManage templateManage, MultipartFile file);
42
+
43
+    AjaxResult deleteTemplate(Long id);
44
+
45
+    List<TemplateManage> getTemplateList(DeptIdentify deptIdentify);
46
+
37
 }
47
 }

+ 106
- 15
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java Просмотреть файл

1
 package com.ruoyi.wisdomarbitrate.service.impl;
1
 package com.ruoyi.wisdomarbitrate.service.impl;
2
 
2
 
3
 import com.alibaba.fastjson.JSONObject;
3
 import com.alibaba.fastjson.JSONObject;
4
+import com.github.pagehelper.PageHelper;
5
+import com.github.pagehelper.PageInfo;
4
 import com.google.gson.Gson;
6
 import com.google.gson.Gson;
5
 import com.google.gson.JsonObject;
7
 import com.google.gson.JsonObject;
6
 import com.ruoyi.common.config.RuoYiConfig;
8
 import com.ruoyi.common.config.RuoYiConfig;
17
 import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
19
 import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
18
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
20
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
19
 import com.ruoyi.wisdomarbitrate.domain.SealManage;
21
 import com.ruoyi.wisdomarbitrate.domain.SealManage;
22
+import com.ruoyi.wisdomarbitrate.domain.TemplateManage;
20
 import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
23
 import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
21
 import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
24
 import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
22
 import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper;
25
 import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper;
23
 import com.ruoyi.wisdomarbitrate.mapper.SealManageMapper;
26
 import com.ruoyi.wisdomarbitrate.mapper.SealManageMapper;
27
+import com.ruoyi.wisdomarbitrate.mapper.TemplateManageMapper;
24
 import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
28
 import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
25
 import com.ruoyi.wisdomarbitrate.utils.SignAward;
29
 import com.ruoyi.wisdomarbitrate.utils.SignAward;
30
+import org.springframework.beans.BeanUtils;
26
 import org.springframework.beans.factory.annotation.Autowired;
31
 import org.springframework.beans.factory.annotation.Autowired;
27
 import org.springframework.stereotype.Service;
32
 import org.springframework.stereotype.Service;
28
 import org.springframework.transaction.annotation.Transactional;
33
 import org.springframework.transaction.annotation.Transactional;
33
 import java.time.LocalDate;
38
 import java.time.LocalDate;
34
 import java.util.*;
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
 @Service
44
 @Service
37
 public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
45
 public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
38
 
46
 
46
     private SysDeptMapper sysDeptMapper;
54
     private SysDeptMapper sysDeptMapper;
47
     @Autowired
55
     @Autowired
48
     private SysUserMapper sysUserMapper;
56
     private SysUserMapper sysUserMapper;
57
+    @Autowired
58
+    private TemplateManageMapper templateManageMapper;
49
 
59
 
50
 
60
 
51
     @Override
61
     @Override
252
     }
262
     }
253
 
263
 
254
     @Override
264
     @Override
255
-    public List<SealListVO> getSealList(DeptIdentify deptIdentify) {
265
+    public List<SealManage> getSealList(DeptIdentify deptIdentify) {
256
         if (deptIdentify.getId() == null) {
266
         if (deptIdentify.getId() == null) {
257
             return null;
267
             return null;
258
         }
268
         }
259
         SealManage sealManage = new SealManage();
269
         SealManage sealManage = new SealManage();
260
         sealManage.setIdentifyId(deptIdentify.getId());
270
         sealManage.setIdentifyId(deptIdentify.getId());
261
         List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
271
         List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
262
-        List<SealListVO> sealListVOS = new ArrayList<>();
263
         if (selectSealList != null && selectSealList.size() > 0) {
272
         if (selectSealList != null && selectSealList.size() > 0) {
264
             for (SealManage sealManage1 : selectSealList) {
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
                 Integer annexId = sealManage1.getAnnexId();
274
                 Integer annexId = sealManage1.getAnnexId();
271
                 if (annexId != null) {
275
                 if (annexId != null) {
272
                     //根据附件id查询路径
276
                     //根据附件id查询路径
276
                     int startIndex = annexName.indexOf(prefix);
280
                     int startIndex = annexName.indexOf(prefix);
277
                     startIndex += prefix.length();
281
                     startIndex += prefix.length();
278
                     String annexPath = "/uploadPath" + annexName.substring(startIndex);
282
                     String annexPath = "/uploadPath" + annexName.substring(startIndex);
279
-                    sealListVO.setAnnexPath(annexPath);
280
-                    sealListVO.setAnnexType(caseAttach.getAnnexType());
283
+                    sealManage1.setAnnexPath(annexPath);
281
                 } else {
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
     @Override
292
     @Override
374
         return null;
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
     private String generateUniqueUsername() {
462
     private String generateUniqueUsername() {
378
         final Random random = new Random();
463
         final Random random = new Random();
379
         final Set<String> generatedUsernames = new HashSet<>();
464
         final Set<String> generatedUsernames = new HashSet<>();
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
 }

+ 1
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml Просмотреть файл

83
         update dept_identify
83
         update dept_identify
84
         <set>
84
         <set>
85
             <if test="identifyDate != null">identify_date = #{identifyDate},</if>
85
             <if test="identifyDate != null">identify_date = #{identifyDate},</if>
86
+            <if test="identifyName != null">identify_name = #{identifyName},</if>
86
             <if test="isUse != null">is_use = #{isUse},</if>
87
             <if test="isUse != null">is_use = #{isUse},</if>
87
             <if test="identifyStatus != null ">identify_status = #{identifyStatus},</if>
88
             <if test="identifyStatus != null ">identify_status = #{identifyStatus},</if>
88
             <if test="orgId != null  and orgId != ''">org_id = #{orgId},</if>
89
             <if test="orgId != null  and orgId != ''">org_id = #{orgId},</if>

+ 80
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/TemplateManageMapper.xml Просмотреть файл

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.ruoyi.wisdomarbitrate.mapper.TemplateManageMapper">
6
+    <resultMap type="TemplateManage" id="TemplateManageResult">
7
+        <id     property="id"       column="id"      />
8
+        <result property="identifyId"     column="identify_id"    />
9
+        <result property="temName"        column="tem_name"        />
10
+        <result property="temType"  column="tem_type"  />
11
+        <result property="temFormat"     column="tem_format"     />
12
+        <result property="temOrigPath"     column="tem_orig_path"     />
13
+        <result property="temRevisPath"     column="tem_revis_path"     />
14
+        <result property="delFlag"     column="del_flag"     />
15
+    </resultMap>
16
+
17
+    <insert id="insertTemplateManage" parameterType="TemplateManage" useGeneratedKeys="true" keyProperty="id">
18
+        insert into template_manage(
19
+        <if test="identifyId != null">identify_id,</if>
20
+        <if test="temName != null and temName != ''">tem_name,</if>
21
+        <if test="temType != null">tem_type,</if>
22
+        <if test="temFormat != null and temFormat != '' ">tem_format,</if>
23
+        <if test="temOrigPath != null and temOrigPath != '' ">tem_orig_path,</if>
24
+        <if test="temRevisPath != null and temRevisPath != '' ">tem_revis_path,</if>
25
+        <if test="createBy != null and createBy != '' ">create_by,</if>
26
+        del_flag,create_time
27
+        )values(
28
+        <if test="identifyId != null">#{identifyId},</if>
29
+        <if test="sealName != null and sealName != ''">#{sealName},</if>
30
+        <if test="temType != null">#{temType},</if>
31
+        <if test="temFormat != null and temFormat != ''">#{temFormat},</if>
32
+        <if test="temOrigPath != null and temOrigPath != ''">#{temOrigPath},</if>
33
+        <if test="temRevisPath != null and temRevisPath != ''">#{temRevisPath},</if>
34
+        <if test="createBy != null and createBy != ''">#{createBy},</if>
35
+        0,sysdate()
36
+        )
37
+    </insert>
38
+
39
+    <update id="updateTemplateManage" parameterType="TemplateManage">
40
+        update template_manage
41
+        <set>
42
+            <if test="identifyId != null">identify_id = #{identifyId},</if>
43
+            <if test="temName != null and temName != ''">tem_name = #{temName},</if>
44
+            <if test="temType != null">tem_type = #{temType},</if>
45
+            <if test="temFormat != null and temFormat != '' ">tem_format = #{temFormat},</if>
46
+            <if test="temOrigPath != null  and temOrigPath != ''">tem_orig_path = #{temOrigPath},</if>
47
+            <if test="delFlag != null ">del_flag = #{delFlag},</if>
48
+            <if test="temRevisPath != null and temRevisPath != '' ">tem_revis_path = #{temRevisPath},</if>
49
+            <if test="updateBy != null and updateBy != '' ">update_by = #{updateBy},</if>
50
+            update_time = sysdate()
51
+        </set>
52
+        <where>
53
+            <if test="id != null">
54
+                AND id = #{id}
55
+            </if>
56
+
57
+        </where>
58
+    </update>
59
+
60
+    <select id="selectTemplateList" parameterType="TemplateManage" resultMap="TemplateManageResult">
61
+        SELECT  id, identify_id ,tem_name , tem_type,tem_format,tem_orig_path,tem_revis_path
62
+        FROM  template_manage
63
+        <where>
64
+            <if test="id != null">
65
+                AND id = #{id}
66
+            </if>
67
+            <if test="identifyId != null">
68
+                AND identify_id = #{identifyId}
69
+            </if>
70
+            <if test="temName != null  and temName != ''">
71
+                AND tem_name = #{temName}
72
+            </if>
73
+            <if test="temType != null ">
74
+                AND tem_type = #{temType}
75
+            </if>
76
+            AND  del_flag =0
77
+        </where>
78
+    </select>
79
+
80
+</mapper>