Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
此号慢热型
o2oa
提交
a9e9b0ad
o2oa
项目概览
此号慢热型
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
5
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,发现更多精彩内容 >>
提交
a9e9b0ad
编写于
10月 20, 2020
作者:
L
luojing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
人员组织导入及获取导入结果附件-缓存去除,改为存取到通用附件
上级
7ac308b9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
59 addition
and
13 deletion
+59
-13
o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_organization_assemble_control.java
.../x/base/core/project/x_organization_assemble_control.java
+2
-1
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionGetResult.java
...n/assemble/control/jaxrs/inputperson/ActionGetResult.java
+28
-6
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionInputAll.java
...on/assemble/control/jaxrs/inputperson/ActionInputAll.java
+16
-6
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ExceptionInputResultObject.java
...control/jaxrs/inputperson/ExceptionInputResultObject.java
+13
-0
未找到文件。
o2server/x_base_core_project/src/main/java/com/x/base/core/project/x_organization_assemble_control.java
浏览文件 @
a9e9b0ad
package
com.x.base.core.project
;
import
com.x.base.core.entity.StorageType
;
import
com.x.base.core.project.annotation.Module
;
import
com.x.base.core.project.annotation.ModuleCategory
;
import
com.x.base.core.project.annotation.ModuleType
;
...
...
@@ -10,6 +11,6 @@ import com.x.base.core.project.annotation.ModuleType;
"com.x.organization.core.entity.Identity"
,
"com.x.organization.core.entity.PersonAttribute"
,
"com.x.organization.core.entity.Unit"
,
"com.x.organization.core.entity.UnitAttribute"
,
"com.x.organization.core.entity.PersonCard"
,
"com.x.organization.core.entity.PermissionSetting"
,
"com.x.organization.core.entity.UnitDuty"
},
storeJars
=
{
"x_organization_core_entity"
})
"com.x.organization.core.entity.UnitDuty"
,
"com.x.general.core.entity.file.GeneralFile"
},
storageTypes
=
{
StorageType
.
general
},
storeJars
=
{
"x_organization_core_entity"
,
"x_general_core_entity"
})
public
class
x_organization_assemble_control
extends
Deployable
{
}
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionGetResult.java
浏览文件 @
a9e9b0ad
package
com.x.organization.assemble.control.jaxrs.inputperson
;
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.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WoFile
;
...
...
@@ -7,6 +11,9 @@ import com.x.base.core.project.logger.Logger;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.cache.Cache.CacheKey
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.general.core.entity.file.GeneralFile
;
import
com.x.organization.assemble.control.ThisApplication
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.Optional
;
...
...
@@ -17,13 +24,28 @@ public class ActionGetResult extends BaseAction {
protected
ActionResult
<
Wo
>
execute
(
EffectivePerson
effectivePerson
,
String
flag
)
throws
Exception
{
logger
.
debug
(
effectivePerson
,
"flag:{}."
,
flag
);
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
CacheKey
cacheKey
=
new
CacheKey
(
flag
);
Optional
<?>
optional
=
CacheManager
.
get
(
this
.
cache
,
cacheKey
);
if
(!
optional
.
isPresent
())
{
throw
new
ExceptionResultNotFound
(
flag
);
Wo
wo
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
GeneralFile
generalFile
=
emc
.
find
(
flag
,
GeneralFile
.
class
);
if
(
generalFile
!=
null
){
if
(!
StringUtils
.
equals
(
effectivePerson
.
getDistinguishedName
(),
generalFile
.
getPerson
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
);
}
StorageMapping
gfMapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
GeneralFile
.
class
,
generalFile
.
getStorage
());
wo
=
new
Wo
(
generalFile
.
readContent
(
gfMapping
),
this
.
contentType
(
true
,
generalFile
.
getName
()),
this
.
contentDisposition
(
true
,
generalFile
.
getName
()));
result
.
setData
(
wo
);
generalFile
.
deleteContent
(
gfMapping
);
emc
.
beginTransaction
(
GeneralFile
.
class
);
emc
.
delete
(
GeneralFile
.
class
,
generalFile
.
getId
());
emc
.
commit
();
}
else
{
throw
new
ExceptionInputResultObject
(
flag
);
}
}
CacheInputResult
o
=
(
CacheInputResult
)
optional
.
get
();
Wo
wo
=
new
Wo
(
o
.
getBytes
(),
this
.
contentType
(
true
,
o
.
getName
()),
this
.
contentDisposition
(
true
,
o
.
getName
()));
result
.
setData
(
wo
);
return
result
;
}
...
...
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionInputAll.java
浏览文件 @
a9e9b0ad
...
...
@@ -22,7 +22,10 @@ import javax.script.Bindings;
import
javax.script.ScriptContext
;
import
javax.script.SimpleScriptContext
;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.config.StorageMapping
;
import
com.x.general.core.entity.file.GeneralFile
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.text.StringEscapeUtils
;
...
...
@@ -97,12 +100,7 @@ class ActionInputAll extends BaseAction {
this
.
scanUnit
(
business
,
workbook
);
String
name
=
"person_input_"
+
DateTools
.
formatDate
(
new
Date
())
+
".xlsx"
;
workbook
.
write
(
os
);
CacheInputResult
cacheInputResult
=
new
CacheInputResult
();
cacheInputResult
.
setName
(
name
);
cacheInputResult
.
setBytes
(
os
.
toByteArray
());
String
flag
=
StringTools
.
uniqueToken
();
CacheKey
cacheKey
=
new
CacheKey
(
flag
);
CacheManager
.
put
(
this
.
cache
,
cacheKey
,
cacheInputResult
);
String
flag
=
saveAttachment
(
os
.
toByteArray
(),
name
,
effectivePerson
);
CacheManager
.
notify
(
Person
.
class
);
CacheManager
.
notify
(
Group
.
class
);
CacheManager
.
notify
(
Role
.
class
);
...
...
@@ -1228,6 +1226,18 @@ class ActionInputAll extends BaseAction {
o
.
setPassword
(
Crypto
.
encrypt
(
o
.
getPassword
(),
Config
.
token
().
getKey
()));
}
}
private
String
saveAttachment
(
byte
[]
bytes
,
String
attachmentName
,
EffectivePerson
effectivePerson
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
StorageMapping
gfMapping
=
ThisApplication
.
context
().
storageMappings
().
random
(
GeneralFile
.
class
);
GeneralFile
generalFile
=
new
GeneralFile
(
gfMapping
.
getName
(),
attachmentName
,
effectivePerson
.
getDistinguishedName
());
generalFile
.
saveContent
(
gfMapping
,
bytes
,
attachmentName
);
emc
.
beginTransaction
(
GeneralFile
.
class
);
emc
.
persist
(
generalFile
,
CheckPersistType
.
all
);
emc
.
commit
();
return
generalFile
.
getId
();
}
}
public
static
class
Wo
extends
GsonPropertyObject
{
...
...
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ExceptionInputResultObject.java
0 → 100644
浏览文件 @
a9e9b0ad
package
com.x.organization.assemble.control.jaxrs.inputperson
;
import
com.x.base.core.project.exception.PromptException
;
public
class
ExceptionInputResultObject
extends
PromptException
{
private
static
final
long
serialVersionUID
=
9085364457175859374L
;
ExceptionInputResultObject
(
String
flag
)
{
super
(
"对象不存在:{}."
,
flag
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录