zhubaomin
2025-04-02 bab406b3393a3df6854ee5970a5a62a33f34e597
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileOperate.java
@@ -79,23 +79,44 @@
   /**
    * 通过照片路径,得到对应缩略图的路径
    * @param imgPath
    * @param filePath
    * @return
    */
   public String getImgFileZipPath(String imgPath){
   public String getFileZipPath(String filePath){
      String path_ = null ;
      String prePath = null ;
      String tailPath = null ;
      if(imgPath != null && !imgPath.trim().equals("")) {
         int lastDotIndex = imgPath.lastIndexOf('.');
      if(filePath != null && !filePath.trim().equals("")) {
         int lastDotIndex = filePath.lastIndexOf('.');
         if (lastDotIndex >= 0) {
            prePath = imgPath.substring(0, lastDotIndex);
            tailPath = imgPath.substring(lastDotIndex);
            prePath = filePath.substring(0, lastDotIndex);
            tailPath = filePath.substring(lastDotIndex);
            path_ = prePath + "_" + tailPath ;
         }
      }
      if(path_ == null){
         path_ = imgPath ;
         path_ = filePath;
      }
      return path_ ;
   }
   /**
    * 通过视频路径,得到对应缩略图的路径
    * @param filePath
    * @return
    */
   public String getFileZipPath(String filePath, String extName){
      String path_ = null ;
      String prePath = null ;
      if(filePath != null && !filePath.trim().equals("")) {
         int lastDotIndex = filePath.lastIndexOf('.');
         if (lastDotIndex >= 0) {
            prePath = filePath.substring(0, lastDotIndex);
            path_ = prePath + "_." + extName ;
         }
      }
      if(path_ == null){
         path_ = filePath;
      }
      return path_ ;
   }
@@ -277,6 +298,34 @@
   }
   /**
    * 解析文件哈希值
    * @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;
         // 发送POST请求
         FileRestVo[] rvos = restTemplate.postForObject(webUrl, requestEntity, FileRestVo[].class);
         rList = Arrays.asList(rvos) ;
      }
      return rList ;
   }
   /**
    * 解析文件文件路径中的哈希值并返回图片完整路径
    * @param fmUrl
    * @param filePath