添加关闭页面回调接口,添加token

This commit is contained in:
高嵩
2024-03-26 16:51:52 +08:00
parent f430311eed
commit 2c565c60fa
4 changed files with 41 additions and 1 deletions
@@ -108,6 +108,10 @@ public class OnlyOfficeController {
@Value("${byd.uploadFileUrl}")
private String bydUploadFileUrl;
@Value("${byd.unlockUrl}")
private String unlockUrl;
@ApiOperation(value = "分页查询")
@GetMapping("/pageList")
public Result<IPage<BusProcessModelHis>> pageList(HttpServletRequest req, BusProcessModelHis processModelHis,
@@ -521,6 +525,8 @@ public class OnlyOfficeController {
public Result<String> updateOnlineFileLogJxInfo(@RequestBody JSONObject json){
String jxFileName = json.getString("jxFileName");
String fileId = json.getString("fileId");
String appId = json.getString("appId");
String token = json.getString("Authorization");
String dataType = "1";
Date now = new Date();
@@ -547,7 +553,8 @@ public class OnlyOfficeController {
HttpHeaders headers2 = new HttpHeaders();
headers2.setContentType(MediaType.MULTIPART_FORM_DATA);
headers2.add("appId",appId);
headers2.add("Authorization",token);
// 创建MultiValueMap对象,用于存储请求参数
MultiValueMap<String, Object> params2 = new LinkedMultiValueMap<>();
@@ -577,6 +584,7 @@ public class OnlyOfficeController {
}catch (Exception ex){
ex.printStackTrace();
logger.error("基线版本文件上传失败:" + ex.getMessage());
return Result.error("更新基线信息失败!");
}
logger.info("基线版本文件上传接口结束==========================================");
@@ -587,6 +595,8 @@ public class OnlyOfficeController {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("appId",appId);
headers.add("Authorization",token);
// 创建MultiValueMap对象,用于存储请求参数
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
@@ -603,6 +613,7 @@ public class OnlyOfficeController {
}catch (Exception ex){
ex.printStackTrace();
logger.error("推送保存基线版本文件信息失败:" + ex.getMessage());
return Result.error("更新基线信息失败!");
}
logger.info("推送保存基线版本文件信息结束==========================================");
@@ -653,6 +664,32 @@ public class OnlyOfficeController {
return result;
}
@ApiOperation(value = "关闭页面回调接口")
@GetMapping("/onlyOfficeCloseTab")
public Result<String> onlyOfficeCloseTab(String fileId, String appId, String Authorization, HttpServletResponse response, HttpServletRequest request) {
try {
// String appId = request.getParameter("appId");
// String token = request.getParameter("Authorization");
String token = Authorization;
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("appId",appId);
headers.add("Authorization",token);
// 创建MultiValueMap对象,用于存储请求参数
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("fileId", fileId);
// 使用HttpEntity对象包装请求体和请求头
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers);
// 发送POST请求并获取响应
ResponseEntity<String> responseEntity = restTemplate.postForEntity(unlockUrl, requestEntity, String.class);
String body = responseEntity.getBody();
logger.info("关闭页面回调接口:" + body);
}catch (Exception ex){
ex.printStackTrace();
}
return Result.OK();
}
@ApiOperation(value = "|File|在线编辑下载docx文件")
@GetMapping("/onlyOfficeDownloadDocxFile")
@@ -236,4 +236,5 @@ byd:
saveBaseLineDocIdUrl: http://127.0.0.1:9998/saveBaseLineDocIdUrl
splitResultUrl: http://127.0.0.1:9998/splitResultUrl
downLoadFileUrl: http://127.0.0.1:9998/downLoadFileUrl
unlockUrl: http://127.0.0.1:9998/api/qbp/document/unlock
@@ -220,3 +220,4 @@ byd:
saveBaseLineDocIdUrl: http://127.0.0.1:9998/api/qbp/organization/saveBaseLineDocId
splitResultUrl: http://127.0.0.1:9998/api/qbp/library/structured
downLoadFileUrl: http://127.0.0.1:9998/ipd-files/file/downLoad
unlockUrl: http://127.0.0.1:9998/api/qbp/document/unlock
@@ -232,3 +232,4 @@ byd:
saveBaseLineDocIdUrl: http://127.0.0.1:9998/saveBaseLineDocIdUrl
splitResultUrl: http://127.0.0.1:9998/splitResultUrl
downLoadFileUrl: http://127.0.0.1:9998/downLoadFileUrl
unlockUrl: http://127.0.0.1:9998/api/qbp/document/unlock