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 docId = json.getString("docId");
String filePath = json.getString("filePath");
String token = json.getString("token");
String appId = json.getString("appId");
SarFileSplitInfoEO sarFileSplitInfoEO = new SarFileSplitInfoEO();
sarFileSplitInfoEO.setFileName(fileName);
@@ -75,7 +77,7 @@ public class DockingController {
sarFileSplitInfoEO.setTitle(title);
sarFileSplitInfoEO.setId(docId);
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<>();
resultMap.put("infoId",docId);
@@ -140,7 +140,7 @@ public class DocumentSplitController {
@PostMapping(value = "/split")
@ApiOperationSupport(order = 6)
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));
}
@@ -66,7 +66,7 @@ public interface IDocumentSplitService {
* 文档拆分-拆分
* @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
public void add(SarFileSplitInfoEO sarFileSplitInfoEO,String splitSource) {
// // 企标权限校验
// enterpriseCheck(sarFileSplitInfoEO);
public void add(String token,String appId,SarFileSplitInfoEO sarFileSplitInfoEO,String splitSource) {
// 唯一校验
uniqueCheck(sarFileSplitInfoEO);
// 保存文本拆分数据
@@ -323,31 +321,38 @@ 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,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)) {
log.info("拆分结果回调开始=========================================================");
// 拆分结果(0-拆分失败、1-拆分成功)
int successful = 1;
if(count == -1){
successful = 0;
}
try {
// 推送拆分结果
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
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);
@@ -359,16 +364,11 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
log.error("拆分结果回调结果失败:" + ex.getMessage());
}
log.info("拆分结果回调结束=========================================================");
}
if(count == -1){
throw new JeroBootException("文档格式错误,请检查文档内容!");
}
sarFileSplitInfoService.updateById(sarFileSplitInfoEO);
}
});
thread.start();
}
@Override
@@ -1297,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);
@@ -108,6 +108,10 @@ public class OnlyOfficeController {
@Value("${byd.uploadFileUrl}")
private String bydUploadFileUrl;
@Value("${byd.unlockUrl}")
private String unlockUrl;
@ApiOperation(value = "分页查询")
@GetMapping("/pageList")
public Result<IPage<BusProcessModelHis>> pageList(HttpServletRequest req, BusProcessModelHis processModelHis,
@@ -521,6 +525,8 @@ public class OnlyOfficeController {
public Result<String> updateOnlineFileLogJxInfo(@RequestBody JSONObject json){
String jxFileName = json.getString("jxFileName");
String fileId = json.getString("fileId");
String appId = json.getString("appId");
String token = json.getString("token");
String dataType = "1";
Date now = new Date();
@@ -529,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) {
@@ -547,7 +554,8 @@ public class OnlyOfficeController {
HttpHeaders headers2 = new HttpHeaders();
headers2.setContentType(MediaType.MULTIPART_FORM_DATA);
headers2.add("appId",appId);
headers2.add("Authorization",token);
// 创建MultiValueMap对象,用于存储请求参数
MultiValueMap<String, Object> params2 = new LinkedMultiValueMap<>();
@@ -564,6 +572,7 @@ public class OnlyOfficeController {
// 发送POST请求并获取响应
ResponseEntity<String> responseEntity2 = restTemplate2.postForEntity(bydUploadFileUrl, requestEntity2, String.class);
String body2 = responseEntity2.getBody();
logger.info("基线版本文件上传接口结果:" + body2);
JSONObject jsonObject2 = JSONObject.parseObject(body2);
String data = jsonObject2.getString("data");
createTimeLatestOnlineFileLog.setBydJxFileId(data);
@@ -571,11 +580,12 @@ public class OnlyOfficeController {
createTimeLatestOnlineFileLog2.setBydJxFileId(data);
this.onlineFileLogDao.insert(createTimeLatestOnlineFileLog2);
logger.info("基线版本文件上传接口结果:" + body2);
// logger.info("基线版本文件上传接口结果:" + body2);
}catch (Exception ex){
ex.printStackTrace();
logger.error("基线版本文件上传失败:" + ex.getMessage());
// return Result.error("更新基线信息失败!");
}
logger.info("基线版本文件上传接口结束==========================================");
@@ -586,27 +596,36 @@ public class OnlyOfficeController {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("appId",appId);
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
params.put("jxFileName", jxFileName); // 基线文档名称
// 使用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);
String body = responseEntity.getBody();
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){
ex.printStackTrace();
logger.error("推送保存基线版本文件信息失败:" + ex.getMessage());
// return Result.error("更新基线信息失败!");
}
logger.info("推送保存基线版本文件信息结束==========================================");
// this.onlineFileLogDao.updateById(createTimeLatestOnlineFileLog);
this.onlineFileLogDao.deleteById(createTimeLatestOnlineFileLog.getId());
this.onlineFileLogDao.deleteById(oldOnlineFileId);
} else {
return Result.error("更新基线信息失败!");
}
@@ -652,6 +671,29 @@ public class OnlyOfficeController {
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文件")
@GetMapping("/onlyOfficeDownloadDocxFile")
@@ -463,83 +463,42 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
String drafts = json.getString("drafts");
String model = "model_qb";
BusProcessModelHis bpmHis = this.baseMapper.selectById(fileId);
if (ObjectUtils.isNotEmpty(bpmHis)) {
resultSb.append(onlyOfficeEditorUrl);
resultSb.append("fileId=").append(fileId).append("&");
resultSb.append("pid=").append(bpmHis.getPId()).append("&");
resultSb.append("taskIds=").append(bpmHis.getTaskId()).append("&");
// resultSb.append("editType=").append("null").append("&");
resultSb.append("oldFileName=").append(bpmHis.getFileName()).append("&");
resultSb.append("fileType=").append("docx").append("&");
resultSb.append("attId=").append(fileId).append("&");
resultSb.append("fileUrl=").append(bpmHis.getDownLoadUrl()).append("&");
// resultSb.append("key=").append("key").append("&");
resultSb.append("filePath=").append(bpmHis.getEditFilePath()).append("&");
resultSb.append("fileName=").append(bpmHis.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);
// 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);
// 查询历史信息:1 是 2 否
String queryType = json.getString("queryType");
if (StringUtils.equals(CommonConstant.ONLIOFFICE_QUERY_TYPE_1,queryType)) {
OnlineFileLog onlineFileLog = onlineFileLogDao.selectById(fileId);
if(ObjectUtils.isNotEmpty(onlineFileLog)){
resultSb.append(onlyOfficeEditorUrl);
resultSb.append("fileId=").append(onlineFileLog.getHisId()).append("&");
resultSb.append("oldFileName=").append(onlineFileLog.getFileName()).append("&");
resultSb.append("fileType=").append("docx").append("&");
resultSb.append("attId=").append(onlineFileLog.getAttFileId()).append("&");
resultSb.append("filePath=").append(onlineFileLog.getFilePath()).append("&");
resultSb.append("fileName=").append(onlineFileLog.getFileName()).append("&");
resultSb.append("userName=").append(userName).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("replaceStand=").append(replaceStand);
}else{
log.error("onlineFileLog为空,fileId="+fileId);
}
} else if (StringUtils.equals(CommonConstant.ONLIOFFICE_QUERY_TYPE_2,queryType)) {
BusProcessModelHis bpmHis = this.baseMapper.selectById(fileId);
if (ObjectUtils.isNotEmpty(bpmHis)) {
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("pid=").append(bpmHis.getPId()).append("&");
resultSb.append("taskIds=").append(bpmHis.getTaskId()).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("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("filePath=").append(modelHis.getEditFilePath()).append("&");
resultSb.append("fileName=").append(modelHis.getFileName()).append("&");
resultSb.append("filePath=").append(bpmHis.getEditFilePath()).append("&");
resultSb.append("fileName=").append(bpmHis.getFileName()).append("&");
// resultSb.append("userId=").append("null").append("&");
resultSb.append("userName=").append(userName).append("&");
// resultSb.append("isEdit=").append("123").append("&");
@@ -550,13 +509,75 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
// 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("操作失败,请联系管理员!");
// 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("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();
}
@@ -564,34 +585,43 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
public String onlyOfficePreview(JSONObject json) {
StringBuilder resultSb = new StringBuilder();
String fileId = json.getString("fileId");
String watermark = json.getString("watermark");
// String watermark = json.getString("watermark");
String userName = json.getString("userName");
// 查询历史信息:1 是 2 否
String queryType = json.getString("queryType");
if (StringUtils.equals(CommonConstant.ONLIOFFICE_QUERY_TYPE_1,queryType)) {
OnlineFileLog onlineFileLog = onlineFileLogDao.selectById(fileId);
StringBuffer downloadFileUrl = new StringBuffer();
downloadFileUrl.append(downloadUrl).append(onlineFileLog.getFilePath() == null ? "" : onlineFileLog.getFilePath());
resultSb.append(previewHistoryUrl);
resultSb.append("oldFileName=").append(onlineFileLog.getFileName()).append("&");
resultSb.append("fileType=").append("docx").append("&");
resultSb.append("attId=").append(onlineFileLog.getAttFileId()).append("&");
resultSb.append("fileUrl=").append(downloadFileUrl.toString()).append("&");
resultSb.append("key=").append(DateUtils.getCurrentTimestamp()).append("&");
resultSb.append("filePath=").append(onlineFileLog.getFilePath()).append("&");
resultSb.append("fileName=").append(onlineFileLog.getFileName());
if(ObjectUtils.isNotEmpty(onlineFileLog)){
StringBuffer downloadFileUrl = new StringBuffer();
downloadFileUrl.append(downloadUrl).append(onlineFileLog.getFilePath() == null ? "" : onlineFileLog.getFilePath());
resultSb.append(previewHistoryUrl);
resultSb.append("oldFileName=").append(onlineFileLog.getFileName()).append("&");
resultSb.append("fileType=").append("docx").append("&");
resultSb.append("userName=").append(userName).append("&");
resultSb.append("attId=").append(onlineFileLog.getAttFileId()).append("&");
resultSb.append("fileUrl=").append(downloadFileUrl.toString()).append("&");
resultSb.append("key=").append(DateUtils.getCurrentTimestamp()).append("&");
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)) {
BusProcessModelHis busProcessModelHis = this.processEditFile(fileId);
resultSb.append(onlyOfficePreviewUrl);
resultSb.append("oldFileName=").append(busProcessModelHis.getFileName()).append("&");
resultSb.append("fileType=").append("docx").append("&");
resultSb.append("attId=").append(busProcessModelHis.getId()).append("&");
resultSb.append("fileUrl=").append(busProcessModelHis.getDownLoadUrl()).append("&");
resultSb.append("key=").append(DateUtils.getCurrentTimestamp()).append("&");
resultSb.append("filePath=").append(busProcessModelHis.getEditFilePath()).append("&");
resultSb.append("fileName=").append(busProcessModelHis.getFileName());
if(ObjectUtils.isNotEmpty(busProcessModelHis)){
resultSb.append(onlyOfficePreviewUrl);
resultSb.append("oldFileName=").append(busProcessModelHis.getFileName()).append("&");
resultSb.append("fileType=").append("docx").append("&");
resultSb.append("userName=").append(userName).append("&");
resultSb.append("attId=").append(busProcessModelHis.getId()).append("&");
resultSb.append("fileUrl=").append(busProcessModelHis.getDownLoadUrl()).append("&");
resultSb.append("key=").append(DateUtils.getCurrentTimestamp()).append("&");
resultSb.append("filePath=").append(busProcessModelHis.getEditFilePath()).append("&");
resultSb.append("fileName=").append(busProcessModelHis.getFileName());
}else{
log.error("busProcessModelHis为空,fileId="+fileId);
}
}
return resultSb.toString();
}
@@ -61,7 +61,6 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.core.io.Resource;
import org.springframework.web.util.UriComponentsBuilder;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -142,7 +141,7 @@ public class FileSpiltService {
* @param enumByValue
* @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) {
sarFileSplitInfoEO.setStopNumber(200);
}
@@ -222,24 +221,21 @@ public class FileSpiltService {
try {
// 根据byd传过来的文件下载路径获取文件。
RestTemplate restTemplate = new RestTemplate();
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_JSON);
//
// // 创建MultiValueMap对象,用于存储请求参数
// MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
// String fileId = sarFileSplitInfoEO.getId();
// params.add("fileId", fileId);
//
// // 使用HttpEntity对象包装请求体和请求头
// HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers);
//
// // 发送POST请求并获取响应
// ResponseEntity<byte[]> responseEntity = restTemplate.postForEntity(bydDownLoadFileUrl, requestEntity, byte[].class);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("Authorization",token);
headers.add("appId",appId);
// 创建MultiValueMap对象,用于存储请求参数
Map<String, String> params = new HashMap<>();
String fileId = sarFileSplitInfoEO.getId();
params.put("fileId", fileId);
// 使用HttpEntity对象包装请求体和请求头
HttpEntity<Map<String, String>> requestEntity = new HttpEntity<>(params, headers);
Long fileId = Long.valueOf(sarFileSplitInfoEO.getId());
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(bydDownLoadFileUrl).queryParam("fileId", fileId);
// 发送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());
}catch (Exception ex){
@@ -96,7 +96,7 @@ public class SarFileSplitInfoServiceImpl extends ServiceImpl<SarFileSplitInfoMap
}*/
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(LanguageEnum.CN.equals(MessageUtils.getLanguage())) {
@@ -236,4 +236,5 @@ byd:
saveBaseLineDocIdUrl: http://127.0.0.1:9998/saveBaseLineDocIdUrl
splitResultUrl: http://127.0.0.1:9998/splitResultUrl
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
splitResultUrl: http://127.0.0.1:9998/api/qbp/library/structured
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
splitResultUrl: http://127.0.0.1:9998/splitResultUrl
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',
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'
}
// {
// 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)
resolve(menuData)
+12 -7
View File
@@ -10,6 +10,8 @@
<script>
import { postAction, getAction } from '../../api/manage'
import { ACCESS_TOKEN, OAUTH2_LOGIN_PAGE_PATH } from '@/store/mutation-types'
import Vue from 'vue'
export default {
name: 'index',
@@ -24,23 +26,26 @@ export default {
if (val.id) {
const oldFileName = '比亚迪企业标准'
const nowTime = new Date().getTime()
const serialNumber = 'x/xx xxxx-xxxx'
const standCode = 'G/BYD xxxx-xxxx'
const standName = '比亚迪企业标准'
const estDepart = '起草部门'
const drafts = '起草人'
const draftingDepartment = '起草部门'
const draftsman = '起草人'
const assessor = '评审人员'
const focalUnit = '归口单位'
const watermark = '比亚迪'
const replaceStand = ''
const Authorization = 'token'
const appId = 'appId'
// http://39.98.140.126:8999
// http://127.0.0.1:8080
window.open(window.CONFIG.onlyOfficeRoute + '/editor?fileId=' + val.id + '&pid=' + val.pid +
'&taskIds=' + val.taskId + '&oldFileName=' + oldFileName + '&assessor=' + assessor +
'&fileType=docx' + '&attId=' + val.id + '&fileUrl=' + val.downLoadUrl +
'&key=' + val.id + nowTime + '&filePath=' + val.editFilePath + '&fileName=' + val.fileName +
'&userId=' + val.userId + '&userName=admin' + '&serialNumber=' + serialNumber +
'&standName=' + standName + '&replaceStand=' + replaceStand + '&drafts=' + drafts +
'&estDepart=' + estDepart + '&focalUnit=' + focalUnit + '&watermark=' + watermark)
'&key=' + nowTime + '&filePath=' + val.editFilePath + '&fileName=' + val.fileName +
'&userId=' + val.userId + '&userName=admin' + '&standCode=' + standCode +
'&standName=' + standName + '&replaceStand=' + replaceStand + '&draftsman=' + draftsman +
'&draftingDepartment=' + draftingDepartment + '&focalUnit=' + focalUnit + '&watermark=' + watermark +
'&Authorization=' + Authorization + '&appId=' + appId)
}
})
} else {