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
454c96de
Commit
454c96de
authored
Oct 12, 2024
by
wangyangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文档 图册:回写ied计划状态
parent
2a4ae50c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
7 deletions
+53
-7
ExtAutoTaskServiceImpl.java
...cs/document/core/service/impl/ExtAutoTaskServiceImpl.java
+9
-7
ExcelUtils.java
...ain/java/com/yonde/dcs/document/core/util/ExcelUtils.java
+44
-0
No files found.
dcs-doc-expand-core/src/main/java/com/yonde/dcs/document/core/service/impl/ExtAutoTaskServiceImpl.java
View file @
454c96de
...
...
@@ -261,7 +261,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
excelVOS
.
add
(
catalogExcelVO
);
}
//已发布的时候才需要生成图册目录 以及修改IED计划状态
if
(
Constants
.
DOC_RELEASE
.
equalsIgnoreCase
(
state
)){
if
(
Constants
.
DOC_RELEASE
.
equalsIgnoreCase
(
state
))
{
//TODO 图册生成图纸信息
String
dir
=
ResourceHelper
.
createTemDir
().
getPath
();
String
filePath
=
dir
+
"\\图册.xlsx"
;
...
...
@@ -271,10 +271,9 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
//转pdf
String
pdfName
=
"图册.pdf"
;
String
filePdfPath
=
dir
+
File
.
separator
+
pdfName
;
ExcelUtils
.
Ex2
PDF
(
filePath
,
filePdfPath
);
ExcelUtils
.
excelTo
PDF
(
filePath
,
filePdfPath
);
//上传文件到文件服务器
MultipartFile
multipartFile
=
null
;
multipartFile
=
new
MockMultipartFile
(
"file"
,
pdfName
,
com
.
yonde
.
dcs
.
plan
.
common
.
constants
.
Constants
.
CONTENT_TYPE_PDF
,
new
FileInputStream
(
filePdfPath
));
MultipartFile
multipartFile
=
new
MockMultipartFile
(
"file"
,
pdfName
,
com
.
yonde
.
dcs
.
plan
.
common
.
constants
.
Constants
.
CONTENT_TYPE_PDF
,
new
FileInputStream
(
filePdfPath
));
RepoFileVO
fileVO
=
fileManagerFeignService
.
uploadFile
(
multipartFile
,
CommonUtil
.
getBucketIdByAppName
(
com
.
yonde
.
dcs
.
document
.
core
.
constants
.
Constants
.
APPLICATION_DOC_INNER_NAME
));
ObjFileLinkUtil
.
addFile
(
documentVO
,
fileVO
,
com
.
yonde
.
dcs
.
plan
.
common
.
constants
.
Constants
.
ATTACH_FILE
);
documentVO
.
setOperator
(
OperatorType
.
MODIFY
);
...
...
@@ -284,9 +283,12 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
//TODO 判断该文档关联IED计划下所有的文档状态是否为已完成,已完成则回写IED计划状态----一个IED计划对应一个图册,直接修改计划状态即可
SearchQueryCondition
query
=
SearchUtil
.
buildQuery
(
"targetId"
,
SearchItem
.
Operator
.
EQ
,
documentVO
.
getId
());
DxPageImpl
iedPage
=
extIEDPlanDocLinkServiceFeign
.
findRecursion
(
query
);
if
(
iedPage
.
getTotalElements
()
>
0
)
{
ExtIEDPlanDocLinkVO
extIEDPlanDocLinkVO
=
(
ExtIEDPlanDocLinkVO
)
iedPage
.
getContent
().
get
(
0
);
Long
iedPlanId
=
extIEDPlanDocLinkVO
.
getSourceId
();
extIEDPlanServiceFeign
.
changeStatus
(
iedPlanId
,
Constants
.
IED_Complete
,
true
);
}
}
}
//判断接口单为审阅中设置全局状态为已打开
...
...
dcs-doc-expand-core/src/main/java/com/yonde/dcs/document/core/util/ExcelUtils.java
View file @
454c96de
...
...
@@ -18,6 +18,9 @@ import org.springframework.web.multipart.MultipartFile;
@Slf4j
public
class
ExcelUtils
{
public
static
final
int
EXCEL_FORMAT_PDF
=
0
;
//excel转pdf
private
static
final
int
xlTypePDF
=
0
;
/**
...
...
@@ -55,6 +58,47 @@ public class ExcelUtils {
}
/**
* 转换文件
*
* @param sourceFile
* @param targetFile
* @return
*/
public
static
boolean
excelToPDF
(
String
sourceFile
,
String
targetFile
)
{
boolean
result
=
true
;
log
.
info
(
"[文件转换-执行] >>>> 启动Excel..."
);
long
start
=
System
.
currentTimeMillis
();
ActiveXComponent
app
=
null
;
Dispatch
excel
=
null
;
try
{
// 创建一个excel对象
app
=
new
ActiveXComponent
(
"Excel.Application"
);
// 不可见打开excel
app
.
setProperty
(
"Visible"
,
new
Variant
(
false
));
app
.
setProperty
(
"AutomationSecurity"
,
new
Variant
(
3
));
// 获取文挡属性
Dispatch
excels
=
app
.
getProperty
(
"Workbooks"
).
toDispatch
();
//调用Documents对象中Open方法打开文档,并返回打开的文档对象Document
excel
=
Dispatch
.
call
(
excels
,
"Open"
,
sourceFile
).
toDispatch
();
// Excel不能调用SaveAs方法,excel值为0
Dispatch
.
call
(
excel
,
"ExportAsFixedFormat"
,
EXCEL_FORMAT_PDF
,
targetFile
);
long
end
=
System
.
currentTimeMillis
();
log
.
info
(
"[文件转换-执行] >>>> 打开文档:"
+
sourceFile
+
",转换文档到PDF:"
+
targetFile
+
",用时:"
+
(
end
-
start
)
+
"ms."
);
}
catch
(
Exception
e
)
{
log
.
info
(
"[文件转换-执行] >>>>Error:文档转换失败:"
,
e
);
}
finally
{
Dispatch
.
call
(
excel
,
"Close"
,
false
);
if
(
app
!=
null
)
app
.
invoke
(
"Quit"
,
new
Variant
[]{});
//如果没有这句话,winword.exe进程将不会关闭
ComThread
.
Release
();
}
return
result
;
}
/***
*
* Excel转化成PDF
...
...
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