Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
sibu-v-mall
/
sibu-v-mall-third-api
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
4b154430
由
刘嘉
编写于
2018-05-16 17:45:25 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
菠萝派接口- 更改产品库存调用新数据源
1 个父辈
d0afcb9f
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
11 行增加
和
6 行删除
com.sibu.orderHelper.service/src/main/java/com/sibu/orderHelper/integral/service/pineapple/impl/SyncStockBizServiceImpl.java
com.sibu.orderHelper.service/src/main/java/com/sibu/orderHelper/integral/service/pineapple/impl/SyncStockBizServiceImpl.java
查看文件 @
4b15443
...
...
@@ -10,6 +10,8 @@ import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import
com.sibu.orderHelper.integral.reponse.PineappleSyncStockResponse
;
import
com.sibu.orderHelper.integral.reponse.SkuApiResponse
;
import
com.sibu.orderHelper.integral.request.PineappleSyncStockRequest
;
import
com.sibu.orderHelper.mall.member.read.MemberReadDao
;
import
com.sibu.orderHelper.mall.member.write.MemberWriteDao
;
import
com.sibu.orderHelper.service.redis.RedisProductSkuService
;
import
com.sibu.orderHelper.service.redis.RedisProductStockService
;
import
org.apache.log4j.Logger
;
...
...
@@ -24,10 +26,13 @@ import java.util.Map;
@Service
public
class
SyncStockBizServiceImpl
extends
AbstractBizService
<
PineappleSyncStockRequest
>
{
private
static
Logger
log
=
Logger
.
getLogger
(
SyncStockBizServiceImpl
.
class
);
@Resource
private
MemberReadDao
memberReadDao
;
@Resource
private
PineappleDao
pineappl
eDao
;
private
MemberWriteDao
memberWrit
eDao
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManagerForMall"
,
rollbackFor
=
Exception
.
class
)
@Override
public
PineappleSyncStockResponse
call
(
CallRequest
<
PineappleSyncStockRequest
>
callRequest
)
throws
Exception
{
PineappleSyncStockResponse
pineappleSyncStockResponse
=
new
PineappleSyncStockResponse
();
...
...
@@ -41,16 +46,16 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto
params
.
put
(
"skuId"
,
callRequest
.
getBizModel
().
getSkuID
());
params
.
put
(
"stock"
,
callRequest
.
getBizModel
().
getQuantity
());
DownloadProductBean
downloadProductBeans
=
pineapple
Dao
.
getDownloadProductBeanByMap
(
params
);
DownloadProductBean
downloadProductBeans
=
memberRead
Dao
.
getDownloadProductBeanByMap
(
params
);
if
(
StringUtil
.
isNull
(
downloadProductBeans
)){
log
.
error
(
String
.
format
(
"菠萝派商城appkey[%s],没有该商品[%s]"
,
callRequest
.
getRequest
().
getAppkey
(),
callRequest
.
getBizModel
().
getPlatProductID
()));
throw
new
BizException
(
String
.
format
(
"菠萝派商城appkey[%s],没有该商品[%s]"
,
callRequest
.
getRequest
().
getAppkey
(),
callRequest
.
getBizModel
().
getPlatProductID
()));
}
if
(
pineappl
eDao
.
updateSkuStock
(
params
)
!=
1
){
if
(
memberWrit
eDao
.
updateSkuStock
(
params
)
!=
1
){
log
.
error
(
String
.
format
(
"菠萝派商城appkey[%s]更新sku库存失败,没有该sku[%s]"
,
callRequest
.
getRequest
().
getAppkey
(),
callRequest
.
getBizModel
().
getPlatProductID
()));
throw
new
BizException
(
String
.
format
(
"菠萝派商城appkey[%s]更新sku库存失败,没有该sku[%s]"
,
callRequest
.
getRequest
().
getAppkey
(),
callRequest
.
getBizModel
().
getPlatProductID
()));
}
List
<
DownloadProductSkuBean
>
skuBean
=
pineapple
Dao
.
downloadSkuByProductId
(
callRequest
.
getBizModel
().
getPlatProductID
());
List
<
DownloadProductSkuBean
>
skuBean
=
memberRead
Dao
.
downloadSkuByProductId
(
callRequest
.
getBizModel
().
getPlatProductID
());
if
(
StringUtil
.
isNull
(
skuBean
)){
log
.
error
(
String
.
format
(
"菠萝派商城appkey[%s]更新库存失败,查询不到该商品所有的sku[%s]"
,
callRequest
.
getRequest
().
getAppkey
(),
callRequest
.
getBizModel
().
getPlatProductID
()));
throw
new
BizException
(
String
.
format
(
"菠萝派商城appkey[%s]更新库存失败,查询不到该商品所有的sku[%s]"
,
callRequest
.
getRequest
().
getAppkey
(),
callRequest
.
getBizModel
().
getPlatProductID
()));
...
...
@@ -60,7 +65,7 @@ public class SyncStockBizServiceImpl extends AbstractBizService<PineappleSyncSto
return
a
+
b
;
});
params
.
put
(
"productStock"
,
sumStock
);
if
(
pineappl
eDao
.
updateProductStock
(
params
)
!=
1
){
if
(
memberWrit
eDao
.
updateProductStock
(
params
)
!=
1
){
log
.
error
(
String
.
format
(
"菠萝派商城appkey[%s]更新产品库存失败[%s]"
,
callRequest
.
getRequest
().
getAppkey
(),
callRequest
.
getBizModel
().
getPlatProductID
()));
throw
new
BizException
((
String
.
format
(
"菠萝派商城appkey[%s]更新产品库存失败[%s]"
,
callRequest
.
getRequest
().
getAppkey
(),
callRequest
.
getBizModel
().
getPlatProductID
())));
}
...
...
请
注册
或
登录
后发表评论