コード例 #1
0
 @Override
 public ItemResponse execute(RequestContext context) throws ItemException {
   ItemResponse response = null;
   ItemRequest request = context.getRequest();
   // 验证ID
   if (request.getLong("ID") == null) {
     return ResponseUtil.getErrorResponse(
         ResCodeNum.PARAM_E_MISSING, "skuPropertyTmplID is missing");
   }
   Long skuPropertyTmplId = request.getLong("ID"); // 商品品牌ID
   try {
     Boolean numOfDeleted = skuPropertyTmplManager.deleteSkuPropertyTmpl(skuPropertyTmplId);
     response = ResponseUtil.getSuccessResponse(numOfDeleted);
     return response;
   } catch (ItemException e) {
     response = ResponseUtil.getErrorResponse(e.getErrorCode(), e.getMessage());
     log.error("do action:" + request.getCommand() + " occur Exception:" + e.getMessage(), e);
     return response;
   }
 }
コード例 #2
0
ファイル: GetItemAction.java プロジェクト: dalinhuang/ve_np
  @Override
  public ItemResponse execute(RequestContext context) throws ItemException {
    ItemDTO itemDTO = null;
    ItemResponse response = null;
    ItemRequest request = context.getRequest();
    // 验证ID
    if (request.getLong("ID") == null) {
      return ResponseUtil.getErrorResponse(ResCodeNum.PARAM_E_MISSING, "itemID is missing");
    }
    if (request.getLong("sellerId") == null) {
      return ResponseUtil.getErrorResponse(ResCodeNum.PARAM_E_MISSING, "sellerId is missing");
    }
    Long itemId = request.getLong("ID"); // 商品品牌ID
    Long sellerId = request.getLong("sellerId"); // 供应商ID

    try {
      itemDTO = itemManager.getItem(itemId, sellerId);
      ItemSkuQTO itemSkuQTO = new ItemSkuQTO();
      itemSkuQTO.setItemId(itemId);
      itemSkuQTO.setSellerId(sellerId);
      // 获取ItemSku列表
      List<ItemSkuDTO> itemSkuDTOList = itemSkuManager.queryItemSku(itemSkuQTO);
      // 获取副图列表
      ItemImageQTO itemImageQTO = new ItemImageQTO();
      itemImageQTO.setItemId(itemId);
      itemImageQTO.setSupplierId(sellerId);
      List<ItemImageDTO> itemImageDTOList = itemImageManager.queryItemImage(itemImageQTO);

      itemDTO.setItemImageDTOList(itemImageDTOList);
      itemDTO.setItemSkuDTOList(itemSkuDTOList);
    } catch (ItemException e) {
      response = ResponseUtil.getErrorResponse(e.getErrorCode(), e.getMessage());
      log.error("do action:" + request.getCommand() + " occur Exception:" + e.getMessage(), e);
      return response;
    }
    response = ResponseUtil.getSuccessResponse(itemDTO);
    return response;
  }