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
5cf5d8e8
Commit
5cf5d8e8
authored
Aug 08, 2020
by
leialin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lal' into 'develop'
Lal See merge request 8timerv2/8timerapiv200!401
parents
fdb5f1a7
47cfa9da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
611 additions
and
400 deletions
+611
-400
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
+611
-400
No files found.
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
View file @
5cf5d8e8
...
...
@@ -891,6 +891,7 @@ public class ClockInController {
dkmx
=
pcd
.
getId
();
atttype
=
1
;
}
else
{
//修改
boolean
zydk
=
true
;
dkmx
=
zydkmc
.
getId
();
KqglAssoDkmx
zypcd
=
KqglAssoDkmx
.
builder
().
build
();
if
((!(
""
).
equals
(
zydkmc
.
getSbdk1
())
||
zydkmc
.
getSbdk1
()
!=
null
)
&&
((
""
).
equals
(
zydkmc
.
getXbdk1
())
||
zydkmc
.
getXbdk1
()
==
null
)){
//下班1
...
...
@@ -900,6 +901,8 @@ public class ClockInController {
if
(
zysd1
.
after
(
zysd2
))
{
//当zysd1大于zysd2时,返回TRUE,当小于等于时,返回false;
msg
=
"自由工时:上班打卡后"
+
canpunchworkdate
+
"小时后,才可打下班卡"
;
sbyf
=
0
;
zydk
=
false
;
atttype
=
0
;
status_
=
2
;
}
else
{
zypcd
.
setId
(
zydkmc
.
getId
());
...
...
@@ -910,7 +913,9 @@ public class ClockInController {
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
zypcd
);
//修改打卡记录
}
atttype
=
2
;
if
(
zydk
)
{
atttype
=
2
;
}
}
else
if
((!(
""
).
equals
(
zydkmc
.
getSbdk1
())
||
zydkmc
.
getSbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
zydkmc
.
getXbdk1
())
||
zydkmc
.
getXbdk1
()
!=
null
)
&&
((
""
).
equals
(
zydkmc
.
getSbdk2
())
||
zydkmc
.
getSbdk2
()
==
null
)){
//上班2
zypcd
.
setId
(
zydkmc
.
getId
());
...
...
@@ -925,6 +930,8 @@ public class ClockInController {
if
(
zysd1
.
after
(
zysd2
))
{
//当zysd1大于zysd2时,返回TRUE,当小于等于时,返回false;
msg
=
"自由工时:上班打卡后"
+
canpunchworkdate
+
"小时后,才可打下班卡"
;
sbyf
=
0
;
zydk
=
false
;
atttype
=
0
;
status_
=
2
;
}
else
{
zypcd
.
setId
(
zydkmc
.
getId
());
...
...
@@ -939,7 +946,9 @@ public class ClockInController {
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
zypcd
);
//修改打卡记录
}
atttype
=
4
;
if
(
zydk
)
{
atttype
=
4
;
}
}
else
if
((!(
""
).
equals
(
zydkmc
.
getSbdk1
())
||
zydkmc
.
getSbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
zydkmc
.
getXbdk1
())
||
zydkmc
.
getXbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
zydkmc
.
getSbdk2
())
||
zydkmc
.
getSbdk2
()
!=
null
)
&&
(!(
""
).
equals
(
zydkmc
.
getXbdk2
())
||
zydkmc
.
getXbdk2
()
!=
null
)
&&
((
""
).
equals
(
zydkmc
.
getSbdk3
())
||
zydkmc
.
getSbdk3
()
==
null
)){
//上班3
...
...
@@ -956,6 +965,8 @@ public class ClockInController {
if
(
zysd1
.
after
(
zysd2
))
{
//当zysd1大于zysd2时,返回TRUE,当小于等于时,返回false;
msg
=
"自由工时:上班打卡后"
+
canpunchworkdate
+
"小时后,才可打下班卡"
;
sbyf
=
0
;
zydk
=
false
;
atttype
=
0
;
status_
=
2
;
}
else
{
zypcd
.
setId
(
zydkmc
.
getId
());
...
...
@@ -970,8 +981,9 @@ public class ClockInController {
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
zypcd
);
//修改打卡记录
}
atttype
=
6
;
if
(
zydk
)
{
atttype
=
6
;
}
}
else
{
atttype
=
7
;
}
...
...
@@ -1016,7 +1028,7 @@ public class ClockInController {
}
}
int
type
=
0
,
status
=
0
;
if
(
atttype
!=
0
)
{
if
(
atttype
>
0
)
{
if
((
atttype
)%
2
>
0
){
type
=
1
;
// 类型(类型 0:无排班打卡 1:上班 2:下班) punchcardtime == 0:无班次打卡
if
(
attdate
.
getAttgrouptype
()
!=
3
)
{
...
...
@@ -1432,6 +1444,7 @@ public class ClockInController {
String
msg
=
"未知错误,请联系管理员"
;
int
sbyf
=
1
;
//0:失败;1:成功
int
status_
=
0
;
YgglMainEmp
user
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getEmpNum
,
clock
.
getUserid
()).
eq
(
YgglMainEmp:
:
getOrgCode
,
userBean
.
getOrgCode
()));
if
(
user
!=
null
)
{
...
...
@@ -1446,7 +1459,8 @@ public class ClockInController {
String
putime
=
sStdIoTime
.
substring
(
0
,
10
);
////转换打卡时间格式 yyyy-MM-dd
// String putime = new SimpleDateFormat("yyyy-MM-dd").format(Double.valueOf(clock.getPunchtime()));//转换打卡时间格式
String
putimehhmm
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
);
//转换打卡时间格式 年月日
Long
startDate
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
putime
,
"yyyy-MM-dd"
)).
getTime
();
//打卡当天开始时间
Long
endDate
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
putime
,
"yyyy-MM-dd"
)).
getTime
();
//打卡当天结束时间
...
...
@@ -1512,8 +1526,15 @@ public class ClockInController {
//无记录的话就找昨天的数据
AttendanceCardListDto
attdate1
=
MethodCall
(
qyid
,
userid
,
yesterday
);
List
<
AttSchedule
>
ashssyebo
=
attdate1
.
getAttsch
();
//获取昨天应打卡时间
if
(
ashssyebo
.
size
()
>
0
)
{
Date
sd1
=
df1
.
parse
(
ClockInTool
.
stampToDate
(
String
.
valueOf
(
ashssyebo
.
get
(
0
).
getTime
())));
//当天应打的首次上班卡时间
Date
sd2
=
df1
.
parse
(
current_time
);
//当前时间
if
(
sd1
.
after
(
sd2
))
{
//大于
dnck
=
true
;
}
}
crdk
=
true
;
}
if
(
crdk
&&
dnck
)
{
...
...
@@ -1532,204 +1553,252 @@ public class ClockInController {
if
(
EmptyUtil
.
isEmpty
(
attdate
.
getAttsch
()))
{
msg
=
"当前未排班"
;
sbyf
=
0
;
status_
=
2
;
}
else
{
long
starttime1
=
0
,
starttime1ks
=
0
,
starttime1js
=
0
,
endtime1
=
0
,
endtime1ks
=
0
,
endtime1js
=
0
,
starttime2
=
0
,
starttime2ks
=
0
,
starttime2js
=
0
,
endtime2
=
0
,
endtime2ks
=
0
,
endtime2js
=
0
,
starttime3
=
0
,
starttime3ks
=
0
,
starttime3js
=
0
,
endtime3
=
0
,
endtime3ks
=
0
,
endtime3js
=
0
;
if
(
attdate
.
getAttsch
().
size
()
>
0
)
{
List
<
AttSchedule
>
ash
=
attdate
.
getAttsch
();
int
y
=
0
;
clockt
.
setShifid
(
ash
.
get
(
y
).
getId
());
shifid
=
ash
.
get
(
y
).
getId
();
//班次id
if
(
attdate
.
getAttsch
().
size
()
==
2
||
attdate
.
getAttsch
().
size
()
==
4
||
attdate
.
getAttsch
().
size
()
==
6
)
{
starttime1
=
ash
.
get
(
0
).
getTime
();
starttime1ks
=
ash
.
get
(
0
).
getStarttime
();
starttime1js
=
ash
.
get
(
0
).
getEndtime
();
endtime1
=
ash
.
get
(
1
).
getTime
();
endtime1ks
=
ash
.
get
(
1
).
getStarttime
();
endtime1js
=
ash
.
get
(
1
).
getEndtime
();
}
if
(
attdate
.
getAttsch
().
size
()
==
4
||
attdate
.
getAttsch
().
size
()
==
6
)
{
starttime2
=
ash
.
get
(
2
).
getTime
();
starttime2ks
=
ash
.
get
(
2
).
getStarttime
();
starttime2js
=
ash
.
get
(
2
).
getEndtime
();
endtime2
=
ash
.
get
(
3
).
getTime
();
endtime2ks
=
ash
.
get
(
3
).
getStarttime
();
endtime2js
=
ash
.
get
(
3
).
getEndtime
();
}
if
(
attdate
.
getAttsch
().
size
()
==
6
)
{
starttime3
=
ash
.
get
(
4
).
getTime
();
starttime3ks
=
ash
.
get
(
4
).
getStarttime
();
starttime3js
=
ash
.
get
(
4
).
getEndtime
();
endtime3
=
ash
.
get
(
5
).
getTime
();
endtime3ks
=
ash
.
get
(
5
).
getStarttime
();
endtime3js
=
ash
.
get
(
5
).
getEndtime
();
}
if
(
dkmc
==
null
)
{
kskd
=
false
;
if
(
attdate
.
getAttsch
().
size
()
==
2
)
{
//一套上下班 上班1
Date
sd1
=
df1
.
parse
(
ClockInTool
.
stampToDate
(
String
.
valueOf
(
starttime1
)));
//应打卡时间
Date
sd2
=
df1
.
parse
(
sStdIoTime
);
//打卡时间
Date
sd3
=
df1
.
parse
(
ClockInTool
.
stampToDate
(
String
.
valueOf
(
endtime1
)));
//应打卡时间
if
(
sd2
.
before
(
sd3
))
{
atttype
=
1
;
}
if
(
sd2
.
after
(
sd1
)
&&
sd2
.
after
(
sd3
))
{
atttype
=
2
;
}
}
else
{
boolean
getinto
=
true
;
//打卡时间 对比班次 接近哪个时间就打哪个时间的卡
//排查请假是否在最后一次打卡范围内 查询当月的请假所有日期
KqglAssoRelationSummary
leainv
=
kqglassorelationsummarymapper
.
leaveinvesti
(
userid
,
2
,
putime
,
qyid
);
boolean
adopt
=
false
;
if
(
leainv
!=
null
)
{
adopt
=
ClockInTool
.
hourMinuteBetween
(
putimehhmm
,
leainv
.
getStartTime
().
substring
(
0
,
16
),
leainv
.
getEndTime
().
substring
(
0
,
16
),
"yyyy-MM-dd HH:mm"
);
}
if
(
adopt
)
{
msg
=
"已请假"
;
sbyf
=
0
;
status_
=
2
;
}
else
{
long
starttime1
=
0
,
starttime1ks
=
0
,
starttime1js
=
0
,
endtime1
=
0
,
endtime1ks
=
0
,
endtime1js
=
0
,
starttime2
=
0
,
starttime2ks
=
0
,
starttime2js
=
0
,
endtime2
=
0
,
endtime2ks
=
0
,
endtime2js
=
0
,
starttime3
=
0
,
starttime3ks
=
0
,
starttime3js
=
0
,
endtime3
=
0
,
endtime3ks
=
0
,
endtime3js
=
0
;
if
(
attdate
.
getAttsch
().
size
()
>
0
)
{
List
<
AttSchedule
>
ash
=
attdate
.
getAttsch
();
int
y
=
0
;
clockt
.
setShifid
(
ash
.
get
(
y
).
getId
());
shifid
=
ash
.
get
(
y
).
getId
();
//班次id
if
(
attdate
.
getAttsch
().
size
()
==
2
||
attdate
.
getAttsch
().
size
()
==
4
||
attdate
.
getAttsch
().
size
()
==
6
)
{
starttime1
=
ash
.
get
(
0
).
getTime
();
starttime1ks
=
ash
.
get
(
0
).
getStarttime
();
starttime1js
=
ash
.
get
(
0
).
getEndtime
();
endtime1
=
ash
.
get
(
1
).
getTime
();
endtime1ks
=
ash
.
get
(
1
).
getStarttime
();
endtime1js
=
ash
.
get
(
1
).
getEndtime
();
}
if
(
attdate
.
getAttsch
().
size
()
==
4
||
attdate
.
getAttsch
().
size
()
==
6
)
{
starttime2
=
ash
.
get
(
2
).
getTime
();
starttime2ks
=
ash
.
get
(
2
).
getStarttime
();
starttime2js
=
ash
.
get
(
2
).
getEndtime
();
endtime2
=
ash
.
get
(
3
).
getTime
();
endtime2ks
=
ash
.
get
(
3
).
getStarttime
();
endtime2js
=
ash
.
get
(
3
).
getEndtime
();
}
if
(
attdate
.
getAttsch
().
size
()
==
6
)
{
starttime3
=
ash
.
get
(
4
).
getTime
();
starttime3ks
=
ash
.
get
(
4
).
getStarttime
();
starttime3js
=
ash
.
get
(
4
).
getEndtime
();
endtime3
=
ash
.
get
(
5
).
getTime
();
endtime3ks
=
ash
.
get
(
5
).
getStarttime
();
endtime3js
=
ash
.
get
(
5
).
getEndtime
();
}
if
(
dkmc
==
null
)
{
kskd
=
false
;
if
(
attdate
.
getAttsch
().
size
()
==
2
)
{
//一套上下班 上班1
Date
sd1
=
df1
.
parse
(
ClockInTool
.
stampToDate
(
String
.
valueOf
(
starttime1
)));
//应打卡时间
Date
sd2
=
df1
.
parse
(
sStdIoTime
);
//打卡时间
Date
sd3
=
df1
.
parse
(
ClockInTool
.
stampToDate
(
String
.
valueOf
(
endtime1
)));
//应打卡时间
if
(
sd2
.
before
(
sd3
))
{
atttype
=
1
;
}
if
(
sd2
.
after
(
sd1
)
&&
sd2
.
after
(
sd3
))
{
atttype
=
2
;
}
}
else
{
boolean
getinto
=
true
;
//打卡时间 对比班次 接近哪个时间就打哪个时间的卡
if
(
attdate
.
getAttsch
().
size
()
==
4
||
attdate
.
getAttsch
().
size
()
==
6
)
{
//punchstart 应打卡开始时间 punchend:应打卡结束时间 time_:打卡时间
if
(
clock
.
getType
()
==
1
)
{
boolean
effectiveDate1
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime1ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime1js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate1
)
{
//在范围内就打卡
atttype
=
clock
.
getType
();
getinto
=
false
;
}
else
{
if
(
getinto
)
{
isRange
=
false
;
}
}
}
else
if
(
clock
.
getType
()
==
2
){
boolean
effectiveDate2
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime1ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime1js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate2
)
{
//在范围内就打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto
=
false
;
}
else
{
if
(
getinto
)
{
isRange
=
false
;
}
}
}
else
if
(
clock
.
getType
()
==
3
)
{
boolean
effectiveDate3
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime2ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime2js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate3
)
{
//在范围内就打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto
=
false
;
}
else
{
if
(
getinto
)
{
isRange
=
false
;
}
}
}
else
if
(
clock
.
getType
()
==
4
)
{
boolean
effectiveDate4
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime2ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime2js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate4
)
{
//在范围内就打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto
=
false
;
}
else
{
if
(
getinto
)
{
isRange
=
false
;
}
}
}
}
if
(
attdate
.
getAttsch
().
size
()
==
6
)
{
if
(
clock
.
getType
()
==
5
)
{
boolean
effectiveDate5
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime3ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime3js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate5
)
{
//在范围内就打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto
=
false
;
}
else
{
if
(
getinto
)
{
isRange
=
false
;
}
}
}
else
if
(
clock
.
getType
()
==
6
)
{
boolean
effectiveDate6
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime3ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime3js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate6
)
{
//在范围内就打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto
=
false
;
}
else
{
if
(
getinto
)
{
isRange
=
false
;
}
}
}
}
}
execution_status
=
1
;
}
else
{
boolean
getinto2
=
true
;
execution_status
=
2
;
if
(
attdate
.
getAttsch
().
size
()
==
2
)
{
//下班1
if
(
clock
.
getType
()
==
1
)
{
if
(
clock
.
getDiffer
()
==
2
)
{
//更新打卡
//如果第二次后打卡,未超过上班时间 即为打卡失效
Date
sd1
=
df1
.
parse
(
ClockInTool
.
stampToDate
(
String
.
valueOf
(
starttime1
)));
//应打卡时间
Date
sd2
=
df1
.
parse
(
sStdIoTime
);
//打卡时间
if
(
sd1
.
after
(
sd2
))
{
sbdkkd
=
true
;
//打卡无效
// atttype = 1;
}
}
}
else
if
(
clock
.
getType
()
==
2
){
if
(
dkmc
.
getSbdk1
()
!=
null
&&
dkmc
.
getXbdk1
()
==
null
){
kskd
=
false
;
atttype
=
clock
.
getType
();
}
else
{
//最后一次卡的时候 再继续打视为更新最后一次打卡
kskd
=
true
;
//更新最后一次打卡
atttype
=
clock
.
getType
();
}
}
}
if
(
attdate
.
getAttsch
().
size
()
==
4
||
attdate
.
getAttsch
().
size
()
==
6
)
{
//punchstart 应打卡开始时间 punchend:应打卡结束时间 time_:打卡时间
if
(
clock
.
getType
()
==
1
)
{
boolean
effectiveDate1
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime1ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime1js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate1
)
{
//在范围内就打卡
atttype
=
clock
.
getType
();
getinto
=
false
;
}
else
{
if
(
getinto
)
{
isRange
=
false
;
if
(
dkmc
.
getSbdk1
()
!=
null
)
{
sbdkkd
=
true
;
//打卡无效
}
else
{
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto2
=
false
;
}
}
else
{
if
(
getinto2
)
{
isRange
=
false
;
}
}
}
else
if
(
clock
.
getType
()
==
2
){
}
else
if
(
clock
.
getType
()
==
2
)
{
boolean
effectiveDate2
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime1ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime1js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate2
)
{
//在范围内就打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto
=
false
;
}
else
{
if
(
getinto
)
{
isRange
=
false
;
if
(
dkmc
.
getXbdk1
()
!=
null
)
{
kskd
=
true
;
////更新最后一次打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto2
=
false
;
}
else
{
kskd
=
false
;
//更新最后一次打卡
atttype
=
clock
.
getType
();
}
}
else
{
if
(
getinto2
)
{
isRange
=
false
;
}
}
}
else
if
(
clock
.
getType
()
==
3
)
{
boolean
effectiveDate3
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime2ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime2js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate3
)
{
//在范围内就打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto
=
false
;
}
else
{
if
(
getinto
)
{
isRange
=
false
;
if
(
dkmc
.
getSbdk2
()
!=
null
)
{
sbdkkd
=
true
;
//打卡无效
}
else
{
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto2
=
false
;
}
}
}
else
if
(
clock
.
getType
()
==
4
)
{
boolean
effectiveDate4
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime2ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime2js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate4
)
{
//在范围内就打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto
=
false
;
}
else
{
if
(
getinto
)
{
isRange
=
false
;
}
else
{
if
(
getinto2
)
{
isRange
=
false
;
}
}
}
else
if
(
clock
.
getType
()
==
4
)
{
boolean
effectiveDate4
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime2ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime2js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate4
)
{
//在范围内就打卡
if
(
dkmc
.
getXbdk2
()
!=
null
)
{
kskd
=
true
;
////更新最后一次打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto2
=
false
;
}
else
{
kskd
=
false
;
atttype
=
clock
.
getType
();
}
}
else
{
if
(
getinto2
)
{
isRange
=
false
;
}
}
}
}
if
(
attdate
.
getAttsch
().
size
()
==
6
)
{
if
(
clock
.
getType
()
==
5
)
{
boolean
effectiveDate5
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime3ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime3js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate5
)
{
//在范围内就打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto
=
false
;
}
else
{
if
(
getinto
)
{
isRange
=
false
;
if
(
dkmc
.
getSbdk2
()
!=
null
)
{
sbdkkd
=
true
;
//打卡无效
}
else
{
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto2
=
false
;
}
}
else
{
if
(
getinto2
)
{
isRange
=
false
;
}
}
}
else
if
(
clock
.
getType
()
==
6
)
{
boolean
effectiveDate6
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime3ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime3js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate6
)
{
//在范围内就打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto
=
false
;
}
else
{
if
(
getinto
)
{
isRange
=
false
;
}
}
}
}
}
execution_status
=
1
;
}
else
{
boolean
getinto2
=
true
;
execution_status
=
2
;
if
(
attdate
.
getAttsch
().
size
()
==
2
)
{
//下班1
if
(
clock
.
getType
()
==
1
)
{
if
(
clock
.
getDiffer
()
==
2
)
{
//更新打卡
//如果第二次后打卡,未超过上班时间 即为打卡失效
Date
sd1
=
df1
.
parse
(
ClockInTool
.
stampToDate
(
String
.
valueOf
(
starttime1
)));
//应打卡时间
Date
sd2
=
df1
.
parse
(
sStdIoTime
);
//打卡时间
if
(
sd1
.
after
(
sd2
))
{
sbdkkd
=
true
;
//打卡无效
// atttype = 1;
}
}
}
else
if
(
clock
.
getType
()
==
2
){
if
(
dkmc
.
getSbdk1
()
!=
null
&&
dkmc
.
getXbdk1
()
==
null
){
kskd
=
false
;
atttype
=
clock
.
getType
();
}
else
{
//最后一次卡的时候 再继续打视为更新最后一次打卡
kskd
=
true
;
//更新最后一次打卡
atttype
=
clock
.
getType
();
}
}
}
if
(
attdate
.
getAttsch
().
size
()
==
4
||
attdate
.
getAttsch
().
size
()
==
6
)
{
if
(
clock
.
getType
()
==
1
)
{
boolean
effectiveDate1
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime1ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime1js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate1
)
{
//在范围内就打卡
if
(
dkmc
.
getSbdk1
()
!=
null
)
{
sbdkkd
=
true
;
//打卡无效
}
else
{
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto2
=
false
;
}
}
else
{
if
(
getinto2
)
{
isRange
=
false
;
}
}
}
else
if
(
clock
.
getType
()
==
2
)
{
boolean
effectiveDate2
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime1ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime1js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate2
)
{
//在范围内就打卡
if
(
dkmc
.
getXbdk1
()
!=
null
)
{
kskd
=
true
;
////更新最后一次打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto2
=
false
;
}
else
{
kskd
=
false
;
//更新最后一次打卡
atttype
=
clock
.
getType
();
}
}
else
{
if
(
getinto2
)
{
isRange
=
false
;
}
}
}
else
if
(
clock
.
getType
()
==
3
)
{
boolean
effectiveDate3
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime2ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime2js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate3
)
{
//在范围内就打卡
if
(
dkmc
.
getSbdk2
()
!=
null
)
{
sbdkkd
=
true
;
//打卡无效
}
else
{
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto2
=
false
;
}
}
else
{
if
(
getinto2
)
{
isRange
=
false
;
}
}
}
else
if
(
clock
.
getType
()
==
4
)
{
boolean
effectiveDate4
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime2ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime2js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate4
)
{
//在范围内就打卡
if
(
dkmc
.
getXbdk2
()
!=
null
)
{
kskd
=
true
;
//
//
更新最后一次打卡
kskd
=
true
;
//更新最后一次打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto2
=
false
;
...
...
@@ -1742,257 +1811,374 @@ public class ClockInController {
isRange
=
false
;
}
}
}
}
if
(
attdate
.
getAttsch
().
size
()
==
6
)
{
if
(
clock
.
getType
()
==
5
)
{
boolean
effectiveDate5
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime3ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
starttime3js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate5
)
{
//在范围内就打卡
if
(
dkmc
.
getSbdk2
()
!=
null
)
{
sbdkkd
=
true
;
//打卡无效
}
else
{
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto2
=
false
;
}
}
else
{
if
(
getinto2
)
{
isRange
=
false
;
}
}
}
else
if
(
clock
.
getType
()
==
6
)
{
boolean
effectiveDate6
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime3ks
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
endtime3js
),
"yyyy-MM-dd HH:mm"
);
if
(
effectiveDate6
)
{
//在范围内就打卡
if
(
dkmc
.
getXbdk2
()
!=
null
)
{
kskd
=
true
;
//更新最后一次打卡
atttype
=
clock
.
getType
();
isRange
=
true
;
//在范围
getinto2
=
false
;
}
else
{
kskd
=
false
;
atttype
=
clock
.
getType
();
}
}
else
{
if
(
getinto2
)
{
isRange
=
false
;
}
}
}
}
}
}
if
(
atttype
==
1
)
{
punchcardtime
=
starttime1
;
punchstart
=
starttime1ks
;
punchend
=
starttime1js
;
}
else
if
(
atttype
==
2
)
{
punchcardtime
=
endtime1
;
punchstart
=
endtime1ks
;
punchend
=
endtime1js
;
}
else
if
(
atttype
==
3
)
{
punchcardtime
=
starttime2
;
punchstart
=
starttime2ks
;
punchend
=
starttime2js
;
}
else
if
(
atttype
==
4
)
{
punchcardtime
=
endtime2
;
punchstart
=
endtime2ks
;
punchend
=
endtime2js
;
}
else
if
(
atttype
==
5
)
{
punchcardtime
=
starttime3
;
punchstart
=
starttime3ks
;
punchend
=
starttime3js
;
}
else
if
(
atttype
==
6
)
{
punchcardtime
=
endtime3
;
punchstart
=
endtime3ks
;
punchend
=
endtime3js
;
}
if
(
clockt
.
getShifid
()
!=
0
)
{
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
if
(
attdate
.
getAttsch
().
size
()
>
0
&&
clockt
.
getShifid
()
>
0
){
//有无班次
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
clockt
.
getShifid
()));
}
//打卡记录录入 -- 打卡是否有时间范围限制
if
(
attdate
.
getAttsch
().
size
()
==
2
)
{
if
(
punchstart
>
0
&&
punchend
>
0
)
{
String
staputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
punchstart
);
//应打卡开始时间
String
entputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
punchend
);
//应打卡结束时间
String
DKputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
);
//打卡时间
boolean
effectiveDate
=
ClockInTool
.
hourMinuteBetween
(
DKputime
,
staputime
,
entputime
,
"yyyy-MM-dd HH:mm"
);
if
(!
effectiveDate
)
{
// System.out.println("当前打卡时间不在范围内");
isRange
=
false
;
}
}
}
}
}
}
if
(
isRange
)
{
int
yzcd
=
shif
.
getYzcdfzs
();
//严重迟到分钟数
int
kgcdfzs
=
shif
.
getKgcdfzs
();
//旷工迟到分钟数
//班次的休息时间
long
rest_time
=
0
;
if
(
shif
.
getStartTime
()
!=
null
&&
shif
.
getEndTime
()
!=
null
)
{
long
kaishixiuxi
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
putime
+
" "
+
shif
.
getStartTime
()+
":00"
));
long
jieshuxiuxi
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
putime
+
" "
+
shif
.
getEndTime
()+
":00"
));
rest_time
=
(
jieshuxiuxi
-
kaishixiuxi
)/
1000
/
60
;
//休息时间
}
if
(
execution_status
==
1
)
{
//上班1 ****新增
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
userid
(
userid
).
data
(
putime
).
qyid
(
qyid
).
dksj
(
startDate
).
build
();
int
sbdkjg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
((
atttype
)%
2
>
0
){
//上班
if
(
time
>
0
){
sbdkjg
=
Integer
.
valueOf
(
time
.
toString
());
}
// 打卡结果
}
else
{
//下班
if
(
time
>
0
){}
else
{
sbdkjg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));
}
// 打卡结果
if
(
atttype
==
1
)
{
punchcardtime
=
starttime1
;
punchstart
=
starttime1ks
;
punchend
=
starttime1js
;
}
else
if
(
atttype
==
2
)
{
punchcardtime
=
endtime1
;
punchstart
=
endtime1ks
;
punchend
=
endtime1js
;
}
else
if
(
atttype
==
3
)
{
punchcardtime
=
starttime2
;
punchstart
=
starttime2ks
;
punchend
=
starttime2js
;
}
else
if
(
atttype
==
4
)
{
punchcardtime
=
endtime2
;
punchstart
=
endtime2ks
;
punchend
=
endtime2js
;
}
else
if
(
atttype
==
5
)
{
punchcardtime
=
starttime3
;
punchstart
=
starttime3ks
;
punchend
=
starttime3js
;
}
else
if
(
atttype
==
6
)
{
punchcardtime
=
endtime3
;
punchstart
=
endtime3ks
;
punchend
=
endtime3js
;
}
if
(
clockt
.
getShifid
()
!=
0
)
{
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
if
(
attdate
.
getAttsch
().
size
()
>
0
&&
clockt
.
getShifid
()
>
0
){
//有无班次
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
clockt
.
getShifid
()));
}
//打卡记录录入 -- 打卡是否有时间范围限制
if
(
attdate
.
getAttsch
().
size
()
==
2
)
{
if
(
punchstart
>
0
&&
punchend
>
0
)
{
String
staputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
punchstart
);
//应打卡开始时间
String
entputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
punchend
);
//应打卡结束时间
String
DKputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
);
//打卡时间
boolean
effectiveDate
=
ClockInTool
.
hourMinuteBetween
(
DKputime
,
staputime
,
entputime
,
"yyyy-MM-dd HH:mm"
);
if
(!
effectiveDate
)
{
// System.out.println("当前打卡时间不在范围内");
isRange
=
false
;
}
}
}
if
(
isRange
)
{
if
(
atttype
==
1
)
{
pcd
.
setSbdk1
(
time_
);
pcd
.
setSbdk1jg
(
sbdkjg
);
}
else
if
(
atttype
==
2
)
{
pcd
.
setXbdk1
(
time_
);
pcd
.
setXbdk1jg
(
sbdkjg
);
}
else
if
(
atttype
==
3
)
{
pcd
.
setSbdk2
(
time_
);
pcd
.
setSbdk2jg
(
sbdkjg
);
}
else
if
(
atttype
==
4
)
{
pcd
.
setXbdk2
(
time_
);
pcd
.
setXbdk2jg
(
sbdkjg
);
}
else
if
(
atttype
==
5
)
{
pcd
.
setSbdk3
(
time_
);
pcd
.
setSbdk3jg
(
sbdkjg
);
}
else
if
(
atttype
==
6
)
{
pcd
.
setXbdk3
(
time_
);
pcd
.
setXbdk3jg
(
sbdkjg
);
}
int
yxcd
=
shif
.
getYxcdfzs
();
//允许迟到
int
yzcd
=
shif
.
getYzcdfzs
();
//严重迟到分钟数
int
kgcdfzs
=
shif
.
getKgcdfzs
();
//旷工迟到分钟数
int
dkcs_
=
shif
.
getSxbcs
();
//上下班打卡次数
int
iswzwd
=
shif
.
getIsWzwd
();
//是否开启晚走晚到(0:否;1:是)
int
ydkcs
=
0
;
if
(
shif
!=
null
){
ydkcs
=
shif
.
getSxbcs
()*
2
;}
//应打卡次数
if
(
sbdkjg
>
yzcd
&&
yzcd
>
0
)
{
yzcdcs
++;
yzcdsc
=
sbdkjg
-
yzcd
;
//班次的休息时间
long
rest_time
=
0
;
if
(
shif
.
getStartTime
()
!=
null
&&
shif
.
getEndTime
()
!=
null
)
{
long
kaishixiuxi
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
putime
+
" "
+
shif
.
getStartTime
()+
":00"
));
long
jieshuxiuxi
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
putime
+
" "
+
shif
.
getEndTime
()+
":00"
));
rest_time
=
(
jieshuxiuxi
-
kaishixiuxi
)/
1000
/
60
;
//休息时间
}
if
(
sbdkjg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;}
pcd
.
setYdkcs
(
ydkcs
);
pcd
.
setYzcdcs
(
yzcdcs
);
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
pcd
.
setKgcdfzs
(
kgcdcs
);
if
(!
pcd
.
insert
())
{
throw
new
CustomException
(
"打卡明细-新增异常-1"
);
double
xbwz1
=
0
,
xbwz2
=
0
,
xbwz3
=
0
;
int
sbwd1
=
0
,
sbwd2
=
0
,
sbwd3
=
0
;
int
arrive_late
=
0
;
//晚到时间
String
clock_date
=
""
;
//应打卡时间
Long
latetime
=
0
l
;
//前天晚走时长(分钟)
KqglAssoDkmx
yesterdaymx
=
KqglAssoDkmx
.
builder
().
build
();
AttendanceCardListDto
attdateyesterday
;
long
yesendtime1
=
0
,
yesendtime2
=
0
,
yesendtime3
=
0
;
//存在晚走玩到
if
(
iswzwd
>
0
)
{
//统一分钟数
xbwz1
=
Double
.
valueOf
(
shif
.
getXbwz1
())
*
60
;
//下班晚走1
String
sbwd1_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd1
())
*
60
);
sbwd1
=
Integer
.
valueOf
(
sbwd1_
.
substring
(
0
,
sbwd1_
.
lastIndexOf
(
"."
)));
//上班晚到1
xbwz2
=
Double
.
valueOf
(
shif
.
getXbwz2
())
*
60
;
//下班晚走2
String
sbwd2_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd2
())
*
60
);
sbwd2
=
Integer
.
valueOf
(
sbwd2_
.
substring
(
0
,
sbwd2_
.
lastIndexOf
(
"."
)));
//上班晚到2
xbwz3
=
Double
.
valueOf
(
shif
.
getXbwz3
())
*
60
;
//下班晚走3
String
sbwd3_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd3
())
*
60
);
sbwd3
=
Integer
.
valueOf
(
sbwd3_
.
substring
(
0
,
sbwd3_
.
lastIndexOf
(
"."
)));
//上班晚到3
//获取前一天最后下班的时间
yesterdaymx
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
userid
)
.
ge
(
KqglAssoDkmx:
:
getDksj
,
startDateyesterday
).
le
(
KqglAssoDkmx:
:
getDksj
,
endDateyesterday
));
attdateyesterday
=
MethodCall
(
qyid
,
userid
,
yesterday
);
List
<
AttSchedule
>
ash
=
attdateyesterday
.
getAttsch
();
if
(
attdateyesterday
.
getAttsch
().
size
()
==
2
||
attdateyesterday
.
getAttsch
().
size
()
==
4
||
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesendtime1
=
ash
.
get
(
1
).
getTime
();
}
if
(
attdateyesterday
.
getAttsch
().
size
()
==
4
||
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesendtime2
=
ash
.
get
(
3
).
getTime
();
}
if
(
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesendtime3
=
ash
.
get
(
5
).
getTime
();
}
}
dkmx
=
pcd
.
getId
();
}
else
if
(
execution_status
==
2
){
dkmx
=
dkmc
.
getId
();
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
build
();
if
(
atttype
==
2
){
//下班1
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk1
(
time_
);
//下班1打卡时间
if
(
execution_status
==
1
)
{
//上班1 ****新增
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
userid
(
userid
).
data
(
putime
).
qyid
(
qyid
).
dksj
(
startDate
).
build
();
int
sbdkjg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst1
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk1jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk1jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
if
((
atttype
)%
2
>
0
){
//上班
if
(
time
>
0
){
sbdkjg
=
Integer
.
valueOf
(
time
.
toString
());
}
// 打卡结果
}
else
{
//下班
if
(
time
>
0
){}
else
{
sbdkjg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));
}
// 打卡结果
}
//存在晚走玩到
if
(
iswzwd
>
0
&&
yesterdaymx
!=
null
)
{
if
(
dkcs_
==
1
)
{
if
(
yesterdaymx
.
getXbdk1
()
!=
null
&&
yesterdaymx
.
getXbdk1jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk1
()
-
yesendtime1
)/
1000
/
60
;
}
}
else
if
(
dkcs_
==
2
){
if
(
yesterdaymx
.
getXbdk2
()
!=
null
&&
yesterdaymx
.
getXbdk2jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk2
()
-
yesendtime2
)/
1000
/
60
;
}
}
else
{
if
(
yesterdaymx
.
getXbdk3
()
!=
null
&&
yesterdaymx
.
getXbdk3jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk3
()
-
yesendtime3
)/
1000
/
60
;
}
}
if
(
latetime
!=
0
)
{
double
latetime_
=
Double
.
valueOf
(
String
.
valueOf
(
latetime
));
//前天晚走时长(分钟)
if
(
latetime_
>
xbwz1
&&
latetime_
<
xbwz2
)
{
arrive_late
=
sbwd1
;
}
else
if
(
latetime_
>
xbwz2
&&
latetime_
<
xbwz3
)
{
arrive_late
=
sbwd2
;
}
else
if
(
latetime_
>
xbwz3
)
{
arrive_late
=
sbwd3
;
}
clock_date
=
ClockInTool
.
stampToDate
(
String
.
valueOf
(
punchcardtime
));
Long
changed_time
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
ClockInTool
.
addtime
(
clock_date
,
"+"
+
arrive_late
)));
//晚到后应打卡时间
punchcardtime
=
changed_time
;
//更换当天打卡时间
Long
timeyes
=
(
time_
-
changed_time
)/
1000
/
60
;
//
if
((
atttype
)%
2
>
0
){
//上班
if
(
timeyes
>
0
){
sbdkjg
=
Integer
.
valueOf
(
timeyes
.
toString
());
}
else
{
sbdkjg
=
0
;
}
}
else
{
//下班
if
(
timeyes
>
0
){
sbdkjg
=
0
;
}
else
{
sbdkjg
=
Math
.
abs
(
Integer
.
valueOf
(
timeyes
.
toString
()));
}
}
}
}
}
if
(
dkmc
.
getSbdk1
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk1
())/
1000
/
60
-
rest_time
;
pcd
.
setGzsc
(
Math
.
abs
(
Double
.
valueOf
(
time
.
toString
())));
//只打一次卡时计算工作时长
//允许迟到范围
if
(
sbdkjg
<=
yxcd
)
{
sbdkjg
=
0
;
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
3
){
//上班2
int
sbdk2jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk2jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
if
(
atttype
==
1
)
{
pcd
.
setSbdk1
(
time_
);
pcd
.
setSbdk1jg
(
sbdkjg
);
}
else
if
(
atttype
==
2
)
{
pcd
.
setXbdk1
(
time_
);
pcd
.
setXbdk1jg
(
sbdkjg
);
}
else
if
(
atttype
==
3
)
{
pcd
.
setSbdk2
(
time_
);
pcd
.
setSbdk2jg
(
sbdkjg
);
}
else
if
(
atttype
==
4
)
{
pcd
.
setXbdk2
(
time_
);
pcd
.
setXbdk2jg
(
sbdkjg
);
}
else
if
(
atttype
==
5
)
{
pcd
.
setSbdk3
(
time_
);
pcd
.
setSbdk3jg
(
sbdkjg
);
}
else
if
(
atttype
==
6
)
{
pcd
.
setXbdk3
(
time_
);
pcd
.
setXbdk3jg
(
sbdkjg
);
}
if
(
sbdk2jg
>
yzcd
&&
yzcd
>
0
)
{
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
yzcdsc
=
sbdk2jg
-
yzcd
;
int
ydkcs
=
0
;
if
(
shif
!=
null
){
ydkcs
=
shif
.
getSxbcs
()*
2
;
}
//应打卡次数
pcd
.
setYdkcs
(
ydkcs
);
//严重迟到范围
if
(
sbdkjg
>
yzcd
&&
sbdkjg
<
kgcdfzs
&&
yzcd
>
0
)
{
yzcdcs
++;
yzcdsc
=
sbdkjg
;
dkst1
=
1
;
}
//旷工迟到
if
(
sbdkjg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;
dkst1
=
2
;
}
if
(
sbdk2jg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;}
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setSbdk2
(
time_
);
//上班1打卡时间
pcd
.
setSbdk2jg
(
sbdk2jg
);
pcd
.
setYzcdcs
(
yzcdcs
);
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
pcd
.
setKgcdfzs
(
kgcdcs
);
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
4
){
//下班2
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk2
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk2jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk2jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
pcd
.
setDkst1
(
dkst1
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
pcd
.
setYzcdcs
(
yzcdcs
);
//严重迟到次数
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
//严重迟到时长(分钟)
pcd
.
setKgcdfzs
(
kgcdcs
);
//旷工迟到次数
if
(!
pcd
.
insert
())
{
throw
new
CustomException
(
"打卡明细-新增异常-1"
);
}
//班次为4次时,计算工作时长
if
(
dkmc
.
getSbdk2
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk2
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
BigDecimal
on
=
new
BigDecimal
(
time
);
BigDecimal
worktime_
=
new
BigDecimal
(
Math
.
abs
(
om
.
add
(
on
).
doubleValue
()));
dkmx
=
pcd
.
getId
();
}
else
if
(
execution_status
==
2
){
dkmx
=
dkmc
.
getId
();
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
build
();
if
(
atttype
==
2
){
//下班1
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk1
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk1jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk1jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
if
(
dkmc
.
getSbdk1
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk1
())/
1000
/
60
-
rest_time
;
pcd
.
setGzsc
(
Math
.
abs
(
Double
.
valueOf
(
time
.
toString
())));
//只打一次卡时计算工作时长
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
BigDecimal
xx
=
new
BigDecimal
(
rest_time
);
}
else
if
(
atttype
==
3
){
//上班2
int
sbdk2jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst2
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk2jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
}
double
worktime
=
Math
.
abs
(
worktime_
.
subtract
(
xx
).
doubleValue
());
pcd
.
setGzsc
(
worktime
);
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
5
){
//上班3
int
sbdk3jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk3jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
}
if
(
sbdk3jg
>
yzcd
&&
yzcd
>
0
)
{
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
yzcdsc
=
sbdk3jg
-
yzcd
;
}
if
(
sbdk3jg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;}
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setSbdk3
(
time_
);
//上班1打卡时间
pcd
.
setSbdk3jg
(
sbdk3jg
);
pcd
.
setYzcdcs
(
yzcdcs
);
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
pcd
.
setKgcdfzs
(
kgcdcs
);
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
6
){
//下班3
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk3
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk3jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk3jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
//允许迟到范围
if
(
sbdk2jg
<=
yxcd
)
{
sbdk2jg
=
0
;
}
}
//班次为6次时,计算工作时长
if
(
dkmc
.
getSbdk3
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk3
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
//第二次
BigDecimal
on
=
new
BigDecimal
(
time
);
BigDecimal
worktime_
=
new
BigDecimal
(
Math
.
abs
(
om
.
add
(
on
).
doubleValue
()));
BigDecimal
xx
=
new
BigDecimal
(
rest_time
);
//严重迟到范围
if
(
sbdk2jg
>
yzcd
&&
sbdk2jg
<
kgcdfzs
&&
yzcd
>
0
)
{
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
yzcdsc
=
sbdk2jg
;
dkst2
=
1
;
}
//旷工迟到
if
(
sbdk2jg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;
kgcdcs
=
kgcdcs
+
dkmc
.
getKgcdfzs
();
dkst2
=
2
;
}
double
worktime
=
Math
.
abs
(
worktime_
.
subtract
(
xx
).
doubleValue
());
pcd
.
setDkst2
(
dkst2
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
pcd
.
setGzsc
(
worktime
);
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setSbdk2
(
time_
);
//上班1打卡时间
pcd
.
setSbdk2jg
(
sbdk2jg
);
pcd
.
setYzcdcs
(
yzcdcs
);
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
pcd
.
setKgcdfzs
(
kgcdcs
);
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
4
){
//下班2
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk2
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk2jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk2jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
//班次为4次时,计算工作时长
if
(
dkmc
.
getSbdk2
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk2
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
BigDecimal
on
=
new
BigDecimal
(
time
);
BigDecimal
worktime_
=
new
BigDecimal
(
Math
.
abs
(
om
.
add
(
on
).
doubleValue
()));
BigDecimal
xx
=
new
BigDecimal
(
rest_time
);
double
worktime
=
Math
.
abs
(
worktime_
.
subtract
(
xx
).
doubleValue
());
pcd
.
setGzsc
(
worktime
);
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
5
){
//上班3
int
sbdk3jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst3
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk3jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
}
//允许迟到范围
if
(
sbdk3jg
<=
yxcd
)
{
sbdk3jg
=
0
;
}
//严重迟到范围
if
(
sbdk3jg
>
yzcd
&&
sbdk3jg
<
kgcdfzs
&&
yzcd
>
0
)
{
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
yzcdsc
=
sbdk3jg
;
dkst3
=
1
;
}
//旷工迟到
if
(
sbdk3jg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;
kgcdcs
=
kgcdcs
+
dkmc
.
getKgcdfzs
();
dkst3
=
2
;
}
pcd
.
setDkst3
(
dkst3
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setSbdk3
(
time_
);
//上班1打卡时间
pcd
.
setSbdk3jg
(
sbdk3jg
);
pcd
.
setYzcdcs
(
yzcdcs
);
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
pcd
.
setKgcdfzs
(
kgcdcs
);
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
6
){
//下班3
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk3
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk3jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk3jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
//班次为6次时,计算工作时长
if
(
dkmc
.
getSbdk3
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk3
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
//第二次
BigDecimal
on
=
new
BigDecimal
(
time
);
BigDecimal
worktime_
=
new
BigDecimal
(
Math
.
abs
(
om
.
add
(
on
).
doubleValue
()));
BigDecimal
xx
=
new
BigDecimal
(
rest_time
);
double
worktime
=
Math
.
abs
(
worktime_
.
subtract
(
xx
).
doubleValue
());
pcd
.
setGzsc
(
worktime
);
}
}
pcd
.
setId
(
dkmc
.
getId
());
if
(
atttype
<=
6
&&
atttype
>
0
&&
!
sbdkkd
){
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
}
pcd
.
setId
(
dkmc
.
getId
());
if
(
atttype
<=
6
&&
atttype
>
0
&&
!
sbdkkd
){
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
}
else
{
msg
=
"当前打卡时间不在范围内"
;
sbyf
=
0
;
status_
=
2
;
}
}
else
{
msg
=
"当前打卡时间不在范围内"
;
sbyf
=
0
;
}
}
else
{
msg
=
"当前是休息时间"
;
sbyf
=
0
;
}
}
else
{
msg
=
"当前是休息时间"
;
sbyf
=
0
;
status_
=
2
;
}
}
}
}
else
{
...
...
@@ -2041,6 +2227,7 @@ public class ClockInController {
sbyf
=
0
;
zydk
=
false
;
atttype
=
0
;
status_
=
2
;
}
else
{
zypcd
.
setId
(
zydkmc
.
getId
());
zypcd
.
setXbdk1
(
time_
);
//下班1打卡时间
...
...
@@ -2070,6 +2257,7 @@ public class ClockInController {
sbyf
=
0
;
zydk
=
false
;
atttype
=
0
;
status_
=
2
;
}
else
{
zypcd
.
setId
(
zydkmc
.
getId
());
zypcd
.
setXbdk2
(
time_
);
//下班1打卡时间
...
...
@@ -2104,6 +2292,7 @@ public class ClockInController {
sbyf
=
0
;
zydk
=
false
;
atttype
=
0
;
status_
=
2
;
}
else
{
zypcd
.
setId
(
zydkmc
.
getId
());
zypcd
.
setXbdk3
(
time_
);
//下班1打卡时间
...
...
@@ -2140,6 +2329,7 @@ public class ClockInController {
KqglAssoDkjl
.
builder
().
id
(
dkjj
.
getId
()).
status
(
0
).
sort
(
0
).
build
().
updateById
();
msg
=
"打卡已更新数据"
;
sbyf
=
0
;
status_
=
2
;
}
int
results
=
0
;
...
...
@@ -2244,6 +2434,9 @@ public class ClockInController {
msg
=
"打卡成功"
;
}
else
{
commentary
=
msg
;
if
(
status_
==
2
)
{
status
=
status_
;
}
}
...
...
@@ -2358,6 +2551,8 @@ public class ClockInController {
List
<
AttSchedule
>
attsch
=
attdate
.
getAttsch
();
if
(
EmptyUtil
.
isNotEmpty
(
attdate
.
getAttsch
())
&&
attsch
.
get
(
0
).
getId
()
!=
0
)
{
//班次不为空
int
bc
=
0
;
int
bsz
=
0
;
/****************次日开始***************/
int
sb1
=
0
,
xb1
=
0
,
sb2
=
0
,
xb2
=
0
,
sb3
=
0
,
xb3
=
0
;
//先判断前一天是否存在次日打卡的方式
...
...
@@ -2405,6 +2600,21 @@ public class ClockInController {
}
else
{
attschbefo
.
setIsdk
(
0
);
}
if
(
beforeattdate
.
getAttsch
().
size
()
==
2
)
{
}
else
{
boolean
ectivedate
=
ClockInTool
.
hourMinuteBetween
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
nowdate
),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
befo
.
getStarttime
()),
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
befo
.
getEndtime
()),
"yyyy-MM-dd HH:mm"
);
if
(
ectivedate
)
{
bsz
=
1
;
attschbefo
.
setIsdk
(
0
);
}
else
{
bc
++;
attschbefo
.
setIsdk
(
1
);
}
}
attsch
.
add
(
p
,
attschbefo
);
p
++;
}
...
...
@@ -2413,8 +2623,9 @@ public class ClockInController {
/****************次日结束***************/
int
bccs
=
attdate
.
getAttsch
().
size
();
int
r
=
1
,
bc
=
0
;
int
bsz
=
0
;
int
r
=
1
;
// int bc = 0;
// int bsz = 0;
for
(
AttSchedule
ash
:
attsch
)
{
if
(
ash
.
getNextdaycard
()
==
0
)
{
if
(
attdate
.
getAttsch
().
size
()
==
2
)
{
...
...
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