feat: 部分补全框架
parent
4cdd40fdc8
commit
f6eaf6b05f
|
@ -46,7 +46,11 @@ public abstract class abstractStrategyRouter<T,R> {
|
||||||
* @return 策略处理结果
|
* @return 策略处理结果
|
||||||
*/
|
*/
|
||||||
public R applyStrategy(T param) {
|
public R applyStrategy(T param) {
|
||||||
final StrategyHandler<T,R> strategyHandler = registerStrategy().getHandler(param);
|
StrategyMapper<T, R> trStrategyMapper = registerStrategy();
|
||||||
|
if (trStrategyMapper == null) {
|
||||||
|
return defaultStrategyHandler.apply(param);
|
||||||
|
}
|
||||||
|
final StrategyHandler<T,R> strategyHandler = trStrategyMapper.getHandler(param);
|
||||||
if (strategyHandler != null) {
|
if (strategyHandler != null) {
|
||||||
return strategyHandler.apply(param);
|
return strategyHandler.apply(param);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,6 @@ public class DataProcessStrategy extends abstractStrategyRouter<Temporary1, Temp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,6 @@ public class FaultJudgmentStrategy extends abstractStrategyRouter<Temporary1, Te
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,6 @@ public class FaultProcessingStrategy extends abstractStrategyRouter<Temporary1,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,6 @@ public class FenceJudgmentStrategy extends abstractStrategyRouter<Temporary1, Te
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,6 @@ public class FenceProcessingStrategy extends abstractStrategyRouter<Temporary1,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,6 @@ public class RealTimeJudgmentStrategy extends abstractStrategyRouter<Temporary1,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,6 @@ public class RealTimeProcessingStrategy extends abstractStrategyRouter<Temporary
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,6 @@ public class WarningJudgmentStrategy extends abstractStrategyRouter<Temporary1,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,6 @@ public class WarningProcessingStrategy extends abstractStrategyRouter<Temporary1
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,6 @@ public class BasicStrategy extends abstractStrategyRouter<Temporary1, Temporary2
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,6 @@ public class RoutingStrategy extends abstractStrategyRouter<Temporary1, Tempor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,16 +18,18 @@ import org.springframework.stereotype.Component;
|
||||||
* ↓
|
* ↓
|
||||||
* 基础校验节点
|
* 基础校验节点
|
||||||
* ↓
|
* ↓
|
||||||
* 路由节点
|
* 路由节点 ← ← ← ← ← ←
|
||||||
* ↙ ↙ ↓ ↘ ↘
|
* ↙ ↙ ↓ ↘ ↘
|
||||||
* 数据处理节点 预警处理节点 故障处理节点 围栏处理节点 实时数据数据处理节点
|
* 数据处理节点 预警处理节点 故障处理节点 围栏处理节点 实时数据数据处理节点 ↑
|
||||||
* ↓ ↓ ↓ ↓ ↓
|
* ↓ ↓ ↓ ↓ ↓
|
||||||
* 数据持久化处理节点 预警处理节点 故障处理节点 围栏处理节点 实时数据数据处理节点
|
* 数据持久化处理节点 预警处理节点 故障处理节点 围栏处理节点 实时数据数据处理节点 ↑
|
||||||
* ↓ ↓ ↓ ↓ ↓
|
* ↓ ↓ ↓ ↓ ↓
|
||||||
* ↓ 预警通知节点 故障通知节点 围栏通知节点 实时数据处理节点
|
* ↓ 预警通知节点 故障通知节点 围栏通知节点 实时数据处理节点 ↑
|
||||||
* ↓ ↘ ↓ ↙ ↙
|
* ↓ ↘ ↓ ↙ ↙
|
||||||
* ↓ ↓
|
* ↓ ↓ ↑
|
||||||
* → → → 结束节点
|
* → → → 路由节点 → → → → → →
|
||||||
|
* ↓
|
||||||
|
* 结束节点
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
|
@ -29,6 +29,6 @@ public class DataStorageStrategy extends abstractStrategyRouter<Temporary1, Temp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,6 @@ public class FaultAlarmStrategy extends abstractStrategyRouter<Temporary1, Tempo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,6 @@ public class FenceAlarmStrategy extends abstractStrategyRouter<Temporary1, Tempo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,6 @@ public class RealTimeAlarmStrategy extends abstractStrategyRouter<Temporary1, Te
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,6 @@ public class WarningAlarmStrategy extends abstractStrategyRouter<Temporary1, Tem
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Temporary2 apply(Temporary1 temporary1) {
|
public Temporary2 apply(Temporary1 temporary1) {
|
||||||
return null;
|
return applyStrategy(temporary1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue