当前位置:网站首页>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 )
边栏推荐
- Sonic云真机学习总结6 - 1.4.1服务端、agent端部署
- MySQL数据库详细学习教程
- Qtreeview+qabstractitemmodel custom model: the third of a series of tutorials [easy to understand]
- CIO's discussion and Analysis on the definition of high-performance it team
- 信标委云原生专题组组长,任重道远!
- 记录一次spark on yarn 任务报错 Operation category READ is not supported in state standby
- Clean up system cache and free memory under Linux
- 【日常训练】326. 3 的幂
- 3DE 资源没东西或不对
- C#/VB.NET 给PDF文档添加文本/图像水印
猜你喜欢

Relationship and difference between enterprise architecture and project management

功能测试报告的编写

3DE 资源没东西或不对

详解ThreadLocal

MySQL MHA high availability configuration and failover

搜狗微信APP逆向(二)so层

MySQL series transaction log redo log learning notes
Design and practice of new generation cloud native database

CIO's discussion and Analysis on the definition of high-performance it team

Sonic云真机学习总结6 - 1.4.1服务端、agent端部署
随机推荐
Training on the device with MIT | 256Kb memory
详解LockSupport的使用
GaussDB(DWS)主动预防排查
leetcode - 287. 寻找重复数
灵动微 MM32 多路ADC-DMA配置
内存导致的电脑游戏中显示hdmi无信号 从而死机的情况
QT版本华睿相机的Demo程序实现
删除AWS绑定的信用卡账户
The correct way to set the bypass route
Unity 使用Sqlite
配置筛选机
PyTorch磨刀篇|argmax和argmin函数
性能测试计划怎么编写
记录一次spark on yarn 任务报错 Operation category READ is not supported in state standby
String type conversion BigDecimal, date type
高攀不起的希尔排序,直接插入排序
EasyExcel 复杂数据导出
Airserver mobile phone third-party screen projection computer software
Delete AWS bound credit card account
Slope compensation