mcs8下载选择的是http内网、外网

This commit is contained in:
guoshengxiong 2025-09-19 16:49:04 +08:00
parent 9d32aacaf5
commit f2f27114a8
2 changed files with 21 additions and 2 deletions

View File

@ -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<String, String> 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() {

View File

@ -214,10 +214,11 @@ tenant.tables[7]=wflow_models
tenant.tables[8]=wflow_notifys
tenant.tables[9]=wflow_sub_groups
tenant.tables[10]=wflow_sub_process
sada.host=http://api.e.v1.i-sada.net
# 仁智测控的扬尘上传端口
rengzhicekong.hj212.port=24041
#上传文件限制
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=