From 8739a65826f197156624880172983ca8faee4dfc Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 09 八月 2024 17:15:20 +0800 Subject: [PATCH] 修改web文件功能中下载文件URL配置与生成方式 --- pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/global/WebFileCtrl.java | 50 ++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 36 insertions(+), 14 deletions(-) diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/global/WebFileCtrl.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/global/WebFileCtrl.java index bf1fa9b..3228be2 100644 --- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/global/WebFileCtrl.java +++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/global/WebFileCtrl.java @@ -25,7 +25,6 @@ @Slf4j @RestController @RequestMapping(path="webFile") -@SuppressWarnings("unchecked")//java鐗堟湰瓒婇珮锛屽娉涘瀷绾︽潫瓒婁弗锛屾墍浠ラ厤缃甋uppressWarnings("unchecked" public class WebFileCtrl { @Autowired @@ -42,8 +41,8 @@ /** * 涓婁紶鐓х墖鍥剧墖鏂囦欢 锛堝綋鍓嶅彧瀵筽ng jpg鏍煎紡鍥剧墖鏀寔缂╃暐鍥撅級 - * @param file - * @return + * @param file web绔笂浼犳枃浠剁殑post瀵硅薄 + * @return 杩斿洖缁撴灉 */ @PostMapping("/upPhoto") @SsoPowerAop(power = "-1") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇� @@ -63,7 +62,13 @@ null); String fileMainName = fileOp.getFileMainName(frVo.fileName) ; Long id = this.saveFileInfo(fileNameGrp[0], fileNameGrp[1], fileMainName, frVo.fileNameHash, frVo.fileWebPath); - FileVo fvo = new FileVo(id, frVo.fileNameHash, fileNameGrp[0], fileNameGrp[1], (frVo.getFileWebUrl() + frVo.getFileWebPath()), fileOp.getImgFileZipPath(frVo.getFileWebUrl() + frVo.getFileWebPath()), frVo.fileSysRestUrl + frVo.fileWebDownloadPath + id) ; + FileVo fvo = new FileVo(id, + frVo.fileNameHash, + fileNameGrp[0], + fileNameGrp[1], + (frVo.getFileWebUrl() + frVo.getFileWebPath()), + fileOp.getImgFileZipPath(frVo.getFileWebUrl() + frVo.getFileWebPath()), + frVo.fileWebDownloadPath + id) ; return BaseResponseUtils.buildSuccess(fvo) ; }else { return BaseResponseUtils.buildError("鏈緱鍒颁笂浼犳枃浠剁殑鎵╁睍鍚�"); @@ -82,8 +87,8 @@ /** * 涓婁紶褰曢煶闊抽鏂囦欢 - * @param file - * @return + * @param file web绔笂浼犳枃浠剁殑post瀵硅薄 + * @return 杩斿洖缁撴灉 */ @PostMapping("/upPhone") @SsoPowerAop(power = "-1") @@ -102,7 +107,13 @@ null); String fileMainName = fileOp.getFileMainName(frVo.fileName) ; Long id = this.saveFileInfo(fileNameGrp[0], fileNameGrp[1], fileMainName, frVo.fileNameHash, frVo.fileWebPath); - FileVo fvo = new FileVo(id, frVo.fileNameHash, fileNameGrp[0], fileNameGrp[1],frVo.getFileWebUrl() + frVo.getFileWebPath(), null, frVo.fileSysRestUrl + frVo.fileWebDownloadPath + id) ; + FileVo fvo = new FileVo(id, + frVo.fileNameHash, + fileNameGrp[0], + fileNameGrp[1], + frVo.getFileWebUrl() + frVo.getFileWebPath(), + null, + frVo.fileWebDownloadPath + id) ; return BaseResponseUtils.buildSuccess(fvo) ; }else { return BaseResponseUtils.buildError("鏈緱鍒颁笂浼犳枃浠剁殑鎵╁睍鍚�"); @@ -122,8 +133,8 @@ /** * 涓婁紶褰曞儚瑙嗛鏂囦欢 - * @param file - * @return + * @param file web绔笂浼犳枃浠剁殑post瀵硅薄 + * @return 杩斿洖缁撴灉 */ @PostMapping("/upVideo") @SsoPowerAop(power = "-1") @@ -142,7 +153,13 @@ null); String fileMainName = fileOp.getFileMainName(frVo.fileName) ; Long id = this.saveFileInfo(fileNameGrp[0], fileNameGrp[1], fileMainName, frVo.fileNameHash, frVo.fileWebPath); - FileVo fvo = new FileVo(id, frVo.fileNameHash, fileNameGrp[0], fileNameGrp[1],frVo.getFileWebUrl() + frVo.getFileWebPath(), null, frVo.fileSysRestUrl + frVo.fileWebDownloadPath + id) ; + FileVo fvo = new FileVo(id, + frVo.fileNameHash, + fileNameGrp[0], + fileNameGrp[1], + frVo.getFileWebUrl() + frVo.getFileWebPath(), + null, + frVo.fileWebDownloadPath + id) ; return BaseResponseUtils.buildSuccess(fvo) ; }else { return BaseResponseUtils.buildError("鏈緱鍒颁笂浼犳枃浠剁殑鎵╁睍鍚�"); @@ -162,8 +179,8 @@ /** * 涓婁紶鏂囨。鏂囦欢 - * @param file - * @return + * @param file web绔笂浼犳枃浠剁殑post瀵硅薄 + * @return 杩斿洖缁撴灉 */ @PostMapping("/upDocument") @SsoPowerAop(power = "-1") @@ -186,7 +203,12 @@ null); String fileMainName = fileOp.getFileMainName(frVo.fileName) ; Long id = this.saveFileInfo(fileNameGrp[0], fileNameGrp[1], fileMainName, frVo.fileNameHash, frVo.fileWebPath); - FileVo fvo = new FileVo(id, frVo.fileNameHash, fileNameGrp[0], fileNameGrp[1],frVo.getFileWebUrl() + frVo.getFileWebPath(), null, frVo.fileSysRestUrl + frVo.fileWebDownloadPath + id) ; + FileVo fvo = new FileVo(id, + frVo.fileNameHash, + fileNameGrp[0], fileNameGrp[1], + frVo.getFileWebUrl() + frVo.getFileWebPath(), + null, + frVo.fileWebDownloadPath + id) ; return BaseResponseUtils.buildSuccess(fvo) ; }else { return BaseResponseUtils.buildError("鏈緱鍒颁笂浼犳枃浠剁殑鎵╁睍鍚�"); @@ -211,7 +233,7 @@ * @param newName 鏂囦欢鏂板悕绉� * @param hash 鏂囦欢鏂板悕绉扮殑鍝堝笇鍊� * @param filePath 鏂囦欢鏈嶅姟绔瓨鍌ㄧ浉瀵硅矾寰� - * @return + * @return 鏁版嵁璁板綍涓婚敭 */ private Long saveFileInfo(String orgName, String extName, String newName, Integer hash, String filePath){ OthFile po = new OthFile() ; -- Gitblit v1.8.0