Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
d3f37a65
Commit
d3f37a65
authored
Nov 24, 2021
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
动态枚举修改
parent
581f836f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
15 deletions
+27
-15
DynamicEnumUtil.java
...m/yeejoin/amos/boot/biz/common/utils/DynamicEnumUtil.java
+2
-1
LatentDangerLevelEnum.java
...amos/latentdanger/common/enums/LatentDangerLevelEnum.java
+4
-1
LatentDangerReformTypeEnum.java
...latentdanger/common/enums/LatentDangerReformTypeEnum.java
+4
-1
LatentDangerStateEnum.java
...amos/latentdanger/common/enums/LatentDangerStateEnum.java
+4
-1
EnumFillAop.java
...a/com/yeejoin/amos/latentdanger/core/aop/EnumFillAop.java
+13
-11
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/DynamicEnumUtil.java
View file @
d3f37a65
...
...
@@ -89,7 +89,8 @@ public class DynamicEnumUtil {
* @return
*/
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
extends
Enum
<?>>
T
addEnum
(
Class
<
T
>
enumType
,
String
enumName
,
Class
<?>[]
additionalTypes
,
Object
[]
additionalValues
)
{
public
static
<
T
extends
Enum
<?>>
T
addEnum
(
Class
<
T
>
enumType
,
String
enumName
,
Class
<?>[]
additionalTypes
,
Object
[]
additionalValues
)
{
// 0. 检查类型
if
(!
Enum
.
class
.
isAssignableFrom
(
enumType
))
{
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-latentdanger-api/src/main/java/com/yeejoin/amos/latentdanger/common/enums/LatentDangerLevelEnum.java
View file @
d3f37a65
package
com
.
yeejoin
.
amos
.
latentdanger
.
common
.
enums
;
import
com.yeejoin.amos.boot.biz.common.utils.DynamicEnumUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -98,7 +99,9 @@ public enum LatentDangerLevelEnum {
LatentDangerLevelEnum
dangerLevelEnum
=
DynamicEnumUtil
.
addEnum
(
LatentDangerLevelEnum
.
class
,
enumName
,
new
Class
[]{
String
.
class
,
String
.
class
,
String
.
class
,
Integer
.
class
},
new
Object
[]{
name
,
code
,
riskSourceDangerLevelCode
,
order
});
enumMap
.
put
(
code
,
dangerLevelEnum
);
if
(!
ValidationUtil
.
isEmpty
(
dangerLevelEnum
))
{
enumMap
.
put
(
code
,
dangerLevelEnum
);
}
return
dangerLevelEnum
;
}
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-latentdanger-api/src/main/java/com/yeejoin/amos/latentdanger/common/enums/LatentDangerReformTypeEnum.java
View file @
d3f37a65
package
com
.
yeejoin
.
amos
.
latentdanger
.
common
.
enums
;
import
com.yeejoin.amos.boot.biz.common.utils.DynamicEnumUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -75,7 +76,9 @@ public enum LatentDangerReformTypeEnum {
public
static
LatentDangerReformTypeEnum
addEnumDynamic
(
String
enumName
,
String
name
,
String
code
)
{
LatentDangerReformTypeEnum
dangerReformTypeEnum
=
DynamicEnumUtil
.
addEnum
(
LatentDangerReformTypeEnum
.
class
,
enumName
,
new
Class
[]{
String
.
class
,
String
.
class
},
new
Object
[]{
name
,
code
});
enumMap
.
put
(
code
,
dangerReformTypeEnum
);
if
(!
ValidationUtil
.
isEmpty
(
dangerReformTypeEnum
))
{
enumMap
.
put
(
code
,
dangerReformTypeEnum
);
}
return
dangerReformTypeEnum
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-latentdanger-api/src/main/java/com/yeejoin/amos/latentdanger/common/enums/LatentDangerStateEnum.java
View file @
d3f37a65
package
com
.
yeejoin
.
amos
.
latentdanger
.
common
.
enums
;
import
com.yeejoin.amos.boot.biz.common.utils.DynamicEnumUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -64,7 +65,9 @@ public enum LatentDangerStateEnum {
public
static
LatentDangerStateEnum
addEnumDynamic
(
String
enumName
,
String
name
,
String
code
)
{
LatentDangerStateEnum
dangerStateEnum
=
DynamicEnumUtil
.
addEnum
(
LatentDangerStateEnum
.
class
,
enumName
,
new
Class
[]{
String
.
class
,
String
.
class
},
new
Object
[]{
name
,
code
});
enumMap
.
put
(
code
,
dangerStateEnum
);
if
(!
ValidationUtil
.
isEmpty
(
dangerStateEnum
))
{
enumMap
.
put
(
code
,
dangerStateEnum
);
}
return
dangerStateEnum
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/core/aop/EnumFillAop.java
View file @
d3f37a65
...
...
@@ -42,17 +42,19 @@ public class EnumFillAop {
public
void
doBefore
(
JoinPoint
joinPoint
)
{
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
// 获取隐患等级枚举
if
(
ValidationUtil
.
isEmpty
(
LatentDangerLevelEnum
.
enumMap
))
{
List
<
DictionarieValueModel
>
dicResult
=
Systemctl
.
dictionarieClient
.
dictValues
(
bizType
+
LatentDangerLevelEnum
.
dictCode
).
getResult
();
dicResult
.
forEach
(
dic
->
LatentDangerLevelEnum
.
addEnumDynamic
(
dic
.
getDictDataDesc
(),
dic
.
getDictDataValue
(),
dic
.
getDictDataKey
(),
""
,
dic
.
getOrderNum
()));
}
// 获取治理方式枚举
if
(
ValidationUtil
.
isEmpty
(
LatentDangerReformTypeEnum
.
enumMap
))
{
List
<
DictionarieValueModel
>
dicResult
=
Systemctl
.
dictionarieClient
.
dictValues
(
bizType
+
LatentDangerReformTypeEnum
.
dictCode
).
getResult
();
dicResult
.
forEach
(
dic
->
LatentDangerReformTypeEnum
.
addEnumDynamic
(
dic
.
getDictDataDesc
(),
dic
.
getDictDataValue
(),
dic
.
getDictDataKey
()));
synchronized
(
this
)
{
if
(
ValidationUtil
.
isEmpty
(
LatentDangerLevelEnum
.
enumMap
))
{
List
<
DictionarieValueModel
>
dicResult
=
Systemctl
.
dictionarieClient
.
dictValues
(
bizType
+
LatentDangerLevelEnum
.
dictCode
).
getResult
();
dicResult
.
forEach
(
dic
->
LatentDangerLevelEnum
.
addEnumDynamic
(
dic
.
getDictDataDesc
(),
dic
.
getDictDataValue
(),
dic
.
getDictDataKey
(),
""
,
dic
.
getOrderNum
()));
}
// 获取治理方式枚举
if
(
ValidationUtil
.
isEmpty
(
LatentDangerReformTypeEnum
.
enumMap
))
{
List
<
DictionarieValueModel
>
dicResult
=
Systemctl
.
dictionarieClient
.
dictValues
(
bizType
+
LatentDangerReformTypeEnum
.
dictCode
).
getResult
();
dicResult
.
forEach
(
dic
->
LatentDangerReformTypeEnum
.
addEnumDynamic
(
dic
.
getDictDataDesc
(),
dic
.
getDictDataValue
(),
dic
.
getDictDataKey
()));
}
}
// 获取治理状态枚举
// if (ValidationUtil.isEmpty(LatentDangerStateEnum.enumMap)) {
...
...
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