Quellcode durchsuchen

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

wangqiong123 vor 2 Jahren
Ursprung
Commit
b4e54bd501

+ 13
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java Datei anzeigen

412
         List<SmsSendRecord> list = caseApplicationService.getSmsSendRecord(smsSendRecord);
412
         List<SmsSendRecord> list = caseApplicationService.getSmsSendRecord(smsSendRecord);
413
         return getDataTable(list);
413
         return getDataTable(list);
414
     }
414
     }
415
+    /**
416
+     * 保存onlyOffice在线编辑的文件
417
+     * @param
418
+     * @return
419
+     */
420
+    @GetMapping("/saveOnlyOfficeFile")
421
+    public AjaxResult saveOnlyOfficeFile(  @RequestBody MsCaseAttach caseAttach) {
422
+        if(caseAttach.getCaseAppliId()==null||StrUtil.isEmpty(caseAttach.getOnlyOfficeFileId())||StrUtil.isEmpty(caseAttach.getAnnexPath())){
423
+            return error("参数校验失败");
424
+        }
425
+
426
+        return  caseApplicationService.saveOnlyOfficeFile(caseAttach);
427
+    }
415
 }
428
 }

+ 5
- 1
ruoyi-admin/src/main/resources/application.yml Datei anzeigen

18
 # 开发环境配置
18
 # 开发环境配置
19
 server:
19
 server:
20
   # 测试环境6001,开发环境7001
20
   # 测试环境6001,开发环境7001
21
-  port: 7001
21
+  port: 6001
22
   servlet:
22
   servlet:
23
     # 应用的访问路径
23
     # 应用的访问路径
24
     context-path: /
24
     context-path: /
194
 # 回调通知
194
 # 回调通知
195
 signSealCallbackConfig:
195
 signSealCallbackConfig:
196
   url: http://121.40.189.20:6001/mssignSeal/signSeaalCaseApplicaCallback
196
   url: http://121.40.189.20:6001/mssignSeal/signSeaalCaseApplicaCallback
197
+#  onlyOffice系统url配置
198
+onlyOfficeConfig:
199
+#  url: http://172.16.0.254:9090/files/upload
200
+  url: http://121.40.189.20:9090/files/upload
197
 #jodconverter:
201
 #jodconverter:
198
 #  local:
202
 #  local:
199
 #    host: 121.40.189.20
203
 #    host: 121.40.189.20

+ 3
- 3
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAttach.java Datei anzeigen

73
     private Long sealStatus;
73
     private Long sealStatus;
74
 
74
 
75
     /**
75
     /**
76
-     * 是否是证据上传,0-否,1-是
76
+     * onlyOffice附件id
77
      */
77
      */
78
-    @Column(name = "is_batch_upload")
79
-    private Long isBatchUpload;
78
+    @Column(name = "only_office_file_id")
79
+    private String onlyOfficeFileId;
80
 }
80
 }

+ 12
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java Datei anzeigen

1
 package com.ruoyi.wisdomarbitrate.service.mscase;
1
 package com.ruoyi.wisdomarbitrate.service.mscase;
2
 
2
 
3
+import com.alibaba.fastjson.JSONArray;
3
 import com.ruoyi.common.core.domain.AjaxResult;
4
 import com.ruoyi.common.core.domain.AjaxResult;
4
 import com.ruoyi.common.core.domain.entity.SysDictData;
5
 import com.ruoyi.common.core.domain.entity.SysDictData;
5
 import com.ruoyi.common.core.domain.entity.SysUser;
6
 import com.ruoyi.common.core.domain.entity.SysUser;
219
      * @param dictDataList 内置字段
220
      * @param dictDataList 内置字段
220
      */
221
      */
221
      void createMediateApplication(MsCaseApplication application, MsCaseAffiliate affiliate, String templatePath, List<String> bookmarkList, List<SysDictData> dictDataList, Integer templateType) ;
222
      void createMediateApplication(MsCaseApplication application, MsCaseAffiliate affiliate, String templatePath, List<String> bookmarkList, List<SysDictData> dictDataList, Integer templateType) ;
223
+    /**
224
+     * 调解书上传到onlyoffice服务器
225
+     * @param annexPath
226
+     */
227
+     JSONArray uploadOnlyOffice(String annexPath);
222
     /**
228
     /**
223
      * 案件受理
229
      * 案件受理
224
      * @param application
230
      * @param application
255
      * @return
261
      * @return
256
      */
262
      */
257
     List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord);
263
     List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord);
