当前位置:网站首页>Configure filter
Configure filter
2022-07-01 22:38:00 【haohaounique】
in an article , More inspiration comes from screening grains and peanuts , Structure of screening machine, such as screening machine
More development work , Involving business branches and different logics of the same business , It will be more suitable for the following model : From big to small ( Funnel structure ) Or from small to large ( Inverted funnel structure ) Or one-time choice ( Choose dimensions , Get dimension parameters )
dimension : It can be unified as a key parameter or a parameter composed of multiple parameters
1. be based on A Under the dimension , Choose or design dimension parameters under dimension
2. Do not configure dimensions , But do different operations of the same business logic according to dimensions
The specific table is designed as follows :
Configure top-level classes of the same business --> Specific business class ---> Get the specific processing model ---> Get the specific parameter expression
create table check_expression
(
id int auto_increment
primary key,
business_type varchar(20) null comment ' Business types ',
check_model varchar(20) null comment ' Check the model ',
check_expression text null comment ' expression ',
check_expression_name varchar(200) null comment ' Expression name ',
status tinyint default 1 null comment '0- invalid 1- take effect ',
create_time datetime null comment ' Creation time ',
create_by varchar(60) null comment ' founder ',
update_time datetime null comment ' Update time ',
update_by varchar(60) null comment ' Update builder '
)
comment ' Check expression ';
create table check_config
(
id int auto_increment
primary key,
business_key varchar(100) null comment ' Business key',
business_type varchar(20) null comment ' Business types ',
business_name varchar(100) null comment ' Business name ',
check_word varchar(100) null comment ' Check keywords ',
check_word_name varchar(100) null comment ' Verify keyword name ',
check_model varchar(20) null comment ' Check the model ',
check_model_name varchar(200) null comment ' Verify the model name ',
check_class varchar(500) null comment ' Business class ',
check_expression text null comment ' Check expression ',
check_order tinyint default 1 null comment ' Check sequence ',
check_msg text null comment ' Hint ',
status tinyint default 1 null comment '0- Invalid 1- take effect ',
fresh_status tinyint default 0 null comment '0- Not refreshed 1- Refreshing ,2- Refreshed ',
try_times tinyint default 0 null comment ' Refresh times , Thread pool processing ',
fresh_time datetime default CURRENT_TIMESTAMP null comment ' Last refresh time ',
create_time datetime null comment ' Creation time ',
create_by varchar(60) not null comment ' founder ',
update_time datetime null comment ' Update time ',
update_by varchar(60) null comment ' Update builder '
)
comment ' Verification configuration ' auto_increment = 9;
create index id_business_key
on check_config (business_key);
create index id_business_type
on check_config (business_type);
create index id_check_model
on check_config (check_model);
create index id_create_by
on check_config (create_by);
create index id_fresh_status
on check_config (fresh_status);
create index id_status
on check_config (status);
create table business_class
(
id int auto_increment
primary key,
business_type varchar(20) null comment '001- check ',
business_model varchar(20) null comment ' business model ',
business_name varchar(200) null comment ' Business name ',
business_class varchar(500) null comment ' Business class ',
status tinyint default 1 null comment ' Effective status ',
create_time datetime null comment ' Creation time ',
create_by varchar(60) null comment ' founder ',
update_time datetime null comment ' Update time ',
update_by varchar(60) null comment ' Update builder '
)
comment ' Business configuration class ' auto_increment = 9;
create index id_business_model
on business_class (business_model);
create index id_business_type
on business_class (business_type);
create index id_status
on business_class (status);
Core code ( Only configurable verification codes are shown here ):
thought : The first step is to obtain the core configuration
The second step : Do business processing according to the configuration
List<CheckConfig> checkList = checkConfigService.getCheckList(map, map.get("business_key")); boolean checkResult = checkConfigService.checkConfigList(checkList, map);
public boolean checkConfigList(List<CheckConfig> checkList, Map<String, String> map) {
if (CollectionUtils.isNotEmpty(checkList)) {
for (CheckConfig checkConfig : checkList) {
ICheckService checkService = CACHE_CHECK_CLASS.getIfPresent(checkConfig.getCheckClass());
if (checkService == null) {
checkService = SpringBeanUtils.getBeanByName(checkConfig.getCheckClass(), ICheckService.class);
if (checkService == null) {
throw new BusinessException(500, CommonUtils.getStringBuilder().append("checkConfigList bean Not configured :").append(checkConfig.getCheckClass()).toString());
}
CACHE_CHECK_CLASS.put(checkConfig.getCheckClass(), checkService);
}
boolean param = checkService.checkParam(checkConfig, map);
if (param) {
map.put("check_code", CODE_500);
map.put("check_result", Boolean.FALSE.toString());
map.put("check_msg", checkConfig.getCheckMsg());
map.put("remark", CHECK_NOTICE_MSG);
return true;
}
}
}
return false;
}
Reading the above article is not very simple nor difficult ; It will be very convenient for development to understand , It can not only optimize others, but also optimize yourself ( After all, it is used in actual projects )
边栏推荐
- In the past 100 years, only 6 products have been approved, which is the "adjuvant" behind the vaccine competition
- QT uses ffmpeg4 to convert the qimage of ARGB to yuv422p
- Relationship and difference between enterprise architecture and project management
- 比较版本号[双指针截取自己想要的字串]
- 利用SecureCRTPortable远程连接虚拟机
- RestTemplate 远程调用工具类
- Clean up system cache and free memory under Linux
- LC669. 修剪二叉搜索树
- 【juc学习之路第9天】屏障衍生工具
- 性能测试计划怎么编写
猜你喜欢
MySQL之MHA高可用配置及故障切换
Pytorch sharpening chapter | argmax and argmin functions
How to write a performance test plan
互联网的智算架构设计
Design and practice of new generation cloud native database
【目标跟踪】|单目标跟踪指标
CIO's discussion and Analysis on the definition of high-performance it team
Recent public ancestor (LCA) online practices
黑马程序员-软件测试--06阶段2-linux和数据库-01-08第一章-linux操作系统阶段内容说明,linux命令基本格式以及常见形式的说明,操作系统的常见的分类,查看命令帮助信息方法,
91.(cesium篇)cesium火箭发射模拟
随机推荐
MySQL series transaction log redo log learning notes
完全注解的ssm框架搭建
【生态伙伴】鲲鹏系统工程师培训
Easyexcel complex data export
内存导致的电脑游戏中显示hdmi无信号 从而死机的情况
awoo‘s Favorite Problem(优先队列)
功能测试报告的编写
CIO's discussion and Analysis on the definition of high-performance it team
Training on the device with MIT | 256Kb memory
Object memory layout
JVM有哪些类加载机制?
keras训练的H5模型转tflite
IDA动态调试apk
Gaussdb (DWS) active prevention and troubleshooting
园区全光技术选型-中篇
【日常训练】326. 3 的幂
Clean up system cache and free memory under Linux
内部字段分隔符
QT 使用FFmpeg4将argb的Qimage转换成YUV422P
MQ learning notes