Browse Source

`转码修改`

yue 5 years atrás
parent
commit
a878b506f6

+ 5 - 4
src/main/java/com/jeeplus/common/config/Global.java

@@ -67,7 +67,7 @@ public class Global {
      */
     public static final String USERFILES_BASE_URL = "/freemarker/";
 
-    public static final String FILES_fileServer = "/fileServer/";
+    public static final String FILES_FILESERVER = "/fileServer/";
 
 
     /**
@@ -140,10 +140,11 @@ public class Global {
         SystemAuthorizingRealm.Principal principal = (SystemAuthorizingRealm.Principal) UserUtils.getPrincipal();
         String dir = "";
         if (SYS_TYPE.equals("1")) {
-            dir = Global.getUserfilesBaseDir() + Global.FILES_fileServer;
+            dir = Global.getUserfilesBaseDir() + Global.FILES_FILESERVER;
         } else {
-            dir = Global.getUserfilesBaseDir() + "data/nginx/file" + Servlets.getRequest().getContextPath() + Global.FILES_fileServer;
+            dir =  "/data/nginx/file" + Servlets.getRequest().getContextPath() + Global.FILES_FILESERVER;
         }
+
         FileUtils.createDirectory(dir);
         return dir;
     }
@@ -168,7 +169,7 @@ public class Global {
     public static String getAttachmentUrl2() {
 
         SystemAuthorizingRealm.Principal principal = (SystemAuthorizingRealm.Principal) UserUtils.getPrincipal();
-        return Servlets.getRequest().getContextPath() + Global.FILES_fileServer;
+        return Servlets.getRequest().getContextPath() + Global.FILES_FILESERVER;
     }
 
     /**

+ 3 - 3
src/main/java/com/jeeplus/core/servlet/UserUploadServlet.java

@@ -25,9 +25,9 @@ public class UserUploadServlet extends HttpServlet {
 	public void fileOutputStream(HttpServletRequest req, HttpServletResponse resp)
 			throws ServletException, IOException {
 		String filepath = req.getRequestURI();
-		int index = filepath.indexOf(Global.FILES_fileServer);
+		int index = filepath.indexOf(Global.FILES_FILESERVER);
 		if(index >= 0) {
-			filepath = filepath.substring(index + Global.FILES_fileServer.length());
+			filepath = filepath.substring(index + Global.FILES_FILESERVER.length());
 		}
 		try {
 			filepath = UriUtils.decode(filepath, "UTF-8");
@@ -35,7 +35,7 @@ public class UserUploadServlet extends HttpServlet {
 			logger.error(String.format("解释文件路径失败,URL地址为%s", filepath), e1);
 		}
 
-		File file = new File(Global.getUserfilesBaseDir() + Global.FILES_fileServer + filepath);
+		File file = new File(Global.getUserfilesBaseDir() + Global.FILES_FILESERVER + filepath);
 		//此处修改为断点续传模式,实现视频分段解析,解决视频加载缓慢及微信解析异常问题
 		try{
 			downRangeFile(file,resp,req);

+ 1 - 1
src/main/java/com/jeeplus/modules/sg/managementcenter/activiti/web/UploadController.java

@@ -105,7 +105,7 @@ public class UploadController extends BaseController {
 			List<UploadImages> list = page.getList();
 			for (UploadImages upload:
 				 list) {
-				upload.setPath("http://" + request.getServerName() + upload.getPath());
+				upload.setPath("http://" + request.getServerName() + "/data/nginx/file" +upload.getPath());
 			}
 		}
 		return getBootstrapData(page);

+ 7 - 1
src/main/java/com/jeeplus/modules/sys/web/UserController.java

@@ -5,6 +5,8 @@ package com.jeeplus.modules.sys.web;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
 import java.util.List;
 import java.util.Map;
 
@@ -84,7 +86,11 @@ public class UserController extends BaseController {
 	@RequiresPermissions("sys:user:index")
 	@RequestMapping(value = "userSelect")
 	public String userSelect(Model model, HttpServletRequest request,String roleName) {
-		String roleName1 = request.getParameter("roleName");
+		try {
+			roleName = URLDecoder.decode(roleName,"UTF-8");
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+		}
 		model.addAttribute("roleName",roleName);
 		return "modules/common/userSelect";
 	}