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
2b9f34ca
Commit
2b9f34ca
authored
Mar 25, 2025
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加钉钉对接流程代码
parent
1a468742
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
209 additions
and
141 deletions
+209
-141
attendance-performance-manager/pom.xml
attendance-performance-manager/pom.xml
+2
-2
attendance-performance-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/StartedService.java
...mortals/xhx/daemon/applicationservice/StartedService.java
+41
-1
attendance-performance-manager/src/main/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
...in/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
+70
-87
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceGroupServiceImpl.java
...e/attendance/service/impl/AttendanceGroupServiceImpl.java
+3
-13
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceRecordHikServiceImpl.java
...tendance/service/impl/AttendanceRecordHikServiceImpl.java
+4
-8
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceRecordHikController.java
.../module/attendance/web/AttendanceRecordHikController.java
+43
-9
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dingding/attendance/service/impl/DingAttendanceServiceImpl.java
...ng/attendance/service/impl/DingAttendanceServiceImpl.java
+1
-4
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dingding/personal/service/impl/DingPersonServiceImpl.java
...dingding/personal/service/impl/DingPersonServiceImpl.java
+5
-4
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/web/StaffController.java
...ava/com/mortals/xhx/module/staff/web/StaffController.java
+34
-6
attendance-performance-manager/src/test/java/com/mortals/httpclient/system.http
...-manager/src/test/java/com/mortals/httpclient/system.http
+6
-7
No files found.
attendance-performance-manager/pom.xml
View file @
2b9f34ca
...
...
@@ -164,8 +164,8 @@
<profiles.sms.smsSendUrl>
http://sms.wx3.com.cn/api/index/index
</profiles.sms.smsSendUrl>
<profiles.sms.apiId>
ADsUXLrS81vZDU95
</profiles.sms.apiId>
<profiles.dingtalk.domain>
https://oapi.dingtalk.com
</profiles.dingtalk.domain>
<profiles.dingtalk.oaScheme>
http
</profiles.dingtalk.oaScheme>
<profiles.dingtalk.oaUrl>
https://
oapi.dingtalk.com
</profiles.dingtalk.oaUrl>
<profiles.dingtalk.oaScheme>
http
s
</profiles.dingtalk.oaScheme>
<profiles.dingtalk.oaUrl>
oapi.dingtalk.com
</profiles.dingtalk.oaUrl>
<profiles.dingtalk.agentId>
2652674890
</profiles.dingtalk.agentId>
<profiles.dingtalk.appKey>
dingvbzaw1176pbzo1zx
</profiles.dingtalk.appKey>
<profiles.dingtalk.appSecret>
jmKqKPDLR3BxdZT_QNX4pm6zDdtbaLI3PtsFymQ6tUle-uKUgmxtr_a6ys3b8v3Y
</profiles.dingtalk.appSecret>
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/StartedService.java
View file @
2b9f34ca
package
com.mortals.xhx.daemon.applicationservice
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
...
...
@@ -9,6 +11,7 @@ import com.mortals.framework.common.Rest;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.springcloud.service.IApplicationStartedService
;
import
com.mortals.framework.util.DataUtil
;
import
com.mortals.framework.util.ThreadPool
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.common.code.AttendSourceTypeEnum
;
import
com.mortals.xhx.common.code.AttendanceTypeEnum
;
...
...
@@ -69,16 +72,53 @@ public class StartedService implements IApplicationStartedService {
private
AttendanceClassService
attendanceClassService
;
@Autowired
private
AttendanceClassDetailService
attendanceClassDetailService
;
@Autowired
private
AttendanceLeaveRecordService
attendanceLeaveRecordService
;
private
void
checkDingDingEvent
(
DateTime
attendStart
,
DateTime
attendEnd
,
AttendanceRecordHikQuery
hikEntity
)
{
log
.
info
(
"开始同步钉钉请假事件!"
);
long
between
=
DateUtil
.
between
(
attendStart
,
attendEnd
,
DateUnit
.
DAY
,
true
);
AttendanceLeaveRecordQuery
query
=
new
AttendanceLeaveRecordQuery
();
query
.
setStartTimeStart
(
hikEntity
.
getAttendanceDateStart
());
query
.
setEndTimeEnd
(
hikEntity
.
getAttendanceDateEnd
());
// if (between > 120) return;
new
Thread
(()->{
attendanceLeaveRecordService
.
syncLeaveRecord
(
query
,
null
);
}).
start
();
/* Runnable runnable = new Runnable() {
@Override
public void run() {
attendanceLeaveRecordService.syncLeaveRecord(query, null);
}
};
ThreadPool.getInstance().execute(runnable);*/
}
@Override
public
void
start
()
{
log
.
info
(
"开始服务..[配置已加载完成,并且所有框架都已经初始化]"
);
//deptService.syncDeptByDingTalk(null);
//staffService.syncPersonsByDingTalk(null);
/* String attendStart = "2025-02-01 00:00:00";
groupService
.
syncGroupByDingTalk
();
String attendEnd = "2025-02-26 23:59:59";
AttendanceRecordHikQuery hikQuery = new AttendanceRecordHikQuery();
hikQuery.setAttendanceDateStart(attendStart);
hikQuery.setAttendanceDateEnd(attendEnd);
checkDingDingEvent(DateUtil.parseDateTime(attendStart), DateUtil.parseDateTime(attendEnd), hikQuery);
*/
// groupService.syncGroupByDingTalk();
//获取排班信息
/* Rest<List<OapiAttendanceShiftListResponse.TopMinimalismShiftVo>> rest = dingAttenanceService.getShiftList(0L);
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/daemon/task/SyncUserTaskImpl.java
View file @
2b9f34ca
...
...
@@ -66,44 +66,7 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
log
.
info
(
"同步用户"
);
staffService
.
syncPersons
(
null
);
log
.
info
(
"同步钉钉usreId"
);
try
{
List
<
UserEntity
>
userList
=
userService
.
getCacheList
().
stream
()
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
f
.
getCustomerId
()))
.
filter
(
f
->
ObjectUtils
.
isEmpty
(
f
.
getDingUserId
())).
collect
(
Collectors
.
toList
());
List
<
UserEntity
>
updateUserList
=
userList
.
stream
().
map
(
item
->
{
UserEntity
userEntity
=
new
UserEntity
();
userEntity
.
setId
(
item
.
getId
());
String
mobile
=
""
;
StaffEntity
staffCache
=
staffService
.
getCache
(
item
.
getCustomerId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
staffCache
)
&&
!
ObjectUtils
.
isEmpty
(
staffCache
.
getPhoneNumber
()))
{
mobile
=
staffCache
.
getPhoneNumber
();
if
(
ObjectUtils
.
isEmpty
(
item
.
getMobile
()))
{
userEntity
.
setMobile
(
mobile
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
mobile
))
{
Rest
<
String
>
personByMobile
=
dingPersonService
.
getPersonByMobile
(
mobile
);
if
(!
ObjectUtils
.
isEmpty
(
personByMobile
)
&&
YesNoEnum
.
YES
.
getValue
()
==
personByMobile
.
getCode
()
&&
!
ObjectUtils
.
isEmpty
(
personByMobile
.
getData
()))
{
userEntity
.
setDingUserId
(
personByMobile
.
getData
());
}
}
userEntity
.
setUpdateTime
(
new
Date
());
userEntity
.
setUpdateUserId
(
1L
);
return
userEntity
;
}).
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
f
.
getDingUserId
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
updateUserList
))
{
log
.
info
(
"更新用户钉钉id信息数量:{}"
,
updateUserList
.
size
());
userService
.
getUserDao
().
updateBatch
(
updateUserList
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"同步钉钉usreId失败"
);
}
syncDingDingUserIds
();
}
else
if
(
AttendSourceTypeEnum
.
海康考勤机
.
getValue
().
equals
(
sourceType
))
{
log
.
info
(
"设备直连同步人员信息"
);
staffService
.
syncPersonsByDevices
(
null
);
...
...
@@ -112,66 +75,86 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
//钉钉
log
.
info
(
"同步钉钉部门"
);
deptService
.
syncDeptByDingTalk
(
null
);
//同步钉钉人员
//同步钉钉人员
staffService
.
syncPersonsByDingTalk
(
null
);
log
.
info
(
"同步钉钉usreId"
);
syncDingDingLocalUserIds
();
log
.
info
(
"钉钉直连同步人员信息"
);
}
else
{
log
.
info
(
"未配置考勤源类型!"
);
}
/*
}
private
void
syncDingDingUserIds
()
{
try
{
if (!ObjectUtils.isEmpty(hikhost)) {
log.info("同步部门");
deptService.syncDept(null);
log.info("同步用户");
staffService.syncPersons(null);
log.info("同步钉钉usreId");
try {
List<UserEntity> userList = userService.getCacheList().stream()
.filter(f -> !ObjectUtils.isEmpty(f.getCustomerId()))
.filter(f -> ObjectUtils.isEmpty(f.getDingUserId())).collect(Collectors.toList());
List<UserEntity> updateUserList = userList.stream().map(item -> {
UserEntity userEntity = new UserEntity();
userEntity.setId(item.getId());
String mobile = "";
StaffEntity staffCache = staffService.getCache(item.getCustomerId().toString());
if (!ObjectUtils.isEmpty(staffCache) && !ObjectUtils.isEmpty(staffCache.getPhoneNumber())) {
mobile = staffCache.getPhoneNumber();
if (ObjectUtils.isEmpty(item.getMobile())) {
userEntity.setMobile(mobile);
}
}
if (!ObjectUtils.isEmpty(mobile)) {
Rest<String> personByMobile = dingPersonService.getPersonByMobile(mobile);
if (!ObjectUtils.isEmpty(personByMobile) &&
YesNoEnum.YES.getValue() == personByMobile.getCode()
&& !ObjectUtils.isEmpty(personByMobile.getData())) {
userEntity.setDingUserId(personByMobile.getData());
}
}
userEntity.setUpdateTime(new Date());
userEntity.setUpdateUserId(1L);
return userEntity;
}).filter(f -> !ObjectUtils.isEmpty(f.getDingUserId())).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(updateUserList)) {
log.info("更新用户钉钉id信息数量:{}", updateUserList.size());
userService.getUserDao().updateBatch(updateUserList);
List
<
UserEntity
>
userList
=
userService
.
getCacheList
().
stream
()
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
f
.
getCustomerId
()))
.
filter
(
f
->
ObjectUtils
.
isEmpty
(
f
.
getDingUserId
())).
collect
(
Collectors
.
toList
());
List
<
UserEntity
>
updateUserList
=
userList
.
stream
().
map
(
item
->
{
UserEntity
userEntity
=
new
UserEntity
();
userEntity
.
setId
(
item
.
getId
());
String
mobile
=
""
;
StaffEntity
staffCache
=
staffService
.
getCache
(
item
.
getCustomerId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
staffCache
)
&&
!
ObjectUtils
.
isEmpty
(
staffCache
.
getPhoneNumber
()))
{
mobile
=
staffCache
.
getPhoneNumber
();
if
(
ObjectUtils
.
isEmpty
(
item
.
getMobile
()))
{
userEntity
.
setMobile
(
mobile
);
}
} catch (Exception e) {
log.error("同步钉钉usreId失败");
}
} else {
log.info("设备直连同步人员信息");
staffService.syncPersonsByDevices(null);
if
(!
ObjectUtils
.
isEmpty
(
mobile
))
{
Rest
<
String
>
personByMobile
=
dingPersonService
.
getPersonByMobile
(
mobile
);
if
(!
ObjectUtils
.
isEmpty
(
personByMobile
)
&&
YesNoEnum
.
YES
.
getValue
()
==
personByMobile
.
getCode
()
&&
!
ObjectUtils
.
isEmpty
(
personByMobile
.
getData
()))
{
userEntity
.
setDingUserId
(
personByMobile
.
getData
());
}
}
userEntity
.
setUpdateTime
(
new
Date
());
userEntity
.
setUpdateUserId
(
1L
);
return
userEntity
;
}).
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
f
.
getDingUserId
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
updateUserList
))
{
log
.
info
(
"更新用户钉钉id信息数量:{}"
,
updateUserList
.
size
());
userService
.
getUserDao
().
updateBatch
(
updateUserList
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"同步钉钉usreId失败"
);
}
}
private
void
syncDingDingLocalUserIds
()
{
try
{
List
<
UserEntity
>
userList
=
userService
.
getCacheList
().
stream
()
.
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
f
.
getCustomerId
()))
.
filter
(
f
->
ObjectUtils
.
isEmpty
(
f
.
getDingUserId
())).
collect
(
Collectors
.
toList
());
List
<
UserEntity
>
updateUserList
=
userList
.
stream
().
map
(
item
->
{
UserEntity
userEntity
=
new
UserEntity
();
userEntity
.
setId
(
item
.
getId
());
StaffEntity
staffCache
=
staffService
.
getCache
(
item
.
getCustomerId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
staffCache
)
)
{
userEntity
.
setDingUserId
(
staffCache
.
getWorkNum
());
}
userEntity
.
setUpdateTime
(
new
Date
());
userEntity
.
setUpdateUserId
(
1L
);
return
userEntity
;
}).
filter
(
f
->
!
ObjectUtils
.
isEmpty
(
f
.
getDingUserId
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
updateUserList
))
{
log
.
info
(
"更新用户钉钉id信息数量:{}"
,
updateUserList
.
size
());
userService
.
getUserDao
().
updateBatch
(
updateUserList
);
}
}
catch
(
Exception
e
)
{
log.error("同步
人事异常", e
);
}
*/
log
.
error
(
"同步
钉钉usreId失败"
);
}
}
@Override
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceGroupServiceImpl.java
View file @
2b9f34ca
...
...
@@ -106,7 +106,6 @@ public class AttendanceGroupServiceImpl extends AbstractCRUDServiceImpl<Attendan
String
groupName
=
group
.
getGroupName
();
Long
memberCount
=
group
.
getMemberCount
();
String
type
=
group
.
getType
();
AttendanceGroupQuery
groupQuery
=
new
AttendanceGroupQuery
();
groupQuery
.
setRemark
(
groupId
.
toString
());
AttendanceGroupEntity
attendanceGroupEntity
=
this
.
selectOne
(
groupQuery
);
...
...
@@ -129,31 +128,22 @@ public class AttendanceGroupServiceImpl extends AbstractCRUDServiceImpl<Attendan
}
this
.
save
(
attendanceGroupEntity
);
//
AttendanceGroupFixedworkEntity
attendanceGroupFixedworkEntity
=
fixedworkService
.
selectOne
(
new
AttendanceGroupFixedworkQuery
().
groupId
(
attendanceGroupEntity
.
getId
()));
//
todo 保存考勤组班次
/*
AttendanceGroupFixedworkEntity attendanceGroupFixedworkEntity = fixedworkService.selectOne(new AttendanceGroupFixedworkQuery().groupId(attendanceGroupEntity.getId()));
if(ObjectUtils.isEmpty(attendanceGroupFixedworkEntity)){
//todo 默认班次1
attendanceGroupFixedworkEntity = new AttendanceGroupFixedworkEntity();
attendanceGroupFixedworkEntity.initAttrValue();
attendanceGroupFixedworkEntity.setGroupId(attendanceGroupEntity.getId());
attendanceGroupFixedworkEntity.setGroupName(attendanceGroupEntity.getGroupName());
attendanceGroupFixedworkEntity.setMonday(1);
attendanceGroupFixedworkEntity.setMondayClassName("早晚");
}
}*/
}
}
}
//保存考勤组人员
AttendanceGroupQuery
attendanceGroupQuery
=
new
AttendanceGroupQuery
();
attendanceGroupQuery
.
setAttendanceType
(
AttendanceTypeEnum
.
钉钉打卡
.
getValue
());
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceRecordHikServiceImpl.java
View file @
2b9f34ca
...
...
@@ -740,19 +740,17 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
List
<
String
>
userLists
=
staffService
.
find
(
new
StaffQuery
()).
stream
().
map
(
i
->
i
.
getWorkNum
()).
collect
(
Collectors
.
toList
());
List
<
List
<
String
>>
partition
=
Lists
.
partition
(
userLists
,
10
);
for
(
List
<
String
>
userList
:
partition
)
{
hikQuery
.
setAttendanceDateStart
(
DateUtil
.
parseDate
(
hikQuery
.
getAttendanceDateStart
()).
toString
());
hikQuery
.
setAttendanceDateEnd
(
DateUtil
.
parseDate
(
hikQuery
.
getAttendanceDateEnd
()).
toString
());
Rest
<
List
<
OapiAttendanceListResponse
.
Recordresult
>>
rest
=
dingAttenanceService
.
getAttendanceList
(
pageInfo
,
userList
,
hikQuery
);
if
(
rest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
List
<
AttendanceRecordHikEntity
>
attendanceList
=
rest
.
getData
().
stream
().
map
(
item
->
{
List
<
AttendanceRecordHikEntity
>
attendanceList
=
rest
.
getData
().
stream
()
.
filter
(
f
->
!
"NotSigned"
.
equalsIgnoreCase
(
f
.
getTimeResult
()))
.
map
(
item
->
{
AttendanceRecordHikEntity
recordHikEntity
=
new
AttendanceRecordHikEntity
();
recordHikEntity
.
initAttrValue
();
if
(
ObjectUtils
.
isEmpty
(
item
.
getUserId
()))
{
log
.
info
(
"jobNo is null ==>{}"
,
JSON
.
toJSONString
(
item
));
return
null
;
...
...
@@ -762,13 +760,11 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
workNum
=
StrUtil
.
padPre
(
item
.
getUserId
(),
8
,
"0"
);
}
StaffEntity
staffCache
=
staffService
.
getExtCache
(
workNum
);
// StaffEntity staffCache = staffService.getExtCache(StrUtil.padPre(item.getUserId(), 8, "0"));
if
(
ObjectUtils
.
isEmpty
(
staffCache
))
{
log
.
info
(
"staff is null !worknum:{}"
,
item
.
getUserId
());
return
null
;
}
recordHikEntity
.
setStaffId
(
staffCache
.
getId
());
recordHikEntity
.
setStaffName
(
staffCache
.
getName
());
recordHikEntity
.
setWorkNum
(
staffCache
.
getWorkNum
());
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceRecordHikController.java
View file @
2b9f34ca
...
...
@@ -17,6 +17,7 @@ import com.mortals.framework.utils.ServletUtils;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.common.code.AttendSourceTypeEnum
;
import
com.mortals.xhx.common.key.RedisKey
;
import
com.mortals.xhx.common.keys.RedisCacheKeys
;
import
com.mortals.xhx.common.utils.AddAttendThread
;
...
...
@@ -85,6 +86,8 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
private
ICacheService
cacheService
;
@Value
(
"${hik.host:}"
)
protected
String
hikhost
;
@Value
(
"${source.type:''}"
)
protected
String
sourceType
;
@Autowired
private
DoorService
doorService
;
...
...
@@ -229,12 +232,40 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
Long
compare
=
DateUtil
.
between
(
attendEnd
,
attendStart
,
DateUnit
.
DAY
);
StopWatch
stopWatch
=
new
StopWatch
(
"stopwatch attend1"
);
log
.
info
(
"考勤计算天数区间:{}"
,
compare
);
for
(
int
i
=
0
;
i
<=
compare
.
intValue
();
i
++)
{
DateTime
curDate
=
DateUtil
.
offsetDay
(
attendStart
,
i
);
log
.
info
(
"考勤计算日期:{}"
,
curDate
.
toDateStr
());
stopWatch
.
start
(
"执行本地方法"
);
hikEntity
.
setAttendanceDateStart
(
curDate
.
toDateStr
());
hikEntity
.
setAttendanceDateEnd
(
curDate
.
toDateStr
());
new
Thread
(()->{
for
(
int
i
=
0
;
i
<=
compare
.
intValue
();
i
++)
{
DateTime
curDate
=
DateUtil
.
offsetDay
(
attendStart
,
i
);
log
.
info
(
"考勤计算日期:{}"
,
curDate
.
toDateStr
());
stopWatch
.
start
(
"执行本地方法"
);
hikEntity
.
setAttendanceDateStart
(
curDate
.
toDateStr
());
hikEntity
.
setAttendanceDateEnd
(
curDate
.
toDateStr
());
if
(
AttendSourceTypeEnum
.
海康云平台
.
getValue
().
equals
(
sourceType
))
{
//海康云平台
log
.
info
(
"同步海康云平台门禁事件!"
);
hikService
.
syncDoorEvents
(
hikEntity
);
hikService
.
deletFakeRecord
(
hikEntity
,
context
);
}
else
if
(
AttendSourceTypeEnum
.
海康考勤机
.
getValue
().
equals
(
sourceType
))
{
HikDoorEventReq
hikDoorEventReq
=
new
HikDoorEventReq
();
hikDoorEventReq
.
setStartTime
(
DateUtil
.
parseDate
(
curDate
.
toDateStr
()).
toJdkDate
());
hikDoorEventReq
.
setEndTime
(
DateUtil
.
endOfDay
(
new
Date
()));
log
.
info
(
"同步设备上门禁事件!req==>{}"
,
JSON
.
toJSONString
(
hikDoorEventReq
));
List
<
DoorEntity
>
doorEntities
=
doorService
.
find
(
new
DoorQuery
());
for
(
DoorEntity
doorEntity
:
doorEntities
)
{
doorService
.
syncDoorDeviceEvents
(
doorEntity
,
hikDoorEventReq
);
}
this
.
service
.
deletFakeRecord
(
hikEntity
,
null
);
}
else
if
(
AttendSourceTypeEnum
.
钉钉
.
getValue
().
equals
(
sourceType
))
{
//钉钉
log
.
info
(
"同步钉钉考勤事件!"
);
hikService
.
syncDoorEventsFromDingTalk
(
hikEntity
);
}
else
{
log
.
info
(
"未配置考勤源类型!"
);
}
/*
if (!ObjectUtils.isEmpty(hikhost)) {
hikService.syncDoorEvents(hikEntity);
hikService.deletFakeRecord(hikEntity, context);
...
...
@@ -248,10 +279,13 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
doorService.syncDoorDeviceEvents(doorEntity, hikDoorEventReq);
}
this.service.deletFakeRecord(hikEntity, null);
}*/
stopWatch
.
stop
();
log
.
info
(
"考勤计算日期:{} 完成,耗时:{}ms"
,
curDate
.
toDateStr
(),
stopWatch
.
getLastTaskTimeMillis
());
}
stopWatch
.
stop
();
log
.
info
(
"考勤计算日期:{} 完成,耗时:{}ms"
,
curDate
.
toDateStr
(),
stopWatch
.
getLastTaskTimeMillis
());
}
}).
start
();
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dingding/attendance/service/impl/DingAttendanceServiceImpl.java
View file @
2b9f34ca
...
...
@@ -34,7 +34,7 @@ public class DingAttendanceServiceImpl extends AbstractDingTalkService implement
req
.
setUserIdList
(
userIdList
);
req
.
setOffset
(
Long
.
valueOf
(
pageInfo
.
getBeginIndex
()
+
""
));
req
.
setLimit
(
Long
.
valueOf
(
pageInfo
.
getPrePageResult
()
+
""
));
log
.
info
(
"req:{}"
,
JSON
.
toJSONString
(
req
));
//
log.info("req:{}", JSON.toJSONString(req));
OapiAttendanceListResponse
rsp
=
client
.
execute
(
req
,
getToken
());
// log.info("OapiV2UserGetbymobileResponse:{}", rsp.getBody());
...
...
@@ -43,12 +43,9 @@ public class DingAttendanceServiceImpl extends AbstractDingTalkService implement
log
.
info
(
"还有更多数据,递归调用,req:{}"
,
JSON
.
toJSONString
(
req
));
pageInfo
.
setCurrPage
(
pageInfo
.
getCurrPage
()
+
1
);
Rest
<
List
<
OapiAttendanceListResponse
.
Recordresult
>>
attendanceList
=
getAttendanceList
(
pageInfo
,
userIdList
,
hikQuery
);
rsp
.
getRecordresult
().
addAll
(
attendanceList
.
getData
());
return
Rest
.
ok
(
"成功"
,
rsp
.
getRecordresult
());
}
return
Rest
.
ok
(
"成功"
,
rsp
.
getRecordresult
());
}
else
{
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dingding/personal/service/impl/DingPersonServiceImpl.java
View file @
2b9f34ca
...
...
@@ -233,12 +233,13 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
runtimeOptions
.
setReadTimeout
(
60000
);
runtimeOptions
.
setConnectTimeout
(
60000
);
ListProcessInstanceIdsResponse
rsp
=
client
.
listProcessInstanceIdsWithOptions
(
listProcessInstanceIdsRequest
,
listProcessInstanceIdsHeaders
,
runtimeOptions
);
if
(
rsp
.
getBody
().
getSuccess
())
{
// log.info("获取审批实例id列表成功->" + JSONObject.toJSONString(rsp.getBody().getResult()));
if
(!
ObjectUtils
.
isEmpty
(
rsp
.
getBody
())
&&
!
ObjectUtils
.
isEmpty
(
rsp
.
getBody
().
getSuccess
())&&
rsp
.
getBody
().
getSuccess
())
{
log
.
info
(
"获取审批实例id列表成功->"
+
JSONObject
.
toJSONString
(
rsp
.
getBody
().
getResult
()));
return
Rest
.
ok
(
rsp
.
getBody
().
getResult
());
}
else
{
log
.
info
(
"获取审批实例id列表失败->"
+
JSONObject
.
toJSONString
(
rsp
));
//
log.info("获取审批实例id列表失败->" + JSONObject.toJSONString(rsp));
return
Rest
.
fail
(
"查询失败:"
+
rsp
.
getBody
().
getSuccess
());
}
}
catch
(
Exception
_err
)
{
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/staff/web/StaffController.java
View file @
2b9f34ca
...
...
@@ -2,6 +2,7 @@ package com.mortals.xhx.module.staff.web;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.Rest
;
...
...
@@ -13,14 +14,14 @@ import com.mortals.xhx.base.system.param.service.ParamService;
import
com.mortals.xhx.common.code.*
;
import
com.mortals.xhx.module.attendance.model.*
;
import
com.mortals.xhx.module.attendance.model.vo.AttendStatInfo
;
import
com.mortals.xhx.module.attendance.service.AttendanceLeaveRecordService
;
import
com.mortals.xhx.module.attendance.service.AttendanceRecordHikService
;
import
com.mortals.xhx.module.attendance.service.AttendanceRecordService
;
import
com.mortals.xhx.module.attendance.service.AttendanceVacationRecordService
;
import
com.mortals.xhx.module.attendance.service.*
;
import
com.mortals.xhx.module.dept.model.DeptEntity
;
import
com.mortals.xhx.module.dept.model.DeptQuery
;
import
com.mortals.xhx.module.dept.model.DeptTreeSelect
;
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.hik.door.model.req.door.HikDoorEventReq
;
import
com.mortals.xhx.module.job.model.JobEntity
;
import
com.mortals.xhx.module.job.model.JobQuery
;
import
com.mortals.xhx.module.job.service.JobService
;
...
...
@@ -68,6 +69,12 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ
@Value
(
"${hik.host:}"
)
protected
String
hikhost
;
@Value
(
"${source.type:''}"
)
protected
String
sourceType
;
@Autowired
private
AttendanceGroupService
groupService
;
public
StaffController
()
{
super
.
setModuleDesc
(
"员工基本信息"
);
...
...
@@ -200,16 +207,37 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ
JSONObject
jsonObject
=
new
JSONObject
();
String
busiDesc
=
this
.
getModuleDesc
()
+
"同步"
;
try
{
if
(!
ObjectUtils
.
isEmpty
(
hikhost
))
{
if
(
AttendSourceTypeEnum
.
海康云平台
.
getValue
().
equals
(
sourceType
))
{
//海康云平台
//同步部门
deptService
.
syncDept
(
getContext
());
Rest
<
Void
>
rest
=
this
.
service
.
syncPersons
(
getContext
());
if
(
rest
.
getCode
()
==
YesNoEnum
.
NO
.
getValue
())
{
throw
new
AppException
(
"同步异常!"
);
}
}
else
{
}
else
if
(
AttendSourceTypeEnum
.
海康考勤机
.
getValue
().
equals
(
sourceType
))
{
this
.
service
.
syncPersonsByDevices
(
null
);
}
else
if
(
AttendSourceTypeEnum
.
钉钉
.
getValue
().
equals
(
sourceType
))
{
//钉钉
log
.
info
(
"同步钉钉考勤!"
);
this
.
service
.
syncPersonsByDingTalk
(
null
);
groupService
.
syncGroupByDingTalk
();
}
else
{
log
.
info
(
"未配置考勤源类型!"
);
}
/* if (!ObjectUtils.isEmpty(hikhost)) {
//同步部门
deptService.syncDept(getContext());
Rest<Void> rest = this.service.syncPersons(getContext());
if (rest.getCode() == YesNoEnum.NO.getValue()) {
throw new AppException("同步异常!");
}
}else{
this.service.syncPersonsByDevices(null);
}*/
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
busiDesc
+
" 【成功】"
);
...
...
attendance-performance-manager/src/test/java/com/mortals/httpclient/system.http
View file @
2b9f34ca
...
...
@@ -58,9 +58,8 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceRecord
Content-Type: application/json
{
"attendanceDateStart": "2025-02-05",
"attendanceDateEnd": "2025-02-05",
"staffId":752
"attendanceDateStart": "2025-01-01",
"attendanceDateEnd": "2025-03-24"
}
...
...
@@ -80,8 +79,8 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceHikRecordCustom
Content-Type: application/json
{
"attendanceDateStart": "2025-0
2
-01",
"attendanceDateEnd": "2025-03-
18
"
"attendanceDateStart": "2025-0
1
-01",
"attendanceDateEnd": "2025-03-
24
"
}
...
...
@@ -90,8 +89,8 @@ POST {{baseUrl}}/attendance/stat/summary
Content-Type: application/json
{
"summaryTimeStart": "2025-0
2
-01",
"summaryTimeEnd": "2025-03-
18
"
"summaryTimeStart": "2025-0
3
-01",
"summaryTimeEnd": "2025-03-
24
"
}
...
...
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