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
f20dbd51
Commit
f20dbd51
authored
Jun 23, 2025
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MVP1.7.12-保存人员档案1
parent
49d87fdf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
30 deletions
+126
-30
TGzController.java
...cloud/plus/v1/yifu/archives/controller/TGzController.java
+26
-30
ReturnGz.java
.../com/yifu/cloud/plus/v1/yifu/archives/utils/ReturnGz.java
+99
-0
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/controller/TGzController.java
View file @
f20dbd51
...
@@ -18,18 +18,18 @@
...
@@ -18,18 +18,18 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
controller
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
controller
;
import
com.yifu.cloud.plus.v1.yifu.archives.config.GzConfig
;
import
com.yifu.cloud.plus.v1.yifu.archives.config.GzConfig
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TGzOfferInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TGzOfferInfoService
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TGzOfferInfoService
;
import
com.yifu.cloud.plus.v1.yifu.archives.utils.GZSign
;
import
com.yifu.cloud.plus.v1.yifu.archives.utils.GZSign
;
import
com.yifu.cloud.plus.v1.yifu.
common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.
archives.utils.ReturnGz
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
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.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.time.LocalDateTime
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -56,40 +56,33 @@ public class TGzController {
...
@@ -56,40 +56,33 @@ public class TGzController {
* @param params 包含业务参数和签名的Map
* @param params 包含业务参数和签名的Map
* @return 处理结果
* @return 处理结果
*/
*/
@PostMapping
(
"/
receive
"
)
@PostMapping
(
"/
saveOfferInfo
"
)
public
R
<
String
>
receivePush
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
R
eturnGz
<
String
>
saveOfferInfo
(
@RequestBody
TGzOfferInfo
tGzOfferInfo
// 1. 验证签名
,
@RequestParam
String
appkey
,
@RequestParam
String
expires
,
@RequestParam
String
signature
)
{
String
receivedSignature
=
(
String
)
params
.
get
(
"signature"
);
if
(
receivedSignature
==
null
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
return
R
.
failed
(
"签名参数缺失"
);
params
.
put
(
"appkey"
,
appkey
);
}
params
.
put
(
"expires"
,
expires
);
params
.
put
(
"signature"
,
signature
);
// 2. 计算期望的签名
// 2. 计算期望的签名
String
expectedSignature
=
GZSign
.
getSignature
(
params
,
gzConfig
.
getAppsecret
());
String
expectedSignature
=
GZSign
.
getSignature
(
params
,
gzConfig
.
getAppsecret
());
// 3. 比较签名是否一致
// 3. 比较签名是否一致
if
(!
receivedSignature
.
equals
(
expectedSignature
))
{
if
(!
signature
.
equals
(
expectedSignature
))
{
return
R
.
failed
(
"签名验证失败"
);
return
ReturnGz
.
failed
(
"签名验证失败"
);
}
// 4. 验证时间戳是否过期
String
expiresStr
=
(
String
)
params
.
get
(
"expires"
);
if
(
expiresStr
==
null
)
{
return
R
.
failed
(
"过期时间参数缺失"
);
}
}
try
{
try
{
long
expires
=
Long
.
parseLong
(
expiresStr
);
long
expires
Long
=
Long
.
parseLong
(
expires
);
long
currentTime
=
System
.
currentTimeMillis
()
/
1000
;
long
currentTime
=
System
.
currentTimeMillis
()
/
1000
;
if
(
currentTime
>
expires
)
{
if
(
currentTime
>
expires
Long
)
{
return
R
.
failed
(
"请求已过期"
);
return
R
eturnGz
.
failed
(
"请求已过期"
);
}
}
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
return
R
.
failed
(
"过期时间格式错误"
);
return
R
eturnGz
.
failed
(
"过期时间格式错误"
);
}
}
// 5. 签名验证通过,处理业务逻辑
// 5. 签名验证通过,处理业务逻辑
return
processPushData
(
params
);
return
this
.
saveData
(
tGzOfferInfo
);
}
}
/**
/**
...
@@ -98,11 +91,14 @@ public class TGzController {
...
@@ -98,11 +91,14 @@ public class TGzController {
* @param params 业务参数
* @param params 业务参数
* @return 处理结果
* @return 处理结果
*/
*/
private
R
<
String
>
processPushData
(
Map
<
String
,
Object
>
params
)
{
private
R
eturnGz
<
String
>
saveData
(
TGzOfferInfo
tGzOfferInfo
)
{
// 这里实现你的业务逻辑
// 这里实现你的业务逻辑
// 例如:解析参数、保存数据、触发后续处理等
// 例如:解析参数、保存数据、触发后续处理等
tGzOfferInfo
.
setCreateBy
(
"3"
);
return
R
.
ok
();
tGzOfferInfo
.
setCreateName
(
"瓜子推送"
);
tGzOfferInfo
.
setCreateTime
(
LocalDateTime
.
now
());
tGzOfferInfoService
.
save
(
tGzOfferInfo
);
return
ReturnGz
.
ok
();
}
}
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/utils/ReturnGz.java
0 → 100644
View file @
f20dbd51
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
utils
;
import
lombok.*
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* 响应瓜子
* @author lengleng
*/
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Accessors
(
chain
=
true
)
public
class
ReturnGz
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
String
GZ_OK_MSG
=
"成功"
;
private
static
final
String
GZ_OK
=
"S00000"
;
private
static
final
String
GZ_FAIL
=
"1"
;
@Getter
@Setter
private
String
code
;
@Getter
@Setter
private
String
message
;
@Getter
@Setter
private
String
redirectUrl
;
@Getter
@Setter
private
T
data
;
public
ReturnGz
(
T
data
)
{
super
();
this
.
data
=
data
;
this
.
code
=
"S00000"
;
}
public
static
<
T
>
ReturnGz
<
T
>
ok
()
{
return
restResult
(
null
,
"S00000"
,
GZ_OK_MSG
);
}
public
static
<
T
>
ReturnGz
<
T
>
ok
(
T
data
)
{
return
restResult
(
data
,
GZ_OK
,
GZ_OK_MSG
);
}
public
static
<
T
>
ReturnGz
<
T
>
ok
(
T
data
,
String
msg
)
{
return
restResult
(
data
,
GZ_OK
,
msg
);
}
public
static
<
T
>
ReturnGz
<
T
>
failed
()
{
return
restResult
(
null
,
GZ_FAIL
,
null
);
}
public
static
<
T
>
ReturnGz
<
T
>
failed
(
String
msg
)
{
return
restResult
(
null
,
GZ_FAIL
,
msg
);
}
public
static
<
T
>
ReturnGz
<
T
>
failed
(
T
data
)
{
return
restResult
(
data
,
GZ_FAIL
,
null
);
}
public
static
<
T
>
ReturnGz
<
T
>
failed
(
T
data
,
String
msg
)
{
return
restResult
(
data
,
GZ_FAIL
,
msg
);
}
private
static
<
T
>
ReturnGz
<
T
>
restResult
(
T
data
,
String
code
,
String
msg
)
{
ReturnGz
<
T
>
apiResult
=
new
ReturnGz
<>();
apiResult
.
setCode
(
code
);
apiResult
.
setData
(
data
);
apiResult
.
setMessage
(
msg
);
apiResult
.
setRedirectUrl
(
null
);
return
apiResult
;
}
}
yifu-archives/yifu-archives-biz/src/main/resources/application.yml
View file @
f20dbd51
...
@@ -57,6 +57,7 @@ security:
...
@@ -57,6 +57,7 @@ security:
-
/employeeregistrationpre/getGzEmployeeInfo
-
/employeeregistrationpre/getGzEmployeeInfo
-
/employeeregistrationpre/judgeIsSimple
-
/employeeregistrationpre/judgeIsSimple
-
/tgzempinfo/getInfoByOfferId
-
/tgzempinfo/getInfoByOfferId
-
/gz/core/saveOfferInfo
# 文件上传相关 支持阿里云、华为云、腾讯、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