Ver código fonte

协销再来一单bugfix

chao 3 anos atrás
pai
commit
2cf124f124

+ 13 - 7
src/main/java/com/caimei365/order/service/impl/CartSellerServiceImpl.java

@@ -15,6 +15,7 @@ import com.caimei365.order.service.CartSellerService;
 import com.caimei365.order.utils.MathUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.google.common.base.Joiner;
 import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.AtomicDouble;
 import lombok.extern.slf4j.Slf4j;
@@ -64,13 +65,15 @@ public class CartSellerServiceImpl implements CartSellerService {
     @Override
     public ResponseJson<Map<String, Object>> getSellerCartList(Integer serviceProviderId, Integer clubId, String againBuyProductIds, int pageNum, int pageSize) {
         List<Integer> againBuyIdList = Lists.newArrayList();
-        if (againBuyProductIds.contains(",")) {
-            String[] againBuyArr = againBuyProductIds.split(",");
-            for (String id : againBuyArr) {
-                againBuyIdList.add(Integer.parseInt(id));
+        if (StringUtils.isNotBlank(againBuyProductIds)) {
+            if (againBuyProductIds.contains(",")) {
+                String[] againBuyArr = againBuyProductIds.split(",");
+                for (String id : againBuyArr) {
+                    againBuyIdList.add(Integer.valueOf(id));
+                }
+            } else {
+                againBuyIdList.add(Integer.valueOf(againBuyProductIds));
             }
-        } else {
-            againBuyIdList.add(Integer.parseInt(againBuyProductIds));
         }
         // 失效商品列表(总)
         List<CartItemVo> invalidList = new ArrayList<>();
@@ -713,15 +716,18 @@ public class CartSellerServiceImpl implements CartSellerService {
         SellerCartDto cart = new SellerCartDto();
         cart.setServiceProviderId(againBuyDto.getServiceProviderId());
         cart.setClubId(orderClubId);
+        List<Integer> productIds = new ArrayList<>();
         productList.forEach(cartItemVo -> {
             cart.setProductId(cartItemVo.getProductId());
             cart.setProductCount(cartItemVo.getNumber());
             addSellerCart(cart);
+            productIds.add(cartItemVo.getProductId());
         });
+        String againBuyProductIds = Joiner.on(",").join(productIds);
         // 包装返回数据
         resultData.put("userId", orderUserId);
         resultData.put("clubId", orderClubId);
-        resultData.put("productList", productList);
+        resultData.put("productIds", againBuyProductIds);
         return ResponseJson.success(resultData);
     }