13 changed files with 416 additions and 58 deletions
@ -0,0 +1,162 @@ |
|||
package com.ccsens.tall.bean.vo; |
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.annotation.JSONField; |
|||
import com.ccsens.tall.bean.po.WpsFile; |
|||
import com.ccsens.util.WebConstant; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @description: wps相关接口返回值 |
|||
* @author: whj |
|||
* @time: 2020/6/18 10:21 |
|||
*/ |
|||
@ApiModel("wps相关接口返回值") |
|||
public class WpsVo { |
|||
|
|||
@ApiModel("文件保存返回信息") |
|||
@Data |
|||
public static class FileSave { |
|||
@ApiModelProperty("文件基本信息") |
|||
private FileBase file; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("文件基本信息") |
|||
public static class FileBase { |
|||
@ApiModelProperty("文件id,字符串长度小于40") |
|||
private String id; |
|||
@ApiModelProperty("文件名") |
|||
private String name; |
|||
@ApiModelProperty("当前版本号,位数小于11") |
|||
private Integer version; |
|||
@ApiModelProperty("文件大小,单位为B") |
|||
private Integer size; |
|||
@ApiModelProperty("文档下载地址") |
|||
private String download_url; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("文件信息查询返回") |
|||
public static class FileInfo{ |
|||
@ApiModelProperty("文件信息") |
|||
private File file; |
|||
@ApiModelProperty("用户信息") |
|||
private User user; |
|||
} |
|||
|
|||
@ApiModel("文件信息") |
|||
@Data |
|||
public static class File{ |
|||
@ApiModelProperty("文件id,字符串长度小于40") |
|||
private String id; |
|||
@ApiModelProperty("文件名") |
|||
private String name; |
|||
@ApiModelProperty("当前版本号,位数小于11") |
|||
private Integer version; |
|||
@ApiModelProperty("文件大小,单位为B") |
|||
private Integer size; |
|||
@ApiModelProperty("文档下载地址") |
|||
private String download_url; |
|||
@ApiModelProperty("创建者id,字符串长度小于40") |
|||
private String creator; |
|||
@ApiModelProperty("创建时间,时间戳,单位为秒") |
|||
private Long create_time; |
|||
@ApiModelProperty("修改者id,字符串长度小于40") |
|||
private String modifier; |
|||
@ApiModelProperty("修改时间,时间戳,单位为秒") |
|||
private Long modify_time; |
|||
@ApiModelProperty("用户权限") |
|||
private UserAcl user_acl = new UserAcl(); |
|||
@ApiModelProperty("水印") |
|||
private Watermark watermark; |
|||
|
|||
public File(String id, String name, Integer version, Integer size, String download_url, String creator, Long create_time, String modifier, Long modify_time) { |
|||
this.id = id; |
|||
this.name = name; |
|||
this.version = version; |
|||
this.size = size; |
|||
this.download_url = download_url; |
|||
this.creator = creator; |
|||
this.create_time = create_time; |
|||
this.modifier = modifier; |
|||
this.modify_time = modify_time; |
|||
} |
|||
|
|||
public static File beanToVo(WpsFile wpsFile, String name) { |
|||
File file = new File(wpsFile.getId()+"", wpsFile.getName(), |
|||
wpsFile.getCurrentVersion(), wpsFile.getSize(), |
|||
wpsFile.getDownloadUrl(), wpsFile.getCreator() + "", |
|||
wpsFile.getCreatedAt().getTime()/1000, |
|||
wpsFile.getModifier() + "", |
|||
wpsFile.getUpdatedAt().getTime()/1000 |
|||
); |
|||
Watermark watermark = new Watermark(StrUtil.isEmpty(name) ? WebConstant.DEFAULT_NICKNAME : name); |
|||
file.watermark = watermark; |
|||
return file; |
|||
} |
|||
} |
|||
|
|||
@ApiModel("用户信息") |
|||
@Data |
|||
public static class User{ |
|||
@ApiModelProperty("用户id") |
|||
private String id; |
|||
@ApiModelProperty("用户名称") |
|||
private String name; |
|||
@ApiModelProperty("用户操作权限,write:可编辑,read:预览") |
|||
private String permission = WebConstant.Wps.PERMISSION_READ; |
|||
@ApiModelProperty("用户头像地址") |
|||
private String avatar_url; |
|||
|
|||
public static User getInstance(UserVo.UserInfo userInfo) { |
|||
User user = new User(); |
|||
user.setId(String.valueOf(userInfo.getId())); |
|||
user.setName(userInfo.getNickname()); |
|||
user.setAvatar_url(userInfo.getAvatarUrl()); |
|||
return user; |
|||
} |
|||
} |
|||
|
|||
@ApiModel("用户权限信息") |
|||
@Data |
|||
public static class UserAcl{ |
|||
@ApiModelProperty("重命名权限,1为打开该权限,0为关闭该权限,默认为0") |
|||
private Byte rename = 1; |
|||
@ApiModelProperty("历史版本权限,1为打开该权限,0为关闭该权限,默认为1") |
|||
private Byte history = 1; |
|||
@ApiModelProperty("复制") |
|||
private Byte copy = 1; |
|||
@ApiModelProperty("导出PDF") |
|||
private Byte export = 1; |
|||
@ApiModelProperty("打印") |
|||
private Byte print = 1; |
|||
|
|||
} |
|||
|
|||
@ApiModel("水印信息") |
|||
@Data |
|||
public static class Watermark{ |
|||
@ApiModelProperty("水印类型, 0为无水印; 1为文字水印") |
|||
private Byte type; |
|||
@ApiModelProperty("文字水印的文字,当type为1时此字段必选") |
|||
private String value; |
|||
@ApiModelProperty("水印的透明度,非必选,有默认值") |
|||
private String fillstyle; |
|||
@ApiModelProperty("水印的字体,非必选,有默认值") |
|||
private String font; |
|||
@ApiModelProperty("水印的旋转度,非必选,有默认值") |
|||
private String rotate; |
|||
@ApiModelProperty("水印水平间距,非必选,有默认值") |
|||
private String horizontal; |
|||
@ApiModelProperty("水印垂直间距,非必选,有默认值") |
|||
private String vertical; |
|||
|
|||
public Watermark(String value) { |
|||
this.type = 1; |
|||
this.value = value; |
|||
} |
|||
} |
|||
} |
@ -1,4 +1,30 @@ |
|||
package com.ccsens.tall.service; |
|||
|
|||
import com.ccsens.tall.bean.dto.WpsDto; |
|||
import com.ccsens.tall.bean.vo.WpsVo; |
|||
|
|||
import javax.servlet.http.Part; |
|||
|
|||
/** |
|||
* @author whj |
|||
*/ |
|||
public interface IWpsService { |
|||
/** |
|||
* 获取文件元数据 |
|||
* @param fileId |
|||
* @param token |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
WpsVo.FileInfo getFileInfo(String fileId, String token) throws Exception; |
|||
|
|||
/** |
|||
* 上传文件新版本 |
|||
* @param token |
|||
* @param fileId |
|||
* @param fileSave |
|||
* @param file |
|||
* @return |
|||
*/ |
|||
WpsVo.FileSave fileSave(String token, String fileId, WpsDto.FileSave fileSave, Part file); |
|||
} |
|||
|
Loading…
Reference in new issue