public ProdCategorySearchResult getProductCategoryDTOByCondition(
      ProdCategorySearchCondition prodCategorySearchCondition) {
    if (prodCategorySearchCondition == null) {
      return null;
    }
    ProductWriter productWriter = productDaoManager.getWriter();
    ProdCategorySearchResult prodCategorySearchResult = new ProdCategorySearchResult();

    int totalRows =
        this.countCategoryByNameOrId(
            productWriter,
            prodCategorySearchCondition.getProductCategoryId(),
            prodCategorySearchCondition.getProductCategoryName(),
            prodCategorySearchCondition.getShopId());
    prodCategorySearchResult.setTotalRows(totalRows);

    if (prodCategorySearchCondition.isHasPager()) {
      Pager pager = new Pager();
      pager.setRowStart(prodCategorySearchCondition.getStart());
      pager.setPageSize(prodCategorySearchCondition.getLimit());
      prodCategorySearchCondition.setPager(pager);
    }
    List<ProductCategoryDTO> productCategoryDTOList =
        this.getProductCategoryByNameOrId(
            prodCategorySearchCondition.getProductCategoryId(),
            prodCategorySearchCondition.getProductCategoryName(),
            prodCategorySearchCondition.getShopId(),
            prodCategorySearchCondition.getPager());
    if (CollectionUtils.isEmpty(productCategoryDTOList)) {
      return null;
    }
    this.fillProductCategoryDTOListInfo(productCategoryDTOList);

    prodCategorySearchResult.setResults(productCategoryDTOList);
    prodCategorySearchResult.setSuccess(true);
    return prodCategorySearchResult;
  }
  /**
   * 根据前台查询条件 获得标准商品店铺采购统计
   *
   * @param request
   * @param response
   * @param productSearchCondition
   * @return
   */
  @RequestMapping(params = "method=getNormalProductStatByCondition")
  @ResponseBody
  public Object getNormalProductStatByCondition(
      HttpServletRequest request,
      HttpServletResponse response,
      ProductSearchCondition productSearchCondition) {

    try {
      Long shopId = WebUtil.getShopId(request);
      if (shopId == null) throw new Exception("shopId is null!");
      if (productSearchCondition == null
          || productSearchCondition.getNormalProductStatType() == null) {
        return null;
      }

      List<Long> shopIdList = null;
      if (StringUtil.isNotEmpty(productSearchCondition.getShopVersion())
          || productSearchCondition.getProvinceId() != null
          || productSearchCondition.getCityId() != null
          || productSearchCondition.getRegionId() != null) {
        IConfigService configService = ServiceManager.getService(IConfigService.class);

        List<Long> shopVersionIds = new ArrayList<Long>();

        if ("REPAIR_VERSION".equals(productSearchCondition.getShopVersion())) {
          shopVersionIds.add(10000010017531654L);
          shopVersionIds.add(10000010017531655L);
          shopVersionIds.add(10000010039823882L);
        } else if ("WHOLESALER_VERSION".equals(productSearchCondition.getShopVersion())) {
          shopVersionIds.add(10000010017531657L);
          shopVersionIds.add(10000010037193619L);
          shopVersionIds.add(10000010037193620L);
          shopVersionIds.add(10000010017531653L);
        }

        shopIdList =
            configService.getShopByShopVersionAndArea(
                shopVersionIds.toArray(new Long[shopVersionIds.size()]),
                productSearchCondition.getProvinceId(),
                productSearchCondition.getCityId(),
                productSearchCondition.getRegionId());
        if (CollectionUtils.isEmpty(shopIdList)) {
          return null;
        }
      } else {
        shopIdList = new ArrayList<Long>();
        shopIdList.add(StatConstant.EMPTY_SHOP_ID);
      }

      productSearchCondition.setShopId(shopId);
      IProductService productService = ServiceManager.getService(IProductService.class);
      INormalProductStatService normalProductStatService =
          ServiceManager.getService(INormalProductStatService.class);

      Map<Long, NormalProductDTO> normalProductDTOMap =
          productService.getSimpleNormalProductDTO(productSearchCondition);

      if (MapUtils.isEmpty(normalProductDTOMap)) {
        return null;
      }
      Long[] normalProductIds =
          normalProductDTOMap.keySet().toArray(new Long[normalProductDTOMap.keySet().size()]);

      Pager pager = new Pager();
      pager.setRowStart(productSearchCondition.getStart());
      pager.setPageSize(productSearchCondition.getLimit());

      NormalProductStatSearchResult normalProductStatSearchResult =
          normalProductStatService.getStatDateByCondition(
              shopIdList.toArray(new Long[shopIdList.size()]),
              normalProductIds,
              productSearchCondition.getNormalProductStatType(),
              pager,
              normalProductDTOMap);

      return normalProductStatSearchResult;
    } catch (Exception e) {
      LOG.error("normalProductStat.do method=getNormalProductStatByCondition");
      LOG.error(productSearchCondition.toString());
      LOG.error(e.getMessage(), e);
    }
    return null;
  }