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
4ec7235a
Commit
4ec7235a
authored
Aug 19, 2022
by
陶湘宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复穗港跨天打卡bug
parent
f8142048
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
186 additions
and
14 deletions
+186
-14
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
+175
-13
src/main/java/cn/timer/api/controller/kqgl/ClockInTool.java
+11
-1
No files found.
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
View file @
4ec7235a
...
...
@@ -142,14 +142,10 @@ public class ClockInController {
//pbfs;// 排班方式 1:固定排班;2:自由排班;3:自由工时
/*******/
long
time_
=
DateUtil
.
getStringTime
(
sStdIoTime
,
"yyyy-MM-dd HH:mm:
ss
"
);
//打卡时间戳
long
time_
=
DateUtil
.
getStringTime
(
sStdIoTime
,
"yyyy-MM-dd HH:mm:
SS
"
);
//打卡时间戳
long
isFirsTimer
=
time_
+
60
*
60
*
1000
;
String
putime
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
time_
);
//转换打卡时间格式 年月日
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
();
int
dkmx
=
0
;
int
shifid
=
0
;
long
punchcardtime
=
0
,
punchstart
=
0
,
punchend
=
0
;
//应打卡时间,应打卡开始时间,应打卡结束时间
...
...
@@ -160,7 +156,14 @@ public class ClockInController {
boolean
sbdkkd
=
false
;
//针对于上班 未超过上班卡打卡 视为无效打卡
ClockCollectData
clockt
=
new
ClockCollectData
();
//putime: 根据日期 得到打卡所需的详细信息
AttendanceCardListDto
attdate
=
MethodCall
(
qyid
,
userid
,
putime
);
AttendanceCardListDto
attdate
=
MethodCall
(
qyid
,
userid
,
ClockInTool
.
paraseStringToDate
(
sStdIoTime
,
"yyyy-MM-dd HH:mm:SS"
));
// = new SimpleDateFormat("yyyy-MM-dd").format(sStdIoTime);//转换打卡时间格式 年月日
String
putime
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
attdate
.
getAttsch
().
get
(
0
).
getTime
());
//转换打卡时间格式 年月日
String
putimehhmm
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
attdate
.
getAttsch
().
get
(
0
).
getTime
());
//转换打卡时间格式 年月日
//打卡当天开始时间,打卡当天结束时间
Long
startDate
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
putime
,
"yyyy-MM-dd"
)).
getTime
();
Long
endDate
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
putime
,
"yyyy-MM-dd"
)).
getTime
();
/*******/
if
(
attgro
!=
null
)
{
//判断考勤组是否存在
List
<
KqglAssoKqzdkfs
>
kqjs
=
KqglAssoKqzdkfs
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
KqglAssoKqzdkfs
>().
lambda
().
eq
(
KqglAssoKqzdkfs:
:
getKqzId
,
attgro
.
getId
()));
...
...
@@ -198,7 +201,9 @@ public class ClockInController {
if
((
isXbdk1Cr
+
isSbdk2Cr
+
isXbdk2Cr
+
isSbdk3Cr
+
isXbdk3Cr
)
>
0
)
{
crdk
=
true
;
}
//如果是上班打卡,没有次日
if
(
attdate
.
getAttsch
().
get
(
0
).
getSort
()==
1
&&
attdate
.
getAttsch
().
get
(
0
).
getStarttime
()<
time_
&&
attdate
.
getAttsch
().
get
(
0
).
getEndtime
()>
time_
)
crdk
=
false
;
// if(balan.getSort()+1 == 2 && dkcs == 2) {
// //次日
// if(isXbdk1Cr > 0) { crdk = true; }
...
...
@@ -242,7 +247,10 @@ public class ClockInController {
int
isSbdk3Cr
=
shifi
.
getIsSbdk3Cr
();
//上班3是否次日(0:否;1:是)
int
isXbdk3Cr
=
shifi
.
getIsXbdk3Cr
();
//下班3是否次日(0:否;1:是)
if
((
isXbdk1Cr
+
isSbdk2Cr
+
isXbdk2Cr
+
isSbdk3Cr
+
isXbdk3Cr
)
>
0
)
{
//如果是上班打卡,没有次日
if
(
attdate
.
getAttsch
().
get
(
0
).
getSort
()==
1
&&
attdate
.
getAttsch
().
get
(
0
).
getStarttime
()<
time_
&&
attdate
.
getAttsch
().
get
(
0
).
getEndtime
()>
time_
)
crdk
=
false
;
else
if
((
isXbdk1Cr
+
isSbdk2Cr
+
isXbdk2Cr
+
isSbdk3Cr
+
isXbdk3Cr
)
>
0
)
{
crdk
=
true
;
attdate
=
MethodCall
(
qyid
,
userid
,
yesterday
);
...
...
@@ -250,6 +258,7 @@ public class ClockInController {
}
else
{
crdk
=
false
;
}
}
}
...
...
@@ -1211,12 +1220,14 @@ public class ClockInController {
* @return
* 获取当天打卡班次数据
*/
public
AttendanceCardListDto
MethodCall
(
int
qyid
,
int
userid
,
String
date
)
throws
ParseException
{
public
AttendanceCardListDto
MethodCall
(
int
qyid
,
int
userid
,
Date
date
)
throws
ParseException
{
AttendanceCardListDto
attcar
=
new
AttendanceCardListDto
();
String
str
=
null
;
if
(!(
""
).
equals
(
date
)){
str
=
date
;
str
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
date
);
//转换打卡时间格式 年月日
}
else
{
Date
d
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
...
...
@@ -1242,7 +1253,8 @@ public class ClockInController {
attcar
.
setAttsch
(
atts
);
}
else
{
//今天上班
KqglAssoBcsz
bcz
=
KqglAssoBcsz
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
atwek
.
getBcid
()));
String
putdate
=
getPutDate
(
bcz
,
date
);
str
=
putdate
;
if
(
bcz
!=
null
){
Getshiftinformationbatch
(
bcz
,
attcar
,
str
);
}
...
...
@@ -1348,7 +1360,150 @@ public class ClockInController {
return
attcar
;
}
/**
* @param qyid
* @param userid
* @param date
* @return
* 获取当天打卡班次数据
*/
public
AttendanceCardListDto
MethodCall
(
int
qyid
,
int
userid
,
String
putdate
)
throws
ParseException
{
AttendanceCardListDto
attcar
=
new
AttendanceCardListDto
();
String
str
=
null
;
if
(!(
""
).
equals
(
putdate
)){
str
=
putdate
;
//转换打卡时间格式 年月日
}
else
{
Date
d
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
str
=
sdf
.
format
(
d
);
}
KqglMainKqz
attgro
=
kqglmainkqzmapper
.
getAttendanceGroupInformationByUserid
(
userid
,
qyid
);
//考勤组信息
//pbfs:排班方式 1:固定排班;2:自由排班;3:自由工时
if
(
attgro
!=
null
){
//判断当前用户是否加入到考勤组
//排班制
KqglAssoPbmxDto
jrpb
=
kqglassopbmxmapper
.
getScheduleSpecificAttendance
(
attgro
.
getId
(),
userid
,
str
);
//固定排班
int
week
=
Integer
.
valueOf
(
ClockInTool
.
dateToWeek
(
str
));
//4
KqglAssoZhoupaiban
atwek
=
KqglAssoZhoupaiban
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoZhoupaiban
>().
lambda
().
eq
(
KqglAssoZhoupaiban:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoZhoupaiban:
:
getType
,
week
).
ne
(
KqglAssoZhoupaiban:
:
getBcid
,
0
));
if
(
attgro
.
getPbfs
()
==
1
){
//固定排班
if
(
atwek
!=
null
){
//有固定周排班
KqglAssoTeshu
rest
=
KqglAssoTeshu
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoTeshu
>().
lambda
().
eq
(
KqglAssoTeshu:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoTeshu:
:
getTsrq
,
str
).
eq
(
KqglAssoTeshu:
:
getBcid
,
0
));
if
(
rest
!=
null
){
//今天休息 Sort返回0【特殊日期--休息】
List
<
AttSchedule
>
atts
=
new
ArrayList
<
AttSchedule
>();
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
0
).
sort
(
0
).
time
(
0
l
).
starttime
(
0
l
).
endtime
(
0
l
).
build
();
atts
.
add
(
as
);
attcar
.
setAttsch
(
atts
);
}
else
{
//今天上班
KqglAssoBcsz
bcz
=
KqglAssoBcsz
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
atwek
.
getBcid
()));
if
(
bcz
!=
null
){
Getshiftinformationbatch
(
bcz
,
attcar
,
str
);
}
}
}
else
{
//必须打卡
KqglAssoTeshu
tsri
=
KqglAssoTeshu
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoTeshu
>().
lambda
().
eq
(
KqglAssoTeshu:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoTeshu:
:
getTsrq
,
str
).
ne
(
KqglAssoTeshu:
:
getBcid
,
0
));
if
(
tsri
!=
null
){
KqglAssoBcsz
tsrq
=
KqglAssoBcsz
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
tsri
.
getBcid
()));
if
(
tsrq
!=
null
){
Getshiftinformationbatch
(
tsrq
,
attcar
,
str
);
}
}
else
{
//休息
List
<
AttSchedule
>
atts
=
new
ArrayList
<
AttSchedule
>();
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
0
).
sort
(
0
).
time
(
0
l
).
starttime
(
0
l
).
endtime
(
0
l
).
build
();
atts
.
add
(
as
);
attcar
.
setAttsch
(
atts
);
}
}
}
else
if
(
attgro
.
getPbfs
()
==
2
){
//自由排班
//未排班时,员工可选择班次打卡
// if(attgro.getIsXzbcdk() == 1){
// attcar.setOptscheduling(true);
// }else{
// attcar.setOptscheduling(false);
// }
if
(
jrpb
!=
null
){
if
(
jrpb
.
getBcid
()
!=
0
){
//有班次时("Bcid"不为0时)
KqglAssoBcsz
tsrq
=
KqglAssoBcsz
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
jrpb
.
getBcid
()));
/**已简化**/
Getshiftinformationbatch
(
tsrq
,
attcar
,
str
);
}
else
{
//当天排班为休息
List
<
AttSchedule
>
atts1
=
new
ArrayList
<
AttSchedule
>();
AttSchedule
as
=
AttSchedule
.
builder
().
id
(
0
).
sort
(
0
).
time
(
0
l
).
starttime
(
0
l
).
endtime
(
0
l
).
build
();
atts1
.
add
(
as
);
attcar
.
setAttsch
(
atts1
);
}
}
}
else
{
//自由工时
KqglAssoZhoupaiban
wekz
=
KqglAssoZhoupaiban
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoZhoupaiban
>().
lambda
().
eq
(
KqglAssoZhoupaiban:
:
getKqzid
,
attgro
.
getId
())
.
eq
(
KqglAssoZhoupaiban:
:
getBcid
,
0
).
eq
(
KqglAssoZhoupaiban:
:
getType
,
week
));
if
(
wekz
!=
null
){
//
String
dada
=
str
+
" "
+
attgro
.
getKqkssjTime
()+
":00"
;
attcar
.
setStapclotime
(
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
dada
)));
}
if
(!(
""
).
equals
(
attgro
.
getJbzdsc
())){
attcar
.
setCanpunchworkdate
(
Double
.
valueOf
(
attgro
.
getJbzdsc
()));
//上班打卡后多久大下班卡
}
}
if
(
jrpb
!=
null
||
atwek
!=
null
){
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
if
(
attgro
.
getPbfs
()
==
1
){
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
atwek
.
getBcid
()));
}
else
if
(
attgro
.
getPbfs
()
==
2
){
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
jrpb
.
getBcid
()));
}
if
(
shif
!=
null
){
if
(
shif
.
getIsXbdk
()
==
1
){
attcar
.
setNoclockout
(
true
);
// 下班不用打卡
}
else
{
attcar
.
setNoclockout
(
false
);
// 下班不用打卡
}
attcar
.
setAllowlate
(
shif
.
getYxcdfzs
());
// 允许迟到分钟数
attcar
.
setSeriouslate
(
shif
.
getYzcdfzs
());
// 严重迟到分钟数
attcar
.
setAbsenteeismlate
(
shif
.
getKgcdfzs
());
// 旷工迟到分钟数
if
(
shif
.
getIsWzwd
()
==
1
){
attcar
.
setIslatelate
(
true
);
// 晚走晚到
List
<
AttLateLate
>
atwzwd
=
new
ArrayList
<
AttLateLate
>();
int
p
=
0
;
if
(!(
""
).
equals
(
shif
.
getXbwz1
())
&&
!(
""
).
equals
(
shif
.
getSbwd1
())){
p
=
2
;}
if
(!(
""
).
equals
(
shif
.
getXbwz1
())
&&
!(
""
).
equals
(
shif
.
getSbwd1
())
&&
!(
""
).
equals
(
shif
.
getXbwz2
())
&&
!(
""
).
equals
(
shif
.
getSbwd2
())){
p
=
4
;}
if
(!(
""
).
equals
(
shif
.
getXbwz1
())
&&
!(
""
).
equals
(
shif
.
getSbwd1
())
&&
!(
""
).
equals
(
shif
.
getXbwz2
())
&&
!(
""
).
equals
(
shif
.
getSbwd2
())
&&
!(
""
).
equals
(
shif
.
getXbwz3
())
&&
!(
""
).
equals
(
shif
.
getSbwd3
())){
p
=
6
;}
AttLateLate
ala
=
AttLateLate
.
builder
().
build
();
ala
.
setLatewalk
(
shif
.
getXbwz1
());
ala
.
setArrivelate
(
shif
.
getSbwd1
());
atwzwd
.
add
(
ala
);
if
(
p
==
4
||
p
==
6
){
AttLateLate
alat
=
AttLateLate
.
builder
().
build
();
alat
.
setLatewalk
(
shif
.
getXbwz2
());
alat
.
setArrivelate
(
shif
.
getSbwd2
());
atwzwd
.
add
(
alat
);
}
if
(
p
==
6
){
AttLateLate
alas
=
AttLateLate
.
builder
().
build
();
alas
.
setLatewalk
(
shif
.
getXbwz3
());
alas
.
setArrivelate
(
shif
.
getSbwd3
());
atwzwd
.
add
(
alas
);
}
attcar
.
setAttlat
(
atwzwd
);
}
else
{
attcar
.
setIslatelate
(
false
);
// 晚走晚到
}
}
}
attcar
.
setAttgrouptype
(
attgro
.
getPbfs
());
//1:固定排班;2:自由排班;3:自由工时
}
else
{
attcar
.
setAttgrouptype
(
0
);
//1:固定排班;2:自由排班;3:自由工时
}
return
attcar
;
}
/**
* @param shiftm
* @param attcar
...
...
@@ -1468,7 +1623,14 @@ public class ClockInController {
}
}
String
getPutDate
(
KqglAssoBcsz
bcz
,
Date
puttime
){
String
workHour
=
new
SimpleDateFormat
(
"HHmmss"
).
format
(
puttime
);
//如果是跨天并且在下班打卡时间范围,就算到上一天考勤
if
(
bcz
.
getIsXbdk1Cr
()==
1
&&
Integer
.
parseInt
(
bcz
.
getXbqjks1
().
replace
(
":"
,
""
)+
"00"
)<
Integer
.
parseInt
(
workHour
)&&
Integer
.
parseInt
(
bcz
.
getXbqjjs1
().
replace
(
":"
,
""
)+
"00"
)>
Integer
.
parseInt
(
workHour
))
return
ClockInTool
.
requires_extra_times
(
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
puttime
),-
1
,
2
,
1
);
//昨天的班次
else
return
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
puttime
);
//转换打卡时间格式 年月日;
}
/************************************************************************************************************************************************************************************************/
/************************************************************************** APP打卡 *************************************************************************************************************/
...
...
src/main/java/cn/timer/api/controller/kqgl/ClockInTool.java
View file @
4ec7235a
...
...
@@ -233,7 +233,17 @@ public class ClockInTool {
}
return
date
;
}
// 将字符串转化为日期
public
static
Date
paraseStringToDate
(
String
timestr
,
String
format
){
Date
date
=
null
;
Format
f
=
new
SimpleDateFormat
(
format
);
try
{
date
=
(
Date
)
f
.
parseObject
(
timestr
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
date
;
}
/***
* 去除String数组中的空值
*/
...
...
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