|
|
@@ -81,29 +81,39 @@ public class OnlyServiceAPIImpl implements OnlyServiceAPI {
|
|
81
|
81
|
return documentEdit(map, collaborativeEditing, clientType);
|
|
82
|
82
|
}
|
|
83
|
83
|
if (VIEW.equals(mode)) {
|
|
84
|
|
- return documentView(map, clientType);
|
|
|
84
|
+ return documentView(map, collaborativeEditing, clientType);
|
|
85
|
85
|
}
|
|
|
86
|
+// if (VIEW.equals(mode)) {
|
|
|
87
|
+// return documentView(map, clientType);
|
|
|
88
|
+// }
|
|
86
|
89
|
return null;
|
|
87
|
90
|
}
|
|
88
|
91
|
|
|
89
|
92
|
private Map documentEdit(Map<String, Object> map, boolean collaborativeEditing, String clientType) {
|
|
90
|
|
- FileConfig fileConfigDTO = openEditConfig(map, "edit", collaborativeEditing,clientType);
|
|
|
93
|
+ FileConfig fileConfigDTO = openEditConfig(map, "edit", collaborativeEditing, clientType);
|
|
91
|
94
|
String json = JSON.toJSONString(fileConfigDTO);
|
|
92
|
95
|
Map<String, Object> config = JSON.parseObject(json, Map.class);
|
|
93
|
96
|
config.put("type", clientType);
|
|
94
|
97
|
return config;
|
|
95
|
98
|
}
|
|
96
|
99
|
|
|
|
100
|
+ private Map documentView(Map<String, Object> map, boolean collaborativeEditing, String clientType) {
|
|
|
101
|
+ FileConfig fileConfigDTO = openEditConfig(map, "view", collaborativeEditing, clientType);
|
|
|
102
|
+ String json = JSON.toJSONString(fileConfigDTO);
|
|
|
103
|
+ Map<String, Object> config = JSON.parseObject(json, Map.class);
|
|
|
104
|
+ config.put("type", clientType);
|
|
|
105
|
+ return config;
|
|
|
106
|
+ }
|
|
97
|
107
|
|
|
98
|
|
- private Map documentView(Map<String, Object> map,String clientType) {
|
|
99
|
|
- FileConfig fileConfigDTO = openEditConfig(map, "view", false,clientType);
|
|
|
108
|
+ private Map documentView(Map<String, Object> map, String clientType) {
|
|
|
109
|
+ FileConfig fileConfigDTO = openEditConfig(map, "view", false, clientType);
|
|
100
|
110
|
String json = JSON.toJSONString(fileConfigDTO);
|
|
101
|
111
|
Map<String, Object> config = JSON.parseObject(json, Map.class);
|
|
102
|
112
|
config.put("type", clientType);
|
|
103
|
113
|
return config;
|
|
104
|
114
|
}
|
|
105
|
115
|
|
|
106
|
|
- private FileConfig openEditConfig(Map<String, Object> map, String mode, boolean collaborativeEditing,String clientType) {
|
|
|
116
|
+ private FileConfig openEditConfig(Map<String, Object> map, String mode, boolean collaborativeEditing, String clientType) {
|
|
107
|
117
|
try {
|
|
108
|
118
|
map.put("mode", mode);
|
|
109
|
119
|
log.info("开始生成文件信息");
|
|
|
@@ -111,7 +121,7 @@ public class OnlyServiceAPIImpl implements OnlyServiceAPI {
|
|
111
|
121
|
FileMetadata tempFileInfo = fileHandler.handlerFile(map, collaborativeEditing);
|
|
112
|
122
|
//生成配置文件 TODO: 控制文件权限
|
|
113
|
123
|
log.info("开始生成编辑器配置信息");
|
|
114
|
|
- FileConfig fileConfigDTO = onlyOfficeConfigFactory.buildInitConfig(tempFileInfo.getUrl(), mode, tempFileInfo.getKey(), tempFileInfo.getOldName(),clientType);
|
|
|
124
|
+ FileConfig fileConfigDTO = onlyOfficeConfigFactory.buildInitConfig(tempFileInfo.getUrl(), mode, tempFileInfo.getKey(), tempFileInfo.getOldName(), clientType);
|
|
115
|
125
|
log.info("生成编辑器配置信息结束");
|
|
116
|
126
|
// TODO: 添加更多详细的自定义信息
|
|
117
|
127
|
return fileConfigDTO;
|
|
|
@@ -160,7 +170,7 @@ public class OnlyServiceAPIImpl implements OnlyServiceAPI {
|
|
160
|
170
|
@Override
|
|
161
|
171
|
public OnFile handlerStatus(JSONObject jsonObject) throws Exception {
|
|
162
|
172
|
OnFile file = new OnFile();
|
|
163
|
|
- String fileId = null;
|
|
|
173
|
+ String fileId = jsonObject.getString("fileId");
|
|
164
|
174
|
log.info("开始下载编辑器文件");
|
|
165
|
175
|
int status = jsonObject.getIntValue("status");
|
|
166
|
176
|
log.info("status[{}]:{}", status, jsonObject);
|
|
|
@@ -192,10 +202,11 @@ public class OnlyServiceAPIImpl implements OnlyServiceAPI {
|
|
192
|
202
|
if (caseId != null) {
|
|
193
|
203
|
fileInfoMap.put("caseId", caseId);
|
|
194
|
204
|
}
|
|
195
|
|
- saveFileProcessor.saveBeforeInitialization(tempFile.get().getFileInfo(), fileByte, fileExtension);
|
|
|
205
|
+ //保存文件前进行自定义处理(该方法暂时没有实现业务逻辑)
|
|
|
206
|
+ //saveFileProcessor.saveBeforeInitialization(tempFile.get().getFileInfo(), fileByte, fileExtension);
|
|
196
|
207
|
|
|
197
|
208
|
// 保存文件
|
|
198
|
|
- Map<String, Object> map = saveFileProcessor.save(tempFile.get().getFileInfo(), fileByte, changes, key);
|
|
|
209
|
+ Map<String, Object> map = saveFileProcessor.save(tempFile.get().getFileInfo(), fileByte, changes, fileId);
|
|
199
|
210
|
log.info("文件信息1:" + JSON.toJSONString(tempFile.get().getFileInfo()));
|
|
200
|
211
|
log.info("文件信息2:" + JSON.toJSONString(map));
|
|
201
|
212
|
saveFileProcessor.saveAfterInitialization(tempFile.get().getFileInfo(), fileByte, fileExtension);
|
|
|
@@ -300,7 +311,8 @@ public class OnlyServiceAPIImpl implements OnlyServiceAPI {
|
|
300
|
311
|
log.info("文件变动信息文件url:" + changesurl);
|
|
301
|
312
|
// 下载修改后文件
|
|
302
|
313
|
byte[] fileByte = FileUtil.getFileByte(url);
|
|
303
|
|
- saveFileProcessor.save(tempFile.getFileInfo(), fileByte, null, jsonObject.getString("key"));
|
|
|
314
|
+ saveFileProcessor.save(tempFile.getFileInfo(), fileByte, null, jsonObject.getString("fileId"));
|
|
|
315
|
+ log.info("zouzhele==================");
|
|
304
|
316
|
}
|
|
305
|
317
|
removeTempFile(jsonObject);
|
|
306
|
318
|
String id = (String) cache.get("getID_" + jsonObject.getString("key"));
|