修改对接接口

This commit is contained in:
高嵩
2024-03-27 19:47:52 +08:00
parent 87a684f762
commit c7ba8fe4f3
3 changed files with 35 additions and 32 deletions
@@ -321,16 +321,22 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
@Override
public void run() {
//拆分
int count = fileSpiltService.fileCHN(sarFileSplitInfoEO, SplitFileTypeTypeEnum.GBT,splitSource);
int count = -1;
try{
count = fileSpiltService.fileCHN(sarFileSplitInfoEO, SplitFileTypeTypeEnum.GBT,splitSource);
}catch (Exception e){
log.error("拆分标准失败:" + e.getMessage());
}
// 拆分结果(0-拆分失败、1-拆分成功)
int successful = 1;
sarFileSplitInfoEO.setSplitResult("成功");
if(count == -1){
successful = 0;
sarFileSplitInfoEO.setSplitResult("失败");
}
// 如果是外部系统调用
if (StringUtils.equals(splitSource, CommonConstant.SPLIT_SOURCE_2)) {
log.info("拆分结果回调开始=========================================================");
// 拆分结果(0-拆分失败、1-拆分成功)
int successful = 1;
if(count == -1){
successful = 0;
}
try {
// 推送拆分结果
RestTemplate restTemplate = new RestTemplate();
@@ -339,14 +345,14 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
headers.add("Authorization",token);
// 创建MultiValueMap对象,用于存储请求参数
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("standardCode", sarFileSplitInfoEO.getSerialNumber());
params.add("docId", sarFileSplitInfoEO.getId());
params.add("brief", "");
params.add("successful", successful);
Map<String, Object> params = new HashMap<>();
params.put("standardCode", sarFileSplitInfoEO.getSerialNumber());
params.put("docId", sarFileSplitInfoEO.getId());
params.put("brief", "");
params.put("successful", successful);
// 使用HttpEntity对象包装请求体和请求头
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers);
HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(params, headers);
// 发送POST请求并获取响应
ResponseEntity<String> responseEntity = restTemplate.postForEntity(bydSplitResultUrl, requestEntity, String.class);
@@ -358,12 +364,8 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
log.error("拆分结果回调结果失败:" + ex.getMessage());
}
log.info("拆分结果回调结束=========================================================");
}
if(count == -1){
throw new JeroBootException("文档格式错误,请检查文档内容!");
}
sarFileSplitInfoService.updateById(sarFileSplitInfoEO);
}
});
thread.start();
@@ -1295,7 +1297,7 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
String infoId = UUID.randomUUID().toString().replace("-", "");
sarFileSplitInfoEO.setId(infoId);
}
sarFileSplitInfoEO.setSplitResult("成功");
sarFileSplitInfoEO.setSplitResult("拆分中");
sarFileSplitInfoEO.setSplitStatus(SplitEnum.SPLIT_STATUS2.getValue());
sarFileSplitInfoEO.setAuthor(userId);
sarFileSplitInfoEO.setCreateTime(now);
@@ -535,6 +535,7 @@ public class OnlyOfficeController {
// 查询总次数
int queryCount = 0;
OnlineFileLog createTimeLatestOnlineFileLog = this.getCreateTimeLatestOnlineFileLog(fileId,now,queryCount);
final String oldOnlineFileId = createTimeLatestOnlineFileLog.getId();
OnlineFileLog createTimeLatestOnlineFileLog2 = createTimeLatestOnlineFileLog;
if (null != createTimeLatestOnlineFileLog) {
@@ -584,7 +585,7 @@ public class OnlyOfficeController {
}catch (Exception ex){
ex.printStackTrace();
logger.error("基线版本文件上传失败:" + ex.getMessage());
return Result.error("更新基线信息失败!");
// return Result.error("更新基线信息失败!");
}
logger.info("基线版本文件上传接口结束==========================================");
@@ -599,12 +600,12 @@ public class OnlyOfficeController {
headers.add("Authorization",token);
// 创建MultiValueMap对象,用于存储请求参数
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("fileId", createTimeLatestOnlineFileLog2.getHisId()); // 每一次草稿的id(第一次发起文档编辑时的id)
params.add("docId", createTimeLatestOnlineFileLog2.getId()); // 基线文档主键id
Map<String, Object> params = new HashMap<>();
params.put("fileId", createTimeLatestOnlineFileLog2.getHisId()); // 每一次草稿的id(第一次发起文档编辑时的id)
params.put("docId", createTimeLatestOnlineFileLog2.getId()); // 基线文档主键id
// 使用HttpEntity对象包装请求体和请求头
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers);
HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(params, headers);
// 发送POST请求并获取响应
ResponseEntity<String> responseEntity = restTemplate.postForEntity(bydSaveBaseLineDocIdUrl, requestEntity, String.class);
@@ -618,12 +619,12 @@ public class OnlyOfficeController {
}catch (Exception ex){
ex.printStackTrace();
logger.error("推送保存基线版本文件信息失败:" + ex.getMessage());
return Result.error("更新基线信息失败!");
// return Result.error("更新基线信息失败!");
}
logger.info("推送保存基线版本文件信息结束==========================================");
// this.onlineFileLogDao.updateById(createTimeLatestOnlineFileLog);
this.onlineFileLogDao.deleteById(createTimeLatestOnlineFileLog.getId());
this.onlineFileLogDao.deleteById(oldOnlineFileId);
} else {
return Result.error("更新基线信息失败!");
}
@@ -679,10 +680,10 @@ public class OnlyOfficeController {
headers.add("appId",appId);
headers.add("Authorization",token);
// 创建MultiValueMap对象,用于存储请求参数
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("fileId", fileId);
Map<String, Object> params = new HashMap<>();
params.put("fileId", fileId);
// 使用HttpEntity对象包装请求体和请求头
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers);
HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(params, headers);
// 发送POST请求并获取响应
ResponseEntity<String> responseEntity = restTemplate.postForEntity(unlockUrl, requestEntity, String.class);
String body = responseEntity.getBody();
@@ -225,12 +225,12 @@ public class FileSpiltService {
headers.setContentType(MediaType.APPLICATION_JSON);
// 创建MultiValueMap对象,用于存储请求参数
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
Map<String, String> params = new HashMap<>();
String fileId = sarFileSplitInfoEO.getId();
params.add("fileId", fileId);
params.put("fileId", fileId);
// 使用HttpEntity对象包装请求体和请求头
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers);
HttpEntity<Map<String, String>> requestEntity = new HttpEntity<>(params, headers);
// 发送POST请求并获取响应
ResponseEntity<byte[]> responseEntity = restTemplate.postForEntity(bydDownLoadFileUrl, requestEntity, byte[].class);