Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
4df5fb74
Commit
4df5fb74
authored
Jul 21, 2021
by
hanghang.wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购物车日志修改01
parent
61c7eca9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
47 deletions
+22
-47
shopping-cart-application-service/src/main/java/cn/freemud/constant/ResponseCodeKeyConstant.java
+6
-3
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
+4
-11
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+12
-33
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/constant/ResponseCodeKeyConstant.java
View file @
4df5fb74
...
...
@@ -29,11 +29,14 @@ public class ResponseCodeKeyConstant {
public
static
final
String
MSG
=
"msg"
;
//code名称来源根据 ProductInfosDto
/**
* code名称来源根据 ProductInfosDto
*/
public
final
static
String
ERR_CODE
=
"errcode"
;
//errmsg名称来源根据 ProductInfosDto
/**
* errmsg名称来源根据 ProductInfosDto
*/
public
static
final
String
ERR_MSG
=
"errmsg"
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
View file @
4df5fb74
...
...
@@ -271,7 +271,7 @@ public class CouponServiceImpl implements CouponService {
@Override
public
GetCouponDetailResponseDto
getMemberCoupon
(
GetMemberCouponRequestVo
requestVo
)
{
//
TODO
券详情查券服务
//券详情查券服务
Map
<
String
,
String
>
map
=
new
TreeMap
<
String
,
String
>();
if
(
StringUtils
.
isBlank
(
requestVo
.
getPartnerId
())
||
StringUtils
.
isBlank
(
requestVo
.
getCouponCode
()))
{
return
null
;
...
...
@@ -932,7 +932,7 @@ public class CouponServiceImpl implements CouponService {
requestVo
.
setCouponCode
(
couponCode
);
requestVo
.
setStoreId
(
requestDto
.
getStoreId
());
GetCouponDetailResponseDto
couponDetailResponseDto
=
couponService
.
getMemberCoupon
(
requestVo
);
LogUtil
.
info
(
"couponService.getMemberCoupon"
,
gson
.
toJson
(
requestVo
),
gson
.
toJson
(
couponDetailResponseDto
)
);
ApiLog
.
printLog
(
"couponService.getMemberCoupon"
,
gson
.
toJson
(
requestVo
),
gson
.
toJson
(
couponDetailResponseDto
),
""
);
if
(
couponDetailResponseDto
==
null
||
!
couponDetailResponseDto
.
getResult
().
equals
(
ResponseCodeConstant
.
RESPONSE_SUCCESS_1
)
||
CollectionUtils
.
isEmpty
(
couponDetailResponseDto
.
getDetails
()))
{
return
null
;
}
...
...
@@ -955,16 +955,10 @@ public class CouponServiceImpl implements CouponService {
if
(!
productValid
)
{
return
null
;
}
//TODO 判断该券是否在这个门店下(一个券可以在多个门店下使用) 注意点1
//判断该券是否在这个门店下(一个券可以在多个门店下使用)
List
<
String
>
couponStoreIds
=
Lists
.
newArrayList
();
for
(
GetCouponDetailResponseDto
.
Details
detail
:
couponDetailResponseDto
.
getDetails
())
{
if
(!
CouponStatus
.
STATUS_0
.
getCode
().
equals
(
detail
.
getStatus
())
&&
!
CouponStatus
.
STATUS_2
.
getCode
().
equals
(
detail
.
getStatus
()))
continue
;
ApiLog
.
printLog
(
"addGoods calculationDiscountResult"
,
JSONObject
.
toJSONString
(
detail
),
" 10"
,
null
);
for
(
GetCouponDetailResponseDto
.
ActiveRestrictionVOS
activeRestrictionVO
:
detail
.
getActiveRestrictionVOS
())
{
couponStoreIds
.
add
(
activeRestrictionVO
.
getStoreIdPartner
());
}
...
...
@@ -972,12 +966,11 @@ public class CouponServiceImpl implements CouponService {
if
(
CollectionUtils
.
isNotEmpty
(
couponStoreIds
)
&&
!
couponStoreIds
.
contains
(
storeId
))
{
return
null
;
}
//券返回的商品id
List
<
String
>
skuIds
=
Lists
.
newArrayList
();
String
skuId
=
goodsId
;
skuIds
.
add
(
skuId
);
//
TODO
通过skuid查询spuid
//通过skuid查询spuid
Map
<
String
,
GetProductsVo
>
productsVoMap
=
itemService
.
getProducts
(
skuIds
,
partnerId
,
storeId
,
requestDto
.
getMenuType
());
GetProductsVo
productsVo
=
productsVoMap
.
get
(
skuId
);
if
(
null
==
productsVo
||
!
Objects
.
equals
(
productsVo
.
getStatus
(),
StoreItemStatus
.
PUT_ON_SALE
.
getCode
()))
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
4df5fb74
...
...
@@ -263,7 +263,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
AddShoppingCartGoodsRequestVo
addShoppingCartGoodsRequestVo
=
shoppingCartConvertAdapter
.
convent2AddshoppingCartGoods
(
request
,
getProductsVo
);
//LogUtil.info("addGoodsByCard shoppingCartAdapter.convent2AddshoppingCartGoods****", JSONObject.toJSONString(addShoppingCartGoodsRequestVo), null);
BaseResponse
baseResponse
=
addGoods
(
addShoppingCartGoodsRequestVo
);
return
baseResponse
;
...
...
@@ -281,7 +280,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
@Override
public
BaseResponse
addGoods
(
AddShoppingCartGoodsRequestVo
addShoppingCartGoodsRequestVo
)
{
if
(
StringUtils
.
isEmpty
(
addShoppingCartGoodsRequestVo
.
getShopId
())){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SHOP_ID_NOT_EMPTY
);
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_SHOP_ID_NOT_EMPTY
);
// throw new ServiceException(ResponseResult.SHOPPING_CART_SHOP_ID_NOT_EMPTY);
}
ShoppingCartConvertAdapter
.
convent2SkuId
(
addShoppingCartGoodsRequestVo
);
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
=
new
ShoppingCartGoodsResponseVo
();
...
...
@@ -326,24 +326,19 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
todayAvailableTimes
=
pair
.
getValue
();
}
}
// // 获取商品详细信息
// List<ProductBeanDTO> productBeanListSpuClass = assortmentSdkService.getProductsInfoSdk(partnerId, storeId
// , Collections.singletonList(spuId2),addShoppingCartGoodsRequestVo.getMenuType(), this.shoppingCartBaseService);
// LogUtil.info("productBeanListSpuClass", spuId2,JSON.toJSONString(productBeanListSpuClass));
// 获取商品详细信息
List
<
ProductBean
>
productBeanListSpuClass
=
assortmentSdkService
.
getProductsInfo
(
partnerId
,
storeId
,
Collections
.
singletonList
(
spuId2
),
addShoppingCartGoodsRequestVo
.
getMenuType
(),
this
.
shoppingCartBaseService
);
// LogUtil.info("productBeanListSpuClass", spuId2,JSON.toJSONString(productBeanListSpuClass));
// 没有查到商品
if
(
productBeanListSpuClass
==
null
||
productBeanListSpuClass
.
isEmpty
()){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_PRODUCT_NOT_EXIST
);
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_PRODUCT_NOT_EXIST
);
}
// 检查商品小料数量
if
(
checkMaterialQty
(
addShoppingCartGoodsRequestVo
,
productBeanListSpuClass
)){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_MATERIA_QTY_LIMIT_ERR
);
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_MATERIA_QTY_LIMIT_ERR
);
}
//缓存中获取购物车商品信息
...
...
@@ -353,14 +348,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
allCartGoodsList
=
new
ArrayList
<>();
}
List
<
CartGoods
>
oldCartGoodsList
=
BeanUtil
.
convertBeans
(
allCartGoodsList
,
CartGoods:
:
new
);
/**
Integer checkQty = allCartGoodsList.indexOf(cartGoods) != -1 ?
allCartGoodsList.get(allCartGoodsList.indexOf(cartGoods)).getQty() + cartGoods.getQty() : cartGoods.getQty();
*/
Integer
checkQty
=
this
.
checkSkuQty
(
allCartGoodsList
,
cartGoods
);
//购物车添加数量限制
Integer
productsCount
=
limitGoodsQty
(
allCartGoodsList
,
cartGoods
,
appId
);
//查询多个商品库存信息
TODO
//查询多个商品库存信息
queryManyGoodsStocks
(
addShoppingCartGoodsRequestVo
,
productIds
,
productBeanListSpuClass
,
skuId
,
checkQty
);
String
productName
=
null
;
// 当添加的商品不是商品券时
...
...
@@ -1479,30 +1471,20 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
activityCalculationDiscountRequestDto
.
setDistributionFee
(
distributionFee
);
activityCalculationDiscountRequestDto
.
setIsMember
(
isMember
);
ActivityCalculationDiscountResponseDto
activityCalculationDiscountResponseDto
;
activityCalculationDiscountRequestDto
.
setProductChannel
(
"def"
.
toString
());
//todo def是什么?
activityCalculationDiscountRequestDto
.
setProductChannel
(
"def"
);
if
(
Objects
.
equals
(
orderType
,
CreateOrderType
.
COLLECT_GOODS
.
getCode
()))
{
activityCalculationDiscountRequestDto
.
setProductChannel
(
BusinessTypeEnum
.
SAAS_PICKUP
.
getCode
());
}
else
if
(
Objects
.
equals
(
orderType
,
CreateOrderType
.
TAKE_OUT
.
getCode
()))
{
activityCalculationDiscountRequestDto
.
setProductChannel
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
());
}
try
{
// ApiLog.debug("activityClient discount :{}", JSON.toJSONString(activityCalculationDiscountRequestDto));
ApiLog
.
printLog
(
"activityClient discount :{}"
,
JSON
.
toJSONString
(
activityCalculationDiscountRequestDto
),
null
,
null
);
activityCalculationDiscountResponseDto
=
activityClient
.
calculationDiscount
(
activityCalculationDiscountRequestDto
);
}
catch
(
Exception
ex
)
{
// ErrorLog.printErrorLog("calculation_discount_error", "/calculation/discount", activityCalculationDiscountRequestDto, ex);
ErrorLog
.
errorDev
(
"500"
,
"calculation_discount_error"
,
ex
,
activityCalculationDiscountRequestDto
);
throw
new
ServiceException
(
ResponseResult
.
OPERATE_TOO_OFTEN
);
}
activityCalculationDiscountResponseDto
=
activityClient
.
calculationDiscount
(
activityCalculationDiscountRequestDto
);
// 返回成功
if
(
activityCalculationDiscountResponseDto
!=
null
&&
StringUtils
.
equals
(
activityCalculationDiscountResponseDto
.
getStatusCode
(),
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
))
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
result
=
activityCalculationDiscountResponseDto
.
getResult
();
List
<
Integer
>
activityTypes
=
result
.
getDiscounts
().
stream
().
map
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
::
getType
).
collect
(
Collectors
.
toList
());
if
(
activityTypes
.
contains
(
221
))
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discountDTO
=
result
.
getDiscounts
().
stream
().
filter
(
d
->
221
==
d
.
getType
(
)).
findFirst
().
get
();
if
(
activityTypes
.
contains
(
ActivityTypeEnum
.
TYPE_221
.
getCode
()
))
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discountDTO
=
result
.
getDiscounts
().
stream
().
filter
(
d
->
ActivityTypeEnum
.
TYPE_221
.
getCode
().
equals
(
d
.
getType
()
)).
findFirst
().
get
();
convert2SendPoint
(
result
,
discountDTO
);
}
...
...
@@ -1518,7 +1500,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
shoppingCartClearRequestVo
.
setPartnerId
(
partnerId
);
shoppingCartClearRequestVo
.
setUserId
(
userId
);
shoppingCartClearRequestVo
.
setShopId
(
storeId
);
shoppingCartClearRequestVo
.
setOperationType
(
1
);
shoppingCartClearRequestVo
.
setOperationType
(
OperationTypeEnum
.
PAY_SUCCESS
.
getOperationType
()
);
clear
(
shoppingCartClearRequestVo
);
if
(
activityCalculationDiscountResponseDto
!=
null
&&
StringUtils
.
equals
(
activityCalculationDiscountResponseDto
.
getStatusCode
(),
"103"
)){
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_COUPON_CAN_NOT_USE_THIS_SHOP
);
...
...
@@ -2062,8 +2044,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
setToastMsgIfNotExist
(
shoppingCartGoodsResponseVo
,
ShoppingCartConstant
.
HAS_OTHER_ACTIVITY_WHEN_ADD_GOODS_COUPON
);
}
//校验合法性,更新缓存中购物车信息
ApiLog
.
printLog
(
"updateCartGoodsLegal"
,
JSONObject
.
toJSONString
(
cartGoods
),
JSON
.
toJSONString
(
allCartGoodsList
),
null
);
updateCartGoodsLegal
(
cartGoods
,
userId
,
shoppingCartGoodsResponseVo
,
addShoppingCartGoodsRequestVo
,
allCartGoodsList
);
}
...
...
@@ -2475,7 +2455,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
StringUtils
.
isBlank
(
receiveId
)
&&
!
Objects
.
equals
(
orderType
,
CreateOrderType
.
TAKE_OUT
.
getCode
()))
{
return
deliveryAmount
;
}
// ApiLog.debug("获取配送配逻辑 tackingNo:{},storeDeliveryUseOld:{},receiveId:{},partnerId:{},storeId:{}", LogThreadLocal.getTrackingNo(), storeDeliveryUseOld, receiveId, partnerId, storeId);
ApiLog
.
printLog
(
"获取配送配逻辑 tackingNo:{},storeDeliveryUseOld:{},receiveId:{},partnerId:{},storeId:{}"
,
LogThreadLocal
.
getTrackingNo
(),
JSON
.
toJSONString
(
storeDeliveryUseOld
),
"receiveId:"
+
receiveId
+
",partnerId:"
+
partnerId
+
",storeId:"
+
storeId
);
if
(
storeDeliveryUseOld
)
{
deliveryAmount
=
Long
.
parseLong
(
getDeliveryAmount
(
receiveId
,
partnerId
,
storeId
).
toString
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment