Просмотр исходного кода

Merge branch 'dev' of http://git.xayunmei.com/SH-Arbitrate/Mediation-Backend into qtz

qitz 2 лет назад
Родитель
Сommit
79afb35549

+ 40
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java Просмотреть файл

@@ -7,9 +7,11 @@ import com.ruoyi.common.core.controller.BaseController;
7 7
 import com.ruoyi.common.core.domain.AjaxResult;
8 8
 import com.ruoyi.common.core.page.TableDataInfo;
9 9
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
10
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
10 11
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.BookingVO;
11 12
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq;
12 13
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
14
+import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseAttachVO;
13 15
 import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
14 16
 import org.springframework.web.bind.annotation.*;
15 17
 import org.springframework.web.multipart.MultipartFile;
@@ -201,5 +203,43 @@ public class MsCaseApplicationController extends BaseController {
201 203
     public AjaxResult selectReservation(@RequestParam("id") Long id ) {
202 204
         return caseApplicationService.selectReservation(id);
203 205
     }
206
+    /**
207
+     * 调解
208
+     * @param
209
+     * @return
210
+     */
211
+    @PostMapping("/mediation")
212
+    public AjaxResult mediation(@RequestBody MsCaseApplicationReq req)   {
213
+        if (req.getCaseFlowId() == null || (req.getId() == null && StrUtil.isEmpty(req.getBatchNumber()))) {
214
+            return error("参数校验失败");
215
+        }
204 216
 
217
+        return caseApplicationService.mediation(req);
218
+    }
219
+    /**
220
+     * 修改庭审笔录
221
+     * @param
222
+     * @return
223
+     */
224
+    @PostMapping("/updateTrialPen")
225
+    public AjaxResult updateTrialPen(@RequestBody MsCaseAttach attach)   {
226
+        if (attach.getCaseAppliId()==null || attach.getAnnexId()==null ) {
227
+            return error("参数校验失败");
228
+        }
229
+
230
+        return caseApplicationService.updateTrialPen(attach);
231
+    }
232
+    /**
233
+     * 确认调解书
234
+     * @param
235
+     * @return
236
+     */
237
+    @PostMapping("/confirmMediation")
238
+    public AjaxResult confirmMediation(@RequestBody MsCaseAttachVO attach)   {
239
+        if (attach.getCaseFlowId()==null || attach.getCaseAppliId()==null ) {
240
+            return error("参数校验失败");
241
+        }
242
+
243
+        return caseApplicationService.confirmMediation(attach);
244
+    }
205 245
 }

+ 2
- 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java Просмотреть файл

