Procházet zdrojové kódy

modify:

1. 移动端预览修改;
tags/24080901
WendyYang před 3 měsíci
rodič
revize
fd92d4abcb
5 změnil soubory, kde provedl 34 přidání a 11 odebrání
  1. +17
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/external/FilePreviewClient.java
  2. +3
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/external/controller/FilePreviewController.java
  3. +9
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProps.java
  4. +1
    -1
      hz-pm-api/src/main/resources/application-dev.yml
  5. +4
    -2
      hz-pm-api/src/main/resources/application-prod.yml

+ 17
- 6
hz-pm-api/src/main/java/com/hz/pm/api/external/FilePreviewClient.java Zobrazit soubor

@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
@@ -26,8 +27,11 @@ public class FilePreviewClient {

private static final Logger log = LoggerFactory.getLogger(FilePreviewClient.class);

@Value("${mh.file-preview.host}")
private String mhFilePreviewUrl;
@Value("${mh.file-preview.public-host:}")
private String mhFilePreviewPublicUrl;

@Value("${mh.file-preview.private-host:}")
private String mhFilePreviewPrivateUrl;

private final FileService fileService;

@@ -37,10 +41,17 @@ public class FilePreviewClient {

private static final String PREVIEW_PATH_FMT = "%s/public/risen/core/resrc/view/pdf_view.html.do?strMap.remote_url=%s&strMap.ext=%s";

public String getFilePreviewUrl(Long fileId) {
String fileDownUrl = WebProps.apiUrl + FILE_DOWN_NO_AUTH_URL + fileId;
File file = fileService.getById(fileId);
return String.format(PREVIEW_PATH_FMT, mhFilePreviewUrl, fileDownUrl, file.getSuffix());
public String getFilePreviewUrl(Long fileId, HttpServletRequest request) {
String serverName = request.getServerName();
if (serverName.contains("weixin")) {
String fileDownUrl = WebProps.zzdApiUrl + FILE_DOWN_NO_AUTH_URL + fileId;
File file = fileService.getById(fileId);
return String.format(PREVIEW_PATH_FMT, mhFilePreviewPublicUrl, fileDownUrl, file.getSuffix());
} else {
String fileDownUrl = WebProps.apiUrl + FILE_DOWN_NO_AUTH_URL + fileId;
File file = fileService.getById(fileId);
return String.format(PREVIEW_PATH_FMT, mhFilePreviewPrivateUrl, fileDownUrl, file.getSuffix());
}
}

public void downloadFile(Long fileId, HttpServletResponse response) {


+ 3
- 2
hz-pm-api/src/main/java/com/hz/pm/api/external/controller/FilePreviewController.java Zobrazit soubor

@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
@@ -29,8 +30,8 @@ public class FilePreviewController {

@ApiOperation("获取文件的预览地址")
@GetMapping("/getFilePreviewUrl/{fileId}")
public String getFilePreviewUrl(@PathVariable Long fileId) {
return filePreviewClient.getFilePreviewUrl(fileId);
public String getFilePreviewUrl(@PathVariable Long fileId, HttpServletRequest request) {
return filePreviewClient.getFilePreviewUrl(fileId, request);
}

@ApiOperation("文件下载(不鉴权)")


+ 9
- 0
hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProps.java Zobrazit soubor

@@ -20,6 +20,10 @@ public class WebProps {

public static String apiUrl;

public static String zzdApiUrl;



@Value("${web.login.url:}")
private void setLoginUrl(String url) {
loginUrl = url;
@@ -30,4 +34,9 @@ public class WebProps {
apiUrl = url;
}

@Value("${web.zzd-api.url:}")
private void setZzdApiUrl(String url) {
zzdApiUrl = url;
}

}

+ 1
- 1
hz-pm-api/src/main/resources/application-dev.yml Zobrazit soubor

@@ -189,7 +189,7 @@ mh:
detail-url: https://weixin.hzszxc.hzswb.cn:8443/test/mh-gateway/oss/ossfile/getFileInfoList
upload-url: https://weixin.hzszxc.hzswb.cn:8443/test/mh-gateway/oss/oss/uploadFileSkipLogin
file-preview:
host: http://ztzz2.hzswb.cn/yl
public-host: http://ztzz2.hzswb.cn/yl

auth-code:
secret-key: nqkmzqojg5j4eiypr3rb8s7nb4noa8b2


+ 4
- 2
hz-pm-api/src/main/resources/application-prod.yml Zobrazit soubor

@@ -182,6 +182,8 @@ web:
url: https://hzszxc.hzswb.cn:8443/project
api:
url: https://hzszxc.hzswb.cn:8443/hzpm
zzd-api:
url: https://weixin.hzszxc.hzswb.cn:8143/hzpm

mh:
sso:
@@ -199,8 +201,8 @@ mh:
purchase-notice:
open: true
file-preview:
# host: http://ztzz2.hzswb.cn/yl
host: http://172.18.43.208/yl
public-host: http://ztzz2.hzswb.cn/yl
private-host: http://172.18.43.208/yl

sms-send:
host: http://10.54.38.13:8081/mh-gateway/auth-single


Načítá se…
Zrušit
Uložit