浏览代码

问题修改

hlf 1 年之前
父节点
当前提交
b4031ebe27

+ 6 - 3
ims-service/ims-eval/src/main/java/com/ims/eval/controller/NoticeManagementController.java

@@ -18,6 +18,8 @@ import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
 import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
@@ -265,15 +267,16 @@ public class NoticeManagementController {
 	 * @return 结果
 	 */
 	@GetMapping(value = "/filePreview")
-	public R convertToHtml(@RequestParam("url") String url) {
+	public R convertToHtml(@RequestParam("url") String url) throws UnknownHostException {
 		String os = System.getProperty("os.name");
 		String ip = "";
 		if (os.toLowerCase().startsWith("win")) {
-			ip = "192.168.2.10";
+			InetAddress localHost = InetAddress.getLocalHost();
+			ip = localHost.getHostAddress();
 		} else {
 			ip = "10.65.78.23";
 		}
-		String httpUrl = "http://" + ip + ":8098/office/" + url;
+		String httpUrl = "http://" + ip + ":8098/file/" + url;
 		return R.ok().data(httpUrl);
 	}
 }

+ 1 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/entity/custom/Path.java

@@ -40,6 +40,6 @@ public class Path {
 	 * 获取通告路径
 	 */
 	public static String getNoticePath() {
-		return getPrefix() + "/attachment/";
+		return getPrefix() + "/file/";
 	}
 }