修改空指针问题

This commit is contained in:
高嵩
2024-03-26 11:09:31 +08:00
parent d9dd9dd0f4
commit f430311eed
2 changed files with 29 additions and 22 deletions
@@ -564,6 +564,7 @@ public class OnlyOfficeController {
// 发送POST请求并获取响应 // 发送POST请求并获取响应
ResponseEntity<String> responseEntity2 = restTemplate2.postForEntity(bydUploadFileUrl, requestEntity2, String.class); ResponseEntity<String> responseEntity2 = restTemplate2.postForEntity(bydUploadFileUrl, requestEntity2, String.class);
String body2 = responseEntity2.getBody(); String body2 = responseEntity2.getBody();
logger.info("基线版本文件上传接口结果:" + body2);
JSONObject jsonObject2 = JSONObject.parseObject(body2); JSONObject jsonObject2 = JSONObject.parseObject(body2);
String data = jsonObject2.getString("data"); String data = jsonObject2.getString("data");
createTimeLatestOnlineFileLog.setBydJxFileId(data); createTimeLatestOnlineFileLog.setBydJxFileId(data);
@@ -571,7 +572,7 @@ public class OnlyOfficeController {
createTimeLatestOnlineFileLog2.setBydJxFileId(data); createTimeLatestOnlineFileLog2.setBydJxFileId(data);
this.onlineFileLogDao.insert(createTimeLatestOnlineFileLog2); this.onlineFileLogDao.insert(createTimeLatestOnlineFileLog2);
logger.info("基线版本文件上传接口结果:" + body2); // logger.info("基线版本文件上传接口结果:" + body2);
}catch (Exception ex){ }catch (Exception ex){
ex.printStackTrace(); ex.printStackTrace();
@@ -564,13 +564,13 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
public String onlyOfficePreview(JSONObject json) { public String onlyOfficePreview(JSONObject json) {
StringBuilder resultSb = new StringBuilder(); StringBuilder resultSb = new StringBuilder();
String fileId = json.getString("fileId"); String fileId = json.getString("fileId");
String watermark = json.getString("watermark"); // String watermark = json.getString("watermark");
// 查询历史信息:1 是 2 否 // 查询历史信息:1 是 2 否
String queryType = json.getString("queryType"); String queryType = json.getString("queryType");
if (StringUtils.equals(CommonConstant.ONLIOFFICE_QUERY_TYPE_1,queryType)) { if (StringUtils.equals(CommonConstant.ONLIOFFICE_QUERY_TYPE_1,queryType)) {
OnlineFileLog onlineFileLog = onlineFileLogDao.selectById(fileId); OnlineFileLog onlineFileLog = onlineFileLogDao.selectById(fileId);
if(ObjectUtils.isNotEmpty(onlineFileLog)){
StringBuffer downloadFileUrl = new StringBuffer(); StringBuffer downloadFileUrl = new StringBuffer();
downloadFileUrl.append(downloadUrl).append(onlineFileLog.getFilePath() == null ? "" : onlineFileLog.getFilePath()); downloadFileUrl.append(downloadUrl).append(onlineFileLog.getFilePath() == null ? "" : onlineFileLog.getFilePath());
resultSb.append(previewHistoryUrl); resultSb.append(previewHistoryUrl);
@@ -581,9 +581,12 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
resultSb.append("key=").append(DateUtils.getCurrentTimestamp()).append("&"); resultSb.append("key=").append(DateUtils.getCurrentTimestamp()).append("&");
resultSb.append("filePath=").append(onlineFileLog.getFilePath()).append("&"); resultSb.append("filePath=").append(onlineFileLog.getFilePath()).append("&");
resultSb.append("fileName=").append(onlineFileLog.getFileName()); resultSb.append("fileName=").append(onlineFileLog.getFileName());
}else{
log.error("onlineFileLog为空,fileId="+fileId);
}
} else if (StringUtils.equals(CommonConstant.ONLIOFFICE_QUERY_TYPE_2,queryType)) { } else if (StringUtils.equals(CommonConstant.ONLIOFFICE_QUERY_TYPE_2,queryType)) {
BusProcessModelHis busProcessModelHis = this.processEditFile(fileId); BusProcessModelHis busProcessModelHis = this.processEditFile(fileId);
if(ObjectUtils.isNotEmpty(busProcessModelHis)){
resultSb.append(onlyOfficePreviewUrl); resultSb.append(onlyOfficePreviewUrl);
resultSb.append("oldFileName=").append(busProcessModelHis.getFileName()).append("&"); resultSb.append("oldFileName=").append(busProcessModelHis.getFileName()).append("&");
resultSb.append("fileType=").append("docx").append("&"); resultSb.append("fileType=").append("docx").append("&");
@@ -592,6 +595,9 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
resultSb.append("key=").append(DateUtils.getCurrentTimestamp()).append("&"); resultSb.append("key=").append(DateUtils.getCurrentTimestamp()).append("&");
resultSb.append("filePath=").append(busProcessModelHis.getEditFilePath()).append("&"); resultSb.append("filePath=").append(busProcessModelHis.getEditFilePath()).append("&");
resultSb.append("fileName=").append(busProcessModelHis.getFileName()); resultSb.append("fileName=").append(busProcessModelHis.getFileName());
}else{
log.error("busProcessModelHis为空,fileId="+fileId);
}
} }
return resultSb.toString(); return resultSb.toString();
} }