264
+    /**
265
+     * 保存onlyOffice在线编辑的文件
266
+     * @param
267
+     * @return
268
+     */
258
 
269
 
259
-
270
+    AjaxResult saveOnlyOfficeFile(MsCaseAttach caseAttach);
260
 }
271
 }

+ 85
- 16
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java Datei anzeigen

5
 import cn.hutool.core.util.StrUtil;
5
 import cn.hutool.core.util.StrUtil;
6
 import cn.hutool.http.HttpRequest;
6
 import cn.hutool.http.HttpRequest;
7
 import cn.hutool.http.HttpResponse;
7
 import cn.hutool.http.HttpResponse;
8
+import cn.hutool.http.HttpUtil;
8
 import cn.hutool.json.JSONUtil;
9
 import cn.hutool.json.JSONUtil;
9
 import com.alibaba.fastjson.JSONArray;
10
 import com.alibaba.fastjson.JSONArray;
10
 import com.alibaba.fastjson.JSONObject;
11
 import com.alibaba.fastjson.JSONObject;
47
 import com.ruoyi.wisdomarbitrate.mapper.template.TemplateManageMapper;
48
 import com.ruoyi.wisdomarbitrate.mapper.template.TemplateManageMapper;
48
 import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
49
 import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
49
 import com.ruoyi.wisdomarbitrate.utils.*;
50
 import com.ruoyi.wisdomarbitrate.utils.*;
50
-
51
 import org.apache.pdfbox.pdmodel.PDDocument;
51
 import org.apache.pdfbox.pdmodel.PDDocument;
52
 import org.apache.poi.xwpf.usermodel.XWPFDocument;
52
 import org.apache.poi.xwpf.usermodel.XWPFDocument;
53
 import org.springframework.beans.BeanUtils;
53
 import org.springframework.beans.BeanUtils;
92
 
92
 
93
     @Value("${arbitrateConfig.url}")
93
     @Value("${arbitrateConfig.url}")
94
     private String arbitrateUrl;
94
     private String arbitrateUrl;
95
+    @Value("${onlyOfficeConfig.url}")
96
+    private String onlyOfficeUrl;
95
     @Autowired
97
     @Autowired
96
     MsCaseApplicationService caseApplicationService;
98
     MsCaseApplicationService caseApplicationService;
97
     @Autowired
99
     @Autowired
1548
                         .annexType(annexType)
1550
                         .annexType(annexType)
1549
                         .useId(SecurityUtils.getUserId())
1551
                         .useId(SecurityUtils.getUserId())
1550
                         .useAccount(SecurityUtils.getUsername())
1552
                         .useAccount(SecurityUtils.getUsername())
1551
-                        .isBatchUpload(1L)
1552
                         .build();
1553
                         .build();
1553
                 int count = msCaseAttachMapper.save(caseAttach);
1554
                 int count = msCaseAttachMapper.save(caseAttach);
1554
                 if (count > 0 ) {
1555
                 if (count > 0 ) {
2154
     public List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord) {
2155
     public List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord) {
2155
         return smsRecordMapper.getSmsSendRecord(smsSendRecord);
2156
         return smsRecordMapper.getSmsSendRecord(smsSendRecord);
2156
     }
2157
     }
2158
+    /**
2159
+     * 保存onlyOffice在线编辑的文件
2160
+     * @param
2161
+     * @return
2162
+     */
2163
+    @Transactional
2164
+    @Override
2165
+    public AjaxResult saveOnlyOfficeFile(MsCaseAttach caseAttach) {
2166
+        if(StrUtil.isEmpty(caseAttach.getAnnexName())){
2167
+            caseAttach.setAnnexName("调解书");
2168
+            caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode());
2169
+            caseAttach.setUseId(getUserInfo().getUserId());
2170
+            caseAttach.setUseAccount(getUserInfo().getUserName());
2171
+            // 先删除之前的在新增
2172
+            msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), caseAttach.getAnnexType());
2173
+            msCaseAttachMapper.save(caseAttach);
2174
+        }
2175
+        return AjaxResult.success();
2176
+    }
2157
 
2177
 
2158
     /**
2178
     /**
2159
      * 查询预约信息
2179
      * 查询预约信息
2224
                         if (caseAttachList != null && caseAttachList.size() > 0) {
2244
                         if (caseAttachList != null && caseAttachList.size() > 0) {
2225
                             for (MsCaseAttach caseAttach : caseAttachList) {
2245
                             for (MsCaseAttach caseAttach : caseAttachList) {
2226
                                 if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
2246
                                 if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
2227
-                                    String prefix = "/profile";
2228
-                                    int startIndex = prefix.length();
2247
+                                  //  String prefix = "/profile";
2248
+                                  //  int startIndex = prefix.length();
2229
                                     String annexPath = caseAttach.getAnnexPath();
2249
                                     String annexPath = caseAttach.getAnnexPath();
2230
-                                    String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
2250
+                                  //  String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
2251
+                                    String path = annexPath;
2231
                                     //获取文件上传地址
2252
                                     //获取文件上传地址
2232
                                     EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
2253
                                     EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
2233
                                     String body = response.getBody();
2254
                                     String body = response.getBody();
2635
                         if (caseAttachList != null && caseAttachList.size() > 0) {
2656
                         if (caseAttachList != null && caseAttachList.size() > 0) {
2636
                             for (MsCaseAttach caseAttach : caseAttachList) {
2657
                             for (MsCaseAttach caseAttach : caseAttachList) {
2637
                                 if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
2658
                                 if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
2638
-                                    String prefix = "/profile";
2639
-                                    int startIndex = prefix.length();
2659
+                                   // String prefix = "/profile";
2660
+                                  //  int startIndex = prefix.length();
2640
                                     String annexPath = caseAttach.getAnnexPath();
2661
                                     String annexPath = caseAttach.getAnnexPath();
2641
-                                    String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
2662
+//                                    String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
2663
+                                    String path = annexPath;
2642
                                     //获取文件上传地址
2664
                                     //获取文件上传地址
2643
                                     EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
2665
                                     EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
2644
                                     String body = response.getBody();
2666
                                     String body = response.getBody();
3729
         // 将word中的标签替换掉,生成新的word
3751
         // 将word中的标签替换掉,生成新的word
3730
         wordChangeText(templatePath, bookmarkValueMap,saveFolderPath,resultFilePath);
3752
         wordChangeText(templatePath, bookmarkValueMap,saveFolderPath,resultFilePath);
3731
 
3753
 
3732
-        MsCaseAttach caseAttach = MsCaseAttach.builder()
3733
-                .caseAppliId(application.getId())
3734
-                .annexName(orgFileName+".docx")
3735
-                .annexPath(resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX))
3736
-                .annexType(annexType)
3737
-                .build();
3754
+        MsCaseAttach caseAttach = null;
3755
+       String annexPath=resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX);
3756
+       // 如果是调解书或者调解协议上传到onlyoffice服务器
3757
+        if(annexType != null   && annexType.equals(AnnexTypeEnum.MEDIATE_BOOK.getCode())){
3758
+            JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(annexPath);
3759
+            if(jsonArray!=null && jsonArray.size() > 0){
3760
+                    for (Object obj : jsonArray) {
3761
+                        JSONObject jsonObject = (JSONObject) obj;
3762
+                        caseAttach=    MsCaseAttach.builder()
3763
+                                .caseAppliId(application.getId())
3764
+                                .annexName(jsonObject.getString("fileName"))
3765
+                                .annexPath(jsonObject.getString("filePath"))
3766
+                                .annexType(annexType)
3767
+                                .onlyOfficeFileId(jsonObject.getString("fileId"))
3768
+                                .build();
3769
+
3770
+                }
3771
+            }
3772
+
3773
+        }
3738
         //保存到附件表里,先删除之前的在保存
3774
         //保存到附件表里,先删除之前的在保存
3739
-        msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType);
3740
-        msCaseAttachMapper.save(caseAttach);
3775
+        if(caseAttach != null) {
3776
+           msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType);
3777
+            msCaseAttachMapper.save(caseAttach);
3778
+        }
3779
+    }
3780
+
3781
+    /**
3782
+     * 调解书上传到onlyoffice服务器
3783
+     * @param annexPath
3784
+     */
3785
+    @Override
3786
+    @Transactional
3787
+    public JSONArray uploadOnlyOffice(String annexPath) {
3788
+        annexPath=annexPath.replace("/profile","/home/ruoyi/uploadPath");
3789
+        File file = new File(annexPath);
3790
+        if (file.exists()) {
3791
+           // 调用onlyoffice
3792
+//            String url = "http://121.40.189.20:9090/files/upload";
3793
+            try {
3794
+                Map<String, Object> params = new HashMap<>();
3795
+                params.put("file", file);
3796
+                String postResult = HttpUtil.post(onlyOfficeUrl, params);
3797
+                if(StrUtil.isNotEmpty(postResult)){
3798
+                    // 转为jsonArray
3799
+                    JSONArray jsonArray = JSONArray.parseArray(postResult);
3800
+
3801
+                    return jsonArray;
3802
+                }
3803
+            } catch (Exception e) {
3804
+                throw new ServiceException("上传OnlyOffice服务器失败");
3805
+            }
3806
+        }else {
3807
+            throw new ServiceException("文件不存在");
3808
+        }
3809
+return null;
3741
     }
