菠萝派接口- 更新库存修改
正在显示
1 个修改的文件
包含
9 行增加
和
9 行删除
... | @@ -32,28 +32,28 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto | ... | @@ -32,28 +32,28 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto |
32 | public PineappleSyncStockResponse call(CallRequest<PineappleSyncStockRequest> callRequest) throws Exception { | 32 | public PineappleSyncStockResponse call(CallRequest<PineappleSyncStockRequest> callRequest) throws Exception { |
33 | PineappleSyncStockResponse pineappleSyncStockResponse = new PineappleSyncStockResponse(); | 33 | PineappleSyncStockResponse pineappleSyncStockResponse = new PineappleSyncStockResponse(); |
34 | if(callRequest.getBizModel().getQuantity() < 0){ | 34 | if(callRequest.getBizModel().getQuantity() < 0){ |
35 | log.error(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0,商品ID是:%s",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); | 35 | log.error(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0,商品ID是:[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); |
36 | throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0,商品ID是:%s",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); | 36 | throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0,商品ID是:[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); |
37 | } | 37 | } |
38 | Map<String,Object> params = new HashMap<>(); | 38 | Map<String,Object> params = new HashMap<>(); |
39 | params.put("supplierId",callRequest.getSupplier().getId()); | 39 | params.put("sellerId",callRequest.getSupplier().getId()); |
40 | params.put("productId",callRequest.getBizModel().getPlatProductID()); | 40 | params.put("productId",callRequest.getBizModel().getPlatProductID()); |
41 | params.put("skuId",callRequest.getBizModel().getSkuID()); | 41 | params.put("skuId",callRequest.getBizModel().getSkuID()); |
42 | params.put("stock",callRequest.getBizModel().getQuantity()); | 42 | params.put("stock",callRequest.getBizModel().getQuantity()); |
43 | 43 | ||
44 | List<DownloadProductBean> downloadProductBeans = pineappleDao.downloadProductListByMap(params); | 44 | DownloadProductBean downloadProductBeans = pineappleDao.getDownloadProductBeanByMap(params); |
45 | if(StringUtil.isNull(downloadProductBeans)){ | 45 | if(StringUtil.isNull(downloadProductBeans)){ |
46 | log.error(String.format("菠萝派商城appkey[%s],没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); | 46 | log.error(String.format("菠萝派商城appkey[%s],没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); |
47 | throw new BizException(String.format("菠萝派商城appkey[%s,没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); | 47 | throw new BizException(String.format("菠萝派商城appkey[%s],没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); |
48 | } | 48 | } |
49 | if(pineappleDao.updateSkuStock(params) != 1){ | 49 | if(pineappleDao.updateSkuStock(params) != 1){ |
50 | log.error(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); | 50 | log.error(String.format("菠萝派商城appkey[%s]更新sku库存失败,没有该sku[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); |
51 | throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); | 51 | throw new BizException(String.format("菠萝派商城appkey[%s]更新sku库存失败,没有该sku[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); |
52 | } | 52 | } |
53 | List<DownloadProductSkuBean> skuBean = pineappleDao.downloadSkuByProductId(callRequest.getBizModel().getPlatProductID()); | 53 | List<DownloadProductSkuBean> skuBean = pineappleDao.downloadSkuByProductId(callRequest.getBizModel().getPlatProductID()); |
54 | if(StringUtil.isNull(skuBean)){ | 54 | if(StringUtil.isNull(skuBean)){ |
55 | log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); | 55 | log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该商品所有的sku[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); |
56 | throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); | 56 | throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该商品所有的sku[%s]",callRequest.getRequest().getAppkey(),callRequest.getBizModel().getPlatProductID())); |
57 | } | 57 | } |
58 | //获取sku总库存 | 58 | //获取sku总库存 |
59 | Integer sumStock = skuBean.stream().map(s -> s.getSkuQuantity()).reduce(0,(a,b) ->{ | 59 | Integer sumStock = skuBean.stream().map(s -> s.getSkuQuantity()).reduce(0,(a,b) ->{ | ... | ... |
-
请 注册 或 登录 后发表评论