12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- package com.boman.file.service;
- import com.alibaba.fastjson.JSONObject;
- import com.boman.domain.dto.ImportExcelDto;
- import org.apache.commons.io.FilenameUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Service;
- import org.springframework.web.multipart.MultipartFile;
- import com.github.tobato.fastdfs.domain.fdfs.StorePath;
- import com.github.tobato.fastdfs.service.FastFileStorageClient;
- import java.io.IOException;
- import java.util.List;
- /**
- * FastDFS 文件存储
- *
- * @author ruoyi
- */
- @Service
- public class FastDfsSysFileServiceImpl implements ISysFileService
- {
- /**
- * 域名或本机访问地址
- */
- @Value("${fdfs.domain}")
- public String domain;
- @Autowired
- private FastFileStorageClient storageClient;
- /**
- * FastDfs文件上传接口
- *
- * @param file 上传的文件
- * @return 访问地址
- * @throws Exception
- */
- @Override
- public String uploadFile(MultipartFile file) throws Exception
- {
- StorePath storePath = storageClient.uploadFile(file.getInputStream(), file.getSize(),
- FilenameUtils.getExtension(file.getOriginalFilename()), null);
- return domain + "/" + storePath.getFullPath();
- }
- /**
- * 功能描述: 上传base64
- *
- * @param base64 base64
- * @return java.lang.String
- */
- @Override
- public String uploadFileBase64(String base64) throws IOException {
- return null;
- }
- /**
- * 功能描述: 通用的导入接口
- *
- * @param multipartFile multipartFile
- * @param tableName tableName
- * @return java.util.List<com.alibaba.fastjson.JSONObject>
- */
- @Override
- public List<JSONObject> importExcelCommon(ImportExcelDto dto) {
- return null;
- }
- /**
- * 功能描述: 通用的导入接口
- *
- * @param multipartFile multipartFile
- * @param tableName tableName
- * @return java.util.List<com.alibaba.fastjson.JSONObject>
- */
- @Override
- public List<JSONObject> importExcelCommon(MultipartFile multipartFile, String tableName) throws Exception {
- return null;
- }
- }
|