TencentFileServiceImpl.java 912 Bytes
package com.bs.fileservice.service.impl;

import com.bs.common.config.BsChatConfig;
import com.bs.common.utils.file.FileUploadUtils;
import com.bs.fileservice.service.IFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;


/**
 * 集成腾讯云oss
 */
@Service
@ConditionalOnProperty(prefix = "bs.file", value = "object", havingValue = "tencentOss")
public class TencentFileServiceImpl implements IFileService {

    @Autowired
    private BsChatConfig BsChatConfig;



    @Override
    public String uploadFile(MultipartFile file) throws Exception {


        return  BsChatConfig.getFile().getCos().getCosImgUrlPrefix()+FileUploadUtils.uploadTenantCos(file, BsChatConfig.getFile().getCos());
    }



}