|
@@ -1,10 +1,10 @@
|
|
|
package com.github.jfcloud.excel.editor.docdeal.controller;
|
|
|
|
|
|
-
|
|
|
import cn.hutool.core.io.IoUtil;
|
|
|
import cn.hutool.core.io.file.FileNameUtil;
|
|
|
import cn.hutool.core.lang.Pair;
|
|
|
import cn.hutool.core.net.URLEncodeUtil;
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.http.HttpResponse;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
@@ -112,7 +112,7 @@ public class FileController {
|
|
|
try {
|
|
|
if (size < 0) {
|
|
|
log.error("文档不存在 name={}, bucket={}", name, bucket);
|
|
|
- response.getWriter().println("Sorry, we cannot find the file, pls check the file name and try again.");
|
|
|
+ response.getWriter().println("Sorry, we cannot find the file, pls check the file name and try again. --" + System.currentTimeMillis());
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -152,15 +152,15 @@ public class FileController {
|
|
|
|
|
|
title = StrUtil.isBlank(title) ? name : title;
|
|
|
bucket = StrUtil.isBlank(bucket) ? ossProperties.getBucketName() : bucket;
|
|
|
-
|
|
|
- String downloadUrl = String.format(DocumentConstants.OFFICE_API_DOC_FILE, serverUrl, name);
|
|
|
- downloadUrl += "&bucket=" + bucket;
|
|
|
+ String downloadUrl = String.format(DocumentConstants.OFFICE_API_DOC_FILE_BUCKET, serverUrl, name, bucket) + "&_t=" + System.currentTimeMillis();
|
|
|
|
|
|
Document document = Document.builder()
|
|
|
- .key(FileNameUtil.getPrefix(name))
|
|
|
+ .key(IdUtil.fastSimpleUUID())
|
|
|
.title(title)
|
|
|
.fileType(FileNameUtil.getSuffix(name))
|
|
|
.url(downloadUrl)
|
|
|
+ .storage(bucket)
|
|
|
+ .len(ossTemplate.getSize(bucket, name))
|
|
|
.permissions(new JSONObject()
|
|
|
.fluentPut("chat", true)
|
|
|
.fluentPut("comment", true)
|
|
@@ -178,6 +178,7 @@ public class FileController {
|
|
|
.build();
|
|
|
log.info("document: {}", JSON.toJSONString(document));
|
|
|
|
|
|
+ //回调接口回传文档名称和存储桶
|
|
|
DocumentEditParam param = DocumentEditParam.builder()
|
|
|
.callbackUrl(String.format(DocumentConstants.OFFICE_API_CALLBACK_BUCKET, serverUrl, name, bucket))
|
|
|
.user(new DocumentEditParam.UserBean(userId, userName))
|