Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
e02d94fd
Commit
e02d94fd
authored
Feb 10, 2025
by
chenyuxi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 对接E人事出差数据
parent
fc306434
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
623 additions
and
17 deletions
+623
-17
EkpPermissionTask.java
...com/yifu/cloud/plus/v1/job/compont/EkpPermissionTask.java
+15
-2
EkpQiwiWorkovertime.java
...d/plus/v1/yifu/permission/entity/EkpQiwiWorkovertime.java
+94
-0
WxConfig.java
...va/com/yifu/cloud/plus/v1/permission/config/WxConfig.java
+2
-0
QiWeiController.java
.../cloud/plus/v1/permission/controller/QiWeiController.java
+51
-0
EkpQiweiWorkovertimeMapper.java
...plus/v1/permission/mapper/EkpQiweiWorkovertimeMapper.java
+43
-0
EkpQiweiWorkovertimeService.java
...us/v1/permission/service/EkpQiweiWorkovertimeService.java
+50
-0
QiWeiService.java
...m/yifu/cloud/plus/v1/permission/service/QiWeiService.java
+13
-0
EkpQiweiWorkovertimeServiceImpl.java
...mission/service/impl/EkpQiweiWorkovertimeServiceImpl.java
+207
-0
QiWeiServiceImpl.java
...oud/plus/v1/permission/service/impl/QiWeiServiceImpl.java
+47
-12
application-dev.yml
...ifu-permission-biz/src/main/resources/application-dev.yml
+2
-1
application-prd.yml
...ifu-permission-biz/src/main/resources/application-prd.yml
+2
-1
application-test.yml
...fu-permission-biz/src/main/resources/application-test.yml
+2
-1
logback-spring.xml
...yifu-permission-biz/src/main/resources/logback-spring.xml
+24
-0
EkpQiweiWorkovertimeMapper.xml
.../src/main/resources/mapper/EkpQiweiWorkovertimeMapper.xml
+71
-0
No files found.
yifu-job/yifu-job-api/src/main/java/com/yifu/cloud/plus/v1/job/compont/EkpPermissionTask.java
View file @
e02d94fd
...
...
@@ -55,7 +55,7 @@ public class EkpPermissionTask {
/**
* @return
* @Author hgw
* @Description 每天
1
点,定时同步HCM审批出差数据
* @Description 每天
2
点,定时同步HCM审批出差数据
* @Date 2024-4-29 15:59:31
* @Param
**/
...
...
@@ -81,4 +81,17 @@ public class EkpPermissionTask {
log
.
info
(
"-------------获取企微招聘数据-定时任务结束------------"
);
}
/**
* 每天2点30,定时同步昨天HCM审批加班数据
* @author chenyuxi
* @since 1.9.6
* @date 2025-02-06
**/
public
void
doSaveHcmWorkOvertime
()
throws
Exception
{
log
.
info
(
"-------------获取HCM加班数据-定时任务开始------------"
);
HttpDaprUtil
.
invokeMethodPost
(
daprEkpPermissionProperties
.
getAppUrl
(),
daprEkpPermissionProperties
.
getAppId
(),
"/qiWei/inner/everyDaySaveHcmWorkOvertime"
,
""
,
Object
.
class
,
SecurityConstants
.
FROM_IN
);
log
.
info
(
"-------------获取HCM加班数据-定时任务结束------------"
);
}
}
yifu-permission/yifu-permission-api/src/main/java/com/yifu/cloud/plus/v1/yifu/permission/entity/EkpQiwiWorkovertime.java
0 → 100644
View file @
e02d94fd
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
permission
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
org.apache.poi.hpsf.Decimal
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
/**
* E人事项目加班申请
* @author chenyuxi
* @since 1.9.6
* @date 2025-02-06
*/
@TableName
(
value
=
"ekp_qiwei_workovertime"
)
@Data
@Schema
(
description
=
"E人事项目加班申请"
)
public
class
EkpQiwiWorkovertime
{
@TableField
(
exist
=
false
)
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@Schema
(
description
=
"主键"
,
name
=
"fdId"
)
private
String
fdId
;
@Schema
(
description
=
"申请编号"
)
@NotBlank
(
message
=
"申请编号不能为空"
)
private
String
fdSpNo
;
@Schema
(
description
=
"申请人姓名"
)
@NotBlank
(
message
=
"申请人姓名不能为空"
)
private
String
fdApplyUserName
;
@Schema
(
description
=
"申请人部门"
)
@NotBlank
(
message
=
"申请人部门不能为空"
)
private
String
fdApplyUserDept
;
@Schema
(
description
=
"申请日期"
)
@NotNull
(
message
=
"申请日期不能为空"
)
private
LocalDateTime
fdApplyDate
;
@Schema
(
description
=
"加班开始时间"
)
private
LocalDateTime
fdWorkBegin
;
@Schema
(
description
=
"加班结束时间"
)
private
LocalDateTime
fdWorkEnd
;
@Schema
(
description
=
"加班事由"
)
private
String
fdReason
;
@Schema
(
description
=
"加班时间用于"
)
private
String
fdTimeUse
;
@Schema
(
description
=
"岗位级别"
)
private
String
fdPositionLevel
;
@Schema
(
description
=
"项目名称"
)
private
String
fdProjectName
;
@Schema
(
description
=
"项目编码"
)
private
String
fdProjectCode
;
@Schema
(
description
=
"工作日加班时长(小时)"
)
private
String
fdWorkDuration
;
@Schema
(
description
=
"节假日加班时长(小时)"
)
private
String
fdHolidayDuration
;
@Schema
(
description
=
"休息日加班时长(小时)"
)
private
String
fdRestDuration
;
@Schema
(
description
=
"累计加班时长(小时)"
)
private
String
fdSumDuration
;
@Schema
(
description
=
"是否出差加班:是、否"
)
private
String
fdIsAway
;
@Schema
(
description
=
"关联加班费状态"
)
private
String
fdOvertimePayStatus
;
@Schema
(
description
=
"关联加班费的项目报销单号ID"
)
private
String
fdOvertimePayId
;
@Schema
(
description
=
"关联加班费的项目报销单号编号"
)
private
String
fdOvertimePayCode
;
@Schema
(
description
=
"关联加班餐费状态"
)
private
String
fdOvertimeFoodStatus
;
@Schema
(
description
=
"关联加班餐费的项目报销单号ID"
)
private
String
fdOvertimeFoodId
;
@Schema
(
description
=
"关联加班餐费的项目报销单号编号"
)
private
String
fdOvertimeFoodCode
;
@Schema
(
description
=
"拉取数据时间"
)
private
LocalDateTime
createTime
;
@Schema
(
description
=
"原始数据存储"
)
private
String
orgData
;
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/config/WxConfig.java
View file @
e02d94fd
...
...
@@ -57,6 +57,8 @@ public class WxConfig {
private
String
hcmAppSecret
;
@Value
(
"${hcm.appUrl}"
)
private
String
hcmAppUrl
;
@Value
(
"${hcm.appWorkOvertimeUrl}"
)
private
String
appWorkOvertimeUrl
;
@Autowired
private
RedisTemplate
redisTemplate
;
...
...
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/controller/QiWeiController.java
View file @
e02d94fd
...
...
@@ -7,6 +7,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiChuchai
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiWorkovertime
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiZhaoPin
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
...
...
@@ -152,4 +153,54 @@ public class QiWeiController {
return
R
.
failed
();
}
/**
* 获取HCM审批通过的加班数据并存储到EKP
* @author chenyuxi
* @since 1.9.6
* @date 2025-02-06
* @return R<List<EkpQiwiChuchai>>
**/
@PostMapping
(
"/inner/everyDaySaveHcmWorkOvertime"
)
@Inner
public
R
<
List
<
EkpQiwiWorkovertime
>>
everyDaySaveHcmWorkOvertime
()
{
String
startDay
=
DateUtil
.
addDay
(-
1
);
String
endDay
=
DateUtil
.
addDay
(
0
);
return
wxSalaryService
.
getHcmWorkOvertimeAndSave
(
startDay
,
endDay
);
}
/**
* 初次获取HCM审批通过的加班数据并存储到EKP
* @author chenyuxi
* @since 1.9.6
* @date 2025-02-06
* @return R<List<EkpQiwiChuchai>>
**/
@Operation
(
summary
=
"初次获取HCM审批通过的加班数据并存储到EKP"
)
@SysLog
(
"初次获取HCM审批通过的加班数据并存储到EKP"
)
@GetMapping
(
"/initialSaveHcmWorkOvertime"
)
public
R
<
List
<
EkpQiwiWorkovertime
>>
initialSaveHcmWorkOvertime
()
{
String
startDay
=
"2025-01-01"
;
String
endDay
=
DateUtil
.
addDay
(
0
);
return
wxSalaryService
.
getHcmWorkOvertimeAndSave
(
startDay
,
endDay
);
}
/**
* 手动同步当日HCM的加班数据并存储到EKP
* @author chenyuxi
* @date 2024-10-17
* @since 1.9.6
**/
@Operation
(
summary
=
"手动同步当日HCM的E人事审批里的加班数据--EKP调用接口"
)
@SysLog
(
"手动同步当日HCM的E人事审批里的加班数据--EKP调用接口"
)
@GetMapping
(
"/getEWorkOvertimeInfo"
)
public
R
<
String
>
getEWorkOvertimeInfo
()
{
String
startDay
=
DateUtil
.
addDay
(
0
);
String
endDay
=
DateUtil
.
addDay
(
0
);
R
<
List
<
EkpQiwiWorkovertime
>>
returnR
=
wxSalaryService
.
getHcmWorkOvertimeAndSave
(
startDay
,
endDay
);
if
(
returnR
!=
null
&&
returnR
.
getCode
()
==
CommonConstants
.
SUCCESS
)
{
return
R
.
ok
();
}
return
R
.
failed
();
}
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/mapper/EkpQiweiWorkovertimeMapper.java
0 → 100644
View file @
e02d94fd
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
permission
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiWorkovertime
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiZhaoPin
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* E人事加班申请
*
* @author chenyuxi
* @since 1.9.6
*/
@Mapper
public
interface
EkpQiweiWorkovertimeMapper
extends
BaseMapper
<
EkpQiwiWorkovertime
>
{
/**
* 已被拉取的90天内的数据Map
* 获取全部的列表,用来: 拉取企E人事加班数据时,不覆盖数据
* @return java.util.Map<java.lang.String, java.lang.String>
**/
List
<
EkpQiwiWorkovertime
>
getWorkovertimeMapByTimeRange
(
@Param
(
"queryStartTime"
)
String
queryStartTime
,
@Param
(
"queryEndTime"
)
String
queryEndTime
);
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/EkpQiweiWorkovertimeService.java
0 → 100644
View file @
e02d94fd
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
permission
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiWorkovertime
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiZhaoPin
;
import
java.util.List
;
import
java.util.Map
;
/**
* E人事加班申请
*
* @author chenyuxi
* @since 1.9.6
*/
public
interface
EkpQiweiWorkovertimeService
extends
IService
<
EkpQiwiWorkovertime
>
{
/**
* 已被拉取的90天内的数据Map(定时任务是拉前一天的,手动执行是当面的。所以对90内的查重足够了。查全部数据对IO是浪费的)
* 用来: 拉取企E人事加班数据时,不覆盖数据
* @return java.util.Map<java.lang.String, java.lang.String>
**/
Map
<
String
,
String
>
getWorkovertimeMapByTimeRange
(
String
queryStartTime
,
String
queryEndTime
);
/**
* 获取HCM审批通过的加班数据并存储到EKP
* @param startTime 开始时间
* @param endTime 结束时间
* @return R<List<EkpQiwiChuchai>>
**/
List
<
EkpQiwiWorkovertime
>
saveWorkovertimeList
(
String
startTime
,
String
endTime
);
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/QiWeiService.java
View file @
e02d94fd
...
...
@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.permission.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiChuchai
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiWorkovertime
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiZhaoPin
;
import
java.util.List
;
...
...
@@ -35,4 +36,16 @@ public interface QiWeiService extends IService<EkpQiwiChuchai> {
**/
R
<
List
<
EkpQiwiZhaoPin
>>
getQiWeiZhaoPinAndSave
(
String
startTime
,
String
endTime
);
/**
* 获取HCM审批通过的加班数据并存储到EKP
* @param startDay 开始日期
* @param endDay 结束日期
* @author chenyuxi
* @since 1.9.6
* @date 2025-02-06
* @return R<List<EkpQiwiChuchai>>
**/
R
<
List
<
EkpQiwiWorkovertime
>>
getHcmWorkOvertimeAndSave
(
String
startDay
,
String
endDay
);
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/impl/EkpQiweiWorkovertimeServiceImpl.java
0 → 100644
View file @
e02d94fd
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
permission
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.permission.config.WxConfig
;
import
com.yifu.cloud.plus.v1.permission.mapper.EkpQiweiWorkovertimeMapper
;
import
com.yifu.cloud.plus.v1.permission.mapper.EkpQiweiZhaopinMapper
;
import
com.yifu.cloud.plus.v1.permission.service.EkpQiweiWorkovertimeService
;
import
com.yifu.cloud.plus.v1.permission.service.EkpQiweiZhaopinService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiWorkovertime
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiZhaoPin
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
import
org.springframework.security.authentication.AuthenticationServiceException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* E人事加班申请
*
* @author chenyuxi
* @since 1.9.6
*/
@Log4j2
@Service
@AllArgsConstructor
public
class
EkpQiweiWorkovertimeServiceImpl
extends
ServiceImpl
<
EkpQiweiWorkovertimeMapper
,
EkpQiwiWorkovertime
>
implements
EkpQiweiWorkovertimeService
{
private
final
WxConfig
wxConfig
;
private
RestTemplate
restTemplate
=
new
RestTemplate
();
/**
* 已被拉取的90天内的数据Map(定时任务是拉前一天的,手动执行是当面的。所以对90内的查重足够了。查全部数据对IO是浪费的)
* 用来: 拉取企E人事加班数据时,不覆盖数据
* @return java.util.Map<java.lang.String, java.lang.String>
**/
@Override
public
Map
<
String
,
String
>
getWorkovertimeMapByTimeRange
(
String
queryStartTime
,
String
queryEndTime
)
{
List
<
EkpQiwiWorkovertime
>
cpHistoryList
=
baseMapper
.
getWorkovertimeMapByTimeRange
(
queryStartTime
,
queryEndTime
);
Map
<
String
,
String
>
cpMap
=
new
HashMap
<>();
for
(
EkpQiwiWorkovertime
cpHis
:
cpHistoryList
)
{
cpMap
.
put
(
cpHis
.
getFdSpNo
(),
"0"
);
}
return
cpMap
;
}
/**
* 获取HCM审批通过的加班数据并存储到EKP
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return R<List < EkpQiwiChuchai>>
**/
@Override
public
List
<
EkpQiwiWorkovertime
>
saveWorkovertimeList
(
String
startTime
,
String
endTime
)
{
// 拉取E人事昨天的全量数据
List
<
EkpQiwiWorkovertime
>
hcmAllList
=
new
ArrayList
<>();
// 可存储的数据
List
<
EkpQiwiWorkovertime
>
saveCpList
=
new
ArrayList
<>();
// 已被拉取的90天内的数据Map(定时任务是拉前一天的,手动执行是当面的。所以对90内的查重足够了。查全部数据对IO是浪费的)
String
queryStartDay
=
DateUtil
.
addDay
(-
90
);
String
queryStartTimes
=
queryStartDay
+
" 00:00:00"
;
Map
<
String
,
String
>
cpHistoryMap
=
this
.
getWorkovertimeMapByTimeRange
(
queryStartTimes
,
endTime
);
// 拉取E人事昨天的全量数据
this
.
getWorkOvertimeListByHcm
(
startTime
,
endTime
,
hcmAllList
);
log
.
debug
(
"获取HCM审批通过的加班数据——hcmAllList.size()="
+
hcmAllList
.
size
());
if
(!
hcmAllList
.
isEmpty
())
{
for
(
EkpQiwiWorkovertime
cp
:
hcmAllList
)
{
if
(
cpHistoryMap
.
get
(
cp
.
getFdSpNo
())
==
null
)
{
saveCpList
.
add
(
cp
);
}
}
}
log
.
debug
(
"获取HCM审批通过的加班数据——saveCpList.size()="
+
saveCpList
.
size
());
// 填充基础数据并保存:
if
(
Common
.
isNotNull
(
saveCpList
))
{
this
.
saveBatch
(
saveCpList
);
}
cpHistoryMap
.
clear
();
return
saveCpList
;
}
/**
* 从HCM-获取审批通过的加班数据
* @param startTime 开始时间
* @param endTime 结束时间
**/
private
void
getWorkOvertimeListByHcm
(
String
startTime
,
String
endTime
,
List
<
EkpQiwiWorkovertime
>
cpAllList
)
{
String
sign
=
wxConfig
.
getHcmSign
();
if
(
Common
.
isEmpty
(
sign
))
{
log
.
error
(
"从HCM-获取审批通过的加班数据>>获取HCM的sign失败!"
);
}
String
appWorkOvertimeUrl
=
wxConfig
.
getAppWorkOvertimeUrl
();
if
(
Common
.
isEmpty
(
appWorkOvertimeUrl
))
{
log
.
error
(
"从HCM-获取审批通过的加班数据>>获取HCM的appWorkOvertimeUrl失败!"
);
}
log
.
info
(
"从HCM-获取审批通过的加班数据》》sign="
+
sign
);
HttpHeaders
headers
=
new
HttpHeaders
();
MediaType
type
=
MediaType
.
parseMediaType
(
"application/json; charset=UTF-8"
);
headers
.
setContentType
(
type
);
headers
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON
.
toString
());
headers
.
add
(
"sign"
,
sign
);
HttpEntity
<
String
>
formEntity
=
new
HttpEntity
<>(
headers
);
log
.
info
(
"从HCM-获取审批通过的加班数据》》appWorkOvertimeUrl="
+
appWorkOvertimeUrl
);
// 从HCM-获取审批通过的加班数据
String
dataResultList
=
restTemplate
.
postForEntity
(
appWorkOvertimeUrl
,
formEntity
,
String
.
class
,
startTime
,
endTime
).
getBody
();
log
.
info
(
"从HCM-获取审批通过的加班数据》》dataResultList="
+
dataResultList
);
if
(
Common
.
isEmpty
(
dataResultList
))
{
throw
new
AuthenticationServiceException
(
"从HCM-获取审批通过的加班数据失败"
);
}
JSONObject
jsonObject
=
JSON
.
parseObject
(
dataResultList
);
String
code
=
jsonObject
.
getString
(
"code"
);
if
(!
"200"
.
equals
(
code
))
{
log
.
error
(
"从HCM-获取审批通过的加班数据>>返回code非200"
);
}
// 时间段内的总审批单个数
String
data
=
jsonObject
.
getString
(
"data"
);
if
(
Common
.
isNotNull
(
data
))
{
List
<
JSONObject
>
dataList
=
JSON
.
parseArray
(
data
,
JSONObject
.
class
);
log
.
debug
(
"从HCM-获取审批通过的加班数据》》dataList的数量="
+
dataList
.
size
());
JSONObject
formData
;
DateTimeFormatter
df
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
EkpQiwiWorkovertime
workOvertimeInfo
;
for
(
JSONObject
datas
:
dataList
)
{
workOvertimeInfo
=
new
EkpQiwiWorkovertime
();
// 存原始报文
workOvertimeInfo
.
setOrgData
(
datas
.
toJSONString
());
if
(
Common
.
isNotNull
(
datas
.
getString
(
"applyTimeFormat"
)))
{
workOvertimeInfo
.
setFdApplyDate
(
LocalDateTime
.
parse
(
datas
.
getString
(
"applyTimeFormat"
),
df
));
}
if
(
Common
.
isNotNull
(
datas
.
getString
(
"startTimeFormat"
)))
{
workOvertimeInfo
.
setFdWorkBegin
(
LocalDateTime
.
parse
(
datas
.
getString
(
"startTimeFormat"
),
df
));
}
if
(
Common
.
isNotNull
(
datas
.
getString
(
"endTimeFormat"
)))
{
workOvertimeInfo
.
setFdWorkEnd
(
LocalDateTime
.
parse
(
datas
.
getString
(
"endTimeFormat"
),
df
));
}
workOvertimeInfo
.
setCreateTime
(
LocalDateTime
.
now
());
workOvertimeInfo
.
setFdApplyUserName
(
datas
.
getString
(
"applyName"
));
workOvertimeInfo
.
setFdApplyUserDept
(
datas
.
getString
(
"applyDeptName"
));
workOvertimeInfo
.
setFdSpNo
(
datas
.
getString
(
"flowId"
));
workOvertimeInfo
.
setFdReason
(
datas
.
getString
(
"initiationReason"
));
workOvertimeInfo
.
setFdTimeUse
(
datas
.
getString
(
"dataType"
));
workOvertimeInfo
.
setFdWorkDuration
(
datas
.
getString
(
"weekdayHour"
));
workOvertimeInfo
.
setFdHolidayDuration
(
datas
.
getString
(
"holidayHour"
));
workOvertimeInfo
.
setFdRestDuration
(
datas
.
getString
(
"restDayHour"
));
workOvertimeInfo
.
setFdSumDuration
(
datas
.
getString
(
"duration"
));
// 关联状态默认为"未关联"
workOvertimeInfo
.
setFdOvertimeFoodStatus
(
"未关联"
);
workOvertimeInfo
.
setFdOvertimePayStatus
(
"未关联"
);
if
(
Common
.
isNotNull
(
datas
.
getString
(
"formData"
)))
{
formData
=
JSON
.
parseObject
(
datas
.
getString
(
"formData"
));
workOvertimeInfo
.
setFdPositionLevel
(
formData
.
getString
(
"岗位级别"
));
workOvertimeInfo
.
setFdProjectName
(
formData
.
getString
(
"项目名称"
));
workOvertimeInfo
.
setFdProjectCode
(
formData
.
getString
(
"项目编码"
));
workOvertimeInfo
.
setFdIsAway
(
formData
.
getString
(
"是否是出差加班"
));
}
cpAllList
.
add
(
workOvertimeInfo
);
}
}
}
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/impl/QiWeiServiceImpl.java
View file @
e02d94fd
...
...
@@ -6,18 +6,22 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.permission.config.WxConfig
;
import
com.yifu.cloud.plus.v1.permission.mapper.EkpQiweiChuchaiMapper
;
import
com.yifu.cloud.plus.v1.permission.service.EkpQiweiWorkovertimeService
;
import
com.yifu.cloud.plus.v1.permission.service.EkpQiweiZhaopinService
;
import
com.yifu.cloud.plus.v1.permission.service.QiWeiService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.LocalDateTimeUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.insurances.util.LocalDateUtil
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiChuchai
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiWorkovertime
;
import
com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiZhaoPin
;
import
com.yifu.cloud.plus.v1.yifu.permission.vo.QiWeiUserVo
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
...
...
@@ -38,6 +42,7 @@ import java.util.*;
*/
@Service
@AllArgsConstructor
@Log4j2
public
class
QiWeiServiceImpl
extends
ServiceImpl
<
EkpQiweiChuchaiMapper
,
EkpQiwiChuchai
>
implements
QiWeiService
{
private
RestTemplate
restTemplate
=
new
RestTemplate
();
...
...
@@ -52,6 +57,8 @@ public class QiWeiServiceImpl extends ServiceImpl<EkpQiweiChuchaiMapper, EkpQiwi
private
final
EkpQiweiZhaopinService
ekpQiwiZhaoPinService
;
private
final
EkpQiweiWorkovertimeService
ekpQiweiWorkovertimeService
;
/**
* @Description: 获取企业微信审批里的【招聘平台采购/调配】
* @Author: hgw
...
...
@@ -173,7 +180,7 @@ public class QiWeiServiceImpl extends ServiceImpl<EkpQiweiChuchaiMapper, EkpQiwi
userMap
=
this
.
getUserMap
();
String
qwType
=
"chuChai"
;
this
.
getCostPaymentListByMonth
(
startTime
,
endTime
,
cpAllList
,
qwType
);
log
.
error
(
"1拉取企业微信出差数据cpAllList.size()="
+
cpAllList
.
size
());
log
.
debug
(
"1拉取企业微信出差数据cpAllList.size()="
+
cpAllList
.
size
());
if
(!
cpAllList
.
isEmpty
())
{
for
(
EkpQiwiChuchai
cp
:
cpAllList
)
{
if
(
cpMap
.
get
(
cp
.
getFdSpNo
())
==
null
)
{
...
...
@@ -181,19 +188,19 @@ public class QiWeiServiceImpl extends ServiceImpl<EkpQiweiChuchaiMapper, EkpQiwi
}
}
}
log
.
error
(
"1拉取企业微信出差数据returnCpList.size()="
+
returnCpList
.
size
());
log
.
debug
(
"1拉取企业微信出差数据returnCpList.size()="
+
returnCpList
.
size
());
// 填充详情
if
(!
returnCpList
.
isEmpty
())
{
log
.
error
(
"拉取企业微信出差数据:"
+
returnCpList
.
size
()
+
" 条,开始循环拉取明细!"
);
log
.
debug
(
"拉取企业微信出差数据:"
+
returnCpList
.
size
()
+
" 条,开始循环拉取明细!"
);
this
.
getTStatisticsProjectReimburseDetail
(
returnCpList
,
userMap
);
log
.
error
(
"拉取企业微信出差数据结束"
);
log
.
debug
(
"拉取企业微信出差数据结束"
);
}
}
else
{
// type 2:HCM的E人事
// 已被拉取的Map
cpMap
=
this
.
getAllMap
();
this
.
getChuChaiListByHcm
(
startTimes
,
endTimes
,
cpAllList
);
log
.
error
(
"2拉取HCM的E人事出差数据cpAllList.size()="
+
cpAllList
.
size
());
log
.
debug
(
"2拉取HCM的E人事出差数据cpAllList.size()="
+
cpAllList
.
size
());
if
(!
cpAllList
.
isEmpty
())
{
for
(
EkpQiwiChuchai
cp
:
cpAllList
)
{
if
(
cpMap
.
get
(
cp
.
getFdSpNo
())
==
null
)
{
...
...
@@ -201,7 +208,7 @@ public class QiWeiServiceImpl extends ServiceImpl<EkpQiweiChuchaiMapper, EkpQiwi
}
}
}
log
.
error
(
"2拉取HCM的E人事出差数据returnCpList.size()="
+
returnCpList
.
size
());
log
.
debug
(
"2拉取HCM的E人事出差数据returnCpList.size()="
+
returnCpList
.
size
());
}
// 填充基础数据并保存:
if
(!
returnCpList
.
isEmpty
())
{
...
...
@@ -242,7 +249,7 @@ public class QiWeiServiceImpl extends ServiceImpl<EkpQiweiChuchaiMapper, EkpQiwi
**/
private
R
<
List
<
EkpQiwiChuchai
>>
getTStatisticsProjectReimburseListByWx
(
String
startTime
,
String
endTime
,
String
qwType
)
{
String
accessToken
=
wxConfig
.
getReimbursementToken
(
restTemplate
);
log
.
error
(
"1拉取企业微信出差数据accessToken="
+
accessToken
);
log
.
debug
(
"1拉取企业微信出差数据accessToken="
+
accessToken
);
JSONObject
json
=
new
JSONObject
();
List
<
Map
<
String
,
String
>>
paramList
=
new
ArrayList
<>();
Map
<
String
,
String
>
paramMap
=
new
HashMap
<>();
...
...
@@ -273,7 +280,7 @@ public class QiWeiServiceImpl extends ServiceImpl<EkpQiweiChuchaiMapper, EkpQiwi
headers
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON
.
toString
());
HttpEntity
<
String
>
formEntity
=
new
HttpEntity
<>(
json
.
toString
(),
headers
);
String
dataResultList
=
restTemplate
.
postForEntity
(
SecurityConstants
.
WX_GET_APPROVAL_LIST
,
formEntity
,
String
.
class
,
accessToken
).
getBody
();
log
.
error
(
"1拉取企业微信出差数据dataResultList="
+
dataResultList
);
log
.
debug
(
"1拉取企业微信出差数据dataResultList="
+
dataResultList
);
if
(
Common
.
isEmpty
(
dataResultList
))
{
throw
new
AuthenticationServiceException
(
"获取企业微信审批数据失败"
);
}
...
...
@@ -328,7 +335,7 @@ public class QiWeiServiceImpl extends ServiceImpl<EkpQiweiChuchaiMapper, EkpQiwi
if
(
Common
.
isEmpty
(
appUrl
))
{
return
R
.
failed
(
"获取HCM的appUrl失败!"
);
}
log
.
error
(
"1拉取HCM出差数据sign="
+
sign
);
log
.
debug
(
"1拉取HCM出差数据sign="
+
sign
);
HttpHeaders
headers
=
new
HttpHeaders
();
MediaType
type
=
MediaType
.
parseMediaType
(
"application/json; charset=UTF-8"
);
headers
.
setContentType
(
type
);
...
...
@@ -338,7 +345,7 @@ public class QiWeiServiceImpl extends ServiceImpl<EkpQiweiChuchaiMapper, EkpQiwi
// 线上地址 appUrl = "http://119.96.166.49:28950/api/v1/instance/business/list?startTime={startTime}&endTime={endTime}"
// 测试地址 appUrl = "https://qas-hcm.yfzxtech.com:28950/api/v1/instance/business/list?startTime={startTime}&endTime={endTime}"
String
dataResultList
=
restTemplate
.
postForEntity
(
appUrl
,
formEntity
,
String
.
class
,
startTime
,
endTime
).
getBody
();
log
.
error
(
"1拉取HCM出差数据dataResultList="
+
dataResultList
);
log
.
debug
(
"1拉取HCM出差数据dataResultList="
+
dataResultList
);
if
(
Common
.
isEmpty
(
dataResultList
))
{
throw
new
AuthenticationServiceException
(
"获取HCM出差数据失败"
);
}
...
...
@@ -499,7 +506,7 @@ public class QiWeiServiceImpl extends ServiceImpl<EkpQiweiChuchaiMapper, EkpQiwi
String
errmsg
;
String
info
;
for
(
EkpQiwiZhaoPin
r
:
list
)
{
log
.
error
(
"企业微信招聘【"
+
i
+
"/"
+
""
+
list
.
size
()
+
"】条"
);
log
.
debug
(
"企业微信招聘【"
+
i
+
"/"
+
""
+
list
.
size
()
+
"】条"
);
jsonDetail
=
new
JSONObject
();
jsonDetail
.
put
(
"sp_no"
,
r
.
getFdSpNo
());
formEntityDetail
=
new
HttpEntity
<>(
jsonDetail
.
toString
(),
headers
);
...
...
@@ -549,7 +556,7 @@ public class QiWeiServiceImpl extends ServiceImpl<EkpQiweiChuchaiMapper, EkpQiwi
String
errmsg
;
String
info
;
for
(
EkpQiwiChuchai
r
:
list
)
{
log
.
error
(
"企业微信出差【"
+
i
+
"/"
+
""
+
list
.
size
()
+
"】条"
);
log
.
info
(
"企业微信出差【"
+
i
+
"/"
+
""
+
list
.
size
()
+
"】条"
);
jsonDetail
=
new
JSONObject
();
jsonDetail
.
put
(
"sp_no"
,
r
.
getFdSpNo
());
formEntityDetail
=
new
HttpEntity
<>(
jsonDetail
.
toString
(),
headers
);
...
...
@@ -1060,4 +1067,32 @@ public class QiWeiServiceImpl extends ServiceImpl<EkpQiweiChuchaiMapper, EkpQiwi
return
null
;
}
/**
* 获取HCM审批通过的加班数据并存储到EKP
* @param startDay 开始日期
* @param endDay 结束日期
* @author chenyuxi
* @since 1.9.6
* @date 2025-02-06
* @return R<List<EkpQiwiChuchai>>
**/
@Override
public
synchronized
R
<
List
<
EkpQiwiWorkovertime
>>
getHcmWorkOvertimeAndSave
(
String
startDay
,
String
endDay
)
{
try
{
String
startTime
=
startDay
+
START_TIME
;
String
endTime
=
endDay
+
END_TIME
;
// 可存储的数据
List
<
EkpQiwiWorkovertime
>
saveCpList
=
ekpQiweiWorkovertimeService
.
saveWorkovertimeList
(
startTime
,
endTime
);
return
new
R
<>(
saveCpList
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"拉取HCM审批通过的加班数据失败:"
,
e
);
return
R
.
failed
(
"拉取失败"
+
e
.
getMessage
());
}
}
}
yifu-permission/yifu-permission-biz/src/main/resources/application-dev.yml
View file @
e02d94fd
...
...
@@ -30,3 +30,4 @@ hcm:
appId
:
627673F79C6BAB92
appSecret
:
EA2641EF627673F79C6BAB9280137F00
appUrl
:
https://qas-hcm.yfzxtech.com:28950/api/v1/instance/business/list?startTime={startTime}&endTime={endTime}
appWorkOvertimeUrl
:
https://qas-hcm.yfzxtech.com:28950/api/v1/instance/overtime/list?startTime={startTime}&endTime={endTime}&flowName=项目加班流程
yifu-permission/yifu-permission-biz/src/main/resources/application-prd.yml
View file @
e02d94fd
...
...
@@ -30,3 +30,4 @@ hcm:
appId
:
b2475bbd0a7ef3f3
appSecret
:
C800A676B2475BBD0A7EF3F3C4265582
appUrl
:
https://hcm.yfzxtech.com/api/v1/instance/business/list?startTime={startTime}&endTime={endTime}
appWorkOvertimeUrl
:
https://hcm.yfzxtech.com/api/v1/instance/overtime/list?startTime={startTime}&endTime={endTime}&flowName=项目加班流程
yifu-permission/yifu-permission-biz/src/main/resources/application-test.yml
View file @
e02d94fd
...
...
@@ -30,3 +30,4 @@ hcm:
appId
:
627673F79C6BAB92
appSecret
:
EA2641EF627673F79C6BAB9280137F00
appUrl
:
https://qas-hcm.yfzxtech.com:28950/api/v1/instance/business/list?startTime={startTime}&endTime={endTime}
appWorkOvertimeUrl
:
https://qas-hcm.yfzxtech.com:28950/api/v1/instance/overtime/list?startTime={startTime}&endTime={endTime}&flowName=项目加班流程
yifu-permission/yifu-permission-biz/src/main/resources/logback-spring.xml
View file @
e02d94fd
...
...
@@ -54,5 +54,29 @@
<appender-ref
ref=
"debug"
/>
<appender-ref
ref=
"error"
/>
</root>
<springProfile
name=
"prd"
>
<root
level=
"error"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"debug"
/>
<appender-ref
ref=
"error"
/>
<appender-ref
ref=
"MAIL"
/>
</root>
</springProfile>
<springProfile
name=
"dev"
>
<root
level=
"info"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"debug"
/>
<appender-ref
ref=
"error"
/>
</root>
</springProfile>
<springProfile
name=
"test"
>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root
level=
"debug"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"debug"
/>
<appender-ref
ref=
"error"
/>
</root>
</springProfile>
</configuration>
yifu-permission/yifu-permission-biz/src/main/resources/mapper/EkpQiweiWorkovertimeMapper.xml
0 → 100644
View file @
e02d94fd
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yifu.cloud.plus.v1.permission.mapper.EkpQiweiWorkovertimeMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiWorkovertime"
>
<id
property=
"fdId"
column=
"fd_ID"
/>
<result
property=
"fdSpNo"
column=
"FD_SP_NO"
/>
<result
property=
"fdApplyUserName"
column=
"FD_APPLY_USER_NAME"
/>
<result
property=
"fdApplyUserDept"
column=
"FD_APPLY_USER_DEPT"
/>
<result
property=
"fdApplyDate"
column=
"FD_APPLY_DATE"
/>
<result
property=
"fdWorkBegin"
column=
"FD_WORK_BEGIN"
/>
<result
property=
"fdWorkEnd"
column=
"FD_WORK_END"
/>
<result
property=
"fdReason"
column=
"FD_REASON"
/>
<result
property=
"fdTimeUse"
column=
"FD_TIME_USE"
/>
<result
property=
"fdPositionLevel"
column=
"FD_POSITION_LEVEL"
/>
<result
property=
"fdProjectName"
column=
"FD_PROJECT_NAME"
/>
<result
property=
"fdProjectCode"
column=
"FD_PROJECT_CODE"
/>
<result
property=
"fdWorkDuration"
column=
"FD_WORK_DURATION"
/>
<result
property=
"fdHolidayDuration"
column=
"FD_HOLIDAY_DURATION"
/>
<result
property=
"fdRestDuration"
column=
"FD_REST_DURATION"
/>
<result
property=
"fdSumDuration"
column=
"FD_SUM_DURATION"
/>
<result
property=
"fdIsAway"
column=
"FD_IS_AWAY"
/>
<result
property=
"fdOvertimePayStatus"
column=
"FD_OVERTIME_PAY_STATUS"
/>
<result
property=
"fdOvertimePayId"
column=
"FD_OVERTIME_PAY_ID"
/>
<result
property=
"fdOvertimePayCode"
column=
"FD_OVERTIME_PAY_CODE"
/>
<result
property=
"fdOvertimeFoodStatus"
column=
"FD_OVERTIME_FOOD_STATUS"
/>
<result
property=
"fdOvertimeFoodId"
column=
"FD_OVERTIME_FOOD_ID"
/>
<result
property=
"fdOvertimeFoodCode"
column=
"FD_OVERTIME_FOOD_CODE"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"orgData"
column=
"org_data"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
a.FD_ID,
a.FD_SP_NO,
a.FD_APPLY_USER_NAME,
a.FD_APPLY_USER_DEPT,
a.FD_APPLY_DATE,
a.FD_WORK_BEGIN,
a.FD_WORK_END,
a.FD_REASON,
a.FD_TIME_USE,
a.FD_POSITION_LEVEL,
a.FD_PROJECT_NAME,
a.FD_PROJECT_CODE,
a.FD_WORK_DURATION,
a.FD_HOLIDAY_DURATION,
a.FD_REST_DURATION,
a.FD_SUM_DURATION,
a.FD_IS_AWAY,
a.FD_OVERTIME_PAY_STATUS,
a.FD_OVERTIME_PAY_ID,
a.FD_OVERTIME_PAY_CODE,
a.FD_OVERTIME_FOOD_STATUS,
a.FD_OVERTIME_FOOD_ID,
a.FD_OVERTIME_FOOD_CODE,
a.create_time,
a.org_data
</sql>
<!--获取全部的,用来: 拉取企业微信时,不覆盖数据 -->
<select
id=
"getWorkovertimeMapByTimeRange"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM ekp_qiwei_workovertime a
<where>
a.FD_APPLY_DATE >= #{queryStartTime} and a.FD_APPLY_DATE
<![CDATA[<=]]>
#{queryEndTime}
</where>
</select>
</mapper>
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