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
504be995
Commit
504be995
authored
Jun 23, 2025
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MVP1.7.12-对接瓜子接口
parent
f20dbd51
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
7 deletions
+78
-7
GzConfig.java
...com/yifu/cloud/plus/v1/yifu/archives/config/GzConfig.java
+50
-0
TGzController.java
...cloud/plus/v1/yifu/archives/controller/TGzController.java
+27
-7
application.yml
...ives/yifu-archives-biz/src/main/resources/application.yml
+1
-0
No files found.
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/config/GzConfig.java
View file @
504be995
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
config
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
config
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.Date
;
/**
/**
* @Author: hgw
* @Author: hgw
...
@@ -24,4 +35,43 @@ public class GzConfig {
...
@@ -24,4 +35,43 @@ public class GzConfig {
private
String
tid
;
private
String
tid
;
@Value
(
"${gz.appUrl}"
)
@Value
(
"${gz.appUrl}"
)
private
String
appUrl
;
private
String
appUrl
;
private
static
final
String
APP_KEY
=
"appKey"
;
private
static
final
String
TIMESTAMP
=
"timestamp"
;
private
static
final
String
X_REQ_NONCE
=
"xReqNonce"
;
private
static
final
String
VERSION
=
"version"
;
public
boolean
getGzBankInfo
(
RestTemplate
restTemplate
,
long
expires
,
String
signature
,
String
pageNum
,
String
pageSize
,
String
startTime
,
String
endTime
)
{
String
gzBankUrl
=
appUrl
+
"/eim-hr-induction/api/hr/induction/open/base/bank-branch?pageNum=%s&pageSize=%s&startTime=%s&endTime=%s&appkey=%s&expires=%s&signature=%s"
;
String
requestUrl
=
String
.
format
(
gzBankUrl
,
pageNum
,
pageSize
,
startTime
,
endTime
,
appkey
,
expires
,
signature
);
//String result = restTemplate.getForObject(requestUrl, String.class);
// 创建请求头并添加Authorization
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
set
(
"Authorization"
,
"00000000"
);
// 设置Authorization头
// 创建HttpEntity,包含headers(GET请求没有body,所以为null)
HttpEntity
<
String
>
entity
=
new
HttpEntity
<>(
null
,
headers
);
// 发送GET请求
String
result
=
restTemplate
.
exchange
(
requestUrl
,
HttpMethod
.
GET
,
entity
,
String
.
class
).
getBody
();
if
(
result
!=
null
&&
result
.
contains
(
"code"
)
&&
result
.
contains
(
"data"
))
{
JSONObject
resultObject
=
JSON
.
parseObject
(
result
);
String
code
=
resultObject
.
getString
(
"code"
);
if
(
Common
.
isNotNull
(
code
)
&&
"S00000"
.
equals
(
code
))
{
String
data
=
resultObject
.
getString
(
"data"
);
JSONObject
dataObject
=
JSON
.
parseObject
(
data
);
String
bankCd
=
dataObject
.
getString
(
"bankCd"
);
String
cnapsId
=
dataObject
.
getString
(
"cnapsId"
);
// TODO - 继续解析参数并存储
System
.
out
.
println
(
"bankCd="
+
bankCd
);
System
.
out
.
println
(
"cnapsId="
+
cnapsId
);
return
true
;
}
}
return
false
;
}
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TGzController.java
View file @
504be995
...
@@ -26,9 +26,12 @@ import io.swagger.v3.oas.annotations.tags.Tag;
...
@@ -26,9 +26,12 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -50,12 +53,13 @@ public class TGzController {
...
@@ -50,12 +53,13 @@ public class TGzController {
private
final
TGzOfferInfoService
tGzOfferInfoService
;
private
final
TGzOfferInfoService
tGzOfferInfoService
;
private
RestTemplate
restTemplate
=
new
RestTemplate
();
/**
/**
*
接收推送信息的接口
*
@Description: 接收瓜子推送过来的Offer信息
*
*
@Author: hgw
* @
param params 包含业务参数和签名的Map
* @
Date: 2025/6/23 15:27
* @return
处理结果
* @return
: com.yifu.cloud.plus.v1.yifu.archives.utils.ReturnGz<java.lang.String>
*/
*
*
/
@PostMapping
(
"/saveOfferInfo"
)
@PostMapping
(
"/saveOfferInfo"
)
public
ReturnGz
<
String
>
saveOfferInfo
(
@RequestBody
TGzOfferInfo
tGzOfferInfo
public
ReturnGz
<
String
>
saveOfferInfo
(
@RequestBody
TGzOfferInfo
tGzOfferInfo
,
@RequestParam
String
appkey
,
@RequestParam
String
expires
,
@RequestParam
String
signature
)
{
,
@RequestParam
String
appkey
,
@RequestParam
String
expires
,
@RequestParam
String
signature
)
{
...
@@ -87,8 +91,6 @@ public class TGzController {
...
@@ -87,8 +91,6 @@ public class TGzController {
/**
/**
* 处理推送的业务数据
* 处理推送的业务数据
*
* @param params 业务参数
* @return 处理结果
* @return 处理结果
*/
*/
private
ReturnGz
<
String
>
saveData
(
TGzOfferInfo
tGzOfferInfo
)
{
private
ReturnGz
<
String
>
saveData
(
TGzOfferInfo
tGzOfferInfo
)
{
...
@@ -101,5 +103,23 @@ public class TGzController {
...
@@ -101,5 +103,23 @@ public class TGzController {
return
ReturnGz
.
ok
();
return
ReturnGz
.
ok
();
}
}
/**
* @Description: 获取瓜子银行支行信息的接口
* @Author: hgw
* @Date: 2025/6/23 15:28
* @return: boolean
**/
@PostMapping
(
"/getGzBank"
)
public
boolean
getGzBank
(
@RequestParam
String
pageNum
,
@RequestParam
String
pageSize
,
@RequestParam
String
startTime
,
@RequestParam
String
endTime
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"appkey"
,
gzConfig
.
getAppkey
());
long
expires
=
new
Date
().
getTime
()
+
30000
;
params
.
put
(
"expires"
,
expires
);
// 2. 计算期望的签名
String
signature
=
GZSign
.
getSignature
(
params
,
gzConfig
.
getAppsecret
());
return
gzConfig
.
getGzBankInfo
(
restTemplate
,
expires
,
signature
,
pageNum
,
pageSize
,
startTime
,
endTime
);
}
}
}
yifu-archives/yifu-archives-biz/src/main/resources/application.yml
View file @
504be995
...
@@ -58,6 +58,7 @@ security:
...
@@ -58,6 +58,7 @@ security:
-
/employeeregistrationpre/judgeIsSimple
-
/employeeregistrationpre/judgeIsSimple
-
/tgzempinfo/getInfoByOfferId
-
/tgzempinfo/getInfoByOfferId
-
/gz/core/saveOfferInfo
-
/gz/core/saveOfferInfo
-
/gz/core/getGzBank
# 文件上传相关 支持阿里云、华为云、腾讯、minio
# 文件上传相关 支持阿里云、华为云、腾讯、minio
...
...
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