@@ -15,6 +15,8 @@ public enum AnnexTypeEnum implements EnumsInterface {
15 15
     MEDIATION_APPLICATION(3, "调解申请书"),
16 16
     PAYMENT_RECEIPT(4, "缴费单"),
17 17
     MEETING_VIDEO(5, "会议视频"),
18
+    MEDIATE(6, "庭审笔录"),
19
+    MEDIATE_BOOK(7, "调解书"),
18 20
 
19 21
     ;
20 22
 

+ 2
- 1
ruoyi-common/src/main/java/com/ruoyi/common/utils/BookMarkUtil.java Просмотреть файл

@@ -2,6 +2,7 @@ package com.ruoyi.common.utils;
2 2
 
3 3
 import cn.hutool.core.collection.CollectionUtil;
4 4
 import cn.hutool.core.util.StrUtil;
5
+import com.ruoyi.common.exception.ServiceException;
5 6
 import org.apache.poi.xwpf.usermodel.XWPFDocument;
6 7
 import org.apache.poi.xwpf.usermodel.XWPFParagraph;
7 8
 
@@ -32,7 +33,7 @@ public class BookMarkUtil {
32 33
             FileInputStream fileInputStream = new FileInputStream(path);
33 34
             xwpfDocument = new XWPFDocument(fileInputStream);
34 35
         } catch (IOException e) {
35
-            e.printStackTrace();
36
+            throw new ServiceException("未找到模板");
36 37
         }
37 38
         if (xwpfDocument == null) {
38 39
             return new ArrayList<>();

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

@@ -70,6 +70,7 @@ public class MsCaseApplication {
70 70
     /**
71 71
      * 开庭日期
72 72
      */
73
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
73 74
     @Column(name = "hear_date")
74 75
     private String hearDate;
75 76
 

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

@@ -60,5 +60,9 @@ public class MsCaseApplicationReq {
60 60
      */
61 61
 
62 62
     private String mediatorName;
63
+    /**
64
+     * 模板类型,1调解书,2调解申请书
65
+     */
66
+    private Integer templateType=2;
63 67
 
64 68
 }

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

@@ -0,0 +1,17 @@
1
+package com.ruoyi.wisdomarbitrate.domain.vo.mscase;
2
+
3
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
4
+import lombok.*;
5
+
6
+@Getter
7
+@Setter
8
+@ToString
9
+@NoArgsConstructor
10
+@AllArgsConstructor
11
+public class MsCaseAttachVO extends MsCaseAttach {
12
+
13
+    /**
14
+     * 案件状态ID
15
+     */
16
+    private Integer caseFlowId;
17
+}

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

@@ -34,7 +34,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
34 34
      * @param caseStatusNames
35 35
      * @return
36 36
      */
37
-    @Select("<script> select t.* from (select c.id,0 AS pendingStatus,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
37
+    @Select("<script> select t.* from (select c.id,c.mediation_method mediationMethod,0 AS pendingStatus,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
38 38
             "a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," +
39 39
             "c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_application c " +
40 40
             "join ms_case_affiliate a on c.id=a.case_appli_id <where> " +
@@ -61,7 +61,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
61 61
             "<if test=\"req.endTime != null and req.endTime != ''\">" +
62 62
             "and c.create_time &lt;= #{req.endTime}</if>" +
63 63
             "        </where> " +
64
-            "union  select c.id id,1 AS pendingStatus,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
64
+            "union  select c.id id,c.mediation_method mediationMethod,1 AS pendingStatus,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
65 65
             "a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," +
66 66
             "c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_log_record r " +
67 67
             "join ms_case_application c on r.case_appli_id=c.id and r.case_status_name!=c.case_status_name " +

+ 24
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java Просмотреть файл

@@ -4,9 +4,11 @@ import com.ruoyi.common.core.domain.AjaxResult;
4 4
 import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
5 5
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
6 6
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
7
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
7 8
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.BookingVO;
8 9
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq;
9 10
 import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
11
+import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseAttachVO;
10 12
 import org.springframework.web.multipart.MultipartFile;
11 13
 
12 14
 import java.util.List;
@@ -140,4 +142,26 @@ public interface MsCaseApplicationService {
140 142
      */
141 143
     AjaxResult selectReservation(Long id);
142 144
 
145
+    /**
146
+     * 调解
147
+     * @param req
148
+     * @return
149
+     */
150
+    AjaxResult mediation(MsCaseApplicationReq req);
151
+
152
+    /**
153
+     * 修改庭审笔录
154
+     * @param attach
155
+     * @return
156
+     */
157
+
158
+    AjaxResult updateTrialPen(MsCaseAttach attach);
159
+
160
+    /**
161
+     * 确认调解书
162
+     * @param attach
163
+     * @return
164
+     */
165
+
166
+    AjaxResult confirmMediation(MsCaseAttachVO attach);
143 167
 }

+ 158
- 30
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java Просмотреть файл

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
4 4
 import cn.hutool.core.collection.CollectionUtil;
5 5
 import cn.hutool.core.util.StrUtil;
6 6
 import com.ruoyi.common.config.RuoYiConfig;
7
+import com.ruoyi.common.constant.Constants;
7 8
 import com.ruoyi.common.core.domain.AjaxResult;
8 9
 import com.ruoyi.common.core.domain.entity.SysDept;
9 10
 import com.ruoyi.common.core.domain.entity.SysDictData;
@@ -481,37 +482,40 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
481 482
      * @param req
482 483
      * @return
483 484
      */
485
+    @Transactional
484 486
     @Override
485 487
     public AjaxResult generateApplication(MsCaseApplicationReq req) {
486 488
         // 根据模板id查询申请书
487 489
         TemplateManage templateManage=templateManageMapper.selectById(req.getTemplateId());
488 490
         if(templateManage==null||StrUtil.isEmpty(templateManage.getTemOrigPath())){
489
-            return AjaxResult.error("未找到调解申请书模板");
491
+            throw new ServiceException("未找到模板");
490 492
         }
491
-        String templatePath = templateManage.getTemOrigPath();
493
+        String templatePath = "/home/ruoyi/" + templateManage.getTemOrigPath();
494
+        templatePath=templatePath.replace("/profile","/uploadPath");
495
+
492 496
         try {
493 497
             File file = new File(templatePath);
494 498
         } catch (Exception e) {
495
-            return AjaxResult.error("未找到调解申请书模板");
499
+            throw new ServiceException("未找到模板");
496 500
         }
497 501
 
498 502
         // 获取模板中的占位符key
499 503
         List<String> bookmarkList = getBookmarkByDocx(templatePath);
500 504
         if (CollectionUtil.isEmpty(bookmarkList)) {
501
-            return AjaxResult.success("请检查模板是否配置正确,未获取到占位符");
505
+            throw new ServiceException("请检查模板是否配置正确,未获取到占位符");
502 506
         }
503 507
         // 在系统表中查询案件内置字段
504 508
         SysDictData sysDictData = new SysDictData();
505 509
         sysDictData.setDictType("case_built_type");
506 510
         List<SysDictData> dictDataList = dictDataMapper.selectDictDataList(sysDictData);
507 511
         if(CollectionUtil.isEmpty(dictDataList)){
508
-            return AjaxResult.error("未找到系统内置字段");
512
+            throw new ServiceException("未找到系统内置字段");
509 513
         }
510 514
         // 如果批号不为空,则为批量操作,根据批号查询未锁定的案件
511 515
         if(StrUtil.isNotEmpty(req.getBatchNumber())){
512 516
             List<MsCaseApplication> caseApplicationList=listByBatchNumber(req.getBatchNumber(),req.getCaseFlowId());
513 517
             if(CollectionUtil.isEmpty(caseApplicationList)){
514
-                return AjaxResult.error("该批次号下未找到案件");
518
+                throw new ServiceException("该批次号下未找到案件");
515 519
             }
516 520
             // 案件ids
517 521
             List<Long> caseIds = caseApplicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList());
@@ -520,20 +524,19 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
520 524
             afflicateExample.createCriteria().andIn("case_appli_id", caseIds);
521 525
             List<MsCaseAffiliate> affiliateList = msCaseAffiliateMapper.selectByExample(caseIds);
522 526
             if(CollectionUtil.isEmpty(affiliateList)){
523
-                return AjaxResult.error("该批次号下未找到案件关联人员");
527
+                throw new ServiceException("该批次号下未找到案件关联人员");
524 528
             }
525 529
 
526 530
             Map<Long, MsCaseAffiliate> affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity()));
527 531
 
528 532
             // 循环生成调解申请书
529 533
             for (MsCaseApplication application : caseApplicationList) {
530
-
531 534
                 // 案件相关人员
532 535
                 MsCaseAffiliate affiliate = affiliateMap.get(application.getId());
533 536
                 if(affiliate==null){
534 537
                     continue;
535 538
                 }
536
-                createMediateApplication(application, affiliate, templatePath, bookmarkList,dictDataList);
539
+                createMediateApplication(application, affiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType());
537 540
 
538 541
             }
539 542
         }else {
@@ -543,13 +546,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
543 546
             // 查询案件关联人员
544 547
             MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId());
545 548
             if (application == null || caseAffiliate == null) {
546
-                return AjaxResult.error("该案件不存在");
549
+                throw new ServiceException("该案件不存在");
547 550
             }
548
-            createMediateApplication(application, caseAffiliate, templatePath, bookmarkList,dictDataList);
551
+
552
+            createMediateApplication(application, caseAffiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType());
549 553
         }
550 554
 
551 555
 
552
-        return AjaxResult.success("调解申请书生成成功");
556
+        return AjaxResult.success();
553 557
     }
554 558
 
555 559
     /**
@@ -738,11 +742,57 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
738 742
     @Transactional
739 743
     @Override
740 744
     public AjaxResult updateBooking(BookingVO vo) {
745
+        // 查询被申请人是否预约过(从日志表查),否则不更新流程节点
746
+        MsCaseAffiliate msCaseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(vo.getId());
747
+        if(msCaseAffiliate==null) {
748
+            return AjaxResult.error("该案件不存在");
749
+        }
741 750
         MsCaseApplication application = new MsCaseApplication();
742 751
         application.setId(vo.getId());
743 752
         setMediatorAndDate(application,vo);
744
-        msCaseApplicationMapper.updateByPrimaryKeySelective(application);
745
-        nextFlow(vo.getId(),vo.getCaseFlowId(),null);
753
+        int applicantCount = msCaseApplicationMapper.updateByPrimaryKeySelective(application);
754
+        if(applicantCount<1){
755
+            return AjaxResult.error("保存失败");
756
+        }
757
+        // 新增申请人签署日志
758
+        MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(vo.getCaseFlowId());
759
+        if(currentFlow==null){
760
+            return AjaxResult.error("当前流程不存在");
761
+        }
762
+        CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"申请人选择调解员");
763
+
764
+        if(StrUtil.isNotEmpty(msCaseAffiliate.getRespondentIdentityNum())){
765
+        // 根据身份证查询用户表
766
+            SysUser user = userMapper.selectUserByIdCard(msCaseAffiliate.getRespondentIdentityNum());
767
+            if(user!=null){
768
+                MsCaseFlow nextFlow = caseFlowMapper.nextFlow(vo.getCaseFlowId());
769
+                if(nextFlow==null){
770
+                    return AjaxResult.error("未找到下一个流程");
771
+                }
772
+                // 查询日志中是否有该节点的被申请人操作
773
+                Example example = new Example(MsCaseLogRecord.class);
774
+                Example.Criteria criteria = example.createCriteria();
775
+                criteria.andEqualTo("case_appli_id", vo.getId());
776
+                criteria.andEqualTo("case_node", nextFlow.getNodeId());
777
+                criteria.andEqualTo("case_status_name", nextFlow.getCaseStatusName());
778
+                criteria.andEqualTo("create_by", user.getUserName());
779
+                int count = caseLogRecordMapper.selectCountByExample(example);
780
+                if(count>0){
781
+                    // 被申请人已预约,更新流程节点
782
+                    // 更改案件流程id和案件状态
783
+                    application.setCaseFlowId(nextFlow.getId());
784
+                    application.setCaseStatusName(nextFlow.getCaseStatusName());
785
+                    application.setLockStatus(null);
786
+                    msCaseApplicationMapper.updateByPrimaryKeySelective(application);
787
+                }
788
+//                else {
789
+//                    return AjaxResult.error("被申请人未选择调解员");
790
+//                }
791
+            }
792
+//            else {
793
+//                return AjaxResult.error("被申请人未选择调解员");
794
+//            }
795
+       }
746 796
         return AjaxResult.success();
747 797
     }
748 798
 
@@ -853,6 +903,79 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
853 903
         return AjaxResult.success(result);
854 904
     }
855 905
 
906
+    /**
907
+     * 调解
908
+     * @param req
909
+     * @return
910
+     */
911
+    @Transactional
912
+    @Override
913
+    public AjaxResult mediation(MsCaseApplicationReq req) {
914
+        String templateId=null;
915
+        // 批量
916
+        if(StrUtil.isNotEmpty(req.getBatchNumber())){
917
+            // 查询调解书模板是否存在
918
+            Example example = new Example(MsCaseFlow.class);
919
+            Example.Criteria criteria = example.createCriteria();
920
+            criteria.andEqualTo("batch_number", req.getBatchNumber());
921
+            criteria.andIsNotNull("template_id");
922
+            MsCaseApplication caseApplication = msCaseApplicationMapper.selectOneByExample(example);
923
+            if(caseApplication==null||caseApplication.getTemplateId()==null){
924
+                return AjaxResult.error("未找到模板");
925
+            }
926
+            templateId= String.valueOf(caseApplication.getTemplateId());
927
+
928
+        }else {
929
+            // 单独生成
930
+            // 查询调解书模板是否存在
931
+            MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId());
932
+            if(application==null||application.getTemplateId()==null){
933
+                return AjaxResult.error("未找到模板");
934
+            }
935
+            templateId= String.valueOf(application.getTemplateId());
936
+        }
937
+        req.setTemplateId(templateId);
938
+        req.setTemplateType(1);
939
+        AjaxResult result = generateApplication(req);
940
+        if(result!=null && result.isSuccess()){
941
+            return result;
942
+        }
943
+        return AjaxResult.error("生成失败");
944
+    }
945
+
946
+    /**
947
+     * 修改庭审笔录
948
+     * @param attach
949
+     * @return
950
+     */
951
+    @Transactional
952
+    @Override
953
+    public AjaxResult updateTrialPen(MsCaseAttach attach) {
954
+        // 删除之前的庭审笔录
955
+        msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(attach.getCaseAppliId(), AnnexTypeEnum.MEDIATE.getCode());
956
+        // 更新庭审笔录
957
+        msCaseAttachMapper.updateCaseAttach(attach);
958
+        return AjaxResult.success();
959
+    }
960
+
961
+    /**
962
+     * 确认调解书
963
+     * @param attach
964
+     * @return
965
+     */
966
+    @Transactional
967
+
968
+    @Override
969
+    public AjaxResult confirmMediation(MsCaseAttachVO attach) {
970
+        if(attach.getAnnexId()!=null){
971
+            // 删除之前的调解书
972
+            msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(attach.getCaseAppliId(),AnnexTypeEnum.MEDIATE_BOOK.getCode());
973
+            msCaseAttachMapper.updateCaseAttach(attach);
974
+        }
975
+        // 更新流程节点
976
+        nextFlow(attach.getCaseAppliId(),attach.getCaseFlowId(),YesOrNoEnum.YES.getCode());
977
+        return AjaxResult.success();
978
+    }
856 979
 
