Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dcs-doc-expand
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
INET-TWO
server
dcs-doc-expand
Commits
5ae287fc
Commit
5ae287fc
authored
Aug 16, 2024
by
xuzhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix][DOC]迁移类缺失问题修改
parent
224ed2bb
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1578 additions
and
940 deletions
+1578
-940
compiler.xml
.idea/compiler.xml
+1
-0
pom.xml
dcs-doc-autotask-interface/pom.xml
+0
-1
pom.xml
dcs-doc-expand-core/pom.xml
+15
-1
ExtAutoTaskController.java
.../com/yonde/dcs/core/controller/ExtAutoTaskController.java
+5
-3
DocumentEvent.java
...src/main/java/com/yonde/dcs/core/event/DocumentEvent.java
+396
-0
DocBeforeCreateEvent.java
.../java/com/yonde/dcs/core/events/DocBeforeCreateEvent.java
+53
-260
DocTransactionEvent.java
...n/java/com/yonde/dcs/core/events/DocTransactionEvent.java
+0
-58
ValidateSecretListener.java
...ava/com/yonde/dcs/core/events/ValidateSecretListener.java
+1
-112
InternalInterfaceUtils.java
...va/com/yonde/dcs/core/factory/InternalInterfaceUtils.java
+112
-104
TechnicalFileUtils.java
...n/java/com/yonde/dcs/core/factory/TechnicalFileUtils.java
+411
-353
ExtAutoTaskServiceImpl.java
...m/yonde/dcs/core/service/impl/ExtAutoTaskServiceImpl.java
+12
-10
ExtDxDocumentServiceImpl.java
...cs/core/service/impl/expand/ExtDxDocumentServiceImpl.java
+21
-7
SignHelper.java
...rc/main/java/com/yonde/dcs/core/signUtils/SignHelper.java
+295
-0
SignImageUtil.java
...main/java/com/yonde/dcs/core/signUtils/SignImageUtil.java
+42
-0
SignUtil.java
.../src/main/java/com/yonde/dcs/core/signUtils/SignUtil.java
+50
-0
SignWordUtil.java
.../main/java/com/yonde/dcs/core/signUtils/SignWordUtil.java
+67
-0
ExtDocUtil.java
...ore/src/main/java/com/yonde/dcs/core/util/ExtDocUtil.java
+10
-12
ObjFileLinkUtil.java
...rc/main/java/com/yonde/dcs/core/util/ObjFileLinkUtil.java
+15
-16
ProcessDataUtils.java
...c/main/java/com/yonde/dcs/core/util/ProcessDataUtils.java
+1
-1
DocumentEventTest.java
...test/java/com/yonde/dcs/core/event/DocumentEventTest.java
+39
-0
ExtAutoTaskServiceFeignTest.java
...java/com/yonde/dcs/feign/ExtAutoTaskServiceFeignTest.java
+31
-0
ExtAutoTaskServiceFeign.java
...ain/java/com/yonde/dcs/feign/ExtAutoTaskServiceFeign.java
+1
-2
No files found.
.idea/compiler.xml
View file @
5ae287fc
...
...
@@ -2,6 +2,7 @@
<project
version=
"4"
>
<component
name=
"CompilerConfiguration"
>
<annotationProcessing>
<profile
default=
"true"
name=
"Default"
enabled=
"true"
/>
<profile
name=
"Maven default annotation processors profile"
enabled=
"true"
>
<sourceOutputDir
name=
"target/generated-sources/annotations"
/>
<sourceTestOutputDir
name=
"target/generated-test-sources/test-annotations"
/>
...
...
dcs-doc-autotask-interface/pom.xml
View file @
5ae287fc
...
...
@@ -26,7 +26,6 @@
<dependency>
<groupId>
com.yonde.dcs
</groupId>
<artifactId>
dcs-doc-core
</artifactId>
<version>
4.1-RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.yonde.dcs
</groupId>
...
...
dcs-doc-expand-core/pom.xml
View file @
5ae287fc
...
...
@@ -24,7 +24,6 @@
<dependency>
<groupId>
com.yonde.dcs
</groupId>
<artifactId>
dcs-doc-core
</artifactId>
<version>
4.1-RELEASE
</version>
<exclusions>
<exclusion>
<groupId>
com.yonde.dcs
</groupId>
...
...
@@ -163,6 +162,21 @@
<groupId>
com.yonde.dex
</groupId>
<artifactId>
dex-wfc-common
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.junit.jupiter
</groupId>
<artifactId>
junit-jupiter
</artifactId>
<version>
5.8.1
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.yonde.dex
</groupId>
<artifactId>
dex-wfc-common
</artifactId>
</dependency>
<dependency>
<groupId>
com.luhuiguo
</groupId>
<artifactId>
aspose-words
</artifactId>
...
...
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/controller/ExtAutoTaskController.java
View file @
5ae287fc
...
...
@@ -8,7 +8,6 @@ import com.yonde.dcs.core.constants.Constants;
import
com.yonde.dcs.core.service.ExtAutoTaskService
;
import
com.yonde.dcs.core.service.ExtSendFormLinkService
;
import
com.yonde.dcs.core.util.ExtDocUtil
;
import
com.yonde.dcs.core.util.ExtWfcUtil
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.esign.plugin.message.WfcSignMessage
;
import
com.yonde.dcs.plan.common.vo.ExtPlanVO
;
...
...
@@ -25,12 +24,12 @@ import com.yonde.dex.wfc.common.vo.DxWfTaskContext;
import
com.yonde.dex.wfc.feign.api.WfcProcessFeign
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.SneakyThrows
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.
transaction.annotation.Transactional
;
import
org.springframework.
stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
import
javax.validation.Valid
;
import
java.time.LocalDateTime
;
import
java.util.*
;
...
...
@@ -44,8 +43,11 @@ import java.util.*;
@RestController
@RequestMapping
(
"/task"
)
@Api
(
tags
=
"自动任务服务接口"
)
@Controller
(
ExtAutoTaskController
.
BEAN_NAME
)
public
class
ExtAutoTaskController
{
public
static
final
String
BEAN_NAME
=
"extAutoTaskController"
;
@Autowired
WfcProcessFeign
wfcProcessFeign
;
...
...
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/event/DocumentEvent.java
View file @
5ae287fc
This diff is collapsed.
Click to expand it.
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/events/DocBeforeCreateEvent.java
View file @
5ae287fc
This diff is collapsed.
Click to expand it.
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/events/DocTransactionEvent.java
View file @
5ae287fc
...
...
@@ -27,62 +27,4 @@
//@Slf4j
//public class DocTransactionEvent {
//
// @Autowired
// private ExtDocService extDocService;
//
// @Autowired
// @Qualifier("documentServiceImpl")
// DocumentService documentService;
// @Autowired
// private ExtIncomeContractServiceFeign extIncomeContractService;
// @Autowired
// private ExtSpendingContractServiceFeign extSpendingContractService;
// @Autowired
// private ExtDocUtil extDocUtil;
//
// @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
// public void afterCommit(BaseService.DataChangeEvent event) {
// final String eventType = event.getEventType();
// final BaseService.ChangeType changeType = BaseService.ChangeType.valueOf(eventType);
// if (changeType == BaseService.ChangeType.POST_CREATE || changeType == BaseService.ChangeType.POST_UPDATE || changeType == BaseService.ChangeType.POST_DELETE) {
// event.getEventTargets().forEach(t -> {
// DxDocumentVO doc = new DxDocumentVO();
// if (t instanceof ExtIncomeDetailVO) {
// //刷新收入合同相关金额
// ExtIncomeDetailVO extIncomeDetailVO = (ExtIncomeDetailVO) t;
// this.refreshInContractAmount(extIncomeDetailVO.getExtIncomeContractId());
// } else if (t instanceof ExtSpendingDetailVO) {
// //刷新支出合同相关金额
// ExtSpendingDetailVO spendingDetailVO = (ExtSpendingDetailVO) t;
// this.refreshSpeContractAmount(spendingDetailVO.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);
// }
//}
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/events/ValidateSecretListener.java
View file @
5ae287fc
//package com.yonde.dcs.core.events;
//
//
//import com.yonde.dcs.plan.common.vo.ExtPlanVO;
//import com.yonde.dex.basedata.exception.DxBusinessException;
//import com.yonde.dex.context.common.vo.DxContextVO;
//import com.yonde.dex.context.feign.ContextServiceFeign;
...
...
@@ -23,120 +24,8 @@
//@Service
//@Slf4j
//public class ValidateSecretListener extends AbstractEventListener<BaseService.DataChangeEvent> {
// @Autowired
// private DictDataFeignService dictDataService;
// @Qualifier("com.yonde.dex.context.feign.ContextProjectServiceFeign")
// @Autowired
//
// private ContextServiceFeign contextServiceFeign;
//
// @Override
// public void onAsynEvent(BaseService.DataChangeEvent event) {
//
// }
//
// @Override
// public void onEvent(BaseService.DataChangeEvent event) {
// // 页面资源变更的时候
// switch (event.operationType) {
// case POST_CREATE:
// extValidateSecret(event.eventTargets);
// break;
// case POST_UPDATE:
// extValidateSecret(event.eventTargets);
// break;
// case POST_DELETE:
// break;
// default:
// break;
// }
// }
//
// @Transactional(rollbackFor = {Exception.class, Error.class})
// void extValidateSecret(Iterable<?> objects) {
// for (Object data : objects) {
// log.info(">>>>>extValidateSecret data:" + data);
// log.info(">>>>>extValidateSecret data.getClass:" + data.getClass());
// //校验项目中心相关对象密级和计划密级
// if (data instanceof DxContextVO) {
// String checkResultStr = checkDxObjectSecret((DxContextVO) data);
// if (!StringUtils.isEmpty(checkResultStr)) {
// throw new DxBusinessException("500", checkResultStr);
// }
// }
//
//
// }
// }
//
// /**
// * 校验计划、收入合同、支出合同密级与项目的关系
// *
// * @param dxObjectVo
// * @return
// */
// private String checkDxObjectSecret(DxContextVO dxObjectVo) {
// String checkResultStr = "";
// Boolean checkResult = true;
// //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 = "";
// }
// return checkResultStr;
// }
//
// /**
// * 校验计划、收入合同、支出合同密级与项目的关系
// *
// * @return
// */
// //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;
// }
//
// /**
// * 校验密级信息
// *
// * @param sourceSecret
// * @param targetSecret
// * @return
// */
// private Boolean checkTargetSecret(String sourceSecret, String targetSecret) {
// DictDataVO docSecretCodeDict;
// if (StringUtils.isEmpty(sourceSecret)) {
// //密级为空则获取默认密级
// docSecretCodeDict = dictDataService.getMarkDictData("SecretCode");
// } else {
// docSecretCodeDict = dictDataService.getDictCode("SecretCode", sourceSecret);
// }
// List<DictDataVO> secretCodeDictList = dictDataService.getDictDatas("SecretCode");
// if (CollectionUtils.isNotEmpty(secretCodeDictList)) {
// Set<String> enableSecretCodeSet = secretCodeDictList.stream()
// .filter(x -> x.getDictSeq() <= docSecretCodeDict.getDictSeq())
// .map(DictDataVO::getDictKey)
// .collect(Collectors.toSet());
// if (enableSecretCodeSet != null && enableSecretCodeSet.contains(targetSecret)) {
// return true;
// }
// }
// return false;
// }
//}
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/factory/InternalInterfaceUtils.java
View file @
5ae287fc
This diff is collapsed.
Click to expand it.
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/factory/TechnicalFileUtils.java
View file @
5ae287fc
This diff is collapsed.
Click to expand it.
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/service/impl/ExtAutoTaskServiceImpl.java
View file @
5ae287fc
...
...
@@ -8,11 +8,9 @@ import cn.hutool.extra.spring.SpringUtil;
import
cn.hutool.http.ContentType
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yonde.dcs.common.vo.*
;
import
com.yonde.dcs.core.constants.Constants
;
import
com.yonde.dcs.core.constants.SignConstants
;
import
com.yonde.dcs.core.events.DocBeforeCreateEvent
;
import
com.yonde.dcs.core.events.ProcessDataUtils
;
import
com.yonde.dcs.core.event.DocumentEvent
;
import
com.yonde.dcs.core.factory.*
;
import
com.yonde.dcs.core.service.*
;
import
com.yonde.dcs.core.util.*
;
...
...
@@ -81,9 +79,12 @@ import java.util.stream.Collectors;
* @author: dang wei
* @create: 2021-09-27 09:42
*/
@Service
@Service
(
ExtAutoTaskServiceImpl
.
BEAN_NAME
)
@Slf4j
public
class
ExtAutoTaskServiceImpl
implements
ExtAutoTaskService
{
public
static
final
String
BEAN_NAME
=
"extAutoTaskServiceImpl"
;
@Qualifier
(
"documentServiceImpl"
)
@Autowired
private
DocumentService
documentService
;
...
...
@@ -113,6 +114,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
private
DxPostMemberLinkFeign
<
DxPostMemberLinkVO
>
dxPostMemberLinkFeign
;
@Resource
private
ExtPlanDocLinkServiceFeign
planDocLinkService
;
@Autowired
private
ExtPlanServiceFeign
extPlanService
;
@Autowired
...
...
@@ -122,7 +124,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
@Autowired
private
ExtInterfaceInfoLinkService
interfaceInfoLinkService
;
@Autowired
private
Doc
BeforeCreateEvent
docBeforeCreate
Event
;
private
Doc
umentEvent
document
Event
;
@Autowired
private
FileManagerFeignService
fileManagerFeignService
;
@Autowired
...
...
@@ -643,7 +645,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
if
(!
CollectionUtils
.
isEmpty
(
interfaceInfoLinkVOS
))
{
//1、先根据提资记录生成多个文档
interfaceInfoLinkVOS
.
stream
().
forEach
(
item
->
{
doc
BeforeCreate
Event
.
generateAutoInterFaceWord
(
docObjFile
,
item
,
wfProcessInfoVO
);
doc
ument
Event
.
generateAutoInterFaceWord
(
docObjFile
,
item
,
wfProcessInfoVO
);
});
try
{
//2、合并生成好的文档
...
...
@@ -968,7 +970,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
if
(!
CollectionUtils
.
isEmpty
(
interfaceInfoLinkVOS
))
{
//1、先根据提资记录生成多个文档(不需要上传到附件和主内容中)
interfaceInfoLinkVOS
.
stream
().
forEach
(
item
->
{
doc
BeforeCreate
Event
.
generateAutoInterFaceWord
(
documentVO
,
item
,
wfProcessInfoVO
);
doc
ument
Event
.
generateAutoInterFaceWord
(
documentVO
,
item
,
wfProcessInfoVO
);
});
try
{
//2、合并生成好的文档
...
...
@@ -1000,8 +1002,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
*/
@Override
public
void
generateWordByAutoMethod
(
DxDocumentVO
documentVo
)
{
// DxDocumentVO dxDocumentVO = docBeforeCreate
Event.processCreateData(documentVo);
//
documentService.saveRecursion(dxDocumentVO);
DxDocumentVO
dxDocumentVO
=
document
Event
.
processCreateData
(
documentVo
);
documentService
.
saveRecursion
(
dxDocumentVO
);
}
/**
...
...
@@ -1087,7 +1089,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
FileUtil
.
mkdir
(
outWordFilePath
);
try
{
//先生成封皮数据
doc
BeforeCreate
Event
.
generalTechnicalWord
(
documentVO
);
doc
ument
Event
.
generalTechnicalWord
(
documentVO
);
JSONObject
jsonObject
=
technicalFileUtils
.
settingData
(
documentVO
,
wfProcessInfoVO
);
//生成校核、审核、审定的记录卡
importWordService
.
getWordAllTable
(
jsonObject
,
Constants
.
TEMPLATE_PATH
+
"TechnicalFile/QHTemplate.docx"
,
outWordFilePath
+
"/QHAuditDoc.docx"
);
...
...
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/service/impl/expand/ExtDxDocumentServiceImpl.java
View file @
5ae287fc
package
com
.
yonde
.
dcs
.
core
.
service
.
impl
.
expand
;
import
com.yonde.dcs.core.constants.Constants
;
import
com.yonde.dcs.core.event.DocumentEvent
;
import
com.yonde.dcs.core.util.ProcessDataUtils
;
import
com.yonde.dcs.core.util.ExtDocUtil
;
import
com.yonde.dex.basedata.exception.DxBusinessException
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.logging.log4j.spi.CopyOnWrite
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
java.util.Collection
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.Collection
;
import
java.util.List
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
import
com.yonde.dcs.core.service.expand.ExtDxDocumentService
;
import
com.yonde.dcs.document.core.repository.DocumentRepository
;
import
com.yonde.dcs.document.entity.po.DxDocument
;
import
javax.annotation.Resource
;
import
com.yonde.dcs.document.core.service.impl.DocumentServiceImpl
;
/**
...
...
@@ -31,16 +39,22 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
@Autowired
DocumentRepository
<
DxDocument
>
documentRepository
;
@Autowired
private
DocumentEvent
documentEvent
;
@Override
public
void
beforeSave
(
Collection
<
V
>
target
)
{
//循环处理每一个文档
for
(
V
v
:
target
)
{
documentEvent
.
createDocListener
(
v
);
}
super
.
beforeSave
(
target
);
}
@Override
public
void
beforeUpdate
(
Collection
<
V
>
target
,
Collection
<
V
>
origin
)
{
for
(
V
v
:
target
)
{
documentEvent
.
updateDocListener
(
v
);
}
super
.
beforeUpdate
(
target
,
origin
);
}
}
...
...
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/signUtils/SignHelper.java
0 → 100644
View file @
5ae287fc
This diff is collapsed.
Click to expand it.
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/signUtils/SignImageUtil.java
0 → 100644
View file @
5ae287fc
package
com
.
yonde
.
dcs
.
core
.
signUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.util.Map
;
/**
* @author wyy
* @version 1.0
* @description: pdf签名
* @date 2021/6/25 15:21
*/
@Component
@Slf4j
public
class
SignImageUtil
{
/**
* 签图片 图片的大小为占位符的大小
*
* @param sourcePath 原文件路径
* @param targetPath 目标文件路径
* @param flagMap key:占位符 value:图片绝对路径
*/
public
static
void
signImage
(
String
sourcePath
,
String
targetPath
,
Map
<
String
,
String
>
flagMap
,
String
pictureFrame
)
throws
Exception
{
SignHelper
.
signImage
(
sourcePath
,
targetPath
,
flagMap
,
null
,
null
,
pictureFrame
);
}
/**
* 签图片 图片的大小为占位符的大小
*
* @param sourcePath 原文件路径
* @param targetPath 目标文件路径
* @param flagMap key:占位符 value:图片绝对路径
* @param xOffSet x轴偏移量 (正数:图片向右移动, 负数:图片向左移动)
* @param yOffset y轴偏移量 (正数:图片向上移动, 负数:图片向下移动)
*/
public
static
void
signImage
(
String
sourcePath
,
String
targetPath
,
Map
<
String
,
String
>
flagMap
,
Float
xOffSet
,
Float
yOffset
,
String
pictureFrame
)
throws
Exception
{
SignHelper
.
signImage
(
sourcePath
,
targetPath
,
flagMap
,
xOffSet
,
yOffset
,
pictureFrame
);
}
}
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/signUtils/SignUtil.java
0 → 100644
View file @
5ae287fc
package
com
.
yonde
.
dcs
.
core
.
signUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author wyy
* @version 1.0
* @description: pdf签名
* @date 2021/6/25 15:21
*/
@Component
@Slf4j
public
class
SignUtil
{
//word调整文字宽度(高度可改变字体大小调整):动态调整文字的宽高,鼠标右键选中-右键点击-字体-高级-字符间距-缩放
//缩放>100% 拉宽
//缩放<100% 变窄
/**
* 签字+签图片
*
* @param sourcePath 原文件路径
* @param targetPath 目标文件路径
* @param flagMap key:占位符 value:替换文本/图片路径
*/
public
static
void
sign
(
String
sourcePath
,
String
targetPath
,
Map
<
String
,
String
>
flagMap
,
String
pictureFrame
)
throws
Exception
{
Map
<
String
,
String
>
wordMap
=
new
HashMap
<>();
Map
<
String
,
String
>
imageMap
=
new
HashMap
<>();
for
(
Map
.
Entry
<
String
,
String
>
entry
:
flagMap
.
entrySet
())
{
//判断是否为图片 适用格式: bmp/gif/jpg/png
if
(
SignHelper
.
checkImage
(
entry
.
getValue
()))
{
log
.
info
(
"图片路径为:"
+
entry
.
getValue
().
toString
());
imageMap
.
put
(
entry
.
getKey
(),
entry
.
getValue
());
}
else
{
wordMap
.
put
(
entry
.
getKey
(),
entry
.
getValue
());
}
}
String
temPath
=
targetPath
.
replaceFirst
(
".pdf"
,
"-tem.pdf"
);
//签文字
SignWordUtil
.
signWord
(
sourcePath
,
temPath
,
wordMap
,
pictureFrame
);
//签图片
SignImageUtil
.
signImage
(
temPath
,
targetPath
,
imageMap
,
pictureFrame
);
}
}
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/signUtils/SignWordUtil.java
0 → 100644
View file @
5ae287fc
package
com
.
yonde
.
dcs
.
core
.
signUtils
;
import
com.itextpdf.kernel.font.PdfFont
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.util.Map
;
/**
* @author wyy
* @version 1.0
* @description: 签文字
* @date 2021/6/25 15:21
*/
@Component
@Slf4j
public
class
SignWordUtil
{
/**
* 签文字:字体大小为占位符大小(以占位符宽度大小为准)
*
* @param sourcePath 源文件
* @param targetPath 目标文件
* @param flagMap key:占位符 value:替换文本
*/
public
static
void
signWord
(
String
sourcePath
,
String
targetPath
,
Map
<
String
,
String
>
flagMap
,
String
pictureFrame
)
throws
Exception
{
SignHelper
.
signWord
(
sourcePath
,
targetPath
,
flagMap
,
null
,
null
,
pictureFrame
);
}
/**
* 签文字
*
* @param sourcePath 源文件
* @param targetPath 目标文件
* @param flagMap key:占位符 value:替换文本
* @param fontSize 字体大小
*/
public
static
void
signWord
(
String
sourcePath
,
String
targetPath
,
Map
<
String
,
String
>
flagMap
,
Float
fontSize
,
String
pictureFrame
)
throws
Exception
{
SignHelper
.
signWord
(
sourcePath
,
targetPath
,
flagMap
,
fontSize
,
null
,
pictureFrame
);
}
/**
* 签文字:字体大小为占位符大小(以占位符宽度大小为准)
*
* @param sourcePath 源文件
* @param targetPath 目标文件
* @param flagMap key:占位符 value:替换文本
* @param fontStyle 字体样式
*/
public
static
void
signWord
(
String
sourcePath
,
String
targetPath
,
Map
<
String
,
String
>
flagMap
,
PdfFont
fontStyle
,
String
pictureFrame
)
throws
Exception
{
SignHelper
.
signWord
(
sourcePath
,
targetPath
,
flagMap
,
null
,
fontStyle
,
pictureFrame
);
}
/**
* 签文字
*
* @param sourcePath 源文件
* @param targetPath 目标文件
* @param flagMap key:占位符 value:替换文本
* @param fontSize 字体大小
* @param fontStyle 字体样式
*/
public
static
void
signWord
(
String
sourcePath
,
String
targetPath
,
Map
<
String
,
String
>
flagMap
,
Float
fontSize
,
PdfFont
fontStyle
,
String
pictureFrame
)
throws
Exception
{
SignHelper
.
signWord
(
sourcePath
,
targetPath
,
flagMap
,
fontSize
,
fontStyle
,
pictureFrame
);
}
}
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/util/ExtDocUtil.java
View file @
5ae287fc
...
...
@@ -24,10 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestAttributes
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.io.InputStream
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -116,9 +114,9 @@ public class ExtDocUtil {
* @param fileVO
*/
// TODO: 2024/8/1 minioFileStoreService不存在
//
public InputStream obtainPrimaryFileInputStream(RepoFileVO fileVO) {
//
InputStream inputStream = null;
//
if (!ObjectUtils.isEmpty(fileVO)) {
public
InputStream
obtainPrimaryFileInputStream
(
RepoFileVO
fileVO
)
{
InputStream
inputStream
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
fileVO
))
{
// log.info("开始下载主内容======》" + fileVO.getId());
// RepoFileVO fileEntity = this.fileService.findFileInfoById(fileVO.getId());
// Site siteEntity = this.siteService.findByIsDefault(true);
...
...
@@ -127,11 +125,11 @@ public class ExtDocUtil {
// } else {
// inputStream = this.minioFileStoreService.download(fileEntity.getBucketName(), fileEntity.getMinioFileName(), fileEntity.getSecretKey(), siteEntity);
// }
//
} else {
//
log.error("下载主内容失败======》fileVO为空!");
//
}
//
return inputStream;
//
}
}
else
{
log
.
error
(
"下载主内容失败======》fileVO为空!"
);
}
return
inputStream
;
}
/**
* 通过id查询文档附件
...
...
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/util/ObjFileLinkUtil.java
View file @
5ae287fc
...
...
@@ -20,7 +20,7 @@ import java.util.stream.Collectors;
* @date 2021/7/12 10:28
*/
public
class
ObjFileLinkUtil
{
//TODO 暂使用RepoFileVO替换PapersVO
public
static
<
T
extends
IdVO
&
ContentHolder
>
void
removeAllFile
(
T
holder
)
{
if
(!
CollectionUtils
.
isEmpty
(((
ContentHolder
)
holder
).
getObjFileLinks
()))
{
...
...
@@ -42,11 +42,11 @@ public class ObjFileLinkUtil {
* @param fileType
* @param <T>
*/
// public static <T extends IdVO & ContentHolder> void replaceFile(T holder, Papers
VO fileVO, String fileType) {
//
removeFile(holder, fileType);
//
addFile(holder, fileVO, fileType);
//
}
//
public
static
<
T
extends
IdVO
&
ContentHolder
>
void
replaceFile
(
T
holder
,
RepoFile
VO
fileVO
,
String
fileType
)
{
removeFile
(
holder
,
fileType
);
addFile
(
holder
,
fileVO
,
fileType
);
}
public
static
<
T
extends
IdVO
&
ContentHolder
>
void
addFile
(
T
holder
,
RepoFileVO
fileVO
,
String
fileType
)
{
if
(
CollectionUtils
.
isEmpty
(((
ContentHolder
)
holder
).
getObjFileLinks
()))
{
((
ContentHolder
)
holder
).
setObjFileLinks
(
new
ArrayList
());
...
...
@@ -149,7 +149,6 @@ public class ObjFileLinkUtil {
* @param <T>
* @return
*/
public
static
<
T
extends
IdVO
&
ContentHolder
>
List
<
RepoFileVO
>
getAppointTypeFile
(
T
holder
,
String
fileType
)
{
if
(!
Objects
.
isNull
(
holder
)
&&
!
CollectionUtils
.
isEmpty
(((
ContentHolder
)
holder
).
getObjFileLinks
()))
{
List
<
ObjFileLinkVO
>
fileLinkVOList
=
holder
.
getObjFileLinks
().
stream
().
filter
(
o
->
o
.
getContentType
().
equalsIgnoreCase
(
fileType
)).
collect
(
Collectors
.
toList
());
...
...
@@ -168,15 +167,15 @@ public class ObjFileLinkUtil {
* @param <T>
* @return
*/
// public static <T extends IdVO & ContentHolder> List<Papers
VO> getAppointNameFile(T holder, String fileType, String fileLikeName) {
//
if (!Objects.isNull(holder) && !CollectionUtils.isEmpty(((ContentHolder) holder).getObjFileLinks())) {
//
List<ObjFileLinkVO> fileLinkVOList = holder.getObjFileLinks().stream().filter(o -> o.getContentType().equalsIgnoreCase(fileType)).collect(Collectors.toList());
//
if (!CollectionUtils.isEmpty(fileLinkVOList)) {
//
return fileLinkVOList.stream().map(ObjFileLinkVO::getTarget).filter(o -> o.getOriginalFileName().contains(fileLikeName)).collect(Collectors.toList());
//
}
//
}
//
return null;
//
}
public
static
<
T
extends
IdVO
&
ContentHolder
>
List
<
RepoFile
VO
>
getAppointNameFile
(
T
holder
,
String
fileType
,
String
fileLikeName
)
{
if
(!
Objects
.
isNull
(
holder
)
&&
!
CollectionUtils
.
isEmpty
(((
ContentHolder
)
holder
).
getObjFileLinks
()))
{
List
<
ObjFileLinkVO
>
fileLinkVOList
=
holder
.
getObjFileLinks
().
stream
().
filter
(
o
->
o
.
getContentType
().
equalsIgnoreCase
(
fileType
)).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
fileLinkVOList
))
{
return
fileLinkVOList
.
stream
().
map
(
ObjFileLinkVO:
:
getTarget
).
filter
(
o
->
o
.
getOriginalFileName
().
contains
(
fileLikeName
)).
collect
(
Collectors
.
toList
());
}
}
return
null
;
}
}
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/
events
/ProcessDataUtils.java
→
dcs-doc-expand-core/src/main/java/com/yonde/dcs/core/
util
/ProcessDataUtils.java
View file @
5ae287fc
package
com
.
yonde
.
dcs
.
core
.
events
;
package
com
.
yonde
.
dcs
.
core
.
util
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.extra.spring.SpringUtil
;
...
...
dcs-doc-expand-core/src/test/java/com/yonde/dcs/core/event/DocumentEventTest.java
0 → 100644
View file @
5ae287fc
package
com
.
yonde
.
dcs
.
core
.
event
;
import
com.yonde.dcs.common.vo.ExtIncomeContractVO
;
import
com.yonde.dcs.common.vo.ExtSpendingContractVO
;
import
com.yonde.dcs.plan.common.vo.ExtPlanVO
;
import
org.apache.commons.compress.utils.Lists
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.List
;
//@SpringBootTest
@RunWith
(
SpringRunner
.
class
)
public
class
DocumentEventTest
{
@Mock
DocumentEvent
documentEvent
;
@Test
public
void
extValidateSecretTest
()
{
ExtPlanVO
extPlanVO
=
new
ExtPlanVO
();
ExtIncomeContractVO
extIncomeContractVO
=
new
ExtIncomeContractVO
();
ExtSpendingContractVO
extSpendingContractVO
=
new
ExtSpendingContractVO
();
List
objects
=
Lists
.
newArrayList
();
objects
.
add
(
extPlanVO
);
objects
.
add
(
extIncomeContractVO
);
objects
.
add
(
extSpendingContractVO
);
documentEvent
.
extValidateSecret
(
objects
);
Assert
.
assertNotNull
(
"1"
);
}
}
dcs-doc-expand-core/src/test/java/com/yonde/dcs/feign/ExtAutoTaskServiceFeignTest.java
0 → 100644
View file @
5ae287fc
package
com
.
yonde
.
dcs
.
feign
;
import
com.yonde.dcs.core.util.ExtDocUtil
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.mockito.Mockito
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.io.File
;
@RunWith
(
SpringRunner
.
class
)
public
class
ExtAutoTaskServiceFeignTest
{
@Mock
ExtAutoTaskServiceFeign
extAutoTaskServiceFeign
;
@Mock
ExtDocUtil
extDocUtil
;
@Test
public
void
generateNcrReviewWordTest
()
{
DxDocumentVO
dxDocumentVO
=
new
DxDocumentVO
();
dxDocumentVO
.
setSubTypeName
(
"subTypeName"
);
dxDocumentVO
.
setNumber
(
"number"
);
Mockito
.
when
(
extDocUtil
.
findDocObjFileLinks
(
Mockito
.
any
())).
thenReturn
(
dxDocumentVO
);
extAutoTaskServiceFeign
.
generateNcrReviewWord
(
1L
,
null
);
Assert
.
assertNotNull
(
new
File
(
"D:\\InetService\\resource\\template\\words\\subTypeName\\number\\source"
));
}
}
\ No newline at end of file
dcs-doc-expand-feign/src/main/java/com/yonde/dcs/feign/ExtAutoTaskServiceFeign.java
View file @
5ae287fc
...
...
@@ -9,7 +9,6 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
...
@@ -23,7 +22,7 @@ import java.util.Map;
**/
@Api
(
tags
=
"ExtAutoTask-FEIGN"
)
@FeignClient
(
value
=
"${dcs.feign.DCS-DOC}"
,
path
=
"/task"
)
public
interface
ExtAutoTaskServiceFeign
{
public
interface
ExtAutoTaskServiceFeign
{
@ApiOperation
(
value
=
"客户化文档修改状态"
,
notes
=
"客户化文档修改状态"
,
httpMethod
=
"POST"
)
@PostMapping
(
value
=
"/extChangeDocState"
)
void
extChangeDocState
(
@RequestBody
DxDocumentVO
documentVO
,
@RequestParam
(
name
=
"state"
)
String
state
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment