content: package com.gpmall.order.biz.convert;/**
   * Created by mic on 2019/8/2.
   */
  
  import com.gpmall.commons.result.AbstractRequest;
  import com.gpmall.commons.result.AbstractResponse;
  import com.gpmall.order.biz.context.CreateOrderContext;
  import com.gpmall.order.biz.context.TransHandlerContext;
  import com.gpmall.order.constant.OrderRetCode;
  import com.gpmall.order.dto.CreateOrderRequest;
  import com.gpmall.order.dto.CreateOrderResponse;
  
  /**
   * 腾讯课堂搜索【咕泡学院】
   * 官网：www.gupaoedu.com
   * 风骚的Mic 老师
   * create-date: 2019/8/2-下午11:04
   */
  public class CreateOrderConvert implements TransConvert{
  
      @Override
      public TransHandlerContext convertRequest2Ctx(AbstractRequest req, TransHandlerContext context) {
          CreateOrderRequest createOrderRequest=(CreateOrderRequest)req;
          CreateOrderContext createOrderContext=(CreateOrderContext) context;
          createOrderContext.setAddressId(createOrderRequest.getAddressId());
          createOrderContext.setCartProductDtoList(createOrderRequest.getCartProductDtoList());
          createOrderContext.setOrderTotal(createOrderRequest.getOrderTotal());
          createOrderContext.setStreetName(createOrderRequest.getStreetName());
          createOrderContext.setTel(createOrderRequest.getTel());
          createOrderContext.setUserId(createOrderRequest.getUserId());
          createOrderContext.setUserName(createOrderRequest.getUserName());
          createOrderContext.setUniqueKey(createOrderRequest.getUniqueKey());
          return createOrderContext;
      }
  
      @Override
      public AbstractResponse convertCtx2Respond(TransHandlerContext ctx) {
          CreateOrderContext createOrderContext=(CreateOrderContext) ctx;
          CreateOrderResponse createOrderResponse=new CreateOrderResponse();
          createOrderResponse.setOrderId(createOrderContext.getOrderId());
          createOrderResponse.setCode(OrderRetCode.SUCCESS.getCode());
          createOrderResponse.setMsg(OrderRetCode.SUCCESS.getMessage());
          return createOrderResponse;
      }
  }
  