1、脚本生成报告
2、onlyoffice接口
This commit is contained in:
@@ -447,7 +447,7 @@ public class DataFileController implements IDataFeignClient {
|
||||
*
|
||||
* @param fileId
|
||||
*/
|
||||
@PostMapping("/downloadFileForEdit")
|
||||
@GetMapping("/downloadFileForEdit")
|
||||
@Operation(summary = "根据fileId下载文件到指定目录并返回该文件的系统路径", description = "根据fileId下载文件到指定目录并返回该文件的系统路径")
|
||||
public SdmResponse downloadFileForEdit(@RequestParam(value = "fileId") @Validated Long fileId) {
|
||||
return IDataFileService.downloadFileForEdit(fileId);
|
||||
|
||||
@@ -152,9 +152,9 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
// return type;
|
||||
// }
|
||||
|
||||
private static final String TEMP_FILE_PATH = "D:\\nginx-1.28.0\\html\\static\\";
|
||||
private static final String TEMP_FILE_PATH = "/usr/local/nginx/html/storage/";
|
||||
|
||||
private static final String TEMP_NG_URL = "http://192.168.65.199:10031/static/";
|
||||
private static final String TEMP_NG_URL = "http://192.168.65.161:10031/storage/";
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -2416,6 +2416,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
@Override
|
||||
public ResponseEntity<Object> onlyOfficeCallback(CallbackData callbackData) {
|
||||
log.info("调用回调接口,url:{}",callbackData.getUrl());
|
||||
log.info("调用回调接口key:{}",callbackData.getKey());
|
||||
log.info("调用回调接口status:{}",callbackData.getStatus());
|
||||
//状态监听
|
||||
//参见https://api.onlyoffice.com/editors/callback
|
||||
Integer status = callbackData.getStatus();
|
||||
@@ -2449,13 +2451,13 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
case 6: {
|
||||
//document is being edited, but the current document state is saved,编辑保存
|
||||
String prefixUrl = "D:\\software\\docker_file\\onlyoffice-de\\lib\\documentserver\\App_Data\\cache\\files\\data";
|
||||
String prefixUrl = "/home/onlyoffice/lib/documentserver/App_Data/cache/files/data";
|
||||
String url = callbackData.getUrl();
|
||||
url = url.substring(url.indexOf("data") + 5,url.indexOf("output.docx") - 1);
|
||||
log.info("动态路径为:{}",url);
|
||||
url = prefixUrl + File.separator + url + File.separator + "output.docx";
|
||||
log.info("最终路径为:{}",url);
|
||||
String fileId = callbackData.getKey();
|
||||
String fileId = callbackData.getKey().split("_")[0];
|
||||
try {
|
||||
Path path = Paths.get(url);
|
||||
uploadNewFile(fileId,path);
|
||||
@@ -2527,6 +2529,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
outputStream.close();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("url",TEMP_NG_URL + randomId + "/" + fileMetadataInfo.getOriginalName());
|
||||
jsonObject.put("fileName",fileMetadataInfo.getOriginalName());
|
||||
jsonObject.put("fileType",fileMetadataInfo.getOriginalName().substring(fileMetadataInfo.getOriginalName().lastIndexOf(".") + 1));
|
||||
return SdmResponse.success(jsonObject);
|
||||
} catch (Exception e) {
|
||||
log.error("onlyoffice编辑文件失败", e);
|
||||
|
||||
Reference in New Issue
Block a user