857 980
 
858 981
     /**
@@ -956,7 +1079,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
956 1079
      * @param bookmarkList 标签
957 1080
      * @param dictDataList 内置字段
958 1081
      */
959
-    private void createMediateApplication(MsCaseApplication application, MsCaseAffiliate affiliate, String templatePath, List<String> bookmarkList, List<SysDictData> dictDataList) {
1082
+    private void createMediateApplication(MsCaseApplication application, MsCaseAffiliate affiliate, String templatePath, List<String> bookmarkList, List<SysDictData> dictDataList,Integer templateType) {
960 1083
         // 申请书需要的字段和内容,valueMap<占位符,替换的值>
961 1084
         Map<String, String> valueMap = new HashMap<>();
962 1085
         for (SysDictData dictData : dictDataList) {
@@ -973,8 +1096,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
973 1096
         // 读取调节申请书,找到占位符,替换值
974 1097
         // 遍历书签,给书签赋值
975 1098
         replaceBookmark(bookmarkList, bookmarkValueMap, valueMap);
976
-        // 根据条件替换书签
977
-//                conditionReplaceBookmark(caseApplicationById, bookmarkValueMap, agentName, resName, arbitrateRecordSelect);
978 1099
         // 申请书生成时间
979 1100
         LocalDate now = LocalDate.now();
980 1101
         int year = now.getYear();
@@ -986,29 +1107,34 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
986 1107
         String month = String.format("%02d", now.getMonthValue());
987 1108
         String day = String.format("%02d", now.getDayOfMonth());
988 1109
         // todo
989
-        String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
990
-//            String saveFolderPath = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
991
-        String orgFileName="调解申请书";
1110
+        String saveFolderPath = RuoYiConfig.getUploadPath()+"/"+ year + "/" + month + "/" + day;
1111
+        Integer annexType = AnnexTypeEnum.MEDIATION_APPLICATION.getCode();
1112
+        String orgFileName = "调解申请书";
1113
+        if(templateType!=null&&templateType==1) {
1114
+            orgFileName = "调解书";
1115
+            annexType=AnnexTypeEnum.MEDIATE_BOOK.getCode();
1116
+        }
992 1117
         String fileName = UUID.randomUUID().toString().replace("-", "")+orgFileName + ".docx";
993
-        // todo
994
-        String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
995
-//            String saveName = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day + "/" + fileName;
996 1118
         String resultFilePath = saveFolderPath + "/" + fileName;
997 1119
         // 将word中的标签替换掉,生成新的word
998 1120
         wordChangeText(templatePath, bookmarkValueMap,saveFolderPath,resultFilePath);
999 1121
 
1000
-        //      String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
1001
-        // 保存裁决书附件
1002
-        //      saveArbitorFile(id, saveName, savePath, caseApplicationById, arbitrateRecordSelect);
1003 1122
         MsCaseAttach caseAttach = MsCaseAttach.builder()
1004 1123
                 .caseAppliId(application.getId())
1005 1124
                 .annexName(orgFileName)
1006
-                .annexPath(resultFilePath)
1007
-                .annexType(AnnexTypeEnum.MEDIATION_APPLICATION.getCode())
1125
+                .annexPath(resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX))
1126
+                .annexType(annexType)
1008 1127
                 .build();
1009 1128
         //保存到附件表里,先删除之前的在保存
1010
-        msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), 3);
1129
+        msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), AnnexTypeEnum.MEDIATION_APPLICATION.getCode());
1130
+        if (templateType!=null&&templateType==1) {
1131
+            msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
1132
+        }
1011 1133
         msCaseAttachMapper.save(caseAttach);
