Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
63faedb0
Commit
63faedb0
authored
May 19, 2023
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表结构修改
parent
86ff61e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
0 deletions
+26
-0
TypeHelper.java
...src/main/java/com/yanzuoguang/util/helper/TypeHelper.java
+12
-0
TestTypeHelper.java
yzg-util-base/src/test/java/helper/TestTypeHelper.java
+12
-0
PlanService.java
.../main/java/com.yanzuoguang.redis/service/PlanService.java
+2
-0
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/TypeHelper.java
View file @
63faedb0
...
...
@@ -90,4 +90,16 @@ public class TypeHelper {
System
.
out
.
println
(
returnType
.
getName
());
printSuperClass
(
returnType
.
getSuperclass
());
}
/**
* 获取代理类名称
* @param className 当前代理类名
* @return 普通类名称
*/
public
static
String
getProxyClassName
(
String
className
){
if
(
StringHelper
.
isEmpty
(
className
)){
return
className
;
}
return
className
.
split
(
"\\$"
)[
0
];
}
}
yzg-util-base/src/test/java/helper/TestTypeHelper.java
View file @
63faedb0
...
...
@@ -5,6 +5,7 @@ import com.yanzuoguang.util.YzgError;
import
com.yanzuoguang.util.helper.TypeHelper
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
helper.vo.ResponseDataMainResult
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
java.lang.reflect.Method
;
...
...
@@ -27,4 +28,15 @@ public class TestTypeHelper {
throw
YzgError
.
getRuntimeException
(
"004"
);
}
}
@Test
public
void
testClassName
()
{
String
commonClassName
=
"com.tourbida.store.other1949.plan.StorePlanSceneService"
;
String
proxyClassName
=
TypeHelper
.
getProxyClassName
(
"com.tourbida.store.other1949.plan.StorePlanSceneService$$EnhancerBySpringCGLIB$$18231bee"
);
Assert
.
assertEquals
(
commonClassName
,
proxyClassName
);
String
commonToClassName
=
TypeHelper
.
getProxyClassName
(
commonClassName
);
Assert
.
assertEquals
(
commonClassName
,
commonToClassName
);
}
}
yzg-util-redis/src/main/java/com.yanzuoguang.redis/service/PlanService.java
View file @
63faedb0
...
...
@@ -10,6 +10,7 @@ import com.yanzuoguang.redis.mq.PlanProcedure;
import
com.yanzuoguang.redis.vo.PlanConfigVo
;
import
com.yanzuoguang.redis.vo.PlanLevelType
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.TypeHelper
;
import
com.yanzuoguang.util.helper.YzgTimeout
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
...
...
@@ -158,6 +159,7 @@ public class PlanService {
private
String
getCacheKey
(
PlanConfigVo
config
,
String
key
)
{
PlanLevelNamespace
planLevelNamespace
=
config
.
getPlanLevelNamespace
();
PlanLevelType
level
=
planLevelNamespace
.
getLevel
();
String
toKey
=
TypeHelper
.
getProxyClassName
(
key
);
return
StringHelper
.
getId
(
level
.
getName
(),
planLevelNamespace
.
getLevelNamespace
(),
key
);
}
}
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