Esempio n. 1
0
 /**
  * 查询店铺
  *
  * @param shop
  * @return
  */
 @Transactional(readOnly = true)
 public List<Shop> getShop(Shop shop) {
   if (logger.isInfoEnabled()) {
     logger.info("getShop方法参数为shop[{}]", shop);
   }
   Search search = new Search(Shop.class).setCacheable(true);
   if (shop != null) {
     if (!NumberUtil.isNullOrZero(shop.getId())) {
       search.addFilterEqual("id", shop.getId());
     }
     if (StringUtils.isNotBlank(shop.getNick())) {
       search.addFilterLike("nick", "%" + shop.getNick().trim() + "%");
     }
     if (StringUtils.isNotBlank(shop.getUid())) {
       search.addFilterLike("uid", "%" + shop.getUid().trim() + "%");
     }
     if (StringUtils.isNotBlank(shop.getTitle())) {
       search.addFilterLike("title", "%" + shop.getTitle().trim() + "%");
     }
     if (shop.getPlatformType() != null) {
       search.addFilterEqual("platformType", shop.getPlatformType());
     }
     if (!NumberUtil.isNullOrZero(shop.getOutShopId())) {
       search.addFilterEqual("outShopId", shop.getOutShopId());
     }
   }
   search.addFilterEqual("isDelete", false);
   return generalDAO.search(search);
 }
Esempio n. 2
0
 /**
  * 查询店铺
  *
  * @param shop
  * @return
  */
 @Transactional(readOnly = true)
 public List<Shop> getOnlineShopAndAuth(Shop shop) {
   if (logger.isInfoEnabled()) {
     logger.info("getShop方法参数为shop[{}]", shop);
   }
   Search search = new Search(Shop.class).addFetch("shopAuth").setCacheable(true);
   if (shop != null) {
     // 根据id精确查询
     if (!NumberUtil.isNullOrZero(shop.getId())) {
       search.addFilterEqual("id", shop.getId());
     }
     // 根据nick模糊查询
     if (StringUtils.isNotBlank(shop.getNick())) {
       search.addFilterLike("nick", "%" + shop.getNick().trim() + "%");
     }
     // 根据店铺名称模糊查询
     if (StringUtils.isNotBlank(shop.getTitle())) {
       search.addFilterLike("title", "%" + shop.getTitle().trim() + "%");
     }
     // 根据外部平台店铺id精确查询
     if (!NumberUtil.isNullOrZero(shop.getOutShopId())) {
       search.addFilterEqual("outShopId", shop.getOutShopId());
     }
     // 根据平台模糊查询
     if (shop.getPlatformType() != null) {
       search.addFilterEqual("platformType", shop.getPlatformType());
     }
   }
   search.addFilterNotEmpty("shopAuthId");
   search.addFilterEqual("isDelete", false);
   return generalDAO.search(search);
 }
  /**
   * 将包含授权信息的Shop转换为ShopVo
   *
   * @param shop
   * @return
   */
  private ShopVo convertShopAndAuth2ShopVo(Shop shop) {
    ShopVo shopVo = null;
    if (shop == null) {
      return shopVo;
    }

    shopVo = new ShopVo();
    shopVo.setId(shop.getId());
    shopVo.setShopId(shop.getOutShopId());
    shopVo.setCatId(shop.getCatId());
    shopVo.setNick(shop.getNick());
    shopVo.setTitle(shop.getTitle());
    shopVo.setDescription(shop.getDescription());
    shopVo.setBulletin(shop.getBulletin());
    shopVo.setPicPath(shop.getPicPath());
    shopVo.setItemScore(shop.getItemScore());
    shopVo.setServiceScore(shop.getServiceScore());
    shopVo.setDeliveryScore(shop.getDeliveryScore());
    shopVo.setDeExpress(shop.getDeExpress());
    shopVo.setEnableMsg(shop.getEnableMsg());
    shopVo.setMsgTemp(shop.getMsgTemp());
    shopVo.setMsgSign(shop.getMsgSign());
    shopVo.setOutPlatformType(shop.getPlatformType().getName());
    shopVo.setOutPlatformTypeValue(
        PlatformType.valueOf(shop.getPlatformType().getName()).getValue());
    shopVo.setCreateTime(shop.getCreateTime());
    shopVo.setUpdateTime(shop.getUpdateTime());
    if (shop.getShopAuth() != null) {
      shopVo.setSessionKey(shop.getShopAuth().getSessionKey());
      shopVo.setRefreshToken(shop.getShopAuth().getRefreshToken());
    }

    return shopVo;
  }
Esempio n. 4
0
  /**
   * 根据条件查询店铺,结果分页
   *
   * @param page
   * @param shop
   * @return
   */
  @Transactional(readOnly = false)
  public List<Shop> findShop(Page page, Shop shop) {
    Search search = new Search(Shop.class).setCacheable(true);

    if (shop != null) {
      if (StringUtils.isNotBlank(shop.getNick())) {
        search.addFilterLike("nick", "%" + shop.getNick() + "%");
      }
      if (StringUtils.isNotBlank(shop.getTitle())) {
        search.addFilterLike("title", "%" + shop.getTitle() + "%");
      }
    }
    search.addFilterEqual("isDelete", false);
    search.addFetch("shopAuth").addSortAsc("createTime").addPagination(page);

    return generalDAO.search(search);
  }
 /**
  * 店铺更新
  *
  * @param shop
  * @param sessionKey
  */
 @OperationLog("店铺更新")
 @RequestMapping("/shop/update")
 @ResponseBody
 public JsonResult updateShop(@ModelAttribute("id") Shop shop, String sessionKey)
     throws Exception {
   if (log.isInfoEnabled()) {
     log.info("店铺:更新店铺," + shop);
   }
   // 更新店铺
   shopService.updateShop(shop, sessionKey);
   BusinessLogUtil.bindBusinessLog(
       "店铺详情:名称[%s],描述[%s],卖家昵称[%s],session Key[%s]",
       shop.getTitle(), shop.getDescription(), shop.getNick(), sessionKey);
   return new JsonResult(true, "更新成功!");
 }
Esempio n. 6
0
 /**
  * 将店铺及授权信息转换为shopBean
  *
  * @param shop
  * @return
  */
 private ShopBean convertShop2ShopBean(Shop shop) {
   ShopBean shopBean = null;
   if (shop == null) {
     return shopBean;
   }
   shopBean = new ShopBean();
   shopBean.setShopId(shop.getId());
   shopBean.setOutShopId(shop.getOutShopId());
   shopBean.setTitle(shop.getTitle());
   shopBean.setSellerNick(shop.getNick());
   if (shop.getShopAuth() != null) {
     shopBean.setUserId(shop.getShopAuth().getUserId());
     shopBean.setSessionKey(shop.getShopAuth().getSessionKey());
     shopBean.setRefreshToken(shop.getShopAuth().getRefreshToken());
   }
   shopBean.setPlatformType(shop.getPlatformType());
   shopBean.setShopType(shop.getShopType());
   return shopBean;
 }