Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-cloud-core
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-cloud-core
Commits
fa3afc51
Commit
fa3afc51
authored
Aug 11, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into prod
parents
6ee3c061
d352bc1b
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
388 additions
and
1 deletions
+388
-1
yd-auth-core/src/main/java/com/yd/auth/core/config/SecurityConfig.java
+6
-1
yd-auth-core/src/main/java/com/yd/auth/core/response/LoginResponse.java
+1
-0
yd-auth-core/src/main/java/com/yd/auth/core/service/impl/AuthServiceImpl.java
+1
-0
yd-common/src/main/java/com/yd/common/constant/ServerNameConstants.java
+5
-0
yd-common/src/main/java/com/yd/common/enums/CommonEnum.java
+3
-0
yd-common/src/main/java/com/yd/common/enums/ProjectEnum.java
+1
-0
yd-common/src/main/java/com/yd/common/enums/ResultCode.java
+1
-0
yd-common/src/main/java/com/yd/common/result/CommonResult.java
+126
-0
yd-common/src/main/java/com/yd/common/result/JsonResult.java
+110
-0
yd-common/src/main/java/com/yd/common/utils/ByteArrayMultipartFile.java
+76
-0
yd-common/src/main/java/com/yd/common/utils/RedisUtil.java
+25
-0
yd-feign/pom.xml
+10
-0
yd-feign/src/main/java/com/yd/feign/config/FeignMultipartConfig.java
+19
-0
yd-gateway/src/main/java/com/yd/gateway/config/GatewayJwtAuthFilterConfig.java
+4
-0
No files found.
yd-auth-core/src/main/java/com/yd/auth/core/config/SecurityConfig.java
View file @
fa3afc51
...
...
@@ -73,6 +73,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/clientUser/clientUserBizIdList"
,
"/salary/condition/list"
,
"/salary/detail"
,
"/coSession/create"
,
"/coSession/join"
,
"/coSession/status"
,
"/oss/upload/body/json"
,
"/notificationTask/send"
,
"/userSaleExpand/list"
,
"/relProjectRole/page"
,
...
...
@@ -84,7 +88,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/user/api/v3/api-docs"
,
"/insurance/base/api/v3/api-docs"
,
"/csf/api/v3/api-docs"
,
"/auth/v3/api-docs"
"/auth/v3/api-docs"
,
"/ws/**"
).
permitAll
()
.
anyRequest
().
authenticated
()
.
and
()
...
...
yd-auth-core/src/main/java/com/yd/auth/core/response/LoginResponse.java
View file @
fa3afc51
...
...
@@ -4,6 +4,7 @@ import lombok.Data;
@Data
public
class
LoginResponse
{
private
String
userBizId
;
private
String
token
;
private
String
tokenType
=
"Bearer"
;
private
long
expiresIn
;
...
...
yd-auth-core/src/main/java/com/yd/auth/core/service/impl/AuthServiceImpl.java
View file @
fa3afc51
...
...
@@ -100,6 +100,7 @@ public class AuthServiceImpl implements AuthService {
LoginResponse
response
=
new
LoginResponse
();
response
.
setToken
(
token
);
// 设置生成的JWT令牌
response
.
setExpiresIn
(
jwtTokenProvider
.
getJwtExpiration
());
// 设置令牌过期时间
response
.
setUserBizId
(
sysUser
.
getUserBizId
());
//获取用户登录信息存入redis缓存中,2天
AuthUserDto
currentUser
=
(
AuthUserDto
)
authenticated
.
getPrincipal
();
...
...
yd-common/src/main/java/com/yd/common/constant/ServerNameConstants.java
View file @
fa3afc51
...
...
@@ -79,4 +79,9 @@ public class ServerNameConstants {
* yd-notice-api 通知微服务
*/
public
static
String
ydNoticeApi
=
"yd-notice-api"
;
/**
* yd-communication-api 通信微服务
*/
public
static
String
ydCommunicationApi
=
"yd-communication-api"
;
}
yd-common/src/main/java/com/yd/common/enums/CommonEnum.java
View file @
fa3afc51
...
...
@@ -88,6 +88,9 @@ public enum CommonEnum {
UID_TYPE_AGENT_REFERRAL_RELATION
(
"agent_referral_relation"
,
"推荐关系表"
),
UID_TYPE_AGENT_MANAGE_RELATION
(
"agent_manage_relation"
,
"管理关系表"
),
UID_TYPE_TEAM
(
"team"
,
"团队信息表"
),
UID_TYPE_CO_SESSION
(
"co_session"
,
"协同会话表"
),
UID_TYPE_RECORDING_TASK
(
"recording_task"
,
"录制任务表"
),
UID_TYPE_DESENSITIZATION_RULE
(
"co_desensitization_rule"
,
"协同-脱敏设置表"
),
//作用域枚举
SCOPE_SYS
(
"1"
,
"系统级(全局)"
),
...
...
yd-common/src/main/java/com/yd/common/enums/ProjectEnum.java
View file @
fa3afc51
...
...
@@ -7,6 +7,7 @@ public enum ProjectEnum {
CSF_MINI_PROGRAM
(
"project_IbjfmMTYvNEBuh2S"
,
"CSF-小程序"
,
""
),
CSF_PC
(
"project_nKULQBH1Gw9Ma8YM"
,
"CSF-PC"
,
""
),
SFP_CLIENT
(
"project_5RlbyC3WQPPR5T88"
,
"家办商城小程序"
,
""
),
;
//项目表唯一业务ID
...
...
yd-common/src/main/java/com/yd/common/enums/ResultCode.java
View file @
fa3afc51
...
...
@@ -28,6 +28,7 @@ public enum ResultCode {
FORBIDDEN_ERROR
(
40300
,
"禁止访问"
,
""
),
SENSITIVE_WORDS_EXIST
(
50001
,
"存在禁用类型敏感词"
,
""
),
SENSITIVE_TZ_WORDS_EXIST
(
50002
,
"存在通知类型敏感词"
,
""
),
LINK_INVALID
(
50003
,
"访问链接失效"
,
""
),
;
//返回码
...
...
yd-common/src/main/java/com/yd/common/result/CommonResult.java
0 → 100644
View file @
fa3afc51
package
com
.
yd
.
common
.
result
;
import
java.io.Serializable
;
public
class
CommonResult
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
Boolean
success
;
//执行是否成功
private
String
code
;
//ZHB错误编码
private
String
message
;
//ZHB错误信息
private
String
errorCode
;
//其他平台错误编码
private
String
errorMessage
;
//其他平台错误编码
private
String
flag
;
/**
* 执行是否成功
* @return
*/
public
Boolean
isSuccess
()
{
return
success
;
}
/**
* 执行是否成功
* @param success
*/
public
void
setSuccess
(
Boolean
success
)
{
this
.
success
=
success
;
}
/**
* 获取属性 code
* @return code 最惠比平台对应的错误编码
*/
public
String
getCode
()
{
return
code
;
}
/**
* 属性赋值 code
* @param code 最惠比平台对应的错误编码
*/
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
/**
* 获取属性 message
* @return 最惠比平台对应的错误信息
*/
public
String
getMessage
()
{
return
message
;
}
/**
* 属性赋值 message
* @param message 最惠比平台对应的错误信息
*/
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
/**
* 获取属性 errorCode
* @return 其他平台对应的错误编码
*/
public
String
getErrorCode
()
{
return
errorCode
;
}
/**
* 属性赋值 errorCode
* @param errorCode 其他平台对应的错误编码
*/
public
void
setErrorCode
(
String
errorCode
)
{
this
.
errorCode
=
errorCode
;
}
/**
* 获取属性 errorMessage
* @return 其他平台对应的错误信息
*/
public
String
getErrorMessage
()
{
return
errorMessage
;
}
/**
* 属性赋值 errorMessage
* @param errorMessage 其他平台对应的错误信息
*/
public
void
setErrorMessage
(
String
errorMessage
)
{
this
.
errorMessage
=
errorMessage
;
}
public
String
getFlag
()
{
return
flag
;
}
public
void
setFlag
(
String
flag
)
{
this
.
flag
=
flag
;
}
public
CommonResult
()
{
super
();
}
/**
* @param success 是否执行成功
* @param message 最惠比平台错误信息
*/
public
CommonResult
(
Boolean
success
,
String
message
)
{
super
();
this
.
success
=
success
;
this
.
message
=
message
;
}
/**
* @param success 是否执行成功
* @param message 最惠比平台错误信息
* @param errorCode 其他平台错误编码
*/
public
CommonResult
(
Boolean
success
,
String
message
,
String
errorCode
)
{
super
();
this
.
success
=
success
;
this
.
message
=
message
;
this
.
errorCode
=
errorCode
;
}
/**
* @param success 是否执行成功
* @param message 最惠比平台错误信息
* @param errorCode 其他平台错误编码
* @param errorMessage 其他平台错误信息
*/
public
CommonResult
(
Boolean
success
,
String
message
,
String
errorCode
,
String
errorMessage
)
{
super
();
this
.
success
=
success
;
this
.
message
=
message
;
this
.
errorCode
=
errorCode
;
this
.
errorMessage
=
errorMessage
;
}
}
yd-common/src/main/java/com/yd/common/result/JsonResult.java
0 → 100644
View file @
fa3afc51
package
com
.
yd
.
common
.
result
;
import
java.io.Serializable
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
/***
* 返回结果封装
*
* @author fan
*
*/
public
class
JsonResult
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
boolean
success
;
private
String
message
;
private
Object
data
;
public
JsonResult
(){}
public
JsonResult
(
boolean
success
,
String
msg
,
Object
data
){
this
.
success
=
success
;
this
.
message
=
msg
;
this
.
data
=
data
;
}
public
JsonResult
(
boolean
success
,
String
msg
){
this
.
success
=
success
;
this
.
message
=
msg
;
this
.
data
=
null
;
}
private
JsonResult
(
String
msg
,
Object
data
)
{
this
.
message
=
msg
;
this
.
success
=
true
;
this
.
data
=
data
;
}
public
Object
getData
()
{
return
data
;
}
public
String
getMessage
()
{
return
message
;
}
public
boolean
isSuccess
()
{
return
success
;
}
public
JsonResult
ofSuccess
(
String
msg
,
Object
data
)
{
return
new
JsonResult
(
msg
,
data
)
;
}
public
void
setData
(
Object
data
)
{
this
.
data
=
data
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
void
setSuccess
(
boolean
success
)
{
this
.
success
=
success
;
}
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
public
void
addResult
(
Object
responseVO
){
Class
c
=
responseVO
.
getClass
();
Method
getMethod
=
null
;
try
{
Class
[]
classArr
=
null
;
getMethod
=
c
.
getMethod
(
"getCommonResult"
,
classArr
);
}
catch
(
NoSuchMethodException
|
SecurityException
e1
)
{
e1
.
printStackTrace
();
}
CommonResult
commonResult
=
null
;
if
(
getMethod
!=
null
){
try
{
Object
[]
objectArr
=
null
;
commonResult
=
(
CommonResult
)
getMethod
.
invoke
(
responseVO
,
objectArr
);
}
catch
(
IllegalAccessException
|
IllegalArgumentException
|
InvocationTargetException
e
)
{
e
.
printStackTrace
();
}
}
if
(
commonResult
!=
null
){
this
.
success
=
commonResult
.
isSuccess
();
this
.
message
=
commonResult
.
getMessage
();
}
else
{
this
.
success
=
true
;
// this.message = ZHBErrorConfig.getErrorInfo("600001", null, null);
}
// Method setMethod = null;
// try {
// setMethod = c.getMethod("setCommonResult", CommonResult.class);
// } catch (NoSuchMethodException | SecurityException e) {
// e.printStackTrace();
// }
// if(setMethod != null){
// CommonResult args = null;
// try {
// setMethod.invoke(responseVO, args);
// } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
// e.printStackTrace();
// }
// }
}
}
yd-common/src/main/java/com/yd/common/utils/ByteArrayMultipartFile.java
0 → 100644
View file @
fa3afc51
package
com
.
yd
.
common
.
utils
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.ByteArrayInputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.file.Files
;
/**
* 基于字节数组的 MultipartFile 实现,用于将内存中的字节数据包装为文件上传对象
*/
public
class
ByteArrayMultipartFile
implements
MultipartFile
{
private
final
byte
[]
content
;
private
final
String
name
;
private
final
String
originalFilename
;
private
final
String
contentType
;
/**
* 构造器
*
* @param content 文件字节数组
* @param name 表单字段名(需与 Feign 接口中的 @RequestPart("file") 一致,通常为 "file")
* @param originalFilename 原始文件名(建议包含扩展名,如 "qr.png")
* @param contentType 内容类型(如 "image/png")
*/
public
ByteArrayMultipartFile
(
byte
[]
content
,
String
name
,
String
originalFilename
,
String
contentType
)
{
this
.
content
=
content
;
this
.
name
=
name
;
this
.
originalFilename
=
originalFilename
;
this
.
contentType
=
contentType
;
}
@Override
public
String
getName
()
{
return
name
;
}
@Override
public
String
getOriginalFilename
()
{
return
originalFilename
;
}
@Override
public
String
getContentType
()
{
return
contentType
;
}
@Override
public
boolean
isEmpty
()
{
return
content
==
null
||
content
.
length
==
0
;
}
@Override
public
long
getSize
()
{
return
content
.
length
;
}
@Override
public
byte
[]
getBytes
()
throws
IOException
{
return
content
;
}
@Override
public
InputStream
getInputStream
()
throws
IOException
{
return
new
ByteArrayInputStream
(
content
);
}
@Override
public
void
transferTo
(
File
dest
)
throws
IOException
,
IllegalStateException
{
Files
.
write
(
dest
.
toPath
(),
content
);
}
}
\ No newline at end of file
yd-common/src/main/java/com/yd/common/utils/RedisUtil.java
View file @
fa3afc51
package
com
.
yd
.
common
.
utils
;
import
com.alibaba.fastjson2.JSONObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.RedisTemplate
;
...
...
@@ -455,4 +456,28 @@ public class RedisUtil {
Long
releaseStatus
=
(
Long
)
this
.
redisTemplate
.
execute
(
redisScript
,
Collections
.
singletonList
(
key
),
value
);
return
releaseStatus
;
}
/**
* 获取缓存对象,并自动反序列化为指定类型
* (解决 StringRedisSerializer 存储对象为 JSON 字符串时的类型转换问题)
* @param key 缓存键
* @param clazz 目标类型
* @return 反序列化后的对象,若 key 不存在则返回 null
*/
public
<
T
>
T
getCacheObject
(
final
String
key
,
Class
<
T
>
clazz
)
{
Object
value
=
redisTemplate
.
opsForValue
().
get
(
key
);
if
(
value
==
null
)
{
return
null
;
}
// 如果已经是目标类型,直接返回
if
(
clazz
.
isAssignableFrom
(
value
.
getClass
()))
{
return
clazz
.
cast
(
value
);
}
// 如果是 JSON 字符串,用 fastjson2 反序列化(项目已引入)
if
(
value
instanceof
String
)
{
return
JSONObject
.
parseObject
((
String
)
value
,
clazz
);
}
// 其他情况(如 LinkedHashMap)也转为 JSON 再反序列化
return
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
value
),
clazz
);
}
}
yd-feign/pom.xml
View file @
fa3afc51
...
...
@@ -27,5 +27,15 @@
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<dependency>
<groupId>
io.github.openfeign.form
</groupId>
<artifactId>
feign-form-spring
</artifactId>
<version>
3.8.0
</version>
</dependency>
<dependency>
<groupId>
io.github.openfeign.form
</groupId>
<artifactId>
feign-form
</artifactId>
<version>
3.8.0
</version>
</dependency>
</dependencies>
</project>
yd-feign/src/main/java/com/yd/feign/config/FeignMultipartConfig.java
0 → 100644
View file @
fa3afc51
//package com.yd.feign.config;
//
//import feign.codec.Encoder;
//import feign.form.spring.SpringFormEncoder;
//import org.springframework.beans.factory.ObjectFactory;
//import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
//import org.springframework.cloud.openfeign.support.SpringEncoder;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class FeignMultipartConfig {
//
// @Bean
// public Encoder feignFormEncoder(ObjectFactory<HttpMessageConverters> converters) {
// return new SpringFormEncoder(new SpringEncoder(converters));
// }
//}
\ No newline at end of file
yd-gateway/src/main/java/com/yd/gateway/config/GatewayJwtAuthFilterConfig.java
View file @
fa3afc51
...
...
@@ -121,6 +121,10 @@ public class GatewayJwtAuthFilterConfig {
"/**/relProjectRole/page"
,
"/**/salary/condition/list"
,
"/**/salary/detail"
,
"/**/coSession/create"
,
"/**/coSession/join"
,
"/**/coSession/status"
,
"/**/oss/upload/body/json"
,
"/**/notificationTask/send"
,
"/**/userSaleExpand/list"
,
"/**/api/relProjectRole/menu/list"
...
...
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