1134
+        // 生成调解书成功,需要更新流程节点
1135
+        if (templateType!=null&&templateType==1) {
1136
+            nextFlow(application.getId(), application.getCaseFlowId(), application.getLockStatus());
1137
+        }
1012 1138
     }
1013 1139
 
1014 1140
     /**
@@ -1041,7 +1167,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1041 1167
                 WordUtil.changeText(xwpfDocument);
1042 1168
             }
1043 1169
         } catch (IOException e) {
1044
-            throw new RuntimeException("请检查文件路径是否有误");
1170
+
1171
+            throw new RuntimeException("modalFilePath:"+modalFilePath+"==saveFolderPath:"
1172
+                    +saveFolderPath+"==resultFilePath:"+resultFilePath+"==sourcePath:"+sourcePath+"==destinationPath:"+destinationPath);
1045 1173
         }
1046 1174
     }
1047 1175
     /**

+ 30
- 4
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java Просмотреть файл

@@ -31,6 +31,9 @@ import com.tencentcloudapi.trtc.v20190722.TrtcClient;
31 31
 import com.tencentcloudapi.trtc.v20190722.models.*;
32 32
 import com.tencentyun.TLSSigAPIv2;
33 33
 import lombok.extern.slf4j.Slf4j;
34
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
35
+import org.apache.poi.xwpf.usermodel.XWPFParagraph;
36
+import org.apache.poi.xwpf.usermodel.XWPFRun;
34 37
 import org.springframework.beans.factory.annotation.Autowired;
35 38
 import org.springframework.beans.factory.annotation.Value;
36 39
 import org.springframework.stereotype.Service;
@@ -39,6 +42,8 @@ import tk.mybatis.mapper.entity.Example;
39 42
 
40 43
 import javax.crypto.Mac;
41 44
 import javax.crypto.spec.SecretKeySpec;
45
+import java.io.File;
46
+import java.io.FileOutputStream;
42 47
 import java.io.IOException;
43 48
 import java.nio.file.Paths;
44 49
 import java.util.Base64;
@@ -175,6 +180,10 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
175 180
         long roomId = generateRoomId();
176 181
         // 绑定案件与房间号
177 182
         bindCaseId(caseId, String.valueOf(roomId));
183
+        // 新增预约会议表
184
+        ReservedConference conference = new ReservedConference(caseId, SecurityUtils.getUserId(), roomId,
185
+                null, null);
186
+        reservedConferenceMapper.insert(conference);
178 187
         return String.valueOf(roomId);
179 188
     }
180 189
 
@@ -187,7 +196,7 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
187 196
         // 查询最大房间号
188 197
         Long maxRoomId = caseApplicationMapper.selectMaxRoomId();
189 198
 
190
-        if (null == maxRoomId || maxRoomId > 4294967294L/2) {
199
+        if (null == maxRoomId || maxRoomId > 4294967294L) {
191 200
             return 4294967294L/2+1;
192 201
         } else {
193 202
             return maxRoomId + 1;
@@ -376,6 +385,7 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
376 385
      * @param reservedConferenceVO
377 386
      * @return
378 387
      */
