Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
a7dcabc6
o2oa
项目概览
weixin_42566577
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a7dcabc6
编写于
7月 01, 2022
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update swagger
上级
f50fcad0
变更
36
隐藏空白更改
内联
并排
Showing
36 changed file
with
728 addition
and
584 deletion
+728
-584
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompleted.java
...ttachment/ActionBatchDownloadWithWorkOrWorkCompleted.java
+5
-86
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompletedStream.java
...ent/ActionBatchDownloadWithWorkOrWorkCompletedStream.java
+15
-86
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionChangeOrderNumber.java
...ble/surface/jaxrs/attachment/ActionChangeOrderNumber.java
+14
-3
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionChangeSite.java
...m/assemble/surface/jaxrs/attachment/ActionChangeSite.java
+18
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionCopyToWork.java
...m/assemble/surface/jaxrs/attachment/ActionCopyToWork.java
+33
-17
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionCopyToWorkCompleted.java
...e/surface/jaxrs/attachment/ActionCopyToWorkCompleted.java
+24
-18
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDelete.java
...tform/assemble/surface/jaxrs/attachment/ActionDelete.java
+10
-8
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDeleteWithWork.java
...semble/surface/jaxrs/attachment/ActionDeleteWithWork.java
+1
-1
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDeleteWithWorkCompleted.java
...rface/jaxrs/attachment/ActionDeleteWithWorkCompleted.java
+1
-1
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDocToWord.java
...rm/assemble/surface/jaxrs/attachment/ActionDocToWord.java
+2
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDocToWordWorkOrWorkCompleted.java
.../jaxrs/attachment/ActionDocToWordWorkOrWorkCompleted.java
+19
-19
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownload.java
...orm/assemble/surface/jaxrs/attachment/ActionDownload.java
+16
-12
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadStream.java
...semble/surface/jaxrs/attachment/ActionDownloadStream.java
+16
-12
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadTransfer.java
...mble/surface/jaxrs/attachment/ActionDownloadTransfer.java
+2
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadWithWork.java
...mble/surface/jaxrs/attachment/ActionDownloadWithWork.java
+5
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadWithWorkCompleted.java
...ace/jaxrs/attachment/ActionDownloadWithWorkCompleted.java
+5
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadWithWorkCompletedStream.java
...xrs/attachment/ActionDownloadWithWorkCompletedStream.java
+5
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadWithWorkStream.java
...urface/jaxrs/attachment/ActionDownloadWithWorkStream.java
+5
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadWorkInfo.java
...mble/surface/jaxrs/attachment/ActionDownloadWorkInfo.java
+1
-1
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionEdit.java
...latform/assemble/surface/jaxrs/attachment/ActionEdit.java
+2
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionGetWithWorkCompleted.java
.../surface/jaxrs/attachment/ActionGetWithWorkCompleted.java
+5
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionGetWithWorkOrWorkCompleted.java
...ce/jaxrs/attachment/ActionGetWithWorkOrWorkCompleted.java
+5
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionHtmlToImage.java
.../assemble/surface/jaxrs/attachment/ActionHtmlToImage.java
+70
-175
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionHtmlToPdf.java
...rm/assemble/surface/jaxrs/attachment/ActionHtmlToPdf.java
+13
-39
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionListWithJob.java
.../assemble/surface/jaxrs/attachment/ActionListWithJob.java
+6
-2
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionListWithWork.java
...assemble/surface/jaxrs/attachment/ActionListWithWork.java
+21
-7
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionListWithWorkCompleted.java
...surface/jaxrs/attachment/ActionListWithWorkCompleted.java
+10
-5
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionListWithWorkOrWorkCompleted.java
...e/jaxrs/attachment/ActionListWithWorkOrWorkCompleted.java
+17
-5
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionManageBatchDelete.java
...ble/surface/jaxrs/attachment/ActionManageBatchDelete.java
+17
-19
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionManageBatchUpdate.java
...ble/surface/jaxrs/attachment/ActionManageBatchUpdate.java
+18
-10
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionManageBatchUpload.java
...ble/surface/jaxrs/attachment/ActionManageBatchUpload.java
+60
-47
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/BaseBatchDownloadWithWorkOrWorkCompleted.java
.../attachment/BaseBatchDownloadWithWorkOrWorkCompleted.java
+104
-0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/V2AddSplit.java
...ocessplatform/assemble/surface/jaxrs/work/V2AddSplit.java
+0
-3
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/assemble/surface/jaxrs/attachment/ActionHtmlToImageWi.java
...ssemble/surface/jaxrs/attachment/ActionHtmlToImageWi.java
+111
-0
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/assemble/surface/jaxrs/attachment/ActionHtmlToPdfWi.java
.../assemble/surface/jaxrs/attachment/ActionHtmlToPdfWi.java
+47
-0
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/assemble/surface/jaxrs/attachment/ActionManageBatchDeleteWi.java
...e/surface/jaxrs/attachment/ActionManageBatchDeleteWi.java
+25
-0
未找到文件。
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompleted.java
浏览文件 @
a7dcabc6
...
...
@@ -2,37 +2,25 @@ package com.x.processplatform.assemble.surface.jaxrs.attachment;
import
java.io.ByteArrayOutputStream
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.tuple.Pair
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.config.StorageMapping
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.exception.ExceptionEntityExist
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoFile
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.DateTools
;
import
com.x.general.core.entity.GeneralFile
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
io.swagger.v3.oas.annotations.media.Schema
;
class
ActionBatchDownloadWithWorkOrWorkCompleted
extends
Base
Action
{
class
ActionBatchDownloadWithWorkOrWorkCompleted
extends
Base
BatchDownloadWithWorkOrWorkCompleted
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionBatchDownloadWithWorkOrWorkCompleted
.
class
);
...
...
@@ -42,21 +30,10 @@ class ActionBatchDownloadWithWorkOrWorkCompleted extends BaseAction {
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
Work
work
=
emc
.
fetch
(
workId
,
Work
.
class
);
Pair
<
String
,
String
>
pair
=
getTitleAndJob
(
effectivePerson
,
business
,
workId
,
emc
,
work
);
Pair
<
String
,
String
>
pair
=
getTitleAndJob
(
effectivePerson
,
business
,
workId
);
String
title
=
pair
.
getLeft
();
String
job
=
pair
.
getRight
();
List
<
Attachment
>
attachmentList
;
if
(
StringUtils
.
isBlank
(
site
)
||
EMPTY_SYMBOL
.
equals
(
site
))
{
attachmentList
=
business
.
attachment
().
listWithJobObject
(
job
);
}
else
if
(
site
.
indexOf
(
SITE_SEPARATOR
)
==
-
1
)
{
attachmentList
=
emc
.
listEqualAndEqual
(
Attachment
.
class
,
Attachment
.
job_FIELDNAME
,
job
,
Attachment
.
site_FIELDNAME
,
site
);
}
else
{
attachmentList
=
emc
.
listEqualAndIn
(
Attachment
.
class
,
Attachment
.
job_FIELDNAME
,
job
,
Attachment
.
site_FIELDNAME
,
Arrays
.
asList
(
site
.
split
(
SITE_SEPARATOR
)));
}
List
<
Attachment
>
attachmentList
=
listAttachment
(
business
,
site
,
job
);
List
<
String
>
identities
=
business
.
organization
().
identity
().
listWithPerson
(
effectivePerson
);
List
<
String
>
units
=
business
.
organization
().
unit
().
listWithPerson
(
effectivePerson
);
List
<
Attachment
>
readableAttachmentList
=
new
ArrayList
<>();
...
...
@@ -65,78 +42,20 @@ class ActionBatchDownloadWithWorkOrWorkCompleted extends BaseAction {
readableAttachmentList
.
add
(
attachment
);
}
}
if
(
StringUtils
.
isBlank
(
fileName
))
{
if
(
title
.
length
()
>
60
)
{
title
=
title
.
substring
(
0
,
60
);
}
fileName
=
title
+
DateTools
.
format
(
new
Date
(),
DateTools
.
formatCompact_yyyyMMddHHmmss
)
+
".zip"
;
}
else
{
String
extension
=
FilenameUtils
.
getExtension
(
fileName
);
if
(
StringUtils
.
isEmpty
(
extension
))
{
fileName
=
fileName
+
".zip"
;
}
}
fileName
=
adjustFileName
(
fileName
,
title
);
Map
<
String
,
byte
[]>
map
=
new
HashMap
<>();
this
.
assembleFile
(
business
,
map
,
flag
);
fileName
=
StringUtils
.
replaceEach
(
fileName
,
new
String
[]
{
"/"
,
":"
,
"*"
,
"?"
,
"<<"
,
">>"
,
"|"
,
"<"
,
">"
,
"\\"
},
new
String
[]
{
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
});
LOGGER
.
info
(
"batchDown to {},att size {}, from work {}"
,
fileName
,
attachmentList
.
size
(),
workId
);
LOGGER
.
info
(
"batchDown to:{},att size:{}, from work:{}."
,
fileName
,
attachmentList
.
size
(),
workId
);
try
(
ByteArrayOutputStream
os
=
new
ByteArrayOutputStream
())
{
business
.
downToZip
(
readableAttachmentList
,
os
,
map
);
byte
[]
bs
=
os
.
toByteArray
();
Wo
wo
=
new
Wo
(
bs
,
this
.
contentType
(
false
,
fileName
),
this
.
contentDisposition
(
false
,
fileName
));
result
.
setData
(
wo
);
}
return
result
;
}
}
private
Pair
<
String
,
String
>
getTitleAndJob
(
EffectivePerson
effectivePerson
,
Business
business
,
String
workId
,
EntityManagerContainer
emc
,
Work
work
)
throws
Exception
{
if
(
work
!=
null
)
{
if
(!
business
.
readable
(
effectivePerson
,
work
))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
work
);
}
return
Pair
.
of
(
work
.
getTitle
(),
work
.
getJob
());
}
else
{
WorkCompleted
workCompleted
=
emc
.
fetch
(
workId
,
WorkCompleted
.
class
);
if
(
null
==
workCompleted
)
{
throw
new
ExceptionEntityExist
(
workId
);
}
if
(!
business
.
readable
(
effectivePerson
,
workCompleted
))
{
throw
new
ExceptionWorkCompletedAccessDenied
(
effectivePerson
.
getDistinguishedName
(),
workCompleted
.
getTitle
(),
workCompleted
.
getId
());
}
return
Pair
.
of
(
workCompleted
.
getTitle
(),
workCompleted
.
getJob
());
}
}
private
void
assembleFile
(
Business
business
,
Map
<
String
,
byte
[]>
map
,
String
files
)
throws
Exception
{
EntityManagerContainer
emc
=
business
.
entityManagerContainer
();
if
(
StringUtils
.
isNotEmpty
(
files
))
{
String
[]
flagList
=
files
.
split
(
FILE_SEPARATOR
);
for
(
String
flag
:
flagList
)
{
if
(
StringUtils
.
isNotBlank
(
flag
))
{
GeneralFile
generalFile
=
emc
.
find
(
flag
.
trim
(),
GeneralFile
.
class
);
if
(
generalFile
!=
null
)
{
StorageMapping
gfMapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
GeneralFile
.
class
,
generalFile
.
getStorage
());
map
.
put
(
generalFile
.
getName
(),
generalFile
.
readContent
(
gfMapping
));
generalFile
.
deleteContent
(
gfMapping
);
emc
.
beginTransaction
(
GeneralFile
.
class
);
emc
.
delete
(
GeneralFile
.
class
,
generalFile
.
getId
());
emc
.
commit
();
}
}
}
}
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionBatchDownloadWithWorkOrWorkCompleted$Wo"
)
public
static
class
Wo
extends
WoFile
{
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompletedStream.java
浏览文件 @
a7dcabc6
...
...
@@ -2,74 +2,39 @@ package com.x.processplatform.assemble.surface.jaxrs.attachment;
import
java.io.ByteArrayOutputStream
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.tuple.Pair
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.config.StorageMapping
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.exception.ExceptionEntityExist
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoFile
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.DateTools
;
import
com.x.general.core.entity.GeneralFile
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
class
ActionBatchDownloadWithWorkOrWorkCompletedStream
extends
BaseAction
{
import
io.swagger.v3.oas.annotations.media.Schema
;
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionBatchDownloadWithWorkOrWorkCompletedStream
.
class
);
class
ActionBatchDownloadWithWorkOrWorkCompletedStream
extends
BaseBatchDownloadWithWorkOrWorkCompleted
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionBatchDownloadWithWorkOrWorkCompletedStream
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
workId
,
String
site
,
String
fileName
,
String
flag
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
String
title
=
""
;
String
job
=
""
;
Work
work
=
emc
.
find
(
workId
,
Work
.
class
);
if
(
work
==
null
)
{
WorkCompleted
workCompleted
=
emc
.
find
(
workId
,
WorkCompleted
.
class
);
if
(
null
==
workCompleted
)
{
throw
new
ExceptionEntityExist
(
workId
);
}
if
(!
business
.
readable
(
effectivePerson
,
workCompleted
))
{
throw
new
ExceptionWorkCompletedAccessDenied
(
effectivePerson
.
getDistinguishedName
(),
workCompleted
.
getTitle
(),
workCompleted
.
getId
());
}
title
=
workCompleted
.
getTitle
();
job
=
workCompleted
.
getJob
();
}
else
{
if
(!
business
.
readable
(
effectivePerson
,
work
))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
work
);
}
title
=
work
.
getTitle
();
job
=
work
.
getJob
();
}
List
<
Attachment
>
attachmentList
;
if
(
StringUtils
.
isBlank
(
site
)
||
EMPTY_SYMBOL
.
equals
(
site
))
{
attachmentList
=
business
.
attachment
().
listWithJobObject
(
job
);
}
else
if
(
site
.
indexOf
(
SITE_SEPARATOR
)
==
-
1
)
{
attachmentList
=
emc
.
listEqualAndEqual
(
Attachment
.
class
,
Attachment
.
job_FIELDNAME
,
job
,
Attachment
.
site_FIELDNAME
,
site
);
}
else
{
attachmentList
=
emc
.
listEqualAndIn
(
Attachment
.
class
,
Attachment
.
job_FIELDNAME
,
job
,
Attachment
.
site_FIELDNAME
,
Arrays
.
asList
(
site
.
split
(
SITE_SEPARATOR
)));
}
Pair
<
String
,
String
>
pair
=
getTitleAndJob
(
effectivePerson
,
business
,
workId
);
String
title
=
pair
.
getLeft
();
String
job
=
pair
.
getRight
();
List
<
Attachment
>
attachmentList
=
listAttachment
(
business
,
site
,
job
);
List
<
String
>
identities
=
business
.
organization
().
identity
().
listWithPerson
(
effectivePerson
);
List
<
String
>
units
=
business
.
organization
().
unit
().
listWithPerson
(
effectivePerson
);
List
<
Attachment
>
readableAttachmentList
=
new
ArrayList
<>();
...
...
@@ -78,61 +43,25 @@ class ActionBatchDownloadWithWorkOrWorkCompletedStream extends BaseAction {
readableAttachmentList
.
add
(
attachment
);
}
}
if
(
StringUtils
.
isBlank
(
fileName
))
{
if
(
title
.
length
()
>
60
)
{
title
=
title
.
substring
(
0
,
60
);
}
fileName
=
title
+
DateTools
.
format
(
new
Date
(),
DateTools
.
formatCompact_yyyyMMddHHmmss
)
+
".zip"
;
}
else
{
String
extension
=
FilenameUtils
.
getExtension
(
fileName
);
if
(
StringUtils
.
isEmpty
(
extension
))
{
fileName
=
fileName
+
".zip"
;
}
}
fileName
=
adjustFileName
(
fileName
,
title
);
Map
<
String
,
byte
[]>
map
=
new
HashMap
<>();
this
.
assembleFile
(
business
,
map
,
flag
);
fileName
=
StringUtils
.
replaceEach
(
fileName
,
new
String
[]
{
"/"
,
":"
,
"*"
,
"?"
,
"<<"
,
">>"
,
"|"
,
"<"
,
">"
,
"\\"
},
new
String
[]
{
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
});
logger
.
info
(
"batchDown to {},att size {}, from work {}, has form {}"
,
fileName
,
attachmentList
.
size
(),
workId
,
map
.
size
());
LOGGER
.
info
(
"batchDown to:{},att size:{}, from work:{}."
,
fileName
,
attachmentList
.
size
(),
workId
);
try
(
ByteArrayOutputStream
os
=
new
ByteArrayOutputStream
())
{
business
.
downToZip
(
readableAttachmentList
,
os
,
map
);
byte
[]
bs
=
os
.
toByteArray
();
Wo
wo
=
new
Wo
(
bs
,
this
.
contentType
(
true
,
fileName
),
this
.
contentDisposition
(
true
,
fileName
));
result
.
setData
(
wo
);
}
return
result
;
}
}
private
void
assembleFile
(
Business
business
,
Map
<
String
,
byte
[]>
map
,
String
files
)
throws
Exception
{
EntityManagerContainer
emc
=
business
.
entityManagerContainer
();
if
(
StringUtils
.
isNotEmpty
(
files
))
{
String
[]
flagList
=
files
.
split
(
FILE_SEPARATOR
);
for
(
String
flag
:
flagList
)
{
if
(
StringUtils
.
isNotBlank
(
flag
))
{
GeneralFile
generalFile
=
emc
.
find
(
flag
.
trim
(),
GeneralFile
.
class
);
if
(
generalFile
!=
null
)
{
StorageMapping
gfMapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
GeneralFile
.
class
,
generalFile
.
getStorage
());
map
.
put
(
generalFile
.
getName
(),
generalFile
.
readContent
(
gfMapping
));
generalFile
.
deleteContent
(
gfMapping
);
emc
.
beginTransaction
(
GeneralFile
.
class
);
emc
.
delete
(
GeneralFile
.
class
,
generalFile
.
getId
());
emc
.
commit
();
}
}
}
}
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionBatchDownloadWithWorkOrWorkCompletedStream$Wo"
)
public
static
class
Wo
extends
WoFile
{
private
static
final
long
serialVersionUID
=
-
1047290780533623494L
;
public
Wo
(
byte
[]
bytes
,
String
contentType
,
String
contentDisposition
)
{
super
(
bytes
,
contentType
,
contentDisposition
);
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionChangeOrderNumber.java
浏览文件 @
a7dcabc6
...
...
@@ -16,12 +16,18 @@ import com.x.processplatform.assemble.surface.Business;
import
com.x.processplatform.assemble.surface.WorkControl
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
io.swagger.v3.oas.annotations.media.Schema
;
class
ActionChangeOrderNumber
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionChangeOrderNumber
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionChangeOrderNumber
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
workId
,
Integer
order
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, id:{}, workId:{}, order:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
,
()
->
workId
,
()
->
order
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
...
...
@@ -34,8 +40,7 @@ class ActionChangeOrderNumber extends BaseAction {
}
List
<
String
>
identities
=
business
.
organization
().
identity
().
listWithPerson
(
effectivePerson
);
List
<
String
>
units
=
business
.
organization
().
unit
().
listWithPerson
(
effectivePerson
);
boolean
canEdit
=
this
.
edit
(
attachment
,
effectivePerson
,
identities
,
units
,
business
);
if
(!
canEdit
)
{
if
(!
this
.
edit
(
attachment
,
effectivePerson
,
identities
,
units
,
business
))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
attachment
);
}
emc
.
beginTransaction
(
Attachment
.
class
);
...
...
@@ -49,12 +54,18 @@ class ActionChangeOrderNumber extends BaseAction {
}
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionChangeOrderNumber$Wo"
)
public
static
class
Wo
extends
WoId
{
private
static
final
long
serialVersionUID
=
7781650524928249364L
;
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionChangeOrderNumber$WoControl"
)
public
static
class
WoControl
extends
WorkControl
{
private
static
final
long
serialVersionUID
=
3944420696392981012L
;
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionChangeSite.java
浏览文件 @
a7dcabc6
...
...
@@ -9,12 +9,23 @@ import com.x.base.core.project.exception.ExceptionEntityNotExist;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoId
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.WorkControl
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
io.swagger.v3.oas.annotations.media.Schema
;
class
ActionChangeSite
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionChangeSite
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
workId
,
String
site
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, id:{}, workId:{}, site:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
id
,
()
->
workId
,
()
->
site
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
...
...
@@ -29,8 +40,7 @@ class ActionChangeSite extends BaseAction {
List
<
String
>
identities
=
business
.
organization
().
identity
().
listWithPerson
(
effectivePerson
);
List
<
String
>
units
=
business
.
organization
().
unit
().
listWithPerson
(
effectivePerson
);
boolean
canEdit
=
this
.
edit
(
attachment
,
effectivePerson
,
identities
,
units
,
business
);
if
(!
canEdit
)
{
if
(!
this
.
edit
(
attachment
,
effectivePerson
,
identities
,
units
,
business
))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
attachment
);
}
emc
.
beginTransaction
(
Attachment
.
class
);
...
...
@@ -43,10 +53,16 @@ class ActionChangeSite extends BaseAction {
}
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionChangeSite$Wo"
)
public
static
class
Wo
extends
WoId
{
private
static
final
long
serialVersionUID
=
3334070435843444140L
;
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionChangeSite$WoControl"
)
public
static
class
WoControl
extends
WorkControl
{
private
static
final
long
serialVersionUID
=
-
5809705124632651361L
;
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionCopyToWork.java
浏览文件 @
a7dcabc6
...
...
@@ -26,6 +26,8 @@ import com.x.processplatform.assemble.surface.WorkControl;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.Work
;
import
io.swagger.v3.oas.annotations.media.Schema
;
class
ActionCopyToWork
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionCopyToWork
.
class
);
...
...
@@ -85,11 +87,13 @@ class ActionCopyToWork extends BaseAction {
return
result
;
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionCopyToWork$Wi"
)
public
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
4382689061793305054L
;
@FieldDescribe
(
"附件对象"
)
@FieldDescribe
(
"附件对象."
)
@Schema
(
description
=
"附件对象."
)
private
List
<
WiAttachment
>
attachmentList
=
new
ArrayList
<>();
public
List
<
WiAttachment
>
getAttachmentList
()
{
...
...
@@ -102,27 +106,21 @@ class ActionCopyToWork extends BaseAction {
}
public
static
class
Req
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
4048752456611022400L
;
List
<
ReqAttachment
>
attachmentList
=
new
ArrayList
<>();
public
List
<
ReqAttachment
>
getAttachmentList
()
{
return
attachmentList
;
}
public
void
setAttachmentList
(
List
<
ReqAttachment
>
attachmentList
)
{
this
.
attachmentList
=
attachmentList
;
}
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionCopyToWork$Wi"
)
public
static
class
WiAttachment
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
6570042412000311813L
;
@FieldDescribe
(
"附件标识."
)
@Schema
(
description
=
"附件标识."
)
private
String
id
;
@FieldDescribe
(
"附件名称."
)
@Schema
(
description
=
"附件名称."
)
private
String
name
;
@FieldDescribe
(
"附件分类."
)
@Schema
(
description
=
"附件分类."
)
private
String
site
;
public
String
getId
()
{
...
...
@@ -151,14 +149,32 @@ class ActionCopyToWork extends BaseAction {
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionCopyToWork$Wo"
)
public
static
class
Wo
extends
WoId
{
private
static
final
long
serialVersionUID
=
-
5986602289699981815L
;
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionCopyToWork$WoWorkControl"
)
public
static
class
WoWorkControl
extends
WorkControl
{
private
static
final
long
serialVersionUID
=
-
7984236444647769198L
;
}
public
static
class
Req
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
4048752456611022400L
;
List
<
ReqAttachment
>
attachmentList
=
new
ArrayList
<>();
public
List
<
ReqAttachment
>
getAttachmentList
()
{
return
attachmentList
;
}
public
void
setAttachmentList
(
List
<
ReqAttachment
>
attachmentList
)
{
this
.
attachmentList
=
attachmentList
;
}
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionCopyToWorkCompleted.java
浏览文件 @
a7dcabc6
...
...
@@ -26,6 +26,8 @@ import com.x.processplatform.assemble.surface.WorkControl;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
import
io.swagger.v3.oas.annotations.media.Schema
;
class
ActionCopyToWorkCompleted
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionCopyToWorkCompleted
.
class
);
...
...
@@ -84,10 +86,11 @@ class ActionCopyToWorkCompleted extends BaseAction {
return
result
;
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionCopyToWorkCompleted$Wi"
)
public
static
class
Wi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
455300115594765428L
;
@FieldDescribe
(
"附件对象"
)
private
List
<
WiAttachment
>
attachmentList
=
new
ArrayList
<>();
...
...
@@ -101,26 +104,11 @@ class ActionCopyToWorkCompleted extends BaseAction {
}
public
static
class
Req
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
3546487034950391385L
;
List
<
ReqAttachment
>
attachmentList
=
new
ArrayList
<>();
public
List
<
ReqAttachment
>
getAttachmentList
()
{
return
attachmentList
;
}
public
void
setAttachmentList
(
List
<
ReqAttachment
>
attachmentList
)
{
this
.
attachmentList
=
attachmentList
;
}
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionCopyToWorkCompleted$WiAttachment"
)
public
static
class
WiAttachment
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
308348301935328134L
;
private
String
id
;
private
String
name
;
private
String
site
;
...
...
@@ -151,14 +139,32 @@ class ActionCopyToWorkCompleted extends BaseAction {
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionCopyToWorkCompleted$Wo"
)
public
static
class
Wo
extends
WoId
{
private
static
final
long
serialVersionUID
=
6235554869680662821L
;
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionCopyToWorkCompleted$WoWorkControl"
)
public
static
class
WoWorkControl
extends
WorkControl
{
private
static
final
long
serialVersionUID
=
-
6269570358898022654L
;
}
public
static
class
Req
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
3546487034950391385L
;
List
<
ReqAttachment
>
attachmentList
=
new
ArrayList
<>();
public
List
<
ReqAttachment
>
getAttachmentList
()
{
return
attachmentList
;
}
public
void
setAttachmentList
(
List
<
ReqAttachment
>
attachmentList
)
{
this
.
attachmentList
=
attachmentList
;
}
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDelete.java
浏览文件 @
a7dcabc6
package
com.x.processplatform.assemble.surface.jaxrs.attachment
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.Applications
;
...
...
@@ -18,7 +20,7 @@ import com.x.processplatform.core.entity.content.Attachment;
class
ActionDelete
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionDelete
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDelete
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
...
...
@@ -29,18 +31,18 @@ class ActionDelete extends BaseAction {
if
(
null
==
attachment
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Attachment
.
class
);
}
Long
taskCount
=
business
.
task
().
countWithPersonWithJob
(
effectivePerson
.
getDistinguishedName
(),
attachment
.
getJob
());
if
(
taskCount
<
0
&&
!
business
.
canManageApplicationOrProcess
(
effectivePerson
,
attachment
.
getApplication
(),
attachment
.
getProcess
()))
{
Long
taskCount
=
business
.
task
().
countWithPersonWithJob
(
effectivePerson
.
getDistinguishedName
(),
attachment
.
getJob
());
if
(
taskCount
<
0
&&
BooleanUtils
.
isFalse
(
business
.
canManageApplicationOrProcess
(
effectivePerson
,
attachment
.
getApplication
(),
attachment
.
getProcess
())))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
}
Wo
wo
=
ThisApplication
.
context
().
applications
()
.
deleteQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"attachment"
,
attachment
.
getId
()))
Wo
wo
=
ThisApplication
.
context
().
applications
().
deleteQuery
(
effectivePerson
.
getDebugger
(),
x_processplatform_service_processing
.
class
,
Applications
.
joinQueryUri
(
"attachment"
,
attachment
.
getId
()))
.
getData
(
Wo
.
class
);
wo
.
setId
(
attachment
.
getId
());
logger
.
info
(
"{}操作删除附件:{}{}"
,
effectivePerson
.
getDistinguishedName
(),
id
,
attachment
.
getName
());
LOGGER
.
info
(
"id: {}, name: {}."
,
id
,
attachment
.
getName
());
result
.
setData
(
wo
);
return
result
;
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDeleteWithWork.java
浏览文件 @
a7dcabc6
...
...
@@ -21,7 +21,7 @@ import com.x.processplatform.core.entity.content.Work;
class
ActionDeleteWithWork
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionDeleteWithWork
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDeleteWithWork
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
workId
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDeleteWithWorkCompleted.java
浏览文件 @
a7dcabc6
...
...
@@ -19,7 +19,7 @@ import com.x.processplatform.core.entity.content.WorkCompleted;
class
ActionDeleteWithWorkCompleted
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionDeleteWithWorkCompleted
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDeleteWithWorkCompleted
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
workCompletedId
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDocToWord.java
浏览文件 @
a7dcabc6
...
...
@@ -36,7 +36,7 @@ import com.x.processplatform.core.entity.content.Work;
class
ActionDocToWord
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionDocToWord
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDocToWord
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
workId
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
...
...
@@ -46,7 +46,7 @@ class ActionDocToWord extends BaseAction {
String
decodedContent
=
URLDecoder
.
decode
(
wi
.
getContent
(),
StandardCharsets
.
UTF_8
.
name
());
wi
.
setContent
(
decodedContent
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
LOGGER
.
error
(
e
);
}
}
Work
work
=
null
;
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDocToWordWorkOrWorkCompleted.java
浏览文件 @
a7dcabc6
...
...
@@ -42,18 +42,18 @@ import com.x.processplatform.core.entity.content.WorkCompleted;
class
ActionDocToWordWorkOrWorkCompleted
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionDocToWordWorkOrWorkCompleted
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDocToWordWorkOrWorkCompleted
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
workOrWorkCompleted
,
JsonElement
jsonElement
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
if
(
StringUtils
.
isNotBlank
(
wi
.
getContent
()))
{
if
(
StringUtils
.
isNotBlank
(
wi
.
getContent
()))
{
try
{
String
decodedContent
=
URLDecoder
.
decode
(
wi
.
getContent
(),
StandardCharsets
.
UTF_8
.
name
());
wi
.
setContent
(
decodedContent
);
}
catch
(
Exception
e
)
{
logger
.
warn
(
"docContent URLDecoder error:"
+
e
.
getMessage
());
LOGGER
.
warn
(
"docContent URLDecoder error:"
+
e
.
getMessage
());
}
}
Work
work
=
null
;
...
...
@@ -88,12 +88,12 @@ class ActionDocToWordWorkOrWorkCompleted extends BaseAction {
String
activity
,
String
job
)
throws
Exception
{
byte
[]
bytes
=
null
;
Optional
<
WorkExtensionEvent
>
event
;
if
(
wi
.
getFileName
().
toLowerCase
().
endsWith
(
OFD_ATT_KEY
))
{
event
=
Config
.
processPlatform
().
getExtensionEvents
().
getWorkDocToOfdEvents
()
.
bind
(
application
,
process
,
activity
);
}
else
{
event
=
Config
.
processPlatform
().
getExtensionEvents
().
getWorkDocToWordEvents
()
.
bind
(
application
,
process
,
activity
);
if
(
wi
.
getFileName
().
toLowerCase
().
endsWith
(
OFD_ATT_KEY
))
{
event
=
Config
.
processPlatform
().
getExtensionEvents
().
getWorkDocToOfdEvents
()
.
bind
(
application
,
process
,
activity
);
}
else
{
event
=
Config
.
processPlatform
().
getExtensionEvents
().
getWorkDocToWordEvents
()
.
bind
(
application
,
process
,
activity
);
}
if
(
event
.
isPresent
())
{
bytes
=
this
.
workExtensionService
(
effectivePerson
,
wi
.
getContent
(),
event
.
get
(),
job
);
...
...
@@ -107,8 +107,8 @@ class ActionDocToWordWorkOrWorkCompleted extends BaseAction {
return
bytes
;
}
private
byte
[]
workExtensionService
(
EffectivePerson
effectivePerson
,
String
content
,
WorkExtensionEvent
event
,
String
job
)
throws
Exception
{
private
byte
[]
workExtensionService
(
EffectivePerson
effectivePerson
,
String
content
,
WorkExtensionEvent
event
,
String
job
)
throws
Exception
{
byte
[]
bytes
=
null
;
Req
req
=
new
Req
();
req
.
setContent
(
content
);
...
...
@@ -122,16 +122,16 @@ class ActionDocToWordWorkOrWorkCompleted extends BaseAction {
return
bytes
;
}
private
byte
[]
workCompletedConvert
(
EffectivePerson
effectivePerson
,
Wi
wi
,
String
application
,
String
process
,
String
job
)
throws
Exception
{
private
byte
[]
workCompletedConvert
(
EffectivePerson
effectivePerson
,
Wi
wi
,
String
application
,
String
process
,
String
job
)
throws
Exception
{
byte
[]
bytes
=
null
;
Optional
<
WorkCompletedExtensionEvent
>
event
;
if
(
wi
.
getFileName
().
toLowerCase
().
endsWith
(
OFD_ATT_KEY
))
{
event
=
Config
.
processPlatform
().
getExtensionEvents
()
.
getWorkCompletedDocToOfdEvents
().
bind
(
application
,
process
);
}
else
{
event
=
Config
.
processPlatform
().
getExtensionEvents
()
.
getWorkCompletedDocToWordEvents
().
bind
(
application
,
process
);
if
(
wi
.
getFileName
().
toLowerCase
().
endsWith
(
OFD_ATT_KEY
))
{
event
=
Config
.
processPlatform
().
getExtensionEvents
()
.
getWorkCompletedDocToOfdEvents
().
bind
(
application
,
process
);
}
else
{
event
=
Config
.
processPlatform
().
getExtensionEvents
()
.
getWorkCompletedDocToWordEvents
().
bind
(
application
,
process
);
}
if
(
event
.
isPresent
())
{
bytes
=
this
.
workCompletedExtensionService
(
effectivePerson
,
wi
.
getContent
(),
event
.
get
(),
job
);
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownload.java
浏览文件 @
a7dcabc6
...
...
@@ -18,6 +18,8 @@ import com.x.base.core.project.exception.ExceptionEntityNotExist;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoFile
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
...
...
@@ -27,8 +29,10 @@ import com.x.processplatform.core.entity.content.Work;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
class
ActionDownload
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
fileName
)
throws
Exception
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDownload
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
fileName
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Work
work
=
null
;
...
...
@@ -41,13 +45,12 @@ class ActionDownload extends BaseAction {
if
(
null
==
attachment
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Attachment
.
class
);
}
if
(!
business
.
readableWithJob
(
effectivePerson
,
attachment
.
getJob
()))
{
if
(!
business
.
readableWithJob
(
effectivePerson
,
attachment
.
getJob
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
id
);
}
if
(
Config
.
processPlatform
().
getExtensionEvents
()
.
getWorkAttachmentDownloadEvents
().
size
()>
0
||
Config
.
processPlatform
().
getExtensionEvents
()
.
getWorkCompletedAttachmentDownloadEvents
().
size
()
>
0
)
{
if
(
Config
.
processPlatform
().
getExtensionEvents
().
getWorkAttachmentDownloadEvents
().
size
()
>
0
||
Config
.
processPlatform
().
getExtensionEvents
().
getWorkCompletedAttachmentDownloadEvents
().
size
()
>
0
)
{
List
<
Work
>
workList
=
business
.
work
().
listWithJobObject
(
attachment
.
getJob
());
if
(
ListTools
.
isEmpty
(
workList
))
{
List
<
WorkCompleted
>
list
=
business
.
workCompleted
().
listWithJobObject
(
attachment
.
getJob
());
...
...
@@ -70,13 +73,14 @@ class ActionDownload extends BaseAction {
}
}
byte
[]
bytes
=
null
;
if
(
work
!=
null
)
{
if
(
work
!=
null
)
{
Optional
<
WorkExtensionEvent
>
event
=
Config
.
processPlatform
().
getExtensionEvents
()
.
getWorkAttachmentDownloadEvents
().
bind
(
work
.
getApplication
(),
work
.
getProcess
(),
work
.
getActivity
());
.
getWorkAttachmentDownloadEvents
()
.
bind
(
work
.
getApplication
(),
work
.
getProcess
(),
work
.
getActivity
());
if
(
event
.
isPresent
())
{
bytes
=
this
.
extensionService
(
effectivePerson
,
attachment
.
getId
(),
event
.
get
());
}
}
else
if
(
workCompleted
!=
null
)
{
}
else
if
(
workCompleted
!=
null
)
{
Optional
<
ProcessPlatform
.
WorkCompletedExtensionEvent
>
event
=
Config
.
processPlatform
().
getExtensionEvents
()
.
getWorkCompletedAttachmentDownloadEvents
()
.
bind
(
workCompleted
.
getApplication
(),
workCompleted
.
getProcess
());
...
...
@@ -84,7 +88,7 @@ class ActionDownload extends BaseAction {
bytes
=
this
.
extensionService
(
effectivePerson
,
attachment
.
getId
(),
event
.
get
());
}
}
if
(
bytes
==
null
)
{
if
(
bytes
==
null
)
{
bytes
=
attachment
.
readContent
(
mapping
);
}
Wo
wo
=
new
Wo
(
bytes
,
this
.
contentType
(
false
,
fileName
),
this
.
contentDisposition
(
false
,
fileName
));
...
...
@@ -106,8 +110,8 @@ class ActionDownload extends BaseAction {
return
bytes
;
}
private
byte
[]
extensionService
(
EffectivePerson
effectivePerson
,
String
id
,
ProcessPlatform
.
WorkCompletedExtensionEvent
event
)
throws
Exception
{
private
byte
[]
extensionService
(
EffectivePerson
effectivePerson
,
String
id
,
ProcessPlatform
.
WorkCompletedExtensionEvent
event
)
throws
Exception
{
byte
[]
bytes
=
null
;
Req
req
=
new
Req
();
req
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadStream.java
浏览文件 @
a7dcabc6
...
...
@@ -18,6 +18,8 @@ import com.x.base.core.project.exception.ExceptionEntityNotExist;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoFile
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
...
...
@@ -27,8 +29,10 @@ import com.x.processplatform.core.entity.content.Work;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
class
ActionDownloadStream
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
fileName
)
throws
Exception
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDownloadStream
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
fileName
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Work
work
=
null
;
...
...
@@ -41,13 +45,12 @@ class ActionDownloadStream extends BaseAction {
if
(
null
==
attachment
)
{
throw
new
ExceptionEntityNotExist
(
id
,
Attachment
.
class
);
}
if
(!
business
.
readableWithJob
(
effectivePerson
,
attachment
.
getJob
()))
{
if
(!
business
.
readableWithJob
(
effectivePerson
,
attachment
.
getJob
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
id
);
}
if
(
Config
.
processPlatform
().
getExtensionEvents
()
.
getWorkAttachmentDownloadEvents
().
size
()>
0
||
Config
.
processPlatform
().
getExtensionEvents
()
.
getWorkCompletedAttachmentDownloadEvents
().
size
()
>
0
)
{
if
(
Config
.
processPlatform
().
getExtensionEvents
().
getWorkAttachmentDownloadEvents
().
size
()
>
0
||
Config
.
processPlatform
().
getExtensionEvents
().
getWorkCompletedAttachmentDownloadEvents
().
size
()
>
0
)
{
List
<
Work
>
workList
=
business
.
work
().
listWithJobObject
(
attachment
.
getJob
());
if
(
ListTools
.
isEmpty
(
workList
))
{
List
<
WorkCompleted
>
list
=
business
.
workCompleted
().
listWithJobObject
(
attachment
.
getJob
());
...
...
@@ -70,13 +73,14 @@ class ActionDownloadStream extends BaseAction {
}
}
byte
[]
bytes
=
null
;
if
(
work
!=
null
)
{
if
(
work
!=
null
)
{
Optional
<
WorkExtensionEvent
>
event
=
Config
.
processPlatform
().
getExtensionEvents
()
.
getWorkAttachmentDownloadEvents
().
bind
(
work
.
getApplication
(),
work
.
getProcess
(),
work
.
getActivity
());
.
getWorkAttachmentDownloadEvents
()
.
bind
(
work
.
getApplication
(),
work
.
getProcess
(),
work
.
getActivity
());
if
(
event
.
isPresent
())
{
bytes
=
this
.
extensionService
(
effectivePerson
,
attachment
.
getId
(),
event
.
get
());
}
}
else
if
(
workCompleted
!=
null
)
{
}
else
if
(
workCompleted
!=
null
)
{
Optional
<
ProcessPlatform
.
WorkCompletedExtensionEvent
>
event
=
Config
.
processPlatform
().
getExtensionEvents
()
.
getWorkCompletedAttachmentDownloadEvents
()
.
bind
(
workCompleted
.
getApplication
(),
workCompleted
.
getProcess
());
...
...
@@ -84,7 +88,7 @@ class ActionDownloadStream extends BaseAction {
bytes
=
this
.
extensionService
(
effectivePerson
,
attachment
.
getId
(),
event
.
get
());
}
}
if
(
bytes
==
null
)
{
if
(
bytes
==
null
)
{
bytes
=
attachment
.
readContent
(
mapping
);
}
Wo
wo
=
new
Wo
(
bytes
,
this
.
contentType
(
true
,
fileName
),
this
.
contentDisposition
(
true
,
fileName
));
...
...
@@ -106,8 +110,8 @@ class ActionDownloadStream extends BaseAction {
return
bytes
;
}
private
byte
[]
extensionService
(
EffectivePerson
effectivePerson
,
String
id
,
ProcessPlatform
.
WorkCompletedExtensionEvent
event
)
throws
Exception
{
private
byte
[]
extensionService
(
EffectivePerson
effectivePerson
,
String
id
,
ProcessPlatform
.
WorkCompletedExtensionEvent
event
)
throws
Exception
{
byte
[]
bytes
=
null
;
Req
req
=
new
Req
();
req
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadTransfer.java
浏览文件 @
a7dcabc6
...
...
@@ -13,7 +13,7 @@ import com.x.processplatform.assemble.surface.ThisApplication;
class
ActionDownloadTransfer
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionDownloadTransfer
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDownloadTransfer
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
flag
,
boolean
stream
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
...
...
@@ -21,7 +21,7 @@ class ActionDownloadTransfer extends BaseAction {
Wo
wo
=
null
;
GeneralFile
generalFile
=
emc
.
find
(
flag
,
GeneralFile
.
class
);
if
(
generalFile
!=
null
)
{
if
(
generalFile
!=
null
)
{
StorageMapping
gfMapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
GeneralFile
.
class
,
generalFile
.
getStorage
());
wo
=
new
Wo
(
generalFile
.
readContent
(
gfMapping
),
this
.
contentType
(
stream
,
generalFile
.
getName
()),
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadWithWork.java
浏览文件 @
a7dcabc6
...
...
@@ -17,6 +17,8 @@ import com.x.base.core.project.exception.ExceptionEntityNotExist;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoFile
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.WorkControl
;
...
...
@@ -24,6 +26,9 @@ import com.x.processplatform.core.entity.content.Attachment;
import
com.x.processplatform.core.entity.content.Work
;
class
ActionDownloadWithWork
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDownloadWithWork
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
workId
,
String
fileName
)
throws
Exception
{
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadWithWorkCompleted.java
浏览文件 @
a7dcabc6
...
...
@@ -17,6 +17,8 @@ import com.x.base.core.project.exception.ExceptionEntityNotExist;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoFile
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.WorkCompletedControl
;
...
...
@@ -24,6 +26,9 @@ import com.x.processplatform.core.entity.content.Attachment;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
class
ActionDownloadWithWorkCompleted
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDownloadWithWorkCompleted
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
workCompletedId
,
String
fileName
)
throws
Exception
{
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadWithWorkCompletedStream.java
浏览文件 @
a7dcabc6
...
...
@@ -17,6 +17,8 @@ import com.x.base.core.project.exception.ExceptionEntityNotExist;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoFile
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.WorkCompletedControl
;
...
...
@@ -24,6 +26,9 @@ import com.x.processplatform.core.entity.content.Attachment;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
class
ActionDownloadWithWorkCompletedStream
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDownloadWithWorkCompletedStream
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
workCompletedId
,
String
fileName
)
throws
Exception
{
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadWithWorkStream.java
浏览文件 @
a7dcabc6
...
...
@@ -17,6 +17,8 @@ import com.x.base.core.project.exception.ExceptionEntityNotExist;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoFile
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.assemble.surface.WorkControl
;
...
...
@@ -24,6 +26,9 @@ import com.x.processplatform.core.entity.content.Attachment;
import
com.x.processplatform.core.entity.content.Work
;
class
ActionDownloadWithWorkStream
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDownloadWithWorkStream
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
workId
,
String
fileName
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionDownloadWorkInfo.java
浏览文件 @
a7dcabc6
...
...
@@ -17,7 +17,7 @@ import com.x.processplatform.core.entity.content.WorkCompleted;
class
ActionDownloadWorkInfo
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionDownloadWorkInfo
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionDownloadWorkInfo
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
workId
,
String
flag
,
boolean
stream
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionEdit.java
浏览文件 @
a7dcabc6
...
...
@@ -25,7 +25,7 @@ import com.x.processplatform.core.entity.content.Work;
class
ActionEdit
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionEdit
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionEdit
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
workId
,
JsonElement
jsonElement
)
throws
Exception
{
...
...
@@ -53,7 +53,7 @@ class ActionEdit extends BaseAction {
List
<
String
>
identities
=
business
.
organization
().
identity
().
listWithPerson
(
effectivePerson
);
List
<
String
>
units
=
business
.
organization
().
unit
().
listWithPerson
(
effectivePerson
);
boolean
canControl
=
this
.
control
(
attachment
,
effectivePerson
,
identities
,
units
,
business
);
if
(!
canControl
)
{
if
(!
canControl
)
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
attachment
);
}
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionGetWithWorkCompleted.java
浏览文件 @
a7dcabc6
...
...
@@ -12,12 +12,17 @@ import com.x.base.core.project.exception.ExceptionEntityNotExist;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
class
ActionGetWithWorkCompleted
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionEdit
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
workCompletedId
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionGetWithWorkOrWorkCompleted.java
浏览文件 @
a7dcabc6
...
...
@@ -12,11 +12,16 @@ import com.x.base.core.project.exception.ExceptionEntityNotExist;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.core.entity.content.Attachment
;
class
ActionGetWithWorkOrWorkCompleted
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionGetWithWorkOrWorkCompleted
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
id
,
String
workId
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionHtmlToImage.java
浏览文件 @
a7dcabc6
package
com.x.processplatform.assemble.surface.jaxrs.attachment
;
import
java.io.File
;
import
java.nio.file.Paths
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -20,12 +19,10 @@ import com.microsoft.playwright.Playwright;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.config.StorageMapping
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoId
;
...
...
@@ -39,12 +36,18 @@ import com.x.processplatform.assemble.surface.ThisApplication;
import
com.x.processplatform.assemble.surface.WorkControl
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.express.assemble.surface.jaxrs.attachment.ActionHtmlToImageWi
;
import
io.swagger.v3.oas.annotations.media.Schema
;
class
ActionHtmlToImage
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionEdit
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionHtmlToImage
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}."
,
effectivePerson:
:
getDistinguishedName
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
...
...
@@ -57,21 +60,24 @@ class ActionHtmlToImage extends BaseAction {
}
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionHtmlToImage$Wo"
)
public
static
class
Wo
extends
WoId
{
private
static
final
long
serialVersionUID
=
-
7747581377738836294L
;
}
private
String
saveImage
(
Wi
wi
,
EffectivePerson
effectivePerson
,
Business
business
)
throws
Exception
{
private
String
saveImage
(
Wi
wi
,
EffectivePerson
effectivePerson
,
Business
business
)
throws
Exception
{
Work
work
=
null
;
EntityManagerContainer
emc
=
business
.
entityManagerContainer
();
if
(
StringUtils
.
isNotBlank
(
wi
.
getWorkId
()))
{
/
* 后面要重新保存 */
if
(
StringUtils
.
isNotBlank
(
wi
.
getWorkId
()))
{
/
/ 后面要重新保存
work
=
emc
.
find
(
wi
.
getWorkId
(),
Work
.
class
);
/
* 判断work是否存在 */
/
/ 判断work是否存在
if
(
null
==
work
)
{
throw
new
ExceptionEntityNotExist
(
wi
.
getWorkId
(),
Work
.
class
);
}
WoControl
control
=
business
.
getControl
(
effectivePerson
,
work
,
Wo
Control
.
class
);
Control
control
=
business
.
getControl
(
effectivePerson
,
work
,
Control
.
class
);
if
(
BooleanUtils
.
isNotTrue
(
control
.
getAllowSave
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
work
);
}
...
...
@@ -82,35 +88,65 @@ class ActionHtmlToImage extends BaseAction {
workHtml
=
"无内容"
;
}
if
(
workHtml
.
toLowerCase
().
indexOf
(
"<html"
)
==
-
1
)
{
workHtml
=
"<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head>"
+
"<body>"
+
workHtml
+
"</body></html>"
;
workHtml
=
"<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head>"
+
"<body>"
+
workHtml
+
"</body></html>"
;
}
String
name
=
StringUtils
.
split
(
effectivePerson
.
getDistinguishedName
(),
"@"
)[
0
]
+
DateTools
.
compact
(
new
Date
())
+
".png"
;
String
name
=
StringUtils
.
split
(
effectivePerson
.
getDistinguishedName
(),
"@"
)[
0
]
+
DateTools
.
compact
(
new
Date
())
+
".png"
;
if
(
StringUtils
.
isNotEmpty
(
wi
.
getTitle
()))
{
name
=
wi
.
getTitle
()
+
".png"
;
}
byte
[]
bytes
=
playWright
(
wi
,
workHtml
,
name
);
if
(
bytes
==
null
)
{
LOGGER
.
warn
(
"Playwright screenshot fail!!!"
);
return
""
;
}
String
key
=
""
;
if
(
work
!=
null
)
{
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
random
(
Attachment
.
class
);
Attachment
attachment
=
this
.
concreteAttachment
(
work
,
effectivePerson
,
wi
.
getSite
());
attachment
.
saveContent
(
mapping
,
bytes
,
name
);
attachment
.
setType
((
new
Tika
()).
detect
(
bytes
,
name
));
emc
.
beginTransaction
(
Attachment
.
class
);
emc
.
persist
(
attachment
,
CheckPersistType
.
all
);
emc
.
commit
();
key
=
attachment
.
getId
();
}
else
{
StorageMapping
gfMapping
=
ThisApplication
.
context
().
storageMappings
().
random
(
GeneralFile
.
class
);
GeneralFile
generalFile
=
new
GeneralFile
(
gfMapping
.
getName
(),
name
,
effectivePerson
.
getDistinguishedName
());
generalFile
.
saveContent
(
gfMapping
,
bytes
,
name
);
emc
.
beginTransaction
(
GeneralFile
.
class
);
emc
.
persist
(
generalFile
,
CheckPersistType
.
all
);
emc
.
commit
();
key
=
generalFile
.
getId
();
}
return
key
;
}
private
byte
[]
playWright
(
Wi
wi
,
String
workHtml
,
String
name
)
{
byte
[]
bytes
=
null
;
try
(
Playwright
playwright
=
Playwright
.
create
())
{
List
<
BrowserType
>
browserTypes
=
Arrays
.
asList
(
playwright
.
chromium
(),
playwright
.
firefox
(),
playwright
.
webkit
()
);
List
<
BrowserType
>
browserTypes
=
Arrays
.
asList
(
playwright
.
chromium
(),
playwright
.
firefox
(),
playwright
.
webkit
());
for
(
BrowserType
browserType
:
browserTypes
)
{
logger
.
print
(
"Playwright user browser:"
+
browserType
.
name
());
LOGGER
.
print
(
"Playwright user browser:"
+
browserType
.
name
());
BrowserType
.
LaunchOptions
options
=
new
BrowserType
.
LaunchOptions
();
options
.
setHeadless
(
true
);
try
(
Browser
browser
=
browserType
.
launch
(
options
))
{
BrowserContext
context
=
browser
.
newContext
();
Page
page
=
context
.
newPage
();
//page.navigate("file:///Users/chengjian/dev/tmp/html2Image.html");
try
(
Browser
browser
=
browserType
.
launch
(
options
);
BrowserContext
context
=
browser
.
newContext
();
Page
page
=
context
.
newPage
())
{
page
.
setContent
(
workHtml
);
Page
.
ScreenshotOptions
screenshotOptions
=
new
Page
.
ScreenshotOptions
();
screenshotOptions
.
setFullPage
(
true
);
if
(
wi
.
getHtmlWidth
()
!=
null
&&
wi
.
getHtmlHeight
()
!=
null
)
{
screenshotOptions
.
setClip
(
wi
.
getStartX
(),
wi
.
getStartY
(),
wi
.
getHtmlWidth
(),
wi
.
getHtmlHeight
());
screenshotOptions
.
setClip
(
wi
.
getStartX
(),
wi
.
getStartY
(),
wi
.
getHtmlWidth
(),
wi
.
getHtmlHeight
());
}
if
(
BooleanUtils
.
isTrue
(
wi
.
getOmitBackground
()))
{
if
(
BooleanUtils
.
isTrue
(
wi
.
getOmitBackground
()))
{
screenshotOptions
.
setOmitBackground
(
wi
.
getOmitBackground
());
}
File
tempDir
=
Config
.
dir_local_temp
();
...
...
@@ -121,46 +157,20 @@ class ActionHtmlToImage extends BaseAction {
bytes
=
FileUtils
.
readFileToByteArray
(
file
);
break
;
}
catch
(
Exception
e
)
{
logger
.
warn
(
"Playwright user browser:{} error:{}"
,
browserType
.
name
(),
e
.
getMessage
());
LOGGER
.
warn
(
"Playwright user browser:{} error:{}"
,
browserType
.
name
(),
e
.
getMessage
());
}
}
}
if
(
bytes
==
null
){
logger
.
warn
(
"Playwright screenshot fail!!!"
);
return
""
;
}
String
key
=
""
;
if
(
work
!=
null
){
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
random
(
Attachment
.
class
);
Attachment
attachment
=
this
.
concreteAttachment
(
work
,
effectivePerson
,
wi
.
getSite
());
attachment
.
saveContent
(
mapping
,
bytes
,
name
);
attachment
.
setType
((
new
Tika
()).
detect
(
bytes
,
name
));
emc
.
beginTransaction
(
Attachment
.
class
);
emc
.
persist
(
attachment
,
CheckPersistType
.
all
);
emc
.
commit
();
key
=
attachment
.
getId
();
}
else
{
StorageMapping
gfMapping
=
ThisApplication
.
context
().
storageMappings
().
random
(
GeneralFile
.
class
);
GeneralFile
generalFile
=
new
GeneralFile
(
gfMapping
.
getName
(),
name
,
effectivePerson
.
getDistinguishedName
());
generalFile
.
saveContent
(
gfMapping
,
bytes
,
name
);
emc
.
beginTransaction
(
GeneralFile
.
class
);
emc
.
persist
(
generalFile
,
CheckPersistType
.
all
);
emc
.
commit
();
key
=
generalFile
.
getId
();
}
return
key
;
return
bytes
;
}
private
Attachment
concreteAttachment
(
Work
work
,
EffectivePerson
effectivePerson
,
String
site
)
throws
Exception
{
private
Attachment
concreteAttachment
(
Work
work
,
EffectivePerson
effectivePerson
,
String
site
)
{
Attachment
attachment
=
new
Attachment
();
attachment
.
setCompleted
(
false
);
attachment
.
setPerson
(
effectivePerson
.
getDistinguishedName
());
attachment
.
setLastUpdatePerson
(
effectivePerson
.
getDistinguishedName
());
attachment
.
setSite
(
site
);
/
** 用于判断目录的值 */
/
/ 用于判断目录的值
attachment
.
setWorkCreateTime
(
work
.
getCreateTime
());
attachment
.
setApplication
(
work
.
getApplication
());
attachment
.
setProcess
(
work
.
getProcess
());
...
...
@@ -172,132 +182,17 @@ class ActionHtmlToImage extends BaseAction {
return
attachment
;
}
public
static
class
Wi
extends
GsonPropertyObject
{
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionHtmlToImage$Wi"
)
public
static
class
Wi
extends
ActionHtmlToImageWi
{
@FieldDescribe
(
"*待转换html."
)
private
String
workHtml
;
@FieldDescribe
(
"图片标题"
)
private
String
title
;
@FieldDescribe
(
"html正文宽度,允许为空."
)
private
Double
htmlWidth
;
@FieldDescribe
(
"html正文高度,允许为空."
)
private
Double
htmlHeight
;
@FieldDescribe
(
"html的X轴开始位置,允许为空."
)
private
Double
startX
;
@FieldDescribe
(
"html的Y轴开始位置,允许为空."
)
private
Double
startY
;
@FieldDescribe
(
"背景是否透明,默认为false."
)
private
Boolean
omitBackground
;
@FieldDescribe
(
"工作标识,把图片保存到工单的附件中,非必填"
)
private
String
workId
;
@FieldDescribe
(
"位置,工作标识不为空的时候必填"
)
private
String
site
;
private
static
final
long
serialVersionUID
=
-
4349899902435225796L
;
public
String
getWorkHtml
()
{
return
workHtml
;
}
public
void
setWorkHtml
(
String
workHtml
)
{
this
.
workHtml
=
workHtml
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getWorkId
()
{
return
workId
;
}
public
void
setWorkId
(
String
workId
)
{
this
.
workId
=
workId
;
}
public
String
getSite
()
{
return
site
;
}
public
void
setSite
(
String
site
)
{
this
.
site
=
site
;
}
public
Double
getStartX
()
{
return
startX
==
null
?
0
D
:
startX
;
}
public
void
setStartX
(
Double
startX
)
{
this
.
startX
=
startX
;
}
public
Double
getStartY
()
{
return
startY
==
null
?
0
D
:
startX
;
}
public
void
setStartY
(
Double
startY
)
{
this
.
startY
=
startY
;
}
public
Double
getHtmlWidth
()
{
return
htmlWidth
;
}
public
void
setHtmlWidth
(
Double
htmlWidth
)
{
this
.
htmlWidth
=
htmlWidth
;
}
public
Double
getHtmlHeight
()
{
return
htmlHeight
;
}
public
void
setHtmlHeight
(
Double
htmlHeight
)
{
this
.
htmlHeight
=
htmlHeight
;
}
public
Boolean
getOmitBackground
()
{
return
omitBackground
;
}
public
void
setOmitBackground
(
Boolean
omitBackground
)
{
this
.
omitBackground
=
omitBackground
;
}
}
public
static
class
WoControl
extends
WorkControl
{
}
public
static
class
Control
extends
WorkControl
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
try
(
Playwright
playwright
=
Playwright
.
create
())
{
List
<
BrowserType
>
browserTypes
=
Arrays
.
asList
(
playwright
.
chromium
(),
playwright
.
firefox
(),
playwright
.
webkit
()
);
for
(
BrowserType
browserType
:
browserTypes
)
{
System
.
out
.
println
(
browserType
.
name
());
BrowserType
.
LaunchOptions
options
=
new
BrowserType
.
LaunchOptions
();
options
.
setHeadless
(
true
);
try
(
Browser
browser
=
browserType
.
launch
(
options
))
{
BrowserContext
context
=
browser
.
newContext
();
Page
page
=
context
.
newPage
();
page
.
navigate
(
"file:///Users/chengjian/Downloads/test11.html"
);
Page
.
ScreenshotOptions
screenshotOptions
=
new
Page
.
ScreenshotOptions
();
screenshotOptions
.
setFullPage
(
true
);
screenshotOptions
.
setClip
(
0
,
0
,
800
,
2310
);
screenshotOptions
.
setOmitBackground
(
true
);
//screenshotOptions.setQuality(2);
screenshotOptions
.
setPath
(
Paths
.
get
(
"/Users/chengjian/dev/temp/screenshot-"
+
browserType
.
name
()
+
".png"
));
page
.
screenshot
(
screenshotOptions
);
break
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
private
static
final
long
serialVersionUID
=
-
2434594947861029787L
;
System
.
out
.
println
(
11
);
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionHtmlToPdf.java
浏览文件 @
a7dcabc6
...
...
@@ -14,10 +14,8 @@ import com.itextpdf.kernel.pdf.PdfWriter;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.config.StorageMapping
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoId
;
...
...
@@ -27,10 +25,13 @@ import com.x.base.core.project.tools.DateTools;
import
com.x.general.core.entity.GeneralFile
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.express.assemble.surface.jaxrs.attachment.ActionHtmlToPdfWi
;
import
io.swagger.v3.oas.annotations.media.Schema
;
class
ActionHtmlToPdf
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionEdit
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionHtmlToPdf
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
...
...
@@ -45,10 +46,6 @@ class ActionHtmlToPdf extends BaseAction {
}
}
public
static
class
Wo
extends
WoId
{
}
private
String
savePdf
(
Wi
wi
,
String
person
,
Business
business
)
{
try
{
String
workHtml
=
wi
.
getWorkHtml
();
...
...
@@ -87,47 +84,24 @@ class ActionHtmlToPdf extends BaseAction {
emc
.
persist
(
generalFile
,
CheckPersistType
.
all
);
emc
.
commit
();
String
key
=
generalFile
.
getId
();
return
key
;
return
generalFile
.
getId
();
}
catch
(
Exception
e
)
{
logger
.
warn
(
"写work信息异常"
+
e
.
getMessage
());
LOGGER
.
warn
(
"写work信息异常"
+
e
.
getMessage
());
}
return
""
;
}
public
static
class
Wi
extends
GsonPropertyObject
{
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionHtmlToPdf$Wi"
)
public
static
class
Wi
extends
ActionHtmlToPdfWi
{
@FieldDescribe
(
"待转换html."
)
private
String
workHtml
;
@FieldDescribe
(
"转pdf页面宽度,默认A4."
)
private
Float
pageWidth
;
@FieldDescribe
(
"pdf标题"
)
private
String
title
;
public
String
getWorkHtml
()
{
return
workHtml
;
}
private
static
final
long
serialVersionUID
=
339938457947418960L
;
public
void
setWorkHtml
(
String
workHtml
)
{
this
.
workHtml
=
workHtml
;
}
public
Float
getPageWidth
()
{
return
pageWidth
;
}
}
public
void
setPageWidth
(
Float
pageWidth
)
{
this
.
pageWidth
=
pageWidth
;
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionHtmlToPdf$Wo"
)
public
static
class
Wo
extends
WoId
{
public
String
getTitle
()
{
return
title
;
}
private
static
final
long
serialVersionUID
=
-
1487347751947636644L
;
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionListWithJob.java
浏览文件 @
a7dcabc6
...
...
@@ -27,9 +27,11 @@ import com.x.processplatform.assemble.surface.Business;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
io.swagger.v3.oas.annotations.media.Schema
;
class
ActionListWithJob
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithJob
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListWithJob
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
job
)
throws
Exception
{
...
...
@@ -72,12 +74,13 @@ class ActionListWithJob extends BaseAction {
Comparator
.
comparing
(
Wo:
:
getCreateTime
,
Comparator
.
nullsLast
(
Date:
:
compareTo
))))
.
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
LOGGER
.
error
(
e
);
}
return
wos
;
},
ThisApplication
.
threadPool
());
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionListWithJob$Wo"
)
public
static
class
Wo
extends
Attachment
{
private
static
final
long
serialVersionUID
=
-
7666329770246726197L
;
...
...
@@ -97,6 +100,7 @@ class ActionListWithJob extends BaseAction {
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionListWithJob$WoControl"
)
public
static
class
WoControl
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
7283783148043076205L
;
@FieldDescribe
(
"可读"
)
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionListWithWork.java
浏览文件 @
a7dcabc6
package
com.x.processplatform.assemble.surface.jaxrs.attachment
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.
entity.JpaObject
;
import
com.x.base.core.
project.annotation.FieldDescribe
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.WorkControl
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.Work
;
import
io.swagger.v3.oas.annotations.media.Schema
;
@Deprecated
class
ActionListWithWork
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListWithWork
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
workId
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, workId:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
workId
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
Work
work
=
emc
.
find
(
workId
,
Work
.
class
);
/
** 判断work是否存在 */
/
/ 判断work是否存在
if
(
null
==
work
)
{
throw
new
ExceptionEntityNotExist
(
workId
,
Work
.
class
);
}
...
...
@@ -41,15 +51,15 @@ class ActionListWithWork extends BaseAction {
}
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionListWithWork$Wo"
)
public
static
class
Wo
extends
Attachment
{
private
static
final
long
serialVersionUID
=
1954637399762611493L
;
static
WrapCopier
<
Attachment
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Attachment
.
class
,
Wo
.
class
,
null
,
Wo
.
Excludes
,
true
);
public
static
List
<
String
>
Excludes
=
new
ArrayList
<>(
JpaObject
.
FieldsInvisible
);
static
WrapCopier
<
Attachment
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Attachment
.
class
,
Wo
.
class
,
null
,
null
,
true
);
@FieldDescribe
(
"排序号."
)
@Schema
(
description
=
"排序号."
)
private
Long
rank
;
public
Long
getRank
()
{
...
...
@@ -62,7 +72,11 @@ class ActionListWithWork extends BaseAction {
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionListWithWork$WoControl"
)
public
static
class
WoControl
extends
WorkControl
{
private
static
final
long
serialVersionUID
=
-
4507421460623028200L
;
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionListWithWorkCompleted.java
浏览文件 @
a7dcabc6
package
com.x.processplatform.assemble.surface.jaxrs.attachment
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -9,19 +8,27 @@ import org.apache.commons.lang3.BooleanUtils;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.JpaObject
;
import
com.x.base.core.project.bean.WrapCopier
;
import
com.x.base.core.project.bean.WrapCopierFactory
;
import
com.x.base.core.project.exception.ExceptionEntityNotExist
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.WorkCompletedControl
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
@Deprecated
class
ActionListWithWorkCompleted
extends
BaseAction
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListWithWorkCompleted
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
workCompletedId
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, workCompletedId:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
workCompletedId
);
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
...
...
@@ -47,9 +54,7 @@ class ActionListWithWorkCompleted extends BaseAction {
private
static
final
long
serialVersionUID
=
1954637399762611493L
;
static
WrapCopier
<
Attachment
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Attachment
.
class
,
Wo
.
class
,
null
,
Wo
.
Excludes
);
public
static
List
<
String
>
Excludes
=
new
ArrayList
<>(
JpaObject
.
FieldsInvisible
);
static
WrapCopier
<
Attachment
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
Attachment
.
class
,
Wo
.
class
,
null
,
null
);
private
Long
rank
;
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionListWithWorkOrWorkCompleted.java
浏览文件 @
a7dcabc6
...
...
@@ -27,12 +27,17 @@ import com.x.processplatform.assemble.surface.Business;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
io.swagger.v3.oas.annotations.media.Schema
;
class
ActionListWithWorkOrWorkCompleted
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListWithWorkOrWorkCompleted
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionListWithWorkOrWorkCompleted
.
class
);
ActionResult
<
List
<
Wo
>>
execute
(
EffectivePerson
effectivePerson
,
String
workOrWorkCompleted
)
throws
Exception
{
LOGGER
.
debug
(
"execute:{}, workOrWorkCompleted:{}."
,
effectivePerson:
:
getDistinguishedName
,
()
->
workOrWorkCompleted
);
ActionResult
<
List
<
Wo
>>
result
=
new
ActionResult
<>();
CompletableFuture
<
List
<
Wo
>>
listFuture
=
listFuture
(
effectivePerson
,
workOrWorkCompleted
);
CompletableFuture
<
Boolean
>
checkControlFuture
=
checkControlFuture
(
effectivePerson
,
workOrWorkCompleted
);
...
...
@@ -72,7 +77,7 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction {
Comparator
.
comparing
(
Wo:
:
getCreateTime
,
Comparator
.
nullsLast
(
Date:
:
compareTo
))))
.
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
LOGGER
.
error
(
e
);
}
return
wos
;
},
ThisApplication
.
threadPool
());
...
...
@@ -99,12 +104,19 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction {
}
public
static
class
WoControl
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
7283783148043076205L
;
@FieldDescribe
(
"可读"
)
@FieldDescribe
(
"可读."
)
@Schema
(
description
=
"可读."
)
private
Boolean
allowRead
=
false
;
@FieldDescribe
(
"可写"
)
@FieldDescribe
(
"可写."
)
@Schema
(
description
=
"可写."
)
private
Boolean
allowEdit
=
false
;
@FieldDescribe
(
"可控制"
)
@FieldDescribe
(
"可控制."
)
@Schema
(
description
=
"可控制."
)
private
Boolean
allowControl
=
false
;
public
Boolean
getAllowRead
()
{
...
...
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionManageBatchDelete.java
浏览文件 @
a7dcabc6
package
com.x.processplatform.assemble.surface.jaxrs.attachment
;
import
java.util.List
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.config.StorageMapping
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
...
...
@@ -18,25 +16,28 @@ import com.x.base.core.project.tools.ListTools;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.express.assemble.surface.jaxrs.attachment.ActionManageBatchDeleteWi
;
import
io.swagger.v3.oas.annotations.media.Schema
;
class
ActionManageBatchDelete
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionManageBatchDelete
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionManageBatchDelete
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
JsonElement
jsonElement
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Wi
wi
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
logger
.
print
(
"manageBatchDelete receive id:{}, effectivePerson:{}."
,
wi
.
getIdList
(),
effectivePerson
.
getDistinguishedName
()
);
LOGGER
.
print
(
"execute:{},."
,
effectivePerson:
:
getDistinguishedName
);
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
if
(!
business
.
canManageApplication
(
effectivePerson
,
null
))
{
if
(
BooleanUtils
.
isFalse
(
business
.
canManageApplication
(
effectivePerson
,
null
)))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
if
(
ListTools
.
isNotEmpty
(
wi
.
getIdList
()))
{
for
(
String
id
:
wi
.
getIdList
()){
if
(
ListTools
.
isNotEmpty
(
wi
.
getIdList
()))
{
for
(
String
id
:
wi
.
getIdList
())
{
Attachment
attachment
=
emc
.
find
(
id
.
trim
(),
Attachment
.
class
);
if
(
attachment
!=
null
)
{
logger
.
print
(
"manageBatchDelete attachment:{}—
—{}"
,
attachment
.
getId
(),
attachment
.
getName
());
if
(
attachment
!=
null
)
{
LOGGER
.
print
(
"manageBatchDelete attachment:{}
—{}"
,
attachment
.
getId
(),
attachment
.
getName
());
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
Attachment
.
class
,
attachment
.
getStorage
());
attachment
.
deleteContent
(
mapping
);
...
...
@@ -54,21 +55,18 @@ class ActionManageBatchDelete extends BaseAction {
}
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionManageBatchDelete$Wo"
)
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
-
6186591656948482426L
;
}
public
static
class
Wi
extends
GsonPropertyObject
{
@FieldDescribe
(
"待删除附件ID列表"
)
private
List
<
String
>
idList
;
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionManageBatchDelete$Wi"
)
public
static
class
Wi
extends
ActionManageBatchDeleteWi
{
public
List
<
String
>
getIdList
()
{
return
idList
;
}
private
static
final
long
serialVersionUID
=
3267682362954096818L
;
public
void
setIdList
(
List
<
String
>
idList
)
{
this
.
idList
=
idList
;
}
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionManageBatchUpdate.java
浏览文件 @
a7dcabc6
package
com.x.processplatform.assemble.surface.jaxrs.attachment
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.glassfish.jersey.media.multipart.FormDataContentDisposition
;
...
...
@@ -18,20 +19,23 @@ import com.x.processplatform.assemble.surface.Business;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
io.swagger.v3.oas.annotations.media.Schema
;
class
ActionManageBatchUpdate
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionManageBatchUpdate
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionManageBatchUpdate
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
ids
,
String
fileName
,
byte
[]
bytes
,
FormDataContentDisposition
disposition
,
String
extraParam
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
logger
.
print
(
"manageBatchUpdate receive id:{}, fileName:{}, effectivePerson:{}."
,
ids
,
fileName
,
effectivePerson
.
getDistinguishedName
());
LOGGER
.
print
(
"manageBatchUpdate receive id:{}, fileName:{}, effectivePerson:{}."
,
ids
,
fileName
,
effectivePerson
.
getDistinguishedName
());
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
if
(!
business
.
canManageApplication
(
effectivePerson
,
null
))
{
if
(
BooleanUtils
.
isFalse
(
business
.
canManageApplication
(
effectivePerson
,
null
)))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
/
* 天谷印章扩展 */
/
/ 天谷印章扩展
if
(
StringUtils
.
isNotEmpty
(
extraParam
))
{
WiExtraParam
wiExtraParam
=
gson
.
fromJson
(
extraParam
,
WiExtraParam
.
class
);
if
(
StringUtils
.
isNotEmpty
(
wiExtraParam
.
getFileName
()))
{
...
...
@@ -42,20 +46,21 @@ class ActionManageBatchUpdate extends BaseAction {
if
(
StringUtils
.
isEmpty
(
fileName
))
{
fileName
=
this
.
fileName
(
disposition
);
}
if
(
StringUtils
.
isNotEmpty
(
ids
)
&&
bytes
!=
null
&&
bytes
.
length
>
0
)
{
if
(
StringUtils
.
isNotEmpty
(
ids
)
&&
bytes
!=
null
&&
bytes
.
length
>
0
)
{
String
[]
idArray
=
ids
.
split
(
","
);
for
(
String
id
:
idArray
){
for
(
String
id
:
idArray
)
{
Attachment
attachment
=
emc
.
find
(
id
.
trim
(),
Attachment
.
class
);
if
(
attachment
!=
null
)
{
if
(
attachment
!=
null
)
{
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
Attachment
.
class
,
attachment
.
getStorage
());
emc
.
beginTransaction
(
Attachment
.
class
);
attachment
.
updateContent
(
mapping
,
bytes
,
fileName
);
if
(
Config
.
query
().
getExtractImage
()
&&
ExtractTextTools
.
supportImage
(
attachment
.
getName
())
if
(
BooleanUtils
.
isTrue
(
Config
.
query
().
getExtractImage
())
&&
ExtractTextTools
.
supportImage
(
attachment
.
getName
())
&&
ExtractTextTools
.
available
(
bytes
))
{
attachment
.
setText
(
ExtractTextTools
.
image
(
bytes
));
logger
.
debug
(
"filename:{}, file type:{}, text:{}."
,
attachment
.
getName
(),
attachment
.
getTyp
e
(),
attachment
.
getText
());
LOGGER
.
debug
(
"filename:{}, file type:{}, text:{}."
,
attachment
.
getNam
e
(),
attachment
.
getT
ype
(),
attachment
.
getT
ext
());
}
emc
.
commit
();
...
...
@@ -70,8 +75,11 @@ class ActionManageBatchUpdate extends BaseAction {
}
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionManageBatchUpdate$Wo"
)
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
-
7244253863926345214L
;
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionManageBatchUpload.java
浏览文件 @
a7dcabc6
...
...
@@ -30,18 +30,20 @@ import com.x.processplatform.core.entity.content.WorkCompleted;
import
com.x.processplatform.core.entity.element.End
;
import
com.x.processplatform.core.entity.element.Process
;
import
io.swagger.v3.oas.annotations.media.Schema
;
class
ActionManageBatchUpload
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionManageBatchUpload
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ActionManageBatchUpload
.
class
);
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
workIds
,
String
site
,
String
fileName
,
byte
[]
bytes
,
FormDataContentDisposition
disposition
,
String
extraParam
,
String
person
,
Integer
order
,
Boolean
isSoftUpload
,
String
mainWork
)
throws
Exception
{
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
workIds
,
String
site
,
String
fileName
,
byte
[]
bytes
,
FormDataContentDisposition
disposition
,
String
extraParam
,
String
person
,
Integer
order
,
Boolean
isSoftUpload
,
String
mainWork
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Business
business
=
new
Business
(
emc
);
// 需要对这个应用的管理权限
if
(
!
business
.
canManageApplication
(
effectivePerson
,
null
))
{
if
(
BooleanUtils
.
isFalse
(
business
.
canManageApplication
(
effectivePerson
,
null
)
))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
...
...
@@ -61,18 +63,18 @@ class ActionManageBatchUpload extends BaseAction {
}
person
=
business
.
organization
().
person
().
get
(
person
);
if
(
StringUtils
.
isEmpty
(
person
))
{
if
(
StringUtils
.
isEmpty
(
person
))
{
person
=
effectivePerson
.
getDistinguishedName
();
}
if
(
StringUtils
.
isNotEmpty
(
workIds
)
&&
bytes
!=
null
&&
bytes
.
length
>
0
)
{
if
(
StringUtils
.
isNotEmpty
(
workIds
)
&&
bytes
!=
null
&&
bytes
.
length
>
0
)
{
Attachment
mainAtt
=
null
;
if
(
BooleanUtils
.
isTrue
(
isSoftUpload
)
&&
StringUtils
.
isNotEmpty
(
mainWork
))
{
logger
.
print
(
"file {} soft upload from mainWork:{}"
,
fileName
,
mainWork
);
if
(
BooleanUtils
.
isTrue
(
isSoftUpload
)
&&
StringUtils
.
isNotEmpty
(
mainWork
))
{
LOGGER
.
print
(
"file {} soft upload from mainWork:{}"
,
fileName
,
mainWork
);
mainWork
=
mainWork
.
trim
();
Work
work
=
emc
.
find
(
mainWork
,
Work
.
class
);
if
(
work
!=
null
)
{
if
(
work
!=
null
)
{
mainAtt
=
this
.
concreteAttachment
(
work
,
person
,
site
,
order
);
}
else
{
}
else
{
WorkCompleted
workCompleted
=
emc
.
find
(
mainWork
,
WorkCompleted
.
class
);
if
(
null
!=
workCompleted
)
{
Process
process
=
business
.
process
().
pick
(
workCompleted
.
getProcess
());
...
...
@@ -86,11 +88,12 @@ class ActionManageBatchUpload extends BaseAction {
mainAtt
=
this
.
concreteAttachment
(
workCompleted
,
person
,
site
,
order
,
ends
.
get
(
0
));
}
}
if
(
mainAtt
!=
null
)
{
if
(
mainAtt
!=
null
)
{
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
random
(
Attachment
.
class
);
mainAtt
.
saveContent
(
mapping
,
bytes
,
fileName
);
mainAtt
.
setType
((
new
Tika
()).
detect
(
bytes
,
fileName
));
if
(
Config
.
query
().
getExtractImage
()
&&
ExtractTextTools
.
supportImage
(
mainAtt
.
getName
())
if
(
BooleanUtils
.
isTrue
(
Config
.
query
().
getExtractImage
()
&&
ExtractTextTools
.
supportImage
(
mainAtt
.
getName
()))
&&
ExtractTextTools
.
available
(
bytes
))
{
mainAtt
.
setText
(
ExtractTextTools
.
image
(
bytes
));
}
...
...
@@ -101,17 +104,17 @@ class ActionManageBatchUpload extends BaseAction {
}
String
[]
idArray
=
workIds
.
split
(
","
);
for
(
String
workId
:
idArray
)
{
Attachment
attachment
=
null
;
Attachment
attachment
=
null
;
workId
=
workId
.
trim
();
if
(
mainAtt
!=
null
&&
workId
.
equals
(
mainWork
))
{
if
(
mainAtt
!=
null
&&
workId
.
equals
(
mainWork
))
{
continue
;
}
Work
work
=
emc
.
find
(
workId
,
Work
.
class
);
if
(
work
!=
null
)
{
if
(
work
!=
null
)
{
attachment
=
this
.
concreteAttachment
(
work
,
person
,
site
,
order
);
}
else
{
WorkCompleted
workCompleted
=
emc
.
find
(
workId
,
WorkCompleted
.
class
);
if
(
null
!=
workCompleted
)
{
}
else
{
WorkCompleted
workCompleted
=
emc
.
find
(
workId
,
WorkCompleted
.
class
);
if
(
null
!=
workCompleted
)
{
Process
process
=
business
.
process
().
pick
(
workCompleted
.
getProcess
());
if
(
null
==
process
)
{
throw
new
ExceptionEntityNotExist
(
workCompleted
.
getProcess
(),
Process
.
class
);
...
...
@@ -121,14 +124,15 @@ class ActionManageBatchUpload extends BaseAction {
throw
new
ExceptionEndNotExist
(
process
.
getId
());
}
attachment
=
this
.
concreteAttachment
(
workCompleted
,
person
,
site
,
order
,
ends
.
get
(
0
));
}
}
if
(
attachment
!=
null
)
{
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
random
(
Attachment
.
class
);
if
(
mainAtt
!=
null
)
{
}
}
if
(
attachment
!=
null
)
{
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
random
(
Attachment
.
class
);
if
(
mainAtt
!=
null
)
{
attachment
.
setName
(
mainAtt
.
getName
());
attachment
.
setDeepPath
(
mapping
.
getDeepPath
());
attachment
.
setExtension
(
StringUtils
.
lowerCase
(
StringUtils
.
substringAfterLast
(
mainAtt
.
getName
(),
"."
)));
attachment
.
setExtension
(
StringUtils
.
lowerCase
(
StringUtils
.
substringAfterLast
(
mainAtt
.
getName
(),
"."
)));
attachment
.
setLength
(
mainAtt
.
getLength
());
attachment
.
setStorage
(
mapping
.
getName
());
attachment
.
setType
(
mainAtt
.
getType
());
...
...
@@ -137,18 +141,19 @@ class ActionManageBatchUpload extends BaseAction {
attachment
.
setFromJob
(
mainAtt
.
getJob
());
attachment
.
setFromId
(
mainAtt
.
getId
());
attachment
.
setFromPath
(
mainAtt
.
path
());
}
else
{
}
else
{
attachment
.
saveContent
(
mapping
,
bytes
,
fileName
);
attachment
.
setType
((
new
Tika
()).
detect
(
bytes
,
fileName
));
if
(
Config
.
query
().
getExtractImage
()
&&
ExtractTextTools
.
supportImage
(
attachment
.
getName
())
if
(
BooleanUtils
.
isTrue
(
Config
.
query
().
getExtractImage
())
&&
ExtractTextTools
.
supportImage
(
attachment
.
getName
())
&&
ExtractTextTools
.
available
(
bytes
))
{
attachment
.
setText
(
ExtractTextTools
.
image
(
bytes
));
}
}
emc
.
beginTransaction
(
Attachment
.
class
);
emc
.
persist
(
attachment
,
CheckPersistType
.
all
);
emc
.
commit
();
}
emc
.
beginTransaction
(
Attachment
.
class
);
emc
.
persist
(
attachment
,
CheckPersistType
.
all
);
emc
.
commit
();
}
}
}
...
...
@@ -165,7 +170,7 @@ class ActionManageBatchUpload extends BaseAction {
attachment
.
setPerson
(
person
);
attachment
.
setLastUpdatePerson
(
person
);
attachment
.
setSite
(
site
);
/
** 用于判断目录的值 */
/
/ 用于判断目录的值
attachment
.
setWorkCreateTime
(
work
.
getCreateTime
());
attachment
.
setApplication
(
work
.
getApplication
());
attachment
.
setProcess
(
work
.
getProcess
());
...
...
@@ -174,37 +179,45 @@ class ActionManageBatchUpload extends BaseAction {
attachment
.
setActivityName
(
work
.
getActivityName
());
attachment
.
setActivityToken
(
work
.
getActivityToken
());
attachment
.
setActivityType
(
work
.
getActivityType
());
if
(
order
!=
null
)
{
if
(
order
!=
null
)
{
attachment
.
setOrderNumber
(
order
);
}
return
attachment
;
}
private
Attachment
concreteAttachment
(
WorkCompleted
workCompleted
,
String
person
,
String
site
,
Integer
order
,
End
end
)
throws
Exception
{
Attachment
attachment
=
new
Attachment
();
attachment
.
setCompleted
(
true
);
attachment
.
setPerson
(
person
);
attachment
.
setLastUpdatePerson
(
person
);
attachment
.
setSite
(
site
);
/** 用于判断目录的值 */
attachment
.
setWorkCreateTime
(
workCompleted
.
getStartTime
());
attachment
.
setApplication
(
workCompleted
.
getApplication
());
attachment
.
setProcess
(
workCompleted
.
getProcess
());
attachment
.
setJob
(
workCompleted
.
getJob
());
private
Attachment
concreteAttachment
(
WorkCompleted
workCompleted
,
String
person
,
String
site
,
Integer
order
,
End
end
)
throws
Exception
{
Attachment
attachment
=
new
Attachment
();
attachment
.
setCompleted
(
true
);
attachment
.
setPerson
(
person
);
attachment
.
setLastUpdatePerson
(
person
);
attachment
.
setSite
(
site
);
// 用于判断目录的值
attachment
.
setWorkCreateTime
(
workCompleted
.
getStartTime
());
attachment
.
setApplication
(
workCompleted
.
getApplication
());
attachment
.
setProcess
(
workCompleted
.
getProcess
());
attachment
.
setJob
(
workCompleted
.
getJob
());
attachment
.
setActivity
(
end
.
getId
());
attachment
.
setActivityName
(
end
.
getName
());
attachment
.
setActivityToken
(
end
.
getId
());
attachment
.
setActivityType
(
end
.
getActivityType
());
if
(
order
!=
null
)
{
if
(
order
!=
null
)
{
attachment
.
setOrderNumber
(
order
);
}
return
attachment
;
}
return
attachment
;
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionManageBatchUpload$Wo"
)
public
static
class
Wo
extends
WrapBoolean
{
private
static
final
long
serialVersionUID
=
5608898238425800133L
;
}
@Schema
(
name
=
"com.x.processplatform.assemble.surface.jaxrs.attachment.ActionManageBatchUpload$WoControl"
)
public
static
class
WoControl
extends
WorkControl
{
private
static
final
long
serialVersionUID
=
3610556328798966861L
;
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/BaseBatchDownloadWithWorkOrWorkCompleted.java
0 → 100644
浏览文件 @
a7dcabc6
package
com.x.processplatform.assemble.surface.jaxrs.attachment
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.tuple.Pair
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.project.config.StorageMapping
;
import
com.x.base.core.project.exception.ExceptionAccessDenied
;
import
com.x.base.core.project.exception.ExceptionEntityExist
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.tools.DateTools
;
import
com.x.general.core.entity.GeneralFile
;
import
com.x.processplatform.assemble.surface.Business
;
import
com.x.processplatform.assemble.surface.ThisApplication
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.Work
;
import
com.x.processplatform.core.entity.content.WorkCompleted
;
class
BaseBatchDownloadWithWorkOrWorkCompleted
extends
BaseAction
{
private
static
final
String
[]
FILENAME_SENSITIVES_KEY
=
new
String
[]
{
"/"
,
":"
,
"*"
,
"?"
,
"<<"
,
">>"
,
"|"
,
"<"
,
">"
,
"\\"
};
private
static
final
String
[]
FILENAME_SENSITIVES_EMPTY
=
new
String
[]
{
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
};
protected
String
adjustFileName
(
String
fileName
,
String
title
)
{
if
(
StringUtils
.
isBlank
(
fileName
))
{
if
(
title
.
length
()
>
60
)
{
title
=
title
.
substring
(
0
,
60
);
}
fileName
=
title
+
DateTools
.
format
(
new
Date
(),
DateTools
.
formatCompact_yyyyMMddHHmmss
)
+
".zip"
;
}
else
{
String
extension
=
FilenameUtils
.
getExtension
(
fileName
);
if
(
StringUtils
.
isEmpty
(
extension
))
{
fileName
=
fileName
+
".zip"
;
}
}
fileName
=
StringUtils
.
replaceEach
(
fileName
,
FILENAME_SENSITIVES_KEY
,
FILENAME_SENSITIVES_EMPTY
);
return
fileName
;
}
protected
List
<
Attachment
>
listAttachment
(
Business
business
,
String
site
,
String
job
)
throws
Exception
{
List
<
Attachment
>
attachmentList
;
if
(
StringUtils
.
isBlank
(
site
)
||
EMPTY_SYMBOL
.
equals
(
site
))
{
attachmentList
=
business
.
attachment
().
listWithJobObject
(
job
);
}
else
if
(
site
.
indexOf
(
SITE_SEPARATOR
)
==
-
1
)
{
attachmentList
=
business
.
entityManagerContainer
().
listEqualAndEqual
(
Attachment
.
class
,
Attachment
.
job_FIELDNAME
,
job
,
Attachment
.
site_FIELDNAME
,
site
);
}
else
{
attachmentList
=
business
.
entityManagerContainer
().
listEqualAndIn
(
Attachment
.
class
,
Attachment
.
job_FIELDNAME
,
job
,
Attachment
.
site_FIELDNAME
,
Arrays
.
asList
(
site
.
split
(
SITE_SEPARATOR
)));
}
return
attachmentList
;
}
protected
Pair
<
String
,
String
>
getTitleAndJob
(
EffectivePerson
effectivePerson
,
Business
business
,
String
workId
)
throws
Exception
{
Work
work
=
business
.
entityManagerContainer
().
fetch
(
workId
,
Work
.
class
);
if
(
work
!=
null
)
{
if
(!
business
.
readable
(
effectivePerson
,
work
))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
,
work
);
}
return
Pair
.
of
(
work
.
getTitle
(),
work
.
getJob
());
}
else
{
WorkCompleted
workCompleted
=
business
.
entityManagerContainer
().
fetch
(
workId
,
WorkCompleted
.
class
);
if
(
null
==
workCompleted
)
{
throw
new
ExceptionEntityExist
(
workId
);
}
if
(!
business
.
readable
(
effectivePerson
,
workCompleted
))
{
throw
new
ExceptionWorkCompletedAccessDenied
(
effectivePerson
.
getDistinguishedName
(),
workCompleted
.
getTitle
(),
workCompleted
.
getId
());
}
return
Pair
.
of
(
workCompleted
.
getTitle
(),
workCompleted
.
getJob
());
}
}
protected
void
assembleFile
(
Business
business
,
Map
<
String
,
byte
[]>
map
,
String
files
)
throws
Exception
{
EntityManagerContainer
emc
=
business
.
entityManagerContainer
();
if
(
StringUtils
.
isNotEmpty
(
files
))
{
String
[]
flagList
=
files
.
split
(
FILE_SEPARATOR
);
for
(
String
flag
:
flagList
)
{
if
(
StringUtils
.
isNotBlank
(
flag
))
{
GeneralFile
generalFile
=
emc
.
find
(
flag
.
trim
(),
GeneralFile
.
class
);
if
(
generalFile
!=
null
)
{
StorageMapping
gfMapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
GeneralFile
.
class
,
generalFile
.
getStorage
());
map
.
put
(
generalFile
.
getName
(),
generalFile
.
readContent
(
gfMapping
));
generalFile
.
deleteContent
(
gfMapping
);
emc
.
beginTransaction
(
GeneralFile
.
class
);
emc
.
delete
(
GeneralFile
.
class
,
generalFile
.
getId
());
emc
.
commit
();
}
}
}
}
}
}
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/work/V2AddSplit.java
浏览文件 @
a7dcabc6
...
...
@@ -156,9 +156,6 @@ class V2AddSplit extends BaseAction {
}
private
void
processing
(
List
<
String
>
ids
)
throws
Exception
{
System
.
out
.
println
(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!2222"
);
System
.
out
.
println
(
gson
.
toJson
(
ids
));
System
.
out
.
println
(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!2222"
);
for
(
String
id
:
ids
)
{
ProcessingAttributes
processingAttributes
=
new
ProcessingAttributes
();
processingAttributes
.
setType
(
ProcessingAttributes
.
TYPE_ADDSPLIT
);
...
...
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/assemble/surface/jaxrs/attachment/ActionHtmlToImageWi.java
0 → 100644
浏览文件 @
a7dcabc6
package
com.x.processplatform.core.express.assemble.surface.jaxrs.attachment
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
io.swagger.v3.oas.annotations.media.Schema
;
public
class
ActionHtmlToImageWi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
8371465627589051014L
;
@FieldDescribe
(
"*待转换html."
)
@Schema
(
description
=
"*待转换html."
)
private
String
workHtml
;
@FieldDescribe
(
"图片标题"
)
@Schema
(
description
=
"图片标题"
)
private
String
title
;
@FieldDescribe
(
"html正文宽度,允许为空."
)
@Schema
(
description
=
"html正文宽度,允许为空."
)
private
Double
htmlWidth
;
@FieldDescribe
(
"html正文高度,允许为空."
)
@Schema
(
description
=
"html正文高度,允许为空."
)
private
Double
htmlHeight
;
@FieldDescribe
(
"html的X轴开始位置,允许为空."
)
@Schema
(
description
=
"html的X轴开始位置,允许为空."
)
private
Double
startX
;
@FieldDescribe
(
"html的Y轴开始位置,允许为空."
)
@Schema
(
description
=
"html的Y轴开始位置,允许为空."
)
private
Double
startY
;
@FieldDescribe
(
"背景是否透明,默认为false."
)
@Schema
(
description
=
"背景是否透明,默认为false."
)
private
Boolean
omitBackground
;
@FieldDescribe
(
"工作标识,把图片保存到工单的附件中,非必填"
)
@Schema
(
description
=
"工作标识,把图片保存到工单的附件中,非必填"
)
private
String
workId
;
@FieldDescribe
(
"位置,工作标识不为空的时候必填"
)
@Schema
(
description
=
"位置,工作标识不为空的时候必填"
)
private
String
site
;
public
String
getWorkHtml
()
{
return
workHtml
;
}
public
void
setWorkHtml
(
String
workHtml
)
{
this
.
workHtml
=
workHtml
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getWorkId
()
{
return
workId
;
}
public
void
setWorkId
(
String
workId
)
{
this
.
workId
=
workId
;
}
public
String
getSite
()
{
return
site
;
}
public
void
setSite
(
String
site
)
{
this
.
site
=
site
;
}
public
Double
getStartX
()
{
return
startX
==
null
?
0
D
:
startX
;
}
public
void
setStartX
(
Double
startX
)
{
this
.
startX
=
startX
;
}
public
Double
getStartY
()
{
return
startY
==
null
?
0
D
:
startX
;
}
public
void
setStartY
(
Double
startY
)
{
this
.
startY
=
startY
;
}
public
Double
getHtmlWidth
()
{
return
htmlWidth
;
}
public
void
setHtmlWidth
(
Double
htmlWidth
)
{
this
.
htmlWidth
=
htmlWidth
;
}
public
Double
getHtmlHeight
()
{
return
htmlHeight
;
}
public
void
setHtmlHeight
(
Double
htmlHeight
)
{
this
.
htmlHeight
=
htmlHeight
;
}
public
Boolean
getOmitBackground
()
{
return
omitBackground
;
}
public
void
setOmitBackground
(
Boolean
omitBackground
)
{
this
.
omitBackground
=
omitBackground
;
}
}
\ No newline at end of file
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/assemble/surface/jaxrs/attachment/ActionHtmlToPdfWi.java
0 → 100644
浏览文件 @
a7dcabc6
package
com.x.processplatform.core.express.assemble.surface.jaxrs.attachment
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
io.swagger.v3.oas.annotations.media.Schema
;
public
class
ActionHtmlToPdfWi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
8513838302143557434L
;
@FieldDescribe
(
"待转换html."
)
@Schema
(
description
=
"待转换html."
)
private
String
workHtml
;
@FieldDescribe
(
"转pdf页面宽度,默认A4."
)
@Schema
(
description
=
"转pdf页面宽度,默认A4."
)
private
Float
pageWidth
;
@FieldDescribe
(
"pdf标题."
)
@Schema
(
description
=
"pdf标题."
)
private
String
title
;
public
String
getWorkHtml
()
{
return
workHtml
;
}
public
void
setWorkHtml
(
String
workHtml
)
{
this
.
workHtml
=
workHtml
;
}
public
Float
getPageWidth
()
{
return
pageWidth
;
}
public
void
setPageWidth
(
Float
pageWidth
)
{
this
.
pageWidth
=
pageWidth
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
}
\ No newline at end of file
o2server/x_processplatform_core_express/src/main/java/com/x/processplatform/core/express/assemble/surface/jaxrs/attachment/ActionManageBatchDeleteWi.java
0 → 100644
浏览文件 @
a7dcabc6
package
com.x.processplatform.core.express.assemble.surface.jaxrs.attachment
;
import
java.util.List
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
io.swagger.v3.oas.annotations.media.Schema
;
public
class
ActionManageBatchDeleteWi
extends
GsonPropertyObject
{
private
static
final
long
serialVersionUID
=
-
1562006729508038976L
;
@FieldDescribe
(
"待删除附件列表."
)
@Schema
(
description
=
"待删除附件列表."
)
private
List
<
String
>
idList
;
public
List
<
String
>
getIdList
()
{
return
idList
;
}
public
void
setIdList
(
List
<
String
>
idList
)
{
this
.
idList
=
idList
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录