diff --git a/src/main/java/com/zcloud/controller/bus/RiskWarningController.java b/src/main/java/com/zcloud/controller/bus/RiskWarningController.java index e1e70a74..5f6e8c11 100644 --- a/src/main/java/com/zcloud/controller/bus/RiskWarningController.java +++ b/src/main/java/com/zcloud/controller/bus/RiskWarningController.java @@ -9,6 +9,7 @@ import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -31,7 +32,7 @@ import com.zcloud.util.Tools; import com.zcloud.entity.PageData; import com.zcloud.service.bus.RiskWarningService; -/** +/** * 说明:风险提示 * 作者:luoxiaobao * 时间:2021-04-27 @@ -40,10 +41,13 @@ import com.zcloud.service.bus.RiskWarningService; @Controller @RequestMapping("/riskwarning") public class RiskWarningController extends BaseController { - + + @Value("${http.file.url}") + private String fileUrl; + @Autowired private RiskWarningService riskwarningService; - + /**新增 * @param * @throws Exception @@ -62,7 +66,7 @@ public class RiskWarningController extends BaseController { pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 pd.put("ISDELETE", "0"); //是否删除 1-是 0-否 - pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); if (null != file && !file.isEmpty()) { String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { @@ -85,7 +89,7 @@ public class RiskWarningController extends BaseController { map.put("result", errInfo); return map; } - + /**删除 * @param out * @throws Exception @@ -102,7 +106,7 @@ public class RiskWarningController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - + /**修改 * @param * @throws Exception @@ -119,7 +123,7 @@ public class RiskWarningController extends BaseController { map.put("result", errInfo); return map; } - + /**列表 * @param page * @throws Exception @@ -134,7 +138,7 @@ public class RiskWarningController extends BaseController { pd = this.getPageData(); String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); - pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); page.setPd(pd); List varList = riskwarningService.list(page); //列出RiskWarning列表 map.put("varList", varList); @@ -142,7 +146,7 @@ public class RiskWarningController extends BaseController { map.put("result", errInfo); return map; } - + /**去修改页面获取数据 * @param * @throws Exception @@ -159,8 +163,8 @@ public class RiskWarningController extends BaseController { map.put("pd", pd); map.put("result", errInfo); return map; - } - + } + /**批量删除 * @param * @throws Exception @@ -171,7 +175,7 @@ public class RiskWarningController extends BaseController { public Object deleteAll() throws Exception{ Map map = new HashMap(); String errInfo = "success"; - PageData pd = new PageData(); + PageData pd = new PageData(); pd = this.getPageData(); String DATA_IDS = pd.getString("DATA_IDS"); if(Tools.notEmpty(DATA_IDS)){ @@ -184,7 +188,7 @@ public class RiskWarningController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - + /**下载 * @param * @throws Exception @@ -197,7 +201,7 @@ public class RiskWarningController extends BaseController { pd = riskwarningService.findById(pd); String FILEPATH = pd.get("FILEPATH").toString(); System.out.println(FILEPATH.length()); - FileDownload.mfFileDownload(response, Const.HTTPFILEURL + FILEPATH, FILEPATH.substring(FILEPATH.length()<85?28:61, FILEPATH.length())); + FileDownload.mfFileDownload(response, fileUrl + FILEPATH, FILEPATH.substring(FILEPATH.length()<85?28:61, FILEPATH.length())); } /**导出到excel * @param @@ -239,5 +243,5 @@ public class RiskWarningController extends BaseController { mv = new ModelAndView(erv,dataMap); return mv; } - + } diff --git a/src/main/java/com/zcloud/controller/bus/VideoController.java b/src/main/java/com/zcloud/controller/bus/VideoController.java index e030c1e2..e8f232ca 100644 --- a/src/main/java/com/zcloud/controller/bus/VideoController.java +++ b/src/main/java/com/zcloud/controller/bus/VideoController.java @@ -8,6 +8,7 @@ import java.util.Map; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -28,7 +29,7 @@ import com.zcloud.util.PathUtil; import com.zcloud.util.Smb; import com.zcloud.util.Tools; -/** +/** * 说明:视频管理 * 作者:luoxiaobao * 时间:2021-01-15 @@ -37,10 +38,13 @@ import com.zcloud.util.Tools; @Controller @RequestMapping("/video") public class VideoController extends BaseController { - + + @Value("${http.file.url}") + private String fileUrl; + @Autowired private VideoService videoService; - + /**新增 * @param * @throws Exception @@ -74,15 +78,15 @@ public class VideoController extends BaseController { String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); //Smb.1sshSftp(file, fileName,Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile); //pd.put("FILEPATH", Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); - Smb.sshSftp(file, fileName,Const.HTTPFILEURL + Jurisdiction.getCORPINFO_ID() + "/" + ffile); - pd.put("FILEPATH", Const.HTTPFILEURL + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); + Smb.sshSftp(file, fileName,fileUrl + Jurisdiction.getCORPINFO_ID() + "/" + ffile); + pd.put("FILEPATH", fileUrl + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); } - + videoService.save(pd); map.put("result", errInfo); return map; } - + /**删除 * @param out * @throws Exception @@ -99,7 +103,7 @@ public class VideoController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - + /**修改 * @param * @throws Exception @@ -116,7 +120,7 @@ public class VideoController extends BaseController { map.put("result", errInfo); return map; } - + /**列表 * @param page * @throws Exception @@ -142,7 +146,7 @@ public class VideoController extends BaseController { map.put("result", errInfo); return map; } - + /**去修改页面获取数据 * @param * @throws Exception @@ -159,8 +163,8 @@ public class VideoController extends BaseController { map.put("pd", pd); map.put("result", errInfo); return map; - } - + } + /**列表 数据置顶 * @param * @throws Exception @@ -187,7 +191,7 @@ public class VideoController extends BaseController { map.put("pd", pd); map.put("result", errInfo); return map; - } + } /**批量删除 * @param * @throws Exception @@ -198,7 +202,7 @@ public class VideoController extends BaseController { public Object deleteAll() throws Exception{ Map map = new HashMap(); String errInfo = "success"; - PageData pd = new PageData(); + PageData pd = new PageData(); pd = this.getPageData(); String DATA_IDS = pd.getString("DATA_IDS"); if(Tools.notEmpty(DATA_IDS)){ @@ -211,7 +215,7 @@ public class VideoController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - + /**导出到excel * @param * @throws Exception @@ -275,7 +279,7 @@ public class VideoController extends BaseController { pd.put("CORPINFO_TYPE", "2"); pd.put("TYPE", "1"); List ptVarList = videoService.listAll(pd); //平台视频 - + map.put("ptVarList", ptVarList); map.put("cpvarList", cpvarList); map.put("result", errInfo); diff --git a/src/main/java/com/zcloud/controller/emergency/EmergencyDrillAttachmentController.java b/src/main/java/com/zcloud/controller/emergency/EmergencyDrillAttachmentController.java index 5a775b37..053d3a30 100644 --- a/src/main/java/com/zcloud/controller/emergency/EmergencyDrillAttachmentController.java +++ b/src/main/java/com/zcloud/controller/emergency/EmergencyDrillAttachmentController.java @@ -7,6 +7,7 @@ import com.zcloud.service.emergency.EmergencyDrillAttachmentService; import com.zcloud.util.*; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -27,6 +28,9 @@ import java.util.*; @RequestMapping("/emergencydrillattachment") public class EmergencyDrillAttachmentController extends BaseController { + @Value("${http.file.url}") + private String fileUrl; + @Autowired private EmergencyDrillAttachmentService emergencydrillattachmentService; @@ -256,7 +260,7 @@ public class EmergencyDrillAttachmentController extends BaseController { // FileDownload.fileDownload(response, PathUtil.getProjectpath() + FILEPATH, FILENAME); //// FileDownload.mfFileDownload(response, this.getRequest().getScheme() + "://" + this.getRequest().getServerName() + ":" + this.getRequest().getServerPort() + FILEPATH, FILENAME); //不好用 //服务器 - FileDownload.mfFileDownload(response, Const.HTTPFILEURL + FILEPATH, FILENAME); + FileDownload.mfFileDownload(response, fileUrl + FILEPATH, FILENAME); } catch (Exception e) { e.printStackTrace(); throw new Exception("=========文件下载异常:可能要下载的文件已经没有了========="); diff --git a/src/main/java/com/zcloud/controller/emergency/EmergencyDrillReportController.java b/src/main/java/com/zcloud/controller/emergency/EmergencyDrillReportController.java index cc60b268..2613798c 100644 --- a/src/main/java/com/zcloud/controller/emergency/EmergencyDrillReportController.java +++ b/src/main/java/com/zcloud/controller/emergency/EmergencyDrillReportController.java @@ -7,6 +7,7 @@ import com.zcloud.service.emergency.EmergencyDrillReportService; import com.zcloud.util.*; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -27,6 +28,9 @@ import java.util.*; @RequestMapping("/emergencydrillreport") public class EmergencyDrillReportController extends BaseController { + @Value("${http.file.url}") + private String fileUrl; + @Autowired private EmergencyDrillReportService emergencydrillreportService; @@ -258,7 +262,7 @@ public class EmergencyDrillReportController extends BaseController { // FileDownload.fileDownload(response, PathUtil.getProjectpath() + FILEPATH, FILENAME); //// FileDownload.mfFileDownload(response, this.getRequest().getScheme() + "://" + this.getRequest().getServerName() + ":" + this.getRequest().getServerPort() + FILEPATH, FILENAME); //不好用 //服务器 - FileDownload.mfFileDownload(response, Const.HTTPFILEURL + FILEPATH, FILENAME); + FileDownload.mfFileDownload(response, fileUrl + FILEPATH, FILENAME); } catch (Exception e) { e.printStackTrace(); throw new Exception("=========文件下载异常:可能要下载的文件已经没有了========="); diff --git a/src/main/java/com/zcloud/controller/emergency/EmergencyPlanController.java b/src/main/java/com/zcloud/controller/emergency/EmergencyPlanController.java index e54008f6..16c9c80a 100644 --- a/src/main/java/com/zcloud/controller/emergency/EmergencyPlanController.java +++ b/src/main/java/com/zcloud/controller/emergency/EmergencyPlanController.java @@ -7,6 +7,7 @@ import com.zcloud.service.emergency.EmergencyPlanService; import com.zcloud.util.*; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -27,6 +28,9 @@ import java.util.*; @RequestMapping("/emergencyplan") public class EmergencyPlanController extends BaseController { + @Value("${http.file.url}") + private String fileUrl; + @Autowired private EmergencyPlanService emergencyplanService; @@ -283,7 +287,7 @@ public class EmergencyPlanController extends BaseController { // FileDownload.fileDownload(response, PathUtil.getProjectpath() + FILEPATH, FILENAME); //// FileDownload.mfFileDownload(response, this.getRequest().getScheme() + "://" + this.getRequest().getServerName() + ":" + this.getRequest().getServerPort() + FILEPATH, FILENAME); //不好用 //服务器 - FileDownload.mfFileDownload(response, Const.HTTPFILEURL + FILEPATH, FILENAME); + FileDownload.mfFileDownload(response, fileUrl + FILEPATH, FILENAME); } catch (Exception e) { e.printStackTrace(); throw new Exception("=========文件下载异常:可能要下载的文件已经没有了========="); diff --git a/src/main/java/com/zcloud/controller/filemanager/MfolderController.java b/src/main/java/com/zcloud/controller/filemanager/MfolderController.java index a0720aec..0d7c1be6 100644 --- a/src/main/java/com/zcloud/controller/filemanager/MfolderController.java +++ b/src/main/java/com/zcloud/controller/filemanager/MfolderController.java @@ -11,6 +11,7 @@ import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -34,18 +35,21 @@ import com.zcloud.util.Tools; import org.apache.shiro.authz.annotation.RequiresPermissions; -/** +/** * 说明:文件管理 - * 作者:zCloud + * 作者:zCloud * 官网: */ @Controller @RequestMapping("/mfolder") public class MfolderController extends BaseController { - + + @Value("${http.file.url}") + private String fileUrl; + @Autowired private MfolderService mfolderService; - + /**创建目录 * @param * @throws Exception @@ -64,13 +68,13 @@ public class MfolderController extends BaseController { pd.put("UNAME", Jurisdiction.getName()); //上传者 pd.put("MASTER", Jurisdiction.getUsername()); //所属人 pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 - pd.put("FILESIZE", ""); - pd.put("SHARE", "no"); + pd.put("FILESIZE", ""); + pd.put("SHARE", "no"); mfolderService.save(pd); map.put("result", errInfo); return map; } - + /**上传文件 * @param * @throws Exception @@ -120,11 +124,11 @@ public class MfolderController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - - + + /** * 上传文件 - * + * * @param * @throws Exception */ @@ -186,7 +190,7 @@ public class MfolderController extends BaseController { map.put("result", errInfo); // 返回结果 return map; } - + /**上传文件 * @param * @throws Exception @@ -212,7 +216,7 @@ public class MfolderController extends BaseController { // String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径 // fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传 fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); - Smb.sshSftp(file, fileName,Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile); + Smb.sshSftp(file, fileName,Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("FILEPATH", Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); //文件路径 String realName = file.getOriginalFilename(); String[] fileFullNames = realName.split("\\.");//上传文件全名 @@ -235,7 +239,7 @@ public class MfolderController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - + /**删除 * @param out * @throws Exception @@ -263,7 +267,7 @@ public class MfolderController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - + /**修改 * @param * @throws Exception @@ -280,7 +284,7 @@ public class MfolderController extends BaseController { map.put("result", errInfo); return map; } - + /**列表 * @param page * @throws Exception @@ -300,7 +304,7 @@ public class MfolderController extends BaseController { MFOLDER_ID = null == pd.get("MFOLDER_ID")?"":pd.get("MFOLDER_ID").toString(); pd.put("MFOLDER_ID", MFOLDER_ID); //当作上级ID } - + // if(Tools.notEmpty(SHARE) && "yes".equals(SHARE)) { // pd.put("SHARE", "yes"); // }else { @@ -351,7 +355,7 @@ public class MfolderController extends BaseController { fileType = "video"; //视频文件类型 } varList.get(i).put("extension_name", extension_name); //文件拓展名 - varList.get(i).put("fileType", fileType); //用于文件图标 + varList.get(i).put("fileType", fileType); //用于文件图标 } map.put("varList", varList); map.put("page", page); @@ -385,9 +389,9 @@ public class MfolderController extends BaseController { map.put("result", errInfo); return map; } - + /**预览txt,java,php,等文本文件 - * @return + * @return */ @RequestMapping(value="/viewTxt") @ResponseBody @@ -403,7 +407,7 @@ public class MfolderController extends BaseController { map.put("result", errInfo); return map; } - + /**批量操作 * @param * @throws Exception @@ -414,7 +418,7 @@ public class MfolderController extends BaseController { public Object deleteAll() throws Exception{ Map map = new HashMap(); String errInfo = "success"; - PageData pd = new PageData(); + PageData pd = new PageData(); pd = this.getPageData(); String DATA_IDS = pd.getString("DATA_IDS"); if(Tools.notEmpty(DATA_IDS)){ @@ -428,7 +432,7 @@ public class MfolderController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - + /**下载 * @param response * @throws Exception @@ -441,17 +445,17 @@ public class MfolderController extends BaseController { pd = mfolderService.findById(pd); String FILEPATH = pd.getString("FILEPATH"); // String fileName = pd.getString("NAME"); - FileDownload.mfFileDownload(response, Const.HTTPFILEURL + FILEPATH, FILEPATH.substring(FILEPATH.length()<85?27:60, FILEPATH.length())); + FileDownload.mfFileDownload(response, fileUrl + FILEPATH, FILEPATH.substring(FILEPATH.length()<85?27:60, FILEPATH.length())); } catch (Exception e) { e.printStackTrace(); throw new NofileException("=========要下载的文件已经没有了========="); } } - + /** * 初始化标签 * 较大及以上等级风险管控方案 - * @throws Exception + * @throws Exception */ public void initialize () throws Exception { PageData pData = new PageData(); @@ -469,12 +473,12 @@ public class MfolderController extends BaseController { pd.put("UNAME", "init"); //上传者 pd.put("MASTER", Jurisdiction.getUsername()); //所属人 pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 - pd.put("FILESIZE", ""); - pd.put("SHARE", "no"); + pd.put("FILESIZE", ""); + pd.put("SHARE", "no"); mfolderService.save(pd); } } - + } /* @@ -483,7 +487,7 @@ public class MfolderController extends BaseController { class NofileException extends Exception { private static final long serialVersionUID = 1L; - + public NofileException() { super(); } @@ -499,5 +503,5 @@ class NofileException extends Exception { public NofileException(Throwable cause) { super(cause); } - + } diff --git a/src/main/java/com/zcloud/controller/filemanager/MfolderStipulateController.java b/src/main/java/com/zcloud/controller/filemanager/MfolderStipulateController.java index af2d0a63..db262675 100644 --- a/src/main/java/com/zcloud/controller/filemanager/MfolderStipulateController.java +++ b/src/main/java/com/zcloud/controller/filemanager/MfolderStipulateController.java @@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletResponse; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -31,18 +32,21 @@ import com.zcloud.util.Tools; import net.sf.json.JSONArray; -/** +/** * 说明:文件管理 - * 作者:zCloud + * 作者:zCloud * 官网: */ @Controller @RequestMapping("/mfolderStipulate") public class MfolderStipulateController extends BaseController { - + + @Value("${http.file.url}") + private String fileUrl; + @Autowired private MfolderStipulateService mfolderService; - + /**创建目录 * @param * @throws Exception @@ -61,12 +65,12 @@ public class MfolderStipulateController extends BaseController { pd.put("UNAME", Jurisdiction.getName()); //上传者 pd.put("MASTER", Jurisdiction.getUsername()); //所属人 pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 - pd.put("FILESIZE", ""); + pd.put("FILESIZE", ""); mfolderService.save(pd); map.put("result", errInfo); return map; } - + /**上传文件 * @param * @throws Exception @@ -103,7 +107,7 @@ public class MfolderStipulateController extends BaseController { //pd.put("REMARKS", REMARKS); //备注 //pd.put("SHARE", SHARE); //是否共享 //pd.put("TYPE", TYPE); //数据类型 1.文件夹 2.文件 - + pd.put("MFOLDER_ID", this.get32UUID()); //主键 pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 mfolderService.save(pd); //存入数据库表 @@ -113,7 +117,7 @@ public class MfolderStipulateController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - + /**上传文件 * @param * @throws Exception @@ -149,15 +153,15 @@ public class MfolderStipulateController extends BaseController { //pd.put("REMARKS", REMARKS); //备注 //pd.put("SHARE", SHARE); //是否共享 //pd.put("TYPE", TYPE); //数据类型 1.文件夹 2.文件 - + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业 } mfolderService.edit(pd); //存入数据库表 map.put("result", errInfo); //返回结果 return map; } - - + + /**去修改页面获取数据 * @param * @throws Exception @@ -174,8 +178,8 @@ public class MfolderStipulateController extends BaseController { map.put("pd", pd); map.put("result", errInfo); return map; - } - + } + /**上传文件 * @param * @throws Exception @@ -201,7 +205,7 @@ public class MfolderStipulateController extends BaseController { // String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径 // fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传 fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); - Smb.sshSftp(file, fileName,Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile); + Smb.sshSftp(file, fileName,Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile); pd.put("FILEPATH", Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); //文件路径 String realName = file.getOriginalFilename(); String[] fileFullNames = realName.split("\\.");//上传文件全名 @@ -248,7 +252,7 @@ public class MfolderStipulateController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - + /**修改 * @param * @throws Exception @@ -265,7 +269,7 @@ public class MfolderStipulateController extends BaseController { map.put("result", errInfo); return map; } - + /**列表 * @param page * @throws Exception @@ -285,7 +289,7 @@ public class MfolderStipulateController extends BaseController { MFOLDER_ID = null == pd.get("MFOLDER_ID")?"":pd.get("MFOLDER_ID").toString(); pd.put("MFOLDER_ID", MFOLDER_ID); //当作上级ID } - + // if(Tools.notEmpty(SHARE) && "yes".equals(SHARE)) { // pd.put("SHARE", "yes"); // }else { @@ -337,7 +341,7 @@ public class MfolderStipulateController extends BaseController { fileType = "video"; //视频文件类型 } varList.get(i).put("extension_name", extension_name); //文件拓展名 - varList.get(i).put("fileType", fileType); //用于文件图标 + varList.get(i).put("fileType", fileType); //用于文件图标 } map.put("varList", varList); map.put("page", page); @@ -370,9 +374,9 @@ public class MfolderStipulateController extends BaseController { map.put("result", errInfo); return map; } - + /**预览txt,java,php,等文本文件 - * @return + * @return */ @RequestMapping(value="/viewTxt") @ResponseBody @@ -388,7 +392,7 @@ public class MfolderStipulateController extends BaseController { map.put("result", errInfo); return map; } - + /**批量操作 * @param * @throws Exception @@ -399,7 +403,7 @@ public class MfolderStipulateController extends BaseController { public Object deleteAll() throws Exception{ Map map = new HashMap(); String errInfo = "success"; - PageData pd = new PageData(); + PageData pd = new PageData(); pd = this.getPageData(); String DATA_IDS = pd.getString("DATA_IDS"); if(Tools.notEmpty(DATA_IDS)){ @@ -413,7 +417,7 @@ public class MfolderStipulateController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - + /**下载 * @param response * @throws Exception @@ -426,12 +430,12 @@ public class MfolderStipulateController extends BaseController { pd = mfolderService.findById(pd); String FILEPATH = pd.getString("FILEPATH"); // String fileName = pd.getString("NAME"); - FileDownload.mfFileDownload(response, Const.HTTPFILEURL + FILEPATH, FILEPATH.substring(FILEPATH.length()<85?27:60, FILEPATH.length())); + FileDownload.mfFileDownload(response, fileUrl + FILEPATH, FILEPATH.substring(FILEPATH.length()<85?27:60, FILEPATH.length())); } catch (Exception e) { throw new NofileStiException("=========要下载的文件已经没有了========="); } } - + } /* @@ -440,7 +444,7 @@ public class MfolderStipulateController extends BaseController { class NofileStiException extends Exception { private static final long serialVersionUID = 1L; - + public NofileStiException() { super(); } @@ -456,5 +460,5 @@ class NofileStiException extends Exception { public NofileStiException(Throwable cause) { super(cause); } - + } diff --git a/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalController.java b/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalController.java index 1669cef6..952c989c 100644 --- a/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalController.java +++ b/src/main/java/com/zcloud/controller/inspection/SafetyEnvironmentalController.java @@ -24,6 +24,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.session.Session; import org.apache.xmlgraphics.xmp.schemas.pdf.PDFAAdapter; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -45,6 +46,9 @@ import java.util.stream.Collectors; @RequestMapping("/safetyenvironmental") public class SafetyEnvironmentalController extends BaseController { + @Value("${http.file.url}") + private String fileUrl; + @Autowired private SafetyEnvironmentalService safetyenvironmentalService; @Autowired @@ -653,7 +657,7 @@ public class SafetyEnvironmentalController extends BaseController { String FILEPATH = pd.getString("INSPECTED_EXPLAIN_FILEPATH"); String FILENAME = pd.getString("INSPECTED_EXPLAIN_FILENAME"); //服务器 - FileDownload.mfFileDownload(response, Const.HTTPFILEURL + FILEPATH, FILENAME); + FileDownload.mfFileDownload(response, fileUrl + FILEPATH, FILENAME); } catch (Exception e) { e.printStackTrace(); throw new Exception("=========文件下载异常:可能要下载的文件已经没有了========="); @@ -674,7 +678,7 @@ public class SafetyEnvironmentalController extends BaseController { String FILEPATH = pd.getString("INSPECTED_EXPLAIN_FILEPATH"); String FILENAME = pd.getString("INSPECTED_EXPLAIN_FILENAME"); //服务器 - FileDownload.mfFileDownload(response, Const.HTTPFILEURL + FILEPATH, FILENAME); + FileDownload.mfFileDownload(response, fileUrl + FILEPATH, FILENAME); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/com/zcloud/controller/majordangersource/MajorDangerSourceController.java b/src/main/java/com/zcloud/controller/majordangersource/MajorDangerSourceController.java index 726483dd..08f0b7a1 100644 --- a/src/main/java/com/zcloud/controller/majordangersource/MajorDangerSourceController.java +++ b/src/main/java/com/zcloud/controller/majordangersource/MajorDangerSourceController.java @@ -10,6 +10,7 @@ import com.zcloud.service.majordangersource.MajorDangerSourceLogService; import com.zcloud.service.majordangersource.MonitoringDeviceDisableService; import com.zcloud.util.*; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -35,6 +36,9 @@ import javax.servlet.http.HttpServletResponse; @RequestMapping("/majordangersource") public class MajorDangerSourceController extends BaseController { + @Value("${http.file.url}") + private String fileUrl; + @Autowired private MajorDangerSourceService majordangersourceService; @@ -352,7 +356,7 @@ public class MajorDangerSourceController extends BaseController { // FileDownload.fileDownload(response, PathUtil.getProjectpath() + FILEPATH, FILENAME); //// FileDownload.mfFileDownload(response, this.getRequest().getScheme() + "://" + this.getRequest().getServerName() + ":" + this.getRequest().getServerPort() + FILEPATH, FILENAME); //不好用 //服务器 - FileDownload.mfFileDownload(response, Const.HTTPFILEURL + FILEPATH, FILENAME); + FileDownload.mfFileDownload(response, fileUrl + FILEPATH, FILENAME); } catch (Exception e) { e.printStackTrace(); throw new Exception("=========文件下载异常:可能要下载的文件已经没有了========="); diff --git a/src/main/java/com/zcloud/controller/majordangersource/MajorDangerSourceLogController.java b/src/main/java/com/zcloud/controller/majordangersource/MajorDangerSourceLogController.java index aab3949d..b0a73ea4 100644 --- a/src/main/java/com/zcloud/controller/majordangersource/MajorDangerSourceLogController.java +++ b/src/main/java/com/zcloud/controller/majordangersource/MajorDangerSourceLogController.java @@ -7,6 +7,7 @@ import com.zcloud.service.majordangersource.MajorDangerSourceLogService; import com.zcloud.util.*; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -15,7 +16,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletResponse; import java.util.*; -/** +/** * 说明:重大危险源 * 作者:luoxiaobao * 时间:2022-03-22 @@ -24,10 +25,13 @@ import java.util.*; @Controller @RequestMapping("/majordangersourcelog") public class MajorDangerSourceLogController extends BaseController { - + + @Value("${http.file.url}") + private String fileUrl; + @Autowired private MajorDangerSourceLogService majorDangerSourceLogService; - + /**新增 * @param * @throws Exception @@ -51,7 +55,7 @@ public class MajorDangerSourceLogController extends BaseController { map.put("result", errInfo); return map; } - + /**删除 * @param out * @throws Exception @@ -70,7 +74,7 @@ public class MajorDangerSourceLogController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - + /**修改 * @param * @throws Exception @@ -89,7 +93,7 @@ public class MajorDangerSourceLogController extends BaseController { map.put("result", errInfo); return map; } - + /**列表 * @param page * @throws Exception @@ -112,7 +116,7 @@ public class MajorDangerSourceLogController extends BaseController { map.put("result", errInfo); return map; } - + /**去修改页面获取数据 * @param * @throws Exception @@ -163,7 +167,7 @@ public class MajorDangerSourceLogController extends BaseController { public Object deleteAll() throws Exception{ Map map = new HashMap(); String errInfo = "success"; - PageData pd = new PageData(); + PageData pd = new PageData(); pd = this.getPageData(); pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 @@ -184,7 +188,7 @@ public class MajorDangerSourceLogController extends BaseController { map.put("result", errInfo); //返回结果 return map; } - + /**导出到excel * @param * @throws Exception @@ -267,11 +271,11 @@ public class MajorDangerSourceLogController extends BaseController { // FileDownload.fileDownload(response, PathUtil.getProjectpath() + FILEPATH, FILENAME); //// FileDownload.mfFileDownload(response, this.getRequest().getScheme() + "://" + this.getRequest().getServerName() + ":" + this.getRequest().getServerPort() + FILEPATH, FILENAME); //不好用 //服务器 - FileDownload.mfFileDownload(response, Const.HTTPFILEURL + FILEPATH, FILENAME); + FileDownload.mfFileDownload(response, fileUrl + FILEPATH, FILENAME); } catch (Exception e) { e.printStackTrace(); throw new Exception("=========文件下载异常:可能要下载的文件已经没有了========="); } } - + } diff --git a/src/main/java/com/zcloud/controller/tzsb/SpecialEquipmentController.java b/src/main/java/com/zcloud/controller/tzsb/SpecialEquipmentController.java index 471f614e..dd083313 100644 --- a/src/main/java/com/zcloud/controller/tzsb/SpecialEquipmentController.java +++ b/src/main/java/com/zcloud/controller/tzsb/SpecialEquipmentController.java @@ -11,6 +11,7 @@ import com.zcloud.service.tzsb.SpecialEquipmentService; import com.zcloud.util.*; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -31,6 +32,9 @@ import java.util.*; @RequestMapping("/specialequipment") public class SpecialEquipmentController extends BaseController { + @Value("${http.file.url}") + private String fileUrl; + @Autowired private SpecialEquipmentService specialequipmentService; @Autowired @@ -488,7 +492,7 @@ public class SpecialEquipmentController extends BaseController { // FileDownload.fileDownload(response, PathUtil.getProjectpath() + FILEPATH, FILENAME); //// FileDownload.mfFileDownload(response, this.getRequest().getScheme() + "://" + this.getRequest().getServerName() + ":" + this.getRequest().getServerPort() + FILEPATH, FILENAME); //不好用 //服务器 - FileDownload.mfFileDownload(response, Const.HTTPFILEURL + FILEPATH, FILENAME); + FileDownload.mfFileDownload(response, fileUrl + FILEPATH, FILENAME); } catch (Exception e) { e.printStackTrace(); throw new Exception("=========文件下载异常:可能要下载的文件已经没有了========="); diff --git a/src/main/java/com/zcloud/util/HiddenExcelImgToSessionView.java b/src/main/java/com/zcloud/util/HiddenExcelImgToSessionView.java index 3e07fff8..2366abae 100644 --- a/src/main/java/com/zcloud/util/HiddenExcelImgToSessionView.java +++ b/src/main/java/com/zcloud/util/HiddenExcelImgToSessionView.java @@ -18,6 +18,7 @@ import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.VerticalAlignment; import org.apache.poi.ss.usermodel.Workbook; import org.apache.shiro.session.Session; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.servlet.view.document.AbstractXlsView; import com.zcloud.entity.PageData; @@ -31,6 +32,9 @@ import net.coobird.thumbnailator.Thumbnails; */ public class HiddenExcelImgToSessionView extends AbstractXlsView{ + @Value("${http.file.url}") + private String fileUrl; + @Override protected void buildExcelDocument(Map model, Workbook workbook, HttpServletRequest request, @@ -38,7 +42,7 @@ public class HiddenExcelImgToSessionView extends AbstractXlsView{ // TODO Auto-generated method stub String proPath = PathUtil.getProjectpath(); Session session = Jurisdiction.getSession(); - String beji = Const.HTTPFILEURL; + String beji = fileUrl; //beji =beji.replaceAll("\\\\", "/"); // String beji = "https://qgqy.qhdsafety.com/file/"; Date date = new Date(); diff --git a/src/main/java/com/zcloud/util/HiddenExcelImgView.java b/src/main/java/com/zcloud/util/HiddenExcelImgView.java index cb1f84e9..a447a4bf 100644 --- a/src/main/java/com/zcloud/util/HiddenExcelImgView.java +++ b/src/main/java/com/zcloud/util/HiddenExcelImgView.java @@ -26,6 +26,7 @@ import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.VerticalAlignment; import org.apache.poi.ss.usermodel.Workbook; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.servlet.view.document.AbstractXlsView; import com.zcloud.entity.PageData; @@ -37,13 +38,16 @@ import com.zcloud.entity.PageData; */ public class HiddenExcelImgView extends AbstractXlsView{ + @Value("${http.file.url}") + private String fileUrl; + @Override protected void buildExcelDocument(Map model, Workbook workbook, HttpServletRequest request, HttpServletResponse response) throws Exception { // TODO Auto-generated method stub String proPath = PathUtil.getProjectpath(); - String beji = Const.HTTPFILEURL; + String beji = fileUrl; //beji =beji.replaceAll("\\\\", "/"); Date date = new Date();