388
+    @Transactional
379 389
     @Override
380 390
     public AjaxResult htmlToPDF(MsReservedConferenceVO reservedConferenceVO) {
381 391
         String currentFileName = System.currentTimeMillis() + ".pdf";
@@ -391,10 +401,12 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
391 401
 
392 402
         // 绑定案件
393 403
         if(convertFlag){
404
+            // 删除之前的庭审笔录
405
+            caseAttachMapper.deleteCaseAttachByCasedIdAndType(reservedConferenceVO.getCaseId(),AnnexTypeEnum.MEDIATE.getCode());
394 406
             MsCaseAttach caseAttach = MsCaseAttach.builder().caseAppliId(reservedConferenceVO.getCaseId())
395
-                    .annexName(fileName)
396
-                    .annexPath(RuoYiConfig.getHtml2PDFPath())
397
-                    .annexType(7)
407
+                    .annexName(currentFileName)
408
+                    .annexPath(fileName)
409
+                    .annexType(AnnexTypeEnum.MEDIATE.getCode())
398 410
                     .build();
399 411
             caseAttachMapper.save(caseAttach);
400 412
             return AjaxResult.success();
@@ -403,8 +415,22 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
403 415
         }
404 416
     }
405 417
 
418
+    public static void main(String[] args) throws Exception{
419
+        String htmlContent = "<h1>wangwu</h1><p>喂喂喂</p><h1>zhangsan</h1><p>hello</p><h1>zhangsan</h1><p>我能听到你说话</p><h1>wangwu</h1><p>欧克</p><h1>wangwu</h1><p>关于XXX我有几点想说的,balalalalalal</p><h1>zhangsan</h1><p>看到回复的时刻双方都是华德福额外补充你下次u饿哦是那些二的河南省而很为难啊看的法国队哈哈哈哈哈哈哈哈哈</p> "; // HTML字符串
420
+        String outputFileName="D://output.docx";
421
+        XWPFDocument document = new XWPFDocument();
422
+        XWPFParagraph paragraph = document.createParagraph();
423
+        XWPFRun run = paragraph.createRun();
424
+        run.setText(htmlContent);
425
+        FileOutputStream out = new FileOutputStream(new File(outputFileName));
426
+        document.write(out);
427
+        out.close();
428
+        System.out.printf("生成调解笔录成功");
406 429
 
407 430
 
431
+
432
+    }
433
+
408 434
     /**
409 435
      * 将视频下载到本地
410 436
      * @param fileUrl 视频路径

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

@@ -10,6 +10,7 @@ import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseLogRecordMapper;
10 10
 
11 11
 import javax.validation.constraints.NotEmpty;
12 12
 import javax.validation.constraints.NotNull;
13
+import java.util.Date;
13 14
 
14 15
 /**
15 16
  * 案件记录日志文件
@@ -45,6 +46,7 @@ public class CaseLogUtils
45 46
         operLog.setCaseAppliId(caseAppliId);
46 47
         operLog.setCaseNode(caseNode);
47 48
         operLog.setNotes(notes);
49
+        operLog.setCreateTime(new Date());
48 50
         caseLogRecordMapper.insert(operLog);
49 51
     }
50 52
 }