diff --git a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/docking/controller/DockingController.java b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/docking/controller/DockingController.java index c3f3b67..bc67309 100644 --- a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/docking/controller/DockingController.java +++ b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/docking/controller/DockingController.java @@ -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 resultMap = new HashMap<>(); resultMap.put("infoId",docId); diff --git a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/documenttool/controller/DocumentSplitController.java b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/documenttool/controller/DocumentSplitController.java index 02e4426..aeb1c16 100644 --- a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/documenttool/controller/DocumentSplitController.java +++ b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/documenttool/controller/DocumentSplitController.java @@ -140,7 +140,7 @@ public class DocumentSplitController { @PostMapping(value = "/split") @ApiOperationSupport(order = 6) public Result 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)); } diff --git a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/documenttool/service/IDocumentSplitService.java b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/documenttool/service/IDocumentSplitService.java index 4578637..4ff9178 100644 --- a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/documenttool/service/IDocumentSplitService.java +++ b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/documenttool/service/IDocumentSplitService.java @@ -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); /** * 拆分文档保存 diff --git a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/documenttool/service/impl/DocumentSplitServiceImpl.java b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/documenttool/service/impl/DocumentSplitServiceImpl.java index dc59cb1..d16b2ad 100644 --- a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/documenttool/service/impl/DocumentSplitServiceImpl.java +++ b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/documenttool/service/impl/DocumentSplitServiceImpl.java @@ -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 params = new LinkedMultiValueMap<>(); - params.add("standardCode", sarFileSplitInfoEO.getSerialNumber()); - params.add("docId", sarFileSplitInfoEO.getId()); - params.add("brief", ""); - params.add("successful", successful); + Map params = new HashMap<>(); + params.put("standardCode", sarFileSplitInfoEO.getSerialNumber()); + params.put("docId", sarFileSplitInfoEO.getId()); + params.put("brief", ""); + params.put("successful", successful); // 使用HttpEntity对象包装请求体和请求头 - HttpEntity> requestEntity = new HttpEntity<>(params, headers); + HttpEntity> requestEntity = new HttpEntity<>(params, headers); // 发送POST请求并获取响应 ResponseEntity 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); diff --git a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java index 1d69f8d..410312f 100644 --- a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java +++ b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java @@ -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> pageList(HttpServletRequest req, BusProcessModelHis processModelHis, @@ -521,6 +525,8 @@ public class OnlyOfficeController { public Result 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 params2 = new LinkedMultiValueMap<>(); @@ -564,6 +572,7 @@ public class OnlyOfficeController { // 发送POST请求并获取响应 ResponseEntity 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 params = new LinkedMultiValueMap<>(); - params.add("fileId", createTimeLatestOnlineFileLog2.getHisId()); // 每一次草稿的id(第一次发起文档编辑时的id) - params.add("docId", createTimeLatestOnlineFileLog2.getId()); // 基线文档主键id + Map params = new HashMap<>(); + params.put("fileId", createTimeLatestOnlineFileLog2.getHisId()); // 每一次草稿的id(第一次发起文档编辑时的id) + params.put("docId", createTimeLatestOnlineFileLog2.getId()); // 基线文档主键id + params.put("jxFileName", jxFileName); // 基线文档名称 // 使用HttpEntity对象包装请求体和请求头 - HttpEntity> requestEntity = new HttpEntity<>(params, headers); + HttpEntity> requestEntity = new HttpEntity<>(params, headers); // 发送POST请求并获取响应 ResponseEntity 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 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 params = new HashMap<>(); + params.put("fileId", fileId); + // 使用HttpEntity对象包装请求体和请求头 + HttpEntity> requestEntity = new HttpEntity<>(params, headers); + // 发送POST请求并获取响应 + ResponseEntity 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") diff --git a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/onlyoffice/service/impl/BusProcessModelHisServiceImpl.java b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/onlyoffice/service/impl/BusProcessModelHisServiceImpl.java index a4b1d54..4de8243 100644 --- a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/onlyoffice/service/impl/BusProcessModelHisServiceImpl.java +++ b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/onlyoffice/service/impl/BusProcessModelHisServiceImpl.java @@ -463,83 +463,42 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl> requestEntity = new HttpEntity<>(params, headers); -// -// // 发送POST请求并获取响应 -// ResponseEntity 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 params = new HashMap<>(); + String fileId = sarFileSplitInfoEO.getId(); + params.put("fileId", fileId); + + // 使用HttpEntity对象包装请求体和请求头 + HttpEntity> requestEntity = new HttpEntity<>(params, headers); - Long fileId = Long.valueOf(sarFileSplitInfoEO.getId()); - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(bydDownLoadFileUrl).queryParam("fileId", fileId); // 发送POST请求并获取响应 - ResponseEntity responseEntity = restTemplate.postForEntity(builder.toUriString(), null, byte[].class); + ResponseEntity responseEntity = restTemplate.postForEntity(bydDownLoadFileUrl, requestEntity, byte[].class); // 获取文件流 splitFileIs = new ByteArrayInputStream(responseEntity.getBody()); }catch (Exception ex){ diff --git a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/split/service/impl/SarFileSplitInfoServiceImpl.java b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/split/service/impl/SarFileSplitInfoServiceImpl.java index 7166ed5..b5e42c1 100644 --- a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/split/service/impl/SarFileSplitInfoServiceImpl.java +++ b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/split/service/impl/SarFileSplitInfoServiceImpl.java @@ -96,7 +96,7 @@ public class SarFileSplitInfoServiceImpl extends ServiceImpl 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 {