Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
3a46650a
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,发现更多精彩内容 >>
提交
3a46650a
编写于
12月 03, 2020
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复根据组织查询人员信息未排序的问题
上级
1fa0bf1b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
98 addition
and
47 deletion
+98
-47
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubDirectLikeObject.java
...s/jaxrs/person/ActionListWithUnitSubDirectLikeObject.java
+26
-9
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubDirectObject.java
...press/jaxrs/person/ActionListWithUnitSubDirectObject.java
+25
-15
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubNestedLikeObject.java
...s/jaxrs/person/ActionListWithUnitSubNestedLikeObject.java
+26
-9
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubNestedObject.java
...press/jaxrs/person/ActionListWithUnitSubNestedObject.java
+21
-14
未找到文件。
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubDirectLikeObject.java
浏览文件 @
3a46650a
package
com.x.organization.assemble.express.jaxrs.person
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
javax.persistence.EntityManager
;
...
...
@@ -82,7 +80,7 @@ class ActionListWithUnitSubDirectLikeObject extends BaseAction {
}
private
List
<
Wo
>
list
(
Business
business
,
Wi
wi
,
List
<
String
>
ids
)
throws
Exception
{
private
List
<
Wo
>
list
(
Business
business
,
Wi
wi
,
List
<
Identity
>
identityList
)
throws
Exception
{
List
<
Wo
>
wos
=
new
ArrayList
<>();
String
str
=
StringUtils
.
lowerCase
(
StringTools
.
escapeSqlLikeKey
(
wi
.
getKey
()));
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Person
.
class
);
...
...
@@ -95,26 +93,45 @@ class ActionListWithUnitSubDirectLikeObject extends BaseAction {
p
=
cb
.
or
(
p
,
cb
.
like
(
cb
.
lower
(
root
.
get
(
Person_
.
pinyinInitial
)),
str
+
"%"
,
StringTools
.
SQL_ESCAPE_CHAR
));
p
=
cb
.
or
(
p
,
cb
.
like
(
cb
.
lower
(
root
.
get
(
Person_
.
mobile
)),
str
+
"%"
,
StringTools
.
SQL_ESCAPE_CHAR
));
p
=
cb
.
or
(
p
,
cb
.
like
(
cb
.
lower
(
root
.
get
(
Person_
.
distinguishedName
)),
str
+
"%"
,
StringTools
.
SQL_ESCAPE_CHAR
));
p
=
cb
.
and
(
p
,
cb
.
isMember
(
root
.
get
(
Person_
.
id
),
cb
.
literal
(
ids
)));
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
if
(
ListTools
.
isNotEmpty
(
identityList
))
{
for
(
Identity
identity
:
identityList
){
map
.
put
(
identity
.
getPerson
(),
identity
.
getOrderNumber
());
}
p
=
cb
.
and
(
p
,
cb
.
isMember
(
root
.
get
(
Person_
.
id
),
cb
.
literal
(
map
.
keySet
())));
}
List
<
String
>
list
=
em
.
createQuery
(
cq
.
select
(
root
.
get
(
Person_
.
id
)).
where
(
p
))
.
getResultList
().
stream
().
distinct
().
collect
(
Collectors
.
toList
());
for
(
Person
o
:
business
.
person
().
pick
(
list
))
{
if
(!
map
.
isEmpty
()){
o
.
setOrderNumber
(
map
.
get
(
o
.
getId
()));
}
wos
.
add
(
this
.
convert
(
business
,
o
,
Wo
.
class
));
}
wos
=
wos
.
stream
()
.
sorted
(
Comparator
.
comparing
(
Wo:
:
getOrderNumber
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))
.
thenComparing
(
Comparator
.
comparing
(
Wo:
:
getName
,
Comparator
.
nullsFirst
(
String:
:
compareTo
)).
reversed
()))
.
collect
(
Collectors
.
toList
());
return
wos
;
}
private
List
<
String
>
people
(
Business
business
,
Wi
wi
)
throws
Exception
{
private
List
<
Identity
>
people
(
Business
business
,
Wi
wi
)
throws
Exception
{
List
<
Unit
>
os
=
business
.
unit
().
pick
(
wi
.
getUnitList
());
List
<
String
>
unitIds
=
ListTools
.
extractField
(
os
,
Unit
.
id_FIELDNAME
,
String
.
class
,
true
,
true
);
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Identity
.
class
);
List
<
Identity
>
list
=
new
ArrayList
<>();
if
(
ListTools
.
isNotEmpty
(
unitIds
))
{
list
=
business
.
entityManagerContainer
().
fetchIn
(
Identity
.
class
,
ListTools
.
toList
(
Identity
.
id_FIELDNAME
,
Identity
.
person_FIELDNAME
,
Identity
.
orderNumber_FIELDNAME
),
Identity
.
unit_FIELDNAME
,
unitIds
);
}
/*EntityManager em = business.entityManagerContainer().get(Identity.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Identity> root = cq.from(Identity.class);
Predicate p = root.get(Identity_.unit).in(unitIds);
List<String> list = em.createQuery(cq.select(root.get(Identity_.person)).where(p))
.
getResultList
().
stream
().
distinct
().
collect
(
Collectors
.
toList
());
.getResultList().stream().distinct().collect(Collectors.toList());
*/
return
list
;
}
}
\ No newline at end of file
}
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubDirectObject.java
浏览文件 @
3a46650a
package
com.x.organization.assemble.express.jaxrs.person
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
javax.persistence.EntityManager
;
...
...
@@ -72,20 +70,32 @@ class ActionListWithUnitSubDirectObject extends BaseAction {
List
<
Unit
>
os
=
business
.
unit
().
pick
(
wi
.
getUnitList
());
List
<
String
>
unitIds
=
new
ArrayList
<>();
for
(
Unit
o
:
os
)
{
unitIds
.
add
(
o
.
getId
());
if
(!
unitIds
.
contains
(
o
.
getId
()))
{
unitIds
.
add
(
o
.
getId
());
}
}
unitIds
=
ListTools
.
trim
(
unitIds
,
true
,
true
);
List
<
Identity
>
list
=
new
ArrayList
<>();
if
(
ListTools
.
isNotEmpty
(
unitIds
))
{
list
=
business
.
entityManagerContainer
().
fetchIn
(
Identity
.
class
,
ListTools
.
toList
(
Identity
.
id_FIELDNAME
,
Identity
.
person_FIELDNAME
,
Identity
.
orderNumber_FIELDNAME
),
Identity
.
unit_FIELDNAME
,
unitIds
);
}
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Identity
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
Identity
>
root
=
cq
.
from
(
Identity
.
class
);
Predicate
p
=
root
.
get
(
Identity_
.
unit
).
in
(
unitIds
);
List
<
String
>
personIds
=
em
.
createQuery
(
cq
.
select
(
root
.
get
(
Identity_
.
person
)).
where
(
p
))
.
getResultList
().
stream
().
distinct
().
collect
(
Collectors
.
toList
());
personIds
=
ListTools
.
trim
(
personIds
,
true
,
true
);
for
(
Person
o
:
business
.
person
().
pick
(
personIds
))
{
wos
.
add
(
this
.
convert
(
business
,
o
,
Wo
.
class
));
if
(
ListTools
.
isNotEmpty
(
list
))
{
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
for
(
Identity
identity
:
list
){
map
.
put
(
identity
.
getPerson
(),
identity
.
getOrderNumber
());
}
for
(
Person
o
:
business
.
person
().
pick
(
new
ArrayList
<>(
map
.
keySet
())))
{
o
.
setOrderNumber
(
map
.
get
(
o
.
getId
()));
wos
.
add
(
this
.
convert
(
business
,
o
,
Wo
.
class
));
}
wos
=
wos
.
stream
()
.
sorted
(
Comparator
.
comparing
(
Wo:
:
getOrderNumber
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))
.
thenComparing
(
Comparator
.
comparing
(
Wo:
:
getName
,
Comparator
.
nullsFirst
(
String:
:
compareTo
)).
reversed
()))
.
collect
(
Collectors
.
toList
());
}
return
wos
;
}
}
\ No newline at end of file
}
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubNestedLikeObject.java
浏览文件 @
3a46650a
package
com.x.organization.assemble.express.jaxrs.person
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
javax.persistence.EntityManager
;
...
...
@@ -82,7 +80,7 @@ class ActionListWithUnitSubNestedLikeObject extends BaseAction {
}
private
List
<
Wo
>
list
(
Business
business
,
Wi
wi
,
List
<
String
>
ids
)
throws
Exception
{
private
List
<
Wo
>
list
(
Business
business
,
Wi
wi
,
List
<
Identity
>
identityList
)
throws
Exception
{
List
<
Wo
>
wos
=
new
ArrayList
<>();
String
str
=
StringUtils
.
lowerCase
(
StringTools
.
escapeSqlLikeKey
(
wi
.
getKey
()));
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Person
.
class
);
...
...
@@ -95,16 +93,30 @@ class ActionListWithUnitSubNestedLikeObject extends BaseAction {
p
=
cb
.
or
(
p
,
cb
.
like
(
cb
.
lower
(
root
.
get
(
Person_
.
pinyinInitial
)),
str
+
"%"
,
StringTools
.
SQL_ESCAPE_CHAR
));
p
=
cb
.
or
(
p
,
cb
.
like
(
cb
.
lower
(
root
.
get
(
Person_
.
mobile
)),
str
+
"%"
,
StringTools
.
SQL_ESCAPE_CHAR
));
p
=
cb
.
or
(
p
,
cb
.
like
(
cb
.
lower
(
root
.
get
(
Person_
.
distinguishedName
)),
str
+
"%"
,
StringTools
.
SQL_ESCAPE_CHAR
));
p
=
cb
.
and
(
p
,
cb
.
isMember
(
root
.
get
(
Person_
.
id
),
cb
.
literal
(
ids
)));
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
if
(
ListTools
.
isNotEmpty
(
identityList
))
{
for
(
Identity
identity
:
identityList
){
map
.
put
(
identity
.
getPerson
(),
identity
.
getOrderNumber
());
}
p
=
cb
.
and
(
p
,
cb
.
isMember
(
root
.
get
(
Person_
.
id
),
cb
.
literal
(
map
.
keySet
())));
}
List
<
String
>
list
=
em
.
createQuery
(
cq
.
select
(
root
.
get
(
Person_
.
id
)).
where
(
p
))
.
getResultList
().
stream
().
distinct
().
collect
(
Collectors
.
toList
());
for
(
Person
o
:
business
.
person
().
pick
(
list
))
{
if
(!
map
.
isEmpty
()){
o
.
setOrderNumber
(
map
.
get
(
o
.
getId
()));
}
wos
.
add
(
this
.
convert
(
business
,
o
,
Wo
.
class
));
}
wos
=
wos
.
stream
()
.
sorted
(
Comparator
.
comparing
(
Wo:
:
getOrderNumber
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))
.
thenComparing
(
Comparator
.
comparing
(
Wo:
:
getName
,
Comparator
.
nullsFirst
(
String:
:
compareTo
)).
reversed
()))
.
collect
(
Collectors
.
toList
());
return
wos
;
}
private
List
<
String
>
people
(
Business
business
,
Wi
wi
)
throws
Exception
{
private
List
<
Identity
>
people
(
Business
business
,
Wi
wi
)
throws
Exception
{
List
<
Unit
>
os
=
business
.
unit
().
pick
(
wi
.
getUnitList
());
List
<
String
>
unitIds
=
new
ArrayList
<>();
for
(
Unit
o
:
os
)
{
...
...
@@ -112,14 +124,19 @@ class ActionListWithUnitSubNestedLikeObject extends BaseAction {
unitIds
.
addAll
(
business
.
unit
().
listSubNested
(
o
.
getId
()));
}
unitIds
=
ListTools
.
trim
(
unitIds
,
true
,
true
);
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Identity
.
class
);
List
<
Identity
>
list
=
new
ArrayList
<>();
if
(
ListTools
.
isNotEmpty
(
unitIds
))
{
list
=
business
.
entityManagerContainer
().
fetchIn
(
Identity
.
class
,
ListTools
.
toList
(
Identity
.
id_FIELDNAME
,
Identity
.
person_FIELDNAME
,
Identity
.
orderNumber_FIELDNAME
),
Identity
.
unit_FIELDNAME
,
unitIds
);
}
/*EntityManager em = business.entityManagerContainer().get(Identity.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Identity> root = cq.from(Identity.class);
Predicate p = root.get(Identity_.unit).in(unitIds);
List<String> list = em.createQuery(cq.select(root.get(Identity_.person)).where(p))
.
getResultList
().
stream
().
distinct
().
collect
(
Collectors
.
toList
());
.getResultList().stream().distinct().collect(Collectors.toList());
*/
return
list
;
}
}
\ No newline at end of file
}
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubNestedObject.java
浏览文件 @
3a46650a
package
com.x.organization.assemble.express.jaxrs.person
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
javax.persistence.EntityManager
;
...
...
@@ -76,18 +74,27 @@ class ActionListWithUnitSubNestedObject extends BaseAction {
unitIds
.
addAll
(
business
.
unit
().
listSubNested
(
o
.
getId
()));
}
unitIds
=
ListTools
.
trim
(
unitIds
,
true
,
true
);
EntityManager
em
=
business
.
entityManagerContainer
().
get
(
Identity
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
Identity
>
root
=
cq
.
from
(
Identity
.
class
);
Predicate
p
=
root
.
get
(
Identity_
.
unit
).
in
(
unitIds
);
List
<
String
>
personIds
=
em
.
createQuery
(
cq
.
select
(
root
.
get
(
Identity_
.
person
)).
where
(
p
))
.
getResultList
().
stream
().
distinct
().
collect
(
Collectors
.
toList
());
personIds
=
ListTools
.
trim
(
personIds
,
true
,
true
);
for
(
Person
o
:
business
.
person
().
pick
(
personIds
))
{
wos
.
add
(
this
.
convert
(
business
,
o
,
Wo
.
class
));
List
<
Identity
>
list
=
new
ArrayList
<>();
if
(
ListTools
.
isNotEmpty
(
unitIds
))
{
list
=
business
.
entityManagerContainer
().
fetchIn
(
Identity
.
class
,
ListTools
.
toList
(
Identity
.
id_FIELDNAME
,
Identity
.
person_FIELDNAME
,
Identity
.
orderNumber_FIELDNAME
),
Identity
.
unit_FIELDNAME
,
unitIds
);
}
if
(
ListTools
.
isNotEmpty
(
list
))
{
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
for
(
Identity
identity
:
list
){
map
.
put
(
identity
.
getPerson
(),
identity
.
getOrderNumber
());
}
for
(
Person
o
:
business
.
person
().
pick
(
new
ArrayList
<>(
map
.
keySet
())))
{
o
.
setOrderNumber
(
map
.
get
(
o
.
getId
()));
wos
.
add
(
this
.
convert
(
business
,
o
,
Wo
.
class
));
}
wos
=
wos
.
stream
()
.
sorted
(
Comparator
.
comparing
(
Wo:
:
getOrderNumber
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))
.
thenComparing
(
Comparator
.
comparing
(
Wo:
:
getName
,
Comparator
.
nullsFirst
(
String:
:
compareTo
)).
reversed
()))
.
collect
(
Collectors
.
toList
());
}
return
wos
;
}
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录