Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fuyue82
o2oa
提交
30a401f5
o2oa
项目概览
fuyue82
/
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,发现更多精彩内容 >>
提交
30a401f5
编写于
4月 17, 2020
作者:
F
fancy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
删除一些describe文件
上级
f034f2fe
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
0 addition
and
12948 deletion
+0
-12948
o2server/x_attendance_assemble_control/src/main/webapp/describe/describe.json
...e_assemble_control/src/main/webapp/describe/describe.json
+0
-11788
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/Business.java
...e/sources/com/x/attendance/assemble/control/Business.java
+0
-216
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/DingdingAttendanceQueue.java
.../attendance/assemble/control/DingdingAttendanceQueue.java
+0
-211
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/ThisApplication.java
...es/com/x/attendance/assemble/control/ThisApplication.java
+0
-52
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/jaxrs/ActionApplication.java
.../attendance/assemble/control/jaxrs/ActionApplication.java
+0
-56
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/jaxrs/dingding/ActionDeleteAllData.java
.../assemble/control/jaxrs/dingding/ActionDeleteAllData.java
+0
-47
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/jaxrs/dingding/ActionSyncData.java
...dance/assemble/control/jaxrs/dingding/ActionSyncData.java
+0
-41
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/jaxrs/dingding/DingdingAttendanceAction.java
...mble/control/jaxrs/dingding/DingdingAttendanceAction.java
+0
-74
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/jaxrs/dingding/SyncWayException.java
...nce/assemble/control/jaxrs/dingding/SyncWayException.java
+0
-11
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/service/UserManagerService.java
...tendance/assemble/control/service/UserManagerService.java
+0
-452
未找到文件。
o2server/x_attendance_assemble_control/src/main/webapp/describe/describe.json
已删除
100644 → 0
浏览文件 @
f034f2fe
此差异已折叠。
点击以展开。
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/Business.java
已删除
100644 → 0
浏览文件 @
f034f2fe
package
com.x.attendance.assemble.control
;
import
com.x.attendance.assemble.control.factory.AttendanceAdminFactory
;
import
com.x.attendance.assemble.control.factory.AttendanceAppealInfoFactory
;
import
com.x.attendance.assemble.control.factory.AttendanceDetailFactory
;
import
com.x.attendance.assemble.control.factory.AttendanceDetailMobileFactory
;
import
com.x.attendance.assemble.control.factory.AttendanceDetailStatisticFactory
;
import
com.x.attendance.assemble.control.factory.AttendanceEmployeeConfigFactory
;
import
com.x.attendance.assemble.control.factory.AttendanceImportFileInfoFactory
;
import
com.x.attendance.assemble.control.factory.AttendanceScheduleSettingFactory
;
import
com.x.attendance.assemble.control.factory.AttendanceSelfHolidayFactory
;
import
com.x.attendance.assemble.control.factory.AttendanceSettingFactory
;
import
com.x.attendance.assemble.control.factory.AttendanceStatisticRequireLogFactory
;
import
com.x.attendance.assemble.control.factory.AttendanceStatisticalCycleFactory
;
import
com.x.attendance.assemble.control.factory.AttendanceWorkDayConfigFactory
;
import
com.x.attendance.assemble.control.factory.AttendanceWorkPlaceFactory
;
import
com.x.attendance.assemble.control.factory.StatisticPersonForMonthFactory
;
import
com.x.attendance.assemble.control.factory.StatisticTopUnitForDayFactory
;
import
com.x.attendance.assemble.control.factory.StatisticTopUnitForMonthFactory
;
import
com.x.attendance.assemble.control.factory.StatisticUnitForDayFactory
;
import
com.x.attendance.assemble.control.factory.StatisticUnitForMonthFactory
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.organization.core.express.Organization
;
public
class
Business
{
private
EntityManagerContainer
emc
;
public
Business
(
EntityManagerContainer
emc
)
throws
Exception
{
this
.
emc
=
emc
;
}
public
EntityManagerContainer
entityManagerContainer
()
{
return
this
.
emc
;
}
// 人员组织业务处理类
private
Organization
organization
;
// 系统配置业务处理类
private
AttendanceSettingFactory
attendanceSettingFactory
;
// 工作场所配置业务处理类
private
AttendanceWorkPlaceFactory
attendanceWorkPlaceFactory
;
// 节假日工作日配置业务处理类
private
AttendanceWorkDayConfigFactory
attendanceWorkDayConfigFactory
;
// 人员考勤数据导入文件操作业务处理类
private
AttendanceImportFileInfoFactory
attendanceImportFileInfoFactory
;
// 人员考勤数据业务处理类
private
AttendanceDetailFactory
attendanceDetailFactory
;
private
AttendanceDetailMobileFactory
attendanceDetailMobileFactory
;
// 考勤管理员业务处理类
private
AttendanceAdminFactory
attendanceAdminFactory
;
// 排班管理业务处理类
private
AttendanceScheduleSettingFactory
attendanceScheduleSettingFactory
;
// 休假申请数据业务处理类
private
AttendanceSelfHolidayFactory
attendanceSelfHolidayFactory
;
private
StatisticTopUnitForDayFactory
statisticTopUnitForDayFactory
;
private
StatisticTopUnitForMonthFactory
statisticTopUnitForMonthFactory
;
private
StatisticUnitForDayFactory
statisticUnitForDayFactory
;
private
StatisticUnitForMonthFactory
statisticUnitForMonthFactory
;
private
StatisticPersonForMonthFactory
statisticPersonForMonthFactory
;
private
AttendanceAppealInfoFactory
attendanceAppealInfoFactory
;
private
AttendanceStatisticalCycleFactory
attendanceStatisticalCycleFactory
;
private
AttendanceEmployeeConfigFactory
attendanceEmployeeConfigFactory
;
private
AttendanceStatisticRequireLogFactory
attendanceStatisticRequireLogFactory
;
private
AttendanceDetailStatisticFactory
attendanceDetailStatisticFactory
;
public
AttendanceWorkPlaceFactory
attendanceWorkPlaceFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceWorkPlaceFactory
)
{
this
.
attendanceWorkPlaceFactory
=
new
AttendanceWorkPlaceFactory
(
this
);
}
return
attendanceWorkPlaceFactory
;
}
public
AttendanceDetailMobileFactory
getAttendanceDetailMobileFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceDetailMobileFactory
)
{
this
.
attendanceDetailMobileFactory
=
new
AttendanceDetailMobileFactory
(
this
);
}
return
attendanceDetailMobileFactory
;
}
public
AttendanceDetailStatisticFactory
getAttendanceDetailStatisticFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceDetailStatisticFactory
)
{
this
.
attendanceDetailStatisticFactory
=
new
AttendanceDetailStatisticFactory
(
this
);
}
return
attendanceDetailStatisticFactory
;
}
public
AttendanceEmployeeConfigFactory
getAttendanceEmployeeConfigFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceEmployeeConfigFactory
)
{
this
.
attendanceEmployeeConfigFactory
=
new
AttendanceEmployeeConfigFactory
(
this
);
}
return
attendanceEmployeeConfigFactory
;
}
public
AttendanceStatisticRequireLogFactory
getAttendanceStatisticRequireLogFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceStatisticRequireLogFactory
)
{
this
.
attendanceStatisticRequireLogFactory
=
new
AttendanceStatisticRequireLogFactory
(
this
);
}
return
attendanceStatisticRequireLogFactory
;
}
public
AttendanceStatisticalCycleFactory
getAttendanceStatisticalCycleFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceStatisticalCycleFactory
)
{
this
.
attendanceStatisticalCycleFactory
=
new
AttendanceStatisticalCycleFactory
(
this
);
}
return
attendanceStatisticalCycleFactory
;
}
public
AttendanceAppealInfoFactory
getAttendanceAppealInfoFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceAppealInfoFactory
)
{
this
.
attendanceAppealInfoFactory
=
new
AttendanceAppealInfoFactory
(
this
);
}
return
attendanceAppealInfoFactory
;
}
public
StatisticTopUnitForDayFactory
getStatisticTopUnitForDayFactory
()
throws
Exception
{
if
(
null
==
this
.
statisticTopUnitForDayFactory
)
{
this
.
statisticTopUnitForDayFactory
=
new
StatisticTopUnitForDayFactory
(
this
);
}
return
statisticTopUnitForDayFactory
;
}
public
StatisticTopUnitForMonthFactory
getStatisticTopUnitForMonthFactory
()
throws
Exception
{
if
(
null
==
this
.
statisticTopUnitForMonthFactory
)
{
this
.
statisticTopUnitForMonthFactory
=
new
StatisticTopUnitForMonthFactory
(
this
);
}
return
statisticTopUnitForMonthFactory
;
}
public
StatisticUnitForDayFactory
getStatisticUnitForDayFactory
()
throws
Exception
{
if
(
null
==
this
.
statisticUnitForDayFactory
)
{
this
.
statisticUnitForDayFactory
=
new
StatisticUnitForDayFactory
(
this
);
}
return
statisticUnitForDayFactory
;
}
public
StatisticUnitForMonthFactory
getStatisticUnitForMonthFactory
()
throws
Exception
{
if
(
null
==
this
.
statisticUnitForMonthFactory
)
{
this
.
statisticUnitForMonthFactory
=
new
StatisticUnitForMonthFactory
(
this
);
}
return
statisticUnitForMonthFactory
;
}
public
StatisticPersonForMonthFactory
getStatisticPersonForMonthFactory
()
throws
Exception
{
if
(
null
==
this
.
statisticPersonForMonthFactory
)
{
this
.
statisticPersonForMonthFactory
=
new
StatisticPersonForMonthFactory
(
this
);
}
return
statisticPersonForMonthFactory
;
}
public
Organization
organization
()
throws
Exception
{
if
(
null
==
this
.
organization
)
{
this
.
organization
=
new
Organization
(
ThisApplication
.
context
());
}
return
organization
;
}
public
AttendanceSettingFactory
getAttendanceSettingFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceSettingFactory
)
{
this
.
attendanceSettingFactory
=
new
AttendanceSettingFactory
(
this
);
}
return
attendanceSettingFactory
;
}
public
AttendanceWorkDayConfigFactory
getAttendanceWorkDayConfigFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceWorkDayConfigFactory
)
{
this
.
attendanceWorkDayConfigFactory
=
new
AttendanceWorkDayConfigFactory
(
this
);
}
return
attendanceWorkDayConfigFactory
;
}
public
AttendanceImportFileInfoFactory
getAttendanceImportFileInfoFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceImportFileInfoFactory
)
{
this
.
attendanceImportFileInfoFactory
=
new
AttendanceImportFileInfoFactory
(
this
);
}
return
attendanceImportFileInfoFactory
;
}
public
AttendanceDetailFactory
getAttendanceDetailFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceDetailFactory
)
{
this
.
attendanceDetailFactory
=
new
AttendanceDetailFactory
(
this
);
}
return
attendanceDetailFactory
;
}
public
AttendanceAdminFactory
getAttendanceAdminFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceAdminFactory
)
{
this
.
attendanceAdminFactory
=
new
AttendanceAdminFactory
(
this
);
}
return
attendanceAdminFactory
;
}
public
AttendanceScheduleSettingFactory
getAttendanceScheduleSettingFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceScheduleSettingFactory
)
{
this
.
attendanceScheduleSettingFactory
=
new
AttendanceScheduleSettingFactory
(
this
);
}
return
attendanceScheduleSettingFactory
;
}
public
AttendanceSelfHolidayFactory
getAttendanceSelfHolidayFactory
()
throws
Exception
{
if
(
null
==
this
.
attendanceSelfHolidayFactory
)
{
this
.
attendanceSelfHolidayFactory
=
new
AttendanceSelfHolidayFactory
(
this
);
}
return
attendanceSelfHolidayFactory
;
}
}
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/DingdingAttendanceQueue.java
已删除
100644 → 0
浏览文件 @
f034f2fe
package
com.x.attendance.assemble.control
;
import
com.x.attendance.entity.DingdingQywxSyncRecord
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.Application
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.connection.HttpConnection
;
import
com.x.base.core.project.gson.GsonPropertyObject
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.organization.Person
;
import
com.x.base.core.project.queue.AbstractQueue
;
import
com.x.base.core.project.x_organization_assemble_control
;
import
javax.persistence.EntityManager
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
public
class
DingdingAttendanceQueue
extends
AbstractQueue
<
DingdingQywxSyncRecord
>
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DingdingAttendanceQueue
.
class
);
@Override
protected
void
execute
(
DingdingQywxSyncRecord
record
)
throws
Exception
{
logger
.
info
(
"开始执行钉钉打卡数据同步,"
+
record
.
getWay
());
if
(
DingdingQywxSyncRecord
.
syncType_dingding
.
equals
(
record
.
getType
()))
{
dingdingSync
(
record
);
}
else
{
logger
.
info
(
"其它类型:"
);
}
}
private
boolean
isSameDay
(
Date
startDate
,
Date
endDate
)
{
Calendar
start
=
Calendar
.
getInstance
();
start
.
setTime
(
startDate
);
Calendar
end
=
Calendar
.
getInstance
();
end
.
setTime
(
endDate
);
return
(
start
.
get
(
Calendar
.
YEAR
)
==
end
.
get
(
Calendar
.
YEAR
)
&&
start
.
get
(
Calendar
.
DAY_OF_YEAR
)
==
end
.
get
(
Calendar
.
DAY_OF_YEAR
));
}
private
void
dingdingSync
(
DingdingQywxSyncRecord
record
)
throws
Exception
{
logger
.
debug
(
record
.
toString
());
Application
app
=
ThisApplication
.
context
().
applications
().
randomWithWeight
(
x_organization_assemble_control
.
class
.
getName
());
//开始分页查询人员
boolean
hasNextPerson
=
true
;
int
personPageSize
=
50
;
String
uri
=
"person/list/(0)/next/50"
;
String
dingdingUrl
=
"https://oapi.dingtalk.com/attendance/list?access_token="
+
Config
.
dingding
().
corpAccessToken
();
logger
.
debug
(
"dingding url :"
+
dingdingUrl
);
while
(
hasNextPerson
)
{
logger
.
info
(
"查询人员 uri:"
+
uri
);
List
<
Person
>
list
=
ThisApplication
.
context
().
applications
().
getQuery
(
false
,
app
,
uri
).
getDataAsList
(
Person
.
class
);
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
//钉钉用户id
List
<
String
>
ddUsers
=
list
.
stream
().
map
(
Person:
:
getDingdingId
).
collect
(
Collectors
.
toList
());
//week
Date
today
=
new
Date
();
today
=
DateTools
.
floorDate
(
today
,
null
);
Date
sevenDayBefore
=
DateTools
.
addDay
(
today
,
-
7
);
//分页查询
int
page
=
0
;
boolean
hasMoreResult
=
true
;
while
(
hasMoreResult
)
{
DingdingAttendancePost
post
=
new
DingdingAttendancePost
();
//post传入 时间(时间间隔不能超过7天) 人员(人员数量不能超过50个)
post
.
setLimit
(
50L
);
post
.
setOffset
(
page
*
50L
);
//从0开始翻页
post
.
setWorkDateFrom
(
DateTools
.
format
(
sevenDayBefore
,
DateTools
.
format_yyyyMMddHHmmss
));
post
.
setWorkDateTo
(
DateTools
.
format
(
today
,
DateTools
.
format_yyyyMMddHHmmss
));
post
.
setUserIdList
(
ddUsers
);
String
body
=
post
.
toString
();
logger
.
info
(
"查询钉钉打卡结果:"
+
body
);
DingdingAttendanceResult
result
=
HttpConnection
.
postAsObject
(
dingdingUrl
,
null
,
post
.
toString
(),
DingdingAttendanceResult
.
class
);
if
(
result
.
errcode
!=
null
&&
result
.
errcode
==
0
)
{
saveDingdingRecord
(
result
.
getRecordresult
());
if
(
result
.
hasMore
)
{
page
++;
}
else
{
logger
.
info
(
"同步钉钉考勤结束。。。。。。。。。。。。。。。。"
);
hasMoreResult
=
false
;
}
}
else
{
//请求结果异常 结束
logger
.
error
(
new
DingDingRequestException
(
result
.
errmsg
));
hasMoreResult
=
false
;
}
}
//是否还有更多用户
if
(
list
.
size
()
<
personPageSize
)
{
logger
.
info
(
"同步钉钉考勤 没有更多用户了,结束。。。。。。。。。。。。。。。"
);
hasNextPerson
=
false
;
updateSyncRecord
(
record
,
null
);
}
else
{
//还有更多用户继续查询
uri
=
"person/list/"
+
list
.
get
(
list
.
size
()
-
1
).
getDistinguishedName
()
+
"/next/50"
;
}
}
else
{
//没有用户查询到结束
logger
.
info
(
"同步钉钉考勤 查询不到用户了,结束。。。。。。。。。。。。。。。"
);
hasNextPerson
=
false
;
updateSyncRecord
(
record
,
null
);
}
}
logger
.
info
(
"结束 插入:"
+
saveNumber
+
" 条"
);
//插入数据成功 开始统计程序
boolean
hasNextDate
=
true
;
Date
statisticDate
=
fromDate
;
while
(
hasNextDate
)
{
logger
.
info
(
"发起钉钉考勤数据统计, date:"
+
DateTools
.
format
(
statisticDate
));
ThisApplication
.
personStatisticQueue
.
send
(
statisticDate
);
ThisApplication
.
unitStatisticQueue
.
send
(
statisticDate
);
if
(!
isSameDay
(
statisticDate
,
toDate
))
{
statisticDate
=
DateTools
.
addDay
(
statisticDate
,
1
);
}
else
{
hasNextDate
=
false
;
}
}
logger
.
info
(
"发起数据统计程序 完成。。。。。。。。。。"
);
}
private
void
saveDingdingRecord
(
List
<
DingdingAttendanceResultItem
>
list
)
throws
Exception
{
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
emc
.
beginTransaction
(
AttendanceDingtalkDetail
.
class
);
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
DingdingAttendanceResultItem
item
=
list
.
get
(
i
);
AttendanceDingtalkDetail
detail
=
DingdingAttendanceResultItem
.
copier
.
copy
(
item
);
detail
.
setDdId
(
item
.
getId
());
emc
.
persist
(
detail
);
}
emc
.
commit
();
}
}
}
private
void
updateSyncRecord
(
DingdingQywxSyncRecord
record
,
String
errMsg
)
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
emc
.
beginTransaction
(
DingdingQywxSyncRecord
.
class
);
record
.
setEndTime
(
new
Date
());
if
(
errMsg
==
null
||
errMsg
.
isEmpty
())
{
record
.
setExceptionMessage
(
errMsg
);
record
.
setStatus
(
DingdingQywxSyncRecord
.
status_error
);
}
else
{
record
.
setStatus
(
DingdingQywxSyncRecord
.
status_end
);
}
emc
.
commit
();
}
}
public
static
class
DingdingAttendancePost
extends
GsonPropertyObject
{
// {
// "workDateFrom": "yyyy-MM-dd HH:mm:ss",
// "workDateTo": "yyyy-MM-dd HH:mm:ss",
// "userIdList":["员工UserId列表"], // 必填,与offset和limit配合使用
// "offset":0, // 必填,第一次传0,如果还有多余数据,下次传之前的offset加上limit的值
// "limit":1, // 必填,表示数据条数,最大不能超过50条
// }
private
String
workDateFrom
;
private
String
workDateTo
;
private
List
<
String
>
userIdList
;
private
Integer
offset
;
private
Integer
limit
;
public
String
getWorkDateFrom
()
{
return
workDateFrom
;
}
public
void
setWorkDateFrom
(
String
workDateFrom
)
{
this
.
workDateFrom
=
workDateFrom
;
}
public
String
getWorkDateTo
()
{
return
workDateTo
;
}
public
void
setWorkDateTo
(
String
workDateTo
)
{
this
.
workDateTo
=
workDateTo
;
}
public
List
<
String
>
getUserIdList
()
{
return
userIdList
;
}
public
void
setUserIdList
(
List
<
String
>
userIdList
)
{
this
.
userIdList
=
userIdList
;
}
public
Integer
getOffset
()
{
return
offset
;
}
public
void
setOffset
(
Integer
offset
)
{
this
.
offset
=
offset
;
}
public
Integer
getLimit
()
{
return
limit
;
}
public
void
setLimit
(
Integer
limit
)
{
this
.
limit
=
limit
;
}
}
}
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/ThisApplication.java
已删除
100644 → 0
浏览文件 @
f034f2fe
package
com.x.attendance.assemble.control
;
import
com.x.attendance.assemble.control.processor.monitor.MonitorFileDataOpt
;
import
com.x.attendance.assemble.control.processor.thread.DataProcessThreadFactory
;
import
com.x.attendance.assemble.control.schedule.AttendanceStatisticTask
;
import
com.x.attendance.assemble.control.schedule.MobileRecordAnalyseTask
;
import
com.x.attendance.assemble.control.service.AttendanceSettingService
;
import
com.x.base.core.project.Context
;
import
com.x.base.core.project.config.Config
;
import
org.apache.commons.lang3.BooleanUtils
;
public
class
ThisApplication
{
protected
static
Context
context
;
public
static
Context
context
()
{
return
context
;
}
public
static
DingdingAttendanceQueue
dingdingQueue
=
new
DingdingAttendanceQueue
();
public
static
void
init
()
throws
Exception
{
try
{
new
AttendanceSettingService
().
initAllSystemConfig
();
context
.
schedule
(
AttendanceStatisticTask
.
class
,
"0 0 0/4 * * ?"
);
context
.
schedule
(
MobileRecordAnalyseTask
.
class
,
"0 0/10 * * * ?"
);
if
(
BooleanUtils
.
isTrue
(
Config
.
dingding
().
getAttendanceSyncEnable
()))
{
dingdingQueue
.
start
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
static
void
destroy
()
{
try
{
DataProcessThreadFactory
.
getInstance
().
showdown
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
try
{
MonitorFileDataOpt
.
stop
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
try
{
dingdingQueue
.
stop
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
\ No newline at end of file
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/jaxrs/ActionApplication.java
已删除
100644 → 0
浏览文件 @
f034f2fe
package
com.x.attendance.assemble.control.jaxrs
;
import
java.util.Set
;
import
javax.ws.rs.ApplicationPath
;
import
com.x.attendance.assemble.control.jaxrs.attachment.FileImportExportAction
;
import
com.x.attendance.assemble.control.jaxrs.attendanceadmin.AttendanceAdminAction
;
import
com.x.attendance.assemble.control.jaxrs.attendanceappealinfo.AttendanceAppealInfoAction
;
import
com.x.attendance.assemble.control.jaxrs.attendancedetail.AttendanceDetailAction
;
import
com.x.attendance.assemble.control.jaxrs.attendancedetail.AttendanceDetailMobileAction
;
import
com.x.attendance.assemble.control.jaxrs.attendanceemployeeconfig.AttendanceEmployeeConfigAction
;
import
com.x.attendance.assemble.control.jaxrs.attendanceimportfileinfo.AttendanceImportFileInfoAction
;
import
com.x.attendance.assemble.control.jaxrs.attendanceschedulesetting.AttendanceScheduleSettingAction
;
import
com.x.attendance.assemble.control.jaxrs.attendancesetting.AttendanceSettingAction
;
import
com.x.attendance.assemble.control.jaxrs.attendancestatistic.AttendanceStatisticAction
;
import
com.x.attendance.assemble.control.jaxrs.attendancestatistic.AttendanceStatisticShowAction
;
import
com.x.attendance.assemble.control.jaxrs.attendancestatisticalcycle.AttendanceStatisticalCycleAction
;
import
com.x.attendance.assemble.control.jaxrs.attendancestatisticrequirelog.AttendanceStatisticRequireLogAction
;
import
com.x.attendance.assemble.control.jaxrs.attendanceworkdayconfig.AttendanceWorkDayConfigAction
;
import
com.x.attendance.assemble.control.jaxrs.dingding.DingdingAttendanceAction
;
import
com.x.attendance.assemble.control.jaxrs.fileimport.AttendanceDetailFileImportAction
;
import
com.x.attendance.assemble.control.jaxrs.selfholiday.AttendanceSelfHolidayAction
;
import
com.x.attendance.assemble.control.jaxrs.selfholiday.AttendanceSelfHolidaySimpleAction
;
import
com.x.attendance.assemble.control.jaxrs.uuid.UUIDAction
;
import
com.x.attendance.assemble.control.jaxrs.workplace.AttendanceWorkPlaceAction
;
import
com.x.base.core.project.jaxrs.AbstractActionApplication
;
@ApplicationPath
(
"jaxrs"
)
public
class
ActionApplication
extends
AbstractActionApplication
{
public
Set
<
Class
<?>>
getClasses
()
{
this
.
classes
.
add
(
UUIDAction
.
class
);
this
.
classes
.
add
(
AttendanceWorkPlaceAction
.
class
);
this
.
classes
.
add
(
AttendanceDetailAction
.
class
);
this
.
classes
.
add
(
AttendanceDetailMobileAction
.
class
);
this
.
classes
.
add
(
AttendanceImportFileInfoAction
.
class
);
this
.
classes
.
add
(
FileImportExportAction
.
class
);
this
.
classes
.
add
(
AttendanceSettingAction
.
class
);
this
.
classes
.
add
(
AttendanceWorkDayConfigAction
.
class
);
this
.
classes
.
add
(
AttendanceAdminAction
.
class
);
this
.
classes
.
add
(
AttendanceScheduleSettingAction
.
class
);
this
.
classes
.
add
(
AttendanceSelfHolidayAction
.
class
);
this
.
classes
.
add
(
AttendanceSelfHolidaySimpleAction
.
class
);
this
.
classes
.
add
(
AttendanceDetailFileImportAction
.
class
);
this
.
classes
.
add
(
AttendanceAppealInfoAction
.
class
);
this
.
classes
.
add
(
AttendanceStatisticAction
.
class
);
this
.
classes
.
add
(
AttendanceStatisticShowAction
.
class
);
this
.
classes
.
add
(
AttendanceStatisticalCycleAction
.
class
);
this
.
classes
.
add
(
AttendanceEmployeeConfigAction
.
class
);
this
.
classes
.
add
(
AttendanceStatisticRequireLogAction
.
class
);
this
.
classes
.
add
(
DingdingAttendanceAction
.
class
);
return
this
.
classes
;
}
}
\ No newline at end of file
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/jaxrs/dingding/ActionDeleteAllData.java
已删除
100644 → 0
浏览文件 @
f034f2fe
package
com.x.attendance.assemble.control.jaxrs.dingding
;
import
com.x.attendance.entity.AttendanceDingtalkDetail
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.entity.annotation.CheckRemoveType
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
java.util.List
;
public
class
ActionDeleteAllData
extends
BaseAction
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionDeleteAllData
.
class
);
public
ActionResult
<
WrapBoolean
>
execute
(
EffectivePerson
effectivePerson
)
{
ActionResult
<
WrapBoolean
>
result
=
new
ActionResult
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
List
<
AttendanceDingtalkDetail
>
details
=
emc
.
fetchAll
(
AttendanceDingtalkDetail
.
class
);
if
(
null
==
details
)
{
result
.
error
(
new
FindEmptyException
()
);
}
else
{
//进行数据库持久化操作
emc
.
beginTransaction
(
AttendanceDingtalkDetail
.
class
);
for
(
AttendanceDingtalkDetail
d
:
details
)
{
emc
.
remove
(
d
,
CheckRemoveType
.
all
);
}
emc
.
commit
();
result
.
setData
(
new
WrapBoolean
(
true
));
logger
.
info
(
"成功删除所有的钉钉打卡数据信息"
);
}
}
catch
(
Exception
e
)
{
result
.
error
(
e
);
logger
.
error
(
e
);
}
return
result
;
}
}
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/jaxrs/dingding/ActionSyncData.java
已删除
100644 → 0
浏览文件 @
f034f2fe
package
com.x.attendance.assemble.control.jaxrs.dingding
;
import
com.x.attendance.assemble.control.ThisApplication
;
import
com.x.attendance.entity.DingdingQywxSyncRecord
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
java.util.Date
;
public
class
ActionSyncData
extends
BaseAction
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionSyncData
.
class
);
public
ActionResult
<
WrapBoolean
>
execute
(
EffectivePerson
effectivePerson
,
String
way
)
throws
Exception
{
ActionResult
<
WrapBoolean
>
result
=
new
ActionResult
<>();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
if
(
null
==
way
||
(!
DingdingQywxSyncRecord
.
syncWay_week
.
equals
(
way
)
&&
!
DingdingQywxSyncRecord
.
syncWay_year
.
equals
(
way
)))
{
throw
new
SyncWayException
();
}
DingdingQywxSyncRecord
record
=
new
DingdingQywxSyncRecord
();
record
.
setWay
(
way
);
record
.
setStartTime
(
new
Date
());
record
.
setType
(
DingdingQywxSyncRecord
.
syncType_dingding
);
record
.
setStatus
(
DingdingQywxSyncRecord
.
status_loading
);
emc
.
beginTransaction
(
DingdingQywxSyncRecord
.
class
);
emc
.
persist
(
record
);
emc
.
commit
();
ThisApplication
.
dingdingQueue
.
send
(
record
);
result
.
setData
(
new
WrapBoolean
(
true
));
}
return
result
;
}
}
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/jaxrs/dingding/DingdingAttendanceAction.java
已删除
100644 → 0
浏览文件 @
f034f2fe
package
com.x.attendance.assemble.control.jaxrs.dingding
;
import
com.google.gson.JsonElement
;
import
com.x.base.core.project.annotation.JaxrsDescribe
;
import
com.x.base.core.project.annotation.JaxrsMethodDescribe
;
import
com.x.base.core.project.annotation.JaxrsParameterDescribe
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.http.HttpMediaType
;
import
com.x.base.core.project.jaxrs.ResponseFactory
;
import
com.x.base.core.project.jaxrs.StandardJaxrsAction
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.ws.rs.*
;
import
javax.ws.rs.container.AsyncResponse
;
import
javax.ws.rs.container.Suspended
;
import
javax.ws.rs.core.Context
;
import
javax.ws.rs.core.MediaType
;
@Path
(
"dingding"
)
@JaxrsDescribe
(
"钉钉打卡数据管理"
)
public
class
DingdingAttendanceAction
extends
StandardJaxrsAction
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DingdingAttendanceAction
.
class
);
//删除所有打卡数据
@JaxrsMethodDescribe
(
value
=
"删除所有打卡数据"
,
action
=
ActionDeleteAllData
.
class
)
@DELETE
@Path
(
"all"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
deleteAllData
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
)
{
ActionResult
<
WrapBoolean
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionDeleteAllData
().
execute
(
effectivePerson
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
//获取一年的数据 ???不知道是否能成 接口限制
//获取7天数据 可以做定时每天晚上更新
@JaxrsMethodDescribe
(
value
=
"同步钉钉考勤结果"
,
action
=
ActionSyncData
.
class
)
@GET
@Path
(
"sync/{way}/start"
)
@Produces
(
HttpMediaType
.
APPLICATION_JSON_UTF_8
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
syncData
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"同步方式"
)
@PathParam
(
"way"
)
String
way
)
{
ActionResult
<
WrapBoolean
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionSyncData
().
execute
(
effectivePerson
,
way
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
}
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/jaxrs/dingding/SyncWayException.java
已删除
100644 → 0
浏览文件 @
f034f2fe
package
com.x.attendance.assemble.control.jaxrs.dingding
;
import
com.x.base.core.project.exception.PromptException
;
public
class
SyncWayException
extends
PromptException
{
private
static
final
long
serialVersionUID
=
-
6072567404702590349L
;
public
SyncWayException
()
{
super
(
"同步方式不正确!"
);
}
}
o2server/x_attendance_assemble_control/src/main/webapp/describe/sources/com/x/attendance/assemble/control/service/UserManagerService.java
已删除
100644 → 0
浏览文件 @
f034f2fe
package
com.x.attendance.assemble.control.service
;
import
com.x.attendance.assemble.control.Business
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.organization.Person
;
import
com.x.base.core.project.organization.Unit
;
import
com.x.base.core.project.tools.ListTools
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.List
;
/**
* 用户组织顶层组织信息管理服务类
* @author LIYI
*
*/
public
class
UserManagerService
{
public
List
<
String
>
listIdentitiesWithPerson
(
String
personName
)
throws
Exception
{
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
return
business
.
organization
().
identity
().
listWithPerson
(
personName
);
}
catch
(
Exception
e
)
{
throw
e
;
}
}
/**
* 根据员工姓名获取组织名称
* 如果用户有多个身份,则取组织级别最大的组织名称
* @param employeeName
* @return
* @throws Exception
*/
public
String
getUnitNameWithPersonName
(
String
personName
)
throws
Exception
{
List
<
String
>
unitNames
=
null
;
Business
business
=
null
;
Integer
level
=
0
;
String
result
=
null
;
Unit
unit
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
unitNames
=
business
.
organization
().
unit
().
listWithPerson
(
personName
);
if
(
ListTools
.
isNotEmpty
(
unitNames
)
)
{
for
(
String
unitName
:
unitNames
)
{
if
(
StringUtils
.
isNotEmpty
(
unitName
)
&&
!
"null"
.
equals
(
unitName
)
)
{
unit
=
business
.
organization
().
unit
().
getObject
(
unitName
);
if
(
level
<
unit
.
getLevel
()
)
{
level
=
unit
.
getLevel
();
result
=
unitName
;
}
}
}
}
}
catch
(
Exception
e
)
{
throw
e
;
}
return
result
;
}
/**
* 根据身份名称获取组织名称
* @param identity
* @return
* @throws Exception
*/
public
String
getUnitNameWithIdentity
(
String
identity
)
throws
Exception
{
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
return
business
.
organization
().
unit
().
getWithIdentity
(
identity
);
}
catch
(
Exception
e
)
{
throw
e
;
}
}
/**
* 根据身份名称获取顶层组织名称
* @param identity
* @return
* @throws Exception
*/
public
String
getTopUnitNameByIdentity
(
String
identity
)
throws
Exception
{
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
String
unitName
=
business
.
organization
().
unit
().
getWithIdentityWithLevel
(
identity
,
1
);
if
(
StringUtils
.
isEmpty
(
unitName
))
{
unitName
=
getUnitNameWithIdentity
(
identity
);
}
return
unitName
;
}
catch
(
Exception
e
)
{
throw
e
;
}
}
/**
* 检查组织名称是否有效
* @param name
* @return
* @throws Exception
*/
public
String
checkUnitNameExists
(
String
unitName
)
throws
Exception
{
if
(
unitName
==
null
||
unitName
.
isEmpty
()
){
throw
new
Exception
(
"name is null!"
);
}
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
return
business
.
organization
().
unit
().
get
(
unitName
);
}
catch
(
Exception
e
)
{
throw
e
;
}
}
/**
* 根据员工姓名获取顶层组织名称,多个身份只取第一个身份
* @param personName
* @return
* @throws Exception
*/
public
String
getTopUnitNameWithPersonName
(
String
personName
)
throws
Exception
{
String
identity
=
null
;
String
topUnitName
=
null
;
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
//兼容一下传过来的personName有可能是个人,有可能是身份
personName
=
business
.
organization
().
person
().
get
(
personName
);
identity
=
getIdentityWithPerson
(
personName
);
if
(
StringUtils
.
isNotEmpty
(
identity
)
){
topUnitName
=
business
.
organization
().
unit
().
getWithIdentityWithLevel
(
identity
,
1
);
}
if
(
StringUtils
.
isEmpty
(
topUnitName
))
{
topUnitName
=
getUnitNameWithIdentity
(
identity
);
}
return
topUnitName
;
}
catch
(
Exception
e
)
{
throw
e
;
}
}
/**
* 根据个人姓名获取所有身份中组织等级最高的一个身份
*
* @param personName
* @return
* @throws Exception
*/
private
String
getIdentityWithPerson
(
String
personName
)
throws
Exception
{
List
<
String
>
identities
=
null
;
String
unitName
=
null
;
Integer
level
=
0
;
String
resultIdentity
=
null
;
Unit
unit
=
null
;
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
//兼容一下传过来的personName有可能是个人,有可能是身份
personName
=
business
.
organization
().
person
().
get
(
personName
);
identities
=
business
.
organization
().
identity
().
listWithPerson
(
personName
);
if
(
identities
!=
null
&&
!
identities
.
isEmpty
()
)
{
for
(
String
identity
:
identities
)
{
unitName
=
business
.
organization
().
unit
().
getWithIdentity
(
identity
);
unit
=
business
.
organization
().
unit
().
getObject
(
unitName
);
if
(
level
<
unit
.
getLevel
()
)
{
level
=
unit
.
getLevel
();
resultIdentity
=
identity
;
}
}
}
return
resultIdentity
;
}
catch
(
Exception
e
)
{
throw
e
;
}
}
/**
* 获取上级组织名称
* @param unitName
* @return
* @throws Exception
*/
public
String
getParentUnitWithUnitName
(
String
unitName
)
throws
Exception
{
Unit
currentUnit
=
null
;
Unit
parentUnit
=
null
;
String
parentUnitName
=
null
;
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
currentUnit
=
business
.
organization
().
unit
().
getObject
(
unitName
);
if
(
currentUnit
!=
null
)
{
parentUnitName
=
currentUnit
.
getSuperior
();
if
(
StringUtils
.
isNotEmpty
(
parentUnitName
)
&&
!
"0"
.
equals
(
parentUnitName
)
)
{
try
{
parentUnit
=
business
.
organization
().
unit
().
getObject
(
currentUnit
.
getSuperior
()
);
if
(
parentUnit
==
null
)
{
return
null
;
}
else
{
return
parentUnit
.
getDistinguishedName
();
}
}
catch
(
NullPointerException
e
)
{
}
}
}
}
catch
(
Exception
e
)
{
throw
e
;
}
return
null
;
}
/**
* 根据组织名称获取顶层组织名称(递归)
* @param organizationName
* @return
* @throws Exception
*/
public
String
getTopUnitNameWithUnitName
(
String
unitName
)
throws
Exception
{
Unit
currentUnit
=
null
;
Unit
parentUnit
=
null
;
String
parentUnitName
=
null
;
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
currentUnit
=
business
.
organization
().
unit
().
getObject
(
unitName
);
if
(
currentUnit
!=
null
)
{
parentUnitName
=
currentUnit
.
getSuperior
();
if
(
StringUtils
.
isNotEmpty
(
parentUnitName
)
&&
!
"0"
.
equals
(
parentUnitName
)
)
{
try
{
parentUnit
=
business
.
organization
().
unit
().
getObject
(
parentUnitName
);
}
catch
(
NullPointerException
e
)
{
}
}
if
(
parentUnit
==
null
)
{
return
currentUnit
.
getDistinguishedName
();
}
else
{
return
getTopUnitNameWithUnitName
(
parentUnit
.
getDistinguishedName
()
);
}
}
else
{
throw
new
Exception
(
"unit is not exists:"
+
unitName
);
}
}
catch
(
Exception
e
)
{
throw
e
;
}
}
/**
* 根据上级组织名称获取所有下级组织名称列表
* @param parentUnitName
* @return
* @throws Exception
*/
public
List
<
String
>
listSubUnitNameWithParent
(
String
parentUnitName
)
throws
Exception
{
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
return
business
.
organization
().
unit
().
listWithUnitSubNested
(
parentUnitName
);
}
catch
(
Exception
e
)
{
throw
e
;
}
}
/**
* 根据人员身份信息获取人员姓名
* @param identityName
* @return
* @throws Exception
*/
public
String
getPersonNameByIdentity
(
String
identityName
)
throws
Exception
{
if
(
identityName
==
null
||
identityName
.
isEmpty
()
){
throw
new
Exception
(
"identityName is null!"
);
}
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
return
business
.
organization
().
person
().
getWithIdentity
(
identityName
);
}
catch
(
Exception
e
)
{
throw
e
;
}
}
/**
* 检查人员是否存在
* @param personName
* @return
* @throws Exception
*/
public
String
checkPersonExists
(
String
personName
)
throws
Exception
{
if
(
personName
==
null
||
personName
.
isEmpty
()
){
throw
new
Exception
(
"personName is null!"
);
}
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
return
business
.
organization
().
person
().
get
(
personName
);
}
catch
(
Exception
e
)
{
throw
e
;
}
}
public
List
<
String
>
listUnitNamesWithPerson
(
String
personName
)
throws
Exception
{
if
(
personName
==
null
||
personName
.
isEmpty
()
){
throw
new
Exception
(
"personName is null!"
);
}
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
return
business
.
organization
().
unit
().
listWithPerson
(
personName
);
}
catch
(
Exception
e
)
{
throw
e
;
}
}
public
List
<
String
>
listAttributeWithPersonWithName
(
String
personName
,
String
attributeName
)
throws
Exception
{
if
(
personName
==
null
||
personName
.
isEmpty
()
){
throw
new
Exception
(
"personName is null!"
);
}
if
(
attributeName
==
null
||
attributeName
.
isEmpty
()
){
throw
new
Exception
(
"attributeName is null!"
);
}
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
return
business
.
organization
().
personAttribute
().
listAttributeWithPersonWithName
(
personName
,
attributeName
);
}
catch
(
Exception
e
)
{
throw
e
;
}
}
/**
* 根据个人获取汇报对象
* @param personName
* @return
* @throws Exception
*/
public
String
getReporterWithPerson
(
String
personName
)
throws
Exception
{
if
(
personName
==
null
||
personName
.
isEmpty
()
){
throw
new
Exception
(
"personName is null!"
);
}
Person
person
=
null
;
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
person
=
business
.
organization
().
person
().
getObject
(
personName
);
if
(
person
!=
null
)
{
if
(
person
.
getSuperior
()
!=
null
)
{
return
business
.
organization
().
person
().
get
(
person
.
getSuperior
()
);
}
}
}
catch
(
Exception
e
)
{
throw
e
;
}
return
null
;
}
public
List
<
String
>
getUnitDutyWithUnitWithDuty
(
String
unitName
,
String
dutyName
)
throws
Exception
{
if
(
unitName
==
null
||
unitName
.
isEmpty
()
){
throw
new
Exception
(
"unitName is null!"
);
}
if
(
dutyName
==
null
||
dutyName
.
isEmpty
()
){
throw
new
Exception
(
"dutyName is null!"
);
}
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
return
business
.
organization
().
unitDuty
().
listIdentityWithUnitWithName
(
unitName
,
dutyName
);
}
catch
(
Exception
e
)
{
throw
e
;
}
}
public
List
<
String
>
getUnitDutyWithPersonWithDuty
(
String
personName
,
String
dutyName
)
throws
Exception
{
if
(
personName
==
null
||
personName
.
isEmpty
()
){
throw
new
Exception
(
"personName is null!"
);
}
if
(
dutyName
==
null
||
dutyName
.
isEmpty
()
){
throw
new
Exception
(
"dutyName is null!"
);
}
String
unitName
=
null
;
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
try
{
unitName
=
getUnitNameWithPersonName
(
personName
);
}
catch
(
NullPointerException
ex
)
{
throw
new
Exception
(
"根据个人查询组织信息发生异常。person:"
+
personName
);
}
if
(
unitName
==
null
||
unitName
.
isEmpty
()
)
{
try
{
unitName
=
getUnitNameWithIdentity
(
personName
);
}
catch
(
NullPointerException
ex
)
{
throw
new
Exception
(
"根据个人查询组织信息发生异常。person:"
+
personName
);
}
}
if
(
unitName
==
null
||
unitName
.
isEmpty
()
)
{
return
null
;
}
else
{
try
{
return
business
.
organization
().
unitDuty
().
listIdentityWithUnitWithName
(
unitName
,
dutyName
);
}
catch
(
NullPointerException
ex
)
{
throw
new
Exception
(
"根据组织查询组织职位时发生异常。unitName:"
+
unitName
+
", dutyName:"
+
dutyName
);
}
}
}
catch
(
Exception
e
)
{
throw
e
;
}
}
public
List
<
String
>
getUnitDutyWithIdentityWithDuty
(
String
identity
,
String
dutyName
)
throws
Exception
{
if
(
identity
==
null
||
identity
.
isEmpty
()
){
throw
new
Exception
(
"identity is null!"
);
}
if
(
dutyName
==
null
||
dutyName
.
isEmpty
()
){
throw
new
Exception
(
"dutyName is null!"
);
}
String
unitName
=
null
;
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
try
{
unitName
=
getUnitNameWithIdentity
(
identity
);
}
catch
(
NullPointerException
ex
)
{
throw
new
Exception
(
"根据个人身份查询组织信息发生异常。identity:"
+
identity
);
}
if
(
unitName
==
null
||
unitName
.
isEmpty
()
)
{
throw
new
Exception
(
"根据个人身份未查询到所属的组织信息。identity:"
+
identity
);
}
else
{
try
{
return
business
.
organization
().
unitDuty
().
listIdentityWithUnitWithName
(
unitName
,
dutyName
);
}
catch
(
NullPointerException
ex
)
{
throw
new
Exception
(
"根据组织查询组织职位时发生异常。unitName:"
+
unitName
+
", dutyName:"
+
dutyName
);
}
}
}
catch
(
Exception
e
)
{
throw
e
;
}
}
public
String
getUnitLevelNameWithName
(
String
unitName
)
throws
Exception
{
if
(
unitName
==
null
||
unitName
.
isEmpty
()
){
throw
new
Exception
(
"unitName is null!"
);
}
Unit
unit
=
null
;
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
unit
=
business
.
organization
().
unit
().
getObject
(
unitName
);
if
(
unit
!=
null
)
{
return
unit
.
getLevelName
();
}
}
catch
(
Exception
e
)
{
throw
e
;
}
return
null
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录