From 4dcb2a0942b6a54109737028dc48d4ea200ef42d Mon Sep 17 00:00:00 2001 From: lzy Date: Tue, 11 Jan 2022 15:41:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=92=A4=E9=94=80=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docus/bgts/handler/TBasicWebService.java | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/docus/bgts/handler/TBasicWebService.java b/src/main/java/com/docus/bgts/handler/TBasicWebService.java index 9e483f7..e252306 100644 --- a/src/main/java/com/docus/bgts/handler/TBasicWebService.java +++ b/src/main/java/com/docus/bgts/handler/TBasicWebService.java @@ -114,6 +114,7 @@ public class TBasicWebService implements ITBasicWebService { filetitle = getElementText(element, filetitleKey.split(",")); // downurl = element.element(downurlKey).getText(); downurl = getElementText(element, downurlKey.split(",")); + downurl = handleDownUrl(downurl); reportDownScanFileDto = new ReportDownScanFileDto(); reportDownScanFileDto.setDownurl(downurl); reportDownScanFileDto.setFiletitle(filetitle); @@ -160,6 +161,48 @@ public class TBasicWebService implements ITBasicWebService { } } + /** + * 特殊处理字符 + * + * @param downurl + * @return + */ + private String handleDownUrl(String downurl) { + String url = ""; + int pdfIndex = -1; + int httpIndex = downurl.indexOf("http"); + if (httpIndex == -1) { + return downurl; + } + if (downurl.indexOf(".pdf") == -1) { + if (downurl.indexOf(".PDF") == -1) { + if (downurl.indexOf(".jpg") == -1) { + if (downurl.indexOf(".JPG") == -1) { + if (downurl.indexOf(".png") == -1) { + if (downurl.indexOf(".PNG") == -1) { + return downurl; + } else { + pdfIndex = downurl.indexOf(".PNG") + 4; + } + } else { + pdfIndex = downurl.indexOf(".png") + 4; + } + } else { + pdfIndex = downurl.indexOf(".JPG") + 4; + } + } else { + pdfIndex = downurl.indexOf(".jpg") + 4; + } + } else { + pdfIndex = downurl.indexOf(".PDF") + 4; + } + } else { + pdfIndex = downurl.indexOf(".pdf") + 4; + } + url = downurl.substring(httpIndex, pdfIndex); + return url; + } + @Override public String EmrDocumentArchive(String xml) { return pushSurveyReport(xml); @@ -232,7 +275,7 @@ public class TBasicWebService implements ITBasicWebService { if (split.length > 1) { for (String spi : split) { byElement1 = byElement.element(spi); - if (byElement1 != null) { + if (byElement1 != null && StringUtils.isNotBlank(byElement1.getText())) { break; } }