|
|
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
5
|
5
|
import cn.hutool.core.util.StrUtil;
|
|
6
|
6
|
import cn.hutool.http.HttpRequest;
|
|
7
|
7
|
import cn.hutool.http.HttpResponse;
|
|
|
8
|
+import cn.hutool.http.HttpUtil;
|
|
8
|
9
|
import cn.hutool.json.JSONUtil;
|
|
9
|
10
|
import com.alibaba.fastjson.JSONArray;
|
|
10
|
11
|
import com.alibaba.fastjson.JSONObject;
|
|
|
@@ -47,7 +48,6 @@ import com.ruoyi.wisdomarbitrate.mapper.template.FatchRuleMapper;
|
|
47
|
48
|
import com.ruoyi.wisdomarbitrate.mapper.template.TemplateManageMapper;
|
|
48
|
49
|
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
|
|
49
|
50
|
import com.ruoyi.wisdomarbitrate.utils.*;
|
|
50
|
|
-
|
|
51
|
51
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
52
|
52
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
|
53
|
53
|
import org.springframework.beans.BeanUtils;
|
|
|
@@ -92,6 +92,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
92
|
92
|
|
|
93
|
93
|
@Value("${arbitrateConfig.url}")
|
|
94
|
94
|
private String arbitrateUrl;
|
|
|
95
|
+ @Value("${onlyOfficeConfig.url}")
|
|
|
96
|
+ private String onlyOfficeUrl;
|
|
95
|
97
|
@Autowired
|
|
96
|
98
|
MsCaseApplicationService caseApplicationService;
|
|
97
|
99
|
@Autowired
|
|
|
@@ -1548,7 +1550,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1548
|
1550
|
.annexType(annexType)
|
|
1549
|
1551
|
.useId(SecurityUtils.getUserId())
|
|
1550
|
1552
|
.useAccount(SecurityUtils.getUsername())
|
|
1551
|
|
- .isBatchUpload(1L)
|
|
1552
|
1553
|
.build();
|
|
1553
|
1554
|
int count = msCaseAttachMapper.save(caseAttach);
|
|
1554
|
1555
|
if (count > 0 ) {
|
|
|
@@ -2154,6 +2155,25 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
2154
|
2155
|
public List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord) {
|
|
2155
|
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,10 +2244,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
2224
|
2244
|
if (caseAttachList != null && caseAttachList.size() > 0) {
|
|
2225
|
2245
|
for (MsCaseAttach caseAttach : caseAttachList) {
|
|
2226
|
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
|
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
|
2253
|
EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
|
|
2233
|
2254
|
String body = response.getBody();
|
|
|
@@ -2635,10 +2656,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
2635
|
2656
|
if (caseAttachList != null && caseAttachList.size() > 0) {
|
|
2636
|
2657
|
for (MsCaseAttach caseAttach : caseAttachList) {
|
|
2637
|
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
|
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
|
2665
|
EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
|
|
2644
|
2666
|
String body = response.getBody();
|
|
|
@@ -3729,15 +3751,62 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
3729
|
3751
|
// 将word中的标签替换掉,生成新的word
|
|
3730
|
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
|
/**
|