Bläddra i källkod

修改公告附件上传路径

user5 4 år sedan
förälder
incheckning
f6e536a8cb

+ 14 - 1
src/main/java/com/jeeplus/common/servlet/UserfilesDownloadServlet.java

@@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.util.FileCopyUtils;
 import org.springframework.web.util.UriUtils;
 
@@ -40,7 +41,19 @@ public class UserfilesDownloadServlet extends HttpServlet {
 		} catch (UnsupportedEncodingException e1) {
 			logger.error(String.format("解释文件路径失败,URL地址为%s", filepath), e1);
 		}
-		File file = new File(Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL + filepath);
+
+		//windows路径
+		String windowsPath = Global.getConfig("windowsPath");
+		//linux路径
+		String linuxPath = Global.getConfig("linuxPath");
+
+		String path= null;
+		if(System.getProperty("os.name").toLowerCase().contains("win")){
+			path = windowsPath;
+		}else{
+			path = linuxPath;
+		}
+		File file = new File(path + Global.USERFILES_BASE_URL + filepath);
 		try {
 			FileCopyUtils.copy(new FileInputStream(file), resp.getOutputStream());
 			resp.setHeader("Content-Type", "application/octet-stream");

+ 14 - 1
src/main/java/com/jeeplus/common/web/CKFinderConfig.java

@@ -14,6 +14,7 @@ import com.jeeplus.common.config.Global;
 import com.jeeplus.common.utils.FileUtils;
 import com.jeeplus.modules.sys.security.SystemAuthorizingRealm.Principal;
 import com.jeeplus.modules.sys.utils.UserUtils;
+import org.springframework.beans.factory.annotation.Value;
 
 /**
  * CKFinder配置
@@ -51,10 +52,22 @@ public class CKFinderConfig extends Configuration {
 //		}
 		AccessControlUtil.getInstance(this).loadACLConfig();
 		try {
+
+			//windows路径
+			String windowsPath = Global.getConfig("windowsPath");
+			//linux路径
+			String linuxPath = Global.getConfig("linuxPath");
+
+			String path= null;
+			if(System.getProperty("os.name").toLowerCase().contains("win")){
+				path = windowsPath;
+			}else{
+				path = linuxPath;
+			}
 //			Principal principal = (Principal)SecurityUtils.getSubject().getPrincipal();
 //			this.baseURL = ServletContextFactory.getServletContext().getContextPath()+"/userfiles/"+principal+"/";
 			this.baseURL = Servlets.getRequest().getContextPath() + Global.USERFILES_BASE_URL + principal + "/";
-			this.baseDir = Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL + principal + "/";
+			this.baseDir = path + Global.USERFILES_BASE_URL + principal + "/";
 		} catch (Exception e) {
 			throw new RuntimeException(e);
 		}

+ 15 - 3
src/main/java/com/jeeplus/common/web/CKFinderConnectorServlet.java

@@ -15,6 +15,7 @@ import com.jeeplus.common.config.Global;
 import com.jeeplus.common.utils.FileUtils;
 import com.jeeplus.modules.sys.security.SystemAuthorizingRealm.Principal;
 import com.jeeplus.modules.sys.utils.UserUtils;
+import org.springframework.beans.factory.annotation.Value;
 
 /**
  * CKFinderConnectorServlet
@@ -24,7 +25,7 @@ import com.jeeplus.modules.sys.utils.UserUtils;
 public class CKFinderConnectorServlet extends ConnectorServlet {
 	
 	private static final long serialVersionUID = 1L;
-	
+
 	@Override
 	protected void doGet(HttpServletRequest request,
 			HttpServletResponse response) throws ServletException, IOException {
@@ -45,6 +46,17 @@ public class CKFinderConnectorServlet extends ConnectorServlet {
 		if (principal == null){
 			return;
 		}
+		//windows路径
+		String windowsPath = Global.getConfig("windowsPath");
+		//linux路径
+		String linuxPath = Global.getConfig("linuxPath");
+
+		String path= null;
+		if(System.getProperty("os.name").toLowerCase().contains("win")){
+			path = windowsPath;
+		}else{
+			path = linuxPath;
+		}
 		String command = request.getParameter("command");
 		String type = request.getParameter("type");
 		// 初始化时,如果startupPath文件夹不存在,则自动创建startupPath文件夹
@@ -53,7 +65,7 @@ public class CKFinderConnectorServlet extends ConnectorServlet {
 			if (startupPath!=null){
 				String[] ss = startupPath.split(":");
 				if (ss.length==2){
-					String realPath = Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL
+					String realPath = path + Global.USERFILES_BASE_URL
 							+ principal + "/" + ss[0] + ss[1];
 					FileUtils.createDirectory(realPath);
 				}
@@ -62,7 +74,7 @@ public class CKFinderConnectorServlet extends ConnectorServlet {
 		// 快捷上传,自动创建当前文件夹,并上传到该路径
 		else if ("QuickUpload".equals(command) && type!=null){
 			String currentFolder = request.getParameter("currentFolder");// 当前文件夹可指定为模块名
-			String realPath = Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL
+			String realPath = path + Global.USERFILES_BASE_URL
 					+ principal + "/" + type + (currentFolder != null ? currentFolder : "");
 			FileUtils.createDirectory(realPath);
 		}

+ 5 - 0
src/main/resources/jeeplus.properties

@@ -253,3 +253,8 @@ serverDomain=http://192.168.5.74:8090/a
 #\u8BA2\u9910\u56DE\u8C03
 backUrl = http://yf.xgccpm.cn/weXin/theOrder/orderFrom
 
+#무멩windows�눈쨌쓺
+windowsPath = d:/simple/
+
+#무멩linux�눈쨌쓺
+linuxPath = /simple/

+ 2 - 2
src/main/webapp/webpage/modules/workreimbursement/workReimbursementFormAdd.jsp

@@ -120,7 +120,7 @@
                 });
 
                 var falt=0;
-                $("#workAccountList tr:visible").each(function () {
+                /*$("#workAccountList tr:visible").each(function () {
                     var v_id = $(this).attr("id");
                     if($("#"+v_id+"_invoiceType").val()=="专票"){
                         falt=1;
@@ -141,7 +141,7 @@
                 if(parseFloat($("#backmoney").val())>parseFloat($("#moneys").val())){
                     parent.layer.msg("还款金额不能大于报销金额!", {icon: 5});
                     return false;
-                }
+                }*/
                 var size = $("#reimbursementBackList tr").length;
                 for (var i = 0;i<size;i++){
                     var backmoney = $("#reimbursementBackList"+i+"_6").val();

+ 2 - 2
src/main/webapp/webpage/modules/workreimbursement/workReimbursementModifyApply.jsp

@@ -123,7 +123,7 @@
                     total= parseFloat($(this).val()) +total;
                 });
                 var falt=0;
-                $("#workAccountList tr:visible").each(function () {
+                /*$("#workAccountList tr:visible").each(function () {
                     var v_id = $(this).attr("id");
                     if($("#"+v_id+"_invoiceType").val()=="专票"){
                         falt=1;
@@ -144,7 +144,7 @@
                 if(parseFloat($("#backmoney").val())>parseFloat($("#moneys").val())){
                     parent.layer.msg("还款金额不能大于报销金额!", {icon: 5});
                     return false;
-                }
+                }*/
                 var size = $("#reimbursementBackList tr").length;
                 for (var i = 0;i<size;i++){
                     var backmoney = $("#reimbursementBackList"+i+"_6").val();