Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
308ddd7e
Commit
308ddd7e
authored
May 21, 2020
by
lal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交考勤报表
parent
3c13519b
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
488 additions
and
136 deletions
+488
-136
src/main/java/cn/timer/api/bean/kqmk/KqglAssoRelationSummary.java
+10
-3
src/main/java/cn/timer/api/controller/kqgl/ClockInTool.java
+52
-1
src/main/java/cn/timer/api/controller/kqgl/TimeCardController.java
+0
-3
src/main/java/cn/timer/api/controller/kqgl/atttimer/AttendanceTaskTiming.java
+315
-104
src/main/java/cn/timer/api/controller/kqgl/service/KqglServiceImpl.java
+9
-16
src/main/java/cn/timer/api/dao/kqmk/KqglAssoDkmxMapper.java
+4
-1
src/main/java/cn/timer/api/dao/kqmk/KqglAssoRelationSummaryMapper.java
+7
-1
src/main/java/cn/timer/api/dao/kqmk/KqglAssoTeshuMapper.java
+1
-1
src/main/java/cn/timer/api/dto/kqmk/AttSubsidiaryDto.java
+26
-0
src/main/resources/mapping/kqmk/KqglAssoDkmxMapper.xml
+18
-0
src/main/resources/mapping/kqmk/KqglAssoRelationSummaryMapper.xml
+45
-5
src/main/resources/mapping/kqmk/KqglAssoTeshuMapper.xml
+1
-1
No files found.
src/main/java/cn/timer/api/bean/kqmk/KqglAssoRelationSummary.java
View file @
308ddd7e
...
...
@@ -52,12 +52,18 @@ public class KqglAssoRelationSummary extends Model<KqglAssoRelationSummary> {
@ApiModelProperty
(
value
=
"时长 时长"
,
example
=
"101"
)
private
double
duration
;
@ApiModelProperty
(
value
=
"假期类型id"
,
example
=
"101"
)
@ApiModelProperty
(
value
=
"假期类型id"
,
example
=
"101"
)
private
Integer
leaveTypeId
;
@ApiModelProperty
(
value
=
"加班类型id"
,
example
=
"101"
)
@ApiModelProperty
(
value
=
"加班类型id"
,
example
=
"101"
)
private
Integer
overtimeTypeId
;
@ApiModelProperty
(
value
=
"加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费"
,
example
=
"101"
)
@ApiModelProperty
(
value
=
"加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费"
,
example
=
"101"
)
private
Integer
compensateId
;
@ApiModelProperty
(
value
=
"开始时间 "
,
example
=
"开始时间"
)
private
String
startTime
;
@ApiModelProperty
(
value
=
"结束时间 "
,
example
=
"结束时间"
)
private
String
endTime
;
}
\ No newline at end of file
src/main/java/cn/timer/api/controller/kqgl/ClockInTool.java
View file @
308ddd7e
package
cn
.
timer
.
api
.
controller
.
kqgl
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
...
...
@@ -9,6 +8,7 @@ import java.util.Arrays;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Set
;
...
...
@@ -21,6 +21,57 @@ public class ClockInTool {
static
SimpleDateFormat
famt
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
// 数组容量的扩容,当空间(.length)不够的时候,增加一
public
static
String
[]
arrycopy
(
String
[]
ss
)
{
// TODO Auto-generated method stub
String
[]
ii
=
new
String
[
ss
.
length
+
1
];
System
.
arraycopy
(
ss
,
0
,
ii
,
0
,
ss
.
length
);
return
ii
;
}
public
static
String
[]
replaceNull
(
String
[]
str
)
{
// 用StringBuffer来存放数组中的非空元素,用“;”分隔
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
str
.
length
;
i
++)
{
if
(
""
.
equals
(
str
[
i
]))
{
continue
;
}
sb
.
append
(
str
[
i
]);
if
(
i
!=
str
.
length
-
1
)
{
sb
.
append
(
";"
);
}
}
// 用String的split方法分割,得到数组
str
=
sb
.
toString
().
split
(
";"
);
return
str
;
}
/**
* 删除数组中的指定值 或者数组中的元素包含指定值
*
* @param filters 数组
* @param target 指定值
* @return
*/
public
static
String
[]
doChinFilters
(
String
[]
filters
,
String
target
)
{
String
[]
res
=
null
;
if
(
filters
.
length
>
0
)
{
List
<
String
>
tempList
=
Arrays
.
asList
(
filters
);
// Arrays.asList(filters) 迭代器实现类 不支持remove() 删除,多一步转化
List
<
String
>
arrList
=
new
ArrayList
<
String
>(
tempList
);
Iterator
<
String
>
it
=
arrList
.
iterator
();
while
(
it
.
hasNext
())
{
String
x
=
it
.
next
();
if
(
x
.
indexOf
(
target
)
!=
-
1
)
{
it
.
remove
();
}
}
res
=
new
String
[
arrList
.
size
()];
arrList
.
toArray
(
res
);
}
return
res
;
}
/**
* 获取两个日期之间的所有日期
*/
...
...
src/main/java/cn/timer/api/controller/kqgl/TimeCardController.java
View file @
308ddd7e
...
...
@@ -928,9 +928,6 @@ public class TimeCardController {
return
ResultUtil
.
data
(
yggl
);
}
//用户和考勤组关系
@Autowired
private
UserAttendanceRelMapper
userattendancerelservice
;
//用户与设备关系表
@Autowired
private
UserEquiRelationMapper
userequirelationmapper
;
...
...
src/main/java/cn/timer/api/controller/kqgl/atttimer/AttendanceTaskTiming.java
View file @
308ddd7e
...
...
@@ -2,6 +2,7 @@ package cn.timer.api.controller.kqgl.atttimer;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Date
;
...
...
@@ -18,12 +19,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
cn.timer.api.bean.kqgl.AttendanceWeeklySch
;
import
cn.timer.api.bean.kqgl.PunchCardDetails
;
import
cn.timer.api.bean.kqgl.PunchRecord
;
import
cn.timer.api.bean.kqgl.Schedule
;
import
cn.timer.api.bean.kqmk.KqglAssoBcsz
;
import
cn.timer.api.bean.kqmk.KqglAssoDkjl
;
import
cn.timer.api.bean.kqmk.KqglAssoDkmx
;
import
cn.timer.api.bean.kqmk.KqglAssoLeaveRules
;
import
cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary
;
import
cn.timer.api.bean.kqmk.KqglAssoOvertimeBasics
;
import
cn.timer.api.bean.kqmk.KqglAssoPbmx
;
import
cn.timer.api.bean.kqmk.KqglAssoRelationSummary
;
import
cn.timer.api.bean.kqmk.KqglAssoTeshu
;
import
cn.timer.api.bean.kqmk.KqglAssoZhoupaiban
;
import
cn.timer.api.bean.kqmk.KqglMainKqz
;
...
...
@@ -32,13 +35,16 @@ import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import
cn.timer.api.controller.kqgl.ClockInTool
;
import
cn.timer.api.dao.kqgl.AttendanceWeeklySchMapper
;
import
cn.timer.api.dao.kqgl.PunchCardDetailsMapper
;
import
cn.timer.api.dao.kqgl.PunchRecordMapper
;
import
cn.timer.api.dao.kqgl.ScheduleMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoDk
jl
Mapper
;
import
cn.timer.api.dao.kqmk.KqglAssoDk
mx
Mapper
;
import
cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoRelationSummaryMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoTeshuMapper
;
import
cn.timer.api.dao.kqmk.KqglMainKqzMapper
;
import
cn.timer.api.dao.qyzx.QyzxEntInfoMMapper
;
import
cn.timer.api.dto.kqmk.AdditionalDto
;
import
cn.timer.api.dto.kqmk.AttSubsidiaryDto
;
import
cn.timer.api.utils.DateUtil
;
/**
...
...
@@ -61,18 +67,13 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
@Autowired
private
KqglAssoTeshuMapper
kqglassoteshumapper
;
@Autowired
private
KqglAssoDkjlMapper
kqglassodkjlmapper
;
@Autowired
private
PunchCardDetailsMapper
punchcarddetailsmapper
;
@Autowired
private
AttendanceWeeklySchMapper
attendanceweeklyschmapper
;
@Autowired
private
ScheduleMapper
schedulemapper
;
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf2
=
new
SimpleDateFormat
(
"EEE"
);
static
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
static
SimpleDateFormat
sdf2
=
new
SimpleDateFormat
(
"EEE"
);
/**
* 数据库动态更改定时配置(attendance_socks)
*/
...
...
@@ -91,8 +92,12 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
});
}
@Autowired
private
KqglAssoRelationSummaryMapper
kqglassorelationsummarymapper
;
@Autowired
private
PunchRecordMapper
punchrecordmapper
;
@Autowired
private
KqglAssoDkmxMapper
kqglassodkmxmapper
;
/**
* @return
* @throws ParseException
...
...
@@ -128,33 +133,75 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
List
<
QyzxEntInfoM
>
orgcodelist
=
qyzxentinfommapper
.
selectList
(
new
QueryWrapper
<
QyzxEntInfoM
>());
//系统中的所有公司 所有未到期的公司
String
str
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
()).
toString
();
//
String
ttstr
=
new
SimpleDateFormat
(
"yyyy-MM"
).
format
(
new
Date
()).
toString
();
//
String
[]
range
=
ClockInTool
.
listToString
(
ClockInTool
.
getDays
(
sdf1
.
format
(
c
.
getTime
()),
str
)).
split
(
";"
);
//目前为止所有日期
int
year
=
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
);
int
month
=
Calendar
.
getInstance
().
get
(
Calendar
.
MONTH
)
+
1
;
KqglAssoMonthPunchSummary
.
builder
().
build
().
delete
(
new
QueryWrapper
<
KqglAssoMonthPunchSummary
>().
lambda
().
eq
(
KqglAssoMonthPunchSummary:
:
getBelongYear
,
year
).
eq
(
KqglAssoMonthPunchSummary:
:
getBelongMonth
,
month
));
for
(
int
t
=
0
;
t
<
orgcodelist
.
size
();
t
++){
int
org_code
=
orgcodelist
.
get
(
t
).
getId
();
//企业组织代码
List
<
AdditionalDto
>
userlist
=
kqglassoleavebalancemapper
.
selectAdditionalList
(
org_code
);
for
(
AdditionalDto
user
:
userlist
)
{
/*****/
for
(
String
num
:
range
)
{
//遍历目前为止所有日期
Long
startDatestop
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
num
,
"yyyy-MM-dd"
)).
getTime
();
Long
endDatestop
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
num
,
"yyyy-MM-dd"
)).
getTime
();
double
traveltotal
,
egresstotal
,
overtimetotal
;
//出差总时长
KqglAssoRelationSummary
travel
=
kqglassorelationsummarymapper
.
SecondaryValue
(
user
.
getEmpnum
(),
3
,
ttstr
);
if
(
travel
!=
null
)
{
traveltotal
=
travel
.
getDuration
();
}
//外出总时长
KqglAssoRelationSummary
egress
=
kqglassorelationsummarymapper
.
SecondaryValue
(
user
.
getEmpnum
(),
4
,
ttstr
);
if
(
egress
!=
null
)
{
egresstotal
=
egress
.
getDuration
();
}
//加班总时长
KqglAssoRelationSummary
overtime
=
kqglassorelationsummarymapper
.
SecondaryValue
(
user
.
getEmpnum
(),
1
,
ttstr
);
if
(
overtime
!=
null
)
{
overtimetotal
=
overtime
.
getDuration
();
}
//考勤组信息
KqglMainKqz
attgro
=
kqglmainkqzmapper
.
getAttendanceGroupInformationByUserid
(
user
.
getEmpnum
(),
org_code
);
//目前为止打卡记录
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsmapper
.
selectAttendanceDays
(
Integer
.
valueOf
(
user
.
getEmpnum
()
),
startDate
,
new
Date
().
getTime
());
List
<
PunchCardDetails
>
attendance
=
punchcarddetailsmapper
.
selectAttendanceDays
(
user
.
getEmpnum
(
),
startDate
,
new
Date
().
getTime
());
int
dkjl
=
0
;
//目前为止打卡次数
if
(
attendance
.
size
()
>
0
)
{
dkjl
=
attendance
.
size
();
}
int
sbqkcs
=
0
,
xbqkcs
=
0
,
dk
=
0
;
String
[]
sblacks
=
new
String
[
31
];
//上班缺卡天数
String
[]
xblacks
=
new
String
[
31
];
//下班缺卡天数
String
[]
dkjtts
=
new
String
[
attendance
.
size
()];
//目前打卡日期明细
if
(
attendance
.
size
()
>
0
)
{
dkjl
=
attendance
.
size
();
for
(
PunchCardDetails
pcd:
attendance
){
dkjtts
[
dk
]
=
pcd
.
getData
();
dk
++;
if
(
pcd
.
getYdkcs
()
==
2
||
pcd
.
getYdkcs
()
==
4
||
pcd
.
getYdkcs
()
==
6
){
if
(
pcd
.
getSbdk1
()
==
null
){
sblacks
[
sbqkcs
]
=
pcd
.
getData
();
sbqkcs
++;
}
if
(
pcd
.
getXbdk1
()
==
null
){
xblacks
[
xbqkcs
]
=
pcd
.
getData
();
xbqkcs
++;
}
}
if
(
pcd
.
getYdkcs
()
==
4
||
pcd
.
getYdkcs
()
==
6
){
if
(
pcd
.
getSbdk2
()
==
null
){
sblacks
[
sbqkcs
]
=
pcd
.
getData
();
sbqkcs
++;
}
if
(
pcd
.
getXbdk2
()
==
null
){
xblacks
[
xbqkcs
]
=
pcd
.
getData
();
xbqkcs
++;
}
}
if
(
pcd
.
getYdkcs
()
==
6
){
if
(
pcd
.
getSbdk3
()
==
null
){
sblacks
[
sbqkcs
]
=
pcd
.
getData
();
sbqkcs
++;
}
if
(
pcd
.
getXbdk3
()
==
null
){
xblacks
[
xbqkcs
]
=
pcd
.
getData
();
xbqkcs
++;
}
}
}
}
//具体打卡时间入汇总表(打卡成功才会录入汇总表)
KqglAssoMonthPunchSummary
isyessum
=
KqglAssoMonthPunchSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoMonthPunchSummary
>().
lambda
()
.
eq
(
KqglAssoMonthPunchSummary:
:
getNum
,
user
.
getEmpnum
()).
eq
(
KqglAssoMonthPunchSummary:
:
getOrgCode
,
org_code
));
int
year
=
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
);
int
month
=
Calendar
.
getInstance
().
get
(
Calendar
.
MONTH
)
+
1
;
if
(
attgro
!=
null
){
//该员工是否加入到考勤组 排班方式 1:固定排班;2:自由排班;3:自由工时 计算出应出勤,实际出勤,休息天数
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
String
[]
ycqts
=
new
String
[
31
];
//应上班的具体天数(yyyy-MM-dd)
String
[]
xxts
=
new
String
[
31
];
//休息的具体天数(yyyy-MM-dd)
List
<
String
>
rowData
=
new
ArrayList
<
String
>();
//休息天数,应出勤天数,实际出勤
double
daysOff
=
0
,
daysOnDuty
=
0
;
//,actualAttDays = 0;
int
zjgzts
=
0
;
//目前为止应该出勤的天数
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
//工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
double
workinghours
=
0
,
seriouslatetimes
=
0
,
seriouslatehours
=
0
,
absenlatetimes
=
0
;
// 迟到次数 迟到时长 早退次数 早退时长
int
latenum
=
0
,
latehours
=
0
,
leanum
=
0
,
leahours
=
0
;
// 迟到次数
if
(
attgro
!=
null
){
//该员工是否加入到考勤组 排班方式 1:固定排班;2:自由排班;3:自由工时 计算出应出勤,实际出勤,休息天数
// KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
// //休息天数,应出勤天数,实际出勤
// double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0;
// int zjgzts = 0;//目前为止应该出勤的天数
if
(
attgro
.
getPbfs
()
==
1
){
//固定排班
int
several
=
Integer
.
valueOf
(
ClockInTool
.
dateToWeek
(
str
));
//
KqglAssoTeshu
tesu
=
KqglAssoTeshu
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoTeshu
>().
lambda
().
eq
(
KqglAssoTeshu:
:
getKqzid
,
attgro
.
getId
()).
eq
(
KqglAssoTeshu:
:
getTsrq
,
str
));
...
...
@@ -166,30 +213,28 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
}
else
{
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
tesu
.
getBcid
()));
}
//获取该员工最新班次
KqglAssoZhoupaiban
gudingpb
=
KqglAssoZhoupaiban
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoZhoupaiban
>().
lambda
().
eq
(
KqglAssoZhoupaiban:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoZhoupaiban:
:
getType
,
several
));
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
gudingpb
.
getBcid
()));
List
<
KqglAssoTeshu
>
bxdklist
=
kqglassoteshumapper
.
ShouldSpecialDatessetByKqzid
(
attgro
.
getId
(),
month
,
1
);
//当前月 必须打卡日期
List
<
KqglAssoTeshu
>
bxdklist
=
kqglassoteshumapper
.
ShouldSpecialDatessetByKqzid
(
attgro
.
getId
(),
ttstr
,
1
);
//当前月 必须打卡日期
int
bxdk
=
bxdklist
.
size
();
String
[]
bxdkss
=
new
String
[
bxdk
];
String
[]
bxdkss
=
new
String
[
bxdk
];
////特殊-必须打卡天数(工作日)
int
b
=
0
;
for
(
KqglAssoTeshu
bxd
:
bxdklist
)
{
bxdkss
[
b
]
=
bxd
.
getTsrq
();
b
++;
}
List
<
KqglAssoTeshu
>
wxdk
=
kqglassoteshumapper
.
ShouldSpecialDatessetByKqzid
(
attgro
.
getId
(),
month
,
2
);
//当前月 无需打卡日期
String
[]
appmaps
=
new
String
[
wxdk
.
size
()];
List
<
KqglAssoTeshu
>
wxdk
=
kqglassoteshumapper
.
ShouldSpecialDatessetByKqzid
(
attgro
.
getId
(),
ttstr
,
2
);
//当前月 无需打卡日期
String
[]
appmaps
=
new
String
[
wxdk
.
size
()];
//特殊-无需打卡天数(休息日)
int
d1
=
0
;
for
(
KqglAssoTeshu
spe:
wxdk
){
appmaps
[
d1
]
=
spe
.
getTsrq
();
d1
++;
}
List
<
AttendanceWeeklySch
>
atwek
=
attendanceweeklyschmapper
.
selectAttendanceMadeByUserid
(
Integer
.
valueOf
(
user
.
getEmpnum
()
));
List
<
AttendanceWeeklySch
>
atwek
=
attendanceweeklyschmapper
.
selectAttendanceMadeByUserid
(
user
.
getEmpnum
(
));
String
[]
week
=
new
String
[
atwek
.
size
()];
String
[]
needfig
=
new
String
[
atwek
.
size
()];
String
[]
needfig
=
new
String
[
atwek
.
size
()];
//应打卡周期时间
int
e
=
0
;
for
(
AttendanceWeeklySch
awek
:
atwek
){
week
[
e
]
=
awek
.
getWekmc
();
...
...
@@ -214,23 +259,36 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
int
xiuxi
=
ClockInTool
.
getDaysByYearMonth
(
year
,
month
)
-
q
-
bxdk
+
wxdk
.
size
();
daysOff
=
xiuxi
;
daysOnDuty
=
y
+
bxdk
;
// String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
// int zjgzts = 0;//目前为止应该出勤的天数
//目前为止应出勤天数
int
w
=
0
,
x
=
0
;
for
(
String
num
:
range
)
{
if
(
Arrays
.
binarySearch
(
needfig
,
Integer
.
valueOf
(
ClockInTool
.
dateToWeek
(
num
)))
>=
0
)
{
//对比排班应打卡时间
ycqts
[
w
]
=
num
;
w
++;
zjgzts
++;
}
else
{
xxts
[
x
]
=
num
;
x
++;
}
if
(
Arrays
.
binarySearch
(
bxdkss
,
num
)
>=
0
)
{
//检查是否存在 必须打卡名单中
ycqts
[
w
]
=
num
;
w
++;
zjgzts
++;
ClockInTool
.
doChinFilters
(
xxts
,
num
);
//为必须上班的话从休息日期中去除
}
if
(
Arrays
.
binarySearch
(
appmaps
,
num
)
>=
0
)
{
//检查是否存在 无需打卡名单中
ClockInTool
.
doChinFilters
(
ycqts
,
num
);
//为必须休息的话从上班日期中去除
zjgzts
=
zjgzts
-
1
;
xxts
[
x
]
=
num
;
x
++;
}
}
}
else
if
(
attgro
.
getPbfs
()
==
2
){
//自由排班
KqglAssoPbmx
pbmxx
=
KqglAssoPbmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoPbmx
>().
lambda
().
eq
(
KqglAssoPbmx:
:
getUserid
,
user
.
getEmpnum
()).
eq
(
KqglAssoPbmx:
:
getData
,
str
).
eq
(
KqglAssoPbmx:
:
getKqzid
,
attgro
.
getId
()));
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
pbmxx
.
getBcid
()));
List
<
Schedule
>
ycqs
=
schedulemapper
.
getAttendanceShouldList
(
Integer
.
valueOf
(
user
.
getEmpnum
()
),
startDate
,
endDate
);
List
<
Schedule
>
ycqs
=
schedulemapper
.
getAttendanceShouldList
(
user
.
getEmpnum
(
),
startDate
,
endDate
);
int
xiuxi
=
0
,
shangban
=
0
,
z
=
0
;
String
[]
ziyoupb
=
new
String
[
ycqs
.
size
()];
for
(
Schedule
sc
:
ycqs
){
...
...
@@ -245,14 +303,21 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
daysOff
=
xiuxi
;
daysOnDuty
=
shangban
;
//目前为止应出勤天数
int
y
=
0
,
x
=
0
;
for
(
String
num
:
range
)
{
if
(
Arrays
.
binarySearch
(
ziyoupb
,
num
)
>=
0
)
{
KqglAssoPbmx
pbx
=
KqglAssoPbmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoPbmx
>().
lambda
().
eq
(
KqglAssoPbmx:
:
getUserid
,
user
.
getEmpnum
()).
eq
(
KqglAssoPbmx:
:
getData
,
num
).
eq
(
KqglAssoPbmx:
:
getKqzid
,
attgro
.
getId
()));
if
(
pbx
!=
null
&&
pbx
.
getBcid
()!=
0
)
{
ycqts
[
y
]
=
num
;
zjgzts
++;
}
else
{
xxts
[
x
]
=
num
;
x
++;
}
}
}
}
else
{
List
<
AttendanceWeeklySch
>
atwek
=
attendanceweeklyschmapper
.
selectAttendanceMadeByUserid
(
Integer
.
valueOf
(
user
.
getEmpnum
()
));
List
<
AttendanceWeeklySch
>
atwek
=
attendanceweeklyschmapper
.
selectAttendanceMadeByUserid
(
user
.
getEmpnum
(
));
String
[]
week
=
new
String
[
atwek
.
size
()];
int
e
=
0
;
String
[]
ziyoupb
=
new
String
[
atwek
.
size
()];
...
...
@@ -276,95 +341,241 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
daysOff
=
xiuxi
;
daysOnDuty
=
y
;
//目前为止应出勤天数
int
g
=
0
,
x
=
0
;
for
(
String
num
:
range
)
{
if
(
Arrays
.
binarySearch
(
ziyoupb
,
Integer
.
valueOf
(
ClockInTool
.
dateToWeek
(
num
)))
>=
0
)
{
//对比排班应打卡时间
ycqts
[
g
]
=
num
;
zjgzts
++;
}
else
{
xxts
[
x
]
=
num
;
x
++;
}
}
}
List
<
PunchRecord
>
initial
=
punchrecordmapper
.
getMaintenancePunchCardList
(
startDate
,
new
Date
().
getTime
(),
user
.
getEmpnum
());
// // 迟到次数 迟到时长 早退次数 早退时长
// int latenum = 0,latehours = 0,leanum = 0,leahours = 0;// 迟到次数
String
[]
cdts
=
new
String
[
31
];
//迟到的具体天数
String
[]
ztts
=
new
String
[
31
];
//早退的具体天数
if
(
initial
.
size
()
>
0
){
for
(
PunchRecord
prd
:
initial
){
if
(
prd
.
getType
()
==
1
&&
prd
.
getResults
()
>
0
){
cdts
[
latenum
]
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
prd
.
getDktime
());
latenum
++;
latehours
+=
prd
.
getResults
();
}
if
(
prd
.
getType
()
==
2
&&
prd
.
getResults
()
>
0
){
ztts
[
leanum
]
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
prd
.
getDktime
());
leanum
++;
leahours
+=
prd
.
getResults
();
}
}
}
AttSubsidiaryDto
subs
=
kqglassodkmxmapper
.
subsidiary
(
user
.
getEmpnum
(),
ttstr
);
// //工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
// double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0;
if
(
subs
!=
null
)
{
workinghours
=
subs
.
getGzsctotalgzsc
();
seriouslatetimes
=
subs
.
getYzcdcstotal
();
seriouslatehours
=
subs
.
getYzcdsctotal
();
absenlatetimes
=
subs
.
getKgcdfzstotal
();
}
//具体请假天数
List
<
KqglAssoRelationSummary
>
leavetotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
2
,
ttstr
);
String
[]
leaves
=
new
String
[
leavetotal
.
size
()];
int
l
=
0
;
if
(
leavetotal
.
size
()>
0
)
{
for
(
KqglAssoRelationSummary
lea
:
leavetotal
){
leaves
[
l
]
=
lea
.
getAppTime
();
l
++;
}
}
//具体加班天数
List
<
KqglAssoRelationSummary
>
overtitotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
1
,
ttstr
);
String
[]
overtimes
=
new
String
[
overtitotal
.
size
()];
int
o
=
0
;
if
(
overtitotal
.
size
()
>
0
)
{
for
(
KqglAssoRelationSummary
over
:
overtitotal
)
{
overtimes
[
o
]
=
over
.
getAppTime
();
o
++;
}
}
//具体出差天数
List
<
KqglAssoRelationSummary
>
trtotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
3
,
ttstr
);
String
[]
travels
=
new
String
[
trtotal
.
size
()];
int
cx
=
0
;
if
(
trtotal
.
size
()>
0
)
{
for
(
KqglAssoRelationSummary
trt
:
trtotal
)
{
travels
[
cx
]
=
trt
.
getAppTime
();
cx
++;
}
}
//具体外出天数
List
<
KqglAssoRelationSummary
>
goouttotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
4
,
ttstr
);
String
[]
goouts
=
new
String
[
goouttotal
.
size
()];
int
wc
=
0
;
if
(
goouttotal
.
size
()>
0
)
{
for
(
KqglAssoRelationSummary
go:
goouttotal
)
{
goouts
[
wc
]
=
go
.
getAppTime
();
wc
++;
}
}
//具体补卡天数
List
<
KqglAssoRelationSummary
>
cardtotal
=
kqglassorelationsummarymapper
.
SpecificLeave
(
user
.
getEmpnum
(),
5
,
ttstr
);
String
[]
cards
=
new
String
[
cardtotal
.
size
()];
int
bk
=
0
;
if
(
cardtotal
.
size
()>
0
)
{
for
(
KqglAssoRelationSummary
car
:
cardtotal
)
{
cards
[
bk
]
=
car
.
getAppTime
();
bk
++;
}
}
String
beginTime
=
sdf1
.
format
(
new
Date
());
// List<String> rowData = new ArrayList<String>();
//遍历目前为止所有日期 结合该用户发起的审批进行结合
//1:加班 2:请假 3:出差 4:外出 5:补卡
for
(
String
num
:
range
)
{
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
xxts
),
num
)
>=
0
&&
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
dkjtts
),
num
)
>=
0
)
{
rowData
.
add
(
"休息并打卡"
);
}
else
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
xxts
),
num
)
>=
0
){
rowData
.
add
(
"休息"
);
}
else
{
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
ycqts
),
num
)
<
0
&&
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
leaves
),
num
)
<
0
&&
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
travels
),
num
)
<
0
&&
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
goouts
),
num
)
<
0
&&
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
cards
),
num
)
<
0
)
{
rowData
.
add
(
"旷工"
);
}
else
if
(
sdf1
.
parse
(
beginTime
).
getTime
()
<=
sdf1
.
parse
(
num
).
getTime
())
{
rowData
.
add
(
"未到班期"
);
}
else
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
leaves
),
num
)
>=
0
)
{
//请假
KqglAssoRelationSummary
lea
=
KqglAssoRelationSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
2
));
String
leavetype
=
"未知"
;
//请假类型
String
company
=
"未知"
;
//请假单位
if
(
lea
!=
null
)
{
KqglAssoLeaveRules
rul
=
KqglAssoLeaveRules
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoLeaveRules
>().
lambda
().
eq
(
KqglAssoLeaveRules:
:
getId
,
lea
.
getLeaveTypeId
()));
if
(
rul
!=
null
)
{
leavetype
=
rul
.
getName
();
//1:按天请假;2:按半天;3:按小时
if
(
rul
.
getCompany
()
==
1
)
{
company
=
"天"
;
}
else
if
(
rul
.
getCompany
()
==
2
)
{
company
=
"半天"
;
}
else
{
company
=
"小时"
;
}
}
}
rowData
.
add
(
lea
.
getStartTime
()
+
"到"
+
lea
.
getEndTime
()+
"请"
+
leavetype
+
lea
.
getDuration
()+
company
);
}
else
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
travels
),
num
)
>=
0
)
{
//出差
KqglAssoRelationSummary
lea
=
KqglAssoRelationSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
3
));
rowData
.
add
(
lea
.
getStartTime
()
+
"到"
+
lea
.
getEndTime
()+
"出差"
+
lea
.
getDuration
()+
"天"
);
}
else
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
goouts
),
num
)
>=
0
){
//外出
KqglAssoRelationSummary
lea
=
KqglAssoRelationSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
4
));
rowData
.
add
(
lea
.
getStartTime
()
+
"到"
+
lea
.
getEndTime
()+
"外出"
+
lea
.
getDuration
()+
"天"
);
}
else
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
cards
),
num
)
>=
0
){
//补卡
KqglAssoRelationSummary
lea
=
KqglAssoRelationSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
5
));
rowData
.
add
(
"已补卡:"
+
lea
.
getStartTime
());
}
else
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
overtimes
),
num
)
>=
0
)
{
//加班
KqglAssoRelationSummary
lea
=
KqglAssoRelationSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoRelationSummary
>().
lambda
().
eq
(
KqglAssoRelationSummary:
:
getUserId
,
user
.
getEmpnum
()).
eq
(
KqglAssoRelationSummary:
:
getAppTime
,
num
).
eq
(
KqglAssoRelationSummary:
:
getApprovalType
,
1
));
String
company
=
"未知"
,
method
=
"无"
;
//加班单位、加班补偿方式
//最小加班单位 1:按分钟加班、2:按半小时加班、3:按小时加班、4:按半天加班、5:按天加班
KqglAssoOvertimeBasics
basics
=
KqglAssoOvertimeBasics
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoOvertimeBasics
>().
lambda
().
eq
(
KqglAssoOvertimeBasics:
:
getOrgCode
,
org_code
));
if
(
basics
.
getMinimumUnit
()
==
1
)
{
company
=
"分钟"
;
}
else
if
(
basics
.
getMinimumUnit
()
==
2
)
{
company
=
"半小时"
;}
else
if
(
basics
.
getMinimumUnit
()
==
3
)
{
company
=
"小时"
;}
else
if
(
basics
.
getMinimumUnit
()
==
4
)
{
company
=
"半天"
;}
else
if
(
basics
.
getMinimumUnit
()
==
5
)
{
company
=
"天"
;}
//1:转调休;2:转加班费;3:转调休或加班费
if
(
lea
.
getCompensateId
()
==
1
)
{
method
=
"转调休"
;
}
else
if
(
lea
.
getCompensateId
()
==
2
)
{
method
=
"转加班费"
;
}
else
{
method
=
"转调休或加班费"
;}
rowData
.
add
(
lea
.
getStartTime
()
+
"到"
+
lea
.
getEndTime
()+
"加班"
+
lea
.
getDuration
()+
company
+
"["
+
method
+
"]"
);
}
else
{
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
sblacks
),
num
)
>=
0
)
{
rowData
.
add
(
"上班缺卡"
);
}
else
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
sblacks
),
num
)
>=
0
&&
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
ztts
),
num
)
>=
0
)
{
rowData
.
add
(
"上班缺卡,下班早退"
);
}
else
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
cdts
),
num
)
>=
0
)
{
rowData
.
add
(
"上班迟到"
);
}
else
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
cdts
),
num
)
>=
0
&&
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
xblacks
),
num
)
>=
0
)
{
rowData
.
add
(
"上班迟到,下班缺卡"
);
}
else
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
cdts
),
num
)
>=
0
&&
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
ztts
),
num
)
>=
0
)
{
rowData
.
add
(
"上班迟到,下班早退"
);
}
else
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
xblacks
),
num
)
>=
0
)
{
rowData
.
add
(
"下班缺卡"
);
}
else
if
(
Arrays
.
binarySearch
(
ClockInTool
.
replaceNull
(
ztts
),
num
)
>=
0
)
{
rowData
.
add
(
"下班早退"
);
}
else
{
rowData
.
add
(
"正常"
);
}
}
}
}
}
else
{
for
(
String
num2
:
range
)
{
if
(
Arrays
.
binarySearch
(
dkjtts
,
num2
)
>=
0
)
{
rowData
.
add
(
"未排班并打卡"
);
}
else
{
rowData
.
add
(
"未排班"
);
}
}
System
.
out
.
println
(
"该员工未加入考勤组"
);
}
String
[]
range1
=
ClockInTool
.
listToString
(
rowData
).
split
(
";"
);
String
[]
noticesArray
=
range1
[
0
].
split
(
","
);
noticesArray
=
ClockInTool
.
arrycopy
(
noticesArray
);
for
(
int
ct
=
noticesArray
.
length
-
1
;
ct
<
31
;
ct
++)
{
noticesArray
[
ct
]
=
""
;
if
(
ct
<
30
)
{
noticesArray
=
ClockInTool
.
arrycopy
(
noticesArray
);
}
}
int
answer
=
shif
.
getSxbcs
();
//1=2次 2=4次 3=6次
//当天打卡是否是最后一次 --- 归档
List
<
KqglAssoDkjl
>
zdkcs
=
kqglassodkjlmapper
.
selectList
(
new
QueryWrapper
<
KqglAssoDkjl
>().
lambda
().
eq
(
KqglAssoDkjl:
:
getUserId
,
user
.
getEmpnum
())
.
ne
(
KqglAssoDkjl:
:
getStatus
,
0
).
gt
(
KqglAssoDkjl:
:
getDktime
,
startDatestop
).
lt
(
KqglAssoDkjl:
:
getDktime
,
endDatestop
));
KqglAssoDkmx
dkmc1
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
user
.
getEmpnum
())
.
gt
(
KqglAssoDkmx:
:
getDksj
,
startDatestop
).
lt
(
KqglAssoDkmx:
:
getDksj
,
endDatestop
));
if
(
isyessum
==
null
)
{
//无汇总记录
KqglAssoMonthPunchSummary
summary
=
KqglAssoMonthPunchSummary
.
builder
().
name
(
user
.
getEmpname
()).
num
(
user
.
getEmpnum
()).
dept
(
user
.
getDepartment
())
.
post
(
user
.
getPosition
()).
attGroup
(
attgro
.
getId
()).
build
();
summary
.
setDaysOnDuty
(
daysOnDuty
);
//应出勤天数
summary
.
setActualAttDays
(
Double
.
valueOf
(
dkjl
));
//实际出勤天数
summary
.
setDaysOff
(
daysOff
);
//休息天数
summary
.
setWorkingHours
(
dkmc1
.
getGzsc
());
int
lateTimes
=
0
,
leavetimes
=
0
,
sbqkcs
=
0
,
xbqkcs
=
0
;
double
lateHours
=
0
,
earlyleave
=
0
;
if
(
answer
==
1
||
answer
==
2
||
answer
==
3
)
{
if
(
dkmc1
.
getSbdk1jg
()
>
0
)
{
lateTimes
++;}
if
(
dkmc1
.
getXbdk1jg
()
>
0
)
{
leavetimes
++;}
lateHours
=
dkmc1
.
getSbdk1jg
();
earlyleave
=
dkmc1
.
getXbdk1jg
();
if
(
dkmc1
.
getSbdk1
()
==
null
)
{
sbqkcs
++;}
if
(
dkmc1
.
getXbdk1
()
==
null
)
{
xbqkcs
++;}
}
if
(
answer
==
2
||
answer
==
3
)
{
if
(
dkmc1
.
getSbdk2jg
()
>
0
)
{
lateTimes
++;}
if
(
dkmc1
.
getXbdk2jg
()
>
0
)
{
leavetimes
++;}
lateHours
=
lateHours
+
dkmc1
.
getSbdk2jg
();
earlyleave
=
earlyleave
+
dkmc1
.
getXbdk2jg
();
if
(
dkmc1
.
getSbdk2
()
==
null
)
{
sbqkcs
++;}
if
(
dkmc1
.
getXbdk2
()
==
null
)
{
xbqkcs
++;}
}
if
(
answer
==
3
)
{
if
(
dkmc1
.
getSbdk3jg
()
>
0
)
{
lateTimes
++;}
if
(
dkmc1
.
getXbdk3jg
()
>
0
)
{
leavetimes
++;}
lateHours
=
lateHours
+
dkmc1
.
getSbdk3jg
();
earlyleave
=
earlyleave
+
dkmc1
.
getXbdk3jg
();
if
(
dkmc1
.
getSbdk3
()
==
null
)
{
sbqkcs
++;}
if
(
dkmc1
.
getXbdk3
()
==
null
)
{
xbqkcs
++;}
}
summary
.
setLateTimes
(
Double
.
valueOf
(
lateTimes
));
//迟到次数
summary
.
setLateHours
(
lateHours
);
//迟到时长(分钟)
summary
.
setSeriousLateTimes
(
Double
.
valueOf
(
dkmc1
.
getYzcdcs
()));
summary
.
setSeriousLateHours
(
dkmc1
.
getYzcdsc
());
summary
.
setAbsenLateTimes
(
Double
.
valueOf
(
dkmc1
.
getKgcdfzs
()));
summary
.
setEarlyLeaveTimes
(
Double
.
valueOf
(
leavetimes
));
//早退次数
summary
.
setLengthEarlyLeave
(
earlyleave
);
//早退时长(分钟)
summary
.
setNumberWorkCardShortage
(
Double
.
valueOf
(
sbqkcs
));
summary
.
setNumberDutyCardShortage
(
Double
.
valueOf
(
xbqkcs
));
.
post
(
user
.
getPosition
()).
attGroup
(
attgro
.
getId
()).
daysOnDuty
(
daysOnDuty
).
actualAttDays
(
Double
.
valueOf
(
dkjl
)).
daysOff
(
daysOff
).
workingHours
(
workinghours
)
.
lateTimes
(
Double
.
valueOf
(
latenum
)).
lateHours
(
Double
.
valueOf
(
latehours
)).
seriousLateTimes
(
seriouslatetimes
).
seriousLateHours
(
seriouslatehours
)
.
absenLateTimes
(
absenlatetimes
).
earlyLeaveTimes
(
Double
.
valueOf
(
leanum
)).
lengthEarlyLeave
(
Double
.
valueOf
(
leahours
)).
numberWorkCardShortage
(
Double
.
valueOf
(
sbqkcs
))
.
numberDutyCardShortage
(
Double
.
valueOf
(
xbqkcs
)).
lengthBusinessTrip
(
traveltotal
).
timeOut
(
egresstotal
).
totalOvertimeHours
(
overtimetotal
)
.
belongYear
(
ca
.
get
(
Calendar
.
YEAR
)).
belongMonth
(
ca
.
get
(
Calendar
.
MONTH
)+
1
).
orgCode
(
org_code
).
lastModified
(
new
Date
().
getTime
()).
build
();
int
absenteeismdays
=
0
;
if
(
zjgzts
-
dkjl
>
0
)
{
absenteeismdays
=
zjgzts
-
dkjl
;
}
summary
.
setAbsenteeismDays
(
Double
.
valueOf
(
absenteeismdays
));
//旷工天数
//出差时长
//外出时长
//加班总时长
//工作日(转调休)
//休息日(转调休)
//节假日(转调休)
//工作日(转加班费)
//休息日(转加班费)
//节假日(转加班费)
summary
.
setBelongYear
(
ca
.
get
(
Calendar
.
YEAR
));
summary
.
setBelongMonth
(
ca
.
get
(
Calendar
.
MONTH
)+
1
);
summary
.
setOrgCode
(
org_code
);
summary
.
setLastModified
(
new
Date
().
getTime
());
/******审批接口----对接*******/
}
else
{
int
id
=
isyessum
.
getId
();
}
}
else
{
System
.
out
.
println
(
"该员工未加入考勤组"
);
}
summary
.
setDay1
(
noticesArray
[
0
]);
summary
.
setDay2
(
noticesArray
[
1
]);
summary
.
setDay3
(
noticesArray
[
2
]);
summary
.
setDay4
(
noticesArray
[
3
]);
summary
.
setDay5
(
noticesArray
[
4
]);
summary
.
setDay6
(
noticesArray
[
5
]);
summary
.
setDay7
(
noticesArray
[
6
]);
summary
.
setDay8
(
noticesArray
[
7
]);
summary
.
setDay9
(
noticesArray
[
8
]);
summary
.
setDay10
(
noticesArray
[
9
]);
summary
.
setDay11
(
noticesArray
[
10
]);
summary
.
setDay12
(
noticesArray
[
11
]);
summary
.
setDay13
(
noticesArray
[
12
]);
summary
.
setDay14
(
noticesArray
[
13
]);
summary
.
setDay15
(
noticesArray
[
14
]);
summary
.
setDay16
(
noticesArray
[
15
]);
summary
.
setDay17
(
noticesArray
[
16
]);
summary
.
setDay18
(
noticesArray
[
17
]);
summary
.
setDay19
(
noticesArray
[
18
]);
summary
.
setDay20
(
noticesArray
[
19
]);
summary
.
setDay21
(
noticesArray
[
20
]);
summary
.
setDay22
(
noticesArray
[
21
]);
summary
.
setDay23
(
noticesArray
[
22
]);
summary
.
setDay24
(
noticesArray
[
23
]);
summary
.
setDay25
(
noticesArray
[
24
]);
summary
.
setDay26
(
noticesArray
[
25
]);
summary
.
setDay27
(
noticesArray
[
26
]);
summary
.
setDay28
(
noticesArray
[
27
]);
summary
.
setDay29
(
noticesArray
[
28
]);
summary
.
setDay30
(
noticesArray
[
29
]);
summary
.
setDay31
(
noticesArray
[
30
]);
summary
.
insert
();
}
}
}
/****************************************************************/
KqglTaskTiming
.
builder
().
task
(
"AttendanceTask"
).
id
(
sock
.
getId
()).
executionStatus
(
0
).
lastExecutionTime
(
new
Date
().
getTime
()).
build
().
updateById
();
return
new
Exception
().
getStackTrace
()[
0
].
getMethodName
();
}
else
{
return
null
;
}
...
...
src/main/java/cn/timer/api/controller/kqgl/service/KqglServiceImpl.java
View file @
308ddd7e
...
...
@@ -33,16 +33,15 @@ public class KqglServiceImpl implements KqglService {
*/
@Override
public
boolean
attleaveapproval
(
AttLeaveApprovalDto
leaveappr
)
{
String
startdate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
leaveappr
.
getStarttime
());
String
enddate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
leaveappr
.
getEndtime
());
String
[]
days
=
ClockInTool
.
listToString
(
ClockInTool
.
getDays
(
startdate
,
enddate
)).
split
(
";"
);
for
(
String
num
:
days
)
{
//记入打卡月汇总关联表
KqglAssoRelationSummary
.
builder
().
userId
(
leaveappr
.
getUserid
()).
appTime
(
num
).
approvalId
(
leaveappr
.
getLeaveid
()).
approvalType
(
2
).
duration
(
leaveappr
.
getDuration
())
.
leaveTypeId
(
leaveappr
.
getLeavetype
()).
build
().
insert
();
.
leaveTypeId
(
leaveappr
.
getLeavetype
()).
startTime
(
new
SimpleDateFormat
(
"yyyy-MM-dd' 'HH:mm:ss"
).
format
(
leaveappr
.
getStarttime
()))
.
endTime
(
new
SimpleDateFormat
(
"yyyy-MM-dd' 'HH:mm:ss"
).
format
(
leaveappr
.
getEndtime
())).
build
().
insert
();
}
YgglMainEmp
emp
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getEmpNum
,
leaveappr
.
getUserid
()));
int
modifynumber
=
1
;
KqglAssoLeaveBalance
balan
=
kqglassoleavebalancemapper
.
selectOne
(
new
QueryWrapper
<
KqglAssoLeaveBalance
>().
lambda
().
eq
(
KqglAssoLeaveBalance:
:
getUserid
,
leaveappr
.
getUserid
())
...
...
@@ -50,10 +49,8 @@ public class KqglServiceImpl implements KqglService {
if
(
balan
!=
null
)
{
modifynumber
=
balan
.
getModifyNumber
()+
1
;
}
KqglAssoLeaveBalance
.
builder
().
leaveRulesId
(
leaveappr
.
getLeavetype
()).
userid
(
leaveappr
.
getUserid
()).
modifyAction
(
2
).
balanceDays
(
"-"
+
leaveappr
.
getDuration
())
.
reason
(
"系统按照规则自动"
).
modifyUserid
(
emp
.
getEmpNum
()).
modifyTimer
(
new
Date
().
getTime
()).
orgCode
(
emp
.
getOrgCode
()).
isAutomatic
(
1
).
modifyNumber
(
modifynumber
).
build
().
insert
();
//员工假期余额
return
true
;
}
...
...
@@ -62,7 +59,6 @@ public class KqglServiceImpl implements KqglService {
*/
@Override
public
boolean
attovertimeapproval
(
AttOvertimeApprovalDto
overappr
)
{
String
startdate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
overappr
.
getStarttime
());
String
enddate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
overappr
.
getEndtime
());
String
[]
days
=
ClockInTool
.
listToString
(
ClockInTool
.
getDays
(
startdate
,
enddate
)).
split
(
";"
);
...
...
@@ -70,11 +66,9 @@ public class KqglServiceImpl implements KqglService {
//记入打卡月汇总关联表
KqglAssoRelationSummary
.
builder
().
userId
(
overappr
.
getUserid
()).
appTime
(
num
).
approvalId
(
overappr
.
getOvertimeid
()).
approvalType
(
1
).
duration
(
overappr
.
getDuration
())
.
overtimeTypeId
(
overappr
.
getOvertimetype
()).
compensateId
(
overappr
.
getCompensate
()).
build
().
insert
();
.
overtimeTypeId
(
overappr
.
getOvertimetype
()).
compensateId
(
overappr
.
getCompensate
()).
startTime
(
new
SimpleDateFormat
(
"yyyy-MM-dd' 'HH:mm:ss"
).
format
(
overappr
.
getStarttime
()))
.
endTime
(
new
SimpleDateFormat
(
"yyyy-MM-dd' 'HH:mm:ss"
).
format
(
overappr
.
getEndtime
())).
build
().
insert
();
}
return
true
;
}
...
...
@@ -89,7 +83,8 @@ public class KqglServiceImpl implements KqglService {
String
[]
days
=
ClockInTool
.
listToString
(
ClockInTool
.
getDays
(
startdate
,
enddate
)).
split
(
";"
);
for
(
String
num
:
days
)
{
//记入打卡月汇总关联表
KqglAssoRelationSummary
.
builder
().
userId
(
evecappr
.
getUserid
()).
appTime
(
num
).
approvalId
(
evecappr
.
getEvectionid
()).
approvalType
(
3
).
build
().
insert
();
KqglAssoRelationSummary
.
builder
().
userId
(
evecappr
.
getUserid
()).
appTime
(
num
).
approvalId
(
evecappr
.
getEvectionid
()).
approvalType
(
3
)
.
startTime
(
new
SimpleDateFormat
(
"yyyy-MM-dd' 'HH:mm:ss"
).
format
(
evecappr
.
getStarttime
())).
endTime
(
new
SimpleDateFormat
(
"yyyy-MM-dd' 'HH:mm:ss"
).
format
(
evecappr
.
getEndtime
())).
build
().
insert
();
}
}
else
{
//外出
String
startdate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
evecappr
.
getStarttime
());
...
...
@@ -97,7 +92,8 @@ public class KqglServiceImpl implements KqglService {
String
[]
days
=
ClockInTool
.
listToString
(
ClockInTool
.
getDays
(
startdate
,
enddate
)).
split
(
";"
);
for
(
String
num
:
days
)
{
//记入打卡月汇总关联表
KqglAssoRelationSummary
.
builder
().
userId
(
evecappr
.
getUserid
()).
appTime
(
num
).
approvalId
(
evecappr
.
getEvectionid
()).
approvalType
(
4
).
build
().
insert
();
KqglAssoRelationSummary
.
builder
().
userId
(
evecappr
.
getUserid
()).
appTime
(
num
).
approvalId
(
evecappr
.
getEvectionid
()).
approvalType
(
4
)
.
startTime
(
new
SimpleDateFormat
(
"yyyy-MM-dd' 'HH:mm:ss"
).
format
(
evecappr
.
getStarttime
())).
endTime
(
new
SimpleDateFormat
(
"yyyy-MM-dd' 'HH:mm:ss"
).
format
(
evecappr
.
getEndtime
())).
build
().
insert
();
}
}
return
true
;
...
...
@@ -108,12 +104,9 @@ public class KqglServiceImpl implements KqglService {
*/
@Override
public
boolean
attrepairapproval
(
AttRepairApprovalDto
repaappr
)
{
String
cardrepltime
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
repaappr
.
getCardrepltime
());
//补卡时间
//记入打卡月汇总关联表
KqglAssoRelationSummary
.
builder
().
userId
(
repaappr
.
getUserid
()).
appTime
(
cardrepltime
).
approvalId
(
repaappr
.
getRepairid
()).
approvalType
(
5
).
build
().
insert
();
KqglAssoRelationSummary
.
builder
().
userId
(
repaappr
.
getUserid
()).
appTime
(
cardrepltime
).
approvalId
(
repaappr
.
getRepairid
()).
approvalType
(
5
).
startTime
(
new
SimpleDateFormat
(
"yyyy-MM-dd' 'HH:mm:ss"
).
format
(
repaappr
.
getCardrepltime
())).
build
().
insert
();
return
true
;
}
...
...
src/main/java/cn/timer/api/dao/kqmk/KqglAssoDkmxMapper.java
View file @
308ddd7e
package
cn
.
timer
.
api
.
dao
.
kqmk
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.timer.api.bean.kqmk.KqglAssoDkmx
;
import
cn.timer.api.dto.kqmk.AttSubsidiaryDto
;
/**
* 打卡明细表
...
...
@@ -13,4 +15,5 @@ import cn.timer.api.bean.kqmk.KqglAssoDkmx;
@Repository
public
interface
KqglAssoDkmxMapper
extends
BaseMapper
<
KqglAssoDkmx
>
{
AttSubsidiaryDto
subsidiary
(
int
userid
,
String
data
);
}
src/main/java/cn/timer/api/dao/kqmk/KqglAssoRelationSummaryMapper.java
View file @
308ddd7e
package
cn
.
timer
.
api
.
dao
.
kqmk
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
java.util.List
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.timer.api.bean.kqmk.KqglAssoRelationSummary
;
/**
...
...
@@ -13,4 +16,7 @@ import cn.timer.api.bean.kqmk.KqglAssoRelationSummary;
@Repository
public
interface
KqglAssoRelationSummaryMapper
extends
BaseMapper
<
KqglAssoRelationSummary
>
{
KqglAssoRelationSummary
SecondaryValue
(
int
userid
,
int
approvaltype
,
String
time
);
List
<
KqglAssoRelationSummary
>
SpecificLeave
(
int
userid
,
int
approvaltype
,
String
apptime
);
}
src/main/java/cn/timer/api/dao/kqmk/KqglAssoTeshuMapper.java
View file @
308ddd7e
...
...
@@ -18,6 +18,6 @@ public interface KqglAssoTeshuMapper extends BaseMapper<KqglAssoTeshu> {
int
insertKqglAssoTeshuList
(
List
<
KqglAssoTeshu
>
kqglassoteshu
);
List
<
KqglAssoTeshu
>
ShouldSpecialDatessetByKqzid
(
int
kqzid
,
int
tsrq
,
int
type
);
List
<
KqglAssoTeshu
>
ShouldSpecialDatessetByKqzid
(
int
kqzid
,
String
tsrq
,
int
type
);
}
src/main/java/cn/timer/api/dto/kqmk/AttSubsidiaryDto.java
0 → 100644
View file @
308ddd7e
package
cn
.
timer
.
api
.
dto
.
kqmk
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
AttSubsidiaryDto
{
@ApiModelProperty
(
value
=
"工作总时长"
,
example
=
"字段说明"
)
private
double
gzsctotalgzsc
;
@ApiModelProperty
(
value
=
"严重迟到总次数"
,
example
=
"字段说明"
)
private
double
yzcdcstotal
;
@ApiModelProperty
(
value
=
"严重迟到总时长(分钟) "
,
example
=
"字段说明"
)
private
double
yzcdsctotal
;
@ApiModelProperty
(
value
=
"旷工迟到总次数"
,
example
=
"字段说明"
)
private
double
kgcdfzstotal
;
}
src/main/resources/mapping/kqmk/KqglAssoDkmxMapper.xml
View file @
308ddd7e
...
...
@@ -28,6 +28,13 @@
<result
column=
"kgcdfzs"
property=
"kgcdfzs"
/>
</resultMap>
<resultMap
id=
"AttSubsidiary"
type=
"cn.timer.api.dto.kqmk.AttSubsidiaryDto"
>
<result
column=
"gzsctotalgzsc"
property=
"gzsctotalgzsc"
/>
<result
column=
"yzcdcstotal"
property=
"yzcdcstotal"
/>
<result
column=
"yzcdsctotal"
property=
"yzcdsctotal"
/>
<result
column=
"kgcdfzstotal"
property=
"kgcdfzstotal"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,
userid,
...
...
@@ -78,6 +85,17 @@
kgcdfzs KqglAssoDkmx_kgcdfzs
</sql>
<select
id=
"subsidiary"
resultMap=
"AttSubsidiary"
>
select SUM(dk.gzsc) as gzsctotalgzsc,
SUM(dk.yzcdcs) as yzcdcstotal,
SUM(dk.yzcdsc) as yzcdsctotal,
SUM(dk.kgcdfzs) as kgcdfzstotal
from kqgl_asso_dkmx dk
where dk.userid = #{userid}
and SUBSTR(dk.`data`,1,7) = #{data}
GROUP BY dk.userid
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkmx">
...
...
src/main/resources/mapping/kqmk/KqglAssoRelationSummaryMapper.xml
View file @
308ddd7e
...
...
@@ -13,6 +13,8 @@
<result
column=
"leave_type_id"
property=
"leaveTypeId"
/>
<result
column=
"overtime_type_id"
property=
"overtimeTypeId"
/>
<result
column=
"compensate_id"
property=
"compensateId"
/>
<result
column=
"start_time"
property=
"startTime"
/>
<result
column=
"end_time"
property=
"endTime"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
...
...
@@ -24,7 +26,9 @@
duration,
leave_type_id,
overtime_type_id,
compensate_id
compensate_id,
start_time,
end_time
</sql>
<sql
id=
"Base_Column_List_Alias"
>
...
...
@@ -36,9 +40,31 @@
duration KqglAssoRelationSummary_duration,
leave_type_id KqglAssoRelationSummary_leave_type_id,
overtime_type_id KqglAssoRelationSummary_overtime_type_id,
compensate_id KqglAssoRelationSummary_compensate_id
compensate_id KqglAssoRelationSummary_compensate_id,
start_time KqglAssoRelationSummary_start_time,
end_time KqglAssoRelationSummary_end_time
</sql>
<select
id=
"SecondaryValue"
resultMap=
"BaseResultMap"
>
select a.user_id,
SUM(a.duration) as duration
from (select res.user_id,res.duration
from kqgl_asso_relation_summary res
where res.user_id = #{userid}
and res.approval_type = #{approvaltype}
and SUBSTR(res.app_time,1,7) = #{time}
GROUP BY res.approval_id) as a
GROUP BY a.user_id
</select>
<select
id=
"SpecificLeave"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from kqgl_asso_relation_summary res
where res.user_id = #{userid}
and res.approval_type = #{approvaltype}
and SUBSTR(res.app_time,1,7) = #{apptime}
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoRelationSummary">
...
...
@@ -66,7 +92,13 @@
overtime_type_id,
</if>
<if test ='null != compensateId'>
compensate_id
compensate_id,
</if>
<if test ='null != startTime'>
start_time,
</if>
<if test ='null != endTime'>
end_time
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
...
...
@@ -92,7 +124,13 @@
#{overtimeTypeId},
</if>
<if test ='null != compensateId'>
#{compensateId}
#{compensateId},
</if>
<if test ='null != startTime'>
#{startTime},
</if>
<if test ='null != endTime'>
#{endTime}
</if>
</trim>
</insert>
...
...
@@ -112,7 +150,9 @@
<if test ='null != duration'>duration = #{duration},</if>
<if test ='null != leaveTypeId'>leave_type_id = #{leaveTypeId},</if>
<if test ='null != overtimeTypeId'>overtime_type_id = #{overtimeTypeId},</if>
<if test ='null != compensateId'>compensate_id = #{compensateId}</if>
<if test ='null != compensateId'>compensate_id = #{compensateId},</if>
<if test ='null != startTime'>start_time = #{startTime},</if>
<if test ='null != endTime'>end_time = #{endTime}</if>
</set>
WHERE id = #{id}
</update>
...
...
src/main/resources/mapping/kqmk/KqglAssoTeshuMapper.xml
View file @
308ddd7e
...
...
@@ -63,7 +63,7 @@
select
<include
refid=
"Base_Column_List"
/>
from kqgl_asso_teshu teshu
where teshu.kqzid = #{kqzid}
and
substring(teshu.tsrq,6,2
) = #{tsrq}
and
SUBSTR(teshu.tsrq,1,7
) = #{tsrq}
and teshu.type = #{type}
</select>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment