From b7d83328c1d4cf65f0dc9ec7c17e957afc7e3c76 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期一, 13 一月 2025 17:07:33 +0800 Subject: [PATCH] web文件系统,文件上传返回增加一个属性filePath ;//文件在服务端存储相对路径 --- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileOperate.java | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 49 insertions(+), 0 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileOperate.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileOperate.java index ae52a49..08fed09 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileOperate.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileOperate.java @@ -101,6 +101,27 @@ } /** + * 閫氳繃瑙嗛璺緞锛屽緱鍒板搴旂缉鐣ュ浘鐨勮矾寰� + * @param videoPath + * @return + */ + public String getVideoFileZipPath(String videoPath, String extName){ + String path_ = null ; + String prePath = null ; + if(videoPath != null && !videoPath.trim().equals("")) { + int lastDotIndex = videoPath.lastIndexOf('.'); + if (lastDotIndex >= 0) { + prePath = videoPath.substring(0, lastDotIndex); + path_ = prePath + "_." + extName ; + } + } + if(path_ == null){ + path_ = videoPath ; + } + return path_ ; + } + + /** * web鍒嗗竷寮忔枃浠剁郴缁熶繚瀛樻枃浠� * @param file * @param fmUrl @@ -277,6 +298,34 @@ } /** + * 瑙f瀽鏂囦欢鍝堝笇鍊� + * @param fmUrl + * @param hashCodes + * @return + */ + public List<FileRestVo> parseHashcode(String fmUrl, List<Integer> hashCodes){ + List<FileRestVo> rList = null ; + if(hashCodes != null && hashCodes.size() > 0) { + // 鍑嗗璇锋眰鏁版嵁 + MultiValueMap<String, Object> multipartRequestData = new LinkedMultiValueMap<>(); + multipartRequestData.add(FileConstant.fmPostMapping_parseHashcodeList_paramName, hashCodes); + + // 璁剧疆璇锋眰澶撮儴锛岃繖閲屽亣璁炬湇鍔″櫒鎺ユ敹multipart/form-data绫诲瀷鐨勬暟鎹� + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.MULTIPART_FORM_DATA); + + // 灏佽璇锋眰浣� + HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(multipartRequestData, headers); + + String webUrl = fmUrl + "/" + FileConstant.fmRequestMapping + "/" + FileConstant.fmPostMapping_parseHashcodeList; + // 鍙戦�丳OST璇锋眰 + FileRestVo[] rvos = restTemplate.postForObject(webUrl, requestEntity, FileRestVo[].class); + rList = Arrays.asList(rvos) ; + } + return rList ; + } + + /** * 瑙f瀽鏂囦欢鏂囦欢璺緞涓殑鍝堝笇鍊煎苟杩斿洖鍥剧墖瀹屾暣璺緞 * @param fmUrl * @param filePath -- Gitblit v1.8.0