From ee5def33a4bba11c6a421c838b360579e6d5f232 Mon Sep 17 00:00:00 2001 From: gaojiabao Date: Wed, 21 Jun 2023 10:42:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/application-dev.properties | 6 +- .../impl/SarBussionessStandServiceImpl.java | 11 +- .../adc/da/utils/util/OnlyofficePdfUtil.java | 142 ++---------------- 3 files changed, 31 insertions(+), 128 deletions(-) diff --git a/adc-da-main/src/main/resources/application-dev.properties b/adc-da-main/src/main/resources/application-dev.properties index 2490f6e5..475a573d 100644 --- a/adc-da-main/src/main/resources/application-dev.properties +++ b/adc-da-main/src/main/resources/application-dev.properties @@ -72,4 +72,8 @@ OCR.ocrPath=/data/slrs/ocrResultFile/ # OCR文件请求下载或在线预览时URL OCR.ocrDownPath=/data/slrs/ocrResultFile/ OCR.times=20 -OCR.convertType=BOTH \ No newline at end of file +OCR.convertType=BOTH + +# 在线编辑的调用 +onlyoffice.url=http://47.92.92.38:8103/7.2.1-34/ConvertService.ashx +#onlyoffice.url=http://10.100.5.116:8088/7.2.1-34/ConvertService.ashx \ No newline at end of file diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java index 0a27713a..b471436a 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java @@ -112,6 +112,9 @@ public class SarBussionessStandServiceImpl extends ServiceImpl map = new HashMap<>(); - map.put("async",false); - map.put("filetype","docx"); - map.put("key",key); - map.put("outputtype","pdf"); - - map.put("title","test.pdf"); - map.put("url","https://srms.foton.com.cn/file/"+onlineFilePath); + map.put("title",titleName+".pdf"); + map.put("url","https://10.100.5.111:3306/file/"+onlineFilePath); //map.put("url","https://srms.foton.com.cn/file/model/task_768330d8/task_768330d8_top_768330d8_node.docx"); - JSONObject requestJson = new JSONObject(map); - // 创建HttpClientBuilder - HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); - // HttpClient - CloseableHttpClient closeableHttpClient = httpClientBuilder.build(); - HttpPost httpPost = new HttpPost(url); - // 设置请求和传输超时时间 - RequestConfig requestConfig = RequestConfig.custom() - .setSocketTimeout(60000) - .setConnectionRequestTimeout(60000) - .setConnectTimeout(60000) - .build(); - httpPost.setConfig(requestConfig); - CloseableHttpResponse response = null; - try { - //设置post请求方式为JSON - StringEntity data = new StringEntity(String.valueOf(requestJson), "UTF-8"); - data.setContentType("application/json; charset=UTF-8"); - httpPost.setEntity(data); - - - //发送post请求 - response = closeableHttpClient.execute(httpPost); - if (response == null || response.getStatusLine() == null) { - throw new Exception("发送POST请求失败,返回结果为空!"); - } - - - //返回状态是否200 - int statusCode = response.getStatusLine().getStatusCode(); - if (statusCode == HttpStatus.SC_OK) { - //得到请求结果 - + logger.info("===========================================返回状态是否200==============================="); HttpEntity entityRes = response.getEntity(); - if (entityRes != null) { - String responsetData = EntityUtils.toString(entityRes, "UTF-8"); - String fileUrl = analysisXML(responsetData); - + logger.info("===========================================返回的文件路径"+fileUrl+"==============================="); return fileUrl; - } - } else { - throw new Exception("发送POST-JSON请求出错:" + response); - } - } catch (Exception e) { - throw new Exception("发送POST请求出现异常," + e.getMessage()); - } finally { - try { - // 关闭连接释放资源 - if (response != null) { - response.close(); - } if (closeableHttpClient != null) { - closeableHttpClient.close(); - } } catch (IOException e) { From 953c063ef577f5152429658f422d24e6759755be Mon Sep 17 00:00:00 2001 From: SUNJIABIN Date: Wed, 21 Jun 2023 10:51:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B9=B1=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/adc/da/att/controller/AttFileEOController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adc-da-sys/src/main/java/com/adc/da/att/controller/AttFileEOController.java b/adc-da-sys/src/main/java/com/adc/da/att/controller/AttFileEOController.java index e484785b..c608dc04 100644 --- a/adc-da-sys/src/main/java/com/adc/da/att/controller/AttFileEOController.java +++ b/adc-da-sys/src/main/java/com/adc/da/att/controller/AttFileEOController.java @@ -348,7 +348,6 @@ public class AttFileEOController { String fileOldName = fileNameEncoding(attFileEO.getOldFileName(),request); response.setHeader("Content-Disposition", "attachment;filename=\""+fileOldName+"\""); response.setContentType("application/octet-stream"); - response.setCharacterEncoding("UTF-8"); File file = new File(filePath+attFileEO.getFilePath()+attFileEO.getFileName()); is = new FileInputStream(file); os = response.getOutputStream(); @@ -497,7 +496,8 @@ public class AttFileEOController { + base64Encoder.encode(fileName.getBytes("utf-8")) + "?=";*/ fileName = new String(fileName.getBytes("UTF-8"), "ISO8859-1"); // firefox浏览器 } else { - fileName = URLEncoder.encode(fileName, "utf-8"); + //fileName = URLEncoder.encode(fileName, "utf-8"); + fileName = new String(fileName.getBytes("UTF-8"), "ISO8859-1"); //谷歌中空格变为+问题 fileName = fileName.replaceAll("\\+","%20"); } From d5ca38a671f222d7a940338c6399ae3a93669bf5 Mon Sep 17 00:00:00 2001 From: gaojiabao Date: Wed, 21 Jun 2023 10:58:14 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SarBussionessStandServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java index b471436a..0e7452ff 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java @@ -4938,7 +4938,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl