is the business solution, also shows our logical framework
是一个业务解决方案,关于展示我们的业务逻辑框架
设计背景
工程描述
demo/solf-bundle-demo 业务扩展包示例 demo/solf-service-demo 服务示例 solf-core 核心实现 solf-model 核心模型 wiki 介绍
核心设计
使用方式
引入依赖包 引入solf-core依赖
<dependency>
<groupId>com.zzqfsy.io</groupId>
<artifactId>solf-core</artifactId>
</dependency>
扫描加载
@ComponentScan(basePackages = {
"com.zzqfsy.solf.core"
})
注册自定义业务身份
@Component
@BizIdentitySpec(code = "xxxBizId", name = "xxx")
public class XxxBizIdentityConfig {
/**
* 获取xxx的身份
*
* @return
*/
public BizIdentity getBizIdentity(T t) {
...
}
}
注册自定义领域能力
@DomainSpec(name = "xxx", domain = "xxxDomain", description = "xxx")
public class XxxEventHandler {
@AbilityOrderSpec(300)
@AbilitySpec(name = "xxx",
scenario = "xxx",
description = "",
bizIdentityCode = "xxxBizId")
public <E> E handler(T t) {
...
}
注册自定义流程节点链
@Component
@FlowChainSpec(name = "xxx", code = "xxxFlow")
public class XxxFlowChain {
@FlowNodeOrderSpec(1)
@FlowNodeSpec(name = "xxx", code = "xxxFlowNode",
domainName = "xxxDomain", abilityName = "xxxAbility")
public void valid(T t){
...
}
运行来了解
debug com.zzqfsy.solf.service.demo.ServiceApplicaiton.main
then browser request http://127.0.0.1:8081/stockIn
console println execute handler:
PurchaseOrderStockInValidEventHandler handler
PurchaseOrderStockInAssemblyEventHandler handler
PurchaseOrderStockInCreateEventHandler handler
PurchaseOrderStockInCreateEventHandler wms handler
视图
流程链视图 请求示例
debug com.zzqfsy.solf.service.demo.ServiceApplicaiton.main
then browser request http://127.0.0.1:8081/flowChain/config
输出示例
[{
"chainName": "入库通知",
"chainCode": "stockInNoticeFlow",
"flowNodeList": [{
"name": "入库通知校验",
"code": "StockInNotice.valid",
"domainName": "stockInNoticeDomain",
"abilityName": "valid",
"order": 1
}, {
"name": "入库通知组装",
"code": "StockInNotice.assembly",
"domainName": "stockInNoticeDomain",
"abilityName": "assembly",
"order": 2
}, {
"name": "入库通知创建",
"code": "StockInNotice.create",
"domainName": "stockInNoticeDomain",
"abilityName": "create",
"order": 3
}]
}]
业务身份能力视图 请求示例
debug com.zzqfsy.solf.service.demo.ServiceApplicaiton.main
then browser request http://127.0.0.1:8081/domain/ability/config
输出示例
[{
"bizIdentityName": "采购单",
"bizIdentityCode": "purchaseOrderBizId",
"bizIdentityMethodObject": {
"className": "com.zzqfsy.solf.service.demo.config.bizId.stock.in.PurchaseOrderBizIdentityConfig",
"methodName": "getBizIdentity",
"parameterType": "com.zzqfsy.solf.service.demo.model.StockInDo",
"returnType": "com.zzqfsy.solf.model.identity.BizIdentity"
},
"domainCode": "stockInNoticeDomain",
"domainName": "入库领域",
"abilityScenario": "valid",
"abilityName": "校验",
"abilityOrder": 100,
"abilityMethodObject": {
"beanClass": "com.zzqfsy.solf.service.demo.domain.event.handler.stock.in.notice.valid.PurchaseOrderStockInValidEventHandler",
"methodName": "handler",
"parameterType": "com.zzqfsy.solf.service.demo.model.StockInDo",
"returnType": "java.lang.Integer",
"order": 100
}
}]
请求对象匹配流程和能力视图
todo