Browse Source

储备项目新-拆旧清册上传需改

wangqiang 2 years atrás
parent
commit
1647ee336a

+ 23 - 1
src/main/java/com/jeeplus/modules/cg/reservemanagementcenter/reserveManage/web/ProcessController.java

@@ -3,10 +3,12 @@ package com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.web;
 import com.jeeplus.common.config.Global;
 import com.jeeplus.common.json.AjaxJson;
 import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.PropertiesLoader;
 import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.common.utils.excel.ExportExcel;
 import com.jeeplus.core.persistence.Page;
 import com.jeeplus.core.web.BaseController;
+import com.jeeplus.core.web.Servlets;
 import com.jeeplus.modules.act.entity.Act;
 import com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.entity.Demolite;
 import com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.entity.ReserveSummaryProcess;
@@ -50,6 +52,16 @@ import java.util.Map;
 @RequestMapping(value = "${adminPath}/cg/reservemanagementcenter/process")
 public class ProcessController extends BaseController {
 
+    /**
+     * 判断服务器系统类型,1是windows系统,2是linux系统
+     */
+    public static final String SYS_TYPE = System.getProperty("os.name").toLowerCase().startsWith("win") ? "1" : "2";
+
+    /**
+     * 属性文件加载对象
+     */
+    private static PropertiesLoader loader = new PropertiesLoader("/properties/jeeplus.properties");
+
     @Autowired
     private ReserveSummaryProcessService reserveProcessService;
 
@@ -173,7 +185,17 @@ public class ProcessController extends BaseController {
 //            int index = file.getAbsolutePath().indexOf("\\fileServer");
             int index = file.getAbsolutePath().indexOf("fileServer");
 //            path = path.substring(index);
-            path = path.substring(index-1);
+
+            String FILE_PREFIX = loader.getProperty("linux.file.store.prefix");
+
+            if (SYS_TYPE.equals("1")) {
+                path = path.substring(index-1);
+
+            } else {
+                //liunx file store prefix
+                path = FILE_PREFIX + Servlets.getRequest().getContextPath() + path.substring(index-1);
+                path = path.replaceAll("\\\\","/");
+            }
 
             File demoFile = new File(path);