Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fuyue82
o2oa
提交
01eb0988
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,发现更多精彩内容 >>
提交
01eb0988
编写于
8月 17, 2021
作者:
L
luojing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
考勤-处理多级公司bug,添加导出打卡数据
上级
d6986524
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
526 addition
and
46 deletion
+526
-46
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/jaxrs/attachment/ActionExportDetailSource.java
...le/control/jaxrs/attachment/ActionExportDetailSource.java
+230
-0
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/jaxrs/attachment/FileImportExportAction.java
...mble/control/jaxrs/attachment/FileImportExportAction.java
+19
-0
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/jaxrs/attendancedetail/ActionCheckWithPersonByCycle.java
.../jaxrs/attendancedetail/ActionCheckWithPersonByCycle.java
+68
-12
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/processor/sender/SenderForSupplementData.java
...ble/control/processor/sender/SenderForSupplementData.java
+4
-3
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/processor/thread/OperatorDataSupplement.java
...mble/control/processor/thread/OperatorDataSupplement.java
+6
-5
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/service/AttendanceDetailAnalyseService.java
...emble/control/service/AttendanceDetailAnalyseService.java
+7
-7
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/service/AttendanceDetailService.java
...nce/assemble/control/service/AttendanceDetailService.java
+15
-2
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/service/AttendanceScheduleSettingService.java
...ble/control/service/AttendanceScheduleSettingService.java
+13
-0
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/service/AttendanceStatisticalCycleServiceAdv.java
...control/service/AttendanceStatisticalCycleServiceAdv.java
+148
-16
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/service/UserManagerService.java
...tendance/assemble/control/service/UserManagerService.java
+15
-0
o2server/x_attendance_core_entity/src/main/java/com/x/attendance/entity/AttendanceStatisticalCycle.java
...a/com/x/attendance/entity/AttendanceStatisticalCycle.java
+1
-1
未找到文件。
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/jaxrs/attachment/ActionExportDetailSource.java
0 → 100644
浏览文件 @
01eb0988
package
com.x.attendance.assemble.control.jaxrs.attachment
;
import
com.x.attendance.assemble.control.Business
;
import
com.x.attendance.assemble.control.jaxrs.attendancedetail.WrapInFilter
;
import
com.x.attendance.assemble.control.service.AttendanceEmployeeConfigServiceAdv
;
import
com.x.attendance.assemble.control.service.UserManagerService
;
import
com.x.attendance.entity.AttendanceAppealInfo
;
import
com.x.attendance.entity.AttendanceDetail
;
import
com.x.attendance.entity.AttendanceEmployeeConfig
;
import
com.x.attendance.entity.AttendanceScheduleSetting
;
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.WoFile
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.DateTools
;
import
com.x.base.core.project.tools.ListTools
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.ByteArrayOutputStream
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* 导出原始打卡记录
*/
public
class
ActionExportDetailSource
extends
BaseAction
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionExportDetailSource
.
class
);
private
UserManagerService
userManagerService
=
new
UserManagerService
();
protected
AttendanceEmployeeConfigServiceAdv
attendanceEmployeeConfigServiceAdv
=
new
AttendanceEmployeeConfigServiceAdv
();
protected
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
cycleYear
,
String
cycleMonth
,
Boolean
stream
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
currentPerson
=
this
.
effectivePerson
(
request
);
List
<
AttendanceDetail
>
detailList
=
null
;
List
<
AttendanceDetail
>
sourceList
=
new
ArrayList
<>();
Workbook
wb
=
null
;
Wo
wo
=
null
;
String
fileName
=
null
;
String
sheetName
=
null
;
Boolean
check
=
true
;
WrapInFilter
wrapIn
=
new
WrapInFilter
();
List
<
String
>
unUnitNameList
=
new
ArrayList
<
String
>();
List
<
String
>
personNameList
=
new
ArrayList
<
String
>();
try
{
if
(
StringUtils
.
isNotEmpty
(
cycleYear
)){
wrapIn
.
setCycleYear
(
cycleYear
);
}
if
(
StringUtils
.
isNotEmpty
(
cycleMonth
)){
wrapIn
.
setCycleMonth
(
cycleMonth
);
}
}
catch
(
Exception
e
)
{
check
=
false
;
logger
.
error
(
e
,
currentPerson
,
request
,
null
);
}
if
(
check
)
{
unUnitNameList
=
getUnUnitNameList
();
personNameList
=
getUnPersonNameList
();
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
// 从数据库中查询符合条件的一页数据对象
Business
business
=
new
Business
(
emc
);
/*ids = business.getAttendanceDetailFactory().listIdsWithFilterUn(wrapIn,unUnitNameList,personNameList);
detailList = business.getAttendanceDetailFactory().list(ids);*/
detailList
=
business
.
getAttendanceDetailFactory
().
listIdsWithFilterUn
(
wrapIn
,
unUnitNameList
,
personNameList
);
logger
.
info
(
"detailList======"
+
detailList
.
size
()
);
for
(
AttendanceDetail
source:
detailList
){
if
(!
StringUtils
.
equals
(
"系统补充"
,
source
.
getBatchName
())){
sourceList
.
add
(
source
);
}
}
logger
.
info
(
"sourceList======"
+
sourceList
.
size
()
);
}
catch
(
Exception
e
)
{
logger
.
info
(
"系统在查询符合条件的打卡记录时发生异常。"
);
e
.
printStackTrace
();
}
}
// 将结果组织成EXCEL
if
(
check
)
{
fileName
=
"原始打卡记录_"
+
DateTools
.
formatDate
(
new
Date
())+
".xls"
;
sheetName
=
"Sheet1"
;
wb
=
composeDetail
(
fileName
,
sheetName
,
sourceList
);
}
if
(
check
)
{
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
try
{
wb
.
write
(
bos
);
wo
=
new
Wo
(
bos
.
toByteArray
(),
this
.
contentType
(
stream
,
fileName
),
this
.
contentDisposition
(
stream
,
fileName
));
}
finally
{
bos
.
close
();
}
}
result
.
setData
(
wo
);
return
result
;
}
private
Workbook
composeDetail
(
String
fileName
,
String
sheetName
,
List
<
AttendanceDetail
>
detailList
)
{
AttendanceDetail
attendanceDetail
=
null
;
AttendanceAppealInfo
attendanceAppealInfo
=
null
;
Workbook
wb
=
new
HSSFWorkbook
();
Row
row
=
null
;
if
(
ListTools
.
isNotEmpty
(
detailList
)
)
{
// 创建新的表格
Sheet
sheet
=
wb
.
createSheet
(
sheetName
);
// 先创建表头
row
=
sheet
.
createRow
(
0
);
row
.
createCell
(
0
).
setCellValue
(
"姓名"
);
row
.
createCell
(
1
).
setCellValue
(
"员工号"
);
row
.
createCell
(
2
).
setCellValue
(
"日期"
);
row
.
createCell
(
3
).
setCellValue
(
"上午上班打卡时间"
);
row
.
createCell
(
4
).
setCellValue
(
"上午下班打卡时间"
);
row
.
createCell
(
5
).
setCellValue
(
"下午上班打卡时间"
);
row
.
createCell
(
6
).
setCellValue
(
"下午下班打开时间"
);
for
(
int
i
=
0
;
i
<
detailList
.
size
();
i
++)
{
attendanceDetail
=
detailList
.
get
(
i
);
row
=
sheet
.
createRow
(
i
+
1
);
String
empName
=
attendanceDetail
.
getEmpName
();
if
(
StringUtils
.
isNotEmpty
(
empName
)
&&
StringUtils
.
contains
(
empName
,
"@"
)){
empName
=
empName
.
split
(
"@"
)[
0
];
}
String
recordDate
=
attendanceDetail
.
getRecordDateString
();
String
onDutyTime
=
attendanceDetail
.
getOnDutyTime
();
if
(
StringUtils
.
isNotEmpty
(
onDutyTime
)){
onDutyTime
=
onDutyTime
.
substring
(
0
,
onDutyTime
.
length
()
-
3
);
}
String
morningOffDutyTime
=
attendanceDetail
.
getMorningOffDutyTime
();
if
(
StringUtils
.
isNotEmpty
(
morningOffDutyTime
)){
morningOffDutyTime
=
morningOffDutyTime
.
substring
(
0
,
morningOffDutyTime
.
length
()
-
3
);
}
String
afternoonOnDutyTime
=
attendanceDetail
.
getAfternoonOnDutyTime
();
if
(
StringUtils
.
isNotEmpty
(
afternoonOnDutyTime
)){
afternoonOnDutyTime
=
afternoonOnDutyTime
.
substring
(
0
,
afternoonOnDutyTime
.
length
()
-
3
);
}
String
offDutyTime
=
attendanceDetail
.
getOffDutyTime
();
if
(
StringUtils
.
isNotEmpty
(
offDutyTime
)){
offDutyTime
=
offDutyTime
.
substring
(
0
,
offDutyTime
.
length
()
-
3
);
}
row
.
createCell
(
0
).
setCellValue
(
attendanceDetail
.
getEmpName
());
row
.
createCell
(
1
).
setCellValue
(
attendanceDetail
.
getEmpNo
());
row
.
createCell
(
2
).
setCellValue
(
recordDate
.
replaceAll
(
"-"
,
"/"
));
row
.
createCell
(
3
).
setCellValue
(
onDutyTime
);
row
.
createCell
(
4
).
setCellValue
(
morningOffDutyTime
);
row
.
createCell
(
5
).
setCellValue
(
afternoonOnDutyTime
);
row
.
createCell
(
6
).
setCellValue
(
offDutyTime
);
}
}
return
wb
;
}
/**
* 获取不需要考勤的组织
* @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
;
}
public
static
class
Wo
extends
WoFile
{
public
Wo
(
byte
[]
bytes
,
String
contentType
,
String
contentDisposition
)
{
super
(
bytes
,
contentType
,
contentDisposition
);
}
}
}
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/jaxrs/attachment/FileImportExportAction.java
浏览文件 @
01eb0988
...
...
@@ -136,6 +136,25 @@ public class FileImportExportAction extends StandardJaxrsAction {
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"导出原始打卡记录"
,
action
=
ActionExportDetailSource
.
class
)
@GET
@Path
(
"export/source/{cycleYear}/{cycleMonth}/stream/{stream}"
)
@Consumes
(
MediaType
.
APPLICATION_JSON
)
public
void
detailsSourceExportStream
(
@Suspended
final
AsyncResponse
asyncResponse
,
@Context
HttpServletRequest
request
,
@JaxrsParameterDescribe
(
"统计周期年份,为空时输入0"
)
@PathParam
(
"cycleYear"
)
String
cycleYear
,
@JaxrsParameterDescribe
(
"统计周期月份,为空时输入0"
)
@PathParam
(
"cycleMonth"
)
String
cycleMonth
,
@JaxrsParameterDescribe
(
"用.APPLICATION_OCTET_STREAM头输出"
)
@PathParam
(
"stream"
)
Boolean
stream
)
{
ActionResult
<
ActionExportDetailSource
.
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
effectivePerson
=
this
.
effectivePerson
(
request
);
try
{
result
=
new
ActionExportDetailSource
().
execute
(
request
,
effectivePerson
,
cycleYear
,
cycleMonth
,
stream
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
,
effectivePerson
,
request
,
null
);
result
.
error
(
e
);
}
asyncResponse
.
resume
(
ResponseFactory
.
getEntityTagActionResultResponse
(
request
,
result
));
}
@JaxrsMethodDescribe
(
value
=
"导出个人出勤率统计记录,设定是否使用stream输出"
,
action
=
ActionExportPersonStatistic
.
class
)
@GET
@Path
(
"export/person/{name}/{year}/{month}/stream/{stream}"
)
...
...
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/jaxrs/attendancedetail/ActionCheckWithPersonByCycle.java
浏览文件 @
01eb0988
...
...
@@ -24,11 +24,12 @@ public class ActionCheckWithPersonByCycle extends BaseAction {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActionCheckWithPersonByCycle
.
class
);
protected
ActionResult
<
Wo
>
execute
(
HttpServletRequest
request
,
EffectivePerson
effectivePerson
,
String
cycleYear
,
String
cycleMonth
)
throws
Exception
{
logger
.
debug
(
effectivePerson
,
">>>>>>>>>>系统尝试对统计周期["
+
cycleYear
+
"-"
+
cycleMonth
+
"]的打卡数据核对......"
);
logger
.
info
(
">>>>>>>>>>系统尝试对统计周期["
+
cycleYear
+
"-"
+
cycleMonth
+
"]的打卡数据核对......"
);
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
EffectivePerson
currentPerson
=
this
.
effectivePerson
(
request
);
Map
<
String
,
Map
<
String
,
List
<
AttendanceStatisticalCycle
>>>
topUnitAttendanceStatisticalCycleMap
=
null
;
List
<
AttendanceEmployeeConfig
>
attendanceEmployeeConfigList
=
null
;
List
<
AttendanceEmployeeConfig
>
unitConfigList
=
null
;
StatusSystemImportOpt
statusSystemImportOpt
=
StatusSystemImportOpt
.
getInstance
();
Boolean
check
=
true
;
...
...
@@ -69,11 +70,8 @@ public class ActionCheckWithPersonByCycle extends BaseAction {
try
{
attendanceEmployeeConfigList
=
attendanceEmployeeConfigServiceAdv
.
listByConfigType
(
"REQUIRED"
);
if
(
ListTools
.
isEmpty
(
attendanceEmployeeConfigList
)
)
{
attendanceEmployeeConfigList
=
new
ArrayList
<>();
// check = false;
// Exception exception = new ExceptionAttendanceDetailProcess( "系统未获取到需要考勤的人员配置,尚不需要补录任何信息." );
// result.error( exception );
//如果没有配置任何需要考勤的人员,那么就是全员需要考勤
attendanceEmployeeConfigList
=
new
ArrayList
<>();
AttendanceEmployeeConfig
config
=
null
;
String
identity
=
null
;
Unit
unit
=
null
;
...
...
@@ -95,14 +93,60 @@ public class ActionCheckWithPersonByCycle extends BaseAction {
config
.
setEmpInTopUnitTime
(
"1900-01-01"
);
config
.
setEmployeeName
(
person
.
getDistinguishedName
()
);
config
.
setEmployeeNumber
(
person
.
getEmployee
()
);
config
.
setUnitOu
(
unit
.
get
DistinguishedNam
e
()
);
config
.
setUnitName
(
unit
.
getUnique
()
);
config
.
setTopUnitName
(
topUnit
.
getName
()
);
config
.
setUnitOu
(
unit
.
get
Uniqu
e
()
);
config
.
setUnitName
(
unit
.
getDistinguishedName
()
);
config
.
setTopUnitName
(
topUnit
.
get
Distinguished
Name
()
);
config
.
setTopUnitOu
(
topUnit
.
getUnique
()
);
attendanceEmployeeConfigList
.
add
(
config
);
}
}
}
}
else
{
//将现有考勤人员配置解析到人
unitConfigList
=
new
ArrayList
<>();
for
(
AttendanceEmployeeConfig
attendanceEmployeeConfig
:
attendanceEmployeeConfigList
){
if
(
StringUtils
.
isNotEmpty
(
attendanceEmployeeConfig
.
getEmployeeName
())){
unitConfigList
.
add
(
attendanceEmployeeConfig
);
}
else
if
(
StringUtils
.
isNotEmpty
(
attendanceEmployeeConfig
.
getUnitName
())){
List
<
String
>
unitPersons
=
userManagerService
.
listWithUnitSubNested
(
attendanceEmployeeConfig
.
getUnitName
());
for
(
String
personId
:
unitPersons
){
Person
person
=
userManagerService
.
getPersonObjByName
(
personId
);
if
(
person
!=
null
){
AttendanceEmployeeConfig
newEmployeeConfig
=
new
AttendanceEmployeeConfig
();
newEmployeeConfig
=
attendanceEmployeeConfig
;
newEmployeeConfig
.
setEmployeeName
(
person
.
getDistinguishedName
()
);
newEmployeeConfig
.
setEmployeeNumber
(
person
.
getEmployee
()
);
unitConfigList
.
add
(
newEmployeeConfig
);
}
}
}
else
if
(
StringUtils
.
isNotEmpty
(
attendanceEmployeeConfig
.
getTopUnitName
())){
//将公司的人员添加
AttendanceEmployeeConfig
newEmployeeConfig
=
null
;
String
identity
=
null
;
Unit
unit
=
null
;
List
<
String
>
unitPersons
=
userManagerService
.
listWithUnitSubNested
(
attendanceEmployeeConfig
.
getTopUnitName
());
for
(
String
personId
:
unitPersons
){
Person
person
=
userManagerService
.
getPersonObjByName
(
personId
);
if
(
person
!=
null
){
newEmployeeConfig
=
new
AttendanceEmployeeConfig
();
newEmployeeConfig
.
setTopUnitName
(
attendanceEmployeeConfig
.
getTopUnitName
());
newEmployeeConfig
.
setTopUnitOu
(
attendanceEmployeeConfig
.
getTopUnitOu
());
newEmployeeConfig
.
setConfigType
(
attendanceEmployeeConfig
.
getConfigType
());
identity
=
userManagerService
.
getMajorIdentityWithPerson
(
person
.
getDistinguishedName
()
);
if
(
StringUtils
.
isNotEmpty
(
identity
)){
unit
=
userManagerService
.
getUnitWithIdentity
(
identity
);
}
if
(
unit
!=
null
){
newEmployeeConfig
.
setUnitOu
(
unit
.
getUnique
()
);
newEmployeeConfig
.
setUnitName
(
unit
.
getDistinguishedName
());
}
newEmployeeConfig
.
setEmployeeName
(
person
.
getDistinguishedName
()
);
newEmployeeConfig
.
setEmployeeNumber
(
person
.
getEmployee
()
);
unitConfigList
.
add
(
newEmployeeConfig
);
}
}
}
}
}
}
catch
(
Exception
e
)
{
check
=
false
;
...
...
@@ -123,20 +167,32 @@ public class ActionCheckWithPersonByCycle extends BaseAction {
}
}
if
(
check
)
{
List
<
AttendanceEmployeeConfig
>
emconfigList
=
new
ArrayList
<>();
if
(
ListTools
.
isNotEmpty
(
unitConfigList
)){
emconfigList
.
addAll
(
unitConfigList
);
}
else
{
emconfigList
.
addAll
(
attendanceEmployeeConfigList
);
}
//由于检查统计周期是用的多线程,造成多份重复无法控制,改为提前检查统计周期
for
(
AttendanceEmployeeConfig
attendanceEmployeeConfig
:
attendanceEmployeeC
onfigList
){
AttendanceStatisticalCycle
attendanceStatisticalCycle
=
attendanceStatisticCycleServiceAdv
.
getAttendanceDetailStatisticCycle
(
for
(
AttendanceEmployeeConfig
attendanceEmployeeConfig
:
emc
onfigList
){
/*
AttendanceStatisticalCycle attendanceStatisticalCycle = attendanceStatisticCycleServiceAdv.getAttendanceDetailStatisticCycle(
attendanceEmployeeConfig.getTopUnitName(),
attendanceEmployeeConfig.getUnitName(),
cycleYear,
cycleMonth,
topUnitAttendanceStatisticalCycleMap,
false
);*/
AttendanceStatisticalCycle
attendanceStatisticalCycle
=
attendanceStatisticCycleServiceAdv
.
getAttendanceDetailStatisticCycleByConfig
(
attendanceEmployeeConfig
,
cycleYear
,
cycleMonth
,
topUnitAttendanceStatisticalCycleMap
,
false
);
attendanceStatisticCycleServiceAdv
.
checkAttendanceStatisticCycle
(
attendanceStatisticalCycle
);
}
new
SenderForSupplementData
().
execute
(
attendanceEmployeeConfigList
,
topUnitAttendanceStatisticalCycleMap
,
cycleYear
,
cycleMonth
,
effectivePerson
.
getDebugger
()
);
new
SenderForSupplementData
().
execute
(
emconfigList
,
topUnitAttendanceStatisticalCycleMap
,
cycleYear
,
cycleMonth
,
effectivePerson
.
getDebugger
()
);
}
return
result
;
...
...
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/processor/sender/SenderForSupplementData.java
浏览文件 @
01eb0988
...
...
@@ -26,10 +26,11 @@ public class SenderForSupplementData {
StatusSystemImportOpt
statusSystemImportOpt
=
StatusSystemImportOpt
.
getInstance
();
for
(
AttendanceEmployeeConfig
attendanceEmployeeConfig
:
attendanceEmployeeConfigList
)
{
if
(
attendanceEmployeeConfig
.
getEmpInTopUnitTime
()
==
null
||
attendanceEmployeeConfig
.
getEmpInTopUnitTime
().
isEmpty
()
){
//System.out.println( ">>>>>>>>>>当前参与人员配置:attendanceEmployeeConfig_topUnit="+attendanceEmployeeConfig.getTopUnitName()+", unitName="+attendanceEmployeeConfig.getUnitName()+", employeeName="+attendanceEmployeeConfig.getEmployeeName() );
/*if( attendanceEmployeeConfig.getEmpInTopUnitTime() == null || attendanceEmployeeConfig.getEmpInTopUnitTime().isEmpty() ){
logger.warn( "person["+attendanceEmployeeConfig.getEmployeeName()+"] in company date is null, system can not supplement data for person." );
return;
}
else
{
}else {
*/
try
{
statusSystemImportOpt
.
setProcessing
(
true
);
statusSystemImportOpt
.
setProcessing_supplement
(
true
);
...
...
@@ -38,7 +39,7 @@ public class SenderForSupplementData {
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
}
//
}
}
}
...
...
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/processor/thread/OperatorDataSupplement.java
浏览文件 @
01eb0988
...
...
@@ -42,9 +42,10 @@ public class OperatorDataSupplement implements Runnable{
AttendanceEmployeeConfig
attendanceEmployeeConfig
=
null
;
AttendanceStatisticalCycle
attendanceStatisticalCycle
=
null
;
Boolean
check
=
true
;
if
(
check
)
{
Boolean
check
=
true
;
attendanceEmployeeConfig
=
entitySupplementData
.
getAttendanceEmployeeConfig
();
/*if( check ) {
//补充和检验一下配置文件中的人员的所属组织和顶层组织信息是否正常
try {
attendanceEmployeeConfig = attendanceEmployeeConfigServiceAdv.checkAttendanceEmployeeConfig( entitySupplementData.getAttendanceEmployeeConfig() );
...
...
@@ -54,9 +55,8 @@ public class OperatorDataSupplement implements Runnable{
logger.error(e);
}
}
logger.debug( debugger, ">>>>>>>>>>系统正在核对并补充员工的考勤打卡信息:" + attendanceEmployeeConfig.getEmployeeName() );
*/
if
(
check
)
{
//根据组织信息、统计周期年、月从所有的顶层组织统计周期信息MAP中查询一个适合的统计周期,如果没有则为该组织新建一个新的配置
try
{
...
...
@@ -86,6 +86,7 @@ public class OperatorDataSupplement implements Runnable{
if
(
check
)
{
if
(
attendanceStatisticalCycle
!=
null
)
{
//System.out.println( ">>>>>>>>>>获取到统计周期:cycle="+attendanceStatisticalCycle.getTopUnitName()+", unitName="+attendanceStatisticalCycle.getUnitName()+", CycleStartDate="+attendanceStatisticalCycle.getCycleStartDateString()+", cycleEndDate="+ attendanceStatisticalCycle.getCycleEndDateString() );
try
{
logger
.
warn
(
"系统尝试核对和补充人员考勤数据,"
+
"StartDate:"
+
attendanceStatisticalCycle
.
getCycleStartDate
()
...
...
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/service/AttendanceDetailAnalyseService.java
浏览文件 @
01eb0988
...
...
@@ -232,7 +232,8 @@ public class AttendanceDetailAnalyseService {
if
(
detail
!=
null
){
selfHolidayList
=
attendanceSelfHolidayService
.
listWithPersonFromCache
(
emc
,
detail
.
getEmpName
(),
false
);
//查询用户匹配的排班配置
scheduleSetting
=
attendanceScheduleSettingService
.
getAttendanceScheduleSettingWithPerson
(
detail
.
getEmpName
(),
debugger
);
//scheduleSetting = attendanceScheduleSettingService.getAttendanceScheduleSettingWithPerson( detail.getEmpName(), debugger );
scheduleSetting
=
attendanceScheduleSettingService
.
getAttendanceScheduleSettingWithDetail
(
detail
,
debugger
);
return
analyseAttendanceDetail
(
emc
,
detail
,
scheduleSetting
,
selfHolidayList
,
workDayConfigList
,
statisticalCycleMap
,
debugger
);
}
else
{
...
...
@@ -306,13 +307,12 @@ public class AttendanceDetailAnalyseService {
if
(
check
){
if
(
scheduleSetting
!=
null
){
detail
.
setTopUnitName
(
scheduleSetting
.
getTopUnitName
()
);
/*if( StringUtils.isNotEmpty( scheduleSetting.getUnitName() ) && !"*".equals( scheduleSetting.getUnitName() )) {
detail.setUnitName( scheduleSetting.getUnitName() );
}else
{
if
(
StringUtils
.
isEmpty
(
detail
.
getTopUnitName
())){
detail
.
setTopUnitName
(
scheduleSetting
.
getTopUnitName
());
}
if
(
StringUtils
.
isEmpty
(
detail
.
getTopUnitName
()))
{
detail
.
setUnitName
(
userManagerService
.
getUnitNameWithPersonName
(
detail
.
getEmpName
()
)
);
}*/
detail
.
setUnitName
(
userManagerService
.
getUnitNameWithPersonName
(
detail
.
getEmpName
()
)
);
}
detail
.
setOnWorkTime
(
scheduleSetting
.
getOnDutyTime
()
);
detail
.
setMiddayRestStartTime
(
scheduleSetting
.
getMiddayRestStartTime
()
);
detail
.
setMiddayRestEndTime
(
scheduleSetting
.
getMiddayRestEndTime
()
);
...
...
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/service/AttendanceDetailService.java
浏览文件 @
01eb0988
...
...
@@ -61,10 +61,10 @@ public class AttendanceDetailService {
AttendanceDetail
attendanceDetail
=
null
;
for
(
String
day
:
dayList
){
try
{
if
(
dateOperation
.
getDateFromString
(
day
).
before
(
dateOperation
.
getDateFromString
(
attendanceEmployeeConfig
.
getEmpInTopUnitTime
()
))
){
/*
if( dateOperation.getDateFromString(day).before( dateOperation.getDateFromString( attendanceEmployeeConfig.getEmpInTopUnitTime() )) ){
logger.warn( "不需要补录员工["+attendanceEmployeeConfig.getEmployeeName()+"]入职前的打卡数据。" );
continue;
}
}
*/
if
(
dateOperation
.
getDateFromString
(
day
).
before
(
dateOperation
.
getDateFromString
(
dateOperation
.
getNowDate
()))){
business
=
new
Business
(
emc
);
ids
=
business
.
getAttendanceDetailFactory
().
listByEmployeeNameAndDate
(
attendanceEmployeeConfig
.
getEmployeeName
(),
day
);
...
...
@@ -72,6 +72,8 @@ public class AttendanceDetailService {
emc
.
beginTransaction
(
AttendanceDetail
.
class
);
//需要补一条打卡数据
attendanceDetail
=
new
AttendanceDetail
();
attendanceDetail
.
setTopUnitName
(
attendanceEmployeeConfig
.
getTopUnitName
());
attendanceDetail
.
setUnitName
(
attendanceEmployeeConfig
.
getUnitName
());
attendanceDetail
.
setEmpNo
(
attendanceEmployeeConfig
.
getEmployeeNumber
()
);
attendanceDetail
.
setEmpName
(
attendanceEmployeeConfig
.
getEmployeeName
()
);
attendanceDetail
.
setYearString
(
dateOperation
.
getYear
(
dateOperation
.
getDateFromString
(
day
))
);
...
...
@@ -84,6 +86,17 @@ public class AttendanceDetailService {
emc
.
persist
(
attendanceDetail
);
emc
.
commit
();
logger
.
info
(
"员工["
+
attendanceEmployeeConfig
.
getEmployeeName
()+
"]在["
+
day
+
"]不存在打卡数据,成功补录一条数据。"
);
}
else
{
for
(
String
id
:
ids
){
AttendanceDetail
detail
=
this
.
get
(
emc
,
id
);
if
(
detail
!=
null
){
detail
.
setTopUnitName
(
attendanceEmployeeConfig
.
getTopUnitName
());
detail
.
setUnitName
(
attendanceEmployeeConfig
.
getUnitName
());
emc
.
beginTransaction
(
AttendanceDetail
.
class
);
emc
.
persist
(
detail
,
CheckPersistType
.
all
);
emc
.
commit
();
}
}
}
}
else
{
logger
.
warn
(
"员工["
+
attendanceEmployeeConfig
.
getEmployeeName
()+
"]的打卡数据数据["
+
day
+
"], 目前还不能补录."
);
...
...
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/service/AttendanceScheduleSettingService.java
浏览文件 @
01eb0988
...
...
@@ -2,6 +2,7 @@ package com.x.attendance.assemble.control.service;
import
java.util.List
;
import
com.x.attendance.entity.AttendanceDetail
;
import
org.apache.commons.lang3.StringUtils
;
import
com.x.attendance.assemble.control.Business
;
...
...
@@ -86,6 +87,18 @@ public class AttendanceScheduleSettingService {
}
return
attendanceScheduleSetting
;
}
public
AttendanceScheduleSetting
getAttendanceScheduleSettingWithDetail
(
AttendanceDetail
detail
,
Boolean
debugger
)
throws
Exception
{
UserManagerService
userManagerService
=
new
UserManagerService
();
String
unitName
=
detail
.
getUnitName
();
AttendanceScheduleSetting
attendanceScheduleSetting
=
getAttendanceScheduleSettingWithUnitName
(
unitName
);
if
(
attendanceScheduleSetting
==
null
)
{
//如果没有找到,那么应该为该人员所属的组织创建一个新的排班配置
String
topUnitName
=
detail
.
getTopUnitName
();
attendanceScheduleSetting
=
createNewScheduleSetting
(
unitName
,
topUnitName
,
debugger
);
}
return
attendanceScheduleSetting
;
}
private
synchronized
AttendanceScheduleSetting
getAttendanceScheduleSettingWithUnitName
(
String
unitName
)
throws
Exception
{
if
(
unitName
==
null
||
unitName
.
isEmpty
()
||
"null"
.
equals
(
unitName
)
)
{
...
...
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/service/AttendanceStatisticalCycleServiceAdv.java
浏览文件 @
01eb0988
...
...
@@ -8,6 +8,7 @@ import java.util.Map;
import
com.x.attendance.assemble.common.date.DateOperation
;
import
com.x.attendance.entity.AttendanceDetail
;
import
com.x.attendance.entity.AttendanceEmployeeConfig
;
import
com.x.attendance.entity.AttendanceStatisticRequireLog
;
import
com.x.attendance.entity.AttendanceStatisticalCycle
;
import
com.x.base.core.container.EntityManagerContainer
;
...
...
@@ -15,6 +16,7 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory;
import
com.x.base.core.entity.annotation.CheckPersistType
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
org.apache.commons.lang3.StringUtils
;
public
class
AttendanceStatisticalCycleServiceAdv
{
...
...
@@ -173,7 +175,133 @@ public class AttendanceStatisticalCycleServiceAdv {
if
(
Integer
.
parseInt
(
cycleMonth
)
<
10
){
cycleMonth
=
"0"
+
Integer
.
parseInt
(
cycleMonth
);
}
//从Map里查询与顶层组织和组织相应的周期配置信息
if
(
topUnitAttendanceStatisticalCycleMap
!=
null
){
//如果总体的Map不为空
unitAttendanceStatisticalCycleMap
=
topUnitAttendanceStatisticalCycleMap
.
get
(
q_topUnitName
);
if
(
unitAttendanceStatisticalCycleMap
!=
null
){
topUnitName
=
q_topUnitName
;
logger
.
info
(
"0>>>>>>>>>>查询到顶层组织["
+
topUnitName
+
"]的统计周期配置"
);
//存在当前顶层组织的配置信息,再根据组织查询组织的配置列表是否存在[topUnit - unit]
unitCycles
=
unitAttendanceStatisticalCycleMap
.
get
(
q_unitName
);
if
(
unitCycles
!=
null
){
unitName
=
q_unitName
;
logger
.
debug
(
debugger
,
"1>>>>>>>>>>查询到组织["
+
unitName
+
"]的统计周期配置"
);
}
else
{
logger
.
debug
(
debugger
,
"2>>>>>>>>>>未查询到组织["
+
unitName
+
"]的统计周期配置, 组织设置为*"
);
unitName
=
"*"
;
unitCycles
=
unitAttendanceStatisticalCycleMap
.
get
(
"*"
);
}
}
else
{
logger
.
debug
(
debugger
,
"3>>>>>>>>>>未查询到顶层组织["
+
q_topUnitName
+
"]的统计周期配置,顶层组织设置为*"
);
//找顶层组织为*的Map看看是否存在
unitAttendanceStatisticalCycleMap
=
topUnitAttendanceStatisticalCycleMap
.
get
(
"*"
);
topUnitName
=
"*"
;
if
(
unitAttendanceStatisticalCycleMap
!=
null
){
logger
.
debug
(
debugger
,
"4>>>>>>>>>>查询到顶层组织[*]的统计周期配置,再查询组织为[*]的配置列表"
);
//存在当前顶层组织的配置信息,再根据组织查询组织的配置列表是否存在[topUnit - unit]
unitCycles
=
unitAttendanceStatisticalCycleMap
.
get
(
q_unitName
);
if
(
unitCycles
!=
null
){
logger
.
debug
(
debugger
,
"5>>>>>>>>>>查询到顶层组织[*]组织["
+
unitName
+
"]的统计周期配置"
);
unitName
=
q_unitName
;
}
else
{
logger
.
debug
(
debugger
,
"6>>>>>>>>>>未查询到顶层组织[*]组织["
+
unitName
+
"]的统计周期配置, 组织设置为*,查询组织[*]的配置"
);
unitName
=
"*"
;
unitCycles
=
unitAttendanceStatisticalCycleMap
.
get
(
"*"
);
}
}
else
{
logger
.
debug
(
debugger
,
"7>>>>>>>>>>未查询到顶层组织[*]的统计周期配置,顶层组织设置为*,系统中没有任何配置"
);
unitName
=
"*"
;
}
}
}
else
{
logger
.
debug
(
debugger
,
"8>>>>>>>>>>统计周期配置为空,顶层组织为*组织为*,系统中没有任何配置"
);
topUnitName
=
"*"
;
unitName
=
"*"
;
}
if
(
unitCycles
!=
null
&&
unitCycles
.
size
()
>
0
){
//logger.debug( "周期列表信息条数:" + unitCycles.size() );
//说明配置信息里有配置,看看配置信息里的数据是否满足打卡信息需要的周期
for
(
AttendanceStatisticalCycle
attendanceStatisticalCycle
:
unitCycles
){
if
(
attendanceStatisticalCycle
.
getCycleYear
().
equals
(
cycleYear
)
&&
attendanceStatisticalCycle
.
getCycleMonth
().
equals
(
cycleMonth
)
){
hasConfig
=
true
;
return
attendanceStatisticalCycle
;
}
}
}
else
{
logger
.
info
(
"根据顶层组织["
+
topUnitName
+
"]和组织["
+
unitName
+
"]未获取到任何周期数据,需要创建新的统计周期数据......2"
);
}
if
(
!
hasConfig
){
logger
.
debug
(
debugger
,
">>>>>>>>>>未查询到合适的周期,根据打卡信息创建一条自然月的周期"
);
//说明没有找到任何相关的配置,那么新创建一条配置
DateOperation
dateOperation
=
new
DateOperation
();
Date
day
=
dateOperation
.
getDateFromString
(
cycleYear
+
"-"
+
cycleMonth
+
"-01"
);
AttendanceStatisticalCycle
attendanceStatisticalCycle
=
new
AttendanceStatisticalCycle
();
attendanceStatisticalCycle
.
setTopUnitName
(
topUnitName
);
attendanceStatisticalCycle
.
setUnitName
(
unitName
);
attendanceStatisticalCycle
.
setCycleMonth
(
cycleMonth
);
attendanceStatisticalCycle
.
setCycleYear
(
cycleYear
);
attendanceStatisticalCycle
.
setCycleStartDate
(
dateOperation
.
getFirstDateInMonth
(
day
));
attendanceStatisticalCycle
.
setCycleStartDateString
(
dateOperation
.
getFirstDateStringInMonth
(
day
));
attendanceStatisticalCycle
.
setCycleEndDate
(
dateOperation
.
getLastDateInMonth
(
day
));
attendanceStatisticalCycle
.
setCycleEndDateString
(
dateOperation
.
getLastDateStringInMonth
(
day
));
attendanceStatisticalCycle
.
setDescription
(
"系统自动创建"
);
//先把对象放到Map里
if
(
topUnitAttendanceStatisticalCycleMap
==
null
){
topUnitAttendanceStatisticalCycleMap
=
new
HashMap
<
String
,
Map
<
String
,
List
<
AttendanceStatisticalCycle
>>>();
}
unitAttendanceStatisticalCycleMap
=
topUnitAttendanceStatisticalCycleMap
.
get
(
topUnitName
);
if
(
unitAttendanceStatisticalCycleMap
==
null
){
unitAttendanceStatisticalCycleMap
=
new
HashMap
<
String
,
List
<
AttendanceStatisticalCycle
>>();
topUnitAttendanceStatisticalCycleMap
.
put
(
topUnitName
,
unitAttendanceStatisticalCycleMap
);
}
unitCycles
=
unitAttendanceStatisticalCycleMap
.
get
(
unitName
);
if
(
unitCycles
==
null
){
unitCycles
=
new
ArrayList
<
AttendanceStatisticalCycle
>();
unitAttendanceStatisticalCycleMap
.
put
(
unitName
,
unitCycles
);
}
putDistinctCycleInList
(
attendanceStatisticalCycle
,
unitCycles
,
debugger
);
/*logger.info( ">>>>>>>>>>准备保存新创建的统计周期信息......");
try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
emc.beginTransaction(AttendanceStatisticalCycle.class);
emc.persist( attendanceStatisticalCycle, CheckPersistType.all);
emc.commit();
}catch(Exception e){
logger.info( ">>>>>>>>>>系统在保存新的统计周期信息时发生异常!");
throw e;
}*/
return
attendanceStatisticalCycle
;
}
return
null
;
}
/**
* 根据考勤人员配置,年月获取一个统计周期配置
* 如果不存在,则新建一个周期配置
* @param cycleYear
* @param cycleMonth
* @param topUnitAttendanceStatisticalCycleMap
* @return
* @throws Exception
*/
public
AttendanceStatisticalCycle
getAttendanceDetailStatisticCycleByConfig
(
AttendanceEmployeeConfig
attendanceEmployeeConfig
,
String
cycleYear
,
String
cycleMonth
,
Map
<
String
,
Map
<
String
,
List
<
AttendanceStatisticalCycle
>>>
topUnitAttendanceStatisticalCycleMap
,
Boolean
debugger
)
throws
Exception
{
List
<
AttendanceStatisticalCycle
>
unitCycles
=
null
;
Map
<
String
,
List
<
AttendanceStatisticalCycle
>>
unitAttendanceStatisticalCycleMap
=
null
;
Boolean
hasConfig
=
false
;
String
q_topUnitName
=
attendanceEmployeeConfig
.
getTopUnitName
();
String
q_unitName
=
attendanceEmployeeConfig
.
getUnitName
();
String
topUnitName
=
null
;
String
unitName
=
null
;
if
(
Integer
.
parseInt
(
cycleMonth
)
<
10
){
cycleMonth
=
"0"
+
Integer
.
parseInt
(
cycleMonth
);
}
logger
.
debug
(
debugger
,
"getAttendanceDetailStatisticCycleByConfig-----q_topUnitName="
+
q_topUnitName
+
"---q_unitName="
+
q_unitName
);
//从Map里查询与顶层组织和组织相应的周期配置信息
if
(
topUnitAttendanceStatisticalCycleMap
!=
null
){
//如果总体的Map不为空
...
...
@@ -185,19 +313,19 @@ public class AttendanceStatisticalCycleServiceAdv {
unitCycles
=
unitAttendanceStatisticalCycleMap
.
get
(
q_unitName
);
if
(
unitCycles
!=
null
){
unitName
=
q_unitName
;
logger
.
debug
(
debugger
,
">>>>>>>>>>查询到组织["
+
unitName
+
"]的统计周期配置"
);
logger
.
debug
(
debugger
,
">>>>>>>>>>查询到组织["
+
unitName
+
"]的统计周期配置"
);
}
else
{
logger
.
debug
(
debugger
,
">>>>>>>>>>未查询到组织["
+
unitName
+
"]的统计周期配置, 组织设置为*"
);
unitName
=
"*"
;
unitCycles
=
unitAttendanceStatisticalCycleMap
.
get
(
"*"
);
}
}
else
{
logger
.
debug
(
debugger
,
"
>>>>>>>>>>未查询到顶层组织["
+
q_topUnitName
+
"]的统计周期配置,顶层组织设置为*"
);
logger
.
info
(
"3
>>>>>>>>>>未查询到顶层组织["
+
q_topUnitName
+
"]的统计周期配置,顶层组织设置为*"
);
//找顶层组织为*的Map看看是否存在
unitAttendanceStatisticalCycleMap
=
topUnitAttendanceStatisticalCycleMap
.
get
(
"*"
);
topUnitName
=
"*"
;
topUnitName
=
q_topUnitName
;
if
(
unitAttendanceStatisticalCycleMap
!=
null
){
logger
.
debug
(
debugger
,
">>>>>>>>>>查询到顶层组织[
*
]的统计周期配置,再查询组织为[*]的配置列表"
);
logger
.
debug
(
debugger
,
">>>>>>>>>>查询到顶层组织[
"
+
q_topUnitName
+
"
]的统计周期配置,再查询组织为[*]的配置列表"
);
//存在当前顶层组织的配置信息,再根据组织查询组织的配置列表是否存在[topUnit - unit]
unitCycles
=
unitAttendanceStatisticalCycleMap
.
get
(
q_unitName
);
if
(
unitCycles
!=
null
){
...
...
@@ -215,15 +343,15 @@ public class AttendanceStatisticalCycleServiceAdv {
}
}
else
{
logger
.
debug
(
debugger
,
">>>>>>>>>>统计周期配置为空,顶层组织为*组织为*,系统中没有任何配置"
);
topUnitName
=
"*"
;
topUnitName
=
q_topUnitName
;
unitName
=
"*"
;
}
if
(
unitCycles
!=
null
&&
unitCycles
.
size
()
>
0
){
//logger.debug( "周期列表信息条数:" + unitCycles.size() );
//说明配置信息里有配置,看看配置信息里的数据是否满足打卡信息需要的周期
for
(
AttendanceStatisticalCycle
attendanceStatisticalCycle
:
unitCycles
){
if
(
attendanceStatisticalCycle
.
getCycleYear
().
equals
(
cycleYear
)
&&
attendanceStatisticalCycle
.
getCycleMonth
().
equals
(
cycleMonth
)
if
(
attendanceStatisticalCycle
.
getCycleYear
().
equals
(
cycleYear
)
&&
attendanceStatisticalCycle
.
getCycleMonth
().
equals
(
cycleMonth
)
){
hasConfig
=
true
;
return
attendanceStatisticalCycle
;
...
...
@@ -232,13 +360,13 @@ public class AttendanceStatisticalCycleServiceAdv {
}
else
{
logger
.
info
(
"根据顶层组织["
+
topUnitName
+
"]和组织["
+
unitName
+
"]未获取到任何周期数据,需要创建新的统计周期数据......2"
);
}
if
(
!
hasConfig
){
logger
.
debug
(
debugger
,
">>>>>>>>>>未查询到合适的周期,根据打卡信息创建一条自然月的周期"
);
//说明没有找到任何相关的配置,那么新创建一条配置
DateOperation
dateOperation
=
new
DateOperation
();
Date
day
=
dateOperation
.
getDateFromString
(
cycleYear
+
"-"
+
cycleMonth
+
"-01"
);
AttendanceStatisticalCycle
attendanceStatisticalCycle
=
new
AttendanceStatisticalCycle
();
attendanceStatisticalCycle
.
setTopUnitName
(
topUnitName
);
attendanceStatisticalCycle
.
setUnitName
(
unitName
);
...
...
@@ -249,7 +377,7 @@ public class AttendanceStatisticalCycleServiceAdv {
attendanceStatisticalCycle
.
setCycleEndDate
(
dateOperation
.
getLastDateInMonth
(
day
));
attendanceStatisticalCycle
.
setCycleEndDateString
(
dateOperation
.
getLastDateStringInMonth
(
day
));
attendanceStatisticalCycle
.
setDescription
(
"系统自动创建"
);
//先把对象放到Map里
if
(
topUnitAttendanceStatisticalCycleMap
==
null
){
topUnitAttendanceStatisticalCycleMap
=
new
HashMap
<
String
,
Map
<
String
,
List
<
AttendanceStatisticalCycle
>>>();
...
...
@@ -279,6 +407,7 @@ public class AttendanceStatisticalCycleServiceAdv {
return
null
;
}
/**
* 根据顶层组织,组织,年月获取一个统计周期配置 如果不存在,则新建一个周期配置
* @param employeeName
...
...
@@ -464,7 +593,9 @@ public class AttendanceStatisticalCycleServiceAdv {
}
public
void
checkAttendanceStatisticCycle
(
AttendanceStatisticalCycle
cycle
){
System
.
out
.
println
(
"checkAttendanceStatisticCycle----start"
);
if
(
cycle
!=
null
){
Boolean
hasCofig
=
false
;
List
<
AttendanceStatisticalCycle
>
cycles
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
cycles
=
attendanceStatisticCycleService
.
listAll
(
emc
);
...
...
@@ -478,22 +609,23 @@ public class AttendanceStatisticalCycleServiceAdv {
){
//对象已经存在,不再保存
hasCofig
=
true
;
logger
.
info
(
">>>>>>>>>>查询成功,对象已经存在!"
);
}
else
{
this
.
saveAttendanceStatisticCycle
(
cycle
);
}
}
}
else
{
this
.
saveAttendanceStatisticCycle
(
cycle
);
}
}
catch
(
Exception
e
)
{
logger
.
info
(
"未查询到考勤统计周期信息......."
);
}
if
(!
hasCofig
){
this
.
saveAttendanceStatisticCycle
(
cycle
);
}
}
System
.
out
.
println
(
"checkAttendanceStatisticCycle----end"
);
}
public
void
saveAttendanceStatisticCycle
(
AttendanceStatisticalCycle
cycle
){
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
logger
.
info
(
">>>>>>>>>>准备保存新创建的统计周期信息......"
);
logger
.
info
(
"
saveAttendanceStatisticCycle
>>>>>>>>>>准备保存新创建的统计周期信息......"
);
emc
.
beginTransaction
(
AttendanceStatisticalCycle
.
class
);
emc
.
persist
(
cycle
,
CheckPersistType
.
all
);
emc
.
commit
();
...
...
o2server/x_attendance_assemble_control/src/main/java/com/x/attendance/assemble/control/service/UserManagerService.java
浏览文件 @
01eb0988
...
...
@@ -341,6 +341,21 @@ public class UserManagerService {
}
}
/**
* 根据组织名称获取所有人(递归)
*
* @param Unit
* @return
* @throws Exception
*/
public
List
<
String
>
listWithUnitSubNested
(
String
Unit
)
throws
Exception
{
Business
business
=
null
;
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
business
=
new
Business
(
emc
);
return
business
.
organization
().
person
().
listWithUnitSubNested
(
Unit
);
}
}
/**
* 根据人员姓名获取人员姓名
*
...
...
o2server/x_attendance_core_entity/src/main/java/com/x/attendance/entity/AttendanceStatisticalCycle.java
浏览文件 @
01eb0988
...
...
@@ -170,7 +170,7 @@ public class AttendanceStatisticalCycle extends SliceJpaObject {
if
(
cycleStartDate
==
null
)
{
if
(
cycleStartDateString
!=
null
)
{
try
{
return
(
new
DateOperation
()).
getDateFromString
(
cycle
End
DateString
);
return
(
new
DateOperation
()).
getDateFromString
(
cycle
Start
DateString
);
}
catch
(
Exception
e
)
{
return
null
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录