Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
c28bf253
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,发现更多精彩内容 >>
提交
c28bf253
编写于
9月 04, 2020
作者:
L
luojing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
考勤部门人员明细排除不参加考勤人员
上级
27d4edc6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
295 addition
and
2 deletion
+295
-2
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/factory/AttendanceDetailFactory.java
...nce/assemble/control/factory/AttendanceDetailFactory.java
+229
-0
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/jaxrs/attendancedetail/ActionListNextWithFilter.java
...trol/jaxrs/attendancedetail/ActionListNextWithFilter.java
+66
-2
未找到文件。
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/factory/AttendanceDetailFactory.java
浏览文件 @
c28bf253
...
...
@@ -840,6 +840,131 @@ public class AttendanceDetailFactory extends AbstractFactory {
return
query
.
setMaxResults
(
count
).
getResultList
();
}
/**
* 查询下一页的信息数据(排除不参加考勤的人员)
* @param id
* @param count
* @param sequence
* @param wrapIn
* @return
* @throws Exception
*/
@SuppressWarnings
(
"unchecked"
)
public
List
<
AttendanceDetail
>
listIdsNextWithFilterUn
(
String
id
,
Integer
count
,
Object
sequence
,
WrapInFilter
wrapIn
,
List
<
String
>
unUnitNameList
,
List
<
String
>
personNameList
)
throws
Exception
{
//先获取上一页最后一条的sequence值,如果有值的话,以此sequence值作为依据取后续的count条数据
EntityManager
em
=
this
.
entityManagerContainer
().
get
(
AttendanceDetail
.
class
);
String
order
=
wrapIn
.
getOrder
();
//排序方式
List
<
Object
>
vs
=
new
ArrayList
<>();
StringBuffer
sql_stringBuffer
=
new
StringBuffer
();
if
(
order
==
null
||
order
.
isEmpty
()
){
order
=
"DESC"
;
}
Integer
index
=
1
;
sql_stringBuffer
.
append
(
"SELECT o FROM "
+
AttendanceDetail
.
class
.
getCanonicalName
()+
" o where 1=1"
);
if
((
null
!=
sequence
)
)
{
sql_stringBuffer
.
append
(
" and o.sequence "
+
(
StringUtils
.
equalsIgnoreCase
(
order
,
"DESC"
)
?
"<"
:
">"
)
+
(
" ?"
+
(
index
)));
vs
.
add
(
sequence
);
index
++;
}
if
((
null
!=
wrapIn
.
getQ_empName
())
&&
(!
wrapIn
.
getQ_empName
().
isEmpty
()))
{
sql_stringBuffer
.
append
(
" and o.empName = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getQ_empName
()
);
index
++;
}
if
(
null
!=
wrapIn
.
getUnitNames
()
&&
wrapIn
.
getUnitNames
().
size
()>
0
)
{
sql_stringBuffer
.
append
(
" and o.unitName in ( ?"
+
(
index
)
+
")"
);
vs
.
add
(
wrapIn
.
getUnitNames
()
);
index
++;
}
if
(
null
!=
wrapIn
.
getTopUnitNames
()
&&
wrapIn
.
getTopUnitNames
().
size
()
>
0
)
{
sql_stringBuffer
.
append
(
" and o.topUnitName in ( ?"
+
(
index
)
+
")"
);
vs
.
add
(
wrapIn
.
getTopUnitNames
()
);
index
++;
}
if
((
null
!=
wrapIn
.
getCycleYear
()
)
&&
(!
wrapIn
.
getCycleYear
().
isEmpty
()))
{
sql_stringBuffer
.
append
(
" and o.cycleYear = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getCycleYear
()
);
index
++;
}
if
((
null
!=
wrapIn
.
getCycleMonth
())
&&
(!
wrapIn
.
getCycleMonth
().
isEmpty
()))
{
sql_stringBuffer
.
append
(
" and o.cycleMonth = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getCycleMonth
()
);
index
++;
}
if
((
null
!=
wrapIn
.
getQ_year
()
)
&&
(!
wrapIn
.
getQ_year
().
isEmpty
()))
{
sql_stringBuffer
.
append
(
" and o.yearString = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getQ_year
()
);
index
++;
}
if
((
null
!=
wrapIn
.
getQ_month
())
&&
(!
wrapIn
.
getQ_month
().
isEmpty
()))
{
sql_stringBuffer
.
append
(
" and o.monthString = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getQ_month
()
);
index
++;
}
if
((
null
!=
wrapIn
.
getQ_date
())
&&
(!
wrapIn
.
getQ_date
().
isEmpty
()))
{
sql_stringBuffer
.
append
(
" and o.recordDateString = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getQ_date
()
);
index
++;
}
if
(
wrapIn
.
getRecordStatus
()
!=
999
)
{
sql_stringBuffer
.
append
(
" and o.recordStatus = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getRecordStatus
()
);
index
++;
}
if
(
wrapIn
.
getIsAbsent
()
!=
null
)
{
sql_stringBuffer
.
append
(
" and o.isAbsent = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getIsAbsent
()
);
index
++;
}
if
(
wrapIn
.
getIsLate
()
!=
null
)
{
sql_stringBuffer
.
append
(
" and o.isLate = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getIsLate
()
);
index
++;
}
if
(
wrapIn
.
getIsLackOfTime
()
!=
null
)
{
sql_stringBuffer
.
append
(
" and o.isLackOfTime = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getIsLackOfTime
()
);
index
++;
}
if
(
wrapIn
.
getIsLeaveEarlier
()
!=
null
)
{
sql_stringBuffer
.
append
(
" and o.isLeaveEarlier = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getIsLeaveEarlier
()
);
index
++;
}
if
(
ListTools
.
isNotEmpty
(
unUnitNameList
))
{
sql_stringBuffer
.
append
(
" and o.unitName not in ( ?"
+
(
index
)
+
")"
);
vs
.
add
(
unUnitNameList
);
index
++;
}
if
(
ListTools
.
isNotEmpty
(
personNameList
))
{
sql_stringBuffer
.
append
(
" and o.empName not in ( ?"
+
(
index
)
+
")"
);
vs
.
add
(
personNameList
);
index
++;
}
if
(
StringUtils
.
isNotEmpty
(
wrapIn
.
getKey
()
)){
sql_stringBuffer
.
append
(
" order by o."
+
wrapIn
.
getKey
()+
" "
+
order
);
}
else
{
sql_stringBuffer
.
append
(
" order by o.sequence "
+
order
);
}
Query
query
=
em
.
createQuery
(
sql_stringBuffer
.
toString
(),
AttendanceDetail
.
class
);
//为查询设置所有的参数值
for
(
int
i
=
0
;
i
<
vs
.
size
();
i
++)
{
query
.
setParameter
(
i
+
1
,
vs
.
get
(
i
));
}
return
query
.
setMaxResults
(
count
).
getResultList
();
}
/**
* 查询上一页的文档信息数据
* @param id
...
...
@@ -1046,6 +1171,110 @@ public class AttendanceDetailFactory extends AbstractFactory {
}
return
(
Long
)
query
.
getSingleResult
();
}
/**
* 查询符合的文档信息总数(排除不参加考勤的人员)
* @param wrapIn
* @return
* @throws Exception
*/
public
long
getCountWithFilterUn
(
WrapInFilter
wrapIn
,
List
<
String
>
unUnitNameList
,
List
<
String
>
personNameList
)
throws
Exception
{
//先获取上一页最后一条的sequence值,如果有值的话,以此sequence值作为依据取后续的count条数据
EntityManager
em
=
this
.
entityManagerContainer
().
get
(
AttendanceDetail
.
class
);
List
<
Object
>
vs
=
new
ArrayList
<>();
StringBuffer
sql_stringBuffer
=
new
StringBuffer
();
Integer
index
=
1
;
sql_stringBuffer
.
append
(
"SELECT count(o.id) FROM "
+
AttendanceDetail
.
class
.
getCanonicalName
()+
" o where 1=1"
);
if
((
null
!=
wrapIn
.
getQ_empName
())
&&
(!
wrapIn
.
getQ_empName
().
isEmpty
()))
{
sql_stringBuffer
.
append
(
" and o.empName = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getQ_empName
()
);
index
++;
}
if
(
null
!=
wrapIn
.
getUnitNames
()
&&
wrapIn
.
getUnitNames
().
size
()>
0
)
{
sql_stringBuffer
.
append
(
" and o.unitName in ( ?"
+
(
index
)
+
")"
);
vs
.
add
(
wrapIn
.
getUnitNames
()
);
index
++;
}
if
(
null
!=
wrapIn
.
getTopUnitNames
()
&&
wrapIn
.
getTopUnitNames
().
size
()
>
0
)
{
sql_stringBuffer
.
append
(
" and o.topUnitName in ( ?"
+
(
index
)
+
")"
);
vs
.
add
(
wrapIn
.
getTopUnitNames
()
);
index
++;
}
if
((
null
!=
wrapIn
.
getCycleYear
()
)
&&
(!
wrapIn
.
getCycleYear
().
isEmpty
()))
{
sql_stringBuffer
.
append
(
" and o.cycleYear = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getCycleYear
()
);
index
++;
}
if
((
null
!=
wrapIn
.
getCycleMonth
())
&&
(!
wrapIn
.
getCycleMonth
().
isEmpty
()))
{
sql_stringBuffer
.
append
(
" and o.cycleMonth = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getCycleMonth
()
);
index
++;
}
if
((
null
!=
wrapIn
.
getQ_year
()
)
&&
(!
wrapIn
.
getQ_year
().
isEmpty
()))
{
sql_stringBuffer
.
append
(
" and o.yearString = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getQ_year
()
);
index
++;
}
if
((
null
!=
wrapIn
.
getQ_month
())
&&
(!
wrapIn
.
getQ_month
().
isEmpty
()))
{
sql_stringBuffer
.
append
(
" and o.monthString = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getQ_month
()
);
index
++;
}
if
((
null
!=
wrapIn
.
getQ_date
())
&&
(!
wrapIn
.
getQ_date
().
isEmpty
()))
{
sql_stringBuffer
.
append
(
" and o.recordDateString = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getQ_date
()
);
index
++;
}
if
(
wrapIn
.
getRecordStatus
()
!=
999
)
{
sql_stringBuffer
.
append
(
" and o.recordStatus = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getIsAbsent
()
);
index
++;
}
if
(
wrapIn
.
getIsAbsent
()
!=
null
)
{
sql_stringBuffer
.
append
(
" and o.isAbsent = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getIsAbsent
()
);
index
++;
}
if
(
wrapIn
.
getIsLate
()
!=
null
)
{
sql_stringBuffer
.
append
(
" and o.isLate = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getIsLate
()
);
index
++;
}
if
(
wrapIn
.
getIsLackOfTime
()
!=
null
)
{
sql_stringBuffer
.
append
(
" and o.isLackOfTime = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getIsLackOfTime
()
);
index
++;
}
if
(
wrapIn
.
getIsLeaveEarlier
()
!=
null
)
{
sql_stringBuffer
.
append
(
" and o.isLeaveEarlier = ?"
+
(
index
));
vs
.
add
(
wrapIn
.
getIsLeaveEarlier
()
);
index
++;
}
if
(
ListTools
.
isNotEmpty
(
unUnitNameList
))
{
sql_stringBuffer
.
append
(
" and o.unitName not in ( ?"
+
(
index
)
+
")"
);
vs
.
add
(
unUnitNameList
);
index
++;
}
if
(
ListTools
.
isNotEmpty
(
personNameList
))
{
sql_stringBuffer
.
append
(
" and o.empName not in ( ?"
+
(
index
)
+
")"
);
vs
.
add
(
personNameList
);
index
++;
}
Query
query
=
em
.
createQuery
(
sql_stringBuffer
.
toString
(),
AttendanceDetail
.
class
);
//为查询设置所有的参数值
for
(
int
i
=
0
;
i
<
vs
.
size
();
i
++)
{
query
.
setParameter
(
i
+
1
,
vs
.
get
(
i
));
}
return
(
Long
)
query
.
getSingleResult
();
}
public
List
<
String
>
getByUserAndRecordDate
(
String
employeeName
,
String
recordDateStringFormated
)
throws
Exception
{
if
(
employeeName
==
null
||
employeeName
.
isEmpty
()
||
recordDateStringFormated
==
null
||
recordDateStringFormated
.
isEmpty
()
){
...
...
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/jaxrs/attendancedetail/ActionListNextWithFilter.java
浏览文件 @
c28bf253
...
...
@@ -16,7 +16,10 @@ import org.apache.commons.lang3.StringUtils;
import
com.google.gson.JsonElement
;
import
com.x.attendance.assemble.control.Business
;
import
com.x.attendance.assemble.control.ExceptionWrapInConvert
;
import
com.x.attendance.assemble.control.service.AttendanceEmployeeConfigServiceAdv
;
import
com.x.attendance.assemble.control.service.UserManagerService
;
import
com.x.attendance.entity.AttendanceDetail
;
import
com.x.attendance.entity.AttendanceEmployeeConfig
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.JpaObject
;
...
...
@@ -31,6 +34,8 @@ import com.x.base.core.project.logger.LoggerFactory;
public
class
ActionListNextWithFilter
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionListNextWithFilter
.
class
);
private
UserManagerService
userManagerService
=
new
UserManagerService
();
protected
AttendanceEmployeeConfigServiceAdv
attendanceEmployeeConfigServiceAdv
=
new
AttendanceEmployeeConfigServiceAdv
();
protected
ActionResult
<
List
<
Wo
>>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
id
,
Integer
count
,
JsonElement
jsonElement
)
throws
Exception
{
...
...
@@ -47,6 +52,9 @@ public class ActionListNextWithFilter extends BaseAction {
AttendanceScheduleSetting
scheduleSetting_top
=
null
;
AttendanceScheduleSetting
scheduleSetting
=
null
;
Boolean
check
=
true
;
List
<
String
>
unUnitNameList
=
new
ArrayList
<
String
>();
List
<
String
>
personNameList
=
new
ArrayList
<
String
>();
try
{
wrapIn
=
this
.
convertToWrapIn
(
jsonElement
,
Wi
.
class
);
...
...
@@ -111,10 +119,14 @@ public class ActionListNextWithFilter extends BaseAction {
}
if
(
check
)
{
unUnitNameList
=
getUnUnitNameList
();
personNameList
=
getUnPersonNameList
();
// 从数据库中查询符合条件的一页数据对象
detailList
=
business
.
getAttendanceDetailFactory
().
listIdsNextWithFilter
(
id
,
count
,
sequence
,
wrapIn
);
//detailList = business.getAttendanceDetailFactory().listIdsNextWithFilter(id, count, sequence, wrapIn);
detailList
=
business
.
getAttendanceDetailFactory
().
listIdsNextWithFilterUn
(
id
,
count
,
sequence
,
wrapIn
,
unUnitNameList
,
personNameList
);
// 从数据库中查询符合条件的对象总数
total
=
business
.
getAttendanceDetailFactory
().
getCountWithFilter
(
wrapIn
);
//total = business.getAttendanceDetailFactory().getCountWithFilter(wrapIn);
total
=
business
.
getAttendanceDetailFactory
().
getCountWithFilterUn
(
wrapIn
,
unUnitNameList
,
personNameList
);
// 将所有查询出来的有状态的对象转换为可以输出的过滤过属性的对象
wraps
=
Wo
.
copier
.
copy
(
detailList
);
}
...
...
@@ -192,5 +204,57 @@ public class ActionListNextWithFilter extends BaseAction {
public
static
WrapCopier
<
AttendanceDetail
,
Wo
>
copier
=
WrapCopierFactory
.
wo
(
AttendanceDetail
.
class
,
Wo
.
class
,
null
,
JpaObject
.
FieldsInvisible
);
}
/**
* 获取不需要考勤的组织
* @return
* @throws Exception
*/
protected
List
<
String
>
getUnUnitNameList
()
throws
Exception
{
List
<
String
>
unUnitNameList
=
new
ArrayList
<
String
>();
List
<
AttendanceEmployeeConfig
>
attendanceEmployeeConfigs
=
attendanceEmployeeConfigServiceAdv
.
listByConfigType
(
"NOTREQUIRED"
);
if
(
ListTools
.
isNotEmpty
(
attendanceEmployeeConfigs
)){
for
(
AttendanceEmployeeConfig
attendanceEmployeeConfig
:
attendanceEmployeeConfigs
)
{
String
unitName
=
attendanceEmployeeConfig
.
getUnitName
();
String
employeeName
=
attendanceEmployeeConfig
.
getEmployeeName
();
if
(
StringUtils
.
isEmpty
(
employeeName
)
&&
StringUtils
.
isNotEmpty
(
unitName
)){
unUnitNameList
.
add
(
unitName
);
List
<
String
>
tempUnitNameList
=
userManagerService
.
listSubUnitNameWithParent
(
unitName
);
if
(
ListTools
.
isNotEmpty
(
tempUnitNameList
)){
for
(
String
tempUnit:
tempUnitNameList
){
if
(!
ListTools
.
contains
(
unUnitNameList
,
tempUnit
)){
unUnitNameList
.
add
(
tempUnit
);
}
}
}
}
}
}
return
unUnitNameList
;
}
/**
* 获取不需要考勤的人员
* @return
* @throws Exception
*/
protected
List
<
String
>
getUnPersonNameList
()
throws
Exception
{
List
<
String
>
personNameList
=
new
ArrayList
<
String
>();
List
<
AttendanceEmployeeConfig
>
attendanceEmployeeConfigs
=
attendanceEmployeeConfigServiceAdv
.
listByConfigType
(
"NOTREQUIRED"
);
if
(
ListTools
.
isNotEmpty
(
attendanceEmployeeConfigs
)){
for
(
AttendanceEmployeeConfig
attendanceEmployeeConfig
:
attendanceEmployeeConfigs
)
{
String
employeeName
=
attendanceEmployeeConfig
.
getEmployeeName
();
if
(
StringUtils
.
isNotEmpty
(
employeeName
)
&&
!
ListTools
.
contains
(
personNameList
,
employeeName
)){
personNameList
.
add
(
employeeName
);
}
}
}
return
personNameList
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录