修改对接接口

This commit is contained in:
高嵩
2024-03-27 10:53:26 +08:00
parent 71be39b7c8
commit 87a684f762
5 changed files with 13 additions and 12 deletions
@@ -67,6 +67,7 @@ public class DockingController {
String title = json.getString("title"); String title = json.getString("title");
String docId = json.getString("docId"); String docId = json.getString("docId");
String filePath = json.getString("filePath"); String filePath = json.getString("filePath");
String token = json.getString("token");
SarFileSplitInfoEO sarFileSplitInfoEO = new SarFileSplitInfoEO(); SarFileSplitInfoEO sarFileSplitInfoEO = new SarFileSplitInfoEO();
sarFileSplitInfoEO.setFileName(fileName); sarFileSplitInfoEO.setFileName(fileName);
@@ -75,7 +76,7 @@ public class DockingController {
sarFileSplitInfoEO.setTitle(title); sarFileSplitInfoEO.setTitle(title);
sarFileSplitInfoEO.setId(docId); sarFileSplitInfoEO.setId(docId);
sarFileSplitInfoEO.setFilePath(filePath); sarFileSplitInfoEO.setFilePath(filePath);
documentSplitService.add(sarFileSplitInfoEO, CommonConstant.SPLIT_SOURCE_2); documentSplitService.add(token,sarFileSplitInfoEO, CommonConstant.SPLIT_SOURCE_2);
Map<String,String> resultMap = new HashMap<>(); Map<String,String> resultMap = new HashMap<>();
resultMap.put("infoId",docId); resultMap.put("infoId",docId);
@@ -140,7 +140,7 @@ public class DocumentSplitController {
@PostMapping(value = "/split") @PostMapping(value = "/split")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
public Result<T> split(@Validated @RequestBody SarFileSplitInfoEO sarFileSplitInfoEO) { public Result<T> split(@Validated @RequestBody SarFileSplitInfoEO sarFileSplitInfoEO) {
documentSplitService.add(sarFileSplitInfoEO, CommonConstant.SPLIT_SOURCE_1); documentSplitService.add("",sarFileSplitInfoEO, CommonConstant.SPLIT_SOURCE_1);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK)); return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
} }
@@ -66,7 +66,7 @@ public interface IDocumentSplitService {
* 文档拆分-拆分 * 文档拆分-拆分
* @param sarFileSplitInfoEO * @param sarFileSplitInfoEO
*/ */
void add(SarFileSplitInfoEO sarFileSplitInfoEO,String splitSource); void add(String token,SarFileSplitInfoEO sarFileSplitInfoEO,String splitSource);
/** /**
* 拆分文档保存 * 拆分文档保存
@@ -312,9 +312,7 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
} }
@Override @Override
public void add(SarFileSplitInfoEO sarFileSplitInfoEO,String splitSource) { public void add(String token,SarFileSplitInfoEO sarFileSplitInfoEO,String splitSource) {
// // 企标权限校验
// enterpriseCheck(sarFileSplitInfoEO);
// 唯一校验 // 唯一校验
uniqueCheck(sarFileSplitInfoEO); uniqueCheck(sarFileSplitInfoEO);
// 保存文本拆分数据 // 保存文本拆分数据
@@ -338,6 +336,7 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("Authorization",token);
// 创建MultiValueMap对象,用于存储请求参数 // 创建MultiValueMap对象,用于存储请求参数
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
@@ -368,7 +367,6 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
} }
}); });
thread.start(); thread.start();
} }
@Override @Override
@@ -526,7 +526,7 @@ public class OnlyOfficeController {
String jxFileName = json.getString("jxFileName"); String jxFileName = json.getString("jxFileName");
String fileId = json.getString("fileId"); String fileId = json.getString("fileId");
String appId = json.getString("appId"); String appId = json.getString("appId");
String token = json.getString("Authorization"); String token = json.getString("token");
String dataType = "1"; String dataType = "1";
Date now = new Date(); Date now = new Date();
@@ -610,6 +610,11 @@ public class OnlyOfficeController {
ResponseEntity<String> responseEntity = restTemplate.postForEntity(bydSaveBaseLineDocIdUrl, requestEntity, String.class); ResponseEntity<String> responseEntity = restTemplate.postForEntity(bydSaveBaseLineDocIdUrl, requestEntity, String.class);
String body = responseEntity.getBody(); String body = responseEntity.getBody();
logger.info("推送保存基线版本文件信息结果:" + body); logger.info("推送保存基线版本文件信息结果:" + body);
JSONObject jres = JSONObject.parseObject(body);
String code = jres.getString("code");
if(!"000000".equals(code)){
return Result.error(jres.getString("mesg"));
}
}catch (Exception ex){ }catch (Exception ex){
ex.printStackTrace(); ex.printStackTrace();
logger.error("推送保存基线版本文件信息失败:" + ex.getMessage()); logger.error("推送保存基线版本文件信息失败:" + ex.getMessage());
@@ -666,11 +671,8 @@ public class OnlyOfficeController {
@ApiOperation(value = "关闭页面回调接口") @ApiOperation(value = "关闭页面回调接口")
@GetMapping("/onlyOfficeCloseTab") @GetMapping("/onlyOfficeCloseTab")
public Result<String> onlyOfficeCloseTab(String fileId, String appId, String Authorization, HttpServletResponse response, HttpServletRequest request) { public Result<String> onlyOfficeCloseTab(String fileId, String appId, String token, HttpServletResponse response, HttpServletRequest request) {
try { try {
// String appId = request.getParameter("appId");
// String token = request.getParameter("Authorization");
String token = Authorization;
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentType(MediaType.APPLICATION_JSON);