hejinbo 2 år sedan
förälder
incheckning
2557d57508

+ 22
- 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java Visa fil

@@ -29,6 +29,26 @@ public class DeptIdentifyController extends BaseController {
29 29
         return deptIdentifyService.insertDeptIdentify(deptIdentify);
30 30
     }
31 31
 
32
+    /**
33
+     * 删除机构
34
+     * @param id
35
+     * @return
36
+     */
37
+    @DeleteMapping("/delete")
38
+    public AjaxResult deleteDeptIdentify(Long id){
39
+        return deptIdentifyService.deleteDeptIdentify(id);
40
+    }
41
+
42
+    /**
43
+     * 修改机构信息
44
+     * @param deptIdentify
45
+     * @return
46
+     */
47
+    @PutMapping("/update")
48
+    public AjaxResult updateDeptIdentify(@RequestBody DeptIdentify deptIdentify){
49
+        return deptIdentifyService.updateDeptIdentify(deptIdentify);
50
+    }
51
+
32 52
     /**
33 53
      * 查询机构信息
34 54
      */
@@ -64,8 +84,8 @@ public class DeptIdentifyController extends BaseController {
64 84
      * @return
65 85
      */
66 86
     @PostMapping("/sealUpload")
67
-    public AjaxResult sealUpload(Long id, @RequestParam("file") MultipartFile file) {
68
-        return deptIdentifyService.sealUpload(id, file);
87
+    public AjaxResult sealUpload(Long id, String sealName , @RequestParam("file") MultipartFile file) {
88
+        return deptIdentifyService.sealUpload(id, sealName ,file);
69 89
     }
70 90
 
71 91
     /**

+ 3
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java Visa fil

@@ -37,4 +37,7 @@ public class DeptIdentify   extends BaseEntity {
37 37
     private Integer identifyType;
38 38
 
39 39
 
40
+    /** 删除标志(0代表存在 2代表删除) */
41
+    private Integer delFlag;
42
+
40 43
 }

+ 2
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java Visa fil

@@ -4,6 +4,8 @@ import lombok.Data;
4 4
 
5 5
 @Data
6 6
 public class SealListVO {
7
+    /** 主键 */
8
+    private Long id;
7 9
     /** 印章id */
8 10
     private String sealId;
9 11
     /** 印章名称 */

+ 4
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java Visa fil

@@ -19,7 +19,7 @@ public interface IDeptIdentifyService {
19 19
 
20 20
     AjaxResult enableDept(DeptIdentify deptIdentify);
21 21
 
22
-    AjaxResult sealUpload(Long id,MultipartFile file);
22
+    AjaxResult sealUpload(Long id,String sealName ,MultipartFile file);
23 23
 
24 24
 
25 25
     AjaxResult receiveNotify(String body);
@@ -31,4 +31,7 @@ public interface IDeptIdentifyService {
31 31
 
32 32
     AjaxResult insertDeptIdentify(DeptIdentify deptIdentify);
33 33
 
34
+    AjaxResult deleteDeptIdentify(Long id);
35
+
36
+    AjaxResult updateDeptIdentify(DeptIdentify deptIdentify);
34 37
 }

+ 5
- 3
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Visa fil

@@ -1725,9 +1725,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1725 1725
                     for (CaseAttach caseAttach : caseAttachList) {
1726 1726
                         if (caseAttach.getAnnexType() == 3) {
1727 1727
                             String annexPath = caseAttach.getAnnexPath();
1728
-                            //String path = "/home/ruoyi" + annexPath;
1728
+                            String path = "/home/ruoyi" + annexPath;
1729 1729
                             // System.out.println("这是查询到的裁决书路径" + path);
1730
-                            String path = "D:\\home\\仲裁裁决书模板.docx";
1730
+                            //String path = "D:\\home\\仲裁裁决书模板.docx";
1731 1731
                             //获取文件上传地址
1732 1732
                             EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
1733 1733
                             String body = response.getBody();
@@ -1873,8 +1873,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1873 1873
                                                     } else {
1874 1874
                                                         throw new ServiceException("发起签署流程失败,请检查参数是否有误");
1875 1875
                                                     }
1876
+                                                }else {
1877
+                                                    return AjaxResult.error();
1876 1878
                                                 }
1877
-                                                  return AjaxResult.error();
1879
+
1878 1880
                                             }
1879 1881
 
1880 1882
 

+ 92
- 17
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java Visa fil

@@ -7,9 +7,13 @@ import com.ruoyi.common.config.RuoYiConfig;
7 7
 import com.ruoyi.common.constant.FileTransformation;
8 8
 import com.ruoyi.common.core.domain.AjaxResult;
9 9
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
10
+import com.ruoyi.common.core.domain.entity.SysDept;
11
+import com.ruoyi.common.core.domain.entity.SysUser;
10 12
 import com.ruoyi.common.exception.EsignDemoException;
11 13
 import com.ruoyi.common.utils.SealUtil;
12 14
 import com.ruoyi.common.utils.file.FileUploadUtils;
15
+import com.ruoyi.system.mapper.SysDeptMapper;
16
+import com.ruoyi.system.mapper.SysUserMapper;
13 17
 import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
14 18
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
15 19
 import com.ruoyi.wisdomarbitrate.domain.SealManage;
@@ -27,10 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
27 31
 import java.io.File;
28 32
 import java.io.IOException;
29 33
 import java.time.LocalDate;
30
-import java.util.ArrayList;
31
-import java.util.Date;
32
-import java.util.List;
33
-import java.util.UUID;
34
+import java.util.*;
34 35
 
35 36
 @Service
36 37
 public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
@@ -41,6 +42,10 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
41 42
     private CaseAttachMapper caseAttachMapper;
42 43
     @Autowired
43 44
     private SealManageMapper sealManageMapper;
45
+    @Autowired
46
+    private SysDeptMapper sysDeptMapper;
47
+    @Autowired
48
+    private SysUserMapper sysUserMapper;
44 49
 
45 50
 
46 51
     @Override
@@ -106,7 +111,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
106 111
     }
107 112
 
108 113
     @Override
109
-    public AjaxResult sealUpload(Long id, MultipartFile file) {
114
+    public AjaxResult sealUpload(Long id, String sealName, MultipartFile file) {
110 115
         try {
111 116
             if (file.isEmpty()) {
112 117
                 return AjaxResult.error("请选择要上传的文件");
@@ -133,8 +138,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
133 138
                         startIndex += prefix.length();
134 139
                         String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex);
135 140
                         //创建机构图片印章
136
-                        // String annexPath = "D:\\develop\\2.jpg";
137
-                        String sealName = "自定义" + UUID.randomUUID() + "";  //自定义印章印章名称不能重复,所以用UUID确保唯一性
141
+                        //String annexPath = "D:\\develop\\2.jpg";
142
+
138 143
                         EsignHttpResponse response = SignAward.createOrgByImage(identify, sealName, annexPath);
139 144
                         JSONObject jsonObject = JSONObject.parseObject(response.getBody());
140 145
                         int code = jsonObject.getIntValue("code");
@@ -152,7 +157,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
152 157
                                 return AjaxResult.success("上传成功");
153 158
                             }
154 159
                         }
155
-                        return AjaxResult.error("公章上传失败,请检查参数");
160
+                        return AjaxResult.error(jsonObject.getString("message"));
156 161
                     }
157 162
                     return AjaxResult.error("企业用户未授予资源管理权限");
158 163
                 }
