22 changed files with 213 additions and 188 deletions
@ -1,42 +0,0 @@ |
|||
package com.bnyer.file.service; |
|||
|
|||
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; |
|||
|
|||
/** |
|||
* 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(); |
|||
} |
|||
} |
|||
@ -1,50 +0,0 @@ |
|||
package com.bnyer.file.service; |
|||
|
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.context.annotation.Primary; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
import com.bnyer.file.utils.FileUploadUtils; |
|||
|
|||
/** |
|||
* 本地文件存储 |
|||
* |
|||
* @author ruoyi |
|||
*/ |
|||
@Primary |
|||
@Service |
|||
public class LocalSysFileServiceImpl implements ISysFileService |
|||
{ |
|||
/** |
|||
* 资源映射路径 前缀 |
|||
*/ |
|||
@Value("${file.prefix}") |
|||
public String localFilePrefix; |
|||
|
|||
/** |
|||
* 域名或本机访问地址 |
|||
*/ |
|||
@Value("${file.domain}") |
|||
public String domain; |
|||
|
|||
/** |
|||
* 上传文件存储在本地的根路径 |
|||
*/ |
|||
@Value("${file.path}") |
|||
private String localFilePath; |
|||
|
|||
/** |
|||
* 本地文件上传接口 |
|||
* |
|||
* @param file 上传的文件 |
|||
* @return 访问地址 |
|||
* @throws Exception |
|||
*/ |
|||
@Override |
|||
public String uploadFile(MultipartFile file) throws Exception |
|||
{ |
|||
String name = FileUploadUtils.upload(localFilePath, file); |
|||
String url = domain + localFilePrefix + name; |
|||
return url; |
|||
} |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("抖音小程序用户修改信息接收类") |
|||
public class TiktokUserMiniDto implements Serializable { |
|||
|
|||
@NotNull(message = "用户id不能为空!") |
|||
@ApiModelProperty(value="id") |
|||
private Long id; |
|||
|
|||
@ApiModelProperty(value="用户昵称") |
|||
private String username; |
|||
|
|||
@ApiModelProperty(value="抖音号") |
|||
private String tiktokNumber; |
|||
|
|||
@ApiModelProperty(value="手机号") |
|||
private String phone; |
|||
|
|||
@ApiModelProperty(value="搜索码") |
|||
private String scanCode; |
|||
|
|||
@ApiModelProperty(value="个人简介") |
|||
private String intro; |
|||
|
|||
@ApiModelProperty(value="头像img地址") |
|||
private String img; |
|||
} |
|||
Loading…
Reference in new issue