3810
     }
3742
 
3811
 
3743
     /**
3812
     /**

+ 8
- 10
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/mscase/MsCaseAttachMapper.xml Datei anzeigen

13
         <result property="sealStatus"     column="seal_status"    />
13
         <result property="sealStatus"     column="seal_status"    />
14
         <result property="useId"     column="use_id"    />
14
         <result property="useId"     column="use_id"    />
15
         <result property="useAccount"     column="use_account"    />
15
         <result property="useAccount"     column="use_account"    />
16
+        <result property="onlyOfficeFileId"     column="only_office_file_id"    />
16
     </resultMap>
17
     </resultMap>
17
     <insert id="save" useGeneratedKeys="true" keyProperty="annexId">
18
     <insert id="save" useGeneratedKeys="true" keyProperty="annexId">
18
-        INSERT INTO ms_case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,is_batch_upload)
19
-        VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{useId},#{useAccount},#{sealStatus},#{isBatchUpload})
19
+        INSERT INTO ms_case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,only_office_file_id)
20
+        VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{useId},#{useAccount},#{sealStatus},#{onlyOfficeFileId})
20
     </insert>
21
     </insert>
21
     <insert id="batchSave" useGeneratedKeys="true" keyProperty="annexId">
22
     <insert id="batchSave" useGeneratedKeys="true" keyProperty="annexId">
22
-        INSERT INTO ms_case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,is_batch_upload)
23
+        INSERT INTO ms_case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,only_office_file_id)
23
         VALUES
24
         VALUES
24
         <foreach item="item" index="index" collection="list" separator=",">
25
         <foreach item="item" index="index" collection="list" separator=",">
25
 
26
 
26
 
27
 
27
-         (#{item.caseAppliId}, #{item.annexName}, #{item.annexPath},#{item.annexType},#{item.note},#{item.useId},#{item.useAccount},#{item.sealStatus},#{item.isBatchUpload})
28
+         (#{item.caseAppliId}, #{item.annexName}, #{item.annexPath},#{item.annexType},#{item.note},#{item.useId},#{item.useAccount},#{item.sealStatus},#{item.onlyOfficeFileId})
28
         </foreach>
29
         </foreach>
29
     </insert>
30
     </insert>
30
     <delete id="deleteByFileIds">
31
     <delete id="deleteByFileIds">
38
         delete from ms_case_attach
39
         delete from ms_case_attach
39
         where case_appli_id = #{caseAppliId}
40
         where case_appli_id = #{caseAppliId}
40
         and annex_type = #{annexType}
41
         and annex_type = #{annexType}
41
-        <if test="isBatchUpload != null ">
42
-            AND is_batch_upload = #{isBatchUpload}
43
-        </if>
44
     </delete>
42
     </delete>
45
 
43
 
46
     <select id="queryAnnexPathByCaseId" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult">
44
     <select id="queryAnnexPathByCaseId" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult">
47
-        select annex_id,case_appli_id,annex_name,annex_path,annex_type,note,use_id,use_account
45
+        select *
48
         from ms_case_attach
46
         from ms_case_attach
49
         where case_appli_id =#{id}
47
         where case_appli_id =#{id}
50
     </select>
48
     </select>
51
 
49
 
52
     <select id="listCaseAttachByCaseIdAndType" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult">
50
     <select id="listCaseAttachByCaseIdAndType" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult">
53
-        select annex_id,case_appli_id,annex_name,annex_path,annex_type,note,use_id,use_account
51
+        select *
54
         from ms_case_attach
52
         from ms_case_attach
55
         <where>
53
         <where>
56
             <if test="caseAppliId != null ">
54
             <if test="caseAppliId != null ">
78
     </delete>
76
     </delete>
79
 
77
 
80
     <select id="queryCaseAttachList" resultMap="CaseAttachResult">
78
     <select id="queryCaseAttachList" resultMap="CaseAttachResult">
81
-        select annex_id,case_appli_id,annex_name,annex_path,annex_type,note,use_id,use_account
79
+        select *
82
         from ms_case_attach
80
         from ms_case_attach
83
         <where>
81
         <where>
84
             <if test="id != null ">
82
             <if test="id != null ">