Ejemplo n.º 1
0
  /**
   * 将包含授权信息的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;
  }
Ejemplo n.º 2
0
 /**
  * 店铺更新
  *
  * @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, "更新成功!");
 }
Ejemplo n.º 3
0
  /**
   * 店铺更新
   *
   * @param shop
   */
  public void updateShop(Shop shop, String sessionKey) throws Exception {
    if (logger.isInfoEnabled()) {
      logger.info("店铺更新:" + shop);
    }

    if (!(StringUtils.isBlank(shop.getBulletin()) && StringUtils.isBlank(shop.getDescription()))) {
      // 判断来自哪个平台
      if (StringUtils.equals(shop.getPlatformType().getName(), PlatformType.TAO_BAO.getName())
          || StringUtils.equals(
              shop.getPlatformType().getName(), PlatformType.TAO_BAO_2.getName())) {
        // 将店铺信息更新至淘宝平台
        taoBaoShopApiService.updateShop(shop, sessionKey);
      } else if (StringUtils.equals(
          shop.getPlatformType().getName(), PlatformType.JING_DONG.getName())) {
        // 将店铺信息更新至京东平台
        jingDongShopApiService.updateShop(shop, sessionKey);
      }
    }
    // 所有操作成功,店铺更新
    generalDAO.saveOrUpdate(shop);
    if (logger.isInfoEnabled()) {
      logger.info("店铺更新成功!");
    }
  }