yujian
2019-08-27 d8359ddb48dab5cc797a9d552e11fde571f4920c
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareStorageControllerV2.java
@@ -56,6 +56,51 @@
   @Resource
   private UserGoodsStorageService userGoodsStorageService;
   /**
    *  单个商品加入选品库
    *
    * @param callback
    * @param storageIds
    *            id数组
    * @param out
    */
   @RequestMapping(value = "accordtorage", method = RequestMethod.POST)
   public void accordtorage(AcceptData acceptData, Long uid, long id, Integer goodsType, PrintWriter out) {
      if (uid == null) {
         out.print(JsonUtil.loadFalseResult("用户未登录"));
         return;
      }
      if (goodsType == null) {
         goodsType = Constant.SOURCE_TYPE_TAOBAO;
      }
      try {
         UserGoodsStorage userGoodsStorage = userGoodsStorageService.getByUidAndAuctionId(uid, id, goodsType);
         boolean storageState = false;
         if (userGoodsStorage != null) {
            // 取消加入选品库
            userGoodsStorageService.deleteByPrimaryKey(userGoodsStorage.getId());
         } else {
            // 加入选品库
            Set<Long> set = new HashSet<Long>();
            set.add(id);
            userGoodsStorageService.save(uid, set, goodsType);
            storageState = true;
         }
         JSONObject data = new JSONObject();
         data.put("storageState", storageState);
         out.print(JsonUtil.loadTrueResult(data));
      } catch (Exception e) {
         out.print(JsonUtil.loadFalseResult("操作失败"));
         e.printStackTrace();
      }
   }
   /**
    * 批量添加选品库
    *