Commit 8116f58d authored by xuzhang's avatar xuzhang

feat[doc]代码迁移

parent f1fd1dfb
......@@ -66,6 +66,11 @@
<artifactId>dex-basic-service-common</artifactId>
<version>4.1-RELEASE</version>
</dependency>
<dependency>
<groupId>com.yonde.dcs</groupId>
<artifactId>dcs-plan-common</artifactId>
<version>4.1-RELEASE</version>
</dependency>
</dependencies>
......
......@@ -630,6 +630,11 @@ public class DxDocumentVO extends IdOnlyVO implements DxIterationVOHolder<DxDocu
* 三级分类
*/
private String threeLevCategory;
/**
* 阶段状态
*/
private String phaseState;
}
package com.yonde.dcs.document.common.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.yonde.dex.basedata.entity.annotation.DexEmbedded;
import com.yonde.dex.basedata.entity.annotation.ModelConfigProperty;
import com.yonde.dex.basedata.entity.annotation.ReferenceProperty;
import com.yonde.dex.basedata.entity.vo.DxIdVOEmbeddable;
import com.yonde.dex.basedata.entity.vo.IdOnlyVO;
import com.yonde.dex.basedata.entity.vo.IdVO;
import lombok.Data;
......@@ -27,6 +30,12 @@ import java.util.Map;
)
@ModelConfigProperty(syncES = true)
public class ExpectPayDetailsVO extends IdOnlyVO implements IdVO {
/**
* dao扩展对象
*/
@DexEmbedded()
@JsonIgnore
private DxIdVOEmbeddable dxIdEmbeddable;
/**
* 金额
*/
......
package com.yonde.dcs.document.common.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.yonde.dex.basedata.entity.annotation.DexEmbedded;
import com.yonde.dex.basedata.entity.annotation.ModelConfigProperty;
import com.yonde.dex.basedata.entity.annotation.ReferenceProperty;
import com.yonde.dex.lcycle.baseentity.vo.DxObjectVo;
import com.yonde.dex.basedata.entity.vo.DxIdVOEmbeddable;
import com.yonde.dex.basedata.entity.vo.IdOnlyVO;
import com.yonde.dex.basedata.entity.vo.IdVO;
import com.yonde.dex.context.plugin.common.entity.DxContextVOEmbeddable;
import com.yonde.dex.context.plugin.common.entity.DxContextVOHolder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
......@@ -25,7 +31,19 @@ import java.util.Map;
defaultImpl = ExtContractExpensesVO.class
)
@ModelConfigProperty(syncES = true)
public class ExtContractExpensesVO extends DxObjectVo {
public class ExtContractExpensesVO extends IdOnlyVO implements IdVO, DxContextVOHolder {
/**
* dao扩展对象
*/
@DexEmbedded()
@JsonIgnore
private DxIdVOEmbeddable dxIdEmbeddable;
/**
* 扩展VO属性
*/
@DexEmbedded()
@JsonIgnore
private DxContextVOEmbeddable dxContextEmbeddable;
/**
* 收入合同
*/
......
......@@ -2,14 +2,14 @@ package com.yonde.dcs.document.common.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.yonde.dex.basedata.entity.annotation.*;
import com.yonde.dex.basedata.entity.data.VersionRelationType;
import com.yonde.dex.basedata.entity.annotation.DexEmbedded;
import com.yonde.dex.basedata.entity.annotation.ModelConfigProperty;
import com.yonde.dex.basedata.entity.annotation.ReferenceProperty;
import com.yonde.dex.basedata.entity.vo.DxIdVOEmbeddable;
import com.yonde.dex.basedata.entity.vo.IdOnlyVO;
import com.yonde.dex.basedata.entity.vo.IdVO;
import com.yonde.dex.linkdata.plugin.common.DxLinkDataVOEmbeddable;
import com.yonde.dex.linkdata.plugin.common.DxLinkDataVOHolder;
import com.yonde.dex.linkdata.plugin.entities.DxLinkDataHolder;
import com.yonde.dex.logicdelete.plugin.common.entity.DxLogicDeleteVOEmbeddable;
import com.yonde.dex.logicdelete.plugin.common.entity.DxLogicDeleteVOHolder;
import lombok.Data;
......@@ -32,7 +32,7 @@ import java.util.Map;
defaultImpl = ExtContractLinkVO.class
)
@ModelConfigProperty(syncES = true)
public class ExtContractLinkVO extends IdOnlyVO implements IdVO,DxLinkDataVOHolder<DxDocumentVO, DxDocumentVO>, DxLogicDeleteVOHolder {
public class ExtContractLinkVO extends IdOnlyVO implements IdVO,DxLinkDataVOHolder<ExtIncomeContractVO, ExtSpendingContractVO>, DxLogicDeleteVOHolder {
public static final String DX_ID_EMBEDDABLE_PROP_NAME = "dxIdEmbeddable";
public static final String DX_LOGIC_DELETE_EMBEDDABLE_PROP_NAME = "dxLogicDeleteEmbeddable";
......@@ -58,7 +58,7 @@ public class ExtContractLinkVO extends IdOnlyVO implements IdVO,DxLinkDataVOHold
*/
@DexEmbedded()
@JsonIgnore
private DxLinkDataVOEmbeddable<DxDocumentVO, DxDocumentVO> dxLinkDataEmbeddable;
private DxLinkDataVOEmbeddable<ExtIncomeContractVO, ExtSpendingContractVO> dxLinkDataEmbeddable;
/**
* 支出合同
*/
......
......@@ -2,13 +2,13 @@ package com.yonde.dcs.document.common.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.yonde.dcs.plan.common.vo.ExtPlanVO;
import com.yonde.dex.basedata.entity.annotation.DexEmbedded;
import com.yonde.dex.basedata.entity.annotation.ModelConfigProperty;
import com.yonde.dex.basedata.entity.annotation.ReferenceProperty;
import com.yonde.dex.basedata.entity.vo.DxIdVOEmbeddable;
import com.yonde.dex.basedata.entity.vo.IdOnlyVO;
import com.yonde.dex.basedata.entity.vo.IdVO;
import com.yonde.dex.dao.entity.base.IdOnlyEntity;
import com.yonde.dex.linkdata.plugin.common.DxLinkDataVOEmbeddable;
import com.yonde.dex.linkdata.plugin.common.DxLinkDataVOHolder;
import com.yonde.dex.logicdelete.plugin.common.entity.DxLogicDeleteVOEmbeddable;
......@@ -34,7 +34,7 @@ import java.util.Map;
defaultImpl = ExtDisReocredLinkVO.class
)
@ModelConfigProperty(syncES = true)
public class ExtDisReocredLinkVO extends IdOnlyVO implements IdVO, DxLinkDataVOHolder<ExtDistributeRecordVO, IdOnlyEntity> {
public class ExtDisReocredLinkVO extends IdOnlyVO implements IdVO, DxLinkDataVOHolder<ExtDistributeRecordVO, ExtPlanVO> {
/**
* dao扩展对象
......@@ -55,7 +55,7 @@ public class ExtDisReocredLinkVO extends IdOnlyVO implements IdVO, DxLinkDataVOH
*/
@DexEmbedded()
@JsonIgnore
private DxLinkDataVOEmbeddable<ExtDistributeRecordVO, IdOnlyEntity> dxLinkDataEmbeddable;
private DxLinkDataVOEmbeddable<ExtDistributeRecordVO, ExtPlanVO> dxLinkDataEmbeddable;
/**
* DxObject
......
package com.yonde.dcs.document.common.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.yonde.dex.basedata.entity.annotation.DexEmbedded;
import com.yonde.dex.basedata.entity.annotation.ModelConfigProperty;
import com.yonde.dex.basedata.entity.annotation.ReferenceProperty;
import com.yonde.dex.basedata.entity.vo.DxIdVOEmbeddable;
import com.yonde.dex.basedata.entity.vo.IdOnlyVO;
import com.yonde.dex.basedata.entity.vo.IdVO;
import com.yonde.dex.context.plugin.common.entity.DxContextVOEmbeddable;
import com.yonde.dex.context.plugin.common.entity.DxContextVOHolder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
......@@ -25,7 +32,19 @@ import java.util.Map;
defaultImpl = ExtIncomeBillInfoVO.class
)
@ModelConfigProperty(syncES = true)
public class ExtIncomeBillInfoVO extends DxObjectVo {
public class ExtIncomeBillInfoVO extends IdOnlyVO implements IdVO, DxContextVOHolder {
/**
* dao扩展对象
*/
@DexEmbedded()
@JsonIgnore
private DxIdVOEmbeddable dxIdEmbeddable;
/**
* 扩展VO属性
*/
@DexEmbedded()
@JsonIgnore
private DxContextVOEmbeddable dxContextEmbeddable;
/**
* 收入明细
*/
......
......@@ -71,20 +71,6 @@ public class ExtIncomeContractVO extends IdOnlyVO implements DxSecretVOHolder, D
@JsonIgnore
private DxSecretVOEmbeddable dxSecretEmbeddable;
public class ExtIncomeContractVO extends IdOnlyVO implements IdVO, DxLogicDeleteVOHolder {
/**
* dao扩展对象
*/
@DexEmbedded()
@JsonIgnore
private DxIdVOEmbeddable dxIdEmbeddable;
/**
* 扩展VO属性
*/
@DexEmbedded()
@JsonIgnore
private DxLogicDeleteVOEmbeddable dxLogicDeleteEmbeddable;
/**
* 项目属性
*/
......@@ -246,7 +232,5 @@ public class ExtIncomeContractVO extends IdOnlyVO implements IdVO, DxLogicDelete
*/
@RelationProperty(refProperty = "source")
private List<ExtContractLinkVO> sourceContractLink;
}
package com.yonde.dcs.document.common.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.yonde.dex.basedata.entity.annotation.DexEmbedded;
import com.yonde.dex.basedata.entity.annotation.ModelConfigProperty;
import com.yonde.dex.basedata.entity.annotation.ReferenceProperty;
import com.yonde.dex.basedata.entity.annotation.RelationProperty;
import com.yonde.dex.basedata.entity.vo.DxIdVOEmbeddable;
import com.yonde.dex.basedata.entity.vo.IdOnlyVO;
import com.yonde.dex.basedata.entity.vo.IdVO;
import com.yonde.dex.lcycle.baseentity.vo.DxObjectVo;
import com.yonde.dex.context.common.vo.DxContextVO;
import com.yonde.dex.context.plugin.common.entity.DxContextVOEmbeddable;
import com.yonde.dex.context.plugin.common.entity.DxContextVOHolder;
import com.yonde.dex.logicdelete.plugin.common.entity.DxLogicDeleteVOEmbeddable;
import com.yonde.dex.secretcode.plugin.common.entity.DxSecretVOEmbeddable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
......@@ -29,7 +37,33 @@ import java.util.Map;
defaultImpl = ExtIncomeDetailVO.class
)
@ModelConfigProperty(syncES = true)
public class ExtIncomeDetailVO extends DxObjectVo implements IdVO {
public class ExtIncomeDetailVO extends IdOnlyVO implements IdVO, DxContextVOHolder {
/**
* 扩展VO属性
*/
@DexEmbedded()
@JsonIgnore
private DxContextVOEmbeddable dxContextEmbeddable;
/**
* dao扩展对象
*/
@DexEmbedded()
@JsonIgnore
private DxIdVOEmbeddable dxIdEmbeddable;
/**
* 扩展VO属性
*/
@DexEmbedded()
@JsonIgnore
private DxLogicDeleteVOEmbeddable dxLogicDeleteEmbeddable;
/**
* 扩展VO属性
*/
@DexEmbedded()
@JsonIgnore
private DxSecretVOEmbeddable dxSecretEmbeddable;
/**
* IncomeBillInfo集合
*/
......
package com.yonde.dcs.document.common.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.yonde.dex.basedata.entity.annotation.DexEmbedded;
import com.yonde.dex.basedata.entity.annotation.ModelConfigProperty;
import com.yonde.dex.basedata.entity.annotation.ReferenceProperty;
import com.yonde.dex.basedata.entity.annotation.RelationProperty;
import com.yonde.dex.lcycle.baseentity.vo.DxObjectVo;
import com.yonde.dex.basedata.entity.vo.DxIdVOEmbeddable;
import com.yonde.dex.basedata.entity.vo.IdOnlyVO;
import com.yonde.dex.basedata.entity.vo.IdVO;
import com.yonde.dex.context.plugin.common.entity.DxContextVOEmbeddable;
import com.yonde.dex.context.plugin.common.entity.DxContextVOHolder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
......@@ -29,7 +35,21 @@ import java.util.Map;
defaultImpl = ExtSpendingDetailVO.class
)
@ModelConfigProperty(syncES = true)
public class ExtSpendingDetailVO extends DxObjectVo {
public class ExtSpendingDetailVO extends IdOnlyVO implements IdVO, DxContextVOHolder {
/**
* dao扩展对象
*/
@DexEmbedded()
@JsonIgnore
private DxIdVOEmbeddable dxIdEmbeddable;
/**
* 扩展VO属性
*/
@DexEmbedded()
@JsonIgnore
private DxContextVOEmbeddable dxContextEmbeddable;
/**
* 支出合同
*/
......
......@@ -115,6 +115,29 @@
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>4.1.2</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
</project>
package com.yonde.dcs.document.core.events;
import com.inet.pdm.entity.vo.ExtIncomeDetailVO;
import com.inet.pdm.entity.vo.ExtSpendingDetailVO;
import com.inet.pdm.service.ExtIncomeContractService;
import com.inet.pdm.service.ExtSpendingContractService;
import com.yonde.dex.dao.events.BusinessEventType;
import com.yonde.dex.dao.events.DxEvent;
import com.yonde.dex.dao.events.DxEventListener;
import com.yonde.dex.dao.events.DxEventWrap;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author xfchai
* @ClassName ContractEvent.java
* @Description TODO
* @createTime 2022/03/03 19:01:00
*/
@Component
@Slf4j
@DxEvent
public class ContractEvent {
@Autowired
private ExtIncomeContractService extIncomeContractService;
@Autowired
private ExtSpendingContractService extSpendingContractService;
@DxEventListener(value = ExtIncomeDetailVO.class, eventType = BusinessEventType.POST_CREATE, order = 1)
public void incomeDetailPostCreateListener(List<DxEventWrap<ExtIncomeDetailVO>> events) {
events.forEach(e -> {
ExtIncomeDetailVO extIncomeDetailVO = e.getTarget();
this.refreshInContractAmount(extIncomeDetailVO.getExtIncomeContractId());
});
//刷新收入合同相关金额
}
@DxEventListener(value = ExtIncomeDetailVO.class, eventType = BusinessEventType.POST_UPDATE, order = 1)
public void incomeDetailPostUpdateListener(List<DxEventWrap<ExtIncomeDetailVO>> events) {
events.forEach(e -> {
ExtIncomeDetailVO extIncomeDetailVO = e.getTarget();
this.refreshInContractAmount(extIncomeDetailVO.getExtIncomeContractId());
});
}
@DxEventListener(value = ExtIncomeDetailVO.class, eventType = BusinessEventType.POST_DELETE, order = 1)
public void incomeDetailPostDeleteListener(List<DxEventWrap<ExtIncomeDetailVO>> events) {
events.forEach(e -> {
ExtIncomeDetailVO extIncomeDetailVO = e.getTarget();
this.refreshInContractAmount(extIncomeDetailVO.getExtIncomeContractId());
});
}
@DxEventListener(value = ExtSpendingDetailVO.class, eventType = BusinessEventType.POST_CREATE, order = 1)
public void spendingDetailPostCreateListener(List<DxEventWrap<ExtSpendingDetailVO>> events) {
events.forEach(e -> {
ExtSpendingDetailVO extSpendingDetailVO = e.getTarget();
this.refreshSpeContractAmount(extSpendingDetailVO.getExtSpendingContractId());
});
//刷新收入合同相关金额
}
@DxEventListener(value = ExtSpendingDetailVO.class, eventType = BusinessEventType.POST_UPDATE, order = 1)
public void spendingDetailPostUpdateListener(List<DxEventWrap<ExtSpendingDetailVO>> events) {
events.forEach(e -> {
ExtSpendingDetailVO extSpendingDetailVO = e.getTarget();
this.refreshSpeContractAmount(extSpendingDetailVO.getExtSpendingContractId());
});
}
@DxEventListener(value = ExtSpendingDetailVO.class, eventType = BusinessEventType.POST_DELETE, order = 1)
public void spendingDetailPostDeleteListener(List<DxEventWrap<ExtSpendingDetailVO>> events) {
events.forEach(e -> {
ExtSpendingDetailVO extSpendingDetailVO = e.getTarget();
this.refreshSpeContractAmount(extSpendingDetailVO.getExtSpendingContractId());
});
}
/**
* 刷新收入合同金额
*
* @param contractId
*/
private void refreshInContractAmount(Long contractId) {
//已到款
//待拨付
extIncomeContractService.calculateIncome(contractId);
//XXX年到款
extIncomeContractService.reCalculIncomeById(contractId);
}
/**
* 刷新支出合同金额
*
* @param contractId
*/
private void refreshSpeContractAmount(Long contractId) {
//已付金额
//未付金额
//付款比例
extSpendingContractService.calculateSpending(contractId);
}
}
......@@ -2,15 +2,16 @@ package com.yonde.dcs.document.core.events;
import cn.hutool.core.io.FileUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson.JSONObject;
import com.yonde.dcs.document.common.vo.DxDocumentVO;
import com.yonde.dcs.document.common.vo.ExtInterfaceInfoLinkVO;
import com.yonde.dcs.document.core.constants.Constants;
import com.yonde.dcs.document.core.factory.InternalInterfaceUtils;
import com.yonde.dcs.document.core.factory.TechnicalFileUtils;
import com.yonde.dcs.document.core.service.ExtDocService;
import com.yonde.dcs.document.core.util.ExtDocUtil;
import com.yonde.dcs.document.core.util.FileUtils;
import com.yonde.dcs.document.core.util.Word2PdfJacobUtil;
import com.yonde.dcs.document.core.word.ImportWordService;
import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.dao.events.BusinessEventType;
......@@ -18,6 +19,7 @@ import com.yonde.dex.dao.events.DxEvent;
import com.yonde.dex.dao.events.DxEventListener;
import com.yonde.dex.dao.events.DxEventWrap;
import com.yonde.dex.dfs.vo.ObjFileLinkVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
......@@ -137,14 +139,14 @@ public class DocBeforeCreateEvent {
* @param documentVo
* @param infoLinkVO 提资人信息
*/
public void generateAutoInterFaceWord(DxDocumentVO documentVo, ExtInterfaceInfoLinkVO infoLinkVO, WfProcessInfoVO wfProcessInfoVO) {
public void generateAutoInterFaceWord(DxDocumentVO documentVo, ExtInterfaceInfoLinkVO infoLinkVO, DxWfProcessInfoVO wfProcessInfoVO) {
try {
String file = documentVo.getSubTypeName();
String outWordFilePath = Constants.MERGER_FILE_ABSOLUTE_PATH + documentVo.getSubTypeName() + "\\" + documentVo.getNumber() + "\\" + Constants.MERGER_SOURCE + "\\";
//生成特定的文档目录,保存生成的word文件
FileUtil.mkdir(outWordFilePath);
Class<?> clazz = Class.forName("com.inet.pdm.factory.InternalInterfaceUtils");
Method settingDataMethod = clazz.getMethod("settingData", DxDocumentVO.class, InterfaceInfoLinkVO.class, WfProcessInfoVO.class);
Method settingDataMethod = clazz.getMethod("settingData", DxDocumentVO.class, ExtInterfaceInfoLinkVO.class, DxWfProcessInfoVO.class);
JSONObject jsonObject = (JSONObject) settingDataMethod.invoke(SpringUtil.getBean(InternalInterfaceUtils.class), documentVo, infoLinkVO, wfProcessInfoVO);
String generateWordFilePath = FileUtils.generateWordFile(outWordFilePath);
//生成word文件方法
......@@ -228,16 +230,16 @@ public class DocBeforeCreateEvent {
List<ObjFileLinkVO> objFileLinks = documentVo.getObjFileLinks();
//判断是否为word,不是word不合并
if (!CollectionUtils.isEmpty(objFileLinks)) {
//获取主内容数据流
PapersVO fileVO = extDocUtil.obtainPrimaryFile(objFileLinks);
if (!ObjectUtils.isEmpty(fileVO) && (fileVO.getOriginalFileName().endsWith(DOC_END_WITH) || fileVO.getOriginalFileName().endsWith(DOCX_END_WITH))) {
inputStream = extDocUtil.obtainPrimaryFileInputStream(fileVO);
//保存临时文件
String filePath = FileUtils.saveToLocal(inputStream, outWordFilePath + fileVO.getOriginalFileName());
log.info("临时文件目录为:", filePath);
//先将word转为pdf,再合并
Word2PdfJacobUtil.word2PDF(filePath, outPath + "/" + i + "MasterFile.pdf");
}
//todo 获取主内容数据流
// PapersVO fileVO = extDocUtil.obtainPrimaryFile(objFileLinks);
// if (!ObjectUtils.isEmpty(fileVO) && (fileVO.getOriginalFileName().endsWith(DOC_END_WITH) || fileVO.getOriginalFileName().endsWith(DOCX_END_WITH))) {
// inputStream = extDocUtil.obtainPrimaryFileInputStream(fileVO);
// //保存临时文件
// String filePath = FileUtils.saveToLocal(inputStream, outWordFilePath + fileVO.getOriginalFileName());
// log.info("临时文件目录为:", filePath);
// //先将word转为pdf,再合并
// Word2PdfJacobUtil.word2PDF(filePath, outPath + "/" + i + "MasterFile.pdf");
// }
}
}
//合并生成好的文档
......
package com.yonde.dcs.document.core.events;
import com.inet.pdm.entity.vo.ExtIncomeDetailVO;
import com.inet.pdm.entity.vo.ExtSpendingDetailVO;
import com.inet.pdm.service.ExtDocService;
import com.inet.pdm.service.ExtIncomeContractService;
import com.inet.pdm.service.ExtSpendingContractService;
import com.inet.pdm.util.ExtDocUtil;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.document.convert.service.DocConvertService;
import com.yonde.dcs.document.core.service.DocumentService;
import com.yonde.dcs.document.common.vo.DxDocumentVO;
import com.yonde.dcs.document.common.vo.ExtIncomeDetailVO;
import com.yonde.dcs.document.common.vo.ExtSpendingDetailVO;
import com.yonde.dcs.document.core.service.DxDocumentService;
import com.yonde.dcs.document.core.service.ExtDocService;
import com.yonde.dcs.document.core.util.ExtDocUtil;
import com.yonde.dcs.plan.feign.ExtIncomeContractServiceFeign;
import com.yonde.dcs.plan.feign.ExtSpendingContractServiceFeign;
import com.yonde.dex.dao.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -32,13 +31,11 @@ public class DocTransactionEvent {
@Autowired
@Qualifier("documentServiceImpl")
DocumentService documentService;
DxDocumentService documentService;
@Autowired
DocConvertService docConvertService;
private ExtIncomeContractServiceFeign extIncomeContractService;
@Autowired
private ExtIncomeContractService extIncomeContractService;
@Autowired
private ExtSpendingContractService extSpendingContractService;
private ExtSpendingContractServiceFeign extSpendingContractService;
@Autowired
private ExtDocUtil extDocUtil;
......@@ -71,9 +68,11 @@ public class DocTransactionEvent {
private void refreshInContractAmount(Long contractId) {
//已到款
//待拨付
extIncomeContractService.calculateIncome(contractId);
//todo feign添加
// extIncomeContractService.calculateIncome(contractId);
//XXX年到款
extIncomeContractService.reCalculIncomeById(contractId);
//todo feign添加
// extIncomeContractService.reCalculIncomeById(contractId);
}
/**
......@@ -85,6 +84,7 @@ public class DocTransactionEvent {
//已付金额
//未付金额
//付款比例
extSpendingContractService.calculateSpending(contractId);
//todo feign添加
// extSpendingContractService.calculateSpending(contractId);
}
}
package com.yonde.dcs.document.core.events;
import cn.hutool.core.io.FileUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson.JSONObject;
import com.inet.pdm.constants.Constants;
import com.inet.pdm.factory.*;
import com.inet.pdm.service.ExtDocService;
import com.inet.pdm.util.ExtDocUtil;
import com.inet.pdm.util.FileUtils;
import com.inet.pdm.util.WorkFlowUtil;
import com.inet.pdm.word.ImportWordService;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.document.common.entity.vo.InterfaceInfoLinkVO;
import com.yonde.dcs.document.common.vo.DxDocumentVO;
import com.yonde.dcs.document.common.vo.ExtInterfaceInfoLinkVO;
import com.yonde.dcs.document.core.constants.Constants;
import com.yonde.dcs.document.core.factory.InternalInterfaceUtils;
import com.yonde.dcs.document.core.factory.OutdatedDocNotifyUtils;
import com.yonde.dcs.document.core.service.ExtDocService;
import com.yonde.dcs.document.core.util.ExtDocUtil;
import com.yonde.dcs.document.core.util.FileUtils;
import com.yonde.dcs.document.core.util.WorkFlowUtil;
import com.yonde.dcs.document.core.word.ImportWordService;
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.DxWfProcessInstVO;
import com.yonde.dex.wfc.feign.api.DexWorkFlowService;
import com.yonde.dex.wfc.spi.utils.SpringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -51,14 +45,14 @@ public class ProcessDataUtils {
private ExtDocUtil extDocUtil;
@Autowired
private WorkFlowUtil workFlowUtil;
@Autowired
private DexWorkFlowService dexWorkFlowService;
// @Autowired
// private DexWorkFlowService dexWorkFlowService;
/**
* 单独处理过时文件通知单数据
*/
public void processOutdatedDocNotify(DxDocumentVO documentVo) {
extDocService.getDocWord(documentVo, OutdatedDocNotifyUtils.class, new WfProcessInfoVO(), "");
extDocService.getDocWord(documentVo, OutdatedDocNotifyUtils.class, new DxWfProcessInfoVO(), "");
}
/**
......@@ -68,35 +62,36 @@ public class ProcessDataUtils {
*/
public void processData(DxDocumentVO documentVo) {
String subTypeName = documentVo.getSubTypeName();
DxWfProcessVO DxWfProcessInstVO = workFlowUtil.getWfProcessInst(documentVo);
DxWfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(DxWfProcessInstVO.getId());
switch (subTypeName) {
case Constants.INTERNAL_INTERFACE:
this.generateInterFaceWord(documentVo, new InterfaceInfoLinkVO(), wfProcessInfoVO);
break;
case Constants.CONTACTLIST:
extDocService.getDocWord(documentVo, ContactListUtils.class, wfProcessInfoVO, "一");
break;
case Constants.WORK_CONTACTLIST:
extDocService.getDocWord(documentVo, WorkContactListUtils.class, wfProcessInfoVO, "");
break;
case Constants.DESIGN_CHANGE:
extDocService.getDocWord(documentVo, DesignChangeUtils.class, wfProcessInfoVO, "");
break;
case Constants.DESIGN_APPLICATION:
extDocService.getDocWord(documentVo, DesignDocApplicatUtils.class, wfProcessInfoVO, "");
break;
case Constants.DESIGN_ENTER:
extDocService.getDocWord(documentVo, DesignEnterUtils.class, wfProcessInfoVO, "");
break;
case Constants.NCR:
extDocService.getDocWord(documentVo, NCRUtils.class, wfProcessInfoVO, "");
break;
case Constants.DEN:
//根据模板生成两张不同澄清单
extDocService.getDocWord(documentVo, DENUtils.class, wfProcessInfoVO, "");
break;
}
//todo
// WfProcessInstVO DxWfProcessInstVO = workFlowUtil.getWfProcessInst(documentVo);
// DxWfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(DxWfProcessInstVO.getId());
// switch (subTypeName) {
// case Constants.INTERNAL_INTERFACE:
// this.generateInterFaceWord(documentVo, new InterfaceInfoLinkVO(), wfProcessInfoVO);
// break;
// case Constants.CONTACTLIST:
// extDocService.getDocWord(documentVo, ContactListUtils.class, wfProcessInfoVO, "一");
// break;
// case Constants.WORK_CONTACTLIST:
// extDocService.getDocWord(documentVo, WorkContactListUtils.class, wfProcessInfoVO, "");
// break;
// case Constants.DESIGN_CHANGE:
// extDocService.getDocWord(documentVo, DesignChangeUtils.class, wfProcessInfoVO, "");
// break;
// case Constants.DESIGN_APPLICATION:
// extDocService.getDocWord(documentVo, DesignDocApplicatUtils.class, wfProcessInfoVO, "");
// break;
// case Constants.DESIGN_ENTER:
// extDocService.getDocWord(documentVo, DesignEnterUtils.class, wfProcessInfoVO, "");
// break;
// case Constants.NCR:
// extDocService.getDocWord(documentVo, NCRUtils.class, wfProcessInfoVO, "");
// break;
// case Constants.DEN:
// //根据模板生成两张不同澄清单
// extDocService.getDocWord(documentVo, DENUtils.class, wfProcessInfoVO, "");
// break;
// }
}
/**
......@@ -105,14 +100,14 @@ public class ProcessDataUtils {
* @param documentVo
* @param infoLinkVO 提资人信息
*/
public void generateInterFaceWord(DxDocumentVO documentVo, InterfaceInfoLinkVO infoLinkVO, WfProcessInfoVO wfProcessInfoVO) {
public void generateInterFaceWord(DxDocumentVO documentVo, ExtInterfaceInfoLinkVO infoLinkVO, DxWfProcessInfoVO wfProcessInfoVO) {
try {
String file = documentVo.getSubTypeName();
String outWordFilePath = Constants.MERGER_FILE_ABSOLUTE_PATH + documentVo.getSubTypeName() + "\\" + documentVo.getNumber() + "\\";
//生成特定的文档目录,保存生成的word文件
FileUtil.mkdir(outWordFilePath);
Class<?> clazz = Class.forName("com.inet.pdm.factory.InternalInterfaceUtils");
Method settingDataMethod = clazz.getMethod("settingData", DxDocumentVO.class, InterfaceInfoLinkVO.class, WfProcessInfoVO.class);
Method settingDataMethod = clazz.getMethod("settingData", DxDocumentVO.class, ExtInterfaceInfoLinkVO.class, DxWfProcessInfoVO.class);
JSONObject jsonObject = (JSONObject) settingDataMethod.invoke(SpringUtil.getBean(InternalInterfaceUtils.class), documentVo, infoLinkVO, wfProcessInfoVO);
//生成word文件方法
importWordService.getWordAllTable(jsonObject, PATH + file + ".docx", outWordFilePath + "outFile.docx");
......
package com.yonde.dcs.document.core.events;
import com.ctrip.framework.apollo.core.utils.StringUtils;
import com.inet.pdm.entity.vo.ExtIncomeContractVO;
import com.inet.pdm.entity.vo.ExtPlanVO;
import com.inet.pdm.entity.vo.ExtSpendingContractVO;
import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.context.common.vo.DxContextVO;
import com.yonde.dex.context.feign.ContextServiceFeign;
import com.yonde.dex.dao.service.BaseService;
import com.yonde.dex.dao.service.listener.AbstractEventListener;
import com.yonde.dex.dict.service.service.IDictDataService;
import com.yonde.dex.dict.feign.DictDataFeignService;
import com.yonde.dex.dict.service.vo.DictDataVO;
import com.yonde.dex.lcycle.baseentity.vo.DxObjectVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -27,7 +23,7 @@ import java.util.stream.Collectors;
@Slf4j
public class ValidateSecretListener extends AbstractEventListener<BaseService.DataChangeEvent> {
@Autowired
private IDictDataService dictDataService;
private DictDataFeignService dictDataService;
@Autowired
private ContextServiceFeign contextServiceFeign;
......@@ -59,8 +55,8 @@ public class ValidateSecretListener extends AbstractEventListener<BaseService.Da
log.info(">>>>>extValidateSecret data:" + data);
log.info(">>>>>extValidateSecret data.getClass:" + data.getClass());
//校验项目中心相关对象密级和计划密级
if (data instanceof DxObjectVo) {
String checkResultStr = checkDxObjectSecret((DxObjectVo) data);
if (data instanceof DxContextVO) {
String checkResultStr = checkDxObjectSecret((DxContextVO) data);
if (!StringUtils.isEmpty(checkResultStr)) {
throw new DxBusinessException("500", checkResultStr);
}
......@@ -76,21 +72,22 @@ public class ValidateSecretListener extends AbstractEventListener<BaseService.Da
* @param dxObjectVo
* @return
*/
private String checkDxObjectSecret(DxObjectVo dxObjectVo) {
private String checkDxObjectSecret(DxContextVO dxObjectVo) {
String checkResultStr = "";
Boolean checkResult = true;
if (dxObjectVo instanceof ExtPlanVO) {
checkResult = checkDxObjectVoSecret(dxObjectVo);
checkResultStr = "计划密级不能高于项目密级!";
}
if (dxObjectVo instanceof ExtIncomeContractVO) {
checkResult = checkDxObjectVoSecret(dxObjectVo);
checkResultStr = "收入合同密级不能高于项目密级!";
}
if (dxObjectVo instanceof ExtSpendingContractVO) {
checkResult = checkDxObjectVoSecret(dxObjectVo);
checkResultStr = "支出合同密级不能高于项目密级!";
}
//todo
// if (dxObjectVo instanceof ExtPlanVO) {
// checkResult = checkDxObjectVoSecret(dxObjectVo);
// checkResultStr = "计划密级不能高于项目密级!";
// }
// if (dxObjectVo instanceof ExtIncomeContractVO) {
// checkResult = checkDxObjectVoSecret(dxObjectVo);
// checkResultStr = "收入合同密级不能高于项目密级!";
// }
// if (dxObjectVo instanceof ExtSpendingContractVO) {
// checkResult = checkDxObjectVoSecret(dxObjectVo);
// checkResultStr = "支出合同密级不能高于项目密级!";
// }
if (checkResult) {
checkResultStr = "";
}
......@@ -102,12 +99,14 @@ public class ValidateSecretListener extends AbstractEventListener<BaseService.Da
*
* @return
*/
private Boolean checkDxObjectVoSecret(DxObjectVo dxObjectVo) {
if (StringUtils.isBlank(dxObjectVo.getSecretCode())) {
return true;
}
DxContextVO dxContextVO = contextServiceFeign.get(dxObjectVo.getDxContextId());
return checkTargetSecret(dxContextVO.getSecretCode(), dxObjectVo.getSecretCode());
//todo
private Boolean checkDxObjectVoSecret(DxContextVO dxObjectVo) {
// if (StringUtils.isBlank(dxObjectVo.getSecretCode())) {
// return true;
// }
// DxContextVO dxContextVO = contextServiceFeign.get(dxObjectVo.getDxContextId());
// return checkTargetSecret(dxContextVO.getSecretCode(), dxObjectVo.getSecretCode());
return false;
}
/**
......
package com.yonde.dcs.document.core.factory;
import com.alibaba.fastjson.JSONObject;
import com.yonde.dcs.document.common.vo.DxDocumentVO;
import com.yonde.dcs.document.common.vo.ExtInterfaceInfoLinkVO;
import com.yonde.dcs.document.core.constants.Constants;
import com.yonde.dcs.document.core.service.ExtDocService;
import com.yonde.dex.dfs.vo.ObjFileLinkVO;
import com.yonde.dex.user.feign.DxUserInfoFeign;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author xfchai
* @ClassName InterfaceUtils.java
* @Description 内部接口
* @createTime 2021/11/16 14:13:00
*/
@Component
@Slf4j
public class InternalInterfaceUtils {
@Autowired
private ExtDocService extDocService;
@Autowired
private DxUserInfoFeign userService;
/**
* 填充数据
*
* @param
* @return
*/
public JSONObject settingData(DxDocumentVO v, ExtInterfaceInfoLinkVO infoLinkVO, DxWfProcessInfoVO wfProcessInfoVO) {
//获取动态属性
// Map<String, Object> dynamicAttrs = v.getDynamicAttrs();
// String designPhase = Objects.isNull(dynamicAttrs.get("designPhase")) ? "" : (String) dynamicAttrs.get("designPhase");
// String content = Objects.isNull(dynamicAttrs.get("content")) ? "" : (String) dynamicAttrs.get("content");
// String applicant = Objects.isNull(dynamicAttrs.get("applicant")) ? "" : (String) dynamicAttrs.get("applicant");
// String aplicationDate = Objects.isNull(dynamicAttrs.get("aplicationDate")) ? "" : (String) dynamicAttrs.get("aplicationDate");
// String requestDate = Objects.isNull(dynamicAttrs.get("requestDate")) ? "" : (String) dynamicAttrs.get("requestDate");
// String appReviewerDate = Objects.isNull(dynamicAttrs.get("appReviewerDate")) ? "" : (String) dynamicAttrs.get("appReviewerDate");
// String ztsSignDate = Objects.isNull(dynamicAttrs.get("ztsSignDate")) ? "" : (String) dynamicAttrs.get("ztsSignDate");
// JSONObject jsonObject = new JSONObject();
// //项目代号
// String projectCode = ObjectUtils.isEmpty(v.getProjectCode()) ? "" : v.getProjectCode();
// jsonObject.put("apply", "\u0052");
// //密级
// jsonObject.put("SecretCode", extDocService.searchDictDataByDictCode(Constants.SECRET_CODE, v.getSecretCode()));
// jsonObject.put("projectCode", projectCode);
// //设计阶段
// jsonObject.put("designPhase", extDocService.searchDictDataByDictCode(Constants.DESIGN_STAGE, designPhase));
// //接口资料编号
// jsonObject.put("number", ObjectUtils.isEmpty(v.getNumber()) ? "" : v.getNumber());
// //接口名称
// jsonObject.put("name", ObjectUtils.isEmpty(v.getName()) ? "" : v.getName());
// //申请方
// jsonObject.put("applicant", applicant);
// //申请人日期
// jsonObject.put("aplicationDate", DateUtils.conversionDate(aplicationDate));
// String userId = (String) dynamicAttrs.get("applicantorId");
// DxUserInfoVO userVO = (DxUserInfoVO) userService.get(Long.parseLong(userId));
// //申请人签审
// jsonObject.put("sqr_photo", userVO.getUserAccount() + ".png");
// //内容
// jsonObject.put("content", content);
// //要求提交日期
// jsonObject.put("requestDate", DateUtils.conversionDate(requestDate));
// String appReviewer = (String) dynamicAttrs.get("appReviewer");
// if (StringUtils.isEmpty(appReviewer)) {
// log.error("申请审核人为空!");
// }
// if (StringUtils.isEmpty((String) dynamicAttrs.get("ztsSign"))) {
// log.error("总体室签审为空!");
// }
// //申请审核人
// jsonObject.put("sqshr_photo", (String) dynamicAttrs.get("appReviewer") + ".png");
// //总体室签审/日期
// jsonObject.put("ztsSign", (String) dynamicAttrs.get("ztsSign") + ".png");
// //申请审核人日期
// jsonObject.put("appReviewerDate", DateUtils.conversionDate(appReviewerDate));
// jsonObject.put("ztsSignDate", DateUtils.conversionDate(ztsSignDate));
// //页数
// jsonObject.put("pages", v.getAttachPages());
// //判断内部接口基本信息有无附件属性
// checkObjFileLinks(jsonObject, v.getObjFileLinks());
// ExtInformingVO informingVO = infoLinkVO.getTarget();
// if (ObjectUtils.isEmpty(informingVO)) {
// jsonObject.put("infoAttach", "\u00A3");
// jsonObject.put("infoNoAttach", "\u00A3");
// return jsonObject;
// } else {
// jsonObject.put("informativeUnit", Objects.isNull(informingVO.getInformativeUnit()) ? "" : informingVO.getInformativeUnit());
// //提交人日期
// DxUserInfoVO informativeUser = informingVO.getInformativeUser();
// if (!ObjectUtils.isEmpty(informativeUser)) {
// String user = informativeUser.getUserAccount() + ".png";
// //提交人
// jsonObject.put("tjr_photo", user);
// }
// //提交人日期
// jsonObject.put("informativeDate", DateUtils.converLocalDateToString(informingVO.getCreateTime()));
// jsonObject.put("infoContent", Objects.isNull(informingVO.getInfoContent()) ? "" : informingVO.getInfoContent());
// jsonObject.put("remark", Objects.isNull(informingVO.getInfoComment()) ? "" : informingVO.getInfoComment());
// //有无附件属性
// List<ObjFileLinkVO> informingVOObjFileLinks = informingVO.getObjFileLinks();
// this.checkInforObjFileLinks(jsonObject, informingVOObjFileLinks);
// //todo 获取参与者
// List<WfTaskDefinitionVO> activities = wfProcessInfoVO.getActivityInfo();
// if (!CollectionUtils.isEmpty(activities)) {
// for (WfTaskDefinitionVO wf : activities) {
// if (SignConstants.SIGN_KEY_PREPARED.equals(wf.getTaskName())) {
// List<WfProcessTaskVO> taskList = wf.getTaskList();
// for (WfProcessTaskVO wfPro : taskList) {
// //编制且为提交时,把编制人填写备注的属性,写入word文档
// if (SignConstants.WfRoutingList.contains(wfPro.getResult())) {
// jsonObject.put("decription", ObjectUtils.isEmpty(wfPro.getComments()) ? "" : wfPro.getComments().get(0));
// }
// }
// }
// }
// //写入签名数据
// //负责人签字
// jsonObject.put("sqfqr_photo", extDocService.getSignImage(activities, SignConstants.SIGN_KEY_PREPARED));
// jsonObject.put("sqfqr_date", extDocService.getEndDate(activities, SignConstants.SIGN_KEY_PREPARED));
// //总体室签审/日期
// jsonObject.put("zts_photo", extDocService.getSignImage(activities, SignConstants.SIGN_KEY_ZTSQS));
// jsonObject.put("zts_date", extDocService.getEndDate(activities, SignConstants.SIGN_KEY_ZTSQS));
// //提资审核
// jsonObject.put("sh_photo", extDocService.getSignImage(activities, SignConstants.SIGN_KEY_TZSH));
// jsonObject.put("sh_date", extDocService.getEndDate(activities, SignConstants.SIGN_KEY_TZSH));
// //批准
// jsonObject.put("pz_photo", extDocService.getSignImage(activities, SignConstants.SIGN_KEY_APPROVED));
// jsonObject.put("pz_date", extDocService.getEndDate(activities, SignConstants.SIGN_KEY_APPROVED));
// }
// return jsonObject;
// }
return null;
}
/**
* 校验提资信息是否有附件
*
* @param jsonObject
* @param informingVOObjFileLinks
*/
private void checkInforObjFileLinks(JSONObject jsonObject, List<ObjFileLinkVO> informingVOObjFileLinks) {
if (CollectionUtils.isEmpty(informingVOObjFileLinks)) {
jsonObject.put("infoNoAttach", "\u0052");
jsonObject.put("infoAttach", "\u00A3");
} else {
List<ObjFileLinkVO> collect = informingVOObjFileLinks.stream().filter(item ->
Constants.ATTACH_FILE.equals(item.getContentType())
).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
jsonObject.put("infoAttach", "\u0052");
jsonObject.put("infoNoAttach", "\u00A3");
} else {
jsonObject.put("infoNoAttach", "\u0052");
jsonObject.put("infoAttach", "\u00A3");
}
}
}
/**
* 校验内部接口基本信息内容是否附件
*
* @param jsonObject
* @param objFileLinks
*/
private void checkObjFileLinks(JSONObject jsonObject, List<ObjFileLinkVO> objFileLinks) {
if (CollectionUtils.isEmpty(objFileLinks)) {
jsonObject.put("interNoAttach", "\u0052");
jsonObject.put("interAttach", "\u00A3");
} else {
List<ObjFileLinkVO> collect = objFileLinks.stream().filter(item ->
Constants.APP_CONTENT_ATTCH.equals(item.getContentType())
).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
//对号
jsonObject.put("interAttach", "\u0052");
jsonObject.put("interNoAttach", "\u00A3");
} else {
jsonObject.put("interNoAttach", "\u0052");
jsonObject.put("interAttach", "\u00A3");
}
}
}
}
......@@ -5,6 +5,7 @@ import com.yonde.dcs.document.common.vo.DxDocumentVO;
import com.yonde.dcs.document.common.vo.ExtCheckedFileLinkVO;
import com.yonde.dcs.document.common.vo.ExtReviewDocLinkVO;
import com.yonde.dcs.document.core.constants.Constants;
import com.yonde.dcs.document.core.service.ExtDocService;
import com.yonde.dcs.document.core.util.DateUtils;
import com.yonde.dcs.document.entity.excel.MeetingPojo;
import org.springframework.beans.factory.annotation.Autowired;
......
package com.yonde.dcs.document.core.factory;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject;
import com.yonde.dcs.document.common.vo.DxDocumentVO;
import com.yonde.dcs.document.core.constants.Constants;
import com.yonde.dcs.document.core.service.ExtDocService;
import com.yonde.dcs.document.core.util.DateUtils;
import com.yonde.dcs.document.core.util.WorkFlowUtil;
import com.yonde.dcs.document.core.word.ImportWordService;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.util.Map;
import java.util.Objects;
/**
* @author xfchai
* @ClassName OutdatedDocNotifyUtils.java
* @Description 过时文件通知
* @createTime 2021/11/23 09:54:00
*/
@Component
public class OutdatedDocNotifyUtils {
@Autowired
private ExtDocService extDocService;
@Autowired
private ImportWordService importWordService;
@Autowired
private WorkFlowUtil workFlowUtil;
/**
* 填充数据
*
* @param
* @return
*/
public JSONObject settingData(DxDocumentVO v, DxWfProcessInfoVO wfProcessInfoVO) {
String path = Constants.MTEMPLATE_ABSOLUTE_PATH;
String file = v.getSubTypeName();
String outFilePath = Constants.MERGER_FILE_ABSOLUTE_PATH + v.getSubTypeName() + "\\" + v.getNumber() + "\\";
//生成特定的文档目录,保存生成的word文件
FileUtil.mkdir(outFilePath);
//获取动态属性
Map<String, Object> dynamicAttrs = v.getDynamicAttrs();
String distributNumber = Objects.isNull(dynamicAttrs.get("distributNumber")) ? "" : (String) dynamicAttrs.get("distributNumber");
String obsoletedDocNo = Objects.isNull(dynamicAttrs.get("obsoletedDocNo")) ? "" : (String) dynamicAttrs.get("obsoletedDocNo");
String obsoleteDocVer = Objects.isNull(dynamicAttrs.get("obsoleteDocVer")) ? "" : (String) dynamicAttrs.get("obsoleteDocVer");
String obsoleteDocName = Objects.isNull(dynamicAttrs.get("obsoleteDocName")) ? "" : (String) dynamicAttrs.get("obsoleteDocName");
String copies = Objects.isNull(dynamicAttrs.get("copies")) ? "" : (String) dynamicAttrs.get("copies");
Integer pages = Objects.isNull(dynamicAttrs.get("pages")) ? 0 : (Integer) dynamicAttrs.get("pages");
String distributDate = Objects.isNull(dynamicAttrs.get("distributDate")) ? "" : (String) dynamicAttrs.get("distributDate");
JSONObject jsonObject = new JSONObject();
//文件分发号
jsonObject.put("disNumber", distributNumber);
//文件编号
jsonObject.put("obsoDocNo", obsoletedDocNo);
//过时文件通知单编号
jsonObject.put("number", ObjectUtils.isEmpty(v.getNumber()) ? "" : v.getNumber());
//版本
jsonObject.put("version", obsoleteDocVer);
//文件名称
jsonObject.put("docName", obsoleteDocName);
//分发日期
jsonObject.put("disDate", DateUtils.conversionDate(distributDate));
//份数
jsonObject.put("copies", copies);
//页数
jsonObject.put("page", pages);
//todo 获取参与者
// List<WfTaskDefinitionVO> activities = wfProcessInfoVO.getActivityInfo();
// if (!CollectionUtils.isEmpty(activities)) {
// //写入签名数据(总体室)
// jsonObject.put("bmfzr_photo", workFlowUtil.getSignImage(activities, SignConstants.ZTSSignTaskList));
// jsonObject.put("bmfzr_date", workFlowUtil.getEndDate(activities, SignConstants.ZTSSignTaskList));
// }
//模板名称
importWordService.getWordAllTable(jsonObject, path + file + ".docx", outFilePath + "outFile.docx");
return jsonObject;
}
}
......@@ -5,7 +5,6 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.io.FileUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson.JSONObject;
import com.jcraft.jsch.UserInfo;
import com.yonde.dcs.document.common.vo.*;
import com.yonde.dcs.document.core.constants.Constants;
import com.yonde.dcs.document.core.events.DocBeforeCreateEvent;
......
......@@ -3,11 +3,11 @@ package com.yonde.dcs.document.core.word;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import com.jacob.com.Variant;
import java.io.File;
import java.io.IOException;
......
package com.yonde.dcs.document.core.word;
import com.alibaba.fastjson.JSONObject;
import com.inet.pdm.util.Word2PdfJacobUtil;
import com.yonde.dcs.document.core.util.Word2PdfJacobUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -94,22 +93,23 @@ public class ImportWordService {
*/
public int getPdfPages(FileInputStream is) {
int page = 0;
PDDocument pdDocument = null;
try {
pdDocument = PDDocument.load(is);
int pdfPages = pdDocument.getNumberOfPages();
page = page + pdfPages;
} catch (Exception e) {
log.error(e.toString());
} finally {
if (pdDocument != null) {
try {
pdDocument.close();
} catch (IOException e) {
log.error(e.toString());
}
}
}
//todo
// PDDocument pdDocument = null;
// try {
// pdDocument = PDDocument.load(is);
// int pdfPages = pdDocument.getNumberOfPages();
// page = page + pdfPages;
// } catch (Exception e) {
// log.error(e.toString());
// } finally {
// if (pdDocument != null) {
// try {
// pdDocument.close();
// } catch (IOException e) {
// log.error(e.toString());
// }
// }
// }
return page;
}
......
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