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
e713e8c0
Commit
e713e8c0
authored
Sep 04, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 'master'
Develop See merge request 8timerv2/8timerapiv200!481
parents
c82b1690
657b5d72
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
732 additions
and
641 deletions
+732
-641
src/main/java/cn/timer/api/bean/crm/CrmClientData.java
+5
-0
src/main/java/cn/timer/api/controller/crm/CrmController.java
+46
-17
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
+677
-624
src/main/java/cn/timer/api/controller/spmk/SpmkController.java
+4
-0
No files found.
src/main/java/cn/timer/api/bean/crm/CrmClientData.java
View file @
e713e8c0
...
@@ -164,6 +164,11 @@ public class CrmClientData extends Model<CrmClientData> {
...
@@ -164,6 +164,11 @@ public class CrmClientData extends Model<CrmClientData> {
@Transient
@Transient
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"协作(0:否 1:是)"
)
private
Integer
iscooperation
;
@Transient
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"协作人id"
)
@ApiModelProperty
(
value
=
"协作人id"
)
private
Integer
[]
ids
;
private
Integer
[]
ids
;
...
...
src/main/java/cn/timer/api/controller/crm/CrmController.java
View file @
e713e8c0
...
@@ -28,6 +28,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
...
@@ -28,6 +28,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import
com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper
;
import
com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
...
@@ -54,6 +55,7 @@ import cn.timer.api.dao.crm.CrmClientDataMapper;
...
@@ -54,6 +55,7 @@ import cn.timer.api.dao.crm.CrmClientDataMapper;
import
cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper
;
import
cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper
;
import
cn.timer.api.dto.crm.CrmCartogramDto
;
import
cn.timer.api.dto.crm.CrmCartogramDto
;
import
cn.timer.api.dto.crm.CrmClientDataImportVo
;
import
cn.timer.api.dto.crm.CrmClientDataImportVo
;
import
cn.timer.api.dto.kqmk.DailyDetailsDto
;
import
cn.timer.api.utils.CheckUtil
;
import
cn.timer.api.utils.CheckUtil
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.ResultUtil
;
import
cn.timer.api.utils.ResultUtil
;
...
@@ -376,7 +378,7 @@ public class CrmController {
...
@@ -376,7 +378,7 @@ public class CrmController {
public
Result
<
Object
>
addClient
(
@CurrentUser
UserBean
userBean
,
@RequestBody
CrmClientData
crmClientData
)
{
public
Result
<
Object
>
addClient
(
@CurrentUser
UserBean
userBean
,
@RequestBody
CrmClientData
crmClientData
)
{
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
crmClientData
.
setClientStatus
(
0
);
crmClientData
.
setClientStatus
(
1
);
crmClientData
.
setCreateUser
(
empNum
);
crmClientData
.
setCreateUser
(
empNum
);
SysRegion
district
=
getSysRegion
(
crmClientData
.
getDistrictId
());
SysRegion
district
=
getSysRegion
(
crmClientData
.
getDistrictId
());
// crmClientData.setZipCode(district.getZipCode());
// crmClientData.setZipCode(district.getZipCode());
...
@@ -516,8 +518,9 @@ public class CrmController {
...
@@ -516,8 +518,9 @@ public class CrmController {
.
eq
(
status
!=
null
&&
status
>
0
,
CrmClientData:
:
getClientStatus
,
status
).
eq
(
typei
!=
null
&&
typei
>
0
,
CrmClientData:
:
getClientType
,
typei
)
.
eq
(
status
!=
null
&&
status
>
0
,
CrmClientData:
:
getClientStatus
,
status
).
eq
(
typei
!=
null
&&
typei
>
0
,
CrmClientData:
:
getClientType
,
typei
)
.
ge
(
StringUtils
.
isNotBlank
(
startCreateTime
),
CrmClientData:
:
getCreateTime
,
startCreateTime
)
.
ge
(
StringUtils
.
isNotBlank
(
startCreateTime
),
CrmClientData:
:
getCreateTime
,
startCreateTime
)
.
le
(
StringUtils
.
isNotBlank
(
endCreateTime
),
CrmClientData:
:
getCreateTime
,
endCreateTime
)
.
le
(
StringUtils
.
isNotBlank
(
endCreateTime
),
CrmClientData:
:
getCreateTime
,
endCreateTime
)
.
ge
(
StringUtils
.
isNotBlank
(
startFollowTime
),
CrmClientData:
:
getCreateTime
,
startFollowTime
)
.
le
(
StringUtils
.
isNotBlank
(
endFollowTime
),
CrmClientData:
:
getCreateTime
,
endFollowTime
).
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getBelongUserName
,
like
).
or
()
.
ge
(
StringUtils
.
isNotBlank
(
startFollowTime
),
CrmClientData:
:
getLastFollowTime
,
startFollowTime
)
.
le
(
StringUtils
.
isNotBlank
(
endFollowTime
),
CrmClientData:
:
getLastFollowTime
,
endFollowTime
).
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getBelongUserName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
)
.
orderByDesc
(
CrmClientData:
:
getCreateTime
));
.
orderByDesc
(
CrmClientData:
:
getCreateTime
));
...
@@ -525,7 +528,7 @@ public class CrmController {
...
@@ -525,7 +528,7 @@ public class CrmController {
// 我协作的客户
// 我协作的客户
private
List
<
CrmClientData
>
getMyAssociateCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
private
List
<
CrmClientData
>
getMyAssociateCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
String
like
)
{
String
like
,
Integer
typei
,
String
startFollowTime
,
String
endFollowTime
)
{
List
<
CrmClientAssociate
>
crmClientAssociates
=
CrmClientAssociate
.
builder
().
build
().
selectList
(
List
<
CrmClientAssociate
>
crmClientAssociates
=
CrmClientAssociate
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CrmClientAssociate
>().
lambda
().
eq
(
CrmClientAssociate:
:
getAssociateId
,
empNum
)
new
QueryWrapper
<
CrmClientAssociate
>().
lambda
().
eq
(
CrmClientAssociate:
:
getAssociateId
,
empNum
)
.
eq
(
CrmClientAssociate:
:
getOrgCode
,
orgCode
).
select
(
CrmClientAssociate:
:
getCid
));
.
eq
(
CrmClientAssociate:
:
getOrgCode
,
orgCode
).
select
(
CrmClientAssociate:
:
getCid
));
...
@@ -534,8 +537,11 @@ public class CrmController {
...
@@ -534,8 +537,11 @@ public class CrmController {
Integer
cid
=
crmClientAssociate
.
getCid
();
Integer
cid
=
crmClientAssociate
.
getCid
();
CrmClientData
crmClientData
=
CrmClientData
.
builder
().
build
()
CrmClientData
crmClientData
=
CrmClientData
.
builder
().
build
()
.
selectOne
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getId
,
cid
)
.
selectOne
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getId
,
cid
)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
groupId
!=
null
&&
groupId
>
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
)
.
eq
(
status
!=
null
&&
status
>
0
,
CrmClientData:
:
getClientStatus
,
status
).
eq
(
typei
!=
null
&&
typei
>
0
,
CrmClientData:
:
getClientType
,
typei
)
.
ge
(
StringUtils
.
isNotBlank
(
startFollowTime
),
CrmClientData:
:
getLastFollowTime
,
startFollowTime
)
.
le
(
StringUtils
.
isNotBlank
(
endFollowTime
),
CrmClientData:
:
getLastFollowTime
,
endFollowTime
)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
));
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
));
if
(
crmClientData
!=
null
)
if
(
crmClientData
!=
null
)
...
@@ -546,20 +552,20 @@ public class CrmController {
...
@@ -546,20 +552,20 @@ public class CrmController {
// 我的全部客户
// 我的全部客户
private
List
<
CrmClientData
>
getMyTotalCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
private
List
<
CrmClientData
>
getMyTotalCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
String
like
,
Integer
type
)
{
String
like
,
Integer
type
i
)
{
return
CheckUtil
.
distinct
(
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
null
,
null
,
null
,
null
,
null
),
return
CheckUtil
.
distinct
(
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
null
,
null
,
null
,
null
,
null
),
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
),
true
);
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
null
,
null
),
true
);
}
}
// 我关注的客户
// 我关注的客户
private
List
<
CrmClientData
>
getMyStarCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
Integer
type
)
{
private
List
<
CrmClientData
>
getMyStarCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
Integer
type
i
)
{
return
getMyTotalCilent
(
empNum
,
orgCode
,
groupId
,
status
,
null
,
null
).
stream
()
return
getMyTotalCilent
(
empNum
,
orgCode
,
groupId
,
status
,
null
,
null
).
stream
()
.
filter
(
item
->
item
.
getStar
().
equals
(
1
)).
collect
(
Collectors
.
toList
());
.
filter
(
item
->
item
.
getStar
().
equals
(
1
)).
collect
(
Collectors
.
toList
());
}
}
// 七天未跟进的客户
// 七天未跟进的客户
private
List
<
CrmClientData
>
getCilentFollowOvertime
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
private
List
<
CrmClientData
>
getCilentFollowOvertime
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
Integer
type
)
{
Integer
status
,
Integer
type
i
)
{
return
getMyTotalCilent
(
empNum
,
orgCode
,
groupId
,
status
,
null
,
null
).
stream
()
return
getMyTotalCilent
(
empNum
,
orgCode
,
groupId
,
status
,
null
,
null
).
stream
()
.
filter
(
item
->
item
.
getLastFollowTime
()
!=
null
.
filter
(
item
->
item
.
getLastFollowTime
()
!=
null
&&
item
.
getLastFollowTime
().
before
(
DateUtil
.
offsetDay
(
new
Date
(),
-
7
)))
&&
item
.
getLastFollowTime
().
before
(
DateUtil
.
offsetDay
(
new
Date
(),
-
7
)))
...
@@ -598,17 +604,17 @@ public class CrmController {
...
@@ -598,17 +604,17 @@ public class CrmController {
List
<
CrmClientData
>
crmClientDatas
=
null
;
List
<
CrmClientData
>
crmClientDatas
=
null
;
if
(
type
==
null
||
type
==
0
)
{
// 全部客户(去重)
if
(
type
==
null
||
type
==
0
)
{
// 全部客户(去重)
List
<
CrmClientData
>
myClient
=
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
typei
);
List
<
CrmClientData
>
myClient
=
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
typei
);
List
<
CrmClientData
>
myAsso
=
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
);
List
<
CrmClientData
>
myAsso
=
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
startFollowTime
,
endFollowTime
);
crmClientDatas
=
CheckUtil
.
distinct
(
myClient
,
myAsso
,
true
).
stream
()
crmClientDatas
=
CheckUtil
.
distinct
(
myClient
,
myAsso
,
true
).
stream
()
.
filter
(
CheckUtil
.
distinctByKey
(
CrmClientData:
:
getId
)).
collect
(
Collectors
.
toList
());
.
filter
(
CheckUtil
.
distinctByKey
(
CrmClientData:
:
getId
)).
collect
(
Collectors
.
toList
());
}
else
if
(
type
==
1
)
// 我负责的客户
}
else
if
(
type
==
1
)
// 我负责的客户
crmClientDatas
=
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
type
);
crmClientDatas
=
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
type
);
else
if
(
type
==
2
)
// 我协作的客户
else
if
(
type
==
2
)
// 我协作的客户
crmClientDatas
=
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
);
crmClientDatas
=
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
startFollowTime
,
endFollowTime
);
else
if
(
type
==
3
)
// 我关注的客户
else
if
(
type
==
3
)
// 我关注的客户
crmClientDatas
=
getMyStarCilent
(
empNum
,
orgCode
,
groupId
,
status
,
type
);
crmClientDatas
=
getMyStarCilent
(
empNum
,
orgCode
,
groupId
,
status
,
type
i
);
else
if
(
type
==
4
)
// 七天未跟进的客户
else
if
(
type
==
4
)
// 七天未跟进的客户
crmClientDatas
=
getCilentFollowOvertime
(
empNum
,
orgCode
,
groupId
,
status
,
type
);
crmClientDatas
=
getCilentFollowOvertime
(
empNum
,
orgCode
,
groupId
,
status
,
type
i
);
else
else
return
ResultUtil
.
error
(
"查询失败"
);
return
ResultUtil
.
error
(
"查询失败"
);
// Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序
// Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序
...
@@ -618,8 +624,31 @@ public class CrmController {
...
@@ -618,8 +624,31 @@ public class CrmController {
List
<
CrmClientData
>
result
=
getPageList
(
crmClientDatas
,
pageNumber
,
pageSize
,
List
<
CrmClientData
>
result
=
getPageList
(
crmClientDatas
,
pageNumber
,
pageSize
,
Comparator
.
comparing
(
CrmClientData:
:
getCreateTime
).
reversed
());
Comparator
.
comparing
(
CrmClientData:
:
getCreateTime
).
reversed
());
return
ResultUtil
.
pageData
(
result
,
(
long
)
crmClientDatas
.
size
(),
"查询成功"
);
List
<
CrmClientData
>
resultlist
=
new
ArrayList
<
CrmClientData
>();
for
(
CrmClientData
crmd
:
result
)
{
CrmClientData
crmdts
=
CrmClientData
.
builder
().
build
();
BeanUtil
.
copyProperties
(
crmd
,
crmdts
,
"iscooperation"
);
List
<
CrmClientAssociate
>
crmClientAssociates
=
CrmClientAssociate
.
builder
().
build
()
.
selectList
(
new
QueryWrapper
<
CrmClientAssociate
>().
lambda
().
eq
(
CrmClientAssociate:
:
getCid
,
crmd
.
getId
()));
if
(
crmClientAssociates
.
size
()
>
0
)
{
for
(
CrmClientAssociate
crmClientAssociate
:
crmClientAssociates
)
{
Integer
empNum1
=
crmClientAssociate
.
getAssociateId
();
if
(
userBean
.
getEmpNum
().
equals
(
empNum1
))
{
crmdts
.
setIscooperation
(
1
);
}
else
{
crmdts
.
setIscooperation
(
0
);
}
}
}
else
{
crmdts
.
setIscooperation
(
0
);
}
resultlist
.
add
(
crmdts
);
}
return
ResultUtil
.
pageData
(
resultlist
,
(
long
)
crmClientDatas
.
size
(),
"查询成功"
);
// return ResultUtil.data(crmClientDatas, "查询成功");
// return ResultUtil.data(crmClientDatas, "查询成功");
}
}
...
@@ -828,7 +857,7 @@ public class CrmController {
...
@@ -828,7 +857,7 @@ public class CrmController {
@RequestBody
CrmClientContacts
crmClientContacts
)
{
@RequestBody
CrmClientContacts
crmClientContacts
)
{
Integer
cid
=
crmClientContacts
.
getCid
();
Integer
cid
=
crmClientContacts
.
getCid
();
if
(
crmClientContacts
.
getId
()
==
null
)
{
if
(
crmClientContacts
.
getId
()
==
null
||
crmClientContacts
.
getId
().
equals
(
0
)
)
{
if
(
cid
==
null
)
if
(
cid
==
null
)
return
ResultUtil
.
error
(
"编辑失败,请传入客户id"
);
return
ResultUtil
.
error
(
"编辑失败,请传入客户id"
);
...
...
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
View file @
e713e8c0
...
@@ -281,8 +281,9 @@ public class ClockInController {
...
@@ -281,8 +281,9 @@ public class ClockInController {
}
else
{
}
else
{
long
starttime1
=
0
,
starttime1ks
=
0
,
starttime1js
=
0
,
endtime1
=
0
,
endtime1ks
=
0
,
endtime1js
=
0
,
starttime2
=
0
,
starttime2ks
=
0
,
starttime2js
=
0
,
endtime2
=
0
,
endtime2ks
=
0
,
endtime2js
=
0
,
starttime3
=
0
,
starttime3ks
=
0
,
starttime3js
=
0
,
long
starttime1
=
0
,
starttime1ks
=
0
,
starttime1js
=
0
,
endtime1
=
0
,
endtime1ks
=
0
,
endtime1js
=
0
,
starttime2
=
0
,
starttime2ks
=
0
,
starttime2js
=
0
,
endtime2
=
0
,
endtime2ks
=
0
,
endtime2js
=
0
,
starttime3
=
0
,
starttime3ks
=
0
,
starttime3js
=
0
,
endtime3
=
0
,
endtime3ks
=
0
,
endtime3js
=
0
;
endtime3
=
0
,
endtime3ks
=
0
,
endtime3js
=
0
;
List
<
AttSchedule
>
ash
=
null
;
if
(
attdate
.
getAttsch
().
size
()
>
0
)
{
if
(
attdate
.
getAttsch
().
size
()
>
0
)
{
List
<
AttSchedule
>
ash
=
attdate
.
getAttsch
();
ash
=
attdate
.
getAttsch
();
int
y
=
0
;
int
y
=
0
;
clockt
.
setShifid
(
ash
.
get
(
y
).
getId
());
clockt
.
setShifid
(
ash
.
get
(
y
).
getId
());
shifid
=
ash
.
get
(
y
).
getId
();
//班次id
shifid
=
ash
.
get
(
y
).
getId
();
//班次id
...
@@ -536,346 +537,372 @@ public class ClockInController {
...
@@ -536,346 +537,372 @@ public class ClockInController {
if
(
clockt
.
getShifid
()
!=
0
)
{
if
(
clockt
.
getShifid
()
!=
0
)
{
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
boolean
dddbdk
=
true
;
//
if
(
attdate
.
getAttsch
().
size
()
>
0
&&
clockt
.
getShifid
()
>
0
){
//有无班次
boolean
dak2
=
true
;
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
clockt
.
getShifid
()));
//打卡无限制时 当前时间必须大于上班打卡时间 才能打下班卡
if
(
punchstart
==
0
&&
punchend
==
0
&&
(
atttype
==
2
||
atttype
==
4
||
atttype
==
6
))
{
String
xbdk
=
""
;
if
(
atttype
==
2
)
{
xbdk
=
String
.
valueOf
(
ash
.
get
(
0
).
getTime
());
}
else
if
(
atttype
==
4
){
xbdk
=
String
.
valueOf
(
ash
.
get
(
2
).
getTime
());
}
else
{
xbdk
=
String
.
valueOf
(
ash
.
get
(
4
).
getTime
());
}
Date
sd1
=
df1
.
parse
(
ClockInTool
.
stampToDate
(
String
.
valueOf
(
xbdk
)));
//当天应打的首次上班卡时间
Date
sd2
=
df1
.
parse
(
current_time
);
//当前时间
if
(
sd2
.
before
(
sd1
))
{
//小于
dak2
=
false
;
}
}
}
//打卡记录录入 -- 打卡是否有时间范围限制
if
(!
dak2
)
{
dddbdk
=
false
;
}
if
(
attdate
.
getAttsch
().
size
()
==
2
)
{
if
(
punchstart
>
0
&&
punchend
>
0
)
{
if
(
dddbdk
)
{
String
staputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
punchstart
);
//应打卡开始时间
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
String
entputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
punchend
);
//应打卡结束时间
if
(
attdate
.
getAttsch
().
size
()
>
0
&&
clockt
.
getShifid
()
>
0
){
//有无班次
String
DKputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
);
//打卡时间
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
clockt
.
getShifid
()));
boolean
effectiveDate
=
ClockInTool
.
hourMinuteBetween
(
DKputime
,
staputime
,
entputime
,
"yyyy-MM-dd HH:mm"
);
}
if
(!
effectiveDate
)
{
//打卡记录录入 -- 打卡是否有时间范围限制
System
.
out
.
println
(
"当前打卡时间不在范围内"
);
if
(
attdate
.
getAttsch
().
size
()
==
2
)
{
// 手动抛出异常
if
(
punchstart
>
0
&&
punchend
>
0
)
{
isRange
=
false
;
String
staputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
punchstart
);
//应打卡开始时间
// throw new Exception();
String
entputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
punchend
);
//应打卡结束时间
String
DKputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
);
//打卡时间
boolean
effectiveDate
=
ClockInTool
.
hourMinuteBetween
(
DKputime
,
staputime
,
entputime
,
"yyyy-MM-dd HH:mm"
);
if
(!
effectiveDate
)
{
System
.
out
.
println
(
"当前打卡时间不在范围内"
);
// 手动抛出异常
isRange
=
false
;
// throw new Exception();
}
}
}
}
}
}
if
(
isRange
)
{
if
(
isRange
)
{
int
yxcd
=
shif
.
getYxcdfzs
();
//允许迟到
int
yxcd
=
shif
.
getYxcdfzs
();
//允许迟到
int
yzcd
=
shif
.
getYzcdfzs
();
//严重迟到分钟数
int
yzcd
=
shif
.
getYzcdfzs
();
//严重迟到分钟数
int
kgcdfzs
=
shif
.
getKgcdfzs
();
//旷工迟到分钟数
int
kgcdfzs
=
shif
.
getKgcdfzs
();
//旷工迟到分钟数
int
dkcs_
=
shif
.
getSxbcs
();
//上下班打卡次数
int
dkcs_
=
shif
.
getSxbcs
();
//上下班打卡次数
int
iswzwd
=
shif
.
getIsWzwd
();
//是否开启晚走晚到(0:否;1:是)
int
iswzwd
=
shif
.
getIsWzwd
();
//是否开启晚走晚到(0:否;1:是)
long
rest_time
=
0
;
if
(
shif
.
getStartTime
()
!=
null
&&
shif
.
getEndTime
()
!=
null
)
{
long
kaishixiuxi
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
putime
+
" "
+
shif
.
getStartTime
()+
":00"
));
long
jieshuxiuxi
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
putime
+
" "
+
shif
.
getEndTime
()+
":00"
));
rest_time
=
(
jieshuxiuxi
-
kaishixiuxi
)/
1000
/
60
;
//休息时间
}
double
xbwz1
=
0
,
xbwz2
=
0
,
xbwz3
=
0
;
int
sbwd1
=
0
,
sbwd2
=
0
,
sbwd3
=
0
;
int
arrive_late
=
0
;
//晚到时间
String
clock_date
=
""
;
//应打卡时间
Long
latetime
=
0
l
;
//前天晚走时长(分钟)
KqglAssoDkmx
yesterdaymx
=
KqglAssoDkmx
.
builder
().
build
();
AttendanceCardListDto
attdateyesterday
;
long
yesendtime1
=
0
,
yesendtime2
=
0
,
yesendtime3
=
0
;
//存在晚走玩到
if
(
iswzwd
>
0
)
{
//统一分钟数
xbwz1
=
Double
.
valueOf
(
shif
.
getXbwz1
())
*
60
;
//下班晚走1
String
sbwd1_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd1
())
*
60
);
sbwd1
=
Integer
.
valueOf
(
sbwd1_
.
substring
(
0
,
sbwd1_
.
lastIndexOf
(
"."
)));
//上班晚到1
xbwz2
=
Double
.
valueOf
(
shif
.
getXbwz2
())
*
60
;
//下班晚走2
long
rest_time
=
0
;
String
sbwd2_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd2
())
*
60
);
if
(
shif
.
getStartTime
()
!=
null
&&
shif
.
getEndTime
()
!=
null
)
{
sbwd2
=
Integer
.
valueOf
(
sbwd2_
.
substring
(
0
,
sbwd2_
.
lastIndexOf
(
"."
)));
//上班晚到2
long
kaishixiuxi
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
putime
+
" "
+
shif
.
getStartTime
()+
":00"
));
long
jieshuxiuxi
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
putime
+
" "
+
shif
.
getEndTime
()+
":00"
));
rest_time
=
(
jieshuxiuxi
-
kaishixiuxi
)/
1000
/
60
;
//休息时间
}
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
;
//前天晚走时长(分钟)
xbwz3
=
Double
.
valueOf
(
shif
.
getXbwz3
())
*
60
;
//下班晚走3
KqglAssoDkmx
yesterdaymx
=
KqglAssoDkmx
.
builder
().
build
();
String
sbwd3_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd3
())
*
60
);
AttendanceCardListDto
attdateyesterday
;
sbwd3
=
Integer
.
valueOf
(
sbwd3_
.
substring
(
0
,
sbwd3_
.
lastIndexOf
(
"."
)));
//上班晚到3
long
yesendtime1
=
0
,
yesendtime2
=
0
,
yesendtime3
=
0
;
//存在晚走玩到
if
(
iswzwd
>
0
)
{
//统一分钟数
xbwz1
=
Double
.
valueOf
(
shif
.
getXbwz1
())
*
60
;
//下班晚走1
String
sbwd1_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd1
())
*
60
);
sbwd1
=
Integer
.
valueOf
(
sbwd1_
.
substring
(
0
,
sbwd1_
.
lastIndexOf
(
"."
)));
//上班晚到1
//获取前一天最后下班的时间
xbwz2
=
Double
.
valueOf
(
shif
.
getXbwz2
())
*
60
;
//下班晚走2
yesterdaymx
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
userid
)
String
sbwd2_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd2
())
*
60
);
.
ge
(
KqglAssoDkmx:
:
getDksj
,
startDateyesterday
).
le
(
KqglAssoDkmx:
:
getDksj
,
endDateyesterday
));
sbwd2
=
Integer
.
valueOf
(
sbwd2_
.
substring
(
0
,
sbwd2_
.
lastIndexOf
(
"."
)));
//上班晚到2
attdateyesterday
=
MethodCall
(
qyid
,
userid
,
yesterday
);
xbwz3
=
Double
.
valueOf
(
shif
.
getXbwz3
())
*
60
;
//下班晚走3
List
<
AttSchedule
>
ash
=
attdateyesterday
.
getAttsch
();
String
sbwd3_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd3
())
*
60
);
if
(
attdateyesterday
.
getAttsch
().
size
()
==
2
||
attdateyesterday
.
getAttsch
().
size
()
==
4
||
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
sbwd3
=
Integer
.
valueOf
(
sbwd3_
.
substring
(
0
,
sbwd3_
.
lastIndexOf
(
"."
)));
//上班晚到3
yesendtime1
=
ash
.
get
(
1
).
getTime
();
}
//获取前一天最后下班的时间
if
(
attdateyesterday
.
getAttsch
().
size
()
==
4
||
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesterdaymx
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
userid
)
yesendtime2
=
ash
.
get
(
3
).
getTime
();
.
ge
(
KqglAssoDkmx:
:
getDksj
,
startDateyesterday
).
le
(
KqglAssoDkmx:
:
getDksj
,
endDateyesterday
));
}
attdateyesterday
=
MethodCall
(
qyid
,
userid
,
yesterday
);
if
(
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesendtime3
=
ash
.
get
(
5
).
getTime
();
}
}
if
(
execution_status
==
1
)
{
//上班1 ****新增
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
userid
(
userid
).
data
(
putime
).
qyid
(
qyid
).
dksj
(
startDate
).
build
();
int
sbdkjg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst1
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
((
atttype
)%
2
>
0
){
//上班
if
(
time
>
0
){
sbdkjg
=
Integer
.
valueOf
(
time
.
toString
());
}
// 打卡结果
}
else
{
//下班
if
(
time
>
0
){}
else
{
sbdkjg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));
}
// 打卡结果
}
//存在晚走玩到
List
<
AttSchedule
>
ash1
=
attdateyesterday
.
getAttsch
();
if
(
iswzwd
>
0
&&
yesterdaymx
!=
null
)
{
if
(
attdateyesterday
.
getAttsch
().
size
()
==
2
||
attdateyesterday
.
getAttsch
().
size
()
==
4
||
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
if
(
dkcs_
==
1
)
{
yesendtime1
=
ash1
.
get
(
1
).
getTime
();
if
(
yesterdaymx
.
getXbdk1
()
!=
null
&&
yesterdaymx
.
getXbdk1jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk1
()
-
yesendtime1
)/
1000
/
60
;
}
}
else
if
(
dkcs_
==
2
){
if
(
yesterdaymx
.
getXbdk2
()
!=
null
&&
yesterdaymx
.
getXbdk2jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk2
()
-
yesendtime2
)/
1000
/
60
;
}
}
else
{
if
(
yesterdaymx
.
getXbdk3
()
!=
null
&&
yesterdaymx
.
getXbdk3jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk3
()
-
yesendtime3
)/
1000
/
60
;
}
}
if
(
latetime
!=
0
)
{
double
latetime_
=
Double
.
valueOf
(
String
.
valueOf
(
latetime
));
//前天晚走时长(分钟)
if
(
latetime_
>
xbwz1
&&
latetime_
<
xbwz2
)
{
arrive_late
=
sbwd1
;
}
else
if
(
latetime_
>
xbwz2
&&
latetime_
<
xbwz3
)
{
arrive_late
=
sbwd2
;
}
else
if
(
latetime_
>
xbwz3
)
{
arrive_late
=
sbwd3
;
}
clock_date
=
ClockInTool
.
stampToDate
(
String
.
valueOf
(
punchcardtime
));
Long
changed_time
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
ClockInTool
.
addtime
(
clock_date
,
"+"
+
arrive_late
)));
//晚到后应打卡时间
punchcardtime
=
changed_time
;
//更换当天打卡时间
Long
timeyes
=
(
time_
-
changed_time
)/
1000
/
60
;
//
if
((
atttype
)%
2
>
0
){
//上班
if
(
timeyes
>
0
){
sbdkjg
=
Integer
.
valueOf
(
timeyes
.
toString
());
}
else
{
sbdkjg
=
0
;
}
}
else
{
//下班
if
(
timeyes
>
0
){
sbdkjg
=
0
;
}
else
{
sbdkjg
=
Math
.
abs
(
Integer
.
valueOf
(
timeyes
.
toString
()));
}
}
}
}
}
if
(
attdateyesterday
.
getAttsch
().
size
()
==
4
||
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
}
yesendtime2
=
ash1
.
get
(
3
).
getTime
();
//允许迟到范围
}
if
(
sbdkjg
<=
yxcd
)
{
if
(
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
sbdkjg
=
0
;
yesendtime3
=
ash1
.
get
(
5
).
getTime
();
}
}
if
(
atttype
==
1
)
{
pcd
.
setSbdk1
(
time_
);
pcd
.
setSbdk1jg
(
sbdkjg
);
}
else
if
(
atttype
==
2
)
{
pcd
.
setXbdk1
(
time_
);
pcd
.
setXbdk1jg
(
sbdkjg
);
}
else
if
(
atttype
==
3
)
{
pcd
.
setSbdk2
(
time_
);
pcd
.
setSbdk2jg
(
sbdkjg
);
}
else
if
(
atttype
==
4
)
{
pcd
.
setXbdk2
(
time_
);
pcd
.
setXbdk2jg
(
sbdkjg
);
}
else
if
(
atttype
==
5
)
{
pcd
.
setSbdk3
(
time_
);
pcd
.
setSbdk3jg
(
sbdkjg
);
}
else
if
(
atttype
==
6
)
{
pcd
.
setXbdk3
(
time_
);
pcd
.
setXbdk3jg
(
sbdkjg
);
}
int
ydkcs
=
0
;
if
(
shif
!=
null
){
ydkcs
=
shif
.
getSxbcs
()*
2
;
}
//应打卡次数
pcd
.
setYdkcs
(
ydkcs
);
//严重迟到范围
if
(
sbdkjg
>
yzcd
&&
sbdkjg
<
kgcdfzs
&&
yzcd
>
0
)
{
yzcdcs
++;
yzcdsc
=
sbdkjg
;
dkst1
=
1
;
}
//旷工迟到
if
(
sbdkjg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;
dkst1
=
2
;
}
pcd
.
setDkst1
(
dkst1
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
pcd
.
setYzcdcs
(
yzcdcs
);
//严重迟到次数
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
//严重迟到时长(分钟)
pcd
.
setKgcdfzs
(
kgcdcs
);
//旷工迟到次数
if
(!
pcd
.
insert
())
{
throw
new
CustomException
(
"打卡明细-新增异常-1"
);
}
}
dkmx
=
pcd
.
getId
();
}
else
if
(
execution_status
==
2
){
//*****修改
if
(
execution_status
==
1
)
{
//上班1 ****新增
dkmx
=
dkmc
.
getId
();
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
userid
(
userid
).
data
(
putime
).
qyid
(
qyid
).
dksj
(
startDate
).
build
();
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
build
();
int
sbdkjg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst1
=
0
;
if
(
atttype
==
2
){
//下班1
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk1
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
if
((
atttype
)%
2
>
0
){
//上班
pcd
.
setXbdk1jg
(
0
);
// 打卡结果
if
(
time
>
0
){
}
else
{
sbdkjg
=
Integer
.
valueOf
(
time
.
toString
());
pcd
.
setXbdk1jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
// 打卡结果
}
else
{
//下班
if
(
time
>
0
){}
else
{
sbdkjg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));
}
// 打卡结果
}
}
//存在晚走玩到
if
(
iswzwd
>
0
&&
yesterdaymx
!=
null
)
{
if
(
dkcs_
==
1
)
{
if
(
yesterdaymx
.
getXbdk1
()
!=
null
&&
yesterdaymx
.
getXbdk1jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk1
()
-
yesendtime1
)/
1000
/
60
;
}
}
else
if
(
dkcs_
==
2
){
if
(
yesterdaymx
.
getXbdk2
()
!=
null
&&
yesterdaymx
.
getXbdk2jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk2
()
-
yesendtime2
)/
1000
/
60
;
}
}
else
{
if
(
yesterdaymx
.
getXbdk3
()
!=
null
&&
yesterdaymx
.
getXbdk3jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk3
()
-
yesendtime3
)/
1000
/
60
;
}
}
if
(
latetime
!=
0
)
{
double
latetime_
=
Double
.
valueOf
(
String
.
valueOf
(
latetime
));
//前天晚走时长(分钟)
if
(
latetime_
>
xbwz1
&&
latetime_
<
xbwz2
)
{
arrive_late
=
sbwd1
;
}
else
if
(
latetime_
>
xbwz2
&&
latetime_
<
xbwz3
)
{
arrive_late
=
sbwd2
;
}
else
if
(
latetime_
>
xbwz3
)
{
arrive_late
=
sbwd3
;
}
clock_date
=
ClockInTool
.
stampToDate
(
String
.
valueOf
(
punchcardtime
));
Long
changed_time
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
ClockInTool
.
addtime
(
clock_date
,
"+"
+
arrive_late
)));
//晚到后应打卡时间
punchcardtime
=
changed_time
;
//更换当天打卡时间
Long
timeyes
=
(
time_
-
changed_time
)/
1000
/
60
;
//
if
((
atttype
)%
2
>
0
){
//上班
if
(
timeyes
>
0
){
sbdkjg
=
Integer
.
valueOf
(
timeyes
.
toString
());
}
else
{
sbdkjg
=
0
;
}
}
else
{
//下班
if
(
timeyes
>
0
){
sbdkjg
=
0
;
}
else
{
sbdkjg
=
Math
.
abs
(
Integer
.
valueOf
(
timeyes
.
toString
()));
}
}
}
}
}
}
if
(
dkmc
.
getSbdk1
()
!=
null
){
//允许迟到范围
Long
time
=
(
time_
-
dkmc
.
getSbdk1
())/
1000
/
60
-
rest_time
;
if
(
sbdkjg
<=
yxcd
)
{
pcd
.
setGzsc
(
Math
.
abs
(
Double
.
valueOf
(
time
.
toString
())));
//只打一次卡时计算工作时长
sbdkjg
=
0
;
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
3
){
//上班2
int
sbdk2jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst2
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk2jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
}
}
//允许迟到范围
if
(
atttype
==
1
)
{
if
(
sbdk2jg
<=
yxcd
)
{
pcd
.
setSbdk1
(
time_
);
sbdk2jg
=
0
;
pcd
.
setSbdk1jg
(
sbdkjg
);
}
}
else
if
(
atttype
==
2
)
{
pcd
.
setXbdk1
(
time_
);
pcd
.
setXbdk1jg
(
sbdkjg
);
}
else
if
(
atttype
==
3
)
{
pcd
.
setSbdk2
(
time_
);
pcd
.
setSbdk2jg
(
sbdkjg
);
}
else
if
(
atttype
==
4
)
{
pcd
.
setXbdk2
(
time_
);
pcd
.
setXbdk2jg
(
sbdkjg
);
}
else
if
(
atttype
==
5
)
{
pcd
.
setSbdk3
(
time_
);
pcd
.
setSbdk3jg
(
sbdkjg
);
}
else
if
(
atttype
==
6
)
{
pcd
.
setXbdk3
(
time_
);
pcd
.
setXbdk3jg
(
sbdkjg
);
}
int
ydkcs
=
0
;
if
(
shif
!=
null
){
ydkcs
=
shif
.
getSxbcs
()*
2
;
}
//应打卡次数
pcd
.
setYdkcs
(
ydkcs
);
//严重迟到范围
//严重迟到范围
if
(
sbdk
2jg
>
yzcd
&&
sbdk2
jg
<
kgcdfzs
&&
yzcd
>
0
)
{
if
(
sbdk
jg
>
yzcd
&&
sbdk
jg
<
kgcdfzs
&&
yzcd
>
0
)
{
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
yzcdcs
++
;
yzcdsc
=
sbdk
2
jg
;
yzcdsc
=
sbdkjg
;
dkst
2
=
1
;
dkst
1
=
1
;
}
}
//旷工迟到
//旷工迟到
if
(
sbdk
2
jg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
if
(
sbdkjg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;
kgcdcs
++;
kgcdcs
=
kgcdcs
+
dkmc
.
getKgcdfzs
();
dkst1
=
2
;
dkst2
=
2
;
}
}
pcd
.
setDkst
2
(
dkst2
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
pcd
.
setDkst
1
(
dkst1
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
pcd
.
set
Id
(
dkmc
.
getId
());
pcd
.
set
Yzcdcs
(
yzcdcs
);
//严重迟到次数
pcd
.
setSbdk2
(
time_
);
//上班1打卡时间
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
//严重迟到时长(分钟)
pcd
.
set
Sbdk2jg
(
sbdk2jg
);
pcd
.
set
Kgcdfzs
(
kgcdcs
);
//旷工迟到次数
pcd
.
setYzcdcs
(
yzcdcs
);
if
(!
pcd
.
insert
())
{
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
throw
new
CustomException
(
"打卡明细-新增异常-1"
);
pcd
.
setKgcdfzs
(
kgcdcs
);
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
4
){
//下班2
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk2
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk2jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk2jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
}
//班次为4次时,计算工作时长
dkmx
=
pcd
.
getId
();
if
(
dkmc
.
getSbdk2
()
!=
null
){
}
else
if
(
execution_status
==
2
){
//*****修改
Long
time
=
(
time_
-
dkmc
.
getSbdk2
())/
1000
/
60
;
dkmx
=
dkmc
.
getId
();
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
build
();
BigDecimal
on
=
new
BigDecimal
(
time
);
if
(
atttype
==
2
){
//下班1
BigDecimal
worktime_
=
new
BigDecimal
(
Math
.
abs
(
om
.
add
(
on
).
doubleValue
()));
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk1
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk1jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk1jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
if
(
dkmc
.
getSbdk1
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk1
())/
1000
/
60
-
rest_time
;
pcd
.
setGzsc
(
Math
.
abs
(
Double
.
valueOf
(
time
.
toString
())));
//只打一次卡时计算工作时长
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
BigDecimal
xx
=
new
BigDecimal
(
rest_time
);
}
else
if
(
atttype
==
3
){
//上班2
int
sbdk2jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst2
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk2jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
}
double
worktime
=
Math
.
abs
(
worktime_
.
subtract
(
xx
).
doubleValue
());
//允许迟到范围
if
(
sbdk2jg
<=
yxcd
)
{
sbdk2jg
=
0
;
}
pcd
.
setGzsc
(
worktime
);
//严重迟到范围
}
if
(
sbdk2jg
>
yzcd
&&
sbdk2jg
<
kgcdfzs
&&
yzcd
>
0
)
{
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
}
else
if
(
atttype
==
5
){
//上班3
yzcdsc
=
sbdk2jg
;
int
sbdk3jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst3
=
0
;
dkst2
=
1
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk3jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
}
//允许迟到范围
if
(
sbdk3jg
<=
yxcd
)
{
sbdk3jg
=
0
;
}
//严重迟到范围
if
(
sbdk3jg
>
yzcd
&&
sbdk3jg
<
kgcdfzs
&&
yzcd
>
0
)
{
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
yzcdsc
=
sbdk3jg
;
dkst3
=
1
;
}
//旷工迟到
if
(
sbdk3jg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;
kgcdcs
=
kgcdcs
+
dkmc
.
getKgcdfzs
();
dkst3
=
2
;
}
pcd
.
setDkst3
(
dkst3
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setSbdk3
(
time_
);
//上班1打卡时间
pcd
.
setSbdk3jg
(
sbdk3jg
);
pcd
.
setYzcdcs
(
yzcdcs
);
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
pcd
.
setKgcdfzs
(
kgcdcs
);
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
6
){
//下班3
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk3
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk3jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk3jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
}
//旷工迟到
//班次为6次时,计算工作时长
if
(
sbdk2jg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
if
(
dkmc
.
getSbdk3
()
!=
null
){
kgcdcs
++;
Long
time
=
(
time_
-
dkmc
.
getSbdk3
())/
1000
/
60
;
kgcdcs
=
kgcdcs
+
dkmc
.
getKgcdfzs
();
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
//第二次
dkst2
=
2
;
BigDecimal
on
=
new
BigDecimal
(
time
);
}
BigDecimal
worktime_
=
new
BigDecimal
(
Math
.
abs
(
om
.
add
(
on
).
doubleValue
()));
pcd
.
setDkst2
(
dkst2
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setSbdk2
(
time_
);
//上班1打卡时间
pcd
.
setSbdk2jg
(
sbdk2jg
);
BigDecimal
xx
=
new
BigDecimal
(
rest_time
);
pcd
.
setYzcdcs
(
yzcdcs
);
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
pcd
.
setKgcdfzs
(
kgcdcs
);
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
4
){
//下班2
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk2
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk2jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk2jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
//班次为4次时,计算工作时长
if
(
dkmc
.
getSbdk2
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk2
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
BigDecimal
on
=
new
BigDecimal
(
time
);
BigDecimal
worktime_
=
new
BigDecimal
(
Math
.
abs
(
om
.
add
(
on
).
doubleValue
()));
BigDecimal
xx
=
new
BigDecimal
(
rest_time
);
double
worktime
=
Math
.
abs
(
worktime_
.
subtract
(
xx
).
doubleValue
());
pcd
.
setGzsc
(
worktime
);
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
5
){
//上班3
int
sbdk3jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst3
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk3jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
}
//允许迟到范围
if
(
sbdk3jg
<=
yxcd
)
{
sbdk3jg
=
0
;
}
//严重迟到范围
if
(
sbdk3jg
>
yzcd
&&
sbdk3jg
<
kgcdfzs
&&
yzcd
>
0
)
{
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
yzcdsc
=
sbdk3jg
;
dkst3
=
1
;
}
//旷工迟到
if
(
sbdk3jg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;
kgcdcs
=
kgcdcs
+
dkmc
.
getKgcdfzs
();
dkst3
=
2
;
}
double
worktime
=
Math
.
abs
(
worktime_
.
subtract
(
xx
).
doubleValue
());
pcd
.
setDkst3
(
dkst3
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
pcd
.
setGzsc
(
worktime
);
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setSbdk3
(
time_
);
//上班1打卡时间
pcd
.
setSbdk3jg
(
sbdk3jg
);
pcd
.
setYzcdcs
(
yzcdcs
);
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
pcd
.
setKgcdfzs
(
kgcdcs
);
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
6
){
//下班3
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk3
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk3jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk3jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
//班次为6次时,计算工作时长
if
(
dkmc
.
getSbdk3
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk3
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
//第二次
BigDecimal
on
=
new
BigDecimal
(
time
);
BigDecimal
worktime_
=
new
BigDecimal
(
Math
.
abs
(
om
.
add
(
on
).
doubleValue
()));
BigDecimal
xx
=
new
BigDecimal
(
rest_time
);
double
worktime
=
Math
.
abs
(
worktime_
.
subtract
(
xx
).
doubleValue
());
pcd
.
setGzsc
(
worktime
);
}
}
pcd
.
setId
(
dkmc
.
getId
());
if
(
atttype
<=
6
&&
atttype
>
0
&&
!
sbdkkd
){
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
}
}
pcd
.
setId
(
dkmc
.
getId
());
if
(
atttype
<=
6
&&
atttype
>
0
&&
!
sbdkkd
){
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
}
}
else
{
msg
=
"当前打卡时间不在范围内"
;
sbyf
=
0
;
status_
=
2
;
}
}
}
else
{
}
else
{
msg
=
"当前打卡时间不在范围内
"
;
msg
=
"当前时间必须大于上班打卡时间 才能打下班卡
"
;
sbyf
=
0
;
sbyf
=
0
;
status_
=
2
;
status_
=
2
;
}
}
}
else
{
}
else
{
msg
=
"当前是休息时间"
;
msg
=
"当前是休息时间"
;
sbyf
=
0
;
sbyf
=
0
;
...
@@ -1617,8 +1644,9 @@ public class ClockInController {
...
@@ -1617,8 +1644,9 @@ public class ClockInController {
}
else
{
}
else
{
long
starttime1
=
0
,
starttime1ks
=
0
,
starttime1js
=
0
,
endtime1
=
0
,
endtime1ks
=
0
,
endtime1js
=
0
,
starttime2
=
0
,
starttime2ks
=
0
,
starttime2js
=
0
,
endtime2
=
0
,
endtime2ks
=
0
,
endtime2js
=
0
,
starttime3
=
0
,
starttime3ks
=
0
,
starttime3js
=
0
,
long
starttime1
=
0
,
starttime1ks
=
0
,
starttime1js
=
0
,
endtime1
=
0
,
endtime1ks
=
0
,
endtime1js
=
0
,
starttime2
=
0
,
starttime2ks
=
0
,
starttime2js
=
0
,
endtime2
=
0
,
endtime2ks
=
0
,
endtime2js
=
0
,
starttime3
=
0
,
starttime3ks
=
0
,
starttime3js
=
0
,
endtime3
=
0
,
endtime3ks
=
0
,
endtime3js
=
0
;
endtime3
=
0
,
endtime3ks
=
0
,
endtime3js
=
0
;
List
<
AttSchedule
>
ash
=
null
;
if
(
attdate
.
getAttsch
().
size
()
>
0
)
{
if
(
attdate
.
getAttsch
().
size
()
>
0
)
{
List
<
AttSchedule
>
ash
=
attdate
.
getAttsch
();
ash
=
attdate
.
getAttsch
();
int
y
=
0
;
int
y
=
0
;
clockt
.
setShifid
(
ash
.
get
(
y
).
getId
());
clockt
.
setShifid
(
ash
.
get
(
y
).
getId
());
shifid
=
ash
.
get
(
y
).
getId
();
//班次id
shifid
=
ash
.
get
(
y
).
getId
();
//班次id
...
@@ -1893,346 +1921,371 @@ public class ClockInController {
...
@@ -1893,346 +1921,371 @@ public class ClockInController {
}
}
if
(
clockt
.
getShifid
()
!=
0
)
{
if
(
clockt
.
getShifid
()
!=
0
)
{
boolean
dddbdk
=
true
;
//
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
boolean
dak2
=
true
;
if
(
attdate
.
getAttsch
().
size
()
>
0
&&
clockt
.
getShifid
()
>
0
){
//有无班次
//打卡无限制时 当前时间必须大于上班打卡时间 才能打下班卡
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
clockt
.
getShifid
()));
if
(
punchstart
==
0
&&
punchend
==
0
&&
(
atttype
==
2
||
atttype
==
4
||
atttype
==
6
))
{
}
String
xbdk
=
""
;
//打卡记录录入 -- 打卡是否有时间范围限制
if
(
atttype
==
2
)
{
if
(
attdate
.
getAttsch
().
size
()
==
2
)
{
xbdk
=
String
.
valueOf
(
ash
.
get
(
0
).
getTime
());
if
(
punchstart
>
0
&&
punchend
>
0
)
{
}
else
if
(
atttype
==
4
){
String
staputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
punchstart
);
//应打卡开始时间
xbdk
=
String
.
valueOf
(
ash
.
get
(
2
).
getTime
());
String
entputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
punchend
);
//应打卡结束时间
}
else
{
String
DKputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
);
//打卡时间
xbdk
=
String
.
valueOf
(
ash
.
get
(
4
).
getTime
());
boolean
effectiveDate
=
ClockInTool
.
hourMinuteBetween
(
DKputime
,
staputime
,
entputime
,
"yyyy-MM-dd HH:mm"
);
if
(!
effectiveDate
)
{
// System.out.println("当前打卡时间不在范围内");
isRange
=
false
;
}
}
}
if
(
isRange
)
{
int
yxcd
=
shif
.
getYxcdfzs
();
//允许迟到
int
yzcd
=
shif
.
getYzcdfzs
();
//严重迟到分钟数
int
kgcdfzs
=
shif
.
getKgcdfzs
();
//旷工迟到分钟数
int
dkcs_
=
shif
.
getSxbcs
();
//上下班打卡次数
int
iswzwd
=
shif
.
getIsWzwd
();
//是否开启晚走晚到(0:否;1:是)
//班次的休息时间
long
rest_time
=
0
;
if
(
shif
.
getStartTime
()
!=
null
&&
shif
.
getEndTime
()
!=
null
)
{
long
kaishixiuxi
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
putime
+
" "
+
shif
.
getStartTime
()+
":00"
));
long
jieshuxiuxi
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
putime
+
" "
+
shif
.
getEndTime
()+
":00"
));
rest_time
=
(
jieshuxiuxi
-
kaishixiuxi
)/
1000
/
60
;
//休息时间
}
}
Date
sd1
=
df1
.
parse
(
ClockInTool
.
stampToDate
(
String
.
valueOf
(
xbdk
)));
//当天应打的首次上班卡时间
double
xbwz1
=
0
,
xbwz2
=
0
,
xbwz3
=
0
;
Date
sd2
=
df1
.
parse
(
current_time
);
//当前时间
int
sbwd1
=
0
,
sbwd2
=
0
,
sbwd3
=
0
;
if
(
sd2
.
before
(
sd1
))
{
//小于
dak2
=
false
;
int
arrive_late
=
0
;
//晚到时间
String
clock_date
=
""
;
//应打卡时间
Long
latetime
=
0
l
;
//前天晚走时长(分钟)
KqglAssoDkmx
yesterdaymx
=
KqglAssoDkmx
.
builder
().
build
();
AttendanceCardListDto
attdateyesterday
;
long
yesendtime1
=
0
,
yesendtime2
=
0
,
yesendtime3
=
0
;
//存在晚走玩到
if
(
iswzwd
>
0
)
{
//统一分钟数
xbwz1
=
Double
.
valueOf
(
shif
.
getXbwz1
())
*
60
;
//下班晚走1
String
sbwd1_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd1
())
*
60
);
sbwd1
=
Integer
.
valueOf
(
sbwd1_
.
substring
(
0
,
sbwd1_
.
lastIndexOf
(
"."
)));
//上班晚到1
xbwz2
=
Double
.
valueOf
(
shif
.
getXbwz2
())
*
60
;
//下班晚走2
String
sbwd2_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd2
())
*
60
);
sbwd2
=
Integer
.
valueOf
(
sbwd2_
.
substring
(
0
,
sbwd2_
.
lastIndexOf
(
"."
)));
//上班晚到2
xbwz3
=
Double
.
valueOf
(
shif
.
getXbwz3
())
*
60
;
//下班晚走3
String
sbwd3_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd3
())
*
60
);
sbwd3
=
Integer
.
valueOf
(
sbwd3_
.
substring
(
0
,
sbwd3_
.
lastIndexOf
(
"."
)));
//上班晚到3
//获取前一天最后下班的时间
yesterdaymx
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
userid
)
.
ge
(
KqglAssoDkmx:
:
getDksj
,
startDateyesterday
).
le
(
KqglAssoDkmx:
:
getDksj
,
endDateyesterday
));
attdateyesterday
=
MethodCall
(
qyid
,
userid
,
yesterday
);
List
<
AttSchedule
>
ash
=
attdateyesterday
.
getAttsch
();
if
(
attdateyesterday
.
getAttsch
().
size
()
==
2
||
attdateyesterday
.
getAttsch
().
size
()
==
4
||
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesendtime1
=
ash
.
get
(
1
).
getTime
();
}
if
(
attdateyesterday
.
getAttsch
().
size
()
==
4
||
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesendtime2
=
ash
.
get
(
3
).
getTime
();
}
if
(
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesendtime3
=
ash
.
get
(
5
).
getTime
();
}
}
}
}
if
(!
dak2
)
{
dddbdk
=
false
;
}
if
(
execution_status
==
1
)
{
//上班1 ****新增
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
userid
(
userid
).
data
(
putime
).
qyid
(
qyid
).
dksj
(
startDate
).
build
();
if
(
dddbdk
)
{
int
sbdkjg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst1
=
0
;
KqglAssoBcsz
shif
=
KqglAssoBcsz
.
builder
().
build
();
if
(
punchcardtime
!=
0
){
//有应打卡时间时
if
(
attdate
.
getAttsch
().
size
()
>
0
&&
clockt
.
getShifid
()
>
0
){
//有无班次
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
shif
=
shif
.
selectOne
(
new
QueryWrapper
<
KqglAssoBcsz
>().
lambda
().
eq
(
KqglAssoBcsz:
:
getId
,
clockt
.
getShifid
()));
if
((
atttype
)%
2
>
0
){
//上班
}
if
(
time
>
0
){
//打卡记录录入 -- 打卡是否有时间范围限制
sbdkjg
=
Integer
.
valueOf
(
time
.
toString
());
if
(
attdate
.
getAttsch
().
size
()
==
2
)
{
}
// 打卡结果
if
(
punchstart
>
0
&&
punchend
>
0
)
{
}
else
{
//下班
String
staputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
punchstart
);
//应打卡开始时间
if
(
time
>
0
){}
else
{
String
entputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
punchend
);
//应打卡结束时间
sbdkjg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));
String
DKputime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
).
format
(
time_
);
//打卡时间
}
// 打卡结果
boolean
effectiveDate
=
ClockInTool
.
hourMinuteBetween
(
DKputime
,
staputime
,
entputime
,
"yyyy-MM-dd HH:mm"
);
}
if
(!
effectiveDate
)
{
// System.out.println("当前打卡时间不在范围内");
isRange
=
false
;
//存在晚走玩到
if
(
iswzwd
>
0
&&
yesterdaymx
!=
null
)
{
if
(
dkcs_
==
1
)
{
if
(
yesterdaymx
.
getXbdk1
()
!=
null
&&
yesterdaymx
.
getXbdk1jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk1
()
-
yesendtime1
)/
1000
/
60
;
}
}
else
if
(
dkcs_
==
2
){
if
(
yesterdaymx
.
getXbdk2
()
!=
null
&&
yesterdaymx
.
getXbdk2jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk2
()
-
yesendtime2
)/
1000
/
60
;
}
}
else
{
if
(
yesterdaymx
.
getXbdk3
()
!=
null
&&
yesterdaymx
.
getXbdk3jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk3
()
-
yesendtime3
)/
1000
/
60
;
}
}
if
(
latetime
!=
0
)
{
double
latetime_
=
Double
.
valueOf
(
String
.
valueOf
(
latetime
));
//前天晚走时长(分钟)
if
(
latetime_
>
xbwz1
&&
latetime_
<
xbwz2
)
{
arrive_late
=
sbwd1
;
}
else
if
(
latetime_
>
xbwz2
&&
latetime_
<
xbwz3
)
{
arrive_late
=
sbwd2
;
}
else
if
(
latetime_
>
xbwz3
)
{
arrive_late
=
sbwd3
;
}
clock_date
=
ClockInTool
.
stampToDate
(
String
.
valueOf
(
punchcardtime
));
Long
changed_time
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
ClockInTool
.
addtime
(
clock_date
,
"+"
+
arrive_late
)));
//晚到后应打卡时间
punchcardtime
=
changed_time
;
//更换当天打卡时间
Long
timeyes
=
(
time_
-
changed_time
)/
1000
/
60
;
//
if
((
atttype
)%
2
>
0
){
//上班
if
(
timeyes
>
0
){
sbdkjg
=
Integer
.
valueOf
(
timeyes
.
toString
());
}
else
{
sbdkjg
=
0
;
}
}
else
{
//下班
if
(
timeyes
>
0
){
sbdkjg
=
0
;
}
else
{
sbdkjg
=
Math
.
abs
(
Integer
.
valueOf
(
timeyes
.
toString
()));
}
}
}
}
}
}
}
}
if
(
isRange
)
{
//允许迟到范围
if
(
sbdkjg
<=
yxcd
)
{
sbdkjg
=
0
;
}
if
(
atttype
==
1
)
{
pcd
.
setSbdk1
(
time_
);
pcd
.
setSbdk1jg
(
sbdkjg
);
}
else
if
(
atttype
==
2
)
{
pcd
.
setXbdk1
(
time_
);
pcd
.
setXbdk1jg
(
sbdkjg
);
}
else
if
(
atttype
==
3
)
{
pcd
.
setSbdk2
(
time_
);
pcd
.
setSbdk2jg
(
sbdkjg
);
}
else
if
(
atttype
==
4
)
{
pcd
.
setXbdk2
(
time_
);
pcd
.
setXbdk2jg
(
sbdkjg
);
}
else
if
(
atttype
==
5
)
{
pcd
.
setSbdk3
(
time_
);
pcd
.
setSbdk3jg
(
sbdkjg
);
}
else
if
(
atttype
==
6
)
{
pcd
.
setXbdk3
(
time_
);
pcd
.
setXbdk3jg
(
sbdkjg
);
}
int
ydkcs
=
0
;
if
(
shif
!=
null
){
ydkcs
=
shif
.
getSxbcs
()*
2
;
}
//应打卡次数
pcd
.
setYdkcs
(
ydkcs
);
//严重迟到范围
if
(
sbdkjg
>
yzcd
&&
sbdkjg
<
kgcdfzs
&&
yzcd
>
0
)
{
yzcdcs
++;
yzcdsc
=
sbdkjg
;
dkst1
=
1
;
}
//旷工迟到
if
(
sbdkjg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;
dkst1
=
2
;
}
pcd
.
setDkst1
(
dkst1
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
pcd
.
setYzcdcs
(
yzcdcs
);
//严重迟到次数
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
//严重迟到时长(分钟)
pcd
.
setKgcdfzs
(
kgcdcs
);
//旷工迟到次数
if
(!
pcd
.
insert
())
{
throw
new
CustomException
(
"打卡明细-新增异常-1"
);
}
dkmx
=
pcd
.
getId
();
}
else
if
(
execution_status
==
2
){
dkmx
=
dkmc
.
getId
();
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
build
();
if
(
atttype
==
2
){
//下班1
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk1
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk1jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk1jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
if
(
dkmc
.
getSbdk1
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk1
())/
1000
/
60
-
rest_time
;
pcd
.
setGzsc
(
Math
.
abs
(
Double
.
valueOf
(
time
.
toString
())));
//只打一次卡时计算工作时长
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
3
){
//上班2
int
yxcd
=
shif
.
getYxcdfzs
();
//允许迟到
int
yzcd
=
shif
.
getYzcdfzs
();
//严重迟到分钟数
int
sbdk2jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst2
=
0
;
int
kgcdfzs
=
shif
.
getKgcdfzs
();
//旷工迟到分钟数
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk2jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
}
int
dkcs_
=
shif
.
getSxbcs
();
//上下班打卡次数
int
iswzwd
=
shif
.
getIsWzwd
();
//是否开启晚走晚到(0:否;1:是)
//允许迟到范围
//班次的休息时间
if
(
sbdk2jg
<=
yxcd
)
{
long
rest_time
=
0
;
sbdk2jg
=
0
;
if
(
shif
.
getStartTime
()
!=
null
&&
shif
.
getEndTime
()
!=
null
)
{
long
kaishixiuxi
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
putime
+
" "
+
shif
.
getStartTime
()+
":00"
));
long
jieshuxiuxi
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
putime
+
" "
+
shif
.
getEndTime
()+
":00"
));
rest_time
=
(
jieshuxiuxi
-
kaishixiuxi
)/
1000
/
60
;
//休息时间
}
}
//严重迟到范围
double
xbwz1
=
0
,
xbwz2
=
0
,
xbwz3
=
0
;
if
(
sbdk2jg
>
yzcd
&&
sbdk2jg
<
kgcdfzs
&&
yzcd
>
0
)
{
int
sbwd1
=
0
,
sbwd2
=
0
,
sbwd3
=
0
;
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
yzcdsc
=
sbdk2jg
;
int
arrive_late
=
0
;
//晚到时间
dkst2
=
1
;
String
clock_date
=
""
;
//应打卡时间
}
Long
latetime
=
0
l
;
//前天晚走时长(分钟)
//旷工迟到
if
(
sbdk2jg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
KqglAssoDkmx
yesterdaymx
=
KqglAssoDkmx
.
builder
().
build
();
kgcdcs
++;
AttendanceCardListDto
attdateyesterday
;
kgcdcs
=
kgcdcs
+
dkmc
.
getKgcdfzs
();
long
yesendtime1
=
0
,
yesendtime2
=
0
,
yesendtime3
=
0
;
dkst2
=
2
;
//存在晚走玩到
if
(
iswzwd
>
0
)
{
//统一分钟数
xbwz1
=
Double
.
valueOf
(
shif
.
getXbwz1
())
*
60
;
//下班晚走1
String
sbwd1_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd1
())
*
60
);
sbwd1
=
Integer
.
valueOf
(
sbwd1_
.
substring
(
0
,
sbwd1_
.
lastIndexOf
(
"."
)));
//上班晚到1
xbwz2
=
Double
.
valueOf
(
shif
.
getXbwz2
())
*
60
;
//下班晚走2
String
sbwd2_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd2
())
*
60
);
sbwd2
=
Integer
.
valueOf
(
sbwd2_
.
substring
(
0
,
sbwd2_
.
lastIndexOf
(
"."
)));
//上班晚到2
xbwz3
=
Double
.
valueOf
(
shif
.
getXbwz3
())
*
60
;
//下班晚走3
String
sbwd3_
=
String
.
valueOf
(
Double
.
valueOf
(
shif
.
getSbwd3
())
*
60
);
sbwd3
=
Integer
.
valueOf
(
sbwd3_
.
substring
(
0
,
sbwd3_
.
lastIndexOf
(
"."
)));
//上班晚到3
//获取前一天最后下班的时间
yesterdaymx
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
userid
)
.
ge
(
KqglAssoDkmx:
:
getDksj
,
startDateyesterday
).
le
(
KqglAssoDkmx:
:
getDksj
,
endDateyesterday
));
attdateyesterday
=
MethodCall
(
qyid
,
userid
,
yesterday
);
List
<
AttSchedule
>
ash1
=
attdateyesterday
.
getAttsch
();
if
(
attdateyesterday
.
getAttsch
().
size
()
==
2
||
attdateyesterday
.
getAttsch
().
size
()
==
4
||
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesendtime1
=
ash1
.
get
(
1
).
getTime
();
}
if
(
attdateyesterday
.
getAttsch
().
size
()
==
4
||
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesendtime2
=
ash1
.
get
(
3
).
getTime
();
}
if
(
attdateyesterday
.
getAttsch
().
size
()
==
6
)
{
yesendtime3
=
ash1
.
get
(
5
).
getTime
();
}
}
}
pcd
.
setDkst2
(
dkst2
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
if
(
execution_status
==
1
)
{
//上班1 ****新增
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
userid
(
userid
).
data
(
putime
).
qyid
(
qyid
).
dksj
(
startDate
).
build
();
pcd
.
setId
(
dkmc
.
getId
());
int
sbdkjg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst1
=
0
;
pcd
.
setSbdk2
(
time_
);
//上班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
pcd
.
setSbdk2jg
(
sbdk2jg
);
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
((
atttype
)%
2
>
0
){
//上班
pcd
.
setYzcdcs
(
yzcdcs
);
if
(
time
>
0
){
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
sbdkjg
=
Integer
.
valueOf
(
time
.
toString
());
pcd
.
setKgcdfzs
(
kgcdcs
);
}
// 打卡结果
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
{
//下班
}
else
if
(
atttype
==
4
){
//下班2
if
(
time
>
0
){}
else
{
pcd
.
setId
(
dkmc
.
getId
());
sbdkjg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));
pcd
.
setXbdk2
(
time_
);
//下班1打卡时间
}
// 打卡结果
if
(
punchcardtime
!=
0
){
//有应打卡时间时
}
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk2jg
(
0
);
// 打卡结果
//存在晚走玩到
}
else
{
if
(
iswzwd
>
0
&&
yesterdaymx
!=
null
)
{
pcd
.
setXbdk2jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
if
(
dkcs_
==
1
)
{
if
(
yesterdaymx
.
getXbdk1
()
!=
null
&&
yesterdaymx
.
getXbdk1jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk1
()
-
yesendtime1
)/
1000
/
60
;
}
}
else
if
(
dkcs_
==
2
){
if
(
yesterdaymx
.
getXbdk2
()
!=
null
&&
yesterdaymx
.
getXbdk2jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk2
()
-
yesendtime2
)/
1000
/
60
;
}
}
else
{
if
(
yesterdaymx
.
getXbdk3
()
!=
null
&&
yesterdaymx
.
getXbdk3jg
()
==
0
)
{
latetime
=
(
yesterdaymx
.
getXbdk3
()
-
yesendtime3
)/
1000
/
60
;
}
}
if
(
latetime
!=
0
)
{
double
latetime_
=
Double
.
valueOf
(
String
.
valueOf
(
latetime
));
//前天晚走时长(分钟)
if
(
latetime_
>
xbwz1
&&
latetime_
<
xbwz2
)
{
arrive_late
=
sbwd1
;
}
else
if
(
latetime_
>
xbwz2
&&
latetime_
<
xbwz3
)
{
arrive_late
=
sbwd2
;
}
else
if
(
latetime_
>
xbwz3
)
{
arrive_late
=
sbwd3
;
}
clock_date
=
ClockInTool
.
stampToDate
(
String
.
valueOf
(
punchcardtime
));
Long
changed_time
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
ClockInTool
.
addtime
(
clock_date
,
"+"
+
arrive_late
)));
//晚到后应打卡时间
punchcardtime
=
changed_time
;
//更换当天打卡时间
Long
timeyes
=
(
time_
-
changed_time
)/
1000
/
60
;
//
if
((
atttype
)%
2
>
0
){
//上班
if
(
timeyes
>
0
){
sbdkjg
=
Integer
.
valueOf
(
timeyes
.
toString
());
}
else
{
sbdkjg
=
0
;
}
}
else
{
//下班
if
(
timeyes
>
0
){
sbdkjg
=
0
;
}
else
{
sbdkjg
=
Math
.
abs
(
Integer
.
valueOf
(
timeyes
.
toString
()));
}
}
}
}
}
}
}
//班次为4次时,计算工作时长
if
(
dkmc
.
getSbdk2
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk2
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
BigDecimal
on
=
new
BigDecimal
(
time
);
BigDecimal
worktime_
=
new
BigDecimal
(
Math
.
abs
(
om
.
add
(
on
).
doubleValue
()));
BigDecimal
xx
=
new
BigDecimal
(
rest_time
);
//允许迟到范围
if
(
sbdkjg
<=
yxcd
)
{
sbdkjg
=
0
;
}
double
worktime
=
Math
.
abs
(
worktime_
.
subtract
(
xx
).
doubleValue
());
if
(
atttype
==
1
)
{
pcd
.
setSbdk1
(
time_
);
pcd
.
setSbdk1jg
(
sbdkjg
);
}
else
if
(
atttype
==
2
)
{
pcd
.
setXbdk1
(
time_
);
pcd
.
setXbdk1jg
(
sbdkjg
);
}
else
if
(
atttype
==
3
)
{
pcd
.
setSbdk2
(
time_
);
pcd
.
setSbdk2jg
(
sbdkjg
);
}
else
if
(
atttype
==
4
)
{
pcd
.
setXbdk2
(
time_
);
pcd
.
setXbdk2jg
(
sbdkjg
);
}
else
if
(
atttype
==
5
)
{
pcd
.
setSbdk3
(
time_
);
pcd
.
setSbdk3jg
(
sbdkjg
);
}
else
if
(
atttype
==
6
)
{
pcd
.
setXbdk3
(
time_
);
pcd
.
setXbdk3jg
(
sbdkjg
);
}
pcd
.
setGzsc
(
worktime
);
int
ydkcs
=
0
;
}
if
(
shif
!=
null
){
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
ydkcs
=
shif
.
getSxbcs
()*
2
;
}
else
if
(
atttype
==
5
){
//上班3
}
//应打卡次数
int
sbdk3jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst3
=
0
;
pcd
.
setYdkcs
(
ydkcs
);
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
//严重迟到范围
if
(
time
>
0
){
sbdk3jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
if
(
sbdkjg
>
yzcd
&&
sbdkjg
<
kgcdfzs
&&
yzcd
>
0
)
{
}
yzcdcs
++;
yzcdsc
=
sbdkjg
;
//允许迟到范围
dkst1
=
1
;
if
(
sbdk3jg
<=
yxcd
)
{
}
sbdk3jg
=
0
;
//旷工迟到
}
if
(
sbdkjg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;
//严重迟到范围
dkst1
=
2
;
if
(
sbdk3jg
>
yzcd
&&
sbdk3jg
<
kgcdfzs
&&
yzcd
>
0
)
{
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
yzcdsc
=
sbdk3jg
;
dkst3
=
1
;
}
//旷工迟到
if
(
sbdk3jg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;
kgcdcs
=
kgcdcs
+
dkmc
.
getKgcdfzs
();
dkst3
=
2
;
}
pcd
.
setDkst3
(
dkst3
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setSbdk3
(
time_
);
//上班1打卡时间
pcd
.
setSbdk3jg
(
sbdk3jg
);
pcd
.
setYzcdcs
(
yzcdcs
);
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
pcd
.
setKgcdfzs
(
kgcdcs
);
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
6
){
//下班3
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk3
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk3jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk3jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
}
//班次为6次时,计算工作时长
if
(
dkmc
.
getSbdk3
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk3
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
//第二次
BigDecimal
on
=
new
BigDecimal
(
time
);
BigDecimal
worktime_
=
new
BigDecimal
(
Math
.
abs
(
om
.
add
(
on
).
doubleValue
()));
BigDecimal
xx
=
new
BigDecimal
(
rest_time
);
pcd
.
setDkst1
(
dkst1
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
double
worktime
=
Math
.
abs
(
worktime_
.
subtract
(
xx
).
doubleValue
());
pcd
.
setYzcdcs
(
yzcdcs
);
//严重迟到次数
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
//严重迟到时长(分钟)
pcd
.
setKgcdfzs
(
kgcdcs
);
//旷工迟到次数
pcd
.
setGzsc
(
worktime
);
if
(!
pcd
.
insert
())
{
throw
new
CustomException
(
"打卡明细-新增异常-1"
);
}
dkmx
=
pcd
.
getId
();
}
else
if
(
execution_status
==
2
){
dkmx
=
dkmc
.
getId
();
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
build
();
if
(
atttype
==
2
){
//下班1
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk1
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk1jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk1jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
if
(
dkmc
.
getSbdk1
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk1
())/
1000
/
60
-
rest_time
;
pcd
.
setGzsc
(
Math
.
abs
(
Double
.
valueOf
(
time
.
toString
())));
//只打一次卡时计算工作时长
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
3
){
//上班2
int
sbdk2jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst2
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk2jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
}
//允许迟到范围
if
(
sbdk2jg
<=
yxcd
)
{
sbdk2jg
=
0
;
}
//严重迟到范围
if
(
sbdk2jg
>
yzcd
&&
sbdk2jg
<
kgcdfzs
&&
yzcd
>
0
)
{
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
yzcdsc
=
sbdk2jg
;
dkst2
=
1
;
}
//旷工迟到
if
(
sbdk2jg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;
kgcdcs
=
kgcdcs
+
dkmc
.
getKgcdfzs
();
dkst2
=
2
;
}
pcd
.
setDkst2
(
dkst2
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setSbdk2
(
time_
);
//上班1打卡时间
pcd
.
setSbdk2jg
(
sbdk2jg
);
pcd
.
setYzcdcs
(
yzcdcs
);
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
pcd
.
setKgcdfzs
(
kgcdcs
);
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
4
){
//下班2
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk2
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk2jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk2jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
//班次为4次时,计算工作时长
if
(
dkmc
.
getSbdk2
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk2
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
BigDecimal
on
=
new
BigDecimal
(
time
);
BigDecimal
worktime_
=
new
BigDecimal
(
Math
.
abs
(
om
.
add
(
on
).
doubleValue
()));
BigDecimal
xx
=
new
BigDecimal
(
rest_time
);
double
worktime
=
Math
.
abs
(
worktime_
.
subtract
(
xx
).
doubleValue
());
pcd
.
setGzsc
(
worktime
);
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
5
){
//上班3
int
sbdk3jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
,
dkst3
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
sbdk3jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
}
//允许迟到范围
if
(
sbdk3jg
<=
yxcd
)
{
sbdk3jg
=
0
;
}
//严重迟到范围
if
(
sbdk3jg
>
yzcd
&&
sbdk3jg
<
kgcdfzs
&&
yzcd
>
0
)
{
yzcdcs
=
dkmc
.
getYzcdcs
()+
1
;
yzcdsc
=
sbdk3jg
;
dkst3
=
1
;
}
//旷工迟到
if
(
sbdk3jg
>
kgcdfzs
&&
kgcdfzs
>
0
)
{
kgcdcs
++;
kgcdcs
=
kgcdcs
+
dkmc
.
getKgcdfzs
();
dkst3
=
2
;
}
pcd
.
setDkst3
(
dkst3
);
//打卡时态(0:无;1:严重迟到;2:旷工迟到)
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setSbdk3
(
time_
);
//上班1打卡时间
pcd
.
setSbdk3jg
(
sbdk3jg
);
pcd
.
setYzcdcs
(
yzcdcs
);
pcd
.
setYzcdsc
(
Double
.
valueOf
(
yzcdsc
));
pcd
.
setKgcdfzs
(
kgcdcs
);
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
(
atttype
==
6
){
//下班3
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk3
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){
pcd
.
setXbdk3jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk3jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
//班次为6次时,计算工作时长
if
(
dkmc
.
getSbdk3
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk3
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
//第二次
BigDecimal
on
=
new
BigDecimal
(
time
);
BigDecimal
worktime_
=
new
BigDecimal
(
Math
.
abs
(
om
.
add
(
on
).
doubleValue
()));
BigDecimal
xx
=
new
BigDecimal
(
rest_time
);
double
worktime
=
Math
.
abs
(
worktime_
.
subtract
(
xx
).
doubleValue
());
pcd
.
setGzsc
(
worktime
);
}
}
pcd
.
setId
(
dkmc
.
getId
());
if
(
atttype
<=
6
&&
atttype
>
0
&&
!
sbdkkd
){
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
}
}
}
}
else
{
pcd
.
setId
(
dkmc
.
getId
())
;
msg
=
"当前打卡时间不在范围内"
;
if
(
atttype
<=
6
&&
atttype
>
0
&&
!
sbdkkd
){
sbyf
=
0
;
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
status_
=
2
;
}
}
}
}
else
{
}
else
{
msg
=
"当前
打卡时间不在范围内
"
;
msg
=
"当前
时间必须大于上班打卡时间 才能打下班卡
"
;
sbyf
=
0
;
sbyf
=
0
;
status_
=
2
;
status_
=
2
;
}
}
...
...
src/main/java/cn/timer/api/controller/spmk/SpmkController.java
View file @
e713e8c0
...
@@ -793,6 +793,10 @@ public class SpmkController {
...
@@ -793,6 +793,10 @@ public class SpmkController {
if
(
mySummaryQueryDto
.
getSts
()
==
null
)
{
if
(
mySummaryQueryDto
.
getSts
()
==
null
)
{
mySummaryQueryDto
.
setSts
(
0
);
mySummaryQueryDto
.
setSts
(
0
);
}
}
//我发起的
if
(
mySummaryQueryDto
.
getType
()
==
0
)
{
mySummaryQueryDto
.
setSts
(
null
);
}
// 缺-部门id 搜索
// 缺-部门id 搜索
IPage
<
SpmkApproveSummary
>
pageAs
=
spmkApproveSummaryMapper
.
selectPageByQueryForEmpNum
(
page
,
mySummaryQueryDto
);
IPage
<
SpmkApproveSummary
>
pageAs
=
spmkApproveSummaryMapper
.
selectPageByQueryForEmpNum
(
page
,
mySummaryQueryDto
);
...
...
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