From 1ade3411b380253e8789fa85aeeb70c4d64530dd Mon Sep 17 00:00:00 2001
From: Fancy <Fancy.fx@outlook.com>
Date: 星期二, 20 八月 2024 09:08:20 +0800
Subject: [PATCH] order manage
---
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/global/WebFileCtrl.java | 57 +++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 43 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 a3d3641..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
@@ -36,11 +35,14 @@
@Value("${dy.webFile.fmUrl}")
private String fmUrl ;
+ //鏀寔鐨勬枃浠剁被鍨�
+ @Value("${dy.webFile.supportedFileTypes}")
+ private String supportedFileTypes ;
/**
* 涓婁紶鐓х墖鍥剧墖鏂囦欢 锛堝綋鍓嶅彧瀵筽ng jpg鏍煎紡鍥剧墖鏀寔缂╃暐鍥撅級
- * @param file
- * @return
+ * @param file web绔笂浼犳枃浠剁殑post瀵硅薄
+ * @return 杩斿洖缁撴灉
*/
@PostMapping("/upPhoto")
@SsoPowerAop(power = "-1") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇�
@@ -60,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("鏈緱鍒颁笂浼犳枃浠剁殑鎵╁睍鍚�");
@@ -79,8 +87,8 @@
/**
* 涓婁紶褰曢煶闊抽鏂囦欢
- * @param file
- * @return
+ * @param file web绔笂浼犳枃浠剁殑post瀵硅薄
+ * @return 杩斿洖缁撴灉
*/
@PostMapping("/upPhone")
@SsoPowerAop(power = "-1")
@@ -99,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("鏈緱鍒颁笂浼犳枃浠剁殑鎵╁睍鍚�");
@@ -119,8 +133,8 @@
/**
* 涓婁紶褰曞儚瑙嗛鏂囦欢
- * @param file
- * @return
+ * @param file web绔笂浼犳枃浠剁殑post瀵硅薄
+ * @return 杩斿洖缁撴灉
*/
@PostMapping("/upVideo")
@SsoPowerAop(power = "-1")
@@ -139,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("鏈緱鍒颁笂浼犳枃浠剁殑鎵╁睍鍚�");
@@ -159,8 +179,8 @@
/**
* 涓婁紶鏂囨。鏂囦欢
- * @param file
- * @return
+ * @param file web绔笂浼犳枃浠剁殑post瀵硅薄
+ * @return 杩斿洖缁撴灉
*/
@PostMapping("/upDocument")
@SsoPowerAop(power = "-1")
@@ -170,6 +190,10 @@
String[] fileNameGrp = fileOp.splitFileName(file) ;
if(fileNameGrp != null && fileNameGrp[0] != null && fileNameGrp[1] != null){
if(!fileNameGrp[1].trim().equals("")){
+ String fileExtName = fileNameGrp[1];
+ if(!supportedFileTypes.contains(fileExtName)){
+ return BaseResponseUtils.buildError("璇蜂笂浼燱ord,Excel,PDF绫诲瀷鏂囨。");
+ }
FileRestVo frVo = fileOp.saveFile(file,
fmUrl,
FileConstant.fileRequestMapping,
@@ -179,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("鏈緱鍒颁笂浼犳枃浠剁殑鎵╁睍鍚�");
@@ -204,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