@Override
 public ShopResponse execute(RequestContext context) throws ShopException {
   ShopResponse response = null;
   ShopRequest request = context.getRequest();
   ShopItemGroupDTO shopItemGroupDTO = (ShopItemGroupDTO) request.getParam("shopItemGroupDTO");
   if (shopItemGroupDTO == null) {
     return ResponseUtil.getErrorResponse(
         ResponseCode.PARAM_E_MISSING, "shopItemGroupDTO is null");
   }
   Long sellerId = shopItemGroupDTO.getSellerId();
   if (sellerId != null) {
     ShopDTO shopDTO = new ShopDTO();
     shopDTO.setSellerId(shopItemGroupDTO.getSellerId());
     // 去反查shopId,设计的字段填充进去;
     shopDTO = shopManager.getShop(shopDTO);
     shopItemGroupDTO.setShopId(shopDTO.getId());
   }
   try {
     Long id = shopItemGroupManager.addShopItemGroup(shopItemGroupDTO);
     shopItemGroupDTO.setId(id);
     response = ResponseUtil.getSuccessResponse(shopItemGroupDTO);
     return response;
   } catch (ShopException e) {
     response = ResponseUtil.getErrorResponse(e.getCode(), e.getMessage());
     log.error("do action:" + request.getCommand() + " occur Exception:" + e.getMessage(), e);
     return response;
   }
 }
Beispiel #2
0
  @Ignore
  public void test008() {
    Request request = new BaseRequest();
    ShopItemGroupDTO shopItemGroupDTO = new ShopItemGroupDTO();
    shopItemGroupDTO.setSellerId(91L);
    shopItemGroupDTO.setShopId(12L);
    shopItemGroupDTO.setDeleteMark(0);
    shopItemGroupDTO.setGroupName("test");
    request.setParam("shopItemGroupDTO", shopItemGroupDTO);
    request.setParam("appKey", "0efa3aa4c1d059043ec35cec5b6625d1");
    request.setCommand(ActionEnum.ADD_SHOP_ITEM_GROUP.getActionName());
    Response response = shopService.execute(request);

    System.out.println("**************************************");
    System.out.println("Model:" + response.getModule());
    System.out.println("message:" + response.getMessage());
    System.out.println("ResponseCode:" + response.getCode());
    System.out.println("TotalCount:" + response.getTotalCount());
    System.out.println("**************************************");
  }