@@ -257,14 +262,15 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
257 262
         List<SealListVO> sealListVOS = new ArrayList<>();
258 263
         if (selectSealList != null && selectSealList.size() > 0) {
259 264
             for (SealManage sealManage1 : selectSealList) {
260
-                Integer sealStatus = sealManage1.getSealStatus();
261
-                if (sealStatus == 1) {   //审核状态为启用
262
-                    SealListVO sealListVO = new SealListVO();
263
-                    sealListVO.setSealId(sealManage1.getSealId());
264
-                    sealListVO.setSealName(sealManage1.getSealName());
265
-                    sealListVO.setSealStatus(sealManage1.getSealStatus());
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();
271
+                if (annexId != null) {
266 272
                     //根据附件id查询路径
267
-                    CaseAttach caseAttach = caseAttachMapper.queryAnnexById(sealManage1.getAnnexId());
273
+                    CaseAttach caseAttach = caseAttachMapper.queryAnnexById(annexId);
268 274
                     String annexName = caseAttach.getAnnexName();
269 275
                     String prefix = "/profile";
270 276
                     int startIndex = annexName.indexOf(prefix);
@@ -272,9 +278,12 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
272 278
                     String annexPath = "/uploadPath" + annexName.substring(startIndex);
273 279
                     sealListVO.setAnnexPath(annexPath);
274 280
                     sealListVO.setAnnexType(caseAttach.getAnnexType());
275
-                    sealListVO.setIsUse(sealManage1.getIsUse());
276
-                    sealListVOS.add(sealListVO);
281
+                } else {
282
+                    sealListVO.setAnnexPath(null);
283
+                    sealListVO.setAnnexType(null);
277 284
                 }
285
+                sealListVO.setIsUse(sealManage1.getIsUse());
286
+                sealListVOS.add(sealListVO);
278 287
             }
279 288
         }
280 289
         return sealListVOS;
@@ -309,8 +318,74 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
309 318
         deptIdentify.setIsUse(0); //设置机构默认为未启用
310 319
         int i = deptIdentifyMapper.insertDeptIdentify(deptIdentify);
311 320
         if (i > 0) {
321
+            //将机构名称保存到部门表里
322
+            SysDept sysDept = new SysDept();
323
+            sysDept.setDeptName(identifyName);
324
+            sysDept.setParentId(0L);
325
+            sysDept.setDeptType(1);
326
+            int i1 = sysDeptMapper.insertDept(sysDept);
327
+            if (i1 > 0) {
328
+                //将经办人信息存入到用户表里
329
+                Long deptId = sysDept.getDeptId();
330
+                SysUser sysUser = new SysUser();
331
+                sysUser.setDeptId(deptId);
332
+                sysUser.setUserName(generateUniqueUsername());//设置默认的用户名
333
+                sysUser.setNickName(operName);
334
+                sysUser.setPhonenumber(operPhone);
335
+                sysUserMapper.insertUser(sysUser);
336
+            }
337
+
312 338
             return AjaxResult.success("新增成功");
313 339
         }
314 340
         return AjaxResult.error();
315 341
     }
342
+
343
+    @Override
344
+    public AjaxResult deleteDeptIdentify(Long id) {
345
+        DeptIdentify deptIdentify = new DeptIdentify();
346
+        deptIdentify.setId(id);
347
+        deptIdentify.setDelFlag(2);
348
+        int i = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
349
+        if (i > 0) {
350
+            return AjaxResult.success("删除成功");
351
+        }
352
+        return AjaxResult.error();
353
+    }
354
+
355
+    @Override
356
+    public AjaxResult updateDeptIdentify(DeptIdentify deptIdentify) {
357
+        Long id = deptIdentify.getId();
358
+        if (id == null) {
359
+            return AjaxResult.error();
360
+        }
361
+        DeptIdentify deptIdentifyNew = new DeptIdentify();
362
+        deptIdentifyNew.setId(id);
363
+        List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentifyNew);
364
+        if (deptIdentifies != null && deptIdentifies.size() > 0) {
365
+            DeptIdentify deptIdentify1 = deptIdentifies.get(0);
366
+            if (deptIdentify1.getIdentifyStatus() == 1) {
367
+                return AjaxResult.error("已认证的机构不允许修改");
368
+            }
369
+            int i = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
370
+            if (i > 0) {
371
+                return AjaxResult.success("修改成功");
372
+            }
373
+        }
374
+        return null;
375
+    }
376
+
377
+    private String generateUniqueUsername() {
378
+        final Random random = new Random();
379
+        final Set<String> generatedUsernames = new HashSet<>();
380
+        while (true) {
381
+            int min = 000000; // 最小的六位数
382
+            int max = 999999; // 最大的六位数
383
+            int randomNum = random.nextInt(max - min + 1) + min;
384
+            if (!generatedUsernames.contains(randomNum)) {
385
+                generatedUsernames.add(String.valueOf(randomNum));
386
+                return String.valueOf(randomNum);
387
+            }
388
+        }
389
+    }
390
+
316 391
 }

+ 2
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java Visa fil

@@ -43,7 +43,7 @@ public class FixSelectFlowDetailUtils {
43 43
     /*
44 44
     定时查询签署流程详情
45 45
      */
46
-    //@Scheduled(cron = "0/10 * * * * ?")
46
+    @Scheduled(cron = "0/10 * * * * ?")
47 47
     @Transactional
48 48
     public void fixExecuteSelectFlowDetailUtils() {
49 49
         Gson gson = new Gson();
@@ -177,7 +177,7 @@ public class FixSelectFlowDetailUtils {
177 177
      *
178 178
      * @throws Exception
179 179
      */
180
-    //@Scheduled(cron = "*/30 * * * * *")
180
+    @Scheduled(cron = "*/30 * * * * *")
181 181
     @Transactional
182 182
     public void fixExecuteSelectDeptIndentifyUtils() throws Exception {
183 183
         Gson gson = new Gson();

+ 11
- 5
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml Visa fil

@@ -14,6 +14,7 @@
14 14
         <result property="operName"     column="oper_name"     />
15 15
         <result property="operPhone"     column="oper_phone"     />
16 16
         <result property="identifyType"     column="identify_type"     />
17
+        <result property="delFlag"     column="del_flag"     />
17 18
 
18 19
     </resultMap>
19 20
 
@@ -42,6 +43,7 @@
42 43
                 AND oper_phone = #{operPhone}
43 44
             </if>
44 45
             AND identify_type = 1
46
+            AND  del_flag =0
45 47
         </where>
46 48
     </select>
47 49
 
@@ -55,9 +57,9 @@
55 57
         <if test="orgId != null and orgId != ''">org_id,</if>
56 58
         <if test="operName != null and operName != ''">oper_name,</if>
57 59
         <if test="operPhone != null and operPhone != ''">oper_phone,</if>
58
-        <if test="identifyType != null">identify_type</if>
59
-        <if test="authFlowId != null and authFlowId != ''">auth_flow_id</if>
60
-
60
+        <if test="identifyType != null">identify_type,</if>
61
+        <if test="authFlowId != null and authFlowId != ''">auth_flow_id,</if>
62
+        del_flag
61 63
         )values(
62 64
         <if test="identifyName != null and identifyName != ''">#{identifyName},</if>
63 65
         <if test="identifyStatus != null">#{identifyStatus},</if>
@@ -66,8 +68,9 @@
66 68
         <if test="orgId != null and orgId != ''">#{orgId},</if>
67 69
         <if test="operName != null and operName != ''">#{operName},</if>
68 70
         <if test="operPhone != null and operPhone != ''">#{operPhone},</if>
69
-        <if test="identifyType != null ">#{identifyType}</if>
70
-        <if test="authFlowId != null and authFlowId != '' ">#{authFlowId}</if>
71
+        <if test="identifyType != null ">#{identifyType},</if>
72
+        <if test="authFlowId != null and authFlowId != '' ">#{authFlowId},</if>
73
+        0
71 74
         )
72 75
     </insert>
73 76
 
@@ -83,6 +86,9 @@
83 86
             <if test="isUse != null">is_use = #{isUse},</if>
84 87
             <if test="identifyStatus != null ">identify_status = #{identifyStatus},</if>
85 88
             <if test="orgId != null  and orgId != ''">org_id = #{orgId},</if>
89
+            <if test="delFlag != null ">del_flag = #{delFlag},</if>
90
+            <if test="operName != null ">oper_name = #{operName},</if>
91
+            <if test="operPhone != null ">oper_phone = #{operPhone},</if>
86 92
             <if test="authFlowId != null  and authFlowId != '' ">auth_flow_id = #{authFlowId}</if>
87 93
         </set>
88 94
         <where>