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
ef048dd1
Commit
ef048dd1
authored
1 year ago
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步人员方法添加
parent
55225d82
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
141 additions
and
102 deletions
+141
-102
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/req/org/OrgListReq.java
...ortals/xhx/module/hik/staff/model/req/org/OrgListReq.java
+0
-11
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/req/staff/StaffReq.java
...ortals/xhx/module/hik/staff/model/req/staff/StaffReq.java
+2
-2
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/rsp/org/OrgDataInfo.java
...rtals/xhx/module/hik/staff/model/rsp/org/OrgDataInfo.java
+0
-13
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/rsp/org/OrgInfo.java
...m/mortals/xhx/module/hik/staff/model/rsp/org/OrgInfo.java
+0
-14
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/rsp/person/PersonDataInfo.java
...xhx/module/hik/staff/model/rsp/person/PersonDataInfo.java
+0
-13
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/rsp/person/PersonInfo.java
...als/xhx/module/hik/staff/model/rsp/person/PersonInfo.java
+0
-23
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/rsp/person/PersonPhoto.java
...ls/xhx/module/hik/staff/model/rsp/person/PersonPhoto.java
+0
-11
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/service/IHikStaffService.java
...ortals/xhx/module/hik/staff/service/IHikStaffService.java
+2
-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
+2
-8
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/service/impl/StaffServiceImpl.java
...rtals/xhx/module/staff/service/impl/StaffServiceImpl.java
+135
-5
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/req/org/OrgListReq.java
deleted
100644 → 0
View file @
55225d82
package
com.mortals.xhx.module.hik.staff.model.req.org
;
import
lombok.Data
;
@Data
public
class
OrgListReq
{
private
String
orgName
;
private
String
orgIndexCodes
;
private
int
pageNo
;
private
int
pageSize
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/req/
person/Person
Req.java
→
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/req/
staff/Staff
Req.java
View file @
ef048dd1
package
com.mortals.xhx.module.hik.staff.model.req.
person
;
package
com.mortals.xhx.module.hik.staff.model.req.
staff
;
import
com.mortals.xhx.module.hik.BaseReq
;
import
lombok.Data
;
...
...
@@ -7,7 +7,7 @@ import java.io.Serializable;
@Data
public
class
Person
Req
extends
BaseReq
implements
Serializable
{
public
class
Staff
Req
extends
BaseReq
implements
Serializable
{
/**
* 当前页
...
...
This diff is collapsed.
Click to expand it.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/rsp/org/OrgDataInfo.java
deleted
100644 → 0
View file @
55225d82
package
com.mortals.xhx.module.hik.staff.model.rsp.org
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
OrgDataInfo
{
private
List
<
OrgInfo
>
list
;
private
Integer
total
;
private
Integer
totalPage
;
private
Integer
pageNo
;
}
This diff is collapsed.
Click to expand it.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/rsp/org/OrgInfo.java
deleted
100644 → 0
View file @
55225d82
package
com.mortals.xhx.module.hik.staff.model.rsp.org
;
import
lombok.Data
;
@Data
public
class
OrgInfo
{
private
String
orgName
;
private
String
orgNo
;
private
String
orgPath
;
private
String
parentOrgIndexCode
;
private
String
orgIndexCode
;
private
String
updateTime
;
private
String
parentOrgName
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/rsp/person/PersonDataInfo.java
deleted
100644 → 0
View file @
55225d82
package
com.mortals.xhx.module.hik.staff.model.rsp.person
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
PersonDataInfo
{
private
List
<
PersonInfo
>
list
;
private
Integer
total
;
private
Integer
totalPage
;
private
Integer
pageNo
;
}
This diff is collapsed.
Click to expand it.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/rsp/person/PersonInfo.java
deleted
100644 → 0
View file @
55225d82
package
com.mortals.xhx.module.hik.staff.model.rsp.person
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
PersonInfo
{
private
String
personId
;
private
String
personName
;
private
int
gender
;
private
String
orgPath
;
private
String
orgIndexCode
;
private
String
orgName
;
private
int
certificateType
;
private
String
certificateNo
;
@JSONField
(
format
=
"yyyy-MM-dd'T'HH:mm:ssXXX"
)
private
Date
updateTime
;
private
String
phoneNo
;
private
PersonPhoto
personPhoto
;
private
String
jobNo
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/model/rsp/person/PersonPhoto.java
deleted
100644 → 0
View file @
55225d82
package
com.mortals.xhx.module.hik.staff.model.rsp.person
;
import
lombok.Data
;
@Data
public
class
PersonPhoto
{
private
String
personPhotoIndexCode
;
private
String
picUri
;
private
String
personId
;
private
String
serverIndexCode
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/service/IHikStaffService.java
View file @
ef048dd1
...
...
@@ -3,7 +3,7 @@ package com.mortals.xhx.module.hik.staff.service;
import
com.mortals.framework.common.Rest
;
import
com.mortals.xhx.module.door.model.DoorEntity
;
import
com.mortals.xhx.module.hik.staff.model.req.
person.Person
Req
;
import
com.mortals.xhx.module.hik.staff.model.req.
staff.Staff
Req
;
import
com.mortals.xhx.module.hik.staff.model.rsp.person.PersonDataInfo
;
import
com.mortals.xhx.module.hik.staff.model.rsp.staff.search.UserSearchInfo
;
...
...
@@ -21,7 +21,7 @@ public interface IHikStaffService {
* @param personReq
* @return
*/
Rest
<
UserSearchInfo
>
getPersonList
(
Person
Req
personReq
,
DoorEntity
doorEntity
);
Rest
<
UserSearchInfo
>
getPersonList
(
Staff
Req
personReq
,
DoorEntity
doorEntity
);
...
...
This diff is collapsed.
Click to expand it.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/hik/staff/service/impl/HikStaffServiceImpl.java
View file @
ef048dd1
...
...
@@ -3,16 +3,12 @@ package com.mortals.xhx.module.hik.staff.service.impl;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.hikvision.artemis.sdk.ArtemisHttpUtil
;
import
com.hikvision.artemis.sdk.config.ArtemisConfig
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.xhx.hikdoor.Acs.AcsMain
;
import
com.mortals.xhx.hikdoor.NetSDKDemo.HCNetSDK
;
import
com.mortals.xhx.module.door.model.DoorEntity
;
import
com.mortals.xhx.module.hik.AbstractHikService
;
import
com.mortals.xhx.module.hik.HikApiRest
;
import
com.mortals.xhx.module.hik.staff.model.req.person.PersonReq
;
import
com.mortals.xhx.module.hik.staff.model.req.staff.StaffReq
;
import
com.mortals.xhx.module.hik.staff.model.rsp.person.PersonDataInfo
;
import
com.mortals.xhx.module.hik.staff.model.rsp.staff.search.UserSearchInfo
;
import
com.mortals.xhx.module.hik.staff.service.IHikStaffService
;
...
...
@@ -22,8 +18,6 @@ import org.json.JSONObject;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 海康人员接口类
...
...
@@ -37,7 +31,7 @@ public class HikStaffServiceImpl extends AbstractHikService implements IHikStaff
//查询所有人员
@Override
public
Rest
<
UserSearchInfo
>
getPersonList
(
Person
Req
personReq
,
DoorEntity
doorEntity
)
{
public
Rest
<
UserSearchInfo
>
getPersonList
(
Staff
Req
personReq
,
DoorEntity
doorEntity
)
{
//todo 新的链接设备
HCNetSDK
hCNetSDK
=
createSDKInstance
();
initLoadSdk
(
hCNetSDK
);
...
...
This diff is collapsed.
Click to expand it.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/service/impl/StaffServiceImpl.java
View file @
ef048dd1
...
...
@@ -23,10 +23,18 @@ import com.mortals.xhx.module.attendance.service.AttendanceVacationBalanceServic
import
com.mortals.xhx.module.dept.model.DeptEntity
;
import
com.mortals.xhx.module.dept.model.DeptQuery
;
import
com.mortals.xhx.module.dept.service.DeptService
;
import
com.mortals.xhx.module.door.model.DoorEntity
;
import
com.mortals.xhx.module.door.model.DoorQuery
;
import
com.mortals.xhx.module.door.service.DoorService
;
import
com.mortals.xhx.module.hik.person.model.req.person.PersonReq
;
import
com.mortals.xhx.module.hik.person.model.rsp.person.PersonDataInfo
;
import
com.mortals.xhx.module.hik.person.model.rsp.person.PersonInfo
;
import
com.mortals.xhx.module.hik.person.service.IHikPersonService
;
import
com.mortals.xhx.module.hik.staff.model.req.staff.StaffReq
;
import
com.mortals.xhx.module.hik.staff.model.rsp.staff.search.UserInfoItem
;
import
com.mortals.xhx.module.hik.staff.model.rsp.staff.search.UserInfoSearch
;
import
com.mortals.xhx.module.hik.staff.model.rsp.staff.search.UserSearchInfo
;
import
com.mortals.xhx.module.hik.staff.service.IHikStaffService
;
import
com.mortals.xhx.module.staff.dao.StaffDao
;
import
com.mortals.xhx.module.staff.dao.ibatis.StaffDaoImpl
;
import
com.mortals.xhx.module.staff.dao.ibatis.StaffLeaveDaoImpl
;
...
...
@@ -70,17 +78,20 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
@Autowired
private
IHikPersonService
hikPersonService
;
@Autowired
private
IHikStaffService
hikStaffService
;
@Autowired
private
AttendanceStatService
attendanceStatService
;
@Autowired
private
AttendanceVacationBalanceService
balanceService
;
@Autowired
private
IdgeneratorService
idgeneratorService
;
@Autowired
private
StaffLeaveService
staffLeaveService
;
@Autowired
private
AttendanceGroupStaffService
attendanceGroupStaffService
;
@Autowired
private
DoorService
doorService
;
@Override
protected
String
getExtKey
(
StaffEntity
data
)
{
...
...
@@ -133,6 +144,126 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
@Override
public
Rest
<
Void
>
syncPersons
(
Context
context
)
{
log
.
info
(
"同步人员!"
);
//todo 门禁获取人员
List
<
DoorEntity
>
doorEntities
=
doorService
.
find
(
new
DoorQuery
());
for
(
DoorEntity
doorEntity
:
doorEntities
)
{
StaffReq
staffReq
=
new
StaffReq
();
Rest
<
UserSearchInfo
>
rest
=
hikStaffService
.
getPersonList
(
staffReq
,
doorEntity
);
if
(
rest
.
getCode
()==
YesNoEnum
.
YES
.
getValue
()){
//做差集 更新本地用户为离职员工
StaffQuery
staffQuery
=
new
StaffQuery
();
staffQuery
.
setSource
(
1
);
staffQuery
.
setStatusNotList
(
Arrays
.
asList
(
StaffSatusEnum
.
离职
.
getValue
()));
Map
<
String
,
StaffEntity
>
staffCollect
=
this
.
find
(
staffQuery
).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getWorkNum
(),
y
->
y
,
(
o
,
n
)
->
n
));
UserInfoSearch
userInfoSearch
=
rest
.
getData
().
getUserInfoSearch
();
List
<
UserInfoItem
>
userInfoList
=
userInfoSearch
.
getUserInfo
();
for
(
UserInfoItem
userInfoItem
:
userInfoList
)
{
if
(
ObjectUtils
.
isEmpty
(
userInfoItem
.
getEmployeeNo
()))
{
log
.
info
(
"EmployeeNo is null ==>{}"
,
JSON
.
toJSONString
(
userInfoItem
));
continue
;
}
if
(
staffCollect
.
containsKey
(
userInfoItem
.
getEmployeeNo
()))
{
staffCollect
.
remove
(
userInfoItem
.
getEmployeeNo
());
}
StaffEntity
staffEntity
=
this
.
getExtCache
(
StrUtil
.
padPre
(
userInfoItem
.
getEmployeeNo
(),
8
,
"0"
));
DeptEntity
deptEntity
=
deptService
.
selectOne
(
new
DeptQuery
().
deptCode
(
userInfoItem
.
getBelongGroup
()));
//判断本地数据是否为空
if
(
ObjectUtils
.
isEmpty
(
staffEntity
))
{
//新增员工信息
staffEntity
=
new
StaffEntity
();
staffEntity
.
initAttrValue
();
if
(!
ObjectUtils
.
isEmpty
(
deptEntity
))
{
staffEntity
.
setDeptId
(
deptEntity
.
getId
());
}
staffEntity
.
setName
(
userInfoItem
.
getName
());
staffEntity
.
setDeptName
(
userInfoItem
.
getBelongGroup
());
staffEntity
.
setGender
(
"male"
.
equals
(
userInfoItem
.
getGender
())?
1
:
2
);
staffEntity
.
setWorkNum
(
userInfoItem
.
getEmployeeNo
());
staffEntity
.
setCreateUserId
(
1L
);
staffEntity
.
setCreateTime
(
new
Date
());
this
.
save
(
staffEntity
);
}
else
{
//更新
if
(!
ObjectUtils
.
isEmpty
(
deptEntity
))
{
staffEntity
.
setDeptId
(
deptEntity
.
getId
());
}
staffEntity
.
setName
(
userInfoItem
.
getName
());
staffEntity
.
setDeptName
(
userInfoItem
.
getBelongGroup
());
staffEntity
.
setGender
(
"male"
.
equals
(
userInfoItem
.
getGender
())?
1
:
2
);
staffEntity
.
setWorkNum
(
userInfoItem
.
getEmployeeNo
());
staffEntity
.
setUpdateUserId
(
1L
);
staffEntity
.
setUpdateTime
(
new
Date
());
this
.
update
(
staffEntity
);
}
}
if
(
staffCollect
.
size
()
>
0
)
{
//需要将此人员变更为离职
staffCollect
.
entrySet
().
stream
().
forEach
(
item
->
{
String
key
=
item
.
getKey
();
if
(!
ObjectUtils
.
isEmpty
(
key
))
{
StaffEntity
staff
=
item
.
getValue
();
staff
.
setStatus
(
StaffSatusEnum
.
离职
.
getValue
());
staff
.
setUpdateTime
(
new
Date
());
staff
.
setUpdateUserId
(
1L
);
this
.
update
(
staff
);
//新增离职人员
StaffLeaveEntity
staffLeaveEntity
=
new
StaffLeaveEntity
();
staffLeaveEntity
.
initAttrValue
();
staffLeaveEntity
.
setStaffId
(
staff
.
getId
());
staffLeaveEntity
.
setStaffName
(
staff
.
getName
());
staffLeaveEntity
.
setGender
(
staff
.
getGender
());
staffLeaveEntity
.
setBirthday
(
staff
.
getBirthday
());
staffLeaveEntity
.
setPhotoPath
(
staff
.
getPhotoPath
());
staffLeaveEntity
.
setPhoneNumber
(
staff
.
getPhoneNumber
());
staffLeaveEntity
.
setIdCard
(
staff
.
getIdCard
());
staffLeaveEntity
.
setWorkNum
(
staff
.
getWorkNum
());
staffLeaveEntity
.
setPoliticalstatus
(
staff
.
getPoliticalstatus
());
staffLeaveEntity
.
setDeptId
(
staff
.
getDeptId
());
staffLeaveEntity
.
setDeptName
(
staff
.
getDeptName
());
staffLeaveEntity
.
setJobId
(
staff
.
getPositionId
());
staffLeaveEntity
.
setJobName
(
staff
.
getPositionName
());
staffLeaveEntity
.
setStaffType
(
staff
.
getStaffType
());
staffLeaveEntity
.
setStatus
(
StaffSatusEnum
.
离职
.
getValue
());
staffLeaveEntity
.
setLeaveDate
(
new
Date
());
staffLeaveEntity
.
setLeaveReason
(
""
);
staffLeaveEntity
.
setAuditStatus
(
AuditStatusEnum
.
通过
.
getValue
());
staffLeaveEntity
.
setCreateUserId
(
1L
);
staffLeaveEntity
.
setCreateTime
(
new
Date
());
StaffLeaveQuery
staffLeaveQuery
=
new
StaffLeaveQuery
();
staffLeaveQuery
.
setWorkNum
(
staff
.
getWorkNum
());
int
count
=
staffLeaveService
.
count
(
staffLeaveQuery
,
null
);
if
(
count
==
0
)
{
staffLeaveService
.
save
(
staffLeaveEntity
);
}
//考勤人员中有离职的 删除
// List<AttendanceGroupStaffEntity> attendanceGroupStaffEntities = attendanceGroupStaffService.find(new AttendanceGroupStaffQuery().staffId(staff.getId()));
// if (!ObjectUtils.isEmpty(attendanceGroupStaffEntities)) {
// attendanceGroupStaffService.removeList(attendanceGroupStaffEntities,context);
// }
Long
[]
groudStaffIds
=
attendanceGroupStaffService
.
find
(
new
AttendanceGroupStaffQuery
().
staffId
(
staff
.
getId
())).
stream
().
map
(
i
->
i
.
getId
()).
toArray
(
Long
[]::
new
);
if
(!
ObjectUtils
.
isEmpty
(
groudStaffIds
))
{
attendanceGroupStaffService
.
remove
(
groudStaffIds
,
null
);
}
}
});
}
}
else
{
}
}
/*
PersonReq personReq = new PersonReq();
personReq.setPageNo(1);
...
...
@@ -247,14 +378,14 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
// if (!ObjectUtils.isEmpty(attendanceGroupStaffEntities)) {
// attendanceGroupStaffService.removeList(attendanceGroupStaffEntities,context);
// }
Long
[]
groudStaffIds
=
attendanceGroupStaffService
.
find
(
new
AttendanceGroupStaffQuery
().
staffId
(
staff
.
getId
())).
stream
().
map
(
i
->
i
.
getId
()).
toArray
(
Long
[]::
new
);
Long[] groudStaffIds = attendanceGroupStaffService.find(new AttendanceGroupStaffQuery().staffId(staff.getId())).stream().map(i
->
i.getId()).toArray(Long[]::new);
if (!ObjectUtils.isEmpty(groudStaffIds)) {
attendanceGroupStaffService.remove(groudStaffIds, null);
}
}
});
}
}
}
*/
return
Rest
.
ok
();
}
...
...
@@ -344,7 +475,6 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
}
@Override
protected
StaffEntity
findBefore
(
StaffEntity
params
,
PageInfo
pageInfo
,
Context
context
)
throws
AppException
{
if
(
params
.
getDeptId
()
!=
null
)
{
...
...
This diff is collapsed.
Click to expand it.
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