Commit f1fd1dfb authored by pchxue's avatar pchxue

配置文件修改

parent 4036e65d
...@@ -88,6 +88,33 @@ ...@@ -88,6 +88,33 @@
<version>5.2.12.RELEASE</version> <version>5.2.12.RELEASE</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.jacob</groupId>
<artifactId>jacob</artifactId>
<version>1.19</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/jacob.jar</systemPath>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.15</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.24</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -15,6 +15,7 @@ import com.yonde.dcs.document.common.vo.DxDocumentVO; ...@@ -15,6 +15,7 @@ import com.yonde.dcs.document.common.vo.DxDocumentVO;
import com.yonde.dcs.document.core.constants.Constants; import com.yonde.dcs.document.core.constants.Constants;
import com.yonde.dcs.document.core.util.FileUtils; import com.yonde.dcs.document.core.util.FileUtils;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO; import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessVO;
import com.yonde.dex.wfc.common.vo.WfProcessInfoVO; import com.yonde.dex.wfc.common.vo.WfProcessInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessInstVO; import com.yonde.dex.wfc.common.vo.DxWfProcessInstVO;
import com.yonde.dex.wfc.feign.api.DexWorkFlowService; import com.yonde.dex.wfc.feign.api.DexWorkFlowService;
...@@ -67,7 +68,7 @@ public class ProcessDataUtils { ...@@ -67,7 +68,7 @@ public class ProcessDataUtils {
*/ */
public void processData(DxDocumentVO documentVo) { public void processData(DxDocumentVO documentVo) {
String subTypeName = documentVo.getSubTypeName(); String subTypeName = documentVo.getSubTypeName();
WfProcessInstVO DxWfProcessInstVO = workFlowUtil.getWfProcessInst(documentVo); DxWfProcessVO DxWfProcessInstVO = workFlowUtil.getWfProcessInst(documentVo);
DxWfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(DxWfProcessInstVO.getId()); DxWfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(DxWfProcessInstVO.getId());
switch (subTypeName) { switch (subTypeName) {
case Constants.INTERNAL_INTERFACE: case Constants.INTERNAL_INTERFACE:
......
...@@ -10,12 +10,15 @@ import com.yonde.dcs.document.common.vo.*; ...@@ -10,12 +10,15 @@ import com.yonde.dcs.document.common.vo.*;
import com.yonde.dcs.document.core.constants.Constants; import com.yonde.dcs.document.core.constants.Constants;
import com.yonde.dcs.document.core.events.DocBeforeCreateEvent; import com.yonde.dcs.document.core.events.DocBeforeCreateEvent;
import com.yonde.dcs.document.core.events.ProcessDataUtils; import com.yonde.dcs.document.core.events.ProcessDataUtils;
import com.yonde.dcs.document.core.factory.NCRSCUtils;
import com.yonde.dcs.document.core.factory.TechnicalFileUtils; import com.yonde.dcs.document.core.factory.TechnicalFileUtils;
import com.yonde.dcs.document.core.service.*; import com.yonde.dcs.document.core.service.*;
import com.yonde.dcs.document.core.util.ExtDocUtil; import com.yonde.dcs.document.core.util.ExtDocUtil;
import com.yonde.dcs.document.core.util.FileUtils; import com.yonde.dcs.document.core.util.FileUtils;
import com.yonde.dcs.document.core.util.WorkFlowUtil; import com.yonde.dcs.document.core.util.WorkFlowUtil;
import com.yonde.dcs.document.core.word.ImportWordService; import com.yonde.dcs.document.core.word.ImportWordService;
import com.yonde.dcs.plan.common.vo.ExtPlanDocLinkVO;
import com.yonde.dcs.plan.common.vo.ExtPlanVO;
import com.yonde.dcs.plan.feign.ExtDistributeRecordServiceFeign; import com.yonde.dcs.plan.feign.ExtDistributeRecordServiceFeign;
import com.yonde.dcs.plan.feign.ExtPlanDocLinkServiceFeign; import com.yonde.dcs.plan.feign.ExtPlanDocLinkServiceFeign;
import com.yonde.dcs.plan.feign.ExtPlanServiceFeign; import com.yonde.dcs.plan.feign.ExtPlanServiceFeign;
...@@ -221,7 +224,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -221,7 +224,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
//得到souceId获取计划,更新计划状态 //得到souceId获取计划,更新计划状态
ExtPlanVO source = planDocLinkVO.getSource(); ExtPlanVO source = planDocLinkVO.getSource();
source.setTaskState(Constants.COMPLETED); source.setTaskState(Constants.COMPLETED);
extPlanService.saveAndChangeState(source); // TODO: 2024/8/1 extPlanService.saveOrUpdate这个方法不存在
// extPlanService.saveOrUpdate(source);
} }
} }
documentVO.setState(state); documentVO.setState(state);
...@@ -416,7 +420,9 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -416,7 +420,9 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
*/ */
@Override @Override
public List<DxOrganizationVO> searchOrgNameByUserId(Long userId, String code) { public List<DxOrganizationVO> searchOrgNameByUserId(Long userId, String code) {
return extPlanService.searchOrgNameByUserId(userId, code); // TODO: 2024/8/1 searchOrgNameByUserId这个方法不存在
// return extPlanService.searchOrgNameByUserId(userId, code);
return null;
} }
/** /**
...@@ -595,7 +601,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -595,7 +601,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
doc.setDynamicAttrs(map); doc.setDynamicAttrs(map);
doc.setState(extPlanVO.getPhaseState()); doc.setState(extPlanVO.getPhaseState());
//查询文档分类 //查询文档分类
this.extPlanService.searchFileType(extPlanVO.getFileType(), doc); // TODO: 2024/8/1 extPlanService.searchFileT这个方法不存在
// this.extPlanService.searchFileType(extPlanVO.getFileType(), doc);
doc.markCreatorIdHold(); doc.markCreatorIdHold();
doc.markModifyIdHold(); doc.markModifyIdHold();
//设置文档创建者 //设置文档创建者
...@@ -605,12 +612,14 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -605,12 +612,14 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
//绑定计划和文档的link //绑定计划和文档的link
ExtPlanDocLinkVO planDocLinkVO = new ExtPlanDocLinkVO(); ExtPlanDocLinkVO planDocLinkVO = new ExtPlanDocLinkVO();
planDocLinkVO.setSource(extPlanVO); planDocLinkVO.setSource(extPlanVO);
planDocLinkVO.setTarget(dxDocumentVO); // TODO: 2024/8/1 DxDocumentVO参数类型不匹对
// planDocLinkVO.setTarget(dxDocumentVO);
planDocLinkService.save(planDocLinkVO); planDocLinkService.save(planDocLinkVO);
} }
if ("计划反馈类".equals(extPlanVO.getFeedbackType())) { if ("计划反馈类".equals(extPlanVO.getFeedbackType())) {
//向计划执行人分发通知 //向计划执行人分发通知
this.extPlanService.generatePlanDistributeRecord(extPlanVO); // TODO: 2024/8/1 extPlanService.generatePlanDistributeRecord方法不存在
// this.extPlanService.generatePlanDistributeRecord(extPlanVO);
} }
} }
...@@ -637,12 +646,16 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -637,12 +646,16 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
String filePath = Constants.JD_BEFORE_MERGER_PATH + documentVO.getSubTypeName() + "/" + documentVO.getNumber() + "/" + Constants.MERGER_SOURCE; String filePath = Constants.JD_BEFORE_MERGER_PATH + documentVO.getSubTypeName() + "/" + documentVO.getNumber() + "/" + Constants.MERGER_SOURCE;
String fileInputName = Constants.BEFORE_MERGER_PATH + documentVO.getSubTypeName() + "/" + documentVO.getNumber() + "/" + Constants.MERGER_TARGET + "/" + Constants.MERGER_FILE_NAME; String fileInputName = Constants.BEFORE_MERGER_PATH + documentVO.getSubTypeName() + "/" + documentVO.getNumber() + "/" + Constants.MERGER_TARGET + "/" + Constants.MERGER_FILE_NAME;
List<ExtInterfaceInfoLinkVO> interfaceInfoLinkVOS = this.recursionInterfaceInfoLinks(documentVO.getVersionId()); List<ExtInterfaceInfoLinkVO> interfaceInfoLinkVOS = this.recursionInterfaceInfoLinks(documentVO.getVersionId());
DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(documentVO);
DxWfProcessVO wfProcessInfoVO = dexWorkFlowService.getProcessDetail(wfProcessInstVO.getId());
// TODO: 2024/8/1 getWfProcessInst返回属性不匹对
// WfProcessInstVO wfProcessInstVO = workFlowUtil.getWfProcessInst(documentVO);
// DxWfProcessVO wfProcessInfoVO = dexWorkFlowService.getProcessDetail(wfProcessInstVO.getId());
if (!CollectionUtils.isEmpty(interfaceInfoLinkVOS)) { if (!CollectionUtils.isEmpty(interfaceInfoLinkVOS)) {
//1、先根据提资记录生成多个文档 //1、先根据提资记录生成多个文档
interfaceInfoLinkVOS.stream().forEach(item -> { interfaceInfoLinkVOS.stream().forEach(item -> {
docBeforeCreateEvent.generateAutoInterFaceWord(docObjFile, item, wfProcessInfoVO); // TODO: 2024/8/1 generateAutoInterFaceWord入参不匹对
// docBeforeCreateEvent.generateAutoInterFaceWord(docObjFile, item, wfProcessInfoVO);
}); });
try { try {
//2、合并生成好的文档 //2、合并生成好的文档
...@@ -871,7 +884,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -871,7 +884,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
//深度查询展开ObjLink //深度查询展开ObjLink
DxDocumentVO documentVO = extDocUtil.findDocObjFileLinks(documentVo.getId()); DxDocumentVO documentVO = extDocUtil.findDocObjFileLinks(documentVo.getId());
log.info("自动任务======生成word签名开始"); log.info("自动任务======生成word签名开始");
DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(documentVO); // TODO: 2024/7/31 4.1返回对象不匹对 WfProcessInstVO
// WfProcessInstVO wfProcessInstVO = workFlowUtil.getWfProcessInst(documentVO);
// TODO: 2024/7/31 4.1此方法不存在 getProcessInstDetailById(processId) // TODO: 2024/7/31 4.1此方法不存在 getProcessInstDetailById(processId)
// WfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(wfProcessInstVO.getId()); // WfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(wfProcessInstVO.getId());
String subTypeName = documentVO.getSubTypeName(); String subTypeName = documentVO.getSubTypeName();
...@@ -1042,7 +1056,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -1042,7 +1056,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
@Override @Override
public void generateQHTechDoc(DxDocumentVO documentVO, Map<String, Object> wfTaskContext) { public void generateQHTechDoc(DxDocumentVO documentVO, Map<String, Object> wfTaskContext) {
if ((Constants.TECHNICAL_FILE.equals(documentVO.getOneLevCategory()))) { if ((Constants.TECHNICAL_FILE.equals(documentVO.getOneLevCategory()))) {
DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(documentVO); //TODO: 2024/7/31 4.1 不存在这个方法getWfProcessInst
// DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(documentVO);
// TODO: 2024/7/31 4.1 不存在这个方法getProcessInstDetailById // TODO: 2024/7/31 4.1 不存在这个方法getProcessInstDetailById
// DxWfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(wfProcessInstVO.getId()); // DxWfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(wfProcessInstVO.getId());
// //深度查询展开objFileLink // //深度查询展开objFileLink
......
package com.yonde.dcs.document.core.util;
import com.yonde.dex.bmodel.common.entity.vo.ModelDefinitionVO;
import com.yonde.dex.dao.service.util.ApplicationContextUtil;
import com.yonde.dex.dict.feign.DictDataFeignService;
import com.yonde.dex.dict.service.vo.DictDataVO;
import org.apache.logging.log4j.util.Strings;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class CommonUtil {
/**
* 获取字典中文密级
*
* @param key
* @return
*/
public static String getSecretCode(String key) {
if (Strings.isEmpty(key)) {
return "";
}
DictDataFeignService dictService = ApplicationContextUtil.getBean(DictDataFeignService.class);
String secretKey = "SecretCode";
List<DictDataVO> dictData = dictService.getDictDatas(secretKey);
Map<String, String> dictMap = new HashMap<>();
for (DictDataVO dict : dictData) {
dictMap.put(dict.getDictKey(), dict.getDictValue());
}
return dictMap.get(key);
}
/**
* 获取字典中文值
*
* @param key
* @return
*/
public static String getCode(String key,String dictCode) {
if (Strings.isEmpty(key)) {
return "";
}
DictDataFeignService dictService = ApplicationContextUtil.getBean(DictDataFeignService.class);
String secretKey = dictCode;
List<DictDataVO> dictData = dictService.getDictDatas(secretKey);
Map<String, String> dictMap = new HashMap<>();
for (DictDataVO dict : dictData) {
dictMap.put(dict.getDictKey(), dict.getDictValue());
}
return dictMap.get(key);
}
/**
* 根据value升序排序
*
* @param aMap
* @param <K>
* @param <V>
* @return
*/
public static <K extends Comparable, V extends Comparable> LinkedHashMap<K, V> sortMapByValues(Map<K, V> aMap) {
LinkedHashMap<K, V> finalOut = new LinkedHashMap<>();
aMap.entrySet()
.stream()
.sorted((p1, p2) -> p1.getValue().compareTo(p2.getValue()))
.collect(Collectors.toList()).forEach(ele -> finalOut.put(ele.getKey(), ele.getValue()));
return finalOut;
}
/**
* 根据key降序排序
*
* @param aMap
* @param <K>
* @param <V>
* @return
*/
public static <K extends Comparable, V extends Comparable> LinkedHashMap<K, V> sortMapByKeys(Map<K, V> aMap) {
LinkedHashMap<K, V> finalOut = new LinkedHashMap<>();
aMap.entrySet()
.stream()
.sorted((p1, p2) -> p2.getKey().compareTo(p1.getKey()))
.collect(Collectors.toList()).forEach(ele -> finalOut.put(ele.getKey(), ele.getValue()));
return finalOut;
}
}
...@@ -6,12 +6,14 @@ import com.yonde.dcs.document.common.vo.DxDocumentVO; ...@@ -6,12 +6,14 @@ import com.yonde.dcs.document.common.vo.DxDocumentVO;
import com.yonde.dcs.document.common.vo.ExtObsoleteDocLinkVO; import com.yonde.dcs.document.common.vo.ExtObsoleteDocLinkVO;
import com.yonde.dcs.document.common.vo.ObsoleteDocLinkVO; import com.yonde.dcs.document.common.vo.ObsoleteDocLinkVO;
import com.yonde.dcs.document.core.constants.Constants; import com.yonde.dcs.document.core.constants.Constants;
import com.yonde.dcs.document.core.service.DxDocumentService;
import com.yonde.dcs.document.core.service.ExtObsoleteDocLinkService; import com.yonde.dcs.document.core.service.ExtObsoleteDocLinkService;
import com.yonde.dex.basedata.data.search.SearchItem; import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchItems; import com.yonde.dex.basedata.data.search.SearchItems;
import com.yonde.dex.basedata.data.search.SearchQueryCondition; import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.basedata.entity.data.DxPageImpl; import com.yonde.dex.basedata.entity.data.DxPageImpl;
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.vo.ObjFileLinkVO; import com.yonde.dex.dfs.vo.ObjFileLinkVO;
import com.yonde.dex.dfs.vo.RepoFileVO; import com.yonde.dex.dfs.vo.RepoFileVO;
import com.yonde.dex.user.feign.DxUserInfoFeign; import com.yonde.dex.user.feign.DxUserInfoFeign;
...@@ -41,13 +43,15 @@ public class ExtDocUtil { ...@@ -41,13 +43,15 @@ public class ExtDocUtil {
public static Map<String, RequestAttributes> requestAttributes = new HashMap<>(); public static Map<String, RequestAttributes> requestAttributes = new HashMap<>();
@Autowired @Autowired
DocCenterFeignService docCenterFeignService; DxDocumentService docCenterFeignService;
@Autowired @Autowired
private FileService fileService; private FileManagerFeignService fileService;
@Autowired // TODO: 2024/8/1 MinioFileStoreService这个类不存在了
private MinioFileStoreService minioFileStoreService; // @Autowired
@Autowired // private MinioFileStoreService minioFileStoreService;
private SiteService siteService; // TODO: 2024/8/1 SiteService这个类不存在了
// @Autowired
// private SiteService siteService;
@Autowired @Autowired
private DxUserInfoFeign userService; private DxUserInfoFeign userService;
@Autowired @Autowired
...@@ -95,8 +99,8 @@ public class ExtDocUtil { ...@@ -95,8 +99,8 @@ public class ExtDocUtil {
* @param objFileLinks * @param objFileLinks
* @return * @return
*/ */
public PapersVO obtainPrimaryFile(List<ObjFileLinkVO> objFileLinks) { public RepoFileVO obtainPrimaryFile(List<ObjFileLinkVO> objFileLinks) {
PapersVO fileVO = null; RepoFileVO fileVO = null;
if (!CollectionUtils.isEmpty(objFileLinks)) { if (!CollectionUtils.isEmpty(objFileLinks)) {
fileVO = objFileLinks.stream().filter(objFileLinkVO -> Constants.MASTER_FILE.equals(objFileLinkVO.getContentType())).map(ObjFileLinkVO::getTarget) fileVO = objFileLinks.stream().filter(objFileLinkVO -> Constants.MASTER_FILE.equals(objFileLinkVO.getContentType())).map(ObjFileLinkVO::getTarget)
.findFirst().orElse(null); .findFirst().orElse(null);
...@@ -109,22 +113,23 @@ public class ExtDocUtil { ...@@ -109,22 +113,23 @@ public class ExtDocUtil {
* *
* @param fileVO * @param fileVO
*/ */
public InputStream obtainPrimaryFileInputStream(PapersVO fileVO) { // TODO: 2024/8/1 minioFileStoreService不存在
InputStream inputStream = null; // public InputStream obtainPrimaryFileInputStream(RepoFileVO fileVO) {
if (!ObjectUtils.isEmpty(fileVO)) { // InputStream inputStream = null;
log.info("开始下载主内容======》" + fileVO.getId()); // if (!ObjectUtils.isEmpty(fileVO)) {
Papers fileEntity = this.fileService.findById(fileVO.getId()); // log.info("开始下载主内容======》" + fileVO.getId());
Site siteEntity = this.siteService.findByIsDefault(true); // RepoFileVO fileEntity = this.fileService.findFileInfoById(fileVO.getId());
if (Objects.isNull(fileEntity)) { // Site siteEntity = this.siteService.findByIsDefault(true);
log.error("下载主内容失败!====》" + DxValutErrorCodeData.FILE_NOT_EXISTS); // if (Objects.isNull(fileEntity)) {
} else { // log.error("下载主内容失败!====》" + DxValutErrorCodeData.FILE_NOT_EXISTS);
inputStream = this.minioFileStoreService.download(fileEntity.getBucketName(), fileEntity.getMinioFileName(), fileEntity.getSecretKey(), siteEntity); // } else {
} // inputStream = this.minioFileStoreService.download(fileEntity.getBucketName(), fileEntity.getMinioFileName(), fileEntity.getSecretKey(), siteEntity);
} else { // }
log.error("下载主内容失败======》fileVO为空!"); // } else {
} // log.error("下载主内容失败======》fileVO为空!");
return inputStream; // }
} // return inputStream;
// }
/** /**
* 通过id查询文档附件 * 通过id查询文档附件
......
...@@ -3,14 +3,21 @@ package com.yonde.dcs.document.core.util; ...@@ -3,14 +3,21 @@ package com.yonde.dcs.document.core.util;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import com.yonde.dcs.document.common.vo.DxDocumentVO; import com.yonde.dcs.document.common.vo.DxDocumentVO;
import com.yonde.dcs.document.core.constants.Constants; import com.yonde.dcs.document.core.constants.Constants;
import com.yonde.dex.basedata.entity.data.OperatorType; import com.yonde.dex.basedata.entity.data.OperatorType;
import com.yonde.dex.basedata.entity.vo.IdVO; import com.yonde.dex.basedata.entity.vo.IdVO;
import com.yonde.dex.dfs.handler.ContentHolder;
import com.yonde.dex.dfs.vo.ObjFileLinkVO;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.pdfbox.io.MemoryUsageSetting;
import org.apache.pdfbox.multipdf.PDFMergerUtility;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
......
package com.yonde.dcs.document.core.util; package com.yonde.dcs.document.core.util;
import freemarker.core.XMLOutputFormat;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import sun.misc.BASE64Encoder; import sun.misc.BASE64Encoder;
import java.io.*; import java.io.*;
import java.util.Map; import java.util.Map;
/** /**
......
package com.yonde.dcs.document.core.util; package com.yonde.dcs.document.core.util;
import com.inet.pdm.word.DocumentDispatch;
import com.jacob.activeX.ActiveXComponent; import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread; import com.jacob.com.ComThread;
import com.jacob.com.Dispatch; import com.jacob.com.Dispatch;
import com.jacob.com.Variant; import com.jacob.com.Variant;
import com.yonde.dcs.document.core.word.DocumentDispatch;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
......
...@@ -3,8 +3,12 @@ package com.yonde.dcs.document.core.util; ...@@ -3,8 +3,12 @@ package com.yonde.dcs.document.core.util;
import com.yonde.dcs.document.common.vo.DxDocumentVO; import com.yonde.dcs.document.common.vo.DxDocumentVO;
import com.yonde.dcs.document.core.constants.SignConstants; import com.yonde.dcs.document.core.constants.SignConstants;
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.wfc.common.enums.TaskStateEnum; import com.yonde.dex.wfc.common.enums.TaskStateEnum;
import com.yonde.dex.wfc.common.vo.DxWfProcessSearchVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
import com.yonde.dex.wfc.feign.api.WfcProcessFeign;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -25,7 +29,7 @@ import java.util.stream.Collectors; ...@@ -25,7 +29,7 @@ import java.util.stream.Collectors;
public class WorkFlowUtil { public class WorkFlowUtil {
@Autowired @Autowired
private IInstanceService instanceService; private WfcProcessFeign instanceService;
@Autowired @Autowired
private DxUserInfoFeign userService; private DxUserInfoFeign userService;
...@@ -35,16 +39,17 @@ public class WorkFlowUtil { ...@@ -35,16 +39,17 @@ public class WorkFlowUtil {
* @param iterationVO * @param iterationVO
* @return * @return
*/ */
public WfProcessInstVO getWfProcessInst(DxIterationVO iterationVO) { // TODO: 2024/8/1 DxIterationVO不存在
WfProcessInstSearchVO wfProcessInstSearchVO = new WfProcessInstSearchVO(); // public WfProcessInstVO getWfProcessInst(DxIterationVO iterationVO) {
wfProcessInstSearchVO.setPboClass(iterationVO.getClass().getName()); // DxWfProcessSearchVO wfProcessInstSearchVO = new DxWfProcessSearchVO();
wfProcessInstSearchVO.setPboId(iterationVO.getVersionId()); // wfProcessInstSearchVO.setPboClass(iterationVO.getClass().getName());
Page<WfProcessInstVO> wfProcessInstVOPage = this.instanceService.getProcessInstList(wfProcessInstSearchVO, 1, 10); // wfProcessInstSearchVO.setPboId(iterationVO.getVersionId());
if (!CollectionUtils.isEmpty(wfProcessInstVOPage.getContent())) { // Page<WfProcessInstVO> wfProcessInstVOPage = this.instanceService.getProcessList(wfProcessInstSearchVO, 1, 10);
return wfProcessInstVOPage.getContent().get(0); // if (!CollectionUtils.isEmpty(wfProcessInstVOPage.getContent())) {
} // return wfProcessInstVOPage.getContent().get(0);
return null; // }
} // return null;
// }
/** /**
* 获取流程实例 * 获取流程实例
...@@ -52,37 +57,39 @@ public class WorkFlowUtil { ...@@ -52,37 +57,39 @@ public class WorkFlowUtil {
* @param doc * @param doc
* @return * @return
*/ */
public WfProcessInstVO getWfProcessInst(DxDocumentVO doc) { // TODO: 2024/8/1 getProcessInstList方法不存在
WfProcessInstSearchVO wfProcessInstSearchVO = new WfProcessInstSearchVO(); // public WfProcessInstVO getWfProcessInst(DxDocumentVO doc) {
wfProcessInstSearchVO.setPboClass(DxDocumentVO.class.getName()); // WfProcessInstSearchVO wfProcessInstSearchVO = new WfProcessInstSearchVO();
wfProcessInstSearchVO.setPboId(doc.getVersionId()); // wfProcessInstSearchVO.setPboClass(DxDocumentVO.class.getName());
Page<WfProcessInstVO> wfProcessInstVOPage = this.instanceService.getProcessInstList(wfProcessInstSearchVO, 1, 10); // wfProcessInstSearchVO.setPboId(doc.getVersionId());
if (!CollectionUtils.isEmpty(wfProcessInstVOPage.getContent())) { // Page<WfProcessInstVO> wfProcessInstVOPage = this.instanceService.getProcessInstList(wfProcessInstSearchVO, 1, 10);
return wfProcessInstVOPage.getContent().get(0); // if (!CollectionUtils.isEmpty(wfProcessInstVOPage.getContent())) {
} // return wfProcessInstVOPage.getContent().get(0);
return null; // }
} // return null;
// }
/** /**
* 通过pbo获取流程实例签审详情信息 * 通过pbo获取流程实例签审详情信息
* *
* @param doc * @param doc
*/ */
public Map<String, List<WfProcessTaskVO>> getWfInfo(DxDocumentVO doc) { // TODO: 2024/8/1 getProcessInstList方法不存在
WfProcessInstVO wfProcessInstVO = getWfProcessInst(doc); // public Map<String, List<DxWfProcessTaskVO>> getWfInfo(DxDocumentVO doc) {
if (!ObjectUtils.isEmpty(wfProcessInstVO)) { // WfProcessInstVO wfProcessInstVO = getWfProcessInst(doc);
WfProcessInfoVO wfProcessInfo = this.instanceService.getProcessInstSimpleDetailById(wfProcessInstVO.getId()); // if (!ObjectUtils.isEmpty(wfProcessInstVO)) {
List<WfProcessTaskVO> historyInfoList = wfProcessInfo.getHistoryInfo(); // WfProcessInfoVO wfProcessInfo = this.instanceService.getProcessInstSimpleDetailById(wfProcessInstVO.getId());
// List<WfProcessTaskVO> historyInfoList = wfProcessInfo.getHistoryInfo();
List<String> checkResult = Arrays.asList("提交", "通过"); //
Map<String, List<WfProcessTaskVO>> wfHistoryMap = historyInfoList.stream().filter(p -> TaskStateEnum.COMPLETE.name().equals(p.getState()) && checkResult.contains(p.getResult())) // List<String> checkResult = Arrays.asList("提交", "通过");
.sorted(Comparator.comparing(WfProcessTaskVO::getEndTime).reversed()) // Map<String, List<WfProcessTaskVO>> wfHistoryMap = historyInfoList.stream().filter(p -> TaskStateEnum.COMPLETE.name().equals(p.getState()) && checkResult.contains(p.getResult()))
.collect(Collectors.groupingBy(WfProcessTaskVO::getName)); // .sorted(Comparator.comparing(WfProcessTaskVO::getEndTime).reversed())
// .collect(Collectors.groupingBy(WfProcessTaskVO::getName));
return wfHistoryMap; //
} // return wfHistoryMap;
return null; // }
} // return null;
// }
/** /**
* 根据任务名称获取处理人 * 根据任务名称获取处理人
...@@ -91,11 +98,11 @@ public class WorkFlowUtil { ...@@ -91,11 +98,11 @@ public class WorkFlowUtil {
* @param taskName * @param taskName
* @return * @return
*/ */
public String getHandler(Map<String, List<WfProcessTaskVO>> wfHistoryMap, String taskName) { public String getHandler(Map<String, List<DxWfProcessTaskVO>> wfHistoryMap, String taskName) {
String str = ""; String str = "";
if (wfHistoryMap.containsKey(taskName) && !ObjectUtils.isEmpty(wfHistoryMap.get(taskName).get(0))) { if (wfHistoryMap.containsKey(taskName) && !ObjectUtils.isEmpty(wfHistoryMap.get(taskName).get(0))) {
String userId = wfHistoryMap.get(taskName).get(0).getAssignee(); String userId = wfHistoryMap.get(taskName).get(0).getAssignee();
UserVO userVO = userService.get(Long.parseLong(userId)); DxUserInfoVO userVO = (DxUserInfoVO) userService.get(Long.parseLong(userId));
str = userVO.getUserAccount() + ".png"; str = userVO.getUserAccount() + ".png";
return str; return str;
} }
...@@ -109,7 +116,7 @@ public class WorkFlowUtil { ...@@ -109,7 +116,7 @@ public class WorkFlowUtil {
* @param taskName * @param taskName
* @return * @return
*/ */
public String getHandlerUser(Map<String, List<WfProcessTaskVO>> wfHistoryMap, String taskName) { public String getHandlerUser(Map<String, List<DxWfProcessTaskVO>> wfHistoryMap, String taskName) {
if (wfHistoryMap.containsKey(taskName) && !ObjectUtils.isEmpty(wfHistoryMap.get(taskName).get(0))) { if (wfHistoryMap.containsKey(taskName) && !ObjectUtils.isEmpty(wfHistoryMap.get(taskName).get(0))) {
return wfHistoryMap.get(taskName).get(0).getAssigneeName(); return wfHistoryMap.get(taskName).get(0).getAssigneeName();
} }
...@@ -123,32 +130,34 @@ public class WorkFlowUtil { ...@@ -123,32 +130,34 @@ public class WorkFlowUtil {
* @param activityName * @param activityName
* @return * @return
*/ */
public String getSignImage(List<WfTaskDefinitionVO> activities, List<String> activityName) { // TODO: 2024/8/1 WfTaskDefinitionVO类不存在
for (WfTaskDefinitionVO wf : activities) { // public String getSignImage(List<WfTaskDefinitionVO> activities, List<String> activityName) {
if (activityName.contains(wf.getTaskName())) { // for (WfTaskDefinitionVO wf : activities) {
return getActivityUserName(wf); // if (activityName.contains(wf.getTaskName())) {
} // return getActivityUserName(wf);
} // }
return " "; // }
} // return " ";
// }
/** /**
* 获取用户名称及用户id * 获取用户名称及用户id
*/ */
public String getActivityUserName(WfTaskDefinitionVO activity) { // TODO: 2024/8/1 WfTaskDefinitionVO类不存在
String str = " "; // public String getActivityUserName(WfTaskDefinitionVO activity) {
List<WfProcessTaskVO> taskList = activity.getTaskList(); // String str = " ";
for (WfProcessTaskVO wf : taskList) { // List<WfProcessTaskVO> taskList = activity.getTaskList();
if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) { // for (WfProcessTaskVO wf : taskList) {
//获取用户名称和id // if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) {
String userName = wf.getAssigneeName(); // //获取用户名称和id
String userId = wf.getAssignee(); // String userName = wf.getAssigneeName();
UserVO userVO = userService.get(Long.parseLong(userId)); // String userId = wf.getAssignee();
str = userVO.getUserAccount() + ".png"; // UserVO userVO = userService.get(Long.parseLong(userId));
} // str = userVO.getUserAccount() + ".png";
} // }
return str; // }
} // return str;
// }
/** /**
* 获取某个环节结束时间 * 获取某个环节结束时间
...@@ -157,14 +166,15 @@ public class WorkFlowUtil { ...@@ -157,14 +166,15 @@ public class WorkFlowUtil {
* @param activityName * @param activityName
* @return * @return
*/ */
public String getEndDate(List<WfTaskDefinitionVO> activities, List<String> activityName) { // TODO: 2024/8/1 WfTaskDefinitionVO类不存在
for (WfTaskDefinitionVO wf : activities) { // public String getEndDate(List<WfTaskDefinitionVO> activities, List<String> activityName) {
if (activityName.contains(wf.getTaskName())) { // for (WfTaskDefinitionVO wf : activities) {
return Optional.ofNullable(getActiveEndDate(wf)).orElse(""); // if (activityName.contains(wf.getTaskName())) {
} // return Optional.ofNullable(getActiveEndDate(wf)).orElse("");
} // }
return " "; // }
} // return " ";
// }
/** /**
* 修改后的处理获取日期 * 修改后的处理获取日期
...@@ -172,17 +182,18 @@ public class WorkFlowUtil { ...@@ -172,17 +182,18 @@ public class WorkFlowUtil {
* @param activity * @param activity
* @return * @return
*/ */
private String getActiveEndDate(WfTaskDefinitionVO activity) { // TODO: 2024/8/1 WfTaskDefinitionVO类不存在
List<WfProcessTaskVO> taskList = activity.getTaskList(); // private String getActiveEndDate(WfTaskDefinitionVO activity) {
String date = ""; // List<WfProcessTaskVO> taskList = activity.getTaskList();
SimpleDateFormat dateFm = new SimpleDateFormat("yyyy-MM-dd"); // String date = "";
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(taskList)) { // SimpleDateFormat dateFm = new SimpleDateFormat("yyyy-MM-dd");
for (WfProcessTaskVO wf : taskList) { // if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(taskList)) {
if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) { // for (WfProcessTaskVO wf : taskList) {
return dateFm.format(wf.getEndTime()).replace(".", "-"); // if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) {
} // return dateFm.format(wf.getEndTime()).replace(".", "-");
} // }
} // }
return date; // }
} // return date;
// }
} }
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