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
a6835924
Commit
a6835924
authored
Nov 15, 2021
by
284718418@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、执行修改批处理优化
2、修改查询数据走索引
parent
d58b1161
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
983 additions
and
5 deletions
+983
-5
src/main/java/cn/timer/api/controller/kqgl/AttController.java
+888
-2
src/main/java/cn/timer/api/service/KqglAssoDkjlService.java
+25
-0
src/main/java/cn/timer/api/service/impl/KqglAssoDkjlServiceImpl.java
+66
-0
src/main/resources/mapping/kqgl/PunchRecordMapper.xml
+4
-3
No files found.
src/main/java/cn/timer/api/controller/kqgl/AttController.java
View file @
a6835924
...
...
@@ -13,6 +13,8 @@ import java.util.List;
import
java.util.Set
;
import
java.util.concurrent.locks.ReentrantLock
;
import
cn.timer.api.service.KqglAssoDkjlService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpEntity
;
...
...
@@ -111,6 +113,7 @@ import io.swagger.annotations.ApiParam;
* @author lalqq
* 考勤
*/
@Slf4j
@Api
(
tags
=
"3.0[2]考勤模块"
)
@RestController
@Transactional
...
...
@@ -334,6 +337,7 @@ public class AttController {
@ApiOperationSupport
(
order
=
31
)
@ApiOperation
(
value
=
"修改班次信息"
,
httpMethod
=
"PUT"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
Schedule
>>
updateAttscheduling
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttendanceAssistant
attass
)
{
long
startTime
=
System
.
currentTimeMillis
();
int
id
=
Integer
.
valueOf
(
attass
.
getAttgroupid
());
//修改数据id
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
...
...
@@ -346,7 +350,6 @@ public class AttController {
//记录排班(排班制)
List
<
Schedule
>
schlist
=
new
ArrayList
<
Schedule
>();
Schedule
[]
schedules
=
attass
.
getSchedules
();
// 排班日期【排班制】--班次id、日期
String
date_scmx
=
null
;
if
(
schedules
.
length
>
0
&&
attass
.
getAtttype
()
==
2
){
...
...
@@ -1150,6 +1153,8 @@ public class AttController {
}
}
//判断新增或修改
}
long
endTime
=
System
.
currentTimeMillis
();
log
.
info
(
"=======================================执行时长(毫秒):{}"
,
endTime
-
startTime
);
if
(
schlist
.
size
()>
0
&&
xiugai
){
//删除排班明细表(自由排班)
// scheduleservice.deleteByPrimaryBykqzid(id);
...
...
@@ -1159,7 +1164,6 @@ public class AttController {
scheduleservice
.
insertKqglAssoPbmxList
(
schlist
);
return
ResultUtil
.
data
(
schlist
,
"修改考勤组排班成功"
);
}
return
ResultUtil
.
data
(
schlist
,
"修改考勤组排班成功"
);
// return ResultUtil.error("修改考勤组排班失败");
}
...
...
@@ -5182,4 +5186,886 @@ public class AttController {
return
ResultUtil
.
data
(
attrep
);
}
@Autowired
private
KqglAssoDkjlService
kqglAssoDkjlService
;
/**
* 修改考勤组排班(修改排班后,需判断是否有打卡记录,有则匹配当天修改后的班次,无则不需要修改)
* 接口优化
*/
@SuppressWarnings
({
"unused"
,
"deprecation"
})
@PutMapping
(
value
=
"/v2.0/attscheduling"
)
@ApiOperationSupport
(
order
=
57
)
@ApiOperation
(
value
=
"修改班次信息"
,
httpMethod
=
"PUT"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
Schedule
>>
updateAttschedulingv2
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttendanceAssistant
attass
)
{
long
startTime
=
System
.
currentTimeMillis
();
int
id
=
Integer
.
valueOf
(
attass
.
getAttgroupid
());
//修改数据id
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
String
dastr
=
new
SimpleDateFormat
(
"yyyy-MM"
).
format
(
new
Date
()).
toString
();
//
AttendanceGroup
qttgrop
=
attendancegroupservice
.
selectByPrimaryKey
(
Integer
.
valueOf
(
attass
.
getAttgroupid
()));
boolean
xiugai
=
true
;
//记录排班(排班制)
List
<
Schedule
>
schlist
=
new
ArrayList
<
Schedule
>();
Schedule
[]
schedules
=
attass
.
getSchedules
();
// 排班日期【排班制】--班次id、日期
String
date_scmx
=
null
;
if
(
schedules
.
length
>
0
&&
attass
.
getAtttype
()
==
2
){
date_scmx
=
ClockInTool
.
SunNovCSTYM
(
schedules
[
0
].
getData
());
String
date
=
String
.
valueOf
(
schedules
[
0
].
getData
());
Date
dt
=
new
Date
(
date
);
SimpleDateFormat
famt
=
new
SimpleDateFormat
(
"yyyy-MM"
);
System
.
out
.
println
(
famt
.
format
(
dt
));
if
(!(
famt
.
format
(
dt
)).
equals
(
dastr
))
{
xiugai
=
false
;
for
(
int
p
=
0
;
p
<
schedules
.
length
;
p
++){
// scheduleservice.deleteByPrimaryBykqzid(Integer.valueOf(attass.getAttgroupid()),ClockInTool.SunNovCST(String.valueOf(schedules[p].getData())));
KqglAssoPbmx
.
builder
().
build
().
delete
(
new
QueryWrapper
<
KqglAssoPbmx
>().
lambda
().
eq
(
KqglAssoPbmx:
:
getUserid
,
schedules
[
p
].
getUserid
()).
eq
(
KqglAssoPbmx:
:
getData
,
ClockInTool
.
SunNovCST
(
String
.
valueOf
(
schedules
[
p
].
getData
())))
.
eq
(
KqglAssoPbmx:
:
getKqzid
,
Integer
.
valueOf
(
attass
.
getAttgroupid
())));
Schedule
sch
=
new
Schedule
();
sch
.
setUserid
(
schedules
[
p
].
getUserid
());
//用户id
sch
.
setData
(
schedules
[
p
].
getData
());
//排班日期 格式:yyyy-MM-dd
sch
.
setBcid
(
schedules
[
p
].
getBcid
());
//班次id 0为休息
sch
.
setKqzid
(
Integer
.
valueOf
(
attass
.
getAttgroupid
()));
//考勤组id
schlist
.
add
(
sch
);
}
if
(
schlist
.
size
()>
0
){
scheduleservice
.
insertKqglAssoPbmxList
(
schlist
);
}
}
else
{
xiugai
=
true
;
List
<
PunchRecord
>
punchRecordList
=
new
ArrayList
<>();
List
<
PunchCardDetails
>
punchCardDetailsList
=
new
ArrayList
<>();
for
(
int
p
=
0
;
p
<
schedules
.
length
;
p
++){
Schedule
sch
=
new
Schedule
();
sch
.
setUserid
(
schedules
[
p
].
getUserid
());
//用户id
sch
.
setData
(
schedules
[
p
].
getData
());
//排班日期 格式:yyyy-MM-dd
sch
.
setBcid
(
schedules
[
p
].
getBcid
());
//班次id 0为休息
sch
.
setKqzid
(
Integer
.
valueOf
(
attass
.
getAttgroupid
()));
//考勤组id
schlist
.
add
(
sch
);
/*****************************/
//转换日期
String
data
=
mat
.
format
(
new
Date
(
schedules
[
p
].
getData
().
toString
()));
Long
startDate
=
0
l
;
Long
endDate
=
0
l
;
try
{
startDate
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
data
,
"yyyy-MM-dd"
)).
getTime
();
endDate
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
data
,
"yyyy-MM-dd"
)).
getTime
();
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
//当天修改后的班次
ShiftManagement
banci
=
shiftmanagementservice
.
selectByPrimaryKey
(
schedules
[
p
].
getBcid
());
Long
sbdk1
=
0
l
;
Long
xbdk1
=
0
l
;
Long
sbdk2
=
0
l
;
Long
xbdk2
=
0
l
;
Long
sbdk3
=
0
l
;
Long
xbdk3
=
0
l
;
if
(
banci
!=
null
){
if
(
banci
.
getSxbcs
()==
1
||
banci
.
getSxbcs
()==
2
||
banci
.
getSxbcs
()==
3
){
sbdk1
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
banci
.
getSbdk1
()+
":00"
));
xbdk1
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
banci
.
getXbdk1
()+
":00"
));
}
if
(
banci
.
getSxbcs
()==
2
||
banci
.
getSxbcs
()==
3
){
sbdk2
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
banci
.
getSbdk2
()+
":00"
));
xbdk2
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
banci
.
getXbdk2
()+
":00"
));
}
if
(
banci
.
getSxbcs
()==
3
){
sbdk3
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
banci
.
getSbdk3
()+
":00"
));
xbdk3
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
banci
.
getXbdk3
()+
":00"
));
}
}
//之前打卡的班次
PunchRecord
mapuca
=
punchrecordservice
.
MaintenancePunchCard
(
startDate
,
endDate
,
schedules
[
p
].
getUserid
());
if
(
mapuca
!=
null
&&
!(
schedules
[
p
].
getBcid
()).
equals
(
mapuca
.
getBcid
())){
List
<
PunchRecord
>
initial
=
punchrecordservice
.
getMaintenancePunchCardList
(
startDate
,
endDate
,
schedules
[
p
].
getUserid
(),
qyid
);
if
(
initial
.
size
()
>
0
){
RestMethod
(
initial
,
initial
.
get
(
0
).
getDkmxid
());
}
}
//当天的所有打卡记录
List
<
PunchRecord
>
mapucalist
=
punchrecordservice
.
getMaintenancePunchCardList
(
startDate
,
endDate
,
schedules
[
p
].
getUserid
(),
qyid
);
PunchRecord
minAttid
=
null
;
PunchRecord
maxAttid
=
null
;
int
dkmxid
=
0
;
if
(
mapucalist
.
size
()
>
0
){
//最小值
minAttid
=
mapucalist
.
stream
().
min
(
Comparator
.
comparing
(
PunchRecord:
:
getId
)).
get
();
// System.out.println(minAttid.getAttdate() + "---min---" +minAttid.getId());
//最大值
maxAttid
=
mapucalist
.
stream
().
max
(
Comparator
.
comparing
(
PunchRecord:
:
getId
)).
get
();
// System.out.println(maxAttid.getAttdate() + "---max---" + maxAttid.getId());
//对应打卡明细表id
dkmxid
=
maxAttid
.
getDkmxid
();
}
//当天有打卡记录且当天打卡班次和当前修改后的班次不匹配再进行重新维护
if
(
mapuca
!=
null
&&
!(
schedules
[
p
].
getBcid
()).
equals
(
mapuca
.
getBcid
())){
if
(
banci
!=
null
){
//修改后有班次打卡
if
(
banci
.
getSxbcs
()
==
1
){
//修改后一天打两次
if
(
mapucalist
.
size
()
>
2
){
/////当天打卡多条的话 取最开始打的卡和最后打的卡 作为新一轮的上下班考勤
for
(
PunchRecord
pre
:
mapucalist
){
/********/
if
(
pre
.
getId
()
!=
minAttid
.
getId
()
&&
pre
.
getId
()
!=
maxAttid
.
getId
()){
//去除最大和最小 其他均改为“打卡无效:此记录已被更新”
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
pre
.
getId
());
record
.
setStatus
(
0
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setSort
(
0
);
//序号(0:打卡无效:此记录已被更新)
if
((
pre
.
getSort
())%
2
>
0
){
//上班
Long
time
=
(
pre
.
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk1
);
//上班应打卡时间
}
else
{
//下班
Long
time
=
(
pre
.
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk1
);
//下班应打卡时间
}
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
//punchrecordservice.updateByPrimaryKeySelective(record);
}
else
{
if
(
pre
.
getId
()
==
minAttid
.
getId
()){
//上班
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
pre
.
getId
());
record
.
setType
(
1
);
//上班
Long
time
=
(
pre
.
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk1
);
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
//punchrecordservice.updateByPrimaryKeySelective(record);
}
else
if
(
pre
.
getId
()
==
maxAttid
.
getId
()){
//下班
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
pre
.
getId
());
record
.
setType
(
2
);
//下班
Long
time
=
(
pre
.
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk1
);
record
.
setBcid
(
banci
.
getId
());
//班次id
record
.
setSort
(
2
);
punchRecordList
.
add
(
record
);
//punchrecordservice.updateByPrimaryKeySelective(record);
}
}
}
//修改打卡明细
PunchRecord
mindata
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchCardDetails
record
=
new
PunchCardDetails
();
record
.
setId
(
dkmxid
);
//需修改的明细id
record
.
setSbdk1
(
mindata
.
getDktime
());
record
.
setSbdk1jg
(
mindata
.
getResults
());
// 上班1打卡结果
record
.
setXbdk1
(
null
);
record
.
setXbdk1jg
(
0
);
// 下班1打卡结果
record
.
setSbdk2
(
null
);
record
.
setSbdk2jg
(
0
);
// 上班2打卡结果
record
.
setXbdk2
(
null
);
record
.
setXbdk2jg
(
0
);
// 下班2打卡结果
record
.
setSbdk3
(
null
);
record
.
setSbdk3jg
(
0
);
// 上班3打卡结果
record
.
setXbdk3
(
null
);
record
.
setXbdk3jg
(
0
);
// 下班3打卡结果
record
.
setYdkcs
(
banci
.
getSxbcs
()*
2
);
//应打卡次数
record
.
setGzsc
(
Double
.
valueOf
(
"0"
));
punchcarddetailsservice
.
ModifyPunchDetails
(
record
);
//
PunchRecord
maxdata
=
punchrecordservice
.
selectByPrimaryKey
(
maxAttid
.
getId
());
//上班
PunchCardDetails
max
=
new
PunchCardDetails
();
max
.
setId
(
dkmxid
);
//需修改的明细id
max
.
setXbdk1
(
maxdata
.
getDktime
());
max
.
setXbdk1jg
(
maxdata
.
getResults
());
// 下班1打卡结果
Long
woktimes
=
(
maxdata
.
getDktime
()
-
mindata
.
getDktime
())/
1000
/
60
;
max
.
setGzsc
(
Double
.
valueOf
(
woktimes
));
punchCardDetailsList
.
add
(
max
);
//punchcarddetailsservice.updateByPrimaryKeySelective(max);
}
else
{
////
PunchRecord
mindataone
=
null
;
//当天打卡记录为1条
if
(
minAttid
!=
null
||
maxAttid
!=
null
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
0
).
getId
());
//当天一条记录的id
record
.
setType
(
1
);
//上班
Long
time
=
(
mapucalist
.
get
(
0
).
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk1
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
//punchrecordservice.updateByPrimaryKeySelective(record);
//
mindataone
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchCardDetails
dan
=
new
PunchCardDetails
();
dan
.
setId
(
dkmxid
);
//需修改的明细id
dan
.
setSbdk1
(
mindataone
.
getDktime
());
dan
.
setSbdk1jg
(
mindataone
.
getResults
());
// 上班1打卡结果
dan
.
setYdkcs
(
banci
.
getSxbcs
()*
2
);
//应打卡次数
dan
.
setGzsc
(
Double
.
valueOf
(
"0"
));
punchCardDetailsList
.
add
(
dan
);
// punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
//当天打卡记录为2条
if
(
maxAttid
!=
null
&&
minAttid
.
getId
()
!=
maxAttid
.
getId
()){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
1
).
getId
());
record
.
setType
(
2
);
//下班
Long
time
=
(
mapucalist
.
get
(
1
).
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk1
);
record
.
setBcid
(
banci
.
getId
());
//班次id
record
.
setSort
(
2
);
punchRecordList
.
add
(
record
);
punchRecordList
.
add
(
record
);
//punchrecordservice.updateByPrimaryKeySelective(record);
//
PunchRecord
maxdata
=
punchrecordservice
.
selectByPrimaryKey
(
maxAttid
.
getId
());
//下班
PunchCardDetails
max
=
new
PunchCardDetails
();
max
.
setId
(
dkmxid
);
//需修改的明细id
max
.
setXbdk1
(
maxdata
.
getDktime
());
max
.
setXbdk1jg
(
maxdata
.
getResults
());
// 下班1打卡结果
Long
woktimes
=
(
maxdata
.
getDktime
()
-
mindataone
.
getDktime
())/
1000
/
60
;
max
.
setGzsc
(
Double
.
valueOf
(
woktimes
));
punchCardDetailsList
.
add
(
max
);
// punchcarddetailsservice.updateByPrimaryKeySelective(max);
}
}
}
else
if
(
banci
.
getSxbcs
()
==
2
){
//修改后一天打四次
if
(
mapucalist
.
size
()
>
4
){
//当天打卡多次
String
[]
str
=
new
String
[
3
];
for
(
int
y
=
0
;
y
<
mapucalist
.
size
();
y
++){
if
(
y
==
0
){
//上班
PunchRecord
mindata
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
y
).
getId
());
// record.setType(1);//上班
Long
time
=
(
mindata
.
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk1
);
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
//punchrecordservice.updateByPrimaryKeySelective(record);
}
if
(
y
==
1
||
y
==
2
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
y
).
getId
());
if
((
mapucalist
.
get
(
y
).
getSort
())%
2
==
0
){
//下班
Long
time
=
(
mapucalist
.
get
(
y
).
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk1
);
//下班应打卡时间
str
[
0
]
=
String
.
valueOf
(
mapucalist
.
get
(
y
).
getId
());
}
else
{
//上班
Long
time
=
(
mapucalist
.
get
(
y
).
getDktime
()
-
sbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk2
);
//上班应打卡时间
str
[
1
]
=
String
.
valueOf
(
mapucalist
.
get
(
y
).
getId
());
}
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
//punchrecordservice.updateByPrimaryKeySelective(record);
}
PunchRecord
maxdata
=
punchrecordservice
.
selectByPrimaryKey
(
maxAttid
.
getId
());
//下班
if
(
mapucalist
.
get
(
y
).
getId
()
==
maxdata
.
getId
()){
//下班
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
maxdata
.
getId
());
record
.
setType
(
2
);
//下班
Long
time
=
(
maxdata
.
getDktime
()
-
xbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setSort
(
4
);
record
.
setAttime
(
xbdk2
);
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
//punchrecordservice.updateByPrimaryKeySelective(record);
str
[
2
]
=
String
.
valueOf
(
maxdata
.
getId
());
}
if
(
y
==
3
||
y
>
3
&&
mapucalist
.
get
(
y
).
getId
()
!=
maxdata
.
getId
()){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
y
).
getId
());
record
.
setStatus
(
0
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setSort
(
0
);
//序号(0:打卡无效:此记录已被更新)
record
.
setResults
(
0
);
// 打卡结果
record
.
setAttime
(
mapucalist
.
get
(
y
).
getDktime
());
//上班应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
//punchrecordservice.updateByPrimaryKeySelective(record);
}
}
//修改打卡明细
PunchRecord
mindata
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchCardDetails
record
=
new
PunchCardDetails
();
record
.
setId
(
dkmxid
);
//需修改的明细id
record
.
setSbdk1
(
mindata
.
getDktime
());
record
.
setSbdk1jg
(
mindata
.
getResults
());
// 上班1打卡结果
record
.
setXbdk1
(
null
);
record
.
setXbdk1jg
(
0
);
// 下班1打卡结果
record
.
setSbdk2
(
null
);
record
.
setSbdk2jg
(
0
);
// 上班2打卡结果
record
.
setXbdk2
(
null
);
record
.
setXbdk2jg
(
0
);
// 下班2打卡结果
record
.
setSbdk3
(
null
);
record
.
setSbdk3jg
(
0
);
// 上班3打卡结果
record
.
setXbdk3
(
null
);
record
.
setXbdk3jg
(
0
);
// 下班3打卡结果
record
.
setYdkcs
(
banci
.
getSxbcs
()*
2
);
//应打卡次数
record
.
setGzsc
(
Double
.
valueOf
(
"0"
));
punchcarddetailsservice
.
ModifyPunchDetails
(
record
);
for
(
int
t
=
0
;
t
<
str
.
length
;
t
++){
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
Integer
.
valueOf
(
str
[
t
]));
//单条打卡明细
PunchCardDetails
dkmx
=
new
PunchCardDetails
();
dkmx
.
setId
(
dkmxid
);
//需修改的明细id
if
(
t
==
0
){
dkmx
.
setXbdk1
(
dtdkmx
.
getDktime
());
dkmx
.
setXbdk1jg
(
dtdkmx
.
getResults
());
// 下班1打卡结果
}
else
if
(
t
==
1
){
dkmx
.
setSbdk2
(
dtdkmx
.
getDktime
());
dkmx
.
setSbdk2jg
(
dtdkmx
.
getResults
());
// 上班2打卡结果
}
else
{
dkmx
.
setXbdk2
(
dtdkmx
.
getDktime
());
dkmx
.
setXbdk2jg
(
dtdkmx
.
getResults
());
// 下班2打卡结果
}
Long
woktimes
=
(
dtdkmx
.
getDktime
()
-
mindata
.
getDktime
())/
1000
/
60
;
dkmx
.
setGzsc
(
Double
.
valueOf
(
woktimes
));
punchCardDetailsList
.
add
(
dkmx
);
// punchcarddetailsservice.updateByPrimaryKeySelective(dkmx);
}
}
else
{
//打卡小于4次
PunchRecord
mindataone
=
null
;
if
(
minAttid
!=
null
||
maxAttid
!=
null
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
0
).
getId
());
//当天一条记录的id
record
.
setType
(
1
);
//上班
Long
time
=
(
mapucalist
.
get
(
0
).
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk1
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
//
mindataone
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchCardDetails
dan
=
new
PunchCardDetails
();
dan
.
setId
(
dkmxid
);
//需修改的明细id
dan
.
setSbdk1
(
mindataone
.
getDktime
());
dan
.
setSbdk1jg
(
mindataone
.
getResults
());
// 上班1打卡结果
dan
.
setYdkcs
(
banci
.
getSxbcs
()*
2
);
//应打卡次数
dan
.
setGzsc
(
Double
.
valueOf
(
"0"
));
punchCardDetailsList
.
add
(
dan
);
// punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
PunchCardDetails
pcd
=
new
PunchCardDetails
();
if
(
mapucalist
.
size
()
>=
2
){
/***/
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
1
).
getId
());
//当天一条记录的id
record
.
setType
(
2
);
Long
time
=
(
mapucalist
.
get
(
1
).
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk1
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
mapucalist
.
get
(
1
).
getId
());
//单条打卡明细
pcd
.
setXbdk1
(
dtdkmx
.
getDktime
());
pcd
.
setXbdk1jg
(
dtdkmx
.
getResults
());
}
if
(
mapucalist
.
size
()
>=
3
){
/***/
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
2
).
getId
());
//当天一条记录的id
record
.
setType
(
1
);
Long
time
=
(
mapucalist
.
get
(
2
).
getDktime
()
-
sbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk2
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
mapucalist
.
get
(
2
).
getId
());
//单条打卡明细
pcd
.
setSbdk2
(
dtdkmx
.
getDktime
());
pcd
.
setSbdk2jg
(
dtdkmx
.
getResults
());
}
if
(
mapucalist
.
size
()
>=
4
){
/***/
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
maxAttid
.
getId
());
//当天一条记录的id
record
.
setType
(
2
);
Long
time
=
(
maxAttid
.
getDktime
()
-
xbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk2
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
maxAttid
.
getId
());
//单条打卡明细
pcd
.
setXbdk2
(
dtdkmx
.
getDktime
());
pcd
.
setXbdk2jg
(
dtdkmx
.
getResults
());
}
pcd
.
setId
(
dkmxid
);
punchCardDetailsList
.
add
(
pcd
);
// punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
}
}
else
if
(
banci
.
getSxbcs
()
==
3
){
//修改后一天打六次
if
(
mapucalist
.
size
()
>
6
){
//当天打卡多次
String
[]
str
=
new
String
[
5
];
for
(
int
y
=
0
;
y
<
mapucalist
.
size
();
y
++){
if
(
y
==
0
){
//上班
PunchRecord
mindata
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
y
).
getId
());
Long
time
=
(
mindata
.
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk1
);
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
}
if
(
y
==
1
||
y
==
2
||
y
==
3
||
y
==
4
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
y
).
getId
());
if
((
mapucalist
.
get
(
y
).
getSort
())%
2
==
0
){
//下班
if
(
y
==
1
){
Long
time
=
(
mapucalist
.
get
(
y
).
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk1
);
//下班应打卡时间
str
[
0
]
=
String
.
valueOf
(
mapucalist
.
get
(
y
).
getId
());
}
if
(
y
==
3
){
Long
time
=
(
mapucalist
.
get
(
y
).
getDktime
()
-
xbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk2
);
//下班应打卡时间
str
[
2
]
=
String
.
valueOf
(
mapucalist
.
get
(
y
).
getId
());
}
}
else
{
//上班
if
(
y
==
2
){
Long
time
=
(
mapucalist
.
get
(
y
).
getDktime
()
-
sbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk2
);
//上班应打卡时间
str
[
1
]
=
String
.
valueOf
(
mapucalist
.
get
(
y
).
getId
());
}
if
(
y
==
4
){
Long
time
=
(
mapucalist
.
get
(
y
).
getDktime
()
-
sbdk3
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk3
);
//上班应打卡时间
str
[
3
]
=
String
.
valueOf
(
mapucalist
.
get
(
y
).
getId
());
}
}
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
}
PunchRecord
maxdata
=
punchrecordservice
.
selectByPrimaryKey
(
maxAttid
.
getId
());
//下班
if
(
mapucalist
.
get
(
y
).
getId
()
==
maxdata
.
getId
()){
//下班
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
maxdata
.
getId
());
record
.
setType
(
2
);
//下班
Long
time
=
(
maxdata
.
getDktime
()
-
xbdk3
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setSort
(
6
);
record
.
setAttime
(
xbdk3
);
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
str
[
4
]
=
String
.
valueOf
(
maxdata
.
getId
());
}
if
(
y
==
5
||
y
>
5
&&
mapucalist
.
get
(
y
).
getId
()
!=
maxdata
.
getId
()){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
y
).
getId
());
record
.
setStatus
(
0
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setSort
(
0
);
//序号(0:打卡无效:此记录已被更新)
record
.
setResults
(
0
);
// 打卡结果
record
.
setAttime
(
mapucalist
.
get
(
y
).
getDktime
());
//上班应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
}
}
//修改打卡明细
PunchRecord
mindata
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchCardDetails
record
=
new
PunchCardDetails
();
record
.
setId
(
dkmxid
);
//需修改的明细id
record
.
setSbdk1
(
mindata
.
getDktime
());
record
.
setSbdk1jg
(
mindata
.
getResults
());
// 上班1打卡结果
record
.
setXbdk1
(
null
);
record
.
setXbdk1jg
(
0
);
// 下班1打卡结果
record
.
setSbdk2
(
null
);
record
.
setSbdk2jg
(
0
);
// 上班2打卡结果
record
.
setXbdk2
(
null
);
record
.
setXbdk2jg
(
0
);
// 下班2打卡结果
record
.
setSbdk3
(
null
);
record
.
setSbdk3jg
(
0
);
// 上班3打卡结果
record
.
setXbdk3
(
null
);
record
.
setXbdk3jg
(
0
);
// 下班3打卡结果
record
.
setYdkcs
(
banci
.
getSxbcs
()*
2
);
//应打卡次数
record
.
setGzsc
(
Double
.
valueOf
(
"0"
));
punchcarddetailsservice
.
ModifyPunchDetails
(
record
);
for
(
int
t
=
0
;
t
<
str
.
length
;
t
++){
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
Integer
.
valueOf
(
str
[
t
]));
//单条打卡明细
PunchCardDetails
dkmx
=
new
PunchCardDetails
();
dkmx
.
setId
(
dkmxid
);
//需修改的明细id
if
(
t
==
0
){
dkmx
.
setXbdk1
(
dtdkmx
.
getDktime
());
dkmx
.
setXbdk1jg
(
dtdkmx
.
getResults
());
// 下班1打卡结果
}
else
if
(
t
==
1
){
dkmx
.
setSbdk2
(
dtdkmx
.
getDktime
());
dkmx
.
setSbdk2jg
(
dtdkmx
.
getResults
());
// 上班2打卡结果
}
else
if
(
t
==
2
){
dkmx
.
setXbdk2
(
dtdkmx
.
getDktime
());
dkmx
.
setXbdk2jg
(
dtdkmx
.
getResults
());
// 下班2打卡结果
}
else
if
(
t
==
3
){
dkmx
.
setSbdk3
(
dtdkmx
.
getDktime
());
dkmx
.
setSbdk3jg
(
dtdkmx
.
getResults
());
// 上班3打卡结果
}
else
{
dkmx
.
setXbdk3
(
dtdkmx
.
getDktime
());
dkmx
.
setXbdk3jg
(
dtdkmx
.
getResults
());
// 下班3打卡结果
}
Long
woktimes
=
(
dtdkmx
.
getDktime
()
-
mindata
.
getDktime
())/
1000
/
60
;
dkmx
.
setGzsc
(
Double
.
valueOf
(
woktimes
));
punchCardDetailsList
.
add
(
dkmx
);
// punchcarddetailsservice.updateByPrimaryKeySelective(dkmx);
}
}
else
{
/**aaa**/
PunchRecord
mindataone
=
null
;
if
(
minAttid
!=
null
||
maxAttid
!=
null
){
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
0
).
getId
());
//当天一条记录的id
record
.
setType
(
1
);
//上班
Long
time
=
(
mapucalist
.
get
(
0
).
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk1
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
//
mindataone
=
punchrecordservice
.
selectByPrimaryKey
(
minAttid
.
getId
());
//上班
PunchCardDetails
dan
=
new
PunchCardDetails
();
dan
.
setId
(
dkmxid
);
//需修改的明细id
dan
.
setSbdk1
(
mindataone
.
getDktime
());
dan
.
setSbdk1jg
(
mindataone
.
getResults
());
// 上班1打卡结果
dan
.
setYdkcs
(
banci
.
getSxbcs
()*
2
);
//应打卡次数
dan
.
setGzsc
(
Double
.
valueOf
(
"0"
));
punchCardDetailsList
.
add
(
dan
);
// punchcarddetailsservice.updateByPrimaryKeySelective(dan);
}
PunchCardDetails
pcd
=
new
PunchCardDetails
();
if
(
mapucalist
.
size
()
>=
2
){
/***/
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
1
).
getId
());
//当天一条记录的id
record
.
setType
(
2
);
Long
time
=
(
mapucalist
.
get
(
1
).
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk1
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
mapucalist
.
get
(
1
).
getId
());
//单条打卡明细
pcd
.
setXbdk1
(
dtdkmx
.
getDktime
());
pcd
.
setXbdk1jg
(
dtdkmx
.
getResults
());
}
if
(
mapucalist
.
size
()
>=
3
){
/***/
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
2
).
getId
());
//当天一条记录的id
record
.
setType
(
1
);
Long
time
=
(
mapucalist
.
get
(
2
).
getDktime
()
-
sbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk2
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
mapucalist
.
get
(
2
).
getId
());
//单条打卡明细
pcd
.
setSbdk2
(
dtdkmx
.
getDktime
());
pcd
.
setSbdk2jg
(
dtdkmx
.
getResults
());
}
if
(
mapucalist
.
size
()
>=
4
){
/***/
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
3
).
getId
());
//当天一条记录的id
record
.
setType
(
1
);
Long
time
=
(
mapucalist
.
get
(
3
).
getDktime
()
-
xbdk2
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
xbdk2
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
mapucalist
.
get
(
3
).
getId
());
//单条打卡明细
pcd
.
setXbdk2
(
dtdkmx
.
getDktime
());
pcd
.
setXbdk2jg
(
dtdkmx
.
getResults
());
}
if
(
mapucalist
.
size
()
>=
5
){
/***/
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
mapucalist
.
get
(
4
).
getId
());
//当天一条记录的id
record
.
setType
(
1
);
Long
time
=
(
mapucalist
.
get
(
4
).
getDktime
()
-
sbdk3
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
3
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
record
.
setResults
(
Integer
.
valueOf
(
time
.
toString
()));
// 打卡结果
}
else
{
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
record
.
setAttime
(
sbdk3
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
mapucalist
.
get
(
4
).
getId
());
//单条打卡明细
pcd
.
setSbdk3
(
dtdkmx
.
getDktime
());
pcd
.
setSbdk3jg
(
dtdkmx
.
getResults
());
}
if
(
mapucalist
.
size
()
>=
6
){
/***/
PunchRecord
record
=
new
PunchRecord
();
record
.
setId
(
maxAttid
.
getId
());
//当天一条记录的id
record
.
setType
(
2
);
Long
time
=
(
maxAttid
.
getDktime
()
-
xbdk3
)/
1000
/
60
;
if
(
time
>
0
){
record
.
setStatus
(
1
);
record
.
setResults
(
0
);
// 打卡结果
}
else
{
record
.
setStatus
(
4
);
record
.
setResults
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
// 打卡结果
}
record
.
setAttime
(
xbdk3
);
//当天应打卡时间
record
.
setBcid
(
banci
.
getId
());
//班次id
punchRecordList
.
add
(
record
);
// punchrecordservice.updateByPrimaryKeySelective(record);
/***/
PunchRecord
dtdkmx
=
punchrecordservice
.
selectByPrimaryKey
(
maxAttid
.
getId
());
//单条打卡明细
pcd
.
setXbdk3
(
dtdkmx
.
getDktime
());
pcd
.
setXbdk3jg
(
dtdkmx
.
getResults
());
}
pcd
.
setId
(
dkmxid
);
punchCardDetailsList
.
add
(
pcd
);
// punchcarddetailsservice.updateByPrimaryKeySelective(pcd);
/**bbb***/
}
}
}
else
{
////修改后班次为休息的
RestMethod
(
mapucalist
,
dkmxid
);
}
}
/***********************/
}
// 打卡记录修改批处理
kqglAssoDkjlService
.
updateKqglAssoDkjlById
(
punchRecordList
);
// 打卡明细修改批处理
kqglAssoDkjlService
.
updateKqglAssoDkmxById
(
punchCardDetailsList
);
}
//判断新增或修改
}
long
endTime
=
System
.
currentTimeMillis
();
log
.
info
(
"=======================================执行时长(毫秒):{}"
,
endTime
-
startTime
);
if
(
schlist
.
size
()>
0
&&
xiugai
){
//删除排班明细表(自由排班)
// scheduleservice.deleteByPrimaryBykqzid(id);
scheduleservice
.
deleteByPrimaryBykqzid
(
id
,
date_scmx
);
scheduleservice
.
insertKqglAssoPbmxList
(
schlist
);
return
ResultUtil
.
data
(
schlist
,
"修改考勤组排班成功"
);
}
return
ResultUtil
.
data
(
schlist
,
"修改考勤组排班成功"
);
// return ResultUtil.error("修改考勤组排班失败");
}
}
src/main/java/cn/timer/api/service/KqglAssoDkjlService.java
0 → 100644
View file @
a6835924
package
cn
.
timer
.
api
.
service
;
import
cn.timer.api.bean.kqgl.PunchCardDetails
;
import
cn.timer.api.bean.kqgl.PunchRecord
;
import
java.util.List
;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2021/11/12
*/
public
interface
KqglAssoDkjlService
{
/**
* 打卡记录修改批处理
* @param entityList
* @return
*/
void
updateKqglAssoDkjlById
(
List
<
PunchRecord
>
entityList
);
/**
* 打卡明细修改批处理
* @param entityList
* @return
*/
void
updateKqglAssoDkmxById
(
List
<
PunchCardDetails
>
entityList
);
}
src/main/java/cn/timer/api/service/impl/KqglAssoDkjlServiceImpl.java
0 → 100644
View file @
a6835924
package
cn
.
timer
.
api
.
service
.
impl
;
import
cn.timer.api.bean.kqgl.PunchCardDetails
;
import
cn.timer.api.bean.kqgl.PunchRecord
;
import
cn.timer.api.bean.kqmk.KqglAssoDkjl
;
import
cn.timer.api.dao.kqgl.PunchCardDetailsMapper
;
import
cn.timer.api.dao.kqgl.PunchRecordMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoDkjlMapper
;
import
cn.timer.api.service.KqglAssoDkjlService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.session.ExecutorType
;
import
org.apache.ibatis.session.SqlSession
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Collection
;
import
java.util.List
;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2021/11/12
*/
@Slf4j
@Service
public
class
KqglAssoDkjlServiceImpl
implements
KqglAssoDkjlService
{
@Autowired
private
SqlSessionFactory
sqlSessionFactory
;
@Transactional
@Override
public
void
updateKqglAssoDkjlById
(
List
<
PunchRecord
>
entityList
)
{
SqlSession
session
=
sqlSessionFactory
.
openSession
(
ExecutorType
.
BATCH
,
false
);
PunchRecordMapper
mapper
=
session
.
getMapper
(
PunchRecordMapper
.
class
);
for
(
int
i
=
0
;
i
<
entityList
.
size
();
i
++)
{
mapper
.
updateByPrimaryKeySelective
(
entityList
.
get
(
i
));
//每100条提交一次
if
(
i
%
100
==
99
){
session
.
commit
();
session
.
clearCache
();
}
}
session
.
commit
();
session
.
clearCache
();
}
@Override
public
void
updateKqglAssoDkmxById
(
List
<
PunchCardDetails
>
entityList
)
{
SqlSession
session
=
sqlSessionFactory
.
openSession
(
ExecutorType
.
BATCH
,
false
);
PunchCardDetailsMapper
mapper
=
session
.
getMapper
(
PunchCardDetailsMapper
.
class
);
for
(
int
i
=
0
;
i
<
entityList
.
size
();
i
++)
{
mapper
.
updateByPrimaryKeySelective
(
entityList
.
get
(
i
));
//每100条提交一次
if
(
i
%
100
==
99
){
session
.
commit
();
session
.
clearCache
();
}
}
session
.
commit
();
session
.
clearCache
();
}
}
src/main/resources/mapping/kqgl/PunchRecordMapper.xml
View file @
a6835924
...
...
@@ -410,10 +410,11 @@
where dkjl.attime
>
= #{start}
and dkjl.attime
<
= #{end}
and dkjl.user_id = #{userId,jdbcType=INTEGER}
and dkjl.`status`
!=
0
and dkjl.sort
!=
0
and dkjl.`status`
>
0
and dkjl.sort
>
0
and dkjl.qyid = #{qyid}
and dkjl.dkmxid != 0
and dkjl.dkmxid > 0
and dkjl.id > 0
ORDER BY dkjl.id ASC
</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