智慧保安后台管理-外网
Administrator
2022-06-11 3a5d12b67221a19ff199846c19c4e74b71f3be84
图片,文件上传文件名修改
2 files modified
39 ■■■■ changed files
src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java 33 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/controller/UserController.java 6 ●●●● patch | view | raw | blame | history
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() + "'" + "," +
src/main/java/org/springblade/modules/system/controller/UserController.java
@@ -862,7 +862,7 @@
            minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucket).build());
            minioClient.setBucketPolicy(SetBucketPolicyArgs.builder().bucket(bucket).build());
        }
        String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "") + ".jpg";
        String newName = "upload/picture/f" + UUID.randomUUID().toString().replaceAll("-", "") + ".jpg";
        InputStream in = new ByteArrayInputStream(b);
        String[] split = newName.split("/");
        //创建头部信息
@@ -876,7 +876,7 @@
                .headers(headers)
                .build());
        InputStream inputStream = new ByteArrayInputStream(b);
        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();
        //外围url
        String urls = "http://61.131.136.25:2081/zhba/" + newName;
@@ -1595,7 +1595,7 @@
        User user1 = Objects.requireNonNull(BeanUtil.copy(user,User.class));
        //头像
        if (null != user.getAvatar() && !user.getAvatar().equals("")) {
            user1.setAvatar(FtpConfig.ip + user.getAvatar().substring(26));
            user1.setAvatar(FtpConfig.ip +"/"+ user.getAvatar().substring(26));
        }
        //指纹
        String url = "";