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