当前位置:网站首页>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 )
边栏推荐
- 内存导致的电脑游戏中显示hdmi无信号 从而死机的情况
- Fully annotated SSM framework construction
- [STM32] stm32cubemx tutorial II - basic use (new projects light up LED lights)
- Slope compensation
- Delete AWS bound credit card account
- Why must digital transformation strategies include continuous testing?
- PyTorch磨刀篇|argmax和argmin函数
- Ida dynamic debugging apk
- Medium pen test questions: flip the string, such as ABCD, print out DCBA
- Airserver mobile phone third-party screen projection computer software
猜你喜欢

Ida dynamic debugging apk

Is PMP certificate really useful?

Getting started with the lockust series

flink sql-client 使用 对照并熟悉官方文档

切面条 C语言

IDA动态调试apk

Basic knowledge of ngnix
![[commercial terminal simulation solution] Shanghai daoning brings you Georgia introduction, trial and tutorial](/img/b0/029cdea72483ed9bc8a0d66908983a.png)
[commercial terminal simulation solution] Shanghai daoning brings you Georgia introduction, trial and tutorial

PyTorch磨刀篇|argmax和argmin函数

性能测试计划怎么编写
随机推荐
首席信息官对高绩效IT团队定义的探讨和分析
Show member variables and methods in classes in idea
高攀不起的希尔排序,直接插入排序
Learning notes on futuretask source code of concurrent programming series
分享一个一年经历两次裁员的程序员的一些感触
详解Volatile关键字
MySQL数据库详细学习教程
Flume interview questions
Ida dynamic debugging apk
Unity 使用Sqlite
How to write a performance test plan
删除AWS绑定的信用卡账户
记录一次spark on yarn 任务报错 Operation category READ is not supported in state standby
Redis configuration and optimization
RestTemplate 远程调用工具类
The difference between NiO and traditional IO
plantuml介绍与使用
Yyds dry goods inventory # solve the real problem of famous enterprises: egg twisting machine
【日常训练】66. 加一
YOLOv5.5 调用本地摄像头