admin
2019-07-31 f253c6f0ce5e708850f8e3c84a6a9008fc37df5f
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserGoodsStorageController.java
@@ -46,7 +46,7 @@
    * @param out
    */
   @RequestMapping(value = "accordtorage", method = RequestMethod.POST)
   public void accordtorage(AcceptData acceptData, Long uid, Long auctionId, PrintWriter out) {
   public void accordtorage(AcceptData acceptData, Long uid, Long auctionId, Integer goodsType, PrintWriter out) {
      if (auctionId == null) {
         out.print(JsonUtil.loadFalseResult("未选择商品"));
@@ -57,10 +57,13 @@
         out.print(JsonUtil.loadFalseResult("用户未登录"));
         return;
      }
      if (goodsType == null) {
         goodsType = Constant.SOURCE_TYPE_TAOBAO;
      }
      try {
         UserGoodsStorage userGoodsStorage = userGoodsStorageService.getByUidAndAuctionId(uid, auctionId);
         UserGoodsStorage userGoodsStorage = userGoodsStorageService.getByUidAndAuctionId(uid, auctionId, goodsType);
         boolean storageState = false;
         if (userGoodsStorage != null) {
            // 取消加入选品库
@@ -69,7 +72,7 @@
            // 加入选品库
            Set<Long> set = new HashSet<Long>();
            set.add(auctionId);
            userGoodsStorageService.save(uid, set);
            userGoodsStorageService.save(uid, set, goodsType);
            storageState = true;
         }
         
@@ -94,7 +97,7 @@
    * @param out
    */
   @RequestMapping(value = "addstorage", method = RequestMethod.POST)
   public void addStorage(AcceptData acceptData, Long uid, String auctionIds, PrintWriter out) {
   public void addStorage(AcceptData acceptData, Long uid, String auctionIds, Integer goodsType,PrintWriter out) {
      try {
         Gson gson = new Gson();
         Set<Long> set = gson.fromJson(auctionIds, new TypeToken<HashSet<Long>>() {}.getType());
@@ -103,7 +106,10 @@
            return;
         }
         userGoodsStorageService.save(uid, set);
         if (goodsType == null) {
            goodsType = Constant.SOURCE_TYPE_TAOBAO;
         }
         userGoodsStorageService.save(uid, set, goodsType);
         out.print(JsonUtil.loadTrueResult("添加成功"));
      } catch (UserGoodsStorageException e) {
@@ -143,9 +149,9 @@
         JSONObject data = new JSONObject();
         JSONArray array = new JSONArray();
         long count = userGoodsStorageService.countQueryByUid(uid);
         long count = userGoodsStorageService.countQueryByUid(uid, null);
         if (count > 0) {
            array = userGoodsStorageService.getMyStorage((page - 1) * pageSize, pageSize, uid);
            array = userGoodsStorageService.getMyStorage((page - 1) * pageSize, pageSize, uid, null);
         }
         data.put("count", count);
@@ -221,7 +227,6 @@
      }
      try {
         Gson gson = new Gson();
         List<Long> listStorageID = gson.fromJson(storageIds, new TypeToken<ArrayList<Long>>() {}.getType());
         if (listStorageID == null || listStorageID.size() < 9) {
@@ -233,7 +238,6 @@
            out.print(JsonUtil.loadFalseResult("分享商品数量只能是9个"));
            return;
         }
         JSONObject data = userGoodsStorageService.shareGoods(uid, listStorageID);
         out.print(JsonUtil.loadTrueResult(data));