Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
attendance-performance-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
attendance-performance-platform
Commits
086c28cd
Commit
086c28cd
authored
May 31, 2024
by
姬鋆屾
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.scsmile.cn/zxf/attendance-performance-platform
parents
e202fb1d
8cf1ab7b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
15 deletions
+37
-15
attendance-performance-manager/src/main/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
...in/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
+0
-2
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/service/impl/HikStaffServiceImpl.java
...hx/module/hik/staff/service/impl/HikStaffServiceImpl.java
+15
-9
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/service/impl/StaffServiceImpl.java
...rtals/xhx/module/staff/service/impl/StaffServiceImpl.java
+22
-4
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
View file @
086c28cd
...
@@ -45,8 +45,6 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
...
@@ -45,8 +45,6 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired
@Autowired
private
UserService
userService
;
private
UserService
userService
;
@Autowired
@Autowired
private
IHikPersonService
hikPersonService
;
@Autowired
private
IDingPersonService
dingPersonService
;
private
IDingPersonService
dingPersonService
;
@Value
(
"${hik.host:}"
)
@Value
(
"${hik.host:}"
)
protected
String
hikhost
;
protected
String
hikhost
;
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/service/impl/HikStaffServiceImpl.java
View file @
086c28cd
...
@@ -64,6 +64,8 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
...
@@ -64,6 +64,8 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
//定义接收结果的结构体
//定义接收结果的结构体
HCNetSDK
.
BYTE_ARRAY
ptrOutuff
=
new
HCNetSDK
.
BYTE_ARRAY
(
1024
*
1024
);
HCNetSDK
.
BYTE_ARRAY
ptrOutuff
=
new
HCNetSDK
.
BYTE_ARRAY
(
1024
*
1024
);
IntByReference
pInt
=
new
IntByReference
(
0
);
IntByReference
pInt
=
new
IntByReference
(
0
);
int
recount
=
0
;
while
(
true
)
{
while
(
true
)
{
int
dwState
=
hCNetSDK
.
NET_DVR_SendWithRecvRemoteConfig
(
lHandler
,
ptrInbuff
.
getPointer
(),
strInbuff
.
length
(),
ptrOutuff
.
getPointer
(),
1024
*
1024
,
pInt
);
int
dwState
=
hCNetSDK
.
NET_DVR_SendWithRecvRemoteConfig
(
lHandler
,
ptrInbuff
.
getPointer
(),
strInbuff
.
length
(),
ptrOutuff
.
getPointer
(),
1024
*
1024
,
pInt
);
log
.
info
(
"dwState<=={}"
,
dwState
);
log
.
info
(
"dwState<=={}"
,
dwState
);
...
@@ -73,13 +75,12 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
...
@@ -73,13 +75,12 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
// break;
// break;
}
else
if
(
dwState
==
HCNetSDK
.
NET_SDK_CONFIG_STATUS_NEED_WAIT
)
{
}
else
if
(
dwState
==
HCNetSDK
.
NET_SDK_CONFIG_STATUS_NEED_WAIT
)
{
log
.
info
(
"配置等待"
);
log
.
info
(
"配置等待"
);
if
(
recount
>
3
)
throw
new
AppException
(
"配置等待失败!"
);
try
{
try
{
Thread
.
sleep
(
10
);
Thread
.
sleep
(
1000
);
recount
++;
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
continue
;
}
else
if
(
dwState
==
HCNetSDK
.
NET_SDK_CONFIG_STATUS_FAILED
)
{
}
else
if
(
dwState
==
HCNetSDK
.
NET_SDK_CONFIG_STATUS_FAILED
)
{
log
.
info
(
"查询人员失败"
);
log
.
info
(
"查询人员失败"
);
throw
new
AppException
(
String
.
format
(
"查询人员失败,错误码:%s"
,
HCNetSDK
.
NET_SDK_CONFIG_STATUS_FAILED
));
throw
new
AppException
(
String
.
format
(
"查询人员失败,错误码:%s"
,
HCNetSDK
.
NET_SDK_CONFIG_STATUS_FAILED
));
...
@@ -107,11 +108,13 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
...
@@ -107,11 +108,13 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
}
}
UserSearchInfo
userSearchInfo
=
JSON
.
parseObject
(
resp
,
new
TypeReference
<
UserSearchInfo
>()
{
UserSearchInfo
userSearchInfo
=
JSON
.
parseObject
(
resp
,
new
TypeReference
<
UserSearchInfo
>()
{
});
});
logout
(
hCNetSDK
,
userID
);
//
logout(hCNetSDK,userID);
return
Rest
.
ok
(
userSearchInfo
);
return
Rest
.
ok
(
userSearchInfo
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"获取人员异常"
,
e
);
log
.
error
(
"获取人员异常"
,
e
);
return
Rest
.
fail
(
e
.
getMessage
());
return
Rest
.
fail
(
e
.
getMessage
());
}
finally
{
logout
(
hCNetSDK
,
userID
);
}
}
}
}
...
@@ -150,6 +153,7 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
...
@@ -150,6 +153,7 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
//定义接收结果的结构体
//定义接收结果的结构体
HCNetSDK
.
BYTE_ARRAY
ptrOutuff
=
new
HCNetSDK
.
BYTE_ARRAY
(
1
*
1024
);
HCNetSDK
.
BYTE_ARRAY
ptrOutuff
=
new
HCNetSDK
.
BYTE_ARRAY
(
1
*
1024
);
IntByReference
pInt
=
new
IntByReference
(
0
);
IntByReference
pInt
=
new
IntByReference
(
0
);
int
recount
=
0
;
while
(
true
)
{
while
(
true
)
{
int
dwState
=
hCNetSDK
.
NET_DVR_SendWithRecvRemoteConfig
(
lHandler
,
ptrInbuff
.
getPointer
(),
strInbuff
.
length
(),
ptrOutuff
.
getPointer
(),
1
*
1024
,
pInt
);
int
dwState
=
hCNetSDK
.
NET_DVR_SendWithRecvRemoteConfig
(
lHandler
,
ptrInbuff
.
getPointer
(),
strInbuff
.
length
(),
ptrOutuff
.
getPointer
(),
1
*
1024
,
pInt
);
log
.
info
(
"dwState<=={}"
,
dwState
);
log
.
info
(
"dwState<=={}"
,
dwState
);
...
@@ -159,11 +163,12 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
...
@@ -159,11 +163,12 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
// break;
// break;
}
else
if
(
dwState
==
HCNetSDK
.
NET_SDK_CONFIG_STATUS_NEED_WAIT
)
{
}
else
if
(
dwState
==
HCNetSDK
.
NET_SDK_CONFIG_STATUS_NEED_WAIT
)
{
log
.
info
(
"配置等待"
);
log
.
info
(
"配置等待"
);
if
(
recount
>
3
)
throw
new
AppException
(
"配置等待失败!"
);
try
{
try
{
Thread
.
sleep
(
10
);
Thread
.
sleep
(
1000
);
recount
++;
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
continue
;
continue
;
}
else
if
(
dwState
==
HCNetSDK
.
NET_SDK_CONFIG_STATUS_FAILED
)
{
}
else
if
(
dwState
==
HCNetSDK
.
NET_SDK_CONFIG_STATUS_FAILED
)
{
...
@@ -194,11 +199,12 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
...
@@ -194,11 +199,12 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
UserSearchInfo
userSearchInfo
=
JSON
.
parseObject
(
resp
,
new
TypeReference
<
UserSearchInfo
>()
{
UserSearchInfo
userSearchInfo
=
JSON
.
parseObject
(
resp
,
new
TypeReference
<
UserSearchInfo
>()
{
});
});
logout
(
hCNetSDK
,
userID
);
return
Rest
.
ok
(
userSearchInfo
);
return
Rest
.
ok
(
userSearchInfo
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"获取人员异常"
,
e
);
log
.
error
(
"获取人员异常"
,
e
);
return
Rest
.
fail
(
e
.
getMessage
());
return
Rest
.
fail
(
e
.
getMessage
());
}
finally
{
logout
(
hCNetSDK
,
userID
);
}
}
}
}
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/service/impl/StaffServiceImpl.java
View file @
086c28cd
...
@@ -522,8 +522,10 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
...
@@ -522,8 +522,10 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
Map
<
String
,
StaffEntity
>
staffCollect
=
this
.
find
(
staffQuery
).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getWorkNum
(),
y
->
y
,
(
o
,
n
)
->
n
));
Map
<
String
,
StaffEntity
>
staffCollect
=
this
.
find
(
staffQuery
).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getWorkNum
(),
y
->
y
,
(
o
,
n
)
->
n
));
List
<
DoorEntity
>
doorEntities
=
doorService
.
find
(
new
DoorQuery
());
List
<
DoorEntity
>
doorEntities
=
doorService
.
find
(
new
DoorQuery
());
if
(
ObjectUtils
.
isEmpty
(
doorEntities
))
return
Rest
.
fail
(
"未找到门禁设备!"
);
try
{
try
{
for
(
DoorEntity
doorEntity
:
doorEntities
)
{
DoorEntity
doorEntity
=
doorEntities
.
get
(
0
);
//for (DoorEntity doorEntity : doorEntities) {
StaffReq
staffReq
=
new
StaffReq
();
StaffReq
staffReq
=
new
StaffReq
();
Rest
<
UserSearchInfo
>
personCountRest
=
hikStaffService
.
getPersonCount
(
staffReq
,
doorEntity
);
Rest
<
UserSearchInfo
>
personCountRest
=
hikStaffService
.
getPersonCount
(
staffReq
,
doorEntity
);
if
(
personCountRest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
if
(
personCountRest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
...
@@ -570,12 +572,28 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
...
@@ -570,12 +572,28 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
staffEntity
.
setCreateUserId
(
1L
);
staffEntity
.
setCreateUserId
(
1L
);
staffEntity
.
setCreateTime
(
new
Date
());
staffEntity
.
setCreateTime
(
new
Date
());
this
.
save
(
staffEntity
);
this
.
save
(
staffEntity
);
}
else
{
//更新员工状态
staffEntity
.
setStatus
(
StaffSatusEnum
.
正式
.
getValue
());
staffEntity
.
setUpdateUserId
(
1L
);
staffEntity
.
setUpdateTime
(
new
Date
());
this
.
update
(
staffEntity
);
StaffLeaveQuery
staffLeaveQuery
=
new
StaffLeaveQuery
();
staffLeaveQuery
.
setWorkNum
(
staffEntity
.
getWorkNum
());
StaffLeaveEntity
staffLeaveEntity
=
staffLeaveService
.
selectOne
(
staffLeaveQuery
,
null
);
if
(!
ObjectUtils
.
isEmpty
(
staffEntity
)){
staffLeaveService
.
remove
(
staffLeaveEntity
.
getId
(),
null
);
}
}
}
}
}
}
}
}
}
}
else
{
log
.
info
(
"人员信息为空"
);
throw
new
AppException
(
personCountRest
.
getMsg
());
}
}
}
//
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"同步人员信息失败:{}"
,
e
.
getMessage
());
log
.
error
(
"同步人员信息失败:{}"
,
e
.
getMessage
());
staffCollect
=
new
HashMap
<>();
staffCollect
=
new
HashMap
<>();
...
@@ -623,10 +641,10 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
...
@@ -623,10 +641,10 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
if
(
count
==
0
)
{
if
(
count
==
0
)
{
staffLeaveService
.
save
(
staffLeaveEntity
);
staffLeaveService
.
save
(
staffLeaveEntity
);
}
}
Long
[]
groudStaffIds
=
attendanceGroupStaffService
.
find
(
new
AttendanceGroupStaffQuery
().
staffId
(
staff
.
getId
())).
stream
().
map
(
m
->
m
.
getId
()).
toArray
(
Long
[]::
new
);
/*
Long[] groudStaffIds = attendanceGroupStaffService.find(new AttendanceGroupStaffQuery().staffId(staff.getId())).stream().map(m -> m.getId()).toArray(Long[]::new);
if (!ObjectUtils.isEmpty(groudStaffIds)) {
if (!ObjectUtils.isEmpty(groudStaffIds)) {
attendanceGroupStaffService.remove(groudStaffIds, null);
attendanceGroupStaffService.remove(groudStaffIds, null);
}
}
*/
}
}
});
});
}
}
...
...
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