From 43ad1fc4dbf71942bb532c0142530a4efce8aeee Mon Sep 17 00:00:00 2001 From: guoshengxiong <1923636941@qq.com> Date: Fri, 19 Sep 2025 16:49:04 +0800 Subject: [PATCH] =?UTF-8?q?mcs8=E4=B8=8B=E8=BD=BD=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E7=9A=84=E6=98=AFhttp=E5=86=85=E7=BD=91=E3=80=81=E5=A4=96?= =?UTF-8?q?=E7=BD=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zhgd/xmgl/call/Mcs8Call.java | 20 ++++++++++++++++++- src/main/resources/application.properties | 6 ++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zhgd/xmgl/call/Mcs8Call.java b/src/main/java/com/zhgd/xmgl/call/Mcs8Call.java index 1b873a4af..6f0b9aad7 100644 --- a/src/main/java/com/zhgd/xmgl/call/Mcs8Call.java +++ b/src/main/java/com/zhgd/xmgl/call/Mcs8Call.java @@ -23,6 +23,7 @@ import com.zhgd.xmgl.modules.policecamera.service.IWorkTicketHistoryService; import com.zhgd.xmgl.util.PathUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Scope; @@ -50,6 +51,8 @@ public class Mcs8Call implements PoliceCameraManufacturer { @Lazy @Autowired private IWorkTicketHistoryService workTicketHistoryService; + @Value("${mcs8.download.http.type:pubUrl}") + private String downloadType; public void setConfig(ProjectPoliceCameraConfig config) { this.config = config; @@ -118,7 +121,8 @@ public class Mcs8Call implements PoliceCameraManufacturer { if (item != null) { HashMap headers = new HashMap<>(); headers.put("token", Mcs8Util.getToken(Mcs8Util.getHost(config), config.getPort(), config.getAccount(), config.getPassword())); - File downloadFile = HttpUtils.downloadFile(signedUrl.getPubUrl(), PathUtil.getBasePath(), headers); + String pubUrl = getUrl(signedUrl); + File downloadFile = HttpUtils.downloadFile(pubUrl, PathUtil.getBasePath(), headers); if (downloadFile != null) { PoliceCameraItemFile file = new PoliceCameraItemFile(); file.setItemId(item.getItemId()); @@ -145,6 +149,20 @@ public class Mcs8Call implements PoliceCameraManufacturer { } + private String getUrl(Mcs8FileSignedUrlBo bo) { + String pubUrl; + if (Objects.equals("pubUrl", downloadType)) { + pubUrl = bo.getPubUrl(); + } else if (Objects.equals("privateUrl", downloadType)) { + pubUrl = bo.getPrivateUrl(); + } else if (Objects.equals("httpPubUrl", downloadType)) { + pubUrl = bo.getHttpPubUrl(); + } else { + pubUrl = bo.getHttpPrivateUrl(); + } + return pubUrl; + } + @Override public void updateStatus() { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index b007f66a9..8249e71dc 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -220,5 +220,7 @@ sada.host=http://api.e.v1.i-sada.net rengzhicekong.hj212.port=24041 spring.main.allow-circular-references=true #上传文件限制 -file.upload.allowed-extensions=jpg,jpeg,png,gif,bmp,webp,svg,tiff,ico,pdf,doc,docx,xls,xlsx,ppt,pptx,txt,rtf,csv,mp4,avi,mov,wmv,flv,mkv,webm,m4v,3gp,mp3,wav,ogg,flac,aac,wma,m4a,zip,rar,7z,tar,gz,apk -file.upload.allowed-mime-types=image/jpeg,image/png,image/gif,image/bmp,image/webp,image/svg+xml,image/tiff,image/x-icon,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,text/plain,application/rtf,text/csv,video/mp4,video/x-msvideo,video/quicktime,video/x-ms-wmv,video/x-flv,video/x-matroska,video/webm,video/3gpp,audio/mpeg,audio/wav,audio/ogg,audio/flac,audio/aac,audio/x-ms-wma,audio/mp4,application/zip,application/x-rar-compressed,application/x-7z-compressed,application/x-tar,application/gzip,application/vnd.android.package-archive +file.upload.allowed-extensions=jpg,jpeg,png,gif,bmp,webp,svg,tiff,ico,pdf,doc,docx,xls,xlsx,ppt,pptx,txt,rtf,csv,mp4,avi,mov,wmv,flv,mkv,webm,m4v,3gp,mp3,wav,ogg,flac,aac,wma,m4a,zip,rar,7z,tar,gz +file.upload.allowed-mime-types=image/jpeg,image/png,image/gif,image/bmp,image/webp,image/svg+xml,image/tiff,image/x-icon,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,text/plain,application/rtf,text/csv,video/mp4,video/x-msvideo,video/quicktime,video/x-ms-wmv,video/x-flv,video/x-matroska,video/webm,video/3gpp,audio/mpeg,audio/wav,audio/ogg,audio/flac,audio/aac,audio/x-ms-wma,audio/mp4,application/zip,application/x-rar-compressed,application/x-7z-compressed,application/x-tar,application/gzip +#mcs8下载选择的是http内网、外网 +mcs8.download.http.type=httpPrivateUrl