xiangpei
2024-09-11 66232862129c84f2c98fabdc73a59f4fe0e0a360
视频专网端代码初始化
3个文件已修改
89 ■■■■■ 已修改文件
ruoyi-admin/src/main/resources/application-prod.yml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysOssController.java 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/sync/VideoPulSync.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-prod.yml
@@ -46,12 +46,12 @@
#          url: jdbc:mysql://123.207.71.245:13306/qysp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
#          username: root
#          password: 234#Wersdf!
          url: jdbc:mysql://80.36.32.176:3306/qysp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
          username: root
          password: 234#Wersdf!
#          url: jdbc:mysql://51.9.57.211:3306/qysp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
#          url: jdbc:mysql://80.36.32.176:3306/qysp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
#          username: root
#          password: 234#Wersdf!
          url: jdbc:mysql://51.9.57.211:3306/qysp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
          username: root
          password: 234#Wersdf!
#          url: jdbc:mysql://172.35.50.34:3306/qysp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
#          username: root
#          password: 234#Wersdf!
@@ -105,7 +105,7 @@
spring.data:
  redis:
    # 地址
    host: 80.36.32.176
    host: 127.0.0.1
    # 端口,默认为6379
    port: 6379
    password: 234#Wersdf!
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysOssController.java
@@ -89,47 +89,47 @@
        return R.ok(list);
    }
//    /**
//     * 上传OSS对象存储  视频专网
//     *
//     * @param file 文件
//     */
//    @SaCheckPermission("system:oss:upload")
//    @Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
//    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
//    public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file) throws IOException {
//
//        if (ObjectUtil.isNull(file)) {
//            return R.fail("上传文件不能为空");
//        }
//        SysOssVo oss = ossService.upload(file);
//
//        SysOssUploadVo uploadVo = new SysOssUploadVo();
//        uploadVo.setUrl(oss.getUrl());
//        uploadVo.setFileName(oss.getOriginalName());
//        uploadVo.setOssId(oss.getOssId().toString());
//        uploadVo.setPassword(oss.getPassword());
//
//        return R.ok(uploadVo);
//    }
    /**
     * 上传OSS对象存储  互联网
     * 上传OSS对象存储  视频专网
     *
     * @param file 文件
     */
    @SaCheckPermission("system:oss:upload")
    @Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public R<String> upload(@RequestPart("file") MultipartFile file) throws IOException {
        String originalfileName = file.getOriginalFilename();
        long l = System.currentTimeMillis();
        String password = PasswordUtil.randomPassword(6);
        String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length());
        FtpApche.uploadFile(ftpConfig, file, password + String.valueOf(l) + suffix);
        return R.ok(password);
    public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file) throws IOException {
        if (ObjectUtil.isNull(file)) {
            return R.fail("上传文件不能为空");
        }
        SysOssVo oss = ossService.upload(file);
        SysOssUploadVo uploadVo = new SysOssUploadVo();
        uploadVo.setUrl(oss.getUrl());
        uploadVo.setFileName(oss.getOriginalName());
        uploadVo.setOssId(oss.getOssId().toString());
        uploadVo.setPassword(oss.getPassword());
        return R.ok(uploadVo);
    }
//    /**
//     * 上传OSS对象存储  互联网
//     *
//     * @param file 文件
//     */
//    @SaCheckPermission("system:oss:upload")
//    @Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
//    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
//    public R<String> upload(@RequestPart("file") MultipartFile file) throws IOException {
//        String originalfileName = file.getOriginalFilename();
//        long l = System.currentTimeMillis();
//        String password = PasswordUtil.randomPassword(6);
//        String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length());
//        FtpApche.uploadFile(ftpConfig, file, password + String.valueOf(l) + suffix);
//        return R.ok(password);
//    }
//
    private String post(VideoRequest request) throws IOException {
        HashMap<String, String> headers = new HashMap<>(3);
        String requestUrl = boundary.getChief() + "/resource/synchronization/uploadTwo";
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/sync/VideoPulSync.java
@@ -53,24 +53,15 @@
            return;
        }
        for (String str : list) {
            //密码
            String password = str.substring(0,6);
            //文件名称
            String fileName = str.substring(6,str.length());
            InputStream input = FtpApche.downloadFileFromDailyDir(str);
            byte[] fileBytesByName = FtpApche.getFileBytesByName(input);
            OssClient storage = OssFactory.instance();
            MultipartFile file = new MockMultipartFile(fileName,fileName, fileName.substring(14,fileName.length()), input);
//            UploadResult uploadResult = storage.upload(input,getPath(fileName),"multipart/form-data; charset=ISO-8859-1");
            UploadResult uploadResult;
//            try {
                uploadResult = storage.uploadSuffix2(fileBytesByName, getPath(fileName), "multipart/form-data; charset=ISO-8859-1");
            MockMultipartFile mockMultipartFile = new MockMultipartFile(fileName, fileName, fileName.substring(14, fileName.length()), input);
            UploadResult uploadResult = storage.uploadSuffix2(fileBytesByName, getPath(fileName), "multipart/form-data; charset=ISO-8859-1");
            FtpApche.deleteFile(str);
            input.close();
//            buildResultEntity(fileName, fileName.substring(14,fileName.length()), "minio", uploadResult, file,
//                password, fileBytesByName);
            buildResultEntity(fileName, fileName.substring(14, fileName.length()), "minio", uploadResult, (MultipartFile)mockMultipartFile, password, fileBytesByName);
        }
    }