@Override
 public ItemResponse execute(RequestContext context) throws ItemException {
   ItemResponse response = null;
   ItemRequest request = context.getRequest();
   // 验证DTO是否为空
   if (request.getParam("itemCategoryDTO") == null) {
     return ResponseUtil.getErrorResponse(ResCodeNum.PARAM_E_MISSING, "itemCategoryDTO is null");
   }
   ItemCategoryDTO itemCategoryDTO = (ItemCategoryDTO) request.getParam("itemCategoryDTO");
   try {
     itemCategoryDTO = itemCategoryManager.addItemCategory(itemCategoryDTO); // 新增加的itemCategoryDO
     response = ResponseUtil.getSuccessResponse(itemCategoryDTO);
     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;
   }
 }
 @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;
   }
 }
Example #3
0
  @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;
  }