瀏覽代碼

调解申请书修改

18792927508 2 年之前
父節點
當前提交
bde135f621

+ 7
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/template/TemplateManageMapper.java 查看文件

14
 
14
 
15
     int updateTemplateManage(TemplateManage templateManage);
15
     int updateTemplateManage(TemplateManage templateManage);
16
     TemplateManage selectById(@Param("id") String id);
16
     TemplateManage selectById(@Param("id") String id);
17
+
18
+    /**
19
+     * 根据模板类型查找模板
20
+     * @param type 模板类型(1-调解书,2-调解申请书)
21
+     * @return
22
+     */
23
+    TemplateManage selectByType(@Param("type") int type);
17
 }
24
 }

+ 66
- 21
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java 查看文件

182
         if (caseApplication.getId() == null) {
182
         if (caseApplication.getId() == null) {
183
             caseApplication.setId(IdWorkerUtil.getId());
183
             caseApplication.setId(IdWorkerUtil.getId());
184
         }
184
         }
185
-        // 根据用户查询角色
186
-        LoginUser loginUser = SecurityUtils.getLoginUser();
187
-        List<SysRole> roles = loginUser.getUser().getRoles();
188
-        if (CollectionUtil.isEmpty(roles)) {
189
-            throw new ServiceException("该用户未指定角色");
190
-        }
191
-        // 根据角色查询关联的案件状态
192
-        Example example = new Example(MsCaseFlowRoleRelated.class);
193
-        example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()));
194
-        List<MsCaseFlowRoleRelated> caseFlowRoleRelatedList = caseFlowRoleRelatedMapper.selectByExample(example);
195
-        if (CollectionUtil.isEmpty(caseFlowRoleRelatedList)) {
185
+        // 根据角色获取案件流程
186
+        List<MsCaseFlow> caseFlows=  selectCaseFlows();
187
+        if (CollectionUtil.isEmpty(caseFlows)) {
196
             throw new ServiceException("该角色为绑定案件流程");
188
             throw new ServiceException("该角色为绑定案件流程");
197
         }
189
         }
198
-        Example flowExample = new Example(MsCaseFlow.class);
199
-        flowExample.setOrderByClause("sort asc");
200
-        flowExample.createCriteria().andIn("id", caseFlowRoleRelatedList.stream().map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toList()));
201
-        List<MsCaseFlow> caseFlows = caseFlowMapper.selectByExample(flowExample);
202
         MsCaseFlow caseFlow = caseFlows.get(0);
190
         MsCaseFlow caseFlow = caseFlows.get(0);
203
-        if (CollectionUtil.isNotEmpty(caseFlows)) {
204
-            caseApplication.setCaseStatusName(caseFlow.getCaseStatusName());
205
-            caseApplication.setCaseFlowId(caseFlow.getId());
206
-        }
191
+        caseApplication.setCaseStatusName(caseFlow.getCaseStatusName());
192
+        caseApplication.setCaseFlowId(caseFlow.getId());
207
         caseApplication.setCreateTime(new Date());
193
         caseApplication.setCreateTime(new Date());
208
         // 计算仲裁费用
194
         // 计算仲裁费用
209
         setFeePayableMethod(caseApplication);
195
         setFeePayableMethod(caseApplication);
256
                 }
242
                 }
257
                 affiliate.setCaseAppliId(caseApplication.getId());
243
                 affiliate.setCaseAppliId(caseApplication.getId());
258
                 msCaseAffiliateMapper.insert(affiliate);
244
                 msCaseAffiliateMapper.insert(affiliate);
245
+                // 生成调解申请书
246
+                // 查询调解申请书模板id
247
+                TemplateManage templateManage=templateManageMapper.selectByType(2);
248
+                if(templateManage!=null) {
249
+                    // 批量生成调解申请书
250
+                    MsCaseApplicationReq req = new MsCaseApplicationReq();
251
+                        req.setCaseFlowId(caseFlow.getId());
252
+                    if(!caseApplication.isImportFlag()) {
253
+                      req.setId(caseApplication.getId());
254
+                    }else {
255
+                        // 压缩包导入
256
+                        req.setBatchNumber(caseApplication.getBatchNumber());
257
+                    }
258
+                        req.setTemplateId(String.valueOf(templateManage.getId()));
259
+                        generateApplication(req);
260
+
261
+                }
259
             }
262
             }
260
             // 保存案件附件
263
             // 保存案件附件
261
 
264
 
285
         return 0;
288
         return 0;
286
     }
289
     }
287
 
290
 
291
+    /**
292
+     * 查询案件流程
293
+     * @return
294
+     */
295
+
296
+    private List<MsCaseFlow> selectCaseFlows() {
297
+
298
+        // 根据用户查询角色
299
+        LoginUser loginUser = SecurityUtils.getLoginUser();
300
+        List<SysRole> roles = loginUser.getUser().getRoles();
301
+        if (CollectionUtil.isEmpty(roles)) {
302
+            throw new ServiceException("该用户未指定角色");
303
+        }
304
+        // 根据角色查询关联的案件状态
305
+        Example example = new Example(MsCaseFlowRoleRelated.class);
306
+        example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()));
307
+        List<MsCaseFlowRoleRelated> caseFlowRoleRelatedList = caseFlowRoleRelatedMapper.selectByExample(example);
308
+        if (CollectionUtil.isEmpty(caseFlowRoleRelatedList)) {
309
+            throw new ServiceException("该角色为绑定案件流程");
310
+        }
311
+        Example flowExample = new Example(MsCaseFlow.class);
312
+        flowExample.setOrderByClause("sort asc");
313
+        flowExample.createCriteria().andIn("id", caseFlowRoleRelatedList.stream().map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toList()));
314
+        List<MsCaseFlow> caseFlows = caseFlowMapper.selectByExample(flowExample);
315
+        return caseFlows;
316
+    }
317
+
288
     /**
318
     /**
289
      * 计算仲裁费用
319
      * 计算仲裁费用
290
      *
320
      *
471
 
501
 
472
         }
502
         }
473
         if(caseCount>0) {
503
         if(caseCount>0) {
504
+
505
+//            // 查询调解申请书模板id
506
+//            TemplateManage templateManage=templateManageMapper.selectByType(2);
507
+//            if(templateManage!=null) {
508
+//                List<MsCaseFlow> caseFlows = selectCaseFlows();
509
+//                // 批量生成调解申请书
510
+//                MsCaseApplicationReq req = new MsCaseApplicationReq();
511
+//                if (CollectionUtil.isNotEmpty(caseFlows)) {
512
+//                    MsCaseFlow caseFlow = caseFlows.get(0);
513
+//                    req.setCaseFlowId(caseFlow.getId());
514
+//                    req.setBatchNumber(batchNumber);
515
+//                    req.setTemplateId(String.valueOf(templateManage.getId()));
516
+//                    generateApplication(req);
517
+//                }
518
+//            }
474
             return AjaxResult.success();
519
             return AjaxResult.success();
475
         }else {
520
         }else {
476
             return AjaxResult.error("请检查压缩包!");
521
             return AjaxResult.error("请检查压缩包!");
1109
         // todo
1154
         // todo
1110
         String saveFolderPath = RuoYiConfig.getUploadPath()+"/"+ year + "/" + month + "/" + day;
1155
         String saveFolderPath = RuoYiConfig.getUploadPath()+"/"+ year + "/" + month + "/" + day;
1111
         Integer annexType = AnnexTypeEnum.MEDIATION_APPLICATION.getCode();
1156
         Integer annexType = AnnexTypeEnum.MEDIATION_APPLICATION.getCode();
1112
-        String orgFileName = "调解申请书";
1157
+        String orgFileName = "调解申请书.docx";
1113
         if(templateType!=null&&templateType==1) {
1158
         if(templateType!=null&&templateType==1) {
1114
-            orgFileName = "调解书";
1159
+            orgFileName = "调解书.docx";
1115
             annexType=AnnexTypeEnum.MEDIATE_BOOK.getCode();
1160
             annexType=AnnexTypeEnum.MEDIATE_BOOK.getCode();
1116
         }
1161
         }
1117
         String fileName = UUID.randomUUID().toString().replace("-", "")+orgFileName + ".docx";
1162
         String fileName = UUID.randomUUID().toString().replace("-", "")+orgFileName + ".docx";

+ 4
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/template/TemplateManageMapper.xml 查看文件

85
     <select id="selectById" resultMap="TemplateManageResult">
85
     <select id="selectById" resultMap="TemplateManageResult">
86
         select * from ms_template_manage where id=#{id}
86
         select * from ms_template_manage where id=#{id}
87
     </select>
87
     </select>
88
+
89
+    <select id="selectByType" resultMap="TemplateManageResult">
90
+        select * from ms_template_manage where tem_type=#{type}
91
+    </select>
88
 </mapper>
92
 </mapper>