订单模块-结构设计

订单模块-结构设计

 

IOrderDomainService给网关调用,接收一个参数orderType,比如createOrder(CreateOrderRequest req)

=======================================================================================================

class OrderDomainService

 

public CreateOrderResult createOrder(CreateOrderRequest request) {

  //参数验证

  return this.getOrderService(request.getOrderType().toString()).createOrder(request);

}

 

private IOrderService getOrderService(String orderType) {
    String className = String.format("orderService%s", orderType);
    IOrderService orderService = MyApplicationContext.getInstance().getBean(className, IOrderService.class, false);
    if (orderService == null) {
      throw new ServiceException(String.format("合作方订单服务未定义[%s]", orderType), ServiceException.NOT_EXIST);
    }
    return orderService;
}

====================================================================================================================

 

@Service("orderService1")
public class Child1OrderService extends AbstractOrderService implements IChild1OrderService

 

 

@Service("orderService2")
public class Child2OrderService extends AbstractOrderService implements IChild2OrderService

上一篇:Ubuntu18磁盘分区爬坑


下一篇:Linux 私房菜————Linux系统基本操作命令(十四)|文件系统|inode节点|ext类型文件恢复|xfs类型文件恢复