Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
record
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
record
Commits
38b9285d
Commit
38b9285d
authored
Aug 01, 2022
by
陶湘宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加自定义设置考勤机时间接口
parent
be8bc544
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
3 deletions
+38
-3
src/main/java/com/yl8timer/kqj/yl8timer/ctrl/FkController.java
+18
-0
src/main/java/com/yl8timer/kqj/yl8timer/tools/HSTools.java
+16
-0
src/main/resources/application-pro.yml
+2
-2
src/main/resources/application.yml
+2
-1
No files found.
src/main/java/com/yl8timer/kqj/yl8timer/ctrl/FkController.java
View file @
38b9285d
...
...
@@ -147,6 +147,24 @@ public class FkController {
return
ResultUtil
.
data
(
"设置失败,请联系管理员"
);
}
// 同步考勤机时间
@PostMapping
(
"/setTimer"
)
public
Result
<
String
>
setTime
(
@RequestParam
String
devId
,
@RequestParam
String
time
)
{
FkDev
fkDev
=
FkDev
.
builder
().
build
().
selectOne
(
new
LambdaQueryWrapper
<
FkDev
>().
eq
(
FkDev:
:
getDevId
,
devId
));
if
(
fkDev
!=
null
&&
(
fkDev
.
getOrgCode
()
==
1
||
fkDev
.
getOrgCode
()
==
2
))
{
// 1-浩顺 2-浩顺3代
boolean
result
=
false
;
try
{
result
=
hsTools
.
setTime
(
devId
,
time
);
}
catch
(
Exception
e
)
{
return
ResultUtil
.
error
(
"添加失败,请确认考勤机绑定状态"
);
}
if
(
result
==
false
)
return
ResultUtil
.
data
(
"添加失败"
);
return
ResultUtil
.
data
(
"同步成功"
);
}
else
return
ResultUtil
.
data
(
"设置失败,请联系管理员"
);
}
// 删除考勤机用户
@PostMapping
(
"/deleteUser"
)
public
Result
<
String
>
deleteUser
(
@RequestParam
String
devId
,
@RequestParam
String
userId
)
{
...
...
src/main/java/com/yl8timer/kqj/yl8timer/tools/HSTools.java
View file @
38b9285d
...
...
@@ -1364,6 +1364,22 @@ public class HSTools {
return
result
;
}
public
boolean
setTime
(
String
devId
,
String
time
)
{
String
cmd
=
Command
.
SET_TIME
;
Date
now
=
new
Date
();
Device
dev
=
Device
.
getDevice
(
devId
);
String
jsonStr
=
"{\"time\":\""
+
time
+
"\"}"
;
FkHsRequest
fkHsRequest
=
new
FkHsRequest
();
fkHsRequest
.
setJsonStr
(
jsonStr
);
fkHsRequest
.
setDevId
(
devId
);
fkHsRequest
.
setCommand
(
cmd
);
fkHsRequest
.
setTime
(
now
);
fkHsRequest
.
insert
();
String
transId
=
fkHsRequest
.
getId
().
toString
();
boolean
result
=
dev
.
addCmd
(
cmd
,
jsonStr
,
transId
);
return
result
;
}
public
boolean
setDeleteUser
(
String
devId
,
String
userId
)
{
String
cmd
=
Command
.
DELETE_USER
;
JSONObject
vResultJson
=
new
JSONObject
();
...
...
src/main/resources/application-pro.yml
View file @
38b9285d
...
...
@@ -3,8 +3,8 @@ server:
spring
:
datasource
:
username
:
youling8timer
password
:
(!0YouLing
8Timer
0!)
url
:
jdbc:mysql://
192.168.3.3:33000
/record?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&zeroDateTimeBehavior=CONVERT_TO_NULL
password
:
(!0YouLing
Root
0!)
url
:
jdbc:mysql://
rm-wz950gd8jf8209376.mysql.rds.aliyuncs.com
/record?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&zeroDateTimeBehavior=CONVERT_TO_NULL
driver-class-name
:
com.mysql.cj.jdbc.Driver
jackson
:
time-zone
:
Asia/Shanghai
...
...
src/main/resources/application.yml
View file @
38b9285d
spring
:
profiles
:
active
:
test
active
:
pro
#active: '@environment@'
\ No newline at end of file
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