a55a1469 刘嘉

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

1 个父辈 e9a791bb
......@@ -38,19 +38,21 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto
params.put("productId",callRequest.getBizModel().getPlatProductID());
//先判断SKU在判断产品
IMProductBean iMProductBean = pineappleDao.getIMProductBeanByMap(params);
if(!StringUtil.isNull(iMProductBean)){
if(StringUtil.isNull(iMProductBean)){
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品",callRequest.getRequest().getAppkey()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,没有该商品",callRequest.getRequest().getAppkey()));
}
if(callRequest.getBizModel().getQuantity() < 0){
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()));
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()));
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0",callRequest.getRequest().getAppkey()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,库存必须大于或等于0",callRequest.getRequest().getAppkey()));
}
if(!StringUtil.isNull(callRequest.getBizModel().getSkuID()) ) {
params.put("skuId",callRequest.getBizModel().getSkuID());
//查询该条SKUi
SkuBean skuBean = pineappleDao.getSkuBeanByMap(params);
if(StringUtil.isNull(skuBean)){
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()));
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()));
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU",callRequest.getRequest().getAppkey()));
throw new BizException(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU",callRequest.getRequest().getAppkey()));
}
//更新该条SKU
skuBean.setStockNum(callRequest.getBizModel().getQuantity());
......@@ -58,8 +60,8 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto
//根据产品ID获取所有SKU总数
List<SkuApiResponse> skuBeanList = pineappleDao.getSkuBeanListByMap(callRequest.getBizModel().getPlatProductID());
if(!StringUtil.isNull(skuBeanList)){
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()));
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()));
log.error(String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU集合",callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城appkey[%s]更新库存失败,查询不到该SKU集合",callRequest.getRequest().getAppkey())));
}
//更新SKU缓存
RedisProductSkuService.setProductSkuFromRedis(skuBeanList,callRequest.getBizModel().getSkuID());
......@@ -82,17 +84,20 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto
pineappleSyncStockResponse.setCode(PineappleEnum.SUCCESS.getCode());
return pineappleSyncStockResponse;
}
}else{
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()));
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()));
}else {
log.error(String.format("菠萝派商城appkey[%s]更新库存失败", callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城appkey[%s]更新库存失败", callRequest.getRequest().getAppkey())));
}
}else{
log.error(String.format("菠萝派商城appkey[%s]更新sku库存失败", callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城appkey[%s]更新sku库存失败", callRequest.getRequest().getAppkey())));
}
}
if(!StringUtil.isNull(callRequest.getBizModel().getPlatProductID())){
List<SkuApiResponse> skuBeanList = pineappleDao.getSkuBeanListByMap(callRequest.getBizModel().getPlatProductID());
if(!StringUtil.isNull(skuBeanList) && !skuBeanList.isEmpty()){
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()));
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()));
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()));
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()));
}
params.put("stockNum",callRequest.getBizModel().getQuantity());
if(pineappleDao.updateProduct(params) > 0){
......@@ -111,9 +116,8 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto
}
}
}
}
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()));
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()));
log.error(String.format("菠萝派商城appkey[%s]没有更改到库存", callRequest.getRequest().getAppkey()));
throw new BizException((String.format("菠萝派商城appkey[%s]没有更改到库存", callRequest.getRequest().getAppkey())));
}
@Override
......