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
260d2472
Commit
260d2472
authored
Jun 03, 2020
by
lal
Committed by
chenzg
Jul 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
考勤机打卡
parent
f3038aa8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
160 additions
and
109 deletions
+160
-109
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
+70
-20
src/main/java/cn/timer/api/controller/kqgl/TimeCardController.java
+55
-56
src/main/java/cn/timer/api/dao/kqmk/KqglAssoDkmxMapper.java
+2
-0
src/main/resources/mapping/kqgl/PunchCardDetailsMapper.xml
+2
-2
src/main/resources/mapping/kqgl/PunchRecordMapper.xml
+3
-3
src/main/resources/mapping/kqmk/KqglAssoDkmxMapper.xml
+28
-28
No files found.
src/main/java/cn/timer/api/controller/kqgl/ClockInController.java
View file @
260d2472
...
...
@@ -18,6 +18,7 @@ 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.PunchCardDetails
;
import
cn.timer.api.bean.kqmk.KqglAssoBcsz
;
import
cn.timer.api.bean.kqmk.KqglAssoDkjl
;
import
cn.timer.api.bean.kqmk.KqglAssoDkmx
;
...
...
@@ -28,6 +29,7 @@ import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
import
cn.timer.api.bean.kqmk.KqglMainKqz
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.config.exception.CustomException
;
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.AttLateLate
;
...
...
@@ -49,6 +51,10 @@ public class ClockInController {
@Autowired
private
KqglMainKqzMapper
kqglmainkqzmapper
;
//打卡明细表
@Autowired
private
KqglAssoDkmxMapper
kqglassodkmxmapper
;
SimpleDateFormat
sdf1
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
sdf2
=
new
SimpleDateFormat
(
"EEE"
);
...
...
@@ -90,7 +96,7 @@ public class ClockInController {
int
dkmx
=
0
;
//查询打卡当天是否有记录
KqglAssoDkmx
dkmc
=
KqglAssoDkmx
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoDkmx
>().
lambda
().
eq
(
KqglAssoDkmx:
:
getUserid
,
userid
)
.
g
t
(
KqglAssoDkmx:
:
getDksj
,
startDate
).
lt
(
KqglAssoDkmx:
:
getDksj
,
endDate
));
.
g
e
(
KqglAssoDkmx:
:
getDksj
,
startDate
).
le
(
KqglAssoDkmx:
:
getDksj
,
endDate
));
AttendanceCardListDto
attdate
=
MethodCall
(
qyid
,
userid
,
putime
);
ClockCollectData
clockt
=
new
ClockCollectData
();
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
,
...
...
@@ -182,21 +188,29 @@ public class ClockInController {
dkmx
=
pcd
.
getId
();
}
else
{
//*****修改
dkmx
=
dkmc
.
getId
();
KqglAssoDkmx
pcd
=
KqglAssoDkmx
.
builder
().
build
();
if
((!(
""
).
equals
(
dkmc
.
getSbdk1
())
||
dkmc
.
getSbdk1
()
!=
null
)
&&
((
""
).
equals
(
dkmc
.
getXbdk1
())
||
dkmc
.
getXbdk1
()
==
null
)){
//下班1
int
xbdk1jg
=
0
;
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk1
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){}
else
{
xbdk1jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
//上班1打卡结果
if
(
time
>
0
){
pcd
.
setXbdk1jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk1jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
//上班1打卡结果
}
}
double
gzsc
=
0
;
if
(
dkmc
.
getSbdk1
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk1
())/
1000
/
60
;
gzsc
=
Math
.
abs
(
Double
.
valueOf
(
time
.
toString
(
)));
//只打一次卡时计算工作时长
pcd
.
setGzsc
(
Math
.
abs
(
Double
.
valueOf
(
time
.
toString
()
)));
//只打一次卡时计算工作时长
}
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
KqglAssoDkmx
.
builder
().
id
(
dkmc
.
getId
()).
xbdk1
(
time_
).
xbdk1jg
(
xbdk1jg
).
gzsc
(
gzsc
).
build
().
updateById
();
}
else
if
((!(
""
).
equals
(
dkmc
.
getSbdk1
())
||
dkmc
.
getSbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk1
())
||
dkmc
.
getXbdk1
()
!=
null
)
&&
((
""
).
equals
(
dkmc
.
getSbdk2
())
||
dkmc
.
getSbdk2
()
==
null
)){
//上班2
int
sbdk2jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
...
...
@@ -207,26 +221,44 @@ public class ClockInController {
yzcdsc
=
sbdk2jg
-
yzcd
;
}
if
(
sbdk2jg
>
kgcdfzs
)
{
kgcdcs
++;}
KqglAssoDkmx
.
builder
().
id
(
dkmc
.
getId
()).
sbdk2
(
time_
).
sbdk2jg
(
sbdk2jg
).
yzcdcs
(
yzcdcs
).
yzcdsc
(
Double
.
valueOf
(
yzcdsc
)).
kgcdfzs
(
kgcdcs
).
build
().
updateById
();
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
((!(
""
).
equals
(
dkmc
.
getSbdk1
())
||
dkmc
.
getSbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk1
())
||
dkmc
.
getXbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getSbdk2
())
||
dkmc
.
getSbdk2
()
!=
null
)
&&
((
""
).
equals
(
dkmc
.
getXbdk2
())
||
dkmc
.
getXbdk2
()
==
null
)){
//下班2
int
xbdk2jg
=
0
;
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk2
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){}
else
{
xbdk2jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
if
(
time
>
0
){
pcd
.
setXbdk2jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk2jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
//班次为4次时,计算工作时长
double
worktime
=
0
;
if
(
dkmc
.
getSbdk2
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk2
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
BigDecimal
on
=
new
BigDecimal
(
time
);
worktime
=
Math
.
abs
(
om
.
add
(
on
).
doubleValue
());
double
worktime
=
Math
.
abs
(
om
.
add
(
on
).
doubleValue
());
pcd
.
setGzsc
(
worktime
);
}
KqglAssoDkmx
.
builder
().
id
(
dkmc
.
getId
()).
xbdk2
(
time_
).
xbdk2jg
(
xbdk2jg
).
gzsc
(
worktime
).
build
().
updateById
();
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
else
if
((!(
""
).
equals
(
dkmc
.
getSbdk1
())
||
dkmc
.
getSbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk1
())
||
dkmc
.
getXbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getSbdk2
())
||
dkmc
.
getSbdk2
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk2
())
||
dkmc
.
getXbdk2
()
!=
null
)
&&
((
""
).
equals
(
dkmc
.
getSbdk3
())
||
dkmc
.
getSbdk3
()
==
null
)){
//上班3
int
sbdk3jg
=
0
,
yzcdsc
=
0
,
yzcdcs
=
0
,
kgcdcs
=
0
;
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
...
...
@@ -237,27 +269,44 @@ public class ClockInController {
yzcdsc
=
sbdk3jg
-
yzcd
;
}
if
(
sbdk3jg
>
kgcdfzs
)
{
kgcdcs
++;}
KqglAssoDkmx
.
builder
().
id
(
dkmc
.
getId
()).
sbdk3
(
time_
).
sbdk3jg
(
sbdk3jg
).
yzcdcs
(
yzcdcs
).
yzcdsc
(
Double
.
valueOf
(
yzcdsc
)).
kgcdfzs
(
kgcdcs
).
build
().
updateById
();
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
((!(
""
).
equals
(
dkmc
.
getSbdk1
())
||
dkmc
.
getSbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk1
())
||
dkmc
.
getXbdk1
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getSbdk2
())
||
dkmc
.
getSbdk2
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getXbdk2
())
||
dkmc
.
getXbdk2
()
!=
null
)
&&
(!(
""
).
equals
(
dkmc
.
getSbdk3
())
||
dkmc
.
getSbdk3
()
!=
null
)
&&
((
""
).
equals
(
dkmc
.
getXbdk3
())
||
dkmc
.
getXbdk3
()
==
null
)){
//下班3
int
xbdk3jg
=
0
;
pcd
.
setId
(
dkmc
.
getId
());
pcd
.
setXbdk3
(
time_
);
//下班1打卡时间
if
(
punchcardtime
!=
0
){
//有应打卡时间时
Long
time
=
(
time_
-
punchcardtime
)/
1000
/
60
;
if
(
time
>
0
){}
else
{
xbdk3jg
=
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
()));}
if
(
time
>
0
){
pcd
.
setXbdk3jg
(
0
);
// 打卡结果
}
else
{
pcd
.
setXbdk3jg
(
Math
.
abs
(
Integer
.
valueOf
(
time
.
toString
())));
}
}
//班次为6次时,计算工作时长
double
worktime
=
0
;
if
(
dkmc
.
getSbdk3
()
!=
null
){
Long
time
=
(
time_
-
dkmc
.
getSbdk3
())/
1000
/
60
;
BigDecimal
om
=
new
BigDecimal
(
dkmc
.
getGzsc
());
//第二次
BigDecimal
on
=
new
BigDecimal
(
time
);
worktime
=
Math
.
abs
(
om
.
add
(
on
).
doubleValue
());
double
worktime
=
Math
.
abs
(
om
.
add
(
on
).
doubleValue
());
pcd
.
setGzsc
(
worktime
);
}
KqglAssoDkmx
.
builder
().
id
(
dkmc
.
getId
()).
xbdk3
(
time_
).
xbdk3jg
(
xbdk3jg
).
gzsc
(
worktime
).
build
().
updateById
();
}
pcd
.
setId
(
dkmc
.
getId
());
if
(
atttype
<=
6
){
KqglAssoDkmx
.
builder
().
id
(
dkmc
.
getId
()).
build
().
updateById
();
int
update
=
kqglassodkmxmapper
.
updateByPrimaryKeySelective
(
pcd
);
//修改打卡记录
}
}
...
...
@@ -295,7 +344,8 @@ public class ClockInController {
}
String
attdate_
=
new
SimpleDateFormat
(
"yy-MM-dd"
).
format
(
Double
.
valueOf
(
startDate
));
//转换打卡时间格式
long
attime
;
if
(
punchcardtime
==
0
&&
!
isRange
){
attime
=
new
Date
().
getTime
();}
else
{
attime
=
punchcardtime
;}
// 考勤时间(应打卡时间)
// if(punchcardtime == 0 && !isRange){attime = new Date().getTime();}else{attime = punchcardtime;}// 考勤时间(应打卡时间)
if
(
punchcardtime
==
0
){
attime
=
new
Date
().
getTime
();}
else
{
attime
=
punchcardtime
;}
// 考勤时间(应打卡时间)
String
remarks
=
""
;
if
((
"1"
).
equals
(
asVerifyMode
))
{
remarks
=
"考勤机指纹打卡"
;}
else
if
((
"20"
).
equals
(
asVerifyMode
))
{
remarks
=
"考勤机人脸打卡"
;}
else
if
((
"40"
).
equals
(
asVerifyMode
))
{
remarks
=
"考勤机掌纹打卡"
;}
else
if
((
"60"
).
equals
(
asVerifyMode
))
{
remarks
=
"考勤机密码打卡"
;}
//cardtype--1:GPS,2:WIFI,3:考勤机
...
...
src/main/java/cn/timer/api/controller/kqgl/TimeCardController.java
View file @
260d2472
...
...
@@ -38,6 +38,7 @@ import cn.hutool.core.bean.BeanUtil;
import
cn.hutool.core.lang.Console
;
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
;
import
cn.timer.api.bean.kqmk.KqglAssOvertimeVice
;
import
cn.timer.api.bean.kqmk.KqglAssoBcsz
;
...
...
@@ -65,6 +66,7 @@ import cn.timer.api.config.annotation.CurrentUser;
import
cn.timer.api.config.annotation.UserBean
;
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
;
...
...
@@ -109,7 +111,6 @@ import cn.timer.api.utils.Result;
import
cn.timer.api.utils.ResultUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
net.sf.json.JSONObject
;
@Api
(
tags
=
"3.0[1]考勤模块"
)
@RestController
...
...
@@ -123,6 +124,10 @@ public class TimeCardController {
@Autowired
private
KqglAssOvertimeViceMapper
kqglassovertimevicemapper
;
//用户和考勤组关系
@Autowired
private
UserAttendanceRelMapper
userattendancerelmapper
;
/**
* 查询列表-获取班次数据-分页
*/
...
...
@@ -399,7 +404,7 @@ public class TimeCardController {
}
}
else
{
for
(
YgglMainEmp
ye:
yggl
)
{
KqglAssoLeaveBalance
.
builder
().
leaveRulesId
(
id
).
userid
(
ye
.
getEmpNum
()).
modifyAction
(
1
).
balanceDays
(
"1-1"
)
KqglAssoLeaveBalance
.
builder
().
leaveRulesId
(
id
).
userid
(
ye
.
getEmpNum
()).
modifyAction
(
1
).
balanceDays
(
"
-
1-1"
)
.
reason
(
"不限制余额"
).
modifyUserid
(
userBean
.
getEmpNum
()).
modifyTimer
(
new
Date
().
getTime
()).
orgCode
(
userBean
.
getOrgCode
()).
isAutomatic
(
1
).
modifyNumber
(
1
).
build
().
insert
();
//员工假期余额
}
}
...
...
@@ -476,18 +481,15 @@ public class TimeCardController {
@ApiOperation
(
value
=
"考勤机一键同步"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
SynchronizationTime
(
@CurrentUser
UserBean
userBean
,
@PathVariable
(
"code"
)
String
code
)
{
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"devId"
,
code
);
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
+
"/setTime"
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"
json"
,
sFinal
);
params
.
add
(
"
devId"
,
code
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
try
{
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
System
.
err
.
print
(
request
.
getBody
());
}
catch
(
RestClientException
e
)
{
System
.
err
.
println
(
"提示:考勤机服务出错"
);
return
ResultUtil
.
success
(
"失败"
);
...
...
@@ -506,20 +508,17 @@ public class TimeCardController {
KqglAssoKqj
kqj
=
KqglAssoKqj
.
builder
().
id
(
kqjid
).
build
().
selectById
();
//查询考勤机“序列号”
for
(
int
a
=
0
;
a
<
xgyh
.
length
;
a
++){
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"devId"
,
kqj
.
getCode
());
vResultJson
.
put
(
"userId"
,
xgyh
[
a
]);
vResultJson
.
put
(
"privilege"
,
1
);
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
+
"/addUserPrivilege"
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"json"
,
sFinal
);
params
.
add
(
"devId"
,
kqj
.
getCode
());
params
.
add
(
"userId"
,
xgyh
[
a
]);
params
.
add
(
"privilege"
,
1
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
try
{
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
System
.
err
.
print
(
request
.
getBody
());
}
catch
(
RestClientException
e
)
{
System
.
err
.
println
(
"提示:考勤机服务出错"
);
return
ResultUtil
.
success
(
"失败"
);
...
...
@@ -539,20 +538,18 @@ public class TimeCardController {
for
(
int
a
=
0
;
a
<
xgyh
.
length
;
a
++){
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"devId"
,
kqj
.
getCode
());
vResultJson
.
put
(
"userId"
,
xgyh
[
a
]);
vResultJson
.
put
(
"privilege"
,
2
);
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
+
"/addUserPrivilege"
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"json"
,
sFinal
);
params
.
add
(
"devId"
,
kqj
.
getCode
());
params
.
add
(
"userId"
,
xgyh
[
a
]);
params
.
add
(
"privilege"
,
2
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
try
{
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
System
.
err
.
print
(
request
.
getBody
());
}
catch
(
RestClientException
e
)
{
System
.
err
.
println
(
"提示:考勤机服务出错"
);
return
ResultUtil
.
success
(
"失败"
);
...
...
@@ -583,19 +580,16 @@ public class TimeCardController {
if
(!
kqglassokqj
.
insert
())
return
ResultUtil
.
error
(
"操作失败--新增考勤机"
);
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"devId"
,
kqglassokqj
.
getCode
());
vResultJson
.
put
(
"orgCode"
,
userBean
.
getOrgCode
());
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
+
"/addDev"
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"json"
,
sFinal
);
params
.
add
(
"orgCode"
,
kqglassokqj
.
getType
());
params
.
add
(
"devId"
,
kqglassokqj
.
getCode
());
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
try
{
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
System
.
err
.
print
(
request
.
getBody
());
}
catch
(
RestClientException
e
)
{
System
.
err
.
println
(
"提示:考勤机服务出错"
);
return
ResultUtil
.
success
(
"失败"
);
...
...
@@ -944,29 +938,28 @@ public class TimeCardController {
@ApiOperationSupport
(
order
=
39
)
public
Result
<
Integer
>
DelAttendanceGroup
(
@CurrentUser
UserBean
userBean
,
@PathVariable
(
"id"
)
Integer
id
)
{
if
(
KqglMainKqz
.
builder
().
id
(
id
).
build
().
deleteById
())
{
// List<UserAttendanceRel> attusers = userattendancerelservice.selectAttendanceOfficerByKqzid(id, userBean.getOrgCode());//该考勤组人数
// //该考勤组所绑定的考勤机
// List<KqglAssoKqzdkfs> kqjs = kqglassokqzdkfsmapper.selectList(new QueryWrapper<KqglAssoKqzdkfs>().lambda().eq(KqglAssoKqzdkfs::getKqzId, id).eq(KqglAssoKqzdkfs::getType, 1));
// String DevId = "";
// for(KqglAssoKqzdkfs abp:kqjs) {
// KqglAssoKqj kqj = KqglAssoKqj.builder().id(abp.getDkfsid()).build().selectById();//查询考勤机“序列号”
// DevId = kqj.getCode();
// for(UserAttendanceRel user:attusers) {
// String user_id = user.getEmpnum();//"1692";//要删除的考勤组里面用户ID
// JSONObject vResultJson = new JSONObject();
// vResultJson.put("devId", DevId);
// vResultJson.put("userId", user_id);
// String sFinal = vResultJson.toString();
// String url = StaticVariable.mac_command+"/deleteUser";
// HttpHeaders headers = new HttpHeaders();
// MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
// params.add("json", sFinal);
// RestTemplate restTemplate = new RestTemplate();
// HttpEntity httpEntity = new HttpEntity(params, headers);
// ResponseEntity<String> request = restTemplate.postForEntity(url, httpEntity, String.class);
// }
// }
// userequirelationmapper.deleteBykqzid(id);
List
<
UserAttendanceRel
>
attusers
=
userattendancerelmapper
.
selectAttendanceOfficerByKqzid
(
id
,
userBean
.
getOrgCode
());
//该考勤组人数
//该考勤组所绑定的考勤机
List
<
KqglAssoKqzdkfs
>
kqjs
=
kqglassokqzdkfsmapper
.
selectList
(
new
QueryWrapper
<
KqglAssoKqzdkfs
>().
lambda
().
eq
(
KqglAssoKqzdkfs:
:
getKqzId
,
id
).
eq
(
KqglAssoKqzdkfs:
:
getType
,
1
));
String
DevId
=
""
;
for
(
KqglAssoKqzdkfs
abp:
kqjs
)
{
KqglAssoKqj
kqj
=
KqglAssoKqj
.
builder
().
id
(
abp
.
getDkfsid
()).
build
().
selectById
();
//查询考勤机“序列号”
DevId
=
kqj
.
getCode
();
for
(
UserAttendanceRel
user:
attusers
)
{
String
user_id
=
user
.
getEmpnum
();
//"1692";//要删除的考勤组里面用户ID
String
url
=
StaticVariable
.
mac_command
+
"/deleteUser"
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"devId"
,
DevId
);
params
.
add
(
"userId"
,
user_id
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
System
.
err
.
print
(
request
.
getBody
());
}
}
userequirelationmapper
.
deleteBykqzid
(
id
);
//删除考勤组绑定的打卡方式
KqglAssoKqzdkfs
.
builder
().
build
().
delete
(
new
QueryWrapper
<
KqglAssoKqzdkfs
>().
lambda
().
eq
(
KqglAssoKqzdkfs:
:
getKqzId
,
id
));
...
...
@@ -1062,24 +1055,30 @@ public class TimeCardController {
KqglAssoKqj
kqj
=
KqglAssoKqj
.
builder
().
id
(
abp
.
getDkfsid
()).
build
().
selectById
();
KqglAssoYhsb
kqjry
=
KqglAssoYhsb
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoYhsb
>().
lambda
().
eq
(
KqglAssoYhsb:
:
getUserId
,
Integer
.
valueOf
(
attser
[
u
])).
eq
(
KqglAssoYhsb:
:
getKqjid
,
kqj
.
getId
()));
if
(
kqjry
==
null
)
{
KqglAssoYhsb
uskqj
=
KqglAssoYhsb
.
builder
().
userId
(
Integer
.
valueOf
(
attser
[
u
])).
kqjid
(
kqj
.
getId
()).
type
(
1
).
isGly
(
kqjry
.
getIsGly
()).
build
();
KqglAssoYhsb
uskqj
=
KqglAssoYhsb
.
builder
().
userId
(
Integer
.
valueOf
(
attser
[
u
])).
kqjid
(
kqj
.
getId
()).
type
(
1
).
build
();
UserEquiRelation
isgly
=
userequirelationmapper
.
selectByuserId
(
Integer
.
valueOf
(
attser
[
u
]));
if
(
isgly
!=
null
)
{
uskqj
.
setIsGly
(
isgly
.
getIsGly
());
}
else
{
uskqj
.
setIsGly
(
0
);
}
if
(!
uskqj
.
insert
())
return
ResultUtil
.
error
(
"操作失败--新增用户与设备关系"
);
YgglMainEmp
yggluser
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getOrgCode
,
userBean
.
getOrgCode
()).
eq
(
YgglMainEmp:
:
getEmpNum
,
attser
[
u
]));
JSONObject
vResultJson
=
new
JSONObject
();
vResultJson
.
put
(
"devId"
,
kqj
.
getCode
());
vResultJson
.
put
(
"userId"
,
attser
[
u
]);
vResultJson
.
put
(
"userName"
,
yggluser
.
getName
());
String
sFinal
=
vResultJson
.
toString
();
String
url
=
StaticVariable
.
mac_command
+
"/addUserName"
;
HttpHeaders
headers
=
new
HttpHeaders
();
MultiValueMap
<
String
,
Object
>
params
=
new
LinkedMultiValueMap
<>();
params
.
add
(
"json"
,
sFinal
);
params
.
add
(
"devId"
,
kqj
.
getCode
());
params
.
add
(
"userId"
,
attser
[
u
]);
params
.
add
(
"userName"
,
yggluser
.
getName
());
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpEntity
httpEntity
=
new
HttpEntity
(
params
,
headers
);
ResponseEntity
<
String
>
request
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
System
.
err
.
print
(
request
.
getBody
());
}
}
}
...
...
src/main/java/cn/timer/api/dao/kqmk/KqglAssoDkmxMapper.java
View file @
260d2472
...
...
@@ -16,4 +16,6 @@ import cn.timer.api.dto.kqmk.AttSubsidiaryDto;
public
interface
KqglAssoDkmxMapper
extends
BaseMapper
<
KqglAssoDkmx
>
{
AttSubsidiaryDto
subsidiary
(
int
userid
,
String
data
);
int
updateByPrimaryKeySelective
(
KqglAssoDkmx
kqglassodkmx
);
}
src/main/resources/mapping/kqgl/PunchCardDetailsMapper.xml
View file @
260d2472
...
...
@@ -313,7 +313,7 @@
bmgw.post,
dkmx.*
from kqgl_asso_dkmx dkmx
LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid
LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid
and info.org_code = #{qyid,jdbcType=INTEGER}
LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
from zzgl_bmgw_m m
left join zzgl_bmgw_m um on um.id = m.up_id
...
...
@@ -339,7 +339,7 @@
bmgw.post,
dkmx.*
from kqgl_asso_dkmx dkmx
LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid
LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid
and info.org_code = #{qyid,jdbcType=INTEGER}
LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
from zzgl_bmgw_m m
left join zzgl_bmgw_m um on um.id = m.up_id
...
...
src/main/resources/mapping/kqgl/PunchRecordMapper.xml
View file @
260d2472
...
...
@@ -39,7 +39,7 @@
bmgw.post,
info.`name` username
from kqgl_asso_dkjl dkjl
LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id
LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id
and info.org_code = #{param.qyid}
LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
from zzgl_bmgw_m m
left join zzgl_bmgw_m um on um.id = m.up_id
...
...
@@ -308,7 +308,7 @@
bmgw.post,
info.`name` username
from kqgl_asso_dkjl dkjl
LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id
LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id
and info.org_code = #{qyid,jdbcType=INTEGER}
LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
from zzgl_bmgw_m m
left join zzgl_bmgw_m um on um.id = m.up_id
...
...
@@ -323,7 +323,7 @@
bmgw.post,
info.`name` username
from kqgl_asso_dkjl dkjl
LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id
LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id
and info.org_code = #{qyid,jdbcType=INTEGER}
LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
from zzgl_bmgw_m m
left join zzgl_bmgw_m um on um.id = m.up_id
...
...
src/main/resources/mapping/kqmk/KqglAssoDkmxMapper.xml
View file @
260d2472
...
...
@@ -95,6 +95,34 @@
and SUBSTR(dk.`data`,1,7) = #{data}
GROUP BY dk.userid
</select>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"cn.timer.api.bean.kqmk.KqglAssoDkmx"
>
UPDATE kqgl_asso_dkmx
<set>
<if
test =
'null != userid'
>
userid = #{userid},
</if>
<if
test =
'null != data'
>
data = #{data},
</if>
<if
test =
'null != sbdk1'
>
sbdk1 = #{sbdk1},
</if>
<if
test =
'null != sbdk1jg'
>
sbdk1jg = #{sbdk1jg},
</if>
<if
test =
'null != xbdk1'
>
xbdk1 = #{xbdk1},
</if>
<if
test =
'null != xbdk1jg'
>
xbdk1jg = #{xbdk1jg},
</if>
<if
test =
'null != sbdk2'
>
sbdk2 = #{sbdk2},
</if>
<if
test =
'null != sbdk2jg'
>
sbdk2jg = #{sbdk2jg},
</if>
<if
test =
'null != xbdk2'
>
xbdk2 = #{xbdk2},
</if>
<if
test =
'null != xbdk2jg'
>
xbdk2jg = #{xbdk2jg},
</if>
<if
test =
'null != sbdk3'
>
sbdk3 = #{sbdk3},
</if>
<if
test =
'null != sbdk3jg'
>
sbdk3jg = #{sbdk3jg},
</if>
<if
test =
'null != xbdk3'
>
xbdk3 = #{xbdk3},
</if>
<if
test =
'null != xbdk3jg'
>
xbdk3jg = #{xbdk3jg},
</if>
<if
test =
'null != ydkcs'
>
ydkcs = #{ydkcs},
</if>
<if
test =
'null != gzsc'
>
gzsc = #{gzsc},
</if>
<if
test =
'null != qyid'
>
qyid = #{qyid},
</if>
<if
test =
'null != dksj'
>
dksj = #{dksj},
</if>
<if
test =
'null != yzcdcs'
>
yzcdcs = #{yzcdcs},
</if>
<if
test =
'null != yzcdsc'
>
yzcdsc = #{yzcdsc},
</if>
<if
test =
'null != kgcdfzs'
>
kgcdfzs = #{kgcdfzs}
</if>
</set>
WHERE id = #{id}
</update>
<!--
...
...
@@ -237,34 +265,6 @@
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkmx">
UPDATE kqgl_asso_dkmx
<set>
<if test ='null != userid'>userid = #{userid},</if>
<if test ='null != data'>data = #{data},</if>
<if test ='null != sbdk1'>sbdk1 = #{sbdk1},</if>
<if test ='null != sbdk1jg'>sbdk1jg = #{sbdk1jg},</if>
<if test ='null != xbdk1'>xbdk1 = #{xbdk1},</if>
<if test ='null != xbdk1jg'>xbdk1jg = #{xbdk1jg},</if>
<if test ='null != sbdk2'>sbdk2 = #{sbdk2},</if>
<if test ='null != sbdk2jg'>sbdk2jg = #{sbdk2jg},</if>
<if test ='null != xbdk2'>xbdk2 = #{xbdk2},</if>
<if test ='null != xbdk2jg'>xbdk2jg = #{xbdk2jg},</if>
<if test ='null != sbdk3'>sbdk3 = #{sbdk3},</if>
<if test ='null != sbdk3jg'>sbdk3jg = #{sbdk3jg},</if>
<if test ='null != xbdk3'>xbdk3 = #{xbdk3},</if>
<if test ='null != xbdk3jg'>xbdk3jg = #{xbdk3jg},</if>
<if test ='null != ydkcs'>ydkcs = #{ydkcs},</if>
<if test ='null != gzsc'>gzsc = #{gzsc},</if>
<if test ='null != qyid'>qyid = #{qyid},</if>
<if test ='null != dksj'>dksj = #{dksj},</if>
<if test ='null != yzcdcs'>yzcdcs = #{yzcdcs},</if>
<if test ='null != yzcdsc'>yzcdsc = #{yzcdsc},</if>
<if test ='null != kgcdfzs'>kgcdfzs = #{kgcdfzs}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
...
...
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