智慧保安后台管理-外网
Administrator
2022-06-16 8b375fe00a241b3a769b82fe3dac8d1c9dce8a02
src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java
@@ -211,7 +211,7 @@
         minioClient.setBucketPolicy(SetBucketPolicyArgs.builder().bucket(bucket).build());
      }
      String fileName = file.getOriginalFilename();
      String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "")
      String newName = "upload/picture/f" + UUID.randomUUID().toString().replaceAll("-", "")
         + fileName.substring(fileName.lastIndexOf("."));
      InputStream in = file.getInputStream();
      String[] split = newName.split("/");
@@ -226,7 +226,7 @@
            .headers(headers)
            .build());
      InputStream inputStream = file.getInputStream();
      FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", "f"+split[2], inputStream);
      FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream);
      in.close();
      String urls = "http://61.131.136.25:2081/zhba/" + newName;
      //数据封装
@@ -263,7 +263,7 @@
         minioClient.setBucketPolicy(SetBucketPolicyArgs.builder().bucket(bucket).build());
      }
      String fileName = file.getOriginalFilename();
      String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "")
      String newName = "upload/picture/f" + UUID.randomUUID().toString().replaceAll("-", "")
         + fileName.substring(fileName.lastIndexOf("."));
      InputStream in = file.getInputStream();
      String[] split = newName.split("/");
@@ -278,7 +278,7 @@
            .headers(headers)
            .build());
      InputStream inputStream = file.getInputStream();
      FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/","f"+split[2], inputStream);
      FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/",split[2], inputStream);
      in.close();
      String urls = "http://61.131.136.25:2081/zhba/" + newName;
      return R.data(urls);
@@ -310,7 +310,7 @@
         minioClient.setBucketPolicy(SetBucketPolicyArgs.builder().bucket(bucket).build());
      }
      String fileName = file.getOriginalFilename();
      String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "")
      String newName = "upload/picture/f" + UUID.randomUUID().toString().replaceAll("-", "")
         + fileName.substring(fileName.lastIndexOf("."));
      InputStream in = file.getInputStream();
      String[] split = newName.split("/");
@@ -325,7 +325,7 @@
            .headers(headers)
            .build());
      InputStream inputStream = file.getInputStream();
      FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", "f"+split[2], inputStream);
      FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream);
      in.close();
      String urls = "http://61.131.136.25:2081/zhba/" + newName;
      //数据封装
@@ -405,7 +405,8 @@
         }
         if(multipartFile.getName().toLowerCase().endsWith(".png") || multipartFile.getName().toLowerCase().endsWith(".jpg")) {
            String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "") + multipartFile.getName().substring(multipartFile.getName().lastIndexOf("."));
            String name = UUID.randomUUID().toString().replaceAll("-", "") + multipartFile.getName().substring(multipartFile.getName().lastIndexOf("."));
            String newName = "upload/picture/f" + name;
            InputStream in = multipartFile.getInputStream();
            String[] split = newName.split("/");
            //创建头部信息
@@ -444,7 +445,7 @@
               //文件推送
               InputStream inputStream = multipartFile.getInputStream();
               FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", "f"+split[2], inputStream);
               FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream);
               in.close();
            }
         }
@@ -532,7 +533,7 @@
         }
         if(multipartFile.getName().toLowerCase().endsWith(".png") || multipartFile.getName().toLowerCase().endsWith(".jpg")) {
            String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "") + multipartFile.getName().substring(multipartFile.getName().lastIndexOf("."));
            String newName = "upload/picture/f" + UUID.randomUUID().toString().replaceAll("-", "") + multipartFile.getName().substring(multipartFile.getName().lastIndexOf("."));
            InputStream in = multipartFile.getInputStream();
            String[] split = newName.split("/");
            //创建头部信息
@@ -571,7 +572,7 @@
               //文件推送
               InputStream inputStream = multipartFile.getInputStream();
               FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", "f"+split[2], inputStream);
               FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream);
               in.close();
            }else {
               pic.set(false);
@@ -653,7 +654,7 @@
      fileList = fileUtil.getSubFiles(desPath,fileList);
      for (MultipartFile multipartFile : fileList){
         if(multipartFile.getName().toLowerCase().endsWith(".png") || multipartFile.getName().toLowerCase().endsWith(".jpg")) {
            String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "") + multipartFile.getName().substring(multipartFile.getName().lastIndexOf("."));
            String newName = "upload/picture/f" + UUID.randomUUID().toString().replaceAll("-", "") + multipartFile.getName().substring(multipartFile.getName().lastIndexOf("."));
            InputStream in = multipartFile.getInputStream();
            String[] split = newName.split("/");
            //创建头部信息
@@ -708,7 +709,7 @@
               //文件推送
               InputStream inputStream = multipartFile.getInputStream();
               FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", "f"+split[2], inputStream);
               FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream);
               in.close();
            }
         }
@@ -748,7 +749,7 @@
         minioClient.setBucketPolicy(SetBucketPolicyArgs.builder().bucket(bucket).build());
      }
      String fileName = file.getOriginalFilename();
      String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "")
      String newName = "upload/picture/f" + UUID.randomUUID().toString().replaceAll("-", "")
         + fileName.substring(fileName.lastIndexOf("."));
      InputStream in = file.getInputStream();
      String[] split = newName.split("/");
@@ -765,7 +766,7 @@
      //文件推送
      InputStream inputStream = file.getInputStream();
      FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", "f"+split[2], inputStream);
      FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream);
      in.close();
      String urls = "http://61.131.136.25:2081/zhba/" + newName;
      //数据封装
@@ -862,7 +863,7 @@
            "'" + attach.getTenantId() + "'" + "," +
            "'" + imgurl + "'" + "," +
            "'" + ip + "'" + "," +
            "'" + split[2] + "'" + "," +
            "'" + "f"+split[2] + "'" + "," +
            "'" + attach.getOriginalName() + "'" + "," +
            "'" + attach.getExtension() + "'" + "," +
            "'" + attach.getAttachSize() + "'" + "," +
@@ -881,7 +882,7 @@
            "'" + attach.getTenantId() + "'" + "," +
            "'" + imgurl + "'" + "," +
            "'" + ip + "'" + "," +
            "'" + split[2] + "'" + "," +
            "'" + "f"+ split[2] + "'" + "," +
            "'" + attach.getOriginalName() + "'" + "," +
            "'" + attach.getExtension() + "'" + "," +
            "'" + attach.getAttachSize() + "'" + "," +