Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
b5740e37
o2oa
项目概览
ghsby
/
o2oa
落后 Fork 源项目 2880 个版本
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
1
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,发现更多精彩内容 >>
提交
b5740e37
编写于
7月 06, 2021
作者:
O
o2null
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'fix/org_input521' into 'develop_java8'
优化人员组织导入 See merge request o2oa/o2oa!4402
上级
95982a82
168fcd45
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
418 addition
and
291 deletion
+418
-291
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/export/ActionExportAll.java
...zation/assemble/control/jaxrs/export/ActionExportAll.java
+143
-60
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionInputAll.java
...on/assemble/control/jaxrs/inputperson/ActionInputAll.java
+190
-182
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionTemplate.java
...on/assemble/control/jaxrs/inputperson/ActionTemplate.java
+6
-4
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionWipeAll.java
...ion/assemble/control/jaxrs/inputperson/ActionWipeAll.java
+54
-17
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/DutySheetConfigurator.java
...mble/control/jaxrs/inputperson/DutySheetConfigurator.java
+23
-7
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ExceptionDutyCodeColumnEmpty.java
...ntrol/jaxrs/inputperson/ExceptionDutyCodeColumnEmpty.java
+1
-1
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/IdentityItem.java
...tion/assemble/control/jaxrs/inputperson/IdentityItem.java
+0
-9
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/IdentitySheetConfigurator.java
.../control/jaxrs/inputperson/IdentitySheetConfigurator.java
+1
-10
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/PersonSheetConfigurator.java
...le/control/jaxrs/inputperson/PersonSheetConfigurator.java
+0
-1
未找到文件。
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/export/ActionExportAll.java
浏览文件 @
b5740e37
package
com.x.organization.assemble.control.jaxrs.export
;
import
java.io.ByteArrayOutputStream
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
javax.persistence.EntityManager
;
import
javax.persistence.criteria.CriteriaBuilder
;
...
...
@@ -13,18 +11,13 @@ import javax.persistence.criteria.Predicate;
import
javax.persistence.criteria.Root
;
import
javax.servlet.http.HttpServletRequest
;
import
com.x.base.core.project.connection.ActionResponse
;
import
com.x.base.core.project.tools.DateTools
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.base.core.project.x_organization_assemble_control
;
import
com.x.organization.assemble.control.Business
;
import
com.x.organization.core.entity.Group
;
import
com.x.organization.core.entity.Identity
;
import
com.x.organization.core.entity.Person
;
import
com.x.organization.core.entity.PersonAttribute
;
import
com.x.organization.core.entity.PersonAttribute_
;
import
com.x.organization.core.entity.Unit
;
import
com.x.organization.core.entity.UnitDuty
;
import
com.x.organization.core.entity.UnitDuty_
;
import
com.x.organization.core.entity.Unit_
;
import
com.x.organization.assemble.control.ThisApplication
;
import
com.x.organization.core.entity.*
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
...
...
@@ -47,7 +40,9 @@ public class ActionExportAll extends BaseAction {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionExportAll
.
class
);
List
<
Unit
>
allUnitList
=
new
ArrayList
<>();
List
<
String
>
allUnitAttributeList
=
new
ArrayList
<>();
List
<
Person
>
allPersonList
=
new
ArrayList
<>();
List
<
String
>
allPersonAttributeList
=
new
ArrayList
<>();
List
<
Identity
>
allIdentityList
=
new
ArrayList
<>();
List
<
UnitDuty
>
allDutyList
=
new
ArrayList
<>();
List
<
Group
>
allGroupList
=
new
ArrayList
<>();
...
...
@@ -79,31 +74,21 @@ public class ActionExportAll extends BaseAction {
//创建说明sheet
this
.
createNoticeSheet
();
// 将组织信息结果组织成EXCEL
if
(
ListTools
.
isNotEmpty
(
allUnitList
)
)
{
this
.
composeUnit
(
business
,
"组织信息"
,
allUnitList
);
}
// 将人员基础信息结果组织成EXCEL
if
(
ListTools
.
isNotEmpty
(
allPersonList
)
)
{
this
.
composePerson
(
business
,
"人员基本信息"
,
allPersonList
);
}
// 将组织信息结果组织成EXCEL
this
.
composeUnit
(
business
,
"组织信息"
,
allUnitList
);
// 将人员身份信息结果组织成EXCEL
if
(
ListTools
.
isNotEmpty
(
allPersonList
)
)
{
this
.
composeIdentity
(
business
,
"人员身份信息"
,
allIdentityList
);
}
// 将职务信息结果组织成EXCEL
if
(
ListTools
.
isNotEmpty
(
allDutyList
)
)
{
this
.
composeDuty
(
business
,
"职务信息"
,
allDutyList
);
}
// 将群组信息结果组织成EXCEL
if
(
ListTools
.
isNotEmpty
(
allGroupList
)
)
{
this
.
composeGroup
(
business
,
"群组信息"
,
allGroupList
);
}
// 将人员基础信息结果组织成EXCEL
this
.
composePerson
(
business
,
"人员基本信息"
,
allPersonList
);
// 将人员身份信息结果组织成EXCEL
this
.
composeIdentity
(
business
,
"人员身份信息"
,
allIdentityList
);
// 将职务信息结果组织成EXCEL
this
.
composeDuty
(
business
,
"职务信息"
,
allDutyList
);
// 将群组信息结果组织成EXCEL
this
.
composeGroup
(
business
,
"群组信息"
,
allGroupList
);
if
(
wb
!=
null
)
{
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
try
{
...
...
@@ -134,6 +119,17 @@ public class ActionExportAll extends BaseAction {
if
(
ListTools
.
isNotEmpty
(
allUnitList
)){
allUnitList
=
business
.
unit
().
sort
(
allUnitList
);
for
(
Unit
unit:
allUnitList
){
List
<
UnitAttribute
>
us
=
this
.
ListUnitAttributes
(
"unitattribute/list/unit/"
,
unit
.
getId
());
if
(
ListTools
.
isNotEmpty
(
us
)){
for
(
UnitAttribute
u
:
us
){
String
uName
=
u
.
getName
();
if
(
StringUtils
.
isNotEmpty
(
uName
)
&&
!
allUnitAttributeList
.
contains
(
uName
)){
allUnitAttributeList
.
add
(
uName
);
}
}
}
}
}
}
...
...
@@ -143,6 +139,17 @@ public class ActionExportAll extends BaseAction {
CriteriaQuery
<
Person
>
cq
=
cb
.
createQuery
(
Person
.
class
);
Root
<
Person
>
root
=
cq
.
from
(
Person
.
class
);
allPersonList
=
em
.
createQuery
(
cq
.
select
(
root
)).
getResultList
();
if
(
ListTools
.
isNotEmpty
(
allPersonList
)){
for
(
Person
person:
allPersonList
){
List
<
PersonAttribute
>
ps
=
this
.
listAttributeWithPerson
(
business
,
person
.
getId
());
for
(
PersonAttribute
o:
ps
){
String
pName
=
o
.
getName
();
if
(
StringUtils
.
isNotEmpty
(
pName
)
&&
!
allPersonAttributeList
.
contains
(
pName
)){
allPersonAttributeList
.
add
(
pName
);
}
}
}
}
}
private
void
listIdentity
(
Business
business
)
throws
Exception
{
...
...
@@ -228,6 +235,11 @@ public class ActionExportAll extends BaseAction {
row
.
createCell
(
3
).
setCellValue
(
"上级组织编号"
);
row
.
createCell
(
4
).
setCellValue
(
"描述"
);
row
.
createCell
(
5
).
setCellValue
(
"排序号"
);
if
(
ListTools
.
isNotEmpty
(
allUnitAttributeList
)){
for
(
int
n
=
0
;
n
<
allUnitAttributeList
.
size
();
n
++){
row
.
createCell
(
5
+
n
+
1
).
setCellValue
(
"("
+
allUnitAttributeList
.
get
(
n
)+
")"
);
}
}
for
(
int
i
=
0
;
i
<
unitList
.
size
();
i
++)
{
unit
=
unitList
.
get
(
i
);
...
...
@@ -255,7 +267,20 @@ public class ActionExportAll extends BaseAction {
}
row
.
createCell
(
4
).
setCellValue
(
unit
.
getDescription
());
row
.
createCell
(
5
).
setCellValue
(
unit
.
getOrderNumber
()+
""
);
List
<
UnitAttribute
>
os
=
this
.
ListUnitAttributes
(
"unitattribute/list/unit/"
,
unit
.
getId
());
if
(
ListTools
.
isNotEmpty
(
allUnitAttributeList
)
&&
ListTools
.
isNotEmpty
(
os
)){
for
(
int
m
=
0
;
m
<
allUnitAttributeList
.
size
();
m
++){
String
uName
=
allUnitAttributeList
.
get
(
m
);
String
uValue
=
""
;
for
(
UnitAttribute
o
:
os
){
if
(
uName
.
equals
(
o
.
getName
())){
//uValue = o.getAttributeList().toString();
uValue
=
String
.
join
(
","
,
o
.
getAttributeList
().
stream
().
map
(
String:
:
valueOf
).
collect
(
Collectors
.
toList
()));
}
}
row
.
createCell
(
5
+
m
+
1
).
setCellValue
(
uValue
);
}
}
}
}
}
...
...
@@ -277,6 +302,11 @@ public class ActionExportAll extends BaseAction {
row
.
createCell
(
4
).
setCellValue
(
"办公电话"
);
row
.
createCell
(
5
).
setCellValue
(
"性别"
);
row
.
createCell
(
6
).
setCellValue
(
"邮件"
);
if
(
ListTools
.
isNotEmpty
(
allPersonAttributeList
)){
for
(
int
n
=
0
;
n
<
allPersonAttributeList
.
size
();
n
++){
row
.
createCell
(
6
+
n
+
1
).
setCellValue
(
"("
+
allPersonAttributeList
.
get
(
n
)+
")"
);
}
}
for
(
int
i
=
0
;
i
<
personList
.
size
();
i
++)
{
person
=
personList
.
get
(
i
);
...
...
@@ -288,6 +318,20 @@ public class ActionExportAll extends BaseAction {
row
.
createCell
(
4
).
setCellValue
(
person
.
getOfficePhone
());
row
.
createCell
(
5
).
setCellValue
(
Objects
.
toString
(
person
.
getGenderType
(),
""
));
row
.
createCell
(
6
).
setCellValue
(
person
.
getMail
());
List
<
PersonAttribute
>
os
=
this
.
listAttributeWithPerson
(
business
,
person
.
getId
());
if
(
ListTools
.
isNotEmpty
(
allPersonAttributeList
)
&&
ListTools
.
isNotEmpty
(
os
)){
for
(
int
m
=
0
;
m
<
allPersonAttributeList
.
size
();
m
++){
String
pName
=
allPersonAttributeList
.
get
(
m
);
String
pValue
=
""
;
for
(
PersonAttribute
o
:
os
){
if
(
pName
.
equals
(
o
.
getName
())){
//pValue = o.getAttributeList().toString();
pValue
=
String
.
join
(
","
,
o
.
getAttributeList
().
stream
().
map
(
String:
:
valueOf
).
collect
(
Collectors
.
toList
()));
}
}
row
.
createCell
(
6
+
m
+
1
).
setCellValue
(
pValue
);
}
}
}
}
}
...
...
@@ -304,8 +348,7 @@ public class ActionExportAll extends BaseAction {
row
=
sheet
.
createRow
(
0
);
row
.
createCell
(
0
).
setCellValue
(
"人员唯一编码 *"
);
row
.
createCell
(
1
).
setCellValue
(
"组织唯一编码 *"
);
row
.
createCell
(
2
).
setCellValue
(
"职务编号"
);
row
.
createCell
(
3
).
setCellValue
(
"主兼职"
);
row
.
createCell
(
2
).
setCellValue
(
"主兼职"
);
for
(
int
i
=
0
;
i
<
identityList
.
size
();
i
++)
{
identity
=
identityList
.
get
(
i
);
...
...
@@ -315,22 +358,21 @@ public class ActionExportAll extends BaseAction {
if
(
person
!=
null
){
row
.
createCell
(
0
).
setCellValue
(
person
.
getUnique
());
if
(
unit
!=
null
){
String
iduty
=
""
;
List
<
String
>
idutyList
=
new
ArrayList
<>()
;
String
unitId
=
""
;
unitId
=
unit
.
getId
();
row
.
createCell
(
1
).
setCellValue
(
unit
.
getUnique
());
List
<
UnitDuty
>
unitDutyList
=
this
.
listDutyWithIdentity
(
business
,
identity
.
getId
());
/*
List<UnitDuty> unitDutyList = this.listDutyWithIdentity(business,identity.getId());
if(ListTools.isNotEmpty(unitDutyList)){
for(UnitDuty duty :unitDutyList){
if
(
unitId
.
equals
(
duty
.
getUnit
())){
iduty
=
duty
.
getUnique
(
);
}
//
if(unitId.equals(duty.getUnit())){
idutyList.add(duty.getUnique()
);
//
}
}
}
row
.
createCell
(
2
).
setCellValue
(
iduty
);
row
.
createCell
(
3
).
setCellValue
(
String
.
valueOf
(
identity
.
getMajor
()));
row.createCell(2).setCellValue(
StringUtils.join(idutyList.toArray(), "#"));*/
row
.
createCell
(
2
).
setCellValue
(
String
.
valueOf
(
identity
.
getMajor
()));
}
}
...
...
@@ -340,24 +382,64 @@ public class ActionExportAll extends BaseAction {
private
void
composeDuty
(
Business
business
,
String
sheetName
,
List
<
UnitDuty
>
dutyList
)
throws
Exception
{
UnitDuty
duty
=
null
;
EntityManagerContainer
emc
=
business
.
entityManagerContainer
();
Row
row
=
null
;
if
(
ListTools
.
isNotEmpty
(
dutyList
)
)
{
// 创建新的表格
Sheet
sheet
=
wb
.
createSheet
(
sheetName
);
// 先创建表头
row
=
sheet
.
createRow
(
0
);
row
.
createCell
(
0
).
setCellValue
(
"职务
编号
*"
);
row
.
createCell
(
1
).
setCellValue
(
"职务
名称
*"
);
row
.
createCell
(
0
).
setCellValue
(
"职务
名称
*"
);
row
.
createCell
(
1
).
setCellValue
(
"职务
所在组织唯一编码
*"
);
row
.
createCell
(
2
).
setCellValue
(
"职务描述"
);
row
.
createCell
(
3
).
setCellValue
(
"职务所含人员唯一编码"
);
row
.
createCell
(
4
).
setCellValue
(
"职务所含人员所在组织唯一编码"
);
int
currentRow
=
0
;
for
(
int
i
=
0
;
i
<
dutyList
.
size
();
i
++)
{
duty
=
dutyList
.
get
(
i
);
row
=
sheet
.
createRow
(
i
+
1
);
row
.
createCell
(
0
).
setCellValue
(
duty
.
getUnique
());
row
.
createCell
(
1
).
setCellValue
(
duty
.
getName
());
row
.
createCell
(
2
).
setCellValue
(
duty
.
getDescription
());
Unit
unit
=
emc
.
flag
(
duty
.
getUnit
(),
Unit
.
class
);
List
<
String
>
identityList
=
duty
.
getIdentityList
();
if
(
ListTools
.
isNotEmpty
(
identityList
))
{
for
(
int
j
=
0
;
j
<
identityList
.
size
();
j
++)
{
String
identityId
=
identityList
.
get
(
j
);
Identity
identity
=
emc
.
flag
(
identityId
,
Identity
.
class
);
if
(
identity
!=
null
)
{
currentRow
=
currentRow
+
1
;
row
=
sheet
.
createRow
(
currentRow
);
row
.
createCell
(
0
).
setCellValue
(
duty
.
getName
());
if
(
unit
!=
null
)
{
row
.
createCell
(
1
).
setCellValue
(
unit
.
getUnique
());
}
else
{
row
.
createCell
(
1
).
setCellValue
(
""
);
}
row
.
createCell
(
2
).
setCellValue
(
duty
.
getDescription
());
Person
iperson
=
emc
.
flag
(
identity
.
getPerson
(),
Person
.
class
);
Unit
iunit
=
emc
.
flag
(
identity
.
getUnit
(),
Unit
.
class
);
if
(
iperson
!=
null
)
{
row
.
createCell
(
3
).
setCellValue
(
iperson
.
getUnique
());
}
else
{
row
.
createCell
(
3
).
setCellValue
(
""
);
}
if
(
iunit
!=
null
)
{
row
.
createCell
(
4
).
setCellValue
(
iunit
.
getUnique
());
}
else
{
row
.
createCell
(
4
).
setCellValue
(
""
);
}
}
}
}
else
{
currentRow
=
currentRow
+
1
;
row
=
sheet
.
createRow
(
currentRow
);
row
.
createCell
(
0
).
setCellValue
(
duty
.
getName
());
if
(
unit
!=
null
)
{
row
.
createCell
(
1
).
setCellValue
(
unit
.
getUnique
());
}
else
{
row
.
createCell
(
1
).
setCellValue
(
""
);
}
row
.
createCell
(
2
).
setCellValue
(
duty
.
getDescription
());
row
.
createCell
(
3
).
setCellValue
(
""
);
row
.
createCell
(
4
).
setCellValue
(
""
);
}
}
}
}
...
...
@@ -388,10 +470,6 @@ public class ActionExportAll extends BaseAction {
List
<
String
>
groupsList
=
group
.
getGroupList
();
List
<
String
>
identityList
=
group
.
getIdentityList
();
System
.
out
.
println
(
"personList="
+
personList
.
size
());
System
.
out
.
println
(
"unitList="
+
unitList
.
size
());
System
.
out
.
println
(
"groupsList="
+
groupsList
.
size
());
System
.
out
.
println
(
"identityList="
+
identityList
.
size
());
if
(
ListTools
.
isEmpty
(
personList
)
&&
ListTools
.
isEmpty
(
unitList
)
&&
ListTools
.
isEmpty
(
groupsList
)){
forNumber
=
forNumber
+
1
;
row
=
sheet
.
createRow
(
forNumber
);
...
...
@@ -491,6 +569,11 @@ public class ActionExportAll extends BaseAction {
List
<
UnitDuty
>
os
=
em
.
createQuery
(
cq
.
select
(
root
).
where
(
p
)).
getResultList
();
return
os
;
}
private
List
<
UnitAttribute
>
ListUnitAttributes
(
String
path
,
String
unitId
)
throws
Exception
{
ActionResponse
resp
=
ThisApplication
.
context
().
applications
()
.
getQuery
(
x_organization_assemble_control
.
class
,
path
+
unitId
);
return
resp
.
getDataAsList
(
UnitAttribute
.
class
);
}
public
static
class
Wo
extends
WoFile
{
public
Wo
(
byte
[]
bytes
,
String
contentType
,
String
contentDisposition
)
{
...
...
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionInputAll.java
浏览文件 @
b5740e37
此差异已折叠。
点击以展开。
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionTemplate.java
浏览文件 @
b5740e37
...
...
@@ -122,8 +122,6 @@ public class ActionTemplate extends BaseAction {
cell
=
row
.
createCell
(
1
);
cell
.
setCellValue
(
"组织唯一编码 *"
);
cell
=
row
.
createCell
(
2
);
cell
.
setCellValue
(
"职务编号"
);
cell
=
row
.
createCell
(
3
);
cell
.
setCellValue
(
"主兼职"
);
CellStyle
cellStyle
=
workbook
.
createCellStyle
();
cellStyle
.
setWrapText
(
true
);
...
...
@@ -136,11 +134,15 @@ public class ActionTemplate extends BaseAction {
XSSFSheet
sheet
=
workbook
.
createSheet
(
"职务信息"
);
Row
row
=
sheet
.
createRow
(
0
);
Cell
cell
=
row
.
createCell
(
0
);
cell
.
setCellValue
(
"职务编号 *"
);
cell
=
row
.
createCell
(
1
);
cell
.
setCellValue
(
"职务名称 *"
);
cell
=
row
.
createCell
(
1
);
cell
.
setCellValue
(
"职务所在组织唯一编码 *"
);
cell
=
row
.
createCell
(
2
);
cell
.
setCellValue
(
"职务描述"
);
cell
=
row
.
createCell
(
3
);
cell
.
setCellValue
(
"职务所含人员唯一编码"
);
cell
=
row
.
createCell
(
4
);
cell
.
setCellValue
(
"职务所含人员所在组织唯一编码"
);
CellStyle
cellStyle
=
workbook
.
createCellStyle
();
cellStyle
.
setWrapText
(
true
);
IntStream
.
rangeClosed
(
0
,
6
).
forEach
(
i
->
{
...
...
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionWipeAll.java
浏览文件 @
b5740e37
...
...
@@ -15,16 +15,7 @@ import com.x.base.core.project.cache.CacheManager;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.organization.assemble.control.Business
;
import
com.x.organization.assemble.control.ThisApplication
;
import
com.x.organization.core.entity.Group
;
import
com.x.organization.core.entity.Group_
;
import
com.x.organization.core.entity.Identity
;
import
com.x.organization.core.entity.Person
;
import
com.x.organization.core.entity.PersonAttribute
;
import
com.x.organization.core.entity.PersonAttribute_
;
import
com.x.organization.core.entity.Unit
;
import
com.x.organization.core.entity.UnitDuty
;
import
com.x.organization.core.entity.UnitDuty_
;
import
com.x.organization.core.entity.Unit_
;
import
com.x.organization.core.entity.*
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckRemoveType
;
...
...
@@ -44,7 +35,9 @@ public class ActionWipeAll extends BaseAction {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionWipeAll
.
class
);
List
<
Unit
>
allUnitList
=
new
ArrayList
<>();
List
<
UnitAttribute
>
allUnitAttributeList
=
new
ArrayList
<>();
List
<
Person
>
allPersonList
=
new
ArrayList
<>();
List
<
PersonAttribute
>
allPersonAttributeList
=
new
ArrayList
<>();
List
<
Identity
>
allIdentityList
=
new
ArrayList
<>();
List
<
UnitDuty
>
allDutyList
=
new
ArrayList
<>();
List
<
Group
>
allGroupList
=
new
ArrayList
<>();
...
...
@@ -56,10 +49,12 @@ public class ActionWipeAll extends BaseAction {
// 先获取需要删除的数据
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
System
.
out
.
println
(
"开始删除人员组织所有数据--------start"
);
logger
.
info
(
"开始删除人员组织所有数据--------start"
);
business
=
new
Business
(
emc
);
this
.
listUnit
(
business
);
this
.
listPerson
(
business
);
this
.
listUnitAttribute
(
business
);
this
.
listPersonAttribute
(
business
);
this
.
listIdentity
(
business
);
this
.
listDuty
(
business
);
this
.
listGroup
(
business
);
...
...
@@ -69,26 +64,34 @@ public class ActionWipeAll extends BaseAction {
emc
.
beginTransaction
(
Identity
.
class
);
emc
.
beginTransaction
(
Person
.
class
);
//emc.beginTransaction( Unit.class );
System
.
out
.
println
(
"开始删除职务--------"
);
logger
.
info
(
"开始删除职务--------"
);
this
.
deleteDutys
(
emc
,
business
);
System
.
out
.
println
(
"开始删除群组--------"
);
logger
.
info
(
"开始删除群组--------"
);
this
.
deleteGroups
(
emc
,
business
);
System
.
out
.
println
(
"开始删除身份--------"
);
logger
.
info
(
"开始删除身份--------"
);
this
.
deleteIdentitys
(
emc
,
business
);
System
.
out
.
println
(
"开始删除人员--------"
);
logger
.
info
(
"开始删除人员属性--------"
);
this
.
deletePersonAttributes
(
emc
,
business
);
logger
.
info
(
"开始删除组织属性--------"
);
this
.
deleteUnitAttributes
(
emc
,
business
);
logger
.
info
(
"开始删除人员--------"
);
this
.
deletePersons
(
emc
,
business
);
System
.
out
.
println
(
"开始删除组织--------"
);
logger
.
info
(
"开始删除组织--------"
);
this
.
deleteUnits
(
emc
,
business
);
emc
.
commit
();
CacheManager
.
notify
(
UnitDuty
.
class
);
CacheManager
.
notify
(
Group
.
class
);
CacheManager
.
notify
(
Identity
.
class
);
CacheManager
.
notify
(
PersonAttribute
.
class
);
CacheManager
.
notify
(
UnitAttribute
.
class
);
CacheManager
.
notify
(
Person
.
class
);
CacheManager
.
notify
(
Unit
.
class
);
wo
.
setFlag
(
"清空人员数据成功"
);
System
.
out
.
println
(
"开始删除人员组织所有数据--------end"
);
logger
.
info
(
"开始删除人员组织所有数据--------end"
);
}
catch
(
Exception
e
)
{
logger
.
info
(
"系统在查询所有组织人员信息时发生异常。"
);
wo
.
setFlag
(
"清空人员数据失败"
);
...
...
@@ -118,6 +121,13 @@ public class ActionWipeAll extends BaseAction {
allUnitList
=
allUnitList
.
stream
().
sorted
(
Comparator
.
comparing
(
Unit:
:
getLevel
).
reversed
()).
collect
(
Collectors
.
toList
());
}
}
private
void
listUnitAttribute
(
Business
business
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
UnitAttribute
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
UnitAttribute
>
cq
=
cb
.
createQuery
(
UnitAttribute
.
class
);
Root
<
UnitAttribute
>
root
=
cq
.
from
(
UnitAttribute
.
class
);
allUnitAttributeList
=
em
.
createQuery
(
cq
.
select
(
root
)).
getResultList
();
}
private
void
listPerson
(
Business
business
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Person
.
class
);
...
...
@@ -126,6 +136,13 @@ public class ActionWipeAll extends BaseAction {
Root
<
Person
>
root
=
cq
.
from
(
Person
.
class
);
allPersonList
=
em
.
createQuery
(
cq
.
select
(
root
)).
getResultList
();
}
private
void
listPersonAttribute
(
Business
business
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
PersonAttribute
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
PersonAttribute
>
cq
=
cb
.
createQuery
(
PersonAttribute
.
class
);
Root
<
PersonAttribute
>
root
=
cq
.
from
(
PersonAttribute
.
class
);
allPersonAttributeList
=
em
.
createQuery
(
cq
.
select
(
root
)).
getResultList
();
}
private
void
listIdentity
(
Business
business
)
throws
Exception
{
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Identity
.
class
);
...
...
@@ -165,6 +182,26 @@ public class ActionWipeAll extends BaseAction {
List
<
Unit
>
os
=
business
.
unit
().
listSubNestedObject
(
unit
);
return
os
;
}
private
void
deletePersonAttributes
(
EntityManagerContainer
emc
,
Business
business
)
throws
Exception
{
if
(
ListTools
.
isNotEmpty
(
allPersonAttributeList
)){
for
(
PersonAttribute
pa
:
allPersonAttributeList
){
business
.
entityManagerContainer
().
beginTransaction
(
PersonAttribute
.
class
);
business
.
entityManagerContainer
().
remove
(
pa
,
CheckRemoveType
.
all
);
}
business
.
entityManagerContainer
().
commit
();
}
}
private
void
deleteUnitAttributes
(
EntityManagerContainer
emc
,
Business
business
)
throws
Exception
{
if
(
ListTools
.
isNotEmpty
(
allUnitAttributeList
)){
for
(
UnitAttribute
ua
:
allUnitAttributeList
){
business
.
entityManagerContainer
().
beginTransaction
(
UnitAttribute
.
class
);
business
.
entityManagerContainer
().
remove
(
ua
,
CheckRemoveType
.
all
);
}
business
.
entityManagerContainer
().
commit
();
}
}
private
void
deleteUnits
(
EntityManagerContainer
emc
,
Business
business
)
throws
Exception
{
if
(
ListTools
.
isNotEmpty
(
allUnitList
)){
...
...
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/DutySheetConfigurator.java
浏览文件 @
b5740e37
...
...
@@ -26,8 +26,10 @@ public class DutySheetConfigurator extends GsonPropertyObject {
private
Integer
lastRow
;
private
Integer
nameColumn
;
private
Integer
unique
Column
;
private
Integer
iunit
Column
;
private
Integer
descriptionColumn
;
private
Integer
unitColumn
;
private
Integer
ipersonColumn
;
private
Map
<
String
,
Integer
>
attributes
=
new
HashMap
<>();
...
...
@@ -43,13 +45,17 @@ public class DutySheetConfigurator extends GsonPropertyObject {
String
str
=
this
.
getCellStringValue
(
cell
);
//System.out.println("str="+str+"----i="+i);
if
(
StringUtils
.
isNotEmpty
(
str
))
{
if
(
unique
Items
.
contains
(
str
))
{
this
.
unique
Column
=
i
;
if
(
iunit
Items
.
contains
(
str
))
{
this
.
iunit
Column
=
i
;
}
else
if
(
nameItems
.
contains
(
str
))
{
this
.
nameColumn
=
i
;
}
else
if
(
descriptionItems
.
contains
(
str
))
{
this
.
descriptionColumn
=
i
;
}
else
{
}
else
if
(
unitItems
.
contains
(
str
)){
this
.
unitColumn
=
i
;
}
else
if
(
ipersonItems
.
contains
(
str
)){
this
.
ipersonColumn
=
i
;
}
else
{
Matcher
matcher
=
attributePattern
.
matcher
(
str
);
if
(
matcher
.
matches
())
{
String
attribute
=
matcher
.
group
(
1
);
...
...
@@ -61,9 +67,11 @@ public class DutySheetConfigurator extends GsonPropertyObject {
}
}
private
static
List
<
String
>
uniqueItems
=
Arrays
.
asList
(
new
String
[]
{
"职务编号 *"
,
"unique"
});
private
static
List
<
String
>
nameItems
=
Arrays
.
asList
(
new
String
[]
{
"职务名称 *"
,
"name"
});
private
static
List
<
String
>
unitItems
=
Arrays
.
asList
(
new
String
[]
{
"职务所在组织唯一编码 *"
,
"unit"
});
private
static
List
<
String
>
descriptionItems
=
Arrays
.
asList
(
new
String
[]
{
"描述"
,
"职务描述"
,
"description"
});
private
static
List
<
String
>
ipersonItems
=
Arrays
.
asList
(
new
String
[]
{
"职务所含人员唯一编码"
,
"iperson"
});
private
static
List
<
String
>
iunitItems
=
Arrays
.
asList
(
new
String
[]
{
"职务所含人员所在组织唯一编码"
,
"iunit"
});
public
String
getCellStringValue
(
Cell
cell
)
{
if
(
null
!=
cell
)
{
...
...
@@ -95,14 +103,22 @@ public class DutySheetConfigurator extends GsonPropertyObject {
return
memoColumn
;
}
public
Integer
get
Unique
Column
()
{
return
unique
Column
;
public
Integer
get
Iunit
Column
()
{
return
iunit
Column
;
}
public
Integer
getNameColumn
()
{
return
nameColumn
;
}
public
Integer
getUnitColumn
()
{
return
unitColumn
;
}
public
Integer
getIpersonColumn
()
{
return
ipersonColumn
;
}
public
Map
<
String
,
Integer
>
getAttributes
()
{
return
attributes
;
}
...
...
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ExceptionDutyCodeColumnEmpty.java
浏览文件 @
b5740e37
...
...
@@ -7,6 +7,6 @@ class ExceptionDutyCodeColumnEmpty extends PromptException {
private
static
final
long
serialVersionUID
=
-
2139584911736169462L
;
ExceptionDutyCodeColumnEmpty
()
{
super
(
"职务
编号
列不能为空."
);
super
(
"职务
所在组织唯一编码
列不能为空."
);
}
}
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/IdentityItem.java
浏览文件 @
b5740e37
...
...
@@ -13,7 +13,6 @@ public class IdentityItem extends GsonPropertyObject {
private
String
personCode
;
private
String
unitCode
;
private
String
dutyCode
;
private
Boolean
major
;
...
...
@@ -82,14 +81,6 @@ public class IdentityItem extends GsonPropertyObject {
public
void
setUnitCode
(
String
unitCode
)
{
this
.
unitCode
=
unitCode
;
}
public
String
getDutyCode
()
{
return
dutyCode
;
}
public
void
setDutyCode
(
String
dutyCode
)
{
this
.
dutyCode
=
dutyCode
;
}
public
Boolean
getMajor
()
{
return
major
;
...
...
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/IdentitySheetConfigurator.java
浏览文件 @
b5740e37
...
...
@@ -27,7 +27,6 @@ public class IdentitySheetConfigurator extends GsonPropertyObject {
private
Integer
uniqueColumn
;
private
Integer
unitCodeColumn
;
private
Integer
dutyCodeColumn
;
private
Integer
majorColumn
;
private
Map
<
String
,
Integer
>
attributes
=
new
HashMap
<>();
...
...
@@ -42,15 +41,12 @@ public class IdentitySheetConfigurator extends GsonPropertyObject {
Cell
cell
=
row
.
getCell
(
i
);
if
(
null
!=
cell
)
{
String
str
=
this
.
getCellStringValue
(
cell
);
System
.
out
.
println
(
"identityStr = "
+
str
);
if
(
StringUtils
.
isNotEmpty
(
str
))
{
if
(
uniqueItems
.
contains
(
str
))
{
this
.
uniqueColumn
=
i
;
}
else
if
(
unitCodeItems
.
contains
(
str
))
{
this
.
unitCodeColumn
=
i
;
}
else
if
(
dutyCodeItems
.
contains
(
str
))
{
this
.
dutyCodeColumn
=
i
;
}
else
if
(
majorItems
.
contains
(
str
))
{
}
else
if
(
majorItems
.
contains
(
str
))
{
this
.
majorColumn
=
i
;
}
else
{
Matcher
matcher
=
attributePattern
.
matcher
(
str
);
...
...
@@ -66,7 +62,6 @@ public class IdentitySheetConfigurator extends GsonPropertyObject {
private
static
List
<
String
>
uniqueItems
=
Arrays
.
asList
(
new
String
[]
{
"人员唯一编码 *"
,
"员工账号 *"
,
"unique"
});
private
static
List
<
String
>
unitCodeItems
=
Arrays
.
asList
(
new
String
[]
{
"组织编号 *"
,
"组织唯一编码 *"
,
"unitCode"
});
private
static
List
<
String
>
dutyCodeItems
=
Arrays
.
asList
(
new
String
[]
{
"职务编号"
,
"dutyCode"
});
private
static
List
<
String
>
majorItems
=
Arrays
.
asList
(
new
String
[]
{
"主兼职"
,
"major"
});
public
String
getCellStringValue
(
Cell
cell
)
{
...
...
@@ -107,10 +102,6 @@ public class IdentitySheetConfigurator extends GsonPropertyObject {
return
unitCodeColumn
;
}
public
Integer
getDutyCodeColumn
()
{
return
dutyCodeColumn
;
}
public
Integer
getMajorColumn
()
{
return
majorColumn
;
}
...
...
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/PersonSheetConfigurator.java
浏览文件 @
b5740e37
...
...
@@ -45,7 +45,6 @@ public class PersonSheetConfigurator extends GsonPropertyObject {
Cell
cell
=
row
.
getCell
(
i
);
if
(
null
!=
cell
)
{
String
str
=
this
.
getCellStringValue
(
cell
);
System
.
out
.
println
(
"personStr = "
+
str
);
if
(
StringUtils
.
isNotEmpty
(
str
))
{
if
(
nameItems
.
contains
(
str
))
{
this
.
nameColumn
=
i
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录