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
5889223c
Commit
5889223c
authored
Apr 29, 2024
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MVP1.6.3-HCM HCM的出差接口
parent
58dd59d5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
279 additions
and
20 deletions
+279
-20
CacheConstants.java
...oud/plus/v1/yifu/common/core/constant/CacheConstants.java
+2
-0
EkpPermissionTask.java
...com/yifu/cloud/plus/v1/job/compont/EkpPermissionTask.java
+15
-0
EkpQiwiChuchai.java
.../cloud/plus/v1/yifu/permission/entity/EkpQiwiChuchai.java
+4
-0
WxConfig.java
...va/com/yifu/cloud/plus/v1/permission/config/WxConfig.java
+45
-0
QiWeiController.java
.../cloud/plus/v1/permission/controller/QiWeiController.java
+31
-2
QiWeiService.java
...m/yifu/cloud/plus/v1/permission/service/QiWeiService.java
+2
-1
QiWeiServiceImpl.java
...oud/plus/v1/permission/service/impl/QiWeiServiceImpl.java
+165
-16
application-dev.yml
...ifu-permission-biz/src/main/resources/application-dev.yml
+4
-0
application-prd.yml
...ifu-permission-biz/src/main/resources/application-prd.yml
+4
-0
application-test.yml
...fu-permission-biz/src/main/resources/application-test.yml
+4
-0
EkpQiweiChuchaiMapper.xml
...n-biz/src/main/resources/mapper/EkpQiweiChuchaiMapper.xml
+3
-1
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/constant/CacheConstants.java
View file @
5889223c
...
...
@@ -170,6 +170,8 @@ public interface CacheConstants {
// 项目报销token的key
String
WX_REIMBURSEMENT_TOKEN
=
"WX_REIMBURSEMENT_TOKEN"
;
// HCM出差的sign
String
HCM_CHU_CHAI_SIGN
=
"HCM_CHU_CHAI_SIGN"
;
public
static
final
String
WX_ACCOSS_TOKEN
=
"WX_ACCOSS_TOKEN"
;
...
...
yifu-job/yifu-job-api/src/main/java/com/yifu/cloud/plus/v1/job/compont/EkpPermissionTask.java
View file @
5889223c
...
...
@@ -52,4 +52,19 @@ public class EkpPermissionTask {
log
.
info
(
"-------------获取企业微信出差数据-定时任务结束------------"
);
}
/**
* @return
* @Author hgw
* @Description 每天1点,定时同步HCM审批出差数据
* @Date 2024-4-29 15:59:31
* @Param
**/
public
void
doSaveHcmChuChai
()
throws
Exception
{
log
.
info
(
"-------------获取HCM出差数据-定时任务开始------------"
);
HttpDaprUtil
.
invokeMethodPost
(
daprEkpPermissionProperties
.
getAppUrl
(),
daprEkpPermissionProperties
.
getAppId
(),
"/qiWei/inner/everyDaySaveHcmChuChai"
,
""
,
Object
.
class
,
SecurityConstants
.
FROM_IN
);
log
.
info
(
"-------------获取HCM出差数据-定时任务结束------------"
);
}
}
\ No newline at end of file
yifu-permission/yifu-permission-api/src/main/java/com/yifu/cloud/plus/v1/yifu/permission/entity/EkpQiwiChuchai.java
View file @
5889223c
...
...
@@ -78,4 +78,8 @@ public class EkpQiwiChuchai {
@Schema
(
description
=
"创建时间"
)
private
LocalDateTime
createTime
;
// 企微、HCM
@Schema
(
description
=
"数据源"
)
private
String
fdDataSource
;
}
\ No newline at end of file
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/config/WxConfig.java
View file @
5889223c
...
...
@@ -10,6 +10,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.binary.Hex
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -21,6 +22,8 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.security.authentication.AuthenticationServiceException
;
import
org.springframework.web.client.RestTemplate
;
import
java.nio.charset.StandardCharsets
;
import
java.security.MessageDigest
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -47,12 +50,54 @@ public class WxConfig {
@Value
(
"${wx.authUrl}"
)
private
String
authUrl
;
// 获取HCM相关信息
@Value
(
"${hcm.appId}"
)
private
String
hcmAppId
;
@Value
(
"${hcm.appSecret}"
)
private
String
hcmAppSecret
;
@Value
(
"${hcm.appUrl}"
)
private
String
hcmAppUrl
;
@Autowired
private
RedisTemplate
redisTemplate
;
//未授权
private
String
accossTokenInvliad
=
"40014"
;
/**
* @Description: 获取HCM出差的sign
* @Author: hgw
* @Date: 2024-4-29 15:34:54
* @return: java.lang.String
**/
public
String
getHcmSign
()
{
String
sign
=
null
;
Object
wxToken
=
redisTemplate
.
opsForValue
().
get
(
CacheConstants
.
HCM_CHU_CHAI_SIGN
);
if
(
null
!=
wxToken
)
{
return
String
.
valueOf
(
wxToken
);
}
try
{
byte
[]
a
=
(
hcmAppId
+
hcmAppSecret
).
getBytes
(
StandardCharsets
.
UTF_8
);
sign
=
Hex
.
encodeHexString
(
MessageDigest
.
getInstance
(
"SHA-256"
).
digest
(
a
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"2拉取HCM出差数据sign出错="
+
e
.
getMessage
());
}
redisTemplate
.
opsForValue
().
set
(
CacheConstants
.
HCM_CHU_CHAI_SIGN
,
sign
);
redisTemplate
.
expire
(
CacheConstants
.
HCM_CHU_CHAI_SIGN
,
3600
,
TimeUnit
.
SECONDS
);
return
sign
;
}
/**
* @Description: 获取HCM出差的url
* @Author: hgw
* @Date: 2024-4-29 15:34:54
* @return: java.lang.String
**/
public
String
getHcmChuChaiUrl
()
{
return
hcmAppUrl
;
}
/**
* @param restTemplate
* @Description: 获取项目报销的token
...
...
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/controller/QiWeiController.java
View file @
5889223c
...
...
@@ -38,7 +38,7 @@ public class QiWeiController {
public
R
<
List
<
EkpQiwiChuchai
>>
everyDaySaveQiWeiChuChai
()
{
String
startDay
=
DateUtil
.
addDay
(-
29
);
String
endDay
=
DateUtil
.
addDay
(
0
);
return
wxSalaryService
.
getQiWeiChuChaiAndSave
(
startDay
,
endDay
);
return
wxSalaryService
.
getQiWeiChuChaiAndSave
(
startDay
,
endDay
,
1
);
}
/**
...
...
@@ -53,7 +53,36 @@ public class QiWeiController {
@PostMapping
(
"/getQiWeiChuCHaiInfoAndSave"
)
//@PreAuthorize("@pms.hasPermission('wxhr:wxsalaryauth')")
public
R
<
List
<
EkpQiwiChuchai
>>
getQiWeiChuCHaiInfoAndSave
(
@RequestParam
String
startTime
,
@RequestParam
String
endTime
)
{
return
wxSalaryService
.
getQiWeiChuChaiAndSave
(
startTime
,
endTime
);
return
wxSalaryService
.
getQiWeiChuChaiAndSave
(
startTime
,
endTime
,
1
);
}
/**
* @Description: 每日获取当日HCM的E人事审批里的出差
* @Author: hgw
* @Date: 2024-4-28 16:51:16
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.List < com.yifu.cloud.v1.hrms.api.entity.TEventFeeDetail>>
**/
@PostMapping
(
"/inner/everyDaySaveHcmChuChai"
)
@Inner
public
R
<
List
<
EkpQiwiChuchai
>>
everyDaySaveHcmChuChai
()
{
String
startDay
=
DateUtil
.
addDay
(-
1
);
String
endDay
=
DateUtil
.
addDay
(
0
);
return
wxSalaryService
.
getQiWeiChuChaiAndSave
(
startDay
,
endDay
,
2
);
}
/**
* @param startTime
* @param endTime
* @Description: 获取HCM的E人事审批里的出差
* @Author: hgw
* @Date: 2024-4-28 16:51:39
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.List < com.yifu.cloud.v1.hrms.api.entity.TStatisticsProjectReimburse>>
**/
@Operation
(
description
=
"获取HCM的E人事审批里的出差:startTime格式:2024-04-10"
)
@PostMapping
(
"/getHcmChuChaiInfoAndSave"
)
//@PreAuthorize("@pms.hasPermission('wxhr:wxsalaryauth')")
public
R
<
List
<
EkpQiwiChuchai
>>
getHcmChuChaiInfoAndSave
(
@RequestParam
String
startTime
,
@RequestParam
String
endTime
)
{
return
wxSalaryService
.
getQiWeiChuChaiAndSave
(
startTime
,
endTime
,
2
);
}
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/QiWeiService.java
View file @
5889223c
...
...
@@ -17,11 +17,12 @@ public interface QiWeiService extends IService<EkpQiwiChuchai> {
/**
* @param startTime
* @param endTime
* @param type 1:企业微信;2:HCM的E人事
* @Description: 获取微信信息
* @Author: hgw
* @Date: 2021-7-28 17:46:01
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.List < com.yifu.cloud.v1.hrms.api.entity.TStatisticsProjectReimburse>>
**/
R
<
List
<
EkpQiwiChuchai
>>
getQiWeiChuChaiAndSave
(
String
startTime
,
String
endTime
);
R
<
List
<
EkpQiwiChuchai
>>
getQiWeiChuChaiAndSave
(
String
startTime
,
String
endTime
,
int
type
);
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/impl/QiWeiServiceImpl.java
View file @
5889223c
This diff is collapsed.
Click to expand it.
yifu-permission/yifu-permission-biz/src/main/resources/application-dev.yml
View file @
5889223c
...
...
@@ -26,3 +26,7 @@ spring:
maximum-pool-size
:
12
# 连接池最大连接数,默认是10
auto-commit
:
true
#此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime
:
0
#此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
hcm
:
appId
:
627673F79C6BAB92
appSecret
:
EA2641EF627673F79C6BAB9280137F00
appUrl
:
https://qas-hcm.yfzxtech.com:28950/api/v1/instance/business/list?startTime={startTime}&endTime={endTime}
\ No newline at end of file
yifu-permission/yifu-permission-biz/src/main/resources/application-prd.yml
View file @
5889223c
...
...
@@ -26,3 +26,7 @@ spring:
maximum-pool-size
:
12
# 连接池最大连接数,默认是10
auto-commit
:
true
#此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime
:
0
#此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
hcm
:
appId
:
b2475bbd0a7ef3f3
appSecret
:
C800A676B2475BBD0A7EF3F3C4265582
appUrl
:
https://119.96.166.49:28950/api/v1/instance/business/list?startTime={startTime}&endTime={endTime}
\ No newline at end of file
yifu-permission/yifu-permission-biz/src/main/resources/application-test.yml
View file @
5889223c
...
...
@@ -26,3 +26,7 @@ spring:
maximum-pool-size
:
12
# 连接池最大连接数,默认是10
auto-commit
:
true
#此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime
:
0
#此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
hcm
:
appId
:
627673F79C6BAB92
appSecret
:
EA2641EF627673F79C6BAB9280137F00
appUrl
:
https://qas-hcm.yfzxtech.com:28950/api/v1/instance/business/list?startTime={startTime}&endTime={endTime}
\ No newline at end of file
yifu-permission/yifu-permission-biz/src/main/resources/mapper/EkpQiweiChuchaiMapper.xml
View file @
5889223c
...
...
@@ -24,6 +24,7 @@
<result
property=
"fdStatus"
column=
"FD_STATUS"
/>
<result
property=
"fdSettleFormId"
column=
"FD_SETTLE_FORM_ID"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"fdDataSource"
column=
"FD_DATA_SOURCE"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
...
...
@@ -45,7 +46,8 @@
a.FD_REN_SHU,
a.FD_STATUS,
a.FD_SETTLE_FORM_ID,
a.create_time
a.create_time,
a.FD_DATA_SOURCE
</sql>
<!--获取全部的,用来: 拉取企业微信时,不覆盖数据 -->
<select
id=
"getAllInfo"
resultMap=
"BaseResultMap"
>
...
...
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