Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
I
inet-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
inet-doc-expand
Commits
f1fd1dfb
Commit
f1fd1dfb
authored
Aug 01, 2024
by
pchxue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置文件修改
parent
4036e65d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
286 additions
and
121 deletions
+286
-121
jacob.jar
dcs-doc-core/lib/jacob.jar
+0
-0
pom.xml
dcs-doc-core/pom.xml
+29
-2
ProcessDataUtils.java
.../com/yonde/dcs/document/core/events/ProcessDataUtils.java
+2
-1
ExtAutoTaskServiceImpl.java
...cs/document/core/service/impl/ExtAutoTaskServiceImpl.java
+25
-10
CommonUtil.java
...ain/java/com/yonde/dcs/document/core/util/CommonUtil.java
+95
-0
ExtDocUtil.java
...ain/java/com/yonde/dcs/document/core/util/ExtDocUtil.java
+29
-24
FileUtils.java
...main/java/com/yonde/dcs/document/core/util/FileUtils.java
+7
-0
FreemarkerHandler.java
...a/com/yonde/dcs/document/core/util/FreemarkerHandler.java
+4
-1
Word2PdfJacobUtil.java
...a/com/yonde/dcs/document/core/util/Word2PdfJacobUtil.java
+2
-1
WorkFlowUtil.java
...n/java/com/yonde/dcs/document/core/util/WorkFlowUtil.java
+93
-82
No files found.
dcs-doc-core/lib/jacob.jar
0 → 100644
View file @
f1fd1dfb
File added
dcs-doc-core/pom.xml
View file @
f1fd1dfb
...
...
@@ -88,6 +88,33 @@
<version>
5.2.12.RELEASE
</version>
<scope>
compile
</scope>
</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>
</project>
dcs-doc-core/src/main/java/com/yonde/dcs/document/core/events/ProcessDataUtils.java
View file @
f1fd1dfb
...
...
@@ -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.util.FileUtils
;
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
;
...
...
@@ -67,7 +68,7 @@ public class ProcessDataUtils {
*/
public
void
processData
(
DxDocumentVO
documentVo
)
{
String
subTypeName
=
documentVo
.
getSubTypeName
();
WfProcessInst
VO
DxWfProcessInstVO
=
workFlowUtil
.
getWfProcessInst
(
documentVo
);
DxWfProcess
VO
DxWfProcessInstVO
=
workFlowUtil
.
getWfProcessInst
(
documentVo
);
DxWfProcessInfoVO
wfProcessInfoVO
=
dexWorkFlowService
.
getProcessInstDetailById
(
DxWfProcessInstVO
.
getId
());
switch
(
subTypeName
)
{
case
Constants
.
INTERNAL_INTERFACE
:
...
...
dcs-doc-core/src/main/java/com/yonde/dcs/document/core/service/impl/ExtAutoTaskServiceImpl.java
View file @
f1fd1dfb
...
...
@@ -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.events.DocBeforeCreateEvent
;
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.service.*
;
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.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.ExtPlanDocLinkServiceFeign
;
import
com.yonde.dcs.plan.feign.ExtPlanServiceFeign
;
...
...
@@ -221,7 +224,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
//得到souceId获取计划,更新计划状态
ExtPlanVO
source
=
planDocLinkVO
.
getSource
();
source
.
setTaskState
(
Constants
.
COMPLETED
);
extPlanService
.
saveAndChangeState
(
source
);
// TODO: 2024/8/1 extPlanService.saveOrUpdate这个方法不存在
// extPlanService.saveOrUpdate(source);
}
}
documentVO
.
setState
(
state
);
...
...
@@ -416,7 +420,9 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
*/
@Override
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 {
doc
.
setDynamicAttrs
(
map
);
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
.
markModifyIdHold
();
//设置文档创建者
...
...
@@ -605,12 +612,14 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
//绑定计划和文档的link
ExtPlanDocLinkVO
planDocLinkVO
=
new
ExtPlanDocLinkVO
();
planDocLinkVO
.
setSource
(
extPlanVO
);
planDocLinkVO
.
setTarget
(
dxDocumentVO
);
// TODO: 2024/8/1 DxDocumentVO参数类型不匹对
// planDocLinkVO.setTarget(dxDocumentVO);
planDocLinkService
.
save
(
planDocLinkVO
);
}
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 {
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
;
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
))
{
//1、先根据提资记录生成多个文档
interfaceInfoLinkVOS
.
stream
().
forEach
(
item
->
{
docBeforeCreateEvent
.
generateAutoInterFaceWord
(
docObjFile
,
item
,
wfProcessInfoVO
);
// TODO: 2024/8/1 generateAutoInterFaceWord入参不匹对
// docBeforeCreateEvent.generateAutoInterFaceWord(docObjFile, item, wfProcessInfoVO);
});
try
{
//2、合并生成好的文档
...
...
@@ -871,7 +884,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
//深度查询展开ObjLink
DxDocumentVO
documentVO
=
extDocUtil
.
findDocObjFileLinks
(
documentVo
.
getId
());
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)
// WfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(wfProcessInstVO.getId());
String
subTypeName
=
documentVO
.
getSubTypeName
();
...
...
@@ -1042,7 +1056,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
@Override
public
void
generateQHTechDoc
(
DxDocumentVO
documentVO
,
Map
<
String
,
Object
>
wfTaskContext
)
{
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
// DxWfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(wfProcessInstVO.getId());
// //深度查询展开objFileLink
...
...
dcs-doc-core/src/main/java/com/yonde/dcs/document/core/util/CommonUtil.java
0 → 100644
View file @
f1fd1dfb
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
;
}
}
dcs-doc-core/src/main/java/com/yonde/dcs/document/core/util/ExtDocUtil.java
View file @
f1fd1dfb
...
...
@@ -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.ObsoleteDocLinkVO
;
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.dex.basedata.data.search.SearchItem
;
import
com.yonde.dex.basedata.data.search.SearchItems
;
import
com.yonde.dex.basedata.data.search.SearchQueryCondition
;
import
com.yonde.dex.basedata.entity.data.DxPageImpl
;
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.RepoFileVO
;
import
com.yonde.dex.user.feign.DxUserInfoFeign
;
...
...
@@ -41,13 +43,15 @@ public class ExtDocUtil {
public
static
Map
<
String
,
RequestAttributes
>
requestAttributes
=
new
HashMap
<>();
@Autowired
D
ocCenterFeign
Service
docCenterFeignService
;
D
xDocument
Service
docCenterFeignService
;
@Autowired
private
FileService
fileService
;
@Autowired
private
MinioFileStoreService
minioFileStoreService
;
@Autowired
private
SiteService
siteService
;
private
FileManagerFeignService
fileService
;
// TODO: 2024/8/1 MinioFileStoreService这个类不存在了
// @Autowired
// private MinioFileStoreService minioFileStoreService;
// TODO: 2024/8/1 SiteService这个类不存在了
// @Autowired
// private SiteService siteService;
@Autowired
private
DxUserInfoFeign
userService
;
@Autowired
...
...
@@ -95,8 +99,8 @@ public class ExtDocUtil {
* @param objFileLinks
* @return
*/
public
Papers
VO
obtainPrimaryFile
(
List
<
ObjFileLinkVO
>
objFileLinks
)
{
Papers
VO
fileVO
=
null
;
public
RepoFile
VO
obtainPrimaryFile
(
List
<
ObjFileLinkVO
>
objFileLinks
)
{
RepoFile
VO
fileVO
=
null
;
if
(!
CollectionUtils
.
isEmpty
(
objFileLinks
))
{
fileVO
=
objFileLinks
.
stream
().
filter
(
objFileLinkVO
->
Constants
.
MASTER_FILE
.
equals
(
objFileLinkVO
.
getContentType
())).
map
(
ObjFileLinkVO:
:
getTarget
)
.
findFirst
().
orElse
(
null
);
...
...
@@ -109,22 +113,23 @@ public class ExtDocUtil {
*
* @param fileVO
*/
public
InputStream
obtainPrimaryFileInputStream
(
PapersVO
fileVO
)
{
InputStream
inputStream
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
fileVO
))
{
log
.
info
(
"开始下载主内容======》"
+
fileVO
.
getId
());
Papers
fileEntity
=
this
.
fileService
.
findById
(
fileVO
.
getId
());
Site
siteEntity
=
this
.
siteService
.
findByIsDefault
(
true
);
if
(
Objects
.
isNull
(
fileEntity
))
{
log
.
error
(
"下载主内容失败!====》"
+
DxValutErrorCodeData
.
FILE_NOT_EXISTS
);
}
else
{
inputStream
=
this
.
minioFileStoreService
.
download
(
fileEntity
.
getBucketName
(),
fileEntity
.
getMinioFileName
(),
fileEntity
.
getSecretKey
(),
siteEntity
);
}
}
else
{
log
.
error
(
"下载主内容失败======》fileVO为空!"
);
}
return
inputStream
;
}
// TODO: 2024/8/1 minioFileStoreService不存在
// 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);
// if (Objects.isNull(fileEntity)) {
// log.error("下载主内容失败!====》" + DxValutErrorCodeData.FILE_NOT_EXISTS);
// } else {
// inputStream = this.minioFileStoreService.download(fileEntity.getBucketName(), fileEntity.getMinioFileName(), fileEntity.getSecretKey(), siteEntity);
// }
// } else {
// log.error("下载主内容失败======》fileVO为空!");
// }
// return inputStream;
// }
/**
* 通过id查询文档附件
...
...
dcs-doc-core/src/main/java/com/yonde/dcs/document/core/util/FileUtils.java
View file @
f1fd1dfb
...
...
@@ -3,14 +3,21 @@ package com.yonde.dcs.document.core.util;
import
cn.hutool.core.io.FileUtil
;
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.core.constants.Constants
;
import
com.yonde.dex.basedata.entity.data.OperatorType
;
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.extern.slf4j.Slf4j
;
import
org.apache.pdfbox.io.MemoryUsageSetting
;
import
org.apache.pdfbox.multipdf.PDFMergerUtility
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
dcs-doc-core/src/main/java/com/yonde/dcs/document/core/util/FreemarkerHandler.java
View file @
f1fd1dfb
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.LoggerFactory
;
import
org.springframework.util.StringUtils
;
import
sun.misc.BASE64Encoder
;
import
java.io.*
;
import
java.util.Map
;
/**
...
...
dcs-doc-core/src/main/java/com/yonde/dcs/document/core/util/Word2PdfJacobUtil.java
View file @
f1fd1dfb
package
com
.
yonde
.
dcs
.
document
.
core
.
util
;
import
com.inet.pdm.word.DocumentDispatch
;
import
com.jacob.activeX.ActiveXComponent
;
import
com.jacob.com.ComThread
;
import
com.jacob.com.Dispatch
;
import
com.jacob.com.Variant
;
import
com.yonde.dcs.document.core.word.DocumentDispatch
;
import
lombok.extern.slf4j.Slf4j
;
/**
...
...
dcs-doc-core/src/main/java/com/yonde/dcs/document/core/util/WorkFlowUtil.java
View file @
f1fd1dfb
This diff is collapsed.
Click to expand it.
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