|
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -42,6 +43,8 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
|
|
|
private IWpsUserService wpsUserService;
|
|
|
@Autowired
|
|
|
private WpsUtil wpsUtil;
|
|
|
+
|
|
|
+ private static final String OSS_URL_PREFIX = "https://ctop-media.oss-cn-beijing.aliyuncs.com/script-lib/wps/";
|
|
|
@Override
|
|
|
public Token getViewUrl(String fileUrl, boolean checkToken){
|
|
|
Token t = new Token();
|
|
@@ -146,14 +149,12 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
|
|
|
BeanUtils.copyProperties(userAclEntity,userAcl);
|
|
|
permission = userAclEntity.getPermission();
|
|
|
}
|
|
|
- log.info("permission:{}",permission);
|
|
|
// 增加水印
|
|
|
WpsFileWatermark watermarkEntity = wpsFileWatermarkService.findFirstByFileId(fileId);
|
|
|
WatermarkBO watermark = new WatermarkBO();
|
|
|
if (watermarkEntity != null){
|
|
|
BeanUtils.copyProperties(watermarkEntity,watermark);
|
|
|
}
|
|
|
- log.info("mark:{}",watermark.toString());
|
|
|
//获取user
|
|
|
WpsUser wpsUser = wpsUserService.getById(userId);
|
|
|
UserDTO user = new UserDTO();
|
|
@@ -165,13 +166,13 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
|
|
|
// 构建fileInfo
|
|
|
FileDTO file = new FileDTO();
|
|
|
BeanUtils.copyProperties(fileEntity,file);
|
|
|
- file.setDownload_url("https://ctop-media.oss-cn-beijing.aliyuncs.com/script-lib/wps/%E5%B7%A5%E4%BD%9C%E8%AE%A1%E5%88%92%E6%97%A5%E7%A8%8B%E8%A1%A820200618131143825.docx");
|
|
|
+ String url = fileEntity.getDownloadUrl();
|
|
|
+ url = URLEncoder.encode(url.replace(OSS_URL_PREFIX,""));
|
|
|
+ file.setDownload_url(OSS_URL_PREFIX+url);
|
|
|
file.setUser_acl(userAcl);
|
|
|
file.setWatermark(watermark);
|
|
|
result.put("file",file);
|
|
|
result.put("user",user);
|
|
|
- log.info("file:{}",file.toString());
|
|
|
- log.info("user:{}",user.toString());
|
|
|
return result;
|
|
|
}
|
|
|
|