Commit 86e264f6 authored by wei's avatar wei 🎱

移交单流程结束生成移交单,文件移交文件目录附件todo

parent 200a5630
...@@ -457,6 +457,11 @@ public class Constants { ...@@ -457,6 +457,11 @@ public class Constants {
*/ */
public static final String APPLICATION_DOC_INNER_NAME ="dcs-doc"; public static final String APPLICATION_DOC_INNER_NAME ="dcs-doc";
/**
* app 内部名称
*/
public static final String DCS_ARCHIVES = "dcs-archives";
/** /**
* 部分文档类型无流程 * 部分文档类型无流程
*/ */
......
...@@ -6,6 +6,7 @@ import com.inet.dcs.document.core.constants.Constants; ...@@ -6,6 +6,7 @@ import com.inet.dcs.document.core.constants.Constants;
import com.inet.dcs.document.core.constants.SignConstants; import com.inet.dcs.document.core.constants.SignConstants;
import com.inet.dcs.document.core.service.ExtBorrowingDocLinkService; import com.inet.dcs.document.core.service.ExtBorrowingDocLinkService;
import com.inet.dcs.document.core.service.ExtBorrowingFormService; import com.inet.dcs.document.core.service.ExtBorrowingFormService;
import com.inet.dcs.document.core.service.ExtTransferDocLinkService;
import com.inet.dcs.document.core.service.expand.ExtDxDocumentService; import com.inet.dcs.document.core.service.expand.ExtDxDocumentService;
import com.inet.dcs.document.core.service.impl.ExtBorrowingFormServiceImpl; import com.inet.dcs.document.core.service.impl.ExtBorrowingFormServiceImpl;
import com.inet.dcs.document.core.util.SearchUtil; import com.inet.dcs.document.core.util.SearchUtil;
...@@ -46,6 +47,9 @@ public class ExtBorrowingFormEvent { ...@@ -46,6 +47,9 @@ public class ExtBorrowingFormEvent {
@Autowired @Autowired
private ExtDxDocumentService extDxDocumentService; private ExtDxDocumentService extDxDocumentService;
@Autowired
private ExtTransferDocLinkService extTransferDocLinkService;
public void postUpdate(ExtBorrowingFormVO extBorrowingFormVO) { public void postUpdate(ExtBorrowingFormVO extBorrowingFormVO) {
if (Constants.RETURNED.equals(extBorrowingFormVO.getState())) { if (Constants.RETURNED.equals(extBorrowingFormVO.getState())) {
// 获取档案组流程审批人信息 // 获取档案组流程审批人信息
...@@ -91,6 +95,10 @@ public class ExtBorrowingFormEvent { ...@@ -91,6 +95,10 @@ public class ExtBorrowingFormEvent {
List<ExtBorrowingDocLinkVO> extBorrowingDocLinkVOList = extBorrowingDocLinkService.findRecursion(queryCondition).getContent(); List<ExtBorrowingDocLinkVO> extBorrowingDocLinkVOList = extBorrowingDocLinkService.findRecursion(queryCondition).getContent();
Long sourceId = extBorrowingDocLinkVOList.get(0).getSourceId(); Long sourceId = extBorrowingDocLinkVOList.get(0).getSourceId();
extDxDocumentService.updateBorrowingStatus(sourceId, ExtBorrowingFormServiceImpl.BORROWING_IN_PROGRESS); extDxDocumentService.updateBorrowingStatus(sourceId, ExtBorrowingFormServiceImpl.BORROWING_IN_PROGRESS);
// 获取文档档号和文件名称
} }
// 更新借阅人,借阅日期,借阅部门
} }
} }
package com.inet.dcs.document.core.factory;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject;
import com.inet.dcs.document.common.vo.ExtTransferDocumentVO;
import com.inet.dcs.document.core.constants.Constants;
import com.inet.dcs.document.core.service.ExtDocService;
import com.inet.dcs.document.core.service.ExtTransferDocLinkService;
import com.inet.dcs.document.core.util.SearchUtil;
import com.inet.dcs.document.core.word.ImportWordService;
import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.dfs.vo.ObjFileLinkVO;
import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.user.feign.DxUserInfoFeign;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author whd
* @ClassName TransferDocumentUtils.java
* @Description 移交单单填充业务数据类
* @createTime 2024/11/12 10:34:00
*/
@Component
public class TransferDocumentUtils {
@Autowired
private ExtDocService extDocService;
@Autowired
private ImportWordService importWordService;
@Autowired
private ExtTransferDocLinkService extTransferDocLinkService;
@Autowired
private DxUserInfoFeign userService;
/**
* 填充数据
*
* @param
* @return
*/
public void settingData(ExtTransferDocumentVO extTransferDocumentVO, DxWfProcessInfoVO wfProcessInfoVO) {
String path = Constants.MTEMPLATE_ABSOLUTE_PATH;
String file = extTransferDocumentVO.getSubTypeName();
String outFilePath = Constants.MERGER_FILE_ABSOLUTE_PATH + extTransferDocumentVO.getSubTypeName() + "\\" + extTransferDocumentVO.getNumber() + "\\";
//生成特定的文档目录,保存生成的word文件
FileUtil.mkdir(outFilePath);
JSONObject jsonObject = new JSONObject();
//JSONObject jsonObject = (JSONObject) JSONObject.toJSON(extTransferDocumentVO);
String topicTitle = extTransferDocumentVO.getTopicTitle();
String ktName = StringUtils.isBlank(topicTitle) ? extTransferDocumentVO.getProjectName() : topicTitle;
jsonObject.put("ktName", ktName);//课题题名
String yjbm = extTransferDocumentVO.getDxTransferDocOrg().getName();
jsonObject.put("yjbm", yjbm);//移交部门
SearchQueryCondition queryCondition = SearchUtil.buildQuery("targetId", SearchItem.Operator.EQ, extTransferDocumentVO.getId());
int zfs = extTransferDocLinkService.findRecursion(queryCondition).getContent().size();
jsonObject.put("zfs", zfs);//总份数
Long userId = extTransferDocumentVO.getDxTransferUserInfoId();
DxUserInfoVO userVO = (DxUserInfoVO) userService.get(userId);
String yjrPhoto = userVO.getUserAccount() + ".png";
jsonObject.put("yjr_photo", yjrPhoto);//移交人
Long dxRecipientUserInfoId = extTransferDocumentVO.getDxRecipientUserInfoId();
DxUserInfoVO dxRecipientUser = (DxUserInfoVO) userService.get(dxRecipientUserInfoId);
String jsrPhoto = dxRecipientUser.getUserAccount() + ".png";
jsonObject.put("jsr_photo", jsrPhoto);//接收人
LocalDateTime handoverTime = extTransferDocumentVO.getHandoverTime();
String jsrDate = handoverTime.getYear() + "年" + handoverTime.getMonthValue() + "月" + handoverTime.getDayOfMonth() + "日";
jsonObject.put("jsr_date", jsrDate);//接收人日期
//模板名称
importWordService.getWordAllTable(jsonObject, path + file + ".docx", outFilePath + "outFile.docx");
}
/**
* 校验是否有内容附件
*
* @param jsonObject
* @param objFileLinks
* @param attach
*/
private void checkObjFileLinks(JSONObject jsonObject, List<ObjFileLinkVO> objFileLinks, String attach) {
if (CollectionUtils.isEmpty(objFileLinks)) {
//对号
jsonObject.put("noselect", "\u0052");
//方框
jsonObject.put("select", "\u00A3");
} else {
List<ObjFileLinkVO> collect = objFileLinks.stream().filter(item ->
Constants.CONTACT_CONTENT_ATTACH.equals(item.getContentType())
).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
jsonObject.put("noselect", "\u00A3");
jsonObject.put("select", "\u0052");
} else {
//对号
jsonObject.put("noselect", "\u0052");
//方框
jsonObject.put("select", "\u00A3");
}
}
}
}
...@@ -9,6 +9,8 @@ import com.yonde.dex.basedata.entity.data.DxPageImpl; ...@@ -9,6 +9,8 @@ import com.yonde.dex.basedata.entity.data.DxPageImpl;
import com.yonde.dex.user.common.vo.DxUserInfoVO; import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO; import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
import java.io.FileInputStream;
import java.io.IOException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
...@@ -39,4 +41,8 @@ public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> ext ...@@ -39,4 +41,8 @@ public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> ext
void returnDocumentByDocId(Long docId); void returnDocumentByDocId(Long docId);
void batchByIds(String ids); void batchByIds(String ids);
ExtTransferDocumentVO findDocObjFileLinks(Long id);
void extractedAttachFile(ExtTransferDocumentVO extTransferDocumentVO, FileInputStream fileInputStream, String fileName, String attachFile) throws IOException;
} }
package com.inet.dcs.document.core.service.impl; package com.inet.dcs.document.core.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
...@@ -11,7 +10,6 @@ import cn.hutool.http.ContentType; ...@@ -11,7 +10,6 @@ import cn.hutool.http.ContentType;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.inet.dcs.document.common.vo.*; import com.inet.dcs.document.common.vo.*;
import com.inet.dcs.document.core.constants.Constants; import com.inet.dcs.document.core.constants.Constants;
import com.inet.dcs.document.core.constants.SignConstants; import com.inet.dcs.document.core.constants.SignConstants;
...@@ -21,8 +19,8 @@ import com.inet.dcs.document.core.factory.*; ...@@ -21,8 +19,8 @@ import com.inet.dcs.document.core.factory.*;
import com.inet.dcs.document.core.service.*; import com.inet.dcs.document.core.service.*;
import com.inet.dcs.document.core.util.*; import com.inet.dcs.document.core.util.*;
import com.inet.dcs.document.core.word.ImportWordService; import com.inet.dcs.document.core.word.ImportWordService;
import com.yonde.dcs.document.core.service.*;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO; import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.document.core.service.DocumentService;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanDocLinkVO; import com.yonde.dcs.plan.common.vo.ExtIEDPlanDocLinkVO;
import com.yonde.dcs.plan.common.vo.ExtPlanDocLinkVO; import com.yonde.dcs.plan.common.vo.ExtPlanDocLinkVO;
import com.yonde.dcs.plan.common.vo.ExtPlanVO; import com.yonde.dcs.plan.common.vo.ExtPlanVO;
...@@ -34,7 +32,6 @@ import com.yonde.dex.basedata.entity.api.CustomMultipartFile; ...@@ -34,7 +32,6 @@ import com.yonde.dex.basedata.entity.api.CustomMultipartFile;
import com.yonde.dex.basedata.entity.data.DxPageImpl; import com.yonde.dex.basedata.entity.data.DxPageImpl;
import com.yonde.dex.basedata.entity.data.OperatorType; import com.yonde.dex.basedata.entity.data.OperatorType;
import com.yonde.dex.basedata.entity.jackson.JsonUtils; import com.yonde.dex.basedata.entity.jackson.JsonUtils;
import com.yonde.dex.basedata.entity.vo.IdVO;
import com.yonde.dex.basedata.exception.DxBusinessException; import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.dao.service.util.DxPageUtils; import com.yonde.dex.dao.service.util.DxPageUtils;
import com.yonde.dex.dfs.feign.FileManagerFeignService; import com.yonde.dex.dfs.feign.FileManagerFeignService;
...@@ -44,7 +41,10 @@ import com.yonde.dex.dfs.vo.RepoFileVO; ...@@ -44,7 +41,10 @@ import com.yonde.dex.dfs.vo.RepoFileVO;
import com.yonde.dex.user.common.vo.DxOrganizationVO; import com.yonde.dex.user.common.vo.DxOrganizationVO;
import com.yonde.dex.user.common.vo.DxPostMemberLinkVO; import com.yonde.dex.user.common.vo.DxPostMemberLinkVO;
import com.yonde.dex.user.common.vo.DxUserInfoVO; import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.user.feign.*; import com.yonde.dex.user.feign.DxOrganizationFeign;
import com.yonde.dex.user.feign.DxPostMemberLinkFeign;
import com.yonde.dex.user.feign.DxUserInfoFeign;
import com.yonde.dex.user.feign.SwitchUserService;
import com.yonde.dex.utils.common.utils.DxFileUtils; import com.yonde.dex.utils.common.utils.DxFileUtils;
import com.yonde.dex.version.plugin.common.entity.DxIterationVOHolder; import com.yonde.dex.version.plugin.common.entity.DxIterationVOHolder;
import com.yonde.dex.wfc.common.enums.ProcessStateEnum; import com.yonde.dex.wfc.common.enums.ProcessStateEnum;
...@@ -53,7 +53,6 @@ import com.yonde.dex.wfc.common.vo.*; ...@@ -53,7 +53,6 @@ import com.yonde.dex.wfc.common.vo.*;
import com.yonde.dex.wfc.feign.api.WfcActivityFeign; import com.yonde.dex.wfc.feign.api.WfcActivityFeign;
import com.yonde.dex.wfc.feign.api.WfcProcessFeign; import com.yonde.dex.wfc.feign.api.WfcProcessFeign;
import com.yonde.dex.wfc.feign.api.WfcTaskFeign; import com.yonde.dex.wfc.feign.api.WfcTaskFeign;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -61,7 +60,6 @@ import org.apache.commons.collections.MapUtils; ...@@ -61,7 +60,6 @@ import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.utils.CloneUtils; import org.apache.http.client.utils.CloneUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
...@@ -173,6 +171,12 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -173,6 +171,12 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
@Autowired @Autowired
ExtDesignReviewMinutesService extDesignReviewMinutesService; ExtDesignReviewMinutesService extDesignReviewMinutesService;
@Autowired
private ExtTransferDocumentService extTransferDocumentService;
@Autowired
private TransferDocumentUtils transferDocumentUtils;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -275,7 +279,41 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -275,7 +279,41 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
@Override @Override
public void generateTransferDocumentWordSign(ExtTransferDocumentVO extTransferDocumentVO) { public void generateTransferDocumentWordSign(ExtTransferDocumentVO extTransferDocumentVO) {
//深度查询展开ObjLink
extTransferDocumentVO = extTransferDocumentService.findDocObjFileLinks(extTransferDocumentVO.getId());
log.info("自动任务======生成word签名开始");
DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(extTransferDocumentVO);
DxWfProcessInfoVO wfProcessInfoVO = workFlowUtil.getProcessInstDetail(wfProcessInstVO);
String subTypeName = extTransferDocumentVO.getSubTypeName();
log.info("自动任务======生成word签名进行中,文档SubTypeName:{}", subTypeName);
this.generateTransferDocumentSign(extTransferDocumentVO, wfProcessInfoVO, extTransferDocumentVO.getNumber());
//保存附件
extTransferDocumentService.saveRecursion(extTransferDocumentVO);
log.info("自动任务======生成word签名完成");
}
private void generateTransferDocumentSign(ExtTransferDocumentVO extTransferDocumentVO, DxWfProcessInfoVO wfProcessInfoVO, String fileName) {
try {
transferDocumentUtils.settingData(extTransferDocumentVO, wfProcessInfoVO);
log.info("签名----生成word文件内容结束====");
//按照目录获取生成的pdf和word
String outFilePath = Constants.MERGER_FILE_ABSOLUTE_PATH + extTransferDocumentVO.getSubTypeName() + "\\" + extTransferDocumentVO.getNumber() + "\\";
//获取文件夹的所有文件--绝对路径
List<String> fileList = new ArrayList<>();
File[] files = FileUtil.ls(outFilePath);
Arrays.stream(files).forEach(item -> fileList.add(item.getAbsolutePath()));
if (org.springframework.util.CollectionUtils.isEmpty(fileList)) {
log.error("签名----生成的word文件目录内容为空====");
} else {
String pdfFilePath = fileList.stream().filter(item -> item.endsWith(".pdf")).findFirst().get();
extTransferDocumentService.extractedAttachFile(extTransferDocumentVO, new FileInputStream(pdfFilePath), fileName, Constants.ATTACH_FILE);
log.info("签名----获取生成的word文件内容结束====");
}
//删除生成后的临时文件
FileUtils.deleteDirectory(Constants.MERGER_FILE_ABSOLUTE_PATH + extTransferDocumentVO.getSubTypeName() + "\\" + extTransferDocumentVO.getNumber());
} catch (Exception e) {
log.error("签名----通过不同的文档类型生成不同word错误:{}" + e.getMessage());
}
} }
@SneakyThrows @SneakyThrows
......
...@@ -16,6 +16,7 @@ import com.inet.dcs.document.core.service.ExtTransferDocLinkService; ...@@ -16,6 +16,7 @@ import com.inet.dcs.document.core.service.ExtTransferDocLinkService;
import com.inet.dcs.document.core.service.ExtTransferDocumentService; import com.inet.dcs.document.core.service.ExtTransferDocumentService;
import com.inet.dcs.document.core.service.expand.ExtDxDocumentService; import com.inet.dcs.document.core.service.expand.ExtDxDocumentService;
import com.inet.dcs.document.core.service.impl.expand.ExtDxDocumentServiceImpl; import com.inet.dcs.document.core.service.impl.expand.ExtDxDocumentServiceImpl;
import com.inet.dcs.document.core.util.CommonUtil;
import com.inet.dcs.document.core.util.SearchUtil; import com.inet.dcs.document.core.util.SearchUtil;
import com.inet.dcs.document.entity.po.ExtTransferDocument; import com.inet.dcs.document.entity.po.ExtTransferDocument;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO; import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
...@@ -28,10 +29,17 @@ import com.yonde.dex.basedata.exception.DxBusinessException; ...@@ -28,10 +29,17 @@ import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.basic.feign.expand.ExtDxContextProjectServiceFeign; import com.yonde.dex.basic.feign.expand.ExtDxContextProjectServiceFeign;
import com.yonde.dex.context.common.vo.DxContextProjectVO; import com.yonde.dex.context.common.vo.DxContextProjectVO;
import com.yonde.dex.dao.service.DxDaoPluginExpander; import com.yonde.dex.dao.service.DxDaoPluginExpander;
import com.yonde.dex.dao.service.util.DxPageUtils;
import com.yonde.dex.dfs.feign.FileManagerFeignService;
import com.yonde.dex.dfs.objfilelink.plugin.core.util.DxObjFileUtils;
import com.yonde.dex.dfs.vo.ObjFileLinkVO;
import com.yonde.dex.dfs.vo.RepoFileVO;
import com.yonde.dex.dict.feign.DictDataFeignService; import com.yonde.dex.dict.feign.DictDataFeignService;
import com.yonde.dex.dict.service.vo.DictDataVO; import com.yonde.dex.dict.service.vo.DictDataVO;
import com.yonde.dex.feign.info.DxApplicationFeignService;
import com.yonde.dex.user.common.vo.DxUserInfoVO; import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.user.feign.DxUserInfoFeign; import com.yonde.dex.user.feign.DxUserInfoFeign;
import com.yonde.dex.vo.info.DxApplicationVO;
import com.yonde.dex.wfc.common.enums.TaskStateEnum; import com.yonde.dex.wfc.common.enums.TaskStateEnum;
import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO; import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
import com.yonde.dex.wfc.feign.api.WfcProcessFeign; import com.yonde.dex.wfc.feign.api.WfcProcessFeign;
...@@ -40,8 +48,12 @@ import org.apache.commons.collections4.CollectionUtils; ...@@ -40,8 +48,12 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.FileInputStream;
import java.io.IOException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.Arrays; import java.util.Arrays;
...@@ -95,6 +107,12 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -95,6 +107,12 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
@Autowired @Autowired
private DictDataFeignService dictDataService; private DictDataFeignService dictDataService;
@Autowired
private FileManagerFeignService fileManagerFeignService;
@Autowired
DxApplicationFeignService feignService;
@Override @Override
public void postUpdate(Collection<V> target, Collection<V> origin) { public void postUpdate(Collection<V> target, Collection<V> origin) {
for (V v : target) { for (V v : target) {
...@@ -292,6 +310,67 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -292,6 +310,67 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
} }
} }
@Override
public ExtTransferDocumentVO findDocObjFileLinks(Long id) {
SearchQueryCondition queryDoc = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("creator").build())
.openProp(SearchQueryCondition.builder().name("modifier").build())
.openProp(SearchQueryCondition.builder().name("objFileLinks")
.openProp(SearchQueryCondition.builder().name("target").build()).build())
.searchItems(SearchItems.builder()
.item(new SearchItem("id", SearchItem.Operator.EQ, id, null))
.item(new SearchItem("latest", SearchItem.Operator.EQ, true, null))
.operator(SearchItems.BooleanOperator.AND).build()).build();
//通过id查询文档
DxPageImpl<V> recursion = this.findRecursion(queryDoc);
if (CollectionUtils.isNotEmpty(recursion.getContent())) {
ExtTransferDocumentVO extTransferDocumentVO = DxPageUtils.getFirst(recursion);
return extTransferDocumentVO;
}
return null;
}
@Override
public void extractedAttachFile(ExtTransferDocumentVO extTransferDocumentVO, FileInputStream inputStreamPdf, String fileName, String docFileType) throws IOException {
String originalFileName = org.springframework.util.StringUtils.isEmpty(fileName) ? extTransferDocumentVO.getName() : fileName;
String secretCode = CommonUtil.getSecretCode(extTransferDocumentVO.getSecretCode());
originalFileName = originalFileName + "(" + secretCode + ")";
//上传文件到文件服务器
MultipartFile multipartFile = null;
multipartFile = new MockMultipartFile("file", originalFileName + ".pdf", Constants.CONTENT_TYPE_PDF, inputStreamPdf);
RepoFileVO field = fileManagerFeignService.uploadFile(multipartFile, this.getBucketId());
if (field == null) {
log.error("文件上传失败!");
} else {
log.info("文件上传成功:" + field);
}
//根据docId查询文件对象
RepoFileVO fileVO = fileManagerFeignService.findFileInfoById(field.getId());
//上传到DOC_PDF_FILE为了浏览(Constants.PDF_FILE)
this.doProcessDoc(extTransferDocumentVO, fileVO, docFileType);
}
public Long getBucketId() {
DxApplicationVO applicationVO = feignService.findApplicationByInnerName(Constants.DCS_ARCHIVES);
if (!org.springframework.util.ObjectUtils.isEmpty(applicationVO)) {
return Long.valueOf(applicationVO.getBucketId());
}
return null;
}
private void doProcessDoc(ExtTransferDocumentVO extTransferDocumentVO, RepoFileVO fileVO, String fileType) {
List<ObjFileLinkVO> objFileLinks = extTransferDocumentVO.getObjFileLinks();
//删除逻辑
if (!org.springframework.util.CollectionUtils.isEmpty(objFileLinks)) {
objFileLinks.forEach(item -> {
if (item.getContentType().equals(fileType) && item.getTarget().getOriginalFileName().equals(fileVO.getOriginalFileName())) {
item.setOperator(OperatorType.REMOVE);
}
});
}
DxObjFileUtils.addFile(extTransferDocumentVO, fileVO, fileType);
}
@Override @Override
public DxUserInfoVO getSignInfo(List<DxWfProcessTaskVO> activities, String activityName) { public DxUserInfoVO getSignInfo(List<DxWfProcessTaskVO> activities, String activityName) {
for (DxWfProcessTaskVO wf : activities) { for (DxWfProcessTaskVO wf : activities) {
......
...@@ -141,10 +141,12 @@ public class ExtDocUtil { ...@@ -141,10 +141,12 @@ public class ExtDocUtil {
SearchQueryCondition queryDoc = SearchQueryCondition.builder() SearchQueryCondition queryDoc = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("creator").build()) .openProp(SearchQueryCondition.builder().name("creator").build())
.openProp(SearchQueryCondition.builder().name("modifier").build()) .openProp(SearchQueryCondition.builder().name("modifier").build())
.openProp(SearchQueryCondition.builder().name("objFileLinks").openProp(SearchQueryCondition.builder().name("target").build()).build()) .openProp(SearchQueryCondition.builder().name("objFileLinks")
.searchItems(SearchItems.builder().item(new SearchItem("id", SearchItem.Operator.EQ, .openProp(SearchQueryCondition.builder().name("target").build()).build())
id, null)).item(new SearchItem("latest", SearchItem.Operator.EQ, .searchItems(SearchItems.builder()
true, null)).operator(SearchItems.BooleanOperator.AND).build()).build(); .item(new SearchItem("id", SearchItem.Operator.EQ, id, null))
.item(new SearchItem("latest", SearchItem.Operator.EQ, true, null))
.operator(SearchItems.BooleanOperator.AND).build()).build();
//通过id查询文档 //通过id查询文档
DxPageImpl<DxDocumentVO> recursion = docCenterFeignService.findRecursion(queryDoc); DxPageImpl<DxDocumentVO> recursion = docCenterFeignService.findRecursion(queryDoc);
if (!CollectionUtils.isEmpty(recursion.getContent())) { if (!CollectionUtils.isEmpty(recursion.getContent())) {
...@@ -181,7 +183,8 @@ public class ExtDocUtil { ...@@ -181,7 +183,8 @@ public class ExtDocUtil {
public List<ExtObsoleteDocLinkVO> recursionObsoleteDocLinkByTargetId(Long targetId) { public List<ExtObsoleteDocLinkVO> recursionObsoleteDocLinkByTargetId(Long targetId) {
SearchQueryCondition condition = SearchQueryCondition.builder() SearchQueryCondition condition = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("source") .openProp(SearchQueryCondition.builder().name("source")
.openProp(SearchQueryCondition.builder().name("objFileLinks").openProp(SearchQueryCondition.builder().name("target").build()).build()).build()) .openProp(SearchQueryCondition.builder().name("objFileLinks")
.openProp(SearchQueryCondition.builder().name("target").build()).build()).build())
.searchItems(SearchItems.builder().item(new SearchItem("targetId", SearchItem.Operator.EQ, targetId, null)).build()).build(); .searchItems(SearchItems.builder().item(new SearchItem("targetId", SearchItem.Operator.EQ, targetId, null)).build()).build();
DxPageImpl<ExtObsoleteDocLinkVO> recursion = obsoleteDocLinkService.findRecursion(condition); DxPageImpl<ExtObsoleteDocLinkVO> recursion = obsoleteDocLinkService.findRecursion(condition);
if (!CollectionUtils.isEmpty(recursion.getContent())) { if (!CollectionUtils.isEmpty(recursion.getContent())) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment