feat: 在线编辑创建空文件并映射外部

This commit is contained in:
2024-01-22 17:20:14 +08:00
parent bc1f52a05b
commit 8667a2e3bf
6 changed files with 18 additions and 13 deletions
@@ -38,6 +38,8 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
private String webAppPath;
@Value("${spring.resource.static-locations}")
private String staticLocations;
@Value("${file.path}")
private String filePath;
/**
* 静态资源的配置 - 使得可以从磁盘中读取 Html、图片、视频、音频等
@@ -47,6 +49,10 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
registry.addResourceHandler("/**")
.addResourceLocations("file:" + upLoadPath + "//", "file:" + webAppPath + "//")
.addResourceLocations(staticLocations.split(","));
// 映射在线编辑文件存储路径
registry.addResourceHandler("/file/**")
.addResourceLocations("file:" + filePath);
}
/**
@@ -144,6 +144,7 @@ public class ShiroConfig {
//onlyoffice排除
filterChainDefinitionMap.put("/onlyOffice/**", "anon");
filterChainDefinitionMap.put("/file/**", "anon");
//对接接口排除
filterChainDefinitionMap.put("/sync/**", "anon");
@@ -301,7 +301,6 @@ public class OnlyOfficeController {
@ApiOperation(value = "|model| 传入 模板文档名称(不带后缀)默认 docx")
@GetMapping("/saveEditFile")
public Result<BusProcessModelHis> saveEditFile(String model) {
return Result.OK(busProcessModelHisService.saveEditFile(model));
}
@@ -57,11 +57,9 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
String taskId = "task_" + changUuid;
String topId = "top_" + changUuid;
StringBuilder builderModel = new StringBuilder();
builderModel.append("model").append("/");
builderModel.append("model").append("/");
String builderModel = "model" + "/";
File dir = new File(filePath + builderModel.toString());
File dir = new File(filePath + builderModel);
if (!dir.exists()) {
dir.mkdirs();
}
@@ -86,6 +84,7 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
modelHis.setTaskId(taskId);
modelHis.setPId(topId);
modelHis.setEditFilePath(targetPath);
modelHis.setDownLoadUrl(downloadUrl + targetPath);
this.baseMapper.insert(modelHis);
} catch (Exception e) {
logger.error(e.getMessage());
@@ -376,11 +376,11 @@ justauth:
timeout: 1h
file:
downloadUrl: a
downloadUrl: http://localhost:8184/laws-sinotruk/file/
split:
path: D://opt//onlyoffice//file//splitImage/
sourceFilePath: D://opt//onlyoffice//sourceFile//DOCX.docx
path: D://opt//onlyoffice//file//
path: D://opt//onlyOffice//file//splitImage//
sourceFilePath: D://opt//onlyOffice//DOCX.docx
path: D:/opt/onlyOffice/file/
iam:
bimRemoteUser: srmsIam
@@ -349,11 +349,11 @@ justauth:
timeout: 1h
file:
downloadUrl: a
downloadUrl: http://localhost:8184/laws-sinotruk/file/
split:
path: /opt/onlyoffice/file/splitImage/
sourceFilePath: /app/onlyoffice/DOCX.docx
path: /app/onlyoffice/file/
path: /opt/onlyOffice/file/splitImage/
sourceFilePath: /opt/onlyOffice/DOCX.docx
path: /opt/onlyOffice/file/
iam:
bimRemoteUser: srmsIam