a55a1469 刘嘉

菠萝派接口- 更改库存接口修改

1 个父辈 e9a791bb
...@@ -38,19 +38,21 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto ...@@ -38,19 +38,21 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto
38 params.put("productId",callRequest.getBizModel().getPlatProductID()); 38 params.put("productId",callRequest.getBizModel().getPlatProductID());
39 //先判断SKU在判断产品 39 //先判断SKU在判断产品
40 IMProductBean iMProductBean = pineappleDao.getIMProductBeanByMap(params); 40 IMProductBean iMProductBean = pineappleDao.getIMProductBeanByMap(params);
41 if(!StringUtil.isNull(iMProductBean)){ 41 if(StringUtil.isNull(iMProductBean)){
42 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品",callRequest.getRequest().getAppkey()));
43 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品",callRequest.getRequest().getAppkey()));
44 }
42 if(callRequest.getBizModel().getQuantity() < 0){ 45 if(callRequest.getBizModel().getQuantity() < 0){
43 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0,method:%s,PlatProductID:%s,SkuID:s%,Quantity:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID(),callRequest.getBizModel().getQuantity())); 46 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0",callRequest.getRequest().getAppkey()));
44 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0,method:%s,PlatProductID:%s,SkuID:s%,Quantity:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID(),callRequest.getBizModel().getQuantity())); 47 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0",callRequest.getRequest().getAppkey()));
45
46 } 48 }
47 if(!StringUtil.isNull(callRequest.getBizModel().getSkuID()) ) { 49 if(!StringUtil.isNull(callRequest.getBizModel().getSkuID()) ) {
48 params.put("skuId",callRequest.getBizModel().getSkuID()); 50 params.put("skuId",callRequest.getBizModel().getSkuID());
49 //查询该条SKUi 51 //查询该条SKUi
50 SkuBean skuBean = pineappleDao.getSkuBeanByMap(params); 52 SkuBean skuBean = pineappleDao.getSkuBeanByMap(params);
51 if(StringUtil.isNull(skuBean)){ 53 if(StringUtil.isNull(skuBean)){
52 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU,method:%s,PlatProductID:%s,SkuID:s%,Quantity:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID(),callRequest.getBizModel().getQuantity())); 54 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU",callRequest.getRequest().getAppkey()));
53 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU,method:%s,PlatProductID:%s,SkuID:s%,Quantity:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID(),callRequest.getBizModel().getQuantity())); 55 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU",callRequest.getRequest().getAppkey()));
54 } 56 }
55 //更新该条SKU 57 //更新该条SKU
56 skuBean.setStockNum(callRequest.getBizModel().getQuantity()); 58 skuBean.setStockNum(callRequest.getBizModel().getQuantity());
...@@ -58,8 +60,8 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto ...@@ -58,8 +60,8 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto
58 //根据产品ID获取所有SKU总数 60 //根据产品ID获取所有SKU总数
59 List<SkuApiResponse> skuBeanList = pineappleDao.getSkuBeanListByMap(callRequest.getBizModel().getPlatProductID()); 61 List<SkuApiResponse> skuBeanList = pineappleDao.getSkuBeanListByMap(callRequest.getBizModel().getPlatProductID());
60 if(!StringUtil.isNull(skuBeanList)){ 62 if(!StringUtil.isNull(skuBeanList)){
61 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU集合,method:%s,PlatProductID:%s,SkuID:s%,Quantity:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID(),callRequest.getBizModel().getQuantity())); 63 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU集合",callRequest.getRequest().getAppkey()));
62 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU集合,method:%s,PlatProductID:%s,SkuID:s%,Quantity:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID(),callRequest.getBizModel().getQuantity())); 64 throw new BizException((String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU集合",callRequest.getRequest().getAppkey())));
63 } 65 }
64 //更新SKU缓存 66 //更新SKU缓存
65 RedisProductSkuService.setProductSkuFromRedis(skuBeanList,callRequest.getBizModel().getSkuID()); 67 RedisProductSkuService.setProductSkuFromRedis(skuBeanList,callRequest.getBizModel().getSkuID());
...@@ -82,17 +84,20 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto ...@@ -82,17 +84,20 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto
82 pineappleSyncStockResponse.setCode(PineappleEnum.SUCCESS.getCode()); 84 pineappleSyncStockResponse.setCode(PineappleEnum.SUCCESS.getCode());
83 return pineappleSyncStockResponse; 85 return pineappleSyncStockResponse;
84 } 86 }
85 }else{ 87 }else {
86 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,更新产品库存失败,method:%s,PlatProductID:%s,SkuID:s%,Quantity:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID(),callRequest.getBizModel().getQuantity())); 88 log.error(String.format("菠萝派商城appkey[%s]更新库存失败", callRequest.getRequest().getAppkey()));
87 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,更新产品库存失败,method:%s,PlatProductID:%s,SkuID:s%,Quantity:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID(),callRequest.getBizModel().getQuantity())); 89 throw new BizException((String.format("菠萝派商城appkey[%s]更新库存失败", callRequest.getRequest().getAppkey())));
88 } 90 }
91 }else{
92 log.error(String.format("菠萝派商城appkey[%s]更新sku库存失败", callRequest.getRequest().getAppkey()));
93 throw new BizException((String.format("菠萝派商城appkey[%s]更新sku库存失败", callRequest.getRequest().getAppkey())));
89 } 94 }
90 } 95 }
91 if(!StringUtil.isNull(callRequest.getBizModel().getPlatProductID())){ 96 if(!StringUtil.isNull(callRequest.getBizModel().getPlatProductID())){
92 List<SkuApiResponse> skuBeanList = pineappleDao.getSkuBeanListByMap(callRequest.getBizModel().getPlatProductID()); 97 List<SkuApiResponse> skuBeanList = pineappleDao.getSkuBeanListByMap(callRequest.getBizModel().getPlatProductID());
93 if(!StringUtil.isNull(skuBeanList) && !skuBeanList.isEmpty()){ 98 if(!StringUtil.isNull(skuBeanList) && !skuBeanList.isEmpty()){
94 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,该产品有SKU,请指定SKUID,method:%s,PlatProductID:%s,SkuID:s%,Quantity:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID(),callRequest.getBizModel().getQuantity())); 99 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,该产品有SKU,请指定SKUID,method:%s,PlatProductID:%s,SkuID:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID()));
95 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,该产品有SKU,请指定SKUID,method:%s,PlatProductID:%s,SkuID:s%,Quantity:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID(),callRequest.getBizModel().getQuantity())); 100 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,该产品有SKU,请指定SKUID,method:%s,PlatProductID:%s,SkuID:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID()));
96 } 101 }
97 params.put("stockNum",callRequest.getBizModel().getQuantity()); 102 params.put("stockNum",callRequest.getBizModel().getQuantity());
98 if(pineappleDao.updateProduct(params) > 0){ 103 if(pineappleDao.updateProduct(params) > 0){
...@@ -111,9 +116,8 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto ...@@ -111,9 +116,8 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto
111 } 116 }
112 } 117 }
113 } 118 }
114 } 119 log.error(String.format("菠萝派商城appkey[%s]没有更改到库存", callRequest.getRequest().getAppkey()));
115 log.error(String.format("菠萝派商城appkey[%s]更新库存失败,method:%s,PlatProductID:%s,SkuID:s%,Quantity:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID(),callRequest.getBizModel().getQuantity())); 120 throw new BizException((String.format("菠萝派商城appkey[%s]没有更改到库存", callRequest.getRequest().getAppkey())));
116 throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,method:%s,PlatProductID:%s,SkuID:s%,Quantity:%s",callRequest.getRequest().getAppkey(),callRequest.getRequest().getMethod(),callRequest.getBizModel().getPlatProductID(),callRequest.getBizModel().getSkuID(),callRequest.getBizModel().getQuantity()));
117 } 121 }
118 122
119 @Override 123 @Override
......