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
b0a6cafe
Commit
b0a6cafe
authored
Jul 01, 2020
by
lal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交
parent
7bcd3675
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
359 additions
and
704 deletions
+359
-704
src/main/java/cn/timer/api/bean/kqmk/KqglAssoDkjl.java
+1
-1
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
+240
-30
src/main/java/cn/timer/api/controller/kqgl/TimeCardController.java
+82
-666
src/main/java/cn/timer/api/controller/kqgl/service/KqglServiceImpl.java
+17
-1
src/main/java/cn/timer/api/dao/kqmk/KqglAssoDkjlMapper.java
+5
-2
src/main/java/cn/timer/api/dto/kqmk/AttendanceCardListDto.java
+7
-4
src/main/resources/mapping/kqmk/KqglAssoDkjlMapper.xml
+7
-0
No files found.
src/main/java/cn/timer/api/bean/kqmk/KqglAssoDkjl.java
View file @
b0a6cafe
...
...
@@ -60,7 +60,7 @@ public class KqglAssoDkjl extends Model<KqglAssoDkjl> {
@ApiModelProperty
(
value
=
"类型(0:无排班打卡 1:上班 2:下班)"
,
example
=
"101"
)
private
Integer
type
;
@ApiModelProperty
(
value
=
"(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)"
,
example
=
"101"
)
@ApiModelProperty
(
value
=
"(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休
9:管理员改为正常 10:管理员改为迟到 11:管理员改为早退 12:补卡通过/正常 13:补卡通过/迟到 14:补卡通过/早退
)"
,
example
=
"101"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"序号(0:打卡无效:此记录已被更新) 序号(0:打卡无效:此记录已被更新)"
,
example
=
"101"
)
...
...
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
View file @
b0a6cafe
...
...
@@ -19,9 +19,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
cn.hutool.json.JSONObject
;
import
cn.timer.api.bean.kqgl.AttConditions
;
import
cn.timer.api.bean.kqgl.AttGroupBinPunchMode
;
import
cn.timer.api.bean.kqgl.AttendanceGroup
;
import
cn.timer.api.bean.kqgl.AttendanceMachine
;
import
cn.timer.api.bean.kqgl.PunchCardAddress
;
import
cn.timer.api.bean.kqgl.PunchCardDetails
;
import
cn.timer.api.bean.kqgl.PunchRecord
;
import
cn.timer.api.bean.kqgl.PunchCardWiFi
;
import
cn.timer.api.dto.kqmk.PunchRecord
;
import
cn.timer.api.bean.kqgl.ShiftManagement
;
import
cn.timer.api.bean.kqmk.KqglAssoBcsz
;
import
cn.timer.api.bean.kqmk.KqglAssoDkjl
;
...
...
@@ -35,8 +40,12 @@ import cn.timer.api.bean.yggl.YgglMainEmp;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.exception.CustomException
;
import
cn.timer.api.dao.kqgl.AttGroupBinPunchModeMapper
;
import
cn.timer.api.dao.kqgl.AttendanceGroupMapper
;
import
cn.timer.api.dao.kqgl.AttendanceMachineMapper
;
import
cn.timer.api.dao.kqgl.PunchCardAddressMapper
;
import
cn.timer.api.dao.kqgl.PunchCardDetailsMapper
;
import
cn.timer.api.dao.kqgl.PunchCardWiFiMapper
;
import
cn.timer.api.dao.kqgl.PunchRecordMapper
;
import
cn.timer.api.dao.kqgl.ShiftManagementMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoBcszMapper
;
...
...
@@ -44,6 +53,7 @@ import cn.timer.api.dao.kqmk.KqglAssoDkjlMapper;
import
cn.timer.api.dao.kqmk.KqglAssoDkmxMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoPbmxMapper
;
import
cn.timer.api.dao.kqmk.KqglMainKqzMapper
;
import
cn.timer.api.dto.kqmk.AttClockMethod
;
import
cn.timer.api.dto.kqmk.AttLateLate
;
import
cn.timer.api.dto.kqmk.AttSchedule
;
import
cn.timer.api.dto.kqmk.AttendanceCardListDto
;
...
...
@@ -53,7 +63,6 @@ import cn.timer.api.utils.DateUtil;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.ResultUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
@Api
(
tags
=
"3.0[3]考勤打卡"
)
...
...
@@ -466,13 +475,9 @@ public class ClockInController {
int
dkcs_
=
shif
.
getSxbcs
();
//上下班打卡次数
int
iswzwd
=
shif
.
getIsWzwd
();
//是否开启晚走晚到(0:否;1:是)
//统一分钟数
double
xbwz1
=
Double
.
valueOf
(
shif
.
getXbwz1
())
*
60
;
//下班晚走1
int
sbwd1
=
Integer
.
valueOf
(
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd1
())
*
60
));
//上班晚到1
double
xbwz2
=
Double
.
valueOf
(
shif
.
getXbwz2
())
*
60
;
//下班晚走2
int
sbwd2
=
Integer
.
valueOf
(
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd2
())
*
60
));
//上班晚到2
double
xbwz3
=
Double
.
valueOf
(
shif
.
getXbwz3
())
*
60
;
//下班晚走3
int
sbwd3
=
Integer
.
valueOf
(
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd3
())
*
60
));
//上班晚到3
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
;
//前天晚走时长(分钟)
...
...
@@ -482,6 +487,14 @@ public class ClockInController {
long
yesendtime1
=
0
,
yesendtime2
=
0
,
yesendtime3
=
0
;
//存在晚走玩到
if
(
iswzwd
>
0
)
{
//统一分钟数
xbwz1
=
Double
.
valueOf
(
shif
.
getXbwz1
())
*
60
;
//下班晚走1
sbwd1
=
Integer
.
valueOf
(
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd1
())
*
60
));
//上班晚到1
xbwz2
=
Double
.
valueOf
(
shif
.
getXbwz2
())
*
60
;
//下班晚走2
sbwd2
=
Integer
.
valueOf
(
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd2
())
*
60
));
//上班晚到2
xbwz3
=
Double
.
valueOf
(
shif
.
getXbwz3
())
*
60
;
//下班晚走3
sbwd3
=
Integer
.
valueOf
(
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd3
())
*
60
));
//上班晚到3
//获取前一天最后下班的时间
yesterdaymx
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
userid
)
.
ge
(
KqglAssoDkmx:
:
getDksj
,
startDateyesterday
).
le
(
KqglAssoDkmx:
:
getDksj
,
endDateyesterday
));
...
...
@@ -541,6 +554,7 @@ public class ClockInController {
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
){
//上班
...
...
@@ -691,7 +705,7 @@ public class ClockInController {
}
pcd
.
setId
(
dkmc
.
getId
());
if
(
atttype
<=
6
&&
atttype
>
0
&&
!
sbdkkd
){
int
update
=
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
}
}
else
{
...
...
@@ -1027,11 +1041,11 @@ public class ClockInController {
}
}
else
if
(
attgro
.
getPbfs
()
==
2
){
//自由排班
//未排班时,员工可选择班次打卡
if
(
attgro
.
getIsXzbcdk
()
==
1
){
attcar
.
setOptscheduling
(
true
);
}
else
{
attcar
.
setOptscheduling
(
false
);
}
//
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
()));
...
...
@@ -1106,6 +1120,9 @@ public class ClockInController {
}
else
{
attcar
.
setAttgrouptype
(
0
);
//1:固定排班;2:自由排班;3:自由工时
}
return
attcar
;
}
...
...
@@ -1252,7 +1269,7 @@ public class ClockInController {
*/
@PostMapping
(
value
=
"/AttendanceCard"
)
@ApiOperation
(
value
=
"考勤打卡------APP打卡"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
53
)
@ApiOperationSupport
(
order
=
2
)
public
Result
<
Void
>
AttendanceCard
(
@CurrentUser
UserBean
userBean
,
@RequestBody
ClockCollectData
clock
)
{
int
qyid
=
userBean
.
getOrgCode
();
//坏小孩【企业id】
int
userid
=
userBean
.
getEmpNum
();
//用户id
...
...
@@ -1572,19 +1589,19 @@ public class ClockInController {
//打卡记录
if
(
clock
.
getDiffer
()
==
2
){
//更新打卡
PunchRecord
punch
=
punchrecordmapper
.
selectPunchResults
(
startDate
,
endDate
,
userid
,
clock
.
getType
());
if
(
punch
!=
null
){
PunchRecord
pr
=
new
PunchRecord
();
pr
.
setId
(
punch
.
getId
());
pr
.
setStatus
(
0
);
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:补卡 4:请假)
pr
.
setSort
(
0
);
//序号(0:打卡无效:此记录已被更新)
punchrecordmapper
.
updateByPrimaryKeySelective
(
pr
);
}
else
{
return
ResultUtil
.
error
(
"打卡失败"
);
}
}
//
//打卡记录
//
if(clock.getDiffer() == 2){//更新打卡
//
PunchRecord punch = punchrecordmapper.selectPunchResults(startDate,endDate,userid,clock.getType());
//
if(punch != null){
//
PunchRecord pr = new PunchRecord();
//
pr.setId(punch.getId());
//
pr.setStatus(0);//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:补卡 4:请假)
//
pr.setSort(0);//序号(0:打卡无效:此记录已被更新)
//
punchrecordmapper.updateByPrimaryKeySelective(pr);
//
}else{
//
return ResultUtil.error("打卡失败");
//
}
//
}
PunchRecord
pre
=
new
PunchRecord
();
pre
.
setDktime
(
Long
.
valueOf
(
clock
.
getPunchtime
()));
// 打卡时间
...
...
@@ -1659,11 +1676,204 @@ public class ClockInController {
pre
.
setDkmxid
(
dkmx
);
// 打卡明细id
pre
.
setBcid
(
clock
.
getShifid
());
// 班次id
punchrecordmapper
.
insertSelective
(
pre
);
//新增打卡记录
//
punchrecordmapper.insertSelective(pre);//新增打卡记录
return
ResultUtil
.
data
(
null
,
"打卡成功"
);
}
//考勤组绑定的打卡方式
@Autowired
private
AttGroupBinPunchModeMapper
attgroupbinpunchmodemapper
;
//考勤机
@Autowired
private
AttendanceMachineMapper
attendancemachinemapper
;
//考勤地址
@Autowired
private
PunchCardAddressMapper
punchcardaddressmapper
;
//考勤WIFI
@Autowired
private
PunchCardWiFiMapper
punchcardwifimapper
;
/**
* 获取考勤打卡数据------APP打卡
* @throws ParseException
*/
@PostMapping
(
value
=
"/ClockData"
)
@ApiOperation
(
value
=
"获取考勤打卡数据------APP打卡"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
3
)
public
Result
<
Object
>
getAttClockData
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttConditions
attconditions
)
throws
ParseException
{
String
str
=
null
;
if
(!(
""
).
equals
(
attconditions
.
getDate
())){
str
=
attconditions
.
getDate
();
}
else
{
Date
d
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
str
=
sdf
.
format
(
d
);
}
//前一天时间
String
yesterday
=
ClockInTool
.
requires_extra_times
(
str
,-
1
,
3
,
1
);
//前一天
Long
startDateyesterday
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
yesterday
,
"yyyy-MM-dd"
)).
getTime
();
Long
endDateyesterday
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
yesterday
,
"yyyy-MM-dd"
)).
getTime
();
Long
startDate
=
0
l
;
Long
endDate
=
0
l
;
try
{
startDate
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
str
,
"yyyy-MM-dd"
)).
getTime
();
endDate
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
str
,
"yyyy-MM-dd"
)).
getTime
();
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
KqglMainKqz
attgro
=
kqglmainkqzmapper
.
getAttendanceGroupInformationByUserid
(
userBean
.
getEmpNum
(),
userBean
.
getOrgCode
());
//考勤组信息
//APP获取当前天的考勤信息
AttendanceCardListDto
attdate
=
MethodCall
(
userBean
.
getOrgCode
(),
userBean
.
getEmpNum
(),
attconditions
.
getDate
());
//外勤 true:开 false:关
if
(
attgro
.
getIsWq
()
==
1
)
{
attdate
.
setFieldpersonnel
(
true
);
}
else
{
attdate
.
setFieldpersonnel
(
false
);
}
//打卡方式
List
<
AttGroupBinPunchMode
>
attmetlist
=
attgroupbinpunchmodemapper
.
selectByPrimaryByKqzId
(
attgro
.
getId
());
for
(
AttGroupBinPunchMode
agbp:
attmetlist
){
//类型(1:考勤机;2:地址;3:WIFI)
if
(
agbp
.
getType
()
==
1
){
attdate
.
setAttmachine
(
true
);
}
else
if
(
agbp
.
getType
()
==
2
){
attdate
.
setAttaddress
(
true
);
}
else
{
attdate
.
setAttwifi
(
true
);
}
}
//详细打卡方式
List
<
AttClockMethod
>
akms
=
new
ArrayList
<
AttClockMethod
>();
for
(
AttGroupBinPunchMode
abp:
attmetlist
){
if
(
abp
.
getType
()
==
1
){
AttendanceMachine
kqjs
=
attendancemachinemapper
.
selectByPrimaryKey
(
abp
.
getDkfsid
());
AttClockMethod
akm
=
AttClockMethod
.
builder
().
build
();
akm
.
setName
(
kqjs
.
getName
());
// 打卡名称
akm
.
setMac
(
""
);
// wifi【wifi】
akm
.
setAttrange
(
0
);
// 范围【地址】
akm
.
setType
(
1
);
// 类型(1:考勤机;2:地址;3:WIFI)
akm
.
setLongitude
(
0
);
// 经度【地址】
akm
.
setLatitude
(
0
);
// 纬度【地址】
akms
.
add
(
akm
);
}
else
if
(
abp
.
getType
()
==
2
){
PunchCardAddress
kqdzs
=
punchcardaddressmapper
.
selectByPrimaryKey
(
abp
.
getDkfsid
());
AttClockMethod
akm
=
AttClockMethod
.
builder
().
build
();
akm
.
setName
(
kqdzs
.
getName
());
// 打卡名称
akm
.
setMac
(
""
);
// wifi【wifi】
akm
.
setAttrange
(
kqdzs
.
getDkfw
());
// 范围【地址】
akm
.
setType
(
2
);
// 类型(1:考勤机;2:地址;3:WIFI)
akm
.
setLongitude
(
kqdzs
.
getLon
());
// 经度【地址】
akm
.
setLatitude
(
kqdzs
.
getLat
());
// 纬度【地址】
akms
.
add
(
akm
);
}
else
{
PunchCardWiFi
kqwfs
=
punchcardwifimapper
.
selectByPrimaryKey
(
abp
.
getDkfsid
());
AttClockMethod
akm
=
AttClockMethod
.
builder
().
build
();
akm
.
setName
(
kqwfs
.
getName
());
// 打卡名称
akm
.
setMac
(
kqwfs
.
getMac
());
// wifi【wifi】
akm
.
setAttrange
(
0
);
// 范围【地址】
akm
.
setType
(
3
);
// 类型(1:考勤机;2:地址;3:WIFI)
akm
.
setLongitude
(
0
);
// 经度【地址】
akm
.
setLatitude
(
0
);
// 纬度【地址】
akms
.
add
(
akm
);
}
}
attdate
.
setMachine
(
akms
);
//打卡记录
List
<
KqglAssoDkjl
>
dajllist
=
kqglassodkjlmapper
.
getDetailedRecordClock
(
startDate
,
endDate
,
userBean
.
getEmpNum
());
attdate
.
setAttpr
(
dajllist
);
//当天第一次打卡 前一天晚走小时**************************************************
double
latetime_
=
0
;
//前天晚走时长(分钟)
Long
changed_time
=
0
l
;
//晚到后应打卡时间
List
<
AttSchedule
>
ash
=
attdate
.
getAttsch
();
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
ash
.
get
(
0
).
getId
()));
int
dkcs_
=
shif
.
getSxbcs
();
//上下班打卡次数
int
iswzwd
=
shif
.
getIsWzwd
();
//是否开启晚走晚到(0:否;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
sbwd1
=
Integer
.
valueOf
(
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd1
())
*
60
));
//上班晚到1
xbwz2
=
Double
.
valueOf
(
shif
.
getXbwz2
())
*
60
;
//下班晚走2
sbwd2
=
Integer
.
valueOf
(
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd2
())
*
60
));
//上班晚到2
xbwz3
=
Double
.
valueOf
(
shif
.
getXbwz3
())
*
60
;
//下班晚走3
sbwd3
=
Integer
.
valueOf
(
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd3
())
*
60
));
//上班晚到3
//获取前一天最后下班的时间
yesterdaymx
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
userBean
.
getEmpNum
())
.
ge
(
KqglAssoDkmx:
:
getDksj
,
startDateyesterday
).
le
(
KqglAssoDkmx:
:
getDksj
,
endDateyesterday
));
attdateyesterday
=
MethodCall
(
userBean
.
getOrgCode
(),
userBean
.
getEmpNum
(),
yesterday
);
List
<
AttSchedule
>
ashyes
=
attdateyesterday
.
getAttsch
();
if
(
attdateyesterday
.
getAttsch
().
size
()
==
2
||
attdateyesterday
.
getAttsch
().
size
()
==
4
||
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesendtime1
=
ashyes
.
get
(
1
).
getTime
();
}
if
(
attdateyesterday
.
getAttsch
().
size
()
==
4
||
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesendtime2
=
ashyes
.
get
(
3
).
getTime
();
}
if
(
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesendtime3
=
ashyes
.
get
(
5
).
getTime
();
}
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
)
{
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
;
}
//ash.get(0).getTime():当天第一次应打卡时间
clock_date
=
ClockInTool
.
stampToDate
(
String
.
valueOf
(
ash
.
get
(
0
).
getTime
()));
changed_time
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
ClockInTool
.
addtime
(
clock_date
,
"+"
+
arrive_late
)));
//晚到后应打卡时间
}
}
attdate
.
setLatetime
(
latetime_
);
attdate
.
setChanged_time
(
changed_time
);
return
ResultUtil
.
data
(
attdate
);
}
}
src/main/java/cn/timer/api/controller/kqgl/TimeCardController.java
View file @
b0a6cafe
...
...
@@ -5,7 +5,6 @@ import java.text.ParseException;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -39,7 +38,6 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.lang.Console
;
import
cn.timer.api.bean.kqgl.KqglAssoKqjgly
;
import
cn.timer.api.bean.kqgl.PunchCardDetails
;
import
cn.timer.api.bean.kqgl.PunchRecord
;
import
cn.timer.api.bean.kqgl.UserAttendanceRel
;
import
cn.timer.api.bean.kqgl.UserEquiRelation
;
...
...
@@ -70,20 +68,17 @@ import cn.timer.api.bean.yggl.YgglMainEmp;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.exception.CustomException
;
import
cn.timer.api.dao.kqgl.PunchCardDetailsMapper
;
import
cn.timer.api.dao.kqgl.PunchRecordMapper
;
import
cn.timer.api.dao.kqgl.UserAttendanceRelMapper
;
import
cn.timer.api.dao.kqgl.UserEquiRelationMapper
;
import
cn.timer.api.dao.kqmk.KqglAssOvertimeViceMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoBcszMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoDkdzMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoDkjlMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoDkmxMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoDkwxMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoKqjMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoKqzdkfsMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoLeaveEmployeeBalanceMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoLeaveRulesMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoMonthPunchSummaryMapper
;
import
cn.timer.api.dao.kqmk.KqglAssoOvertimeRangeMapper
;
...
...
@@ -472,8 +467,6 @@ public class TimeCardController {
@Autowired
private
KqglAssoRulesViceMapper
kqglassorulesvicemapper
;
@Autowired
private
KqglAssoLeaveEmployeeBalanceMapper
kqglassoleaveemployeebalancemapper
;
/**
* 新增/修改--假期规则
*/
...
...
@@ -579,6 +572,7 @@ public class TimeCardController {
return
ResultUtil
.
data
(
attendanList
,
"操作成功!"
);
}
@SuppressWarnings
(
"all"
)
@GetMapping
(
value
=
"/synchrotime/{code}"
)
@ApiOperation
(
value
=
"考勤机一键同步"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
SynchronizationTime
(
@CurrentUser
UserBean
userBean
,
@PathVariable
(
"code"
)
String
code
)
{
...
...
@@ -602,6 +596,7 @@ public class TimeCardController {
/**
* 移除考勤机管理员
*/
@SuppressWarnings
(
"all"
)
@PostMapping
(
value
=
"/removeadministrator/{kqjid}/{id}"
)
@ApiOperation
(
value
=
"移除考勤机管理员"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
RemoveAdministrator
(
@PathVariable
int
kqjid
,
@PathVariable
int
id
,
@RequestBody
Map
<
String
,
String
>
mmd
)
{
...
...
@@ -631,6 +626,7 @@ public class TimeCardController {
return
ResultUtil
.
success
(
"成功"
);
}
@SuppressWarnings
(
"all"
)
@PostMapping
(
value
=
"/modifyauthority/{kqjid}/{id}"
)
@ApiOperation
(
value
=
"添加考勤机管理员"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
ModifyAuthority
(
@CurrentUser
UserBean
userBean
,
@PathVariable
int
kqjid
,
@PathVariable
int
id
,
@RequestBody
Map
<
String
,
String
>
mmd
)
{
...
...
@@ -671,6 +667,7 @@ public class TimeCardController {
/**
* 新增考勤机
*/
@SuppressWarnings
(
"all"
)
@PostMapping
(
value
=
"/Attendance_machine"
)
@ApiOperation
(
value
=
"16:新增考勤机"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
16
)
...
...
@@ -1134,6 +1131,7 @@ public class TimeCardController {
/**
* 删除考勤组
*/
@SuppressWarnings
(
"all"
)
@DeleteMapping
(
value
=
"/AttendanceGroup/{id}"
)
@ApiOperation
(
value
=
"39:删除考勤组"
,
httpMethod
=
"DELETE"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
39
)
...
...
@@ -1208,6 +1206,7 @@ public class TimeCardController {
/**
* 新建考勤组
*/
@SuppressWarnings
(
"all"
)
@PostMapping
(
value
=
"/AttendanceGroup"
)
@ApiOperation
(
value
=
"40:新增考勤组数据"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
40
)
...
...
@@ -1382,6 +1381,7 @@ public class TimeCardController {
return
ResultUtil
.
data
(
usatt
);
}
@SuppressWarnings
(
"all"
)
@PostMapping
(
value
=
"/setmembers"
)
@ApiOperation
(
value
=
"考勤设置成员"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
Attsetmembers
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttMemberSettings
attsetuser
)
{
...
...
@@ -1487,656 +1487,11 @@ public class TimeCardController {
private
SimpleDateFormat
mat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
@Autowired
private
KqglAssoDkjlMapper
kqglassodkjlmapper
;
//打卡记录
@Autowired
private
PunchRecordMapper
punchrecordmapper
;
//打卡明细表
@Autowired
private
PunchCardDetailsMapper
punchcarddetailsservice
;
/**
* 修改考勤组排班(修改排班后,需判断是否有打卡记录,有则匹配当天修改后的班次,无则不需要修改)
* @throws ParseException
*/
@PutMapping
(
value
=
"/attscheduling"
)
@ApiOperation
(
value
=
"44:修改考勤组排班"
,
httpMethod
=
"PUT"
,
notes
=
"接口发布说明"
)
@ApiOperationSupport
(
order
=
44
)
public
Result
<
Object
>
updateAttscheduling
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AttendanceAssistantDto
attass
)
throws
ParseException
{
int
id
=
Integer
.
valueOf
(
attass
.
getAttgroupid
());
//修改数据id
List
<
KqglAssoPbmxDto
>
schlist
=
new
ArrayList
<
KqglAssoPbmxDto
>();
KqglAssoPbmxDto
[]
schedules
=
attass
.
getSchedules
();
// 排班日期【排班制】--班次id、日期
if
(
schedules
.
length
>
0
&&
attass
.
getAtttype
()
==
2
){
for
(
int
p
=
0
;
p
<
schedules
.
length
;
p
++){
KqglAssoPbmxDto
sch
=
KqglAssoPbmxDto
.
builder
().
userid
(
schedules
[
p
].
getUserid
()).
data
(
schedules
[
p
].
getData
()).
bcid
(
schedules
[
p
].
getBcid
()).
kqzid
(
Integer
.
valueOf
(
attass
.
getAttgroupid
())).
build
();
schlist
.
add
(
sch
);
String
data
=
mat
.
format
(
new
Date
(
schedules
[
p
].
getData
().
toString
()));
Long
startDate
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
data
,
"yyyy-MM-dd"
)).
getTime
();
Long
endDate
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
data
,
"yyyy-MM-dd"
)).
getTime
();
KqglAssoBcsz
banci
=
KqglAssoBcsz
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
schedules
[
p
].
getBcid
()));
Long
sbdk1
=
0
l
,
xbdk1
=
0
l
,
sbdk2
=
0
l
,
xbdk2
=
0
l
,
sbdk3
=
0
l
,
xbdk3
=
0
l
;
if
(
banci
!=
null
){
if
(
banci
.
getSxbcs
()==
1
||
banci
.
getSxbcs
()==
2
||
banci
.
getSxbcs
()==
3
){
sbdk1
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
ClockInTool
.
dealDateFormat
(
banci
.
getSbdk1
(),
2
)+
":00"
));
xbdk1
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
ClockInTool
.
dealDateFormat
(
banci
.
getXbdk1
(),
2
)+
":00"
));
}
if
(
banci
.
getSxbcs
()==
2
||
banci
.
getSxbcs
()==
3
){
sbdk2
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
ClockInTool
.
dealDateFormat
(
banci
.
getSbdk2
(),
2
)+
":00"
));
xbdk2
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
ClockInTool
.
dealDateFormat
(
banci
.
getXbdk2
(),
2
)+
":00"
));
}
if
(
banci
.
getSxbcs
()==
3
){
sbdk3
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
ClockInTool
.
dealDateFormat
(
banci
.
getSbdk3
(),
2
)+
":00"
));
xbdk3
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
data
+
" "
+
ClockInTool
.
dealDateFormat
(
banci
.
getXbdk3
(),
2
)+
":00"
));
}
}
KqglAssoDkjl
mapuca
=
KqglAssoDkjl
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkjl
>().
lambda
().
gt
(
KqglAssoDkjl:
:
getAttime
,
startDate
).
lt
(
KqglAssoDkjl:
:
getAttime
,
endDate
).
eq
(
KqglAssoDkjl:
:
getUserId
,
schedules
[
p
].
getUserid
()).
last
(
"LIMIT 1"
));
List
<
KqglAssoDkjl
>
mapucalist
=
kqglassodkjlmapper
.
selectList
(
new
QueryWrapper
<
KqglAssoDkjl
>().
lambda
().
gt
(
KqglAssoDkjl:
:
getAttime
,
startDate
).
lt
(
KqglAssoDkjl:
:
getAttime
,
endDate
).
eq
(
KqglAssoDkjl:
:
getUserId
,
schedules
[
p
].
getUserid
()).
orderByAsc
(
KqglAssoDkjl:
:
getId
));
if
(
mapuca
!=
null
&&
!(
schedules
[
p
].
getBcid
()).
equals
(
mapuca
.
getBcid
())){
// List<KqglAssoDkjl> initial = kqglassodkjlmapper.selectList(new QueryWrapper<KqglAssoDkjl>().lambda().gt(KqglAssoDkjl::getAttime, startDate).lt(KqglAssoDkjl::getAttime, endDate).eq(KqglAssoDkjl::getUserId, schedules[p].getUserid()).orderByAsc(KqglAssoDkjl::getId));
if
(
mapucalist
.
size
()
>
0
){
RestMethod
(
mapucalist
,
mapucalist
.
get
(
0
).
getDkmxid
());
}
}
KqglAssoDkjl
minAttid
=
null
,
maxAttid
=
null
;
int
dkmxid
=
0
;
if
(
mapucalist
.
size
()
>
0
){
//最小值
minAttid
=
mapucalist
.
stream
().
min
(
Comparator
.
comparing
(
KqglAssoDkjl:
:
getId
)).
get
();
//最大值
maxAttid
=
mapucalist
.
stream
().
max
(
Comparator
.
comparing
(
KqglAssoDkjl:
:
getId
)).
get
();
//对应打卡明细表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
(
KqglAssoDkjl
pre
:
mapucalist
){
if
(
pre
.
getId
()
!=
minAttid
.
getId
()
&&
pre
.
getId
()
!=
maxAttid
.
getId
()){
//去除最大和最小 其他均改为“打卡无效:此记录已被更新”
int
results
=
0
;
long
attime
;
if
((
pre
.
getSort
())%
2
>
0
){
Long
time
=
(
pre
.
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
results
=
Integer
.
valueOf
(
time
.
toString
());}
attime
=
sbdk1
;
//上班应打卡时间
}
else
{
Long
time
=
(
pre
.
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){}
else
{
results
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
attime
=
xbdk1
;
//下班应打卡时间
}
KqglAssoDkjl
.
builder
().
id
(
pre
.
getId
()).
status
(
0
).
sort
(
0
).
results
(
results
).
attime
(
attime
).
bcid
(
banci
.
getId
()).
build
().
updateById
();
}
else
{
if
(
pre
.
getId
()
==
minAttid
.
getId
()){
//上班
Long
time
=
(
pre
.
getDktime
()
-
sbdk1
)/
1000
/
60
;
int
status
=
0
,
results
=
0
;
//状态(0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休)
if
(
time
>
0
){
status
=
3
;
results
=
Integer
.
valueOf
(
time
.
toString
());}
else
{
status
=
1
;
results
=
0
;}
KqglAssoDkjl
.
builder
().
id
(
pre
.
getId
()).
type
(
1
).
status
(
status
).
results
(
results
).
attime
(
sbdk1
).
bcid
(
banci
.
getId
()).
build
().
updateById
();
}
else
if
(
pre
.
getId
()
==
maxAttid
.
getId
()){
//下班
Long
time
=
(
pre
.
getDktime
()
-
xbdk1
)/
1000
/
60
;
int
status
=
0
,
results
=
0
;
if
(
time
>
0
){
status
=
1
;
results
=
0
;}
else
{
status
=
4
;
results
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
KqglAssoDkjl
.
builder
().
id
(
pre
.
getId
()).
type
(
2
).
status
(
status
).
results
(
results
).
attime
(
xbdk1
).
bcid
(
banci
.
getId
()).
sort
(
2
).
build
().
updateById
();
}
}
}
KqglAssoDkjl
mindata
=
KqglAssoDkjl
.
builder
().
id
(
minAttid
.
getId
()).
build
().
selectById
();
KqglAssoDkmx
.
builder
().
id
(
dkmxid
).
sbdk1
(
mindata
.
getDktime
()).
sbdk1jg
(
mindata
.
getResults
()).
xbdk1
(
null
).
xbdk1jg
(
0
).
sbdk2
(
null
).
sbdk2jg
(
0
).
xbdk2
(
null
)
.
xbdk2jg
(
0
).
sbdk3
(
null
).
sbdk3jg
(
0
).
ydkcs
(
banci
.
getSxbcs
()*
2
).
gzsc
(
Double
.
valueOf
(
"0"
)).
build
().
updateById
();
KqglAssoDkjl
maxdata
=
KqglAssoDkjl
.
builder
().
id
(
maxAttid
.
getId
()).
build
().
selectById
();
Long
woktimes
=
(
maxdata
.
getDktime
()
-
mindata
.
getDktime
())/
1000
/
60
;
KqglAssoDkmx
.
builder
().
id
(
dkmxid
).
xbdk1
(
maxdata
.
getDktime
()).
xbdk1jg
(
maxdata
.
getResults
()).
gzsc
(
Double
.
valueOf
(
woktimes
)).
build
().
updateById
();
}
else
{
KqglAssoDkjl
mindataone
=
null
;
if
(
minAttid
!=
null
||
maxAttid
!=
null
){
int
status
=
0
,
results
=
0
;
Long
time
=
(
mapucalist
.
get
(
0
).
getDktime
()
-
sbdk1
)/
1000
/
60
;
if
(
time
>
0
){
status
=
3
;
results
=
Integer
.
valueOf
(
time
.
toString
());
}
else
{
status
=
1
;
results
=
0
;
}
KqglAssoDkjl
.
builder
().
id
(
mapucalist
.
get
(
0
).
getId
()).
type
(
1
).
status
(
status
).
results
(
results
).
attime
(
sbdk1
).
bcid
(
banci
.
getId
()).
build
().
updateById
();
mindataone
=
KqglAssoDkjl
.
builder
().
id
(
minAttid
.
getId
()).
build
().
selectById
();
KqglAssoDkmx
.
builder
().
id
(
dkmxid
).
sbdk1
(
mindataone
.
getDktime
()).
sbdk1jg
(
mindataone
.
getResults
()).
ydkcs
(
banci
.
getSxbcs
()*
2
).
gzsc
(
Double
.
valueOf
(
"0"
)).
build
().
updateById
();
}
if
(
maxAttid
!=
null
&&
minAttid
.
getId
()
!=
maxAttid
.
getId
()){
int
status
=
0
,
results
=
0
;
Long
time
=
(
mapucalist
.
get
(
1
).
getDktime
()
-
xbdk1
)/
1000
/
60
;
if
(
time
>
0
){
status
=
1
;
results
=
0
;
}
else
{
status
=
4
;
results
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));
}
KqglAssoDkjl
.
builder
().
id
(
mapucalist
.
get
(
1
).
getId
()).
type
(
2
).
status
(
status
).
results
(
results
).
attime
(
xbdk1
).
bcid
(
banci
.
getId
()).
sort
(
2
).
build
().
updateById
();
KqglAssoDkjl
maxdata
=
KqglAssoDkjl
.
builder
().
id
(
maxAttid
.
getId
()).
build
().
selectById
();
Long
woktimes
=
(
maxdata
.
getDktime
()
-
mindataone
.
getDktime
())/
1000
/
60
;
KqglAssoDkmx
.
builder
().
id
(
dkmxid
).
xbdk1
(
maxdata
.
getDktime
()).
xbdk1jg
(
maxdata
.
getResults
()).
gzsc
(
Double
.
valueOf
(
woktimes
)).
build
().
updateById
();
}
}
}
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
=
punchrecordmapper
.
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
punchrecordmapper
.
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
}
PunchRecord
maxdata
=
punchrecordmapper
.
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
punchrecordmapper
.
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
}
}
//修改打卡明细
PunchRecord
mindata
=
punchrecordmapper
.
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
=
punchrecordmapper
.
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
));
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
mindataone
=
punchrecordmapper
.
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"
));
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordmapper
.
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordmapper
.
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordmapper
.
selectByPrimaryKey
(
maxAttid
.
getId
());
//单条打卡明细
pcd
.
setXbdk2
(
dtdkmx
.
getDktime
());
pcd
.
setXbdk2jg
(
dtdkmx
.
getResults
());
}
pcd
.
setId
(
dkmxid
);
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
=
punchrecordmapper
.
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
punchrecordmapper
.
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
}
PunchRecord
maxdata
=
punchrecordmapper
.
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
punchrecordmapper
.
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
}
}
//修改打卡明细
PunchRecord
mindata
=
punchrecordmapper
.
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
=
punchrecordmapper
.
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
));
punchcarddetailsservice
.
updateByPrimaryKeySelective
(
dkmx
);
}
}
else
{
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
mindataone
=
punchrecordmapper
.
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"
));
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordmapper
.
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordmapper
.
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordmapper
.
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordmapper
.
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
punchrecordmapper
.
updateByPrimaryKeySelective
(
record
);
PunchRecord
dtdkmx
=
punchrecordmapper
.
selectByPrimaryKey
(
maxAttid
.
getId
());
//单条打卡明细
pcd
.
setXbdk3
(
dtdkmx
.
getDktime
());
pcd
.
setXbdk3jg
(
dtdkmx
.
getResults
());
}
pcd
.
setId
(
dkmxid
);
punchcarddetailsservice
.
updateByPrimaryKeySelective
(
pcd
);
}
}
}
else
{
////修改后班次为休息的
RestMethod
(
mapucalist
,
dkmxid
);
}
}
}
}
if
(
schlist
.
size
()>
0
){
//删除排班明细表(自由排班)
KqglAssoPbmx
.
builder
().
build
().
delete
(
new
QueryWrapper
<
KqglAssoPbmx
>().
lambda
().
eq
(
KqglAssoPbmx:
:
getKqzid
,
id
));
kqglassopbmxmapper
.
insertKqglAssoPbmxList
(
schlist
);
return
ResultUtil
.
data
(
schlist
,
"修改考勤组排班成功"
);
}
return
ResultUtil
.
error
(
"修改考勤组排班失败"
);
}
/**
* 班次修改调用方法
*/
public
void
RestMethod
(
List
<
KqglAssoDkjl
>
mapucalist
,
int
dkmxid
){
int
q
=
1
;
for
(
KqglAssoDkjl
pres
:
mapucalist
){
int
type
=
0
;
if
(
q
%
2
>
0
){
type
=
1
;}
else
{
type
=
2
;}
KqglAssoDkjl
.
builder
().
id
(
pres
.
getId
()).
results
(
0
).
type
(
type
).
status
(
1
).
sort
(
q
).
attime
(
pres
.
getDktime
()).
bcid
(
0
).
build
().
updateById
();
q
++;
}
if
(
mapucalist
.
size
()
>
0
){
/*******修改打卡明细数据****/
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
build
();
if
(
mapucalist
.
size
()
>=
1
){
pcd
.
setSbdk1
(
mapucalist
.
get
(
0
).
getDktime
());
pcd
.
setSbdk1jg
(
0
);}
if
(
mapucalist
.
size
()
>=
2
){
pcd
.
setXbdk1
(
mapucalist
.
get
(
1
).
getDktime
());
pcd
.
setXbdk1jg
(
0
);}
if
(
mapucalist
.
size
()
>=
3
){
pcd
.
setSbdk2
(
mapucalist
.
get
(
2
).
getDktime
());
pcd
.
setSbdk2jg
(
0
);}
if
(
mapucalist
.
size
()
>=
4
){
pcd
.
setXbdk2
(
mapucalist
.
get
(
3
).
getDktime
());
pcd
.
setXbdk2jg
(
0
);}
if
(
mapucalist
.
size
()
>=
5
){
pcd
.
setSbdk3
(
mapucalist
.
get
(
4
).
getDktime
());
pcd
.
setSbdk3jg
(
0
);}
if
(
mapucalist
.
size
()
>=
6
){
pcd
.
setXbdk3
(
mapucalist
.
get
(
5
).
getDktime
());
pcd
.
setXbdk3jg
(
0
);}
pcd
.
setId
(
dkmxid
);
pcd
.
updateById
();
}
}
@PostMapping
(
value
=
"/leave_balance_list"
)
...
...
@@ -2531,13 +1886,28 @@ public class TimeCardController {
int
type
=
0
;
//0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休
//9:管理员改为正常 10:管理员改为迟到 11:管理员改为早退 12:补卡通过/正常 13:补卡通过/迟到 14:补卡通过/早退
int
status
=
2
;
if
((
chpunchr
.
getClocktype
())%
2
>
0
){
type
=
1
;
if
(
results
==
0
)
{
status
=
9
;
}
else
{
status
=
10
;
}
}
else
{
type
=
2
;
if
(
results
==
0
)
{
status
=
9
;
}
else
{
status
=
11
;
}
}
KqglAssoDkjl
pre
=
KqglAssoDkjl
.
builder
().
dktime
(
changed_time
).
results
(
results
).
userId
(
chpunchr
.
getNum
()).
type
(
type
).
status
(
9
).
sort
(
chpunchr
.
getClocktype
())
KqglAssoDkjl
pre
=
KqglAssoDkjl
.
builder
().
dktime
(
changed_time
).
results
(
results
).
userId
(
chpunchr
.
getNum
()).
type
(
type
).
status
(
status
).
sort
(
chpunchr
.
getClocktype
())
.
cardType
(
0
).
qyid
(
userBean
.
getOrgCode
()).
attdate
(
attdate_
+
" "
+
ClockInTool
.
dateToWeek2
(
data
)).
attime
(
clock_time_
).
dkmxid
(
dkmxid
).
bcid
(
chpunchr
.
getBcszid
()).
remarks
(
"管理员更改操作"
).
punchmode
(
0
)
.
punchequipment
(
""
).
build
();
if
(!
pre
.
insert
())
{
...
...
@@ -2776,11 +2146,11 @@ public class TimeCardController {
}
}
else
if
(
attgro
.
getPbfs
()
==
2
){
//自由排班
//未排班时,员工可选择班次打卡
if
(
attgro
.
getIsXzbcdk
()
==
1
){
attcar
.
setOptscheduling
(
true
);
}
else
{
attcar
.
setOptscheduling
(
false
);
}
//
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
()));
...
...
@@ -2986,6 +2356,7 @@ public class TimeCardController {
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
//设置日期格式
String
current
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
());
String
yue
=
new
SimpleDateFormat
(
"yyyy-MM"
).
format
(
new
Date
());
Long
startMonth
=
0
l
;
Long
endMonth
=
0
l
;
...
...
@@ -2996,19 +2367,29 @@ public class TimeCardController {
String
first
=
mat
.
format
(
c
.
getTime
());
startMonth
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
first
,
"yyyy-MM-dd"
)).
getTime
();
//获取当前月最后一天
Calendar
ca
=
Calendar
.
getInstance
();
ca
.
set
(
Calendar
.
DAY_OF_MONTH
,
ca
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
));
String
last
=
mat
.
format
(
ca
.
getTime
());
endMonth
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
last
,
"yyyy-MM-dd"
)).
getTime
();
endMonth
=
new
Date
().
getTime
();
// //获取当前月最后一天
// Calendar ca = Calendar.getInstance();
// ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
// String last = mat.format(ca.getTime());
// endMonth = DateUtil.getnowEndTime(23,DateUtil.getStringTime(last,"yyyy-MM-dd")).getTime();
}
else
{
String
time
=
date
+
"-01"
;
String
sdaet
=
ClockInTool
.
getMinMonthDate
(
time
);
startMonth
=
ClockInTool
.
getStartTime
(
0
,
ClockInTool
.
getStringTime
(
sdaet
,
"yyyy-MM-dd"
)).
getTime
();
String
edate
=
ClockInTool
.
getMaxMonthDate
(
time
);
endMonth
=
ClockInTool
.
getnowEndTime
(
23
,
ClockInTool
.
getStringTime
(
edate
,
"yyyy-MM-dd"
)).
getTime
();
if
(
date
.
equals
(
yue
))
{
endMonth
=
new
Date
().
getTime
();
}
}
String
[]
rangeArray
=
ClockInTool
.
listToString
(
ClockInTool
.
getDays
(
df
.
format
(
startMonth
),
df
.
format
(
endMonth
))).
split
(
";"
);
//目前为止所有日期
String
[]
range
=
rangeArray
[
0
].
split
(
","
);
KqglMainKqz
attgro
=
kqglmainkqzmapper
.
getAttendanceGroupInformationByUserid
(
userBean
.
getEmpNum
(),
userBean
.
getOrgCode
());
//考勤组信息
...
...
@@ -3028,9 +2409,22 @@ public class TimeCardController {
if
(
EmptyUtil
.
isNotEmpty
(
attdate
.
getAttsch
()))
{
//班次不为空
if
(
date
==
null
||
(
""
).
equals
(
date
))
{
//未输入 当月
if
(
current
.
equals
(
num
))
{
bcid
=
ashss
.
get
(
0
).
getId
();
//班次id
}
}
else
{
//输入
if
(
date
.
equals
(
yue
))
{
//输入为当月
if
(
current
.
equals
(
num
))
{
bcid
=
ashss
.
get
(
0
).
getId
();
//班次id
}
}
else
{
//输入不是当月
String
time
=
date
+
"-01"
;
if
(
time
.
equals
(
num
))
{
bcid
=
ashss
.
get
(
0
).
getId
();
//班次id
}
}
}
if
(
ashss
.
get
(
0
).
getId
()
!=
0
)
{
KqglAssoDkmx
dkmc
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
userBean
.
getEmpNum
()).
eq
(
KqglAssoDkmx:
:
getQyid
,
userBean
.
getOrgCode
())
...
...
@@ -3082,16 +2476,38 @@ public class TimeCardController {
List
<
CalendarPunchDetailsDto
>
detailed
=
new
ArrayList
<
CalendarPunchDetailsDto
>();
CalendarPunchDetailsDto
dets
=
CalendarPunchDetailsDto
.
builder
().
build
();
dets
.
setDate
(
current
);
//
dets.setDate(current);
// detailed.add(dets1);
Long
starttime
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
current
,
"yyyy-MM-dd"
)).
getTime
();
Long
endtime
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
current
,
"yyyy-MM-dd"
)).
getTime
();
KqglAssoDkmx
dkmc
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
userBean
.
getEmpNum
()).
eq
(
KqglAssoDkmx:
:
getQyid
,
userBean
.
getOrgCode
())
KqglAssoDkmx
dkmc
=
KqglAssoDkmx
.
builder
().
build
();
if
(
date
==
null
||
(
""
).
equals
(
date
))
{
//未输入 当月
dkmc
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
userBean
.
getEmpNum
()).
eq
(
KqglAssoDkmx:
:
getQyid
,
userBean
.
getOrgCode
())
.
ge
(
KqglAssoDkmx:
:
getDksj
,
starttime
).
le
(
KqglAssoDkmx:
:
getDksj
,
endtime
));
dets
.
setDate
(
current
);
}
else
{
//输入
if
(
date
.
equals
(
yue
))
{
//输入为当月
dkmc
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
userBean
.
getEmpNum
()).
eq
(
KqglAssoDkmx:
:
getQyid
,
userBean
.
getOrgCode
())
.
ge
(
KqglAssoDkmx:
:
getDksj
,
starttime
).
le
(
KqglAssoDkmx:
:
getDksj
,
endtime
));
dets
.
setDate
(
current
);
}
else
{
//输入不是当月
String
time
=
date
+
"-01"
;
Long
starttime_
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
time
,
"yyyy-MM-dd"
)).
getTime
();
Long
endtime_
=
DateUtil
.
getnowEndTime
(
23
,
DateUtil
.
getStringTime
(
time
,
"yyyy-MM-dd"
)).
getTime
();
if
(
dkmc
!=
null
)
{
dets
.
setDate
(
time
);
dkmc
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
userBean
.
getEmpNum
()).
eq
(
KqglAssoDkmx:
:
getQyid
,
userBean
.
getOrgCode
())
.
ge
(
KqglAssoDkmx:
:
getDksj
,
starttime_
).
le
(
KqglAssoDkmx:
:
getDksj
,
endtime_
));
}
}
// KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum()).eq(KqglAssoDkmx::getQyid, userBean.getOrgCode())
// .ge(KqglAssoDkmx::getDksj, starttime).le(KqglAssoDkmx::getDksj, endtime));
if
(
dkmc
!=
null
&&
dkmc
.
getData
()
!=
null
)
{
// CalendarPunchDetailsDto dets = CalendarPunchDetailsDto.builder().build();
dets
.
setSbdksj1
(
dkmc
.
getSbdk1
()
==
null
?
""
:
ClockInTool
.
stampToDate3
(
String
.
valueOf
(
dkmc
.
getSbdk1
())));
dets
.
setSbdksj1jg
(
dkmc
.
getSbdk1jg
());
...
...
src/main/java/cn/timer/api/controller/kqgl/service/KqglServiceImpl.java
View file @
b0a6cafe
...
...
@@ -716,10 +716,26 @@ public class KqglServiceImpl implements KqglService {
dkmxid
=
pcd
.
getId
();
}
//0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休
//9:管理员改为正常 10:管理员改为迟到 11:管理员改为早退 12:补卡通过/正常 13:补卡通过/迟到 14:补卡通过/早退
int
status
=
2
;
if
((
atttype
)%
2
>
0
){
type
=
1
;
if
(
results
==
0
)
{
status
=
12
;
}
else
{
status
=
13
;
}
}
else
{
type
=
2
;
if
(
results
==
0
)
{
status
=
12
;
}
else
{
status
=
14
;
}
}
Long
startDate
=
DateUtil
.
getStartTime
(
0
,
DateUtil
.
getStringTime
(
cardrepltime
,
"yyyy-MM-dd"
)).
getTime
();
...
...
@@ -727,7 +743,7 @@ public class KqglServiceImpl implements KqglService {
//attime 应打卡时间
KqglAssoDkjl
pre
=
KqglAssoDkjl
.
builder
().
dktime
(
repaappr
.
getCardrepltime
()).
results
(
results
).
userId
(
repaappr
.
getUserid
()).
type
(
type
).
status
(
5
).
sort
(
atttype
)
KqglAssoDkjl
pre
=
KqglAssoDkjl
.
builder
().
dktime
(
repaappr
.
getCardrepltime
()).
results
(
results
).
userId
(
repaappr
.
getUserid
()).
type
(
type
).
status
(
status
).
sort
(
atttype
)
.
cardType
(
0
).
qyid
(
repaappr
.
getOrgcode
()).
attdate
(
attdate_
+
" "
+
ClockInTool
.
dateToWeek2
(
cardrepltime
)).
attime
(
attime
).
dkmxid
(
dkmxid
).
bcid
(
shifid
).
remarks
(
"审批补卡通过打卡"
).
punchmode
(
0
)
.
punchequipment
(
""
).
commentary
(
"成功打卡"
).
build
();
...
...
src/main/java/cn/timer/api/dao/kqmk/KqglAssoDkjlMapper.java
View file @
b0a6cafe
package
cn
.
timer
.
api
.
dao
.
kqmk
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
java.util.List
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.timer.api.bean.kqmk.KqglAssoDkjl
;
/**
...
...
@@ -12,5 +15,5 @@ import cn.timer.api.bean.kqmk.KqglAssoDkjl;
*/
@Repository
public
interface
KqglAssoDkjlMapper
extends
BaseMapper
<
KqglAssoDkjl
>
{
List
<
KqglAssoDkjl
>
getDetailedRecordClock
(
Long
start
,
Long
end
,
Integer
userId
);
}
src/main/java/cn/timer/api/dto/kqmk/AttendanceCardListDto.java
View file @
b0a6cafe
...
...
@@ -3,6 +3,8 @@ package cn.timer.api.dto.kqmk;
import
java.io.Serializable
;
import
java.util.List
;
import
cn.timer.api.bean.kqmk.KqglAssoDkjl
;
import
cn.timer.api.bean.kqmk.KqglAssoDkjl.KqglAssoDkjlBuilder
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
...
...
@@ -21,9 +23,9 @@ public class AttendanceCardListDto implements Serializable {
private
boolean
attaddress
;
// 考勤地址
private
boolean
attwifi
;
// 考勤WIFI
private
List
<
AttClockMethod
>
machine
;
// 详细打卡方式
private
List
<
PunchRecord
>
attpr
;
// 打卡记录
private
List
<
KqglAssoDkjl
>
attpr
;
// 打卡记录
private
boolean
optscheduling
;
// 未排班时,员工可选择班次打卡
//
private boolean optscheduling;// 未排班时,员工可选择班次打卡
private
boolean
fieldpersonnel
;
// 外勤 true:开 false:关
...
...
@@ -37,8 +39,9 @@ public class AttendanceCardListDto implements Serializable {
private
boolean
islatelate
;
// 晚走晚到
private
List
<
AttLateLate
>
attlat
;
// 晚走晚到时间
private
String
latetime
;
// 前一天晚走小时****
private
double
latetime
;
// 前天晚走时长(分钟)
private
Long
changed_time
;
// 根据班次规则计算出的 应晚到的打卡时间
private
List
<
SystemShift
>
ssfh
;
// 无排班时获取的系统班次
//
private List<SystemShift> ssfh;// 无排班时获取的系统班次
private
Integer
attgrouptype
;
// 1:固定排班;2:自由排班;3:自由工时
}
src/main/resources/mapping/kqmk/KqglAssoDkjlMapper.xml
View file @
b0a6cafe
...
...
@@ -78,6 +78,13 @@
commentary KqglAssoDkjl_explain
</sql>
<select
id=
"getDetailedRecordClock"
resultMap=
"BaseResultMap"
>
select * from kqgl_asso_dkjl dkjl
where dkjl.attime
>
= #{start}
and dkjl.attime
<
= #{end}
and dkjl.user_id = #{userId,jdbcType=INTEGER}
and dkjl.status != 0
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkjl">
...
...
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