1.1、什么是建模
1.2、建模不建模,代码写出来有什么不一样吗?
建模,就是建立模型,就是为了理解事物而对事物做出的一种 抽象 ,是对事物的一种无 歧义 的书面描述。建立 系统模型 的过程,又称模型化。建模是研究系统的重要手段和前提。凡是用模型描述系统的 因果关系 或相互关系的过程都属于建模
模型是对真实世界的抽象,明确定义了各种元素、以及元素之间的关系,可以用来做逻辑推导--《模型思考者》
互联网环境下,往往在基于理论的基础上会进行裁剪(比如时间、资源、成本、用户等等因素)
分析过程:建模的本质是对于事物的抽象,方便我们理解和分析事物的本质。
统一答案:建模的本质是对于事物的抽象过程,方便我们理解和分析事物的本质
行业答案:建模的本质是基于当前事物域问题,通过实际经验,进行事物本质(元素和元素之间关系)持续探索的过程。
2.1.4.1、未建模前
2.1.4.2、建模以后
正确答案和理论、实际代码会有体现上不一样,但是不是绝对的(实际上取决于研发控制)。
对于研发知识的掌握和规范要求比较高,否则很容易只是形式主义。
建模以前
@Override
public boolean handle(OrbCommonDto orbCommonDto) {
CallerInfo info = Profiler.registerInfo(
UmpKeyConstants.ENTRY_DISPATCHER_HANDLER,
UmpKeyConstants.METHOD_ENABLE_HEART,
UmpKeyConstants.METHOD_ENABLE_TP);
try {
Order order = orbCommonDto.getOrder().getOrder();
if(OrderTypeUtil.isCangYinOrder(order.getOrderType(), order.getSendPay())){
return continueHandle(CangyinCancelHandler, orbCommonDto);
}
if(OrderTypeUtil.isSevenFreshOrder(order.getOrderType())){
return continueHandle(sevenFreshOrderCancelHandler, orbCommonDto);
}
if(OrderTypeUtil.isAnlianzInsuranceOrHuiminbaoOrder(order.getOrderType(), order.getSendPay(), order.getSendPayMap())){
return continueHandle(alxOrHmbCancelHandler, orbCommonDto);
}
if(OrderTypeUtil.isJingXiOrder(order.getOrderType(), order.getSendPay())){
return continueHandle(jxppOrderCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isPreSaleOrder(order.getOrderType(), order.getSendPay())) {
return continueHandle(preSaleCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isOneClickProxyOrder(order.getOrderType(), order.getSendPay())) {
return continueHandle(ocpCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isProduceCenterOrder(order.getOrderType(), order.getSendPay())) {
return continueHandle(produceCenterCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isSaleAppOrder(order.getOrderType(), order.getSendPay())) {
return continueHandle(wsAppCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isAiHuiShouOrder(order.getOrderType())) {
return continueHandle(ahsCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isVipPlusOrder(order.getOrderType())) {
return continueHandle(vipPlusOrderCancelHandler, orbCommonDto);
}
if(OrderTypeUtil.isVoOrder(order.getOrderType())){
return continueHandle(virtualOrderCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isJPTOrder(order.getOrderType(), order.getSendPay(), order.getSendPayMap())) {
return continueHandle(jptCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isAirconditionerOrder(order.getSendPay())) {
return continueHandle(aircmoCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isProduceOrder(order.getSendPay())) {
return continueHandle(produceOrderCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isLOCVIPOrder(order.getOrderType(), order.getSendPay())) {
return continueHandle(locCancelHandler, orbCommonDto);
}
if(OrderTypeUtil.isJDQuanQiuGouOrder(order.getSendPay(), order.getOrderType())){
return continueHandle(espaceStoreCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isSuperstoreZiTiOrder(order.getSendPay())) {
return continueHandle(superStoreCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isYiPanHuoOrder(order.getOrderType(), order.getSendPay())) {
return continueHandle(yphCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isCLPSOrder(order.getOrderType(), order.getSendPay())) {
return continueHandle(clpsCancelHandler, orbCommonDto);
}
if(OrderTypeUtil.isECLPOrder(order.getOrderType(),order.getStoreId(), order.getSendPay())
|| OrderTypeUtil.isVCECLPOrder(order.getOrderType(), order.getSendPay())){
return continueHandle(eclpCancelHandler,orbCommonDto);
}
if (OrderTypeUtil.isShopifyOrder(order.getOrderType(), order.getSendPayMap())) {
return continueHandle(shopifyOrderCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isPOPQuanQiuGouOrder(order.getSendPay(), order.getOrderType())) {
return continueHandle(popWorldWideCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isPOPWmhOrder(order.getOrderType(), order.getSendPay())) {
return continueHandle(popMwhCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isSelfDeliveryOrder(order.getOrderType(), order.getSendPay())
|| OrderTypeUtil.isDJO2OOrder(order.getOrderType(), order.getSendPay())
|| OrderTypeUtil.isCitySpeedDatingOrder(order.getOrderType(), order.getSendPay())) {
return continueHandle(sdoCancelHandler, orbCommonDto);
}
if (OrderTypeUtil.isSDOAfterSaleOrder(order.getOrderType(), order.getSendPay())) {
return continueHandle(sdoASCancelHandler, orbCommonDto);
}
if(OrderTypeUtil.isPOPOrder(order.getSendPay(),order.getOrderType())){
return continueHandle(popCancelHandler, orbCommonDto);
}
if(OrderTypeUtil.isJDQuanQiuGouOrder(order.getSendPay(), order.getOrderType())){
return continueHandle(worldWideCancelHandler, orbCommonDto);
}
if(OrderCancelFlowUtil.isCODOrderCancelFlow(order.getSendPay(), order.getPaymentType())){
return continueHandle(priorityCommodityHandler,orbCommonDto);
}
else{
return continueHandle(payTimeHandler,orbCommonDto);
}
} catch(RetryException e){
return handleRetryException(orbCommonDto,e);
}catch (Exception e) {
throw new MQRetryException(e);
} finally {
Profiler.registerInfoEnd(info);
}
}
建模以后
/**
* 路由&执行具体流程
*
* @param messageDto
*/
public void route(MessageDto messageDto, String queueName) {
// 非流程类型mq,走具体消息处理
if (isFunctionMessage(queueName)) {
functionMessageHandle(messageDto, queueName);
return;
}
// 获取业务身份
BusinessIdentity businessIdentity = this.getBusinessIdentity(messageDto);
// 初始流程上下文
initFlowContext(queueName, businessIdentity);
// 获取流程实例
Flow flowInstance = this.flowService.getFlowInstance(businessIdentity, messageDto);
// 执行流程
flowExecutor.run(flowInstance);
}
不知道看到这里的读者你是否发现建模的意义了呢?
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。