Merge remote-tracking branch 'origin/master'

# Conflicts:
#	byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java
This commit is contained in:
wangzhijiang
2024-03-29 17:52:46 +08:00
13 changed files with 247 additions and 169 deletions
@@ -67,6 +67,8 @@ 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");
String appId = json.getString("appId");
SarFileSplitInfoEO sarFileSplitInfoEO = new SarFileSplitInfoEO(); SarFileSplitInfoEO sarFileSplitInfoEO = new SarFileSplitInfoEO();
sarFileSplitInfoEO.setFileName(fileName); sarFileSplitInfoEO.setFileName(fileName);
@@ -75,7 +77,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,appId,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,String appId,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,String appId,SarFileSplitInfoEO sarFileSplitInfoEO,String splitSource) {
// // 企标权限校验
// enterpriseCheck(sarFileSplitInfoEO);
// 唯一校验 // 唯一校验
uniqueCheck(sarFileSplitInfoEO); uniqueCheck(sarFileSplitInfoEO);
// 保存文本拆分数据 // 保存文本拆分数据
@@ -323,31 +321,38 @@ 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,token,appId);
}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();
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<>(); 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);
@@ -359,16 +364,11 @@ 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();
} }
@Override @Override
@@ -1297,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);
@@ -108,6 +108,10 @@ public class OnlyOfficeController {
@Value("${byd.uploadFileUrl}") @Value("${byd.uploadFileUrl}")
private String bydUploadFileUrl; private String bydUploadFileUrl;
@Value("${byd.unlockUrl}")
private String unlockUrl;
@ApiOperation(value = "分页查询") @ApiOperation(value = "分页查询")
@GetMapping("/pageList") @GetMapping("/pageList")
public Result<IPage<BusProcessModelHis>> pageList(HttpServletRequest req, BusProcessModelHis processModelHis, public Result<IPage<BusProcessModelHis>> pageList(HttpServletRequest req, BusProcessModelHis processModelHis,
@@ -521,6 +525,8 @@ public class OnlyOfficeController {
public Result<String> updateOnlineFileLogJxInfo(@RequestBody JSONObject json){ public Result<String> updateOnlineFileLogJxInfo(@RequestBody JSONObject json){
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 token = json.getString("token");
String dataType = "1"; String dataType = "1";
Date now = new Date(); Date now = new Date();
@@ -529,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) {
@@ -547,7 +554,8 @@ public class OnlyOfficeController {
HttpHeaders headers2 = new HttpHeaders(); HttpHeaders headers2 = new HttpHeaders();
headers2.setContentType(MediaType.MULTIPART_FORM_DATA); headers2.setContentType(MediaType.MULTIPART_FORM_DATA);
headers2.add("appId",appId);
headers2.add("Authorization",token);
// 创建MultiValueMap对象,用于存储请求参数 // 创建MultiValueMap对象,用于存储请求参数
MultiValueMap<String, Object> params2 = new LinkedMultiValueMap<>(); MultiValueMap<String, Object> params2 = new LinkedMultiValueMap<>();
@@ -564,6 +572,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,11 +580,12 @@ 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();
logger.error("基线版本文件上传失败:" + ex.getMessage()); logger.error("基线版本文件上传失败:" + ex.getMessage());
// return Result.error("更新基线信息失败!");
} }
logger.info("基线版本文件上传接口结束=========================================="); logger.info("基线版本文件上传接口结束==========================================");
@@ -586,27 +596,36 @@ public class OnlyOfficeController {
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("appId",appId);
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
params.put("jxFileName", jxFileName); // 基线文档名称
// 使用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);
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());
// 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("更新基线信息失败!");
} }
@@ -652,6 +671,29 @@ public class OnlyOfficeController {
return result; return result;
} }
@ApiOperation(value = "关闭页面回调接口")
@GetMapping("/onlyOfficeCloseTab")
public Result<String> onlyOfficeCloseTab(String fileId, String appId, String token, HttpServletResponse response, HttpServletRequest request) {
try {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("appId",appId);
headers.add("Authorization",token);
// 创建MultiValueMap对象,用于存储请求参数
Map<String, Object> params = new HashMap<>();
params.put("fileId", fileId);
// 使用HttpEntity对象包装请求体和请求头
HttpEntity<Map<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文件") @ApiOperation(value = "|File|在线编辑下载docx文件")
@GetMapping("/onlyOfficeDownloadDocxFile") @GetMapping("/onlyOfficeDownloadDocxFile")
@@ -463,83 +463,42 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
String drafts = json.getString("drafts"); String drafts = json.getString("drafts");
String model = "model_qb"; String model = "model_qb";
// 查询历史信息:1 是 2 否
BusProcessModelHis bpmHis = this.baseMapper.selectById(fileId); String queryType = json.getString("queryType");
if (ObjectUtils.isNotEmpty(bpmHis)) { if (StringUtils.equals(CommonConstant.ONLIOFFICE_QUERY_TYPE_1,queryType)) {
resultSb.append(onlyOfficeEditorUrl); OnlineFileLog onlineFileLog = onlineFileLogDao.selectById(fileId);
resultSb.append("fileId=").append(fileId).append("&"); if(ObjectUtils.isNotEmpty(onlineFileLog)){
resultSb.append("pid=").append(bpmHis.getPId()).append("&"); resultSb.append(onlyOfficeEditorUrl);
resultSb.append("taskIds=").append(bpmHis.getTaskId()).append("&"); resultSb.append("fileId=").append(onlineFileLog.getHisId()).append("&");
// resultSb.append("editType=").append("null").append("&"); resultSb.append("oldFileName=").append(onlineFileLog.getFileName()).append("&");
resultSb.append("oldFileName=").append(bpmHis.getFileName()).append("&"); resultSb.append("fileType=").append("docx").append("&");
resultSb.append("fileType=").append("docx").append("&"); resultSb.append("attId=").append(onlineFileLog.getAttFileId()).append("&");
resultSb.append("attId=").append(fileId).append("&"); resultSb.append("filePath=").append(onlineFileLog.getFilePath()).append("&");
resultSb.append("fileUrl=").append(bpmHis.getDownLoadUrl()).append("&"); resultSb.append("fileName=").append(onlineFileLog.getFileName()).append("&");
// resultSb.append("key=").append("key").append("&"); resultSb.append("userName=").append(userName).append("&");
resultSb.append("filePath=").append(bpmHis.getEditFilePath()).append("&"); resultSb.append("standCode=").append(serialNumber).append("&");
resultSb.append("fileName=").append(bpmHis.getFileName()).append("&"); resultSb.append("standName=").append(standName).append("&");
// resultSb.append("userId=").append("null").append("&"); resultSb.append("draftingDepartment=").append(estDepart).append("&");
resultSb.append("userName=").append(userName).append("&"); resultSb.append("draftsman=").append(drafts).append("&");
// resultSb.append("isEdit=").append("123").append("&"); resultSb.append("replaceStand=").append(replaceStand);
resultSb.append("standCode=").append(serialNumber).append("&"); }else{
resultSb.append("standName=").append(standName).append("&"); log.error("onlineFileLog为空,fileId="+fileId);
resultSb.append("draftingDepartment=").append(estDepart).append("&"); }
resultSb.append("draftsman=").append(drafts).append("&"); } else if (StringUtils.equals(CommonConstant.ONLIOFFICE_QUERY_TYPE_2,queryType)) {
// resultSb.append("assessor=").append("").append("&"); BusProcessModelHis bpmHis = this.baseMapper.selectById(fileId);
// resultSb.append("focalUnit=").append("").append("&"); if (ObjectUtils.isNotEmpty(bpmHis)) {
resultSb.append("replaceStand=").append(replaceStand);
// throw new JeroBootException("fileId已经存在,不能重复,请检查!");
} else {
BusProcessModelHis modelHis = new BusProcessModelHis();
modelHis.setId(fileId);
try {
String preUuid2 = UUID.randomUUID().toString();
String changUuid = preUuid2.substring(0, 8);
String taskId = "task_" + changUuid;
String topId = "top_" + changUuid;
String builderModel = "model" + "/";
File dir = new File(filePath + builderModel);
if (!dir.exists()) {
dir.mkdirs();
}
String fileName = model + ".docx";
modelHis.setFileName(fileName);
StringBuilder builder = new StringBuilder();
builder.append("model").append("/");
builder.append(taskId).append("/");
File file = new File(filePath + builder.toString());
if (!file.exists()) {
file.mkdirs();
}
String targetPath = builder.toString() + taskId + "_" + topId + "_node.docx";
File sourceFile = new File(sourceFilePath);
File targetFile = new File(filePath + targetPath);
FileUtils.copyFile(sourceFile, targetFile);
modelHis.setTaskId(taskId);
modelHis.setPId(topId);
modelHis.setEditFilePath(targetPath);
modelHis.setDownLoadUrl(downloadUrl + targetPath);
this.baseMapper.insert(modelHis);
resultSb.append(onlyOfficeEditorUrl); resultSb.append(onlyOfficeEditorUrl);
resultSb.append("fileId=").append(fileId).append("&"); resultSb.append("fileId=").append(fileId).append("&");
resultSb.append("pid=").append(modelHis.getPId()).append("&"); resultSb.append("pid=").append(bpmHis.getPId()).append("&");
resultSb.append("taskIds=").append(modelHis.getTaskId()).append("&"); resultSb.append("taskIds=").append(bpmHis.getTaskId()).append("&");
// resultSb.append("editType=").append("null").append("&"); // resultSb.append("editType=").append("null").append("&");
resultSb.append("oldFileName=").append(modelHis.getFileName()).append("&"); resultSb.append("oldFileName=").append(bpmHis.getFileName()).append("&");
resultSb.append("fileType=").append("docx").append("&"); resultSb.append("fileType=").append("docx").append("&");
resultSb.append("attId=").append(fileId).append("&"); resultSb.append("attId=").append(fileId).append("&");
resultSb.append("fileUrl=").append(modelHis.getDownLoadUrl()).append("&"); resultSb.append("fileUrl=").append(bpmHis.getDownLoadUrl()).append("&");
// resultSb.append("key=").append("key").append("&"); // resultSb.append("key=").append("key").append("&");
resultSb.append("filePath=").append(modelHis.getEditFilePath()).append("&"); resultSb.append("filePath=").append(bpmHis.getEditFilePath()).append("&");
resultSb.append("fileName=").append(modelHis.getFileName()).append("&"); resultSb.append("fileName=").append(bpmHis.getFileName()).append("&");
// resultSb.append("userId=").append("null").append("&"); // resultSb.append("userId=").append("null").append("&");
resultSb.append("userName=").append(userName).append("&"); resultSb.append("userName=").append(userName).append("&");
// resultSb.append("isEdit=").append("123").append("&"); // resultSb.append("isEdit=").append("123").append("&");
@@ -550,13 +509,75 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
// resultSb.append("assessor=").append("").append("&"); // resultSb.append("assessor=").append("").append("&");
// resultSb.append("focalUnit=").append("").append("&"); // resultSb.append("focalUnit=").append("").append("&");
resultSb.append("replaceStand=").append(replaceStand); resultSb.append("replaceStand=").append(replaceStand);
} catch (Exception e) {
logger.error(e.getMessage()); // throw new JeroBootException("fileId已经存在,不能重复,请检查!");
throw new JeroBootException("操作失败,请联系管理员!"); } else {
BusProcessModelHis modelHis = new BusProcessModelHis();
modelHis.setId(fileId);
try {
String preUuid2 = UUID.randomUUID().toString();
String changUuid = preUuid2.substring(0, 8);
String taskId = "task_" + changUuid;
String topId = "top_" + changUuid;
String builderModel = "model" + "/";
File dir = new File(filePath + builderModel);
if (!dir.exists()) {
dir.mkdirs();
}
String fileName = model + ".docx";
modelHis.setFileName(fileName);
StringBuilder builder = new StringBuilder();
builder.append("model").append("/");
builder.append(taskId).append("/");
File file = new File(filePath + builder.toString());
if (!file.exists()) {
file.mkdirs();
}
String targetPath = builder.toString() + taskId + "_" + topId + "_node.docx";
File sourceFile = new File(sourceFilePath);
File targetFile = new File(filePath + targetPath);
FileUtils.copyFile(sourceFile, targetFile);
modelHis.setTaskId(taskId);
modelHis.setPId(topId);
modelHis.setEditFilePath(targetPath);
modelHis.setDownLoadUrl(downloadUrl + targetPath);
this.baseMapper.insert(modelHis);
resultSb.append(onlyOfficeEditorUrl);
resultSb.append("fileId=").append(fileId).append("&");
resultSb.append("pid=").append(modelHis.getPId()).append("&");
resultSb.append("taskIds=").append(modelHis.getTaskId()).append("&");
// resultSb.append("editType=").append("null").append("&");
resultSb.append("oldFileName=").append(modelHis.getFileName()).append("&");
resultSb.append("fileType=").append("docx").append("&");
resultSb.append("attId=").append(fileId).append("&");
resultSb.append("fileUrl=").append(modelHis.getDownLoadUrl()).append("&");
// resultSb.append("key=").append("key").append("&");
resultSb.append("filePath=").append(modelHis.getEditFilePath()).append("&");
resultSb.append("fileName=").append(modelHis.getFileName()).append("&");
// resultSb.append("userId=").append("null").append("&");
resultSb.append("userName=").append(userName).append("&");
// resultSb.append("isEdit=").append("123").append("&");
resultSb.append("standCode=").append(serialNumber).append("&");
resultSb.append("standName=").append(standName).append("&");
resultSb.append("draftingDepartment=").append(estDepart).append("&");
resultSb.append("draftsman=").append(drafts).append("&");
// resultSb.append("assessor=").append("").append("&");
// resultSb.append("focalUnit=").append("").append("&");
resultSb.append("replaceStand=").append(replaceStand);
} catch (Exception e) {
logger.error(e.getMessage());
throw new JeroBootException("操作失败,请联系管理员!");
}
} }
} }
return resultSb.toString(); return resultSb.toString();
} }
@@ -564,34 +585,43 @@ 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");
String userName = json.getString("userName");
// 查询历史信息: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);
resultSb.append("oldFileName=").append(onlineFileLog.getFileName()).append("&"); resultSb.append("oldFileName=").append(onlineFileLog.getFileName()).append("&");
resultSb.append("fileType=").append("docx").append("&"); resultSb.append("fileType=").append("docx").append("&");
resultSb.append("attId=").append(onlineFileLog.getAttFileId()).append("&"); resultSb.append("userName=").append(userName).append("&");
resultSb.append("fileUrl=").append(downloadFileUrl.toString()).append("&"); resultSb.append("attId=").append(onlineFileLog.getAttFileId()).append("&");
resultSb.append("key=").append(DateUtils.getCurrentTimestamp()).append("&"); resultSb.append("fileUrl=").append(downloadFileUrl.toString()).append("&");
resultSb.append("filePath=").append(onlineFileLog.getFilePath()).append("&"); resultSb.append("key=").append(DateUtils.getCurrentTimestamp()).append("&");
resultSb.append("fileName=").append(onlineFileLog.getFileName()); resultSb.append("filePath=").append(onlineFileLog.getFilePath()).append("&");
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("&");
resultSb.append("attId=").append(busProcessModelHis.getId()).append("&"); resultSb.append("userName=").append(userName).append("&");
resultSb.append("fileUrl=").append(busProcessModelHis.getDownLoadUrl()).append("&"); resultSb.append("attId=").append(busProcessModelHis.getId()).append("&");
resultSb.append("key=").append(DateUtils.getCurrentTimestamp()).append("&"); resultSb.append("fileUrl=").append(busProcessModelHis.getDownLoadUrl()).append("&");
resultSb.append("filePath=").append(busProcessModelHis.getEditFilePath()).append("&"); resultSb.append("key=").append(DateUtils.getCurrentTimestamp()).append("&");
resultSb.append("fileName=").append(busProcessModelHis.getFileName()); resultSb.append("filePath=").append(busProcessModelHis.getEditFilePath()).append("&");
resultSb.append("fileName=").append(busProcessModelHis.getFileName());
}else{
log.error("busProcessModelHis为空,fileId="+fileId);
}
} }
return resultSb.toString(); return resultSb.toString();
} }
@@ -61,7 +61,6 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.web.util.UriComponentsBuilder;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
@@ -142,7 +141,7 @@ public class FileSpiltService {
* @param enumByValue * @param enumByValue
* @return * @return
*/ */
public int fileCHN(SarFileSplitInfoEO sarFileSplitInfoEO, SplitFileTypeTypeEnum enumByValue,String splitSource) { public int fileCHN(SarFileSplitInfoEO sarFileSplitInfoEO, SplitFileTypeTypeEnum enumByValue,String splitSource,String token,String appId) {
if (sarFileSplitInfoEO.getStopNumber() <= 0) { if (sarFileSplitInfoEO.getStopNumber() <= 0) {
sarFileSplitInfoEO.setStopNumber(200); sarFileSplitInfoEO.setStopNumber(200);
} }
@@ -222,24 +221,21 @@ public class FileSpiltService {
try { try {
// 根据byd传过来的文件下载路径获取文件。 // 根据byd传过来的文件下载路径获取文件。
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对象,用于存储请求参数 headers.add("appId",appId);
// MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
// String fileId = sarFileSplitInfoEO.getId(); // 创建MultiValueMap对象,用于存储请求参数
// params.add("fileId", fileId); Map<String, String> params = new HashMap<>();
// String fileId = sarFileSplitInfoEO.getId();
// // 使用HttpEntity对象包装请求体和请求头 params.put("fileId", fileId);
// HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers);
// // 使用HttpEntity对象包装请求体和请求头
// // 发送POST请求并获取响应 HttpEntity<Map<String, String>> requestEntity = new HttpEntity<>(params, headers);
// ResponseEntity<byte[]> responseEntity = restTemplate.postForEntity(bydDownLoadFileUrl, requestEntity, byte[].class);
Long fileId = Long.valueOf(sarFileSplitInfoEO.getId());
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(bydDownLoadFileUrl).queryParam("fileId", fileId);
// 发送POST请求并获取响应 // 发送POST请求并获取响应
ResponseEntity<byte[]> responseEntity = restTemplate.postForEntity(builder.toUriString(), null, byte[].class); ResponseEntity<byte[]> responseEntity = restTemplate.postForEntity(bydDownLoadFileUrl, requestEntity, byte[].class);
// 获取文件流 // 获取文件流
splitFileIs = new ByteArrayInputStream(responseEntity.getBody()); splitFileIs = new ByteArrayInputStream(responseEntity.getBody());
}catch (Exception ex){ }catch (Exception ex){
@@ -96,7 +96,7 @@ public class SarFileSplitInfoServiceImpl extends ServiceImpl<SarFileSplitInfoMap
}*/ }*/
int result = 0; int result = 0;
result = fileSpiltService.fileCHN(sarFileSplitInfoEO,SplitFileTypeTypeEnum.GBT, CommonConstant.SPLIT_SOURCE_1); result = fileSpiltService.fileCHN(sarFileSplitInfoEO,SplitFileTypeTypeEnum.GBT, CommonConstant.SPLIT_SOURCE_1,"","");
if(result == -1){ if(result == -1){
if(LanguageEnum.CN.equals(MessageUtils.getLanguage())) { if(LanguageEnum.CN.equals(MessageUtils.getLanguage())) {
@@ -236,4 +236,5 @@ byd:
saveBaseLineDocIdUrl: http://127.0.0.1:9998/saveBaseLineDocIdUrl saveBaseLineDocIdUrl: http://127.0.0.1:9998/saveBaseLineDocIdUrl
splitResultUrl: http://127.0.0.1:9998/splitResultUrl splitResultUrl: http://127.0.0.1:9998/splitResultUrl
downLoadFileUrl: http://127.0.0.1:9998/downLoadFileUrl 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 saveBaseLineDocIdUrl: http://127.0.0.1:9998/api/qbp/organization/saveBaseLineDocId
splitResultUrl: http://127.0.0.1:9998/api/qbp/library/structured splitResultUrl: http://127.0.0.1:9998/api/qbp/library/structured
downLoadFileUrl: http://127.0.0.1:9998/ipd-files/file/downLoad 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 saveBaseLineDocIdUrl: http://127.0.0.1:9998/saveBaseLineDocIdUrl
splitResultUrl: http://127.0.0.1:9998/splitResultUrl splitResultUrl: http://127.0.0.1:9998/splitResultUrl
downLoadFileUrl: http://127.0.0.1:9998/downLoadFileUrl downLoadFileUrl: http://127.0.0.1:9998/downLoadFileUrl
unlockUrl: http://127.0.0.1:9998/api/qbp/document/unlock
+14 -14
View File
@@ -144,21 +144,21 @@ const user = {
path: '/documentTool/documentComparison', path: '/documentTool/documentComparison',
redirect: null, redirect: null,
route: '1' route: '1'
},
{
component: 'onlyoffice/index',
meta: {
componentName: 'onlyoffice',
icon: 'icon-24gf-folderOpen',
internalOrExternal: false,
keepAlive: false,
title: 'onlyoffice'
},
name: 'onlyoffice',
path: '/onlyoffice',
redirect: null,
route: '1'
} }
// {
// component: 'onlyoffice/index',
// meta: {
// componentName: 'onlyoffice',
// icon: 'icon-24gf-folderOpen',
// internalOrExternal: false,
// keepAlive: false,
// title: 'onlyoffice'
// },
// name: 'onlyoffice',
// path: '/onlyoffice',
// redirect: null,
// route: '1'
// }
] ]
commit('SET_PERMISSIONLIST', menuData) commit('SET_PERMISSIONLIST', menuData)
resolve(menuData) resolve(menuData)
+12 -7
View File
@@ -10,6 +10,8 @@
<script> <script>
import { postAction, getAction } from '../../api/manage' import { postAction, getAction } from '../../api/manage'
import { ACCESS_TOKEN, OAUTH2_LOGIN_PAGE_PATH } from '@/store/mutation-types'
import Vue from 'vue'
export default { export default {
name: 'index', name: 'index',
@@ -24,23 +26,26 @@ export default {
if (val.id) { if (val.id) {
const oldFileName = '比亚迪企业标准' const oldFileName = '比亚迪企业标准'
const nowTime = new Date().getTime() const nowTime = new Date().getTime()
const serialNumber = 'x/xx xxxx-xxxx' const standCode = 'G/BYD xxxx-xxxx'
const standName = '比亚迪企业标准' const standName = '比亚迪企业标准'
const estDepart = '起草部门' const draftingDepartment = '起草部门'
const drafts = '起草人' const draftsman = '起草人'
const assessor = '评审人员' const assessor = '评审人员'
const focalUnit = '归口单位' const focalUnit = '归口单位'
const watermark = '比亚迪' const watermark = '比亚迪'
const replaceStand = '' const replaceStand = ''
const Authorization = 'token'
const appId = 'appId'
// http://39.98.140.126:8999 // http://39.98.140.126:8999
// http://127.0.0.1:8080 // http://127.0.0.1:8080
window.open(window.CONFIG.onlyOfficeRoute + '/editor?fileId=' + val.id + '&pid=' + val.pid + window.open(window.CONFIG.onlyOfficeRoute + '/editor?fileId=' + val.id + '&pid=' + val.pid +
'&taskIds=' + val.taskId + '&oldFileName=' + oldFileName + '&assessor=' + assessor + '&taskIds=' + val.taskId + '&oldFileName=' + oldFileName + '&assessor=' + assessor +
'&fileType=docx' + '&attId=' + val.id + '&fileUrl=' + val.downLoadUrl + '&fileType=docx' + '&attId=' + val.id + '&fileUrl=' + val.downLoadUrl +
'&key=' + val.id + nowTime + '&filePath=' + val.editFilePath + '&fileName=' + val.fileName + '&key=' + nowTime + '&filePath=' + val.editFilePath + '&fileName=' + val.fileName +
'&userId=' + val.userId + '&userName=admin' + '&serialNumber=' + serialNumber + '&userId=' + val.userId + '&userName=admin' + '&standCode=' + standCode +
'&standName=' + standName + '&replaceStand=' + replaceStand + '&drafts=' + drafts + '&standName=' + standName + '&replaceStand=' + replaceStand + '&draftsman=' + draftsman +
'&estDepart=' + estDepart + '&focalUnit=' + focalUnit + '&watermark=' + watermark) '&draftingDepartment=' + draftingDepartment + '&focalUnit=' + focalUnit + '&watermark=' + watermark +
'&Authorization=' + Authorization + '&appId=' + appId)
} }
}) })
} else { } else {