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
6f70f6cb
Commit
6f70f6cb
authored
Jun 21, 2021
by
徐康
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/qa' into qa
parents
a2c088ac
864ca50c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
114 additions
and
5 deletions
+114
-5
assortment-ordercenter-sdk/readme.md
+3
-0
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/impl/ShoppingCartBaseServiceImpl.java
+19
-0
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/constant/ApplicationConstant.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/controller/ShoppingCartController.java
+28
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/PutCacheVo.java
+21
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+41
-5
No files found.
assortment-ordercenter-sdk/readme.md
View file @
6f70f6cb
...
@@ -145,3 +145,5 @@
...
@@ -145,3 +145,5 @@
| 2.1.67-RELEASE | 7天自动退款 | 张志恒 | 2021-05-25|
| 2.1.67-RELEASE | 7天自动退款 | 张志恒 | 2021-05-25|
| 2.1.68-RELEASE | 取餐码迁移至聚合层 | 王航航 | 2021-06-07|
| 2.1.68-RELEASE | 取餐码迁移至聚合层 | 王航航 | 2021-06-07|
| 2.1.69-RELEASE | 麦咖啡一键下单 | 徐康 | 2021-06-10|
| 2.1.69-RELEASE | 麦咖啡一键下单 | 徐康 | 2021-06-10|
| 2.1.70-RELEASE | 更新sdk | 张跃 | 2021-06-17|
| 2.1.71-RELEASE | 麦咖啡买赠和阶梯运费 | 徐康 | 2021-06-19|
\ No newline at end of file
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/service/impl/ShoppingCartBaseServiceImpl.java
View file @
6f70f6cb
...
@@ -175,6 +175,25 @@ public class ShoppingCartBaseServiceImpl implements ShoppingCartBaseService {
...
@@ -175,6 +175,25 @@ public class ShoppingCartBaseServiceImpl implements ShoppingCartBaseService {
}
}
}
}
/**
* 测试用,后续删掉
*/
public
BaseResponse
<
List
<
CartGoods
>>
setCartGoodsListTest
(
CartParamDto
cartParamDto
,
String
trackingNo
,
long
expire
,
TimeUnit
timeUnit
)
{
try
{
String
redisKey
=
getShoppingCartGoodsKey
(
cartParamDto
);
BoundHashOperations
<
String
,
String
,
CartGoods
>
operations
=
redisTemplate
.
boundHashOps
(
redisKey
);
Map
<
String
,
CartGoods
>
cartGoodsMap
=
cartParamDto
.
getCartGoodsList
().
parallelStream
()
.
filter
(
k
->
StringUtils
.
isNotEmpty
(
k
.
getCartGoodsUid
()))
.
collect
(
Collectors
.
toMap
(
CartGoods:
:
getCartGoodsUid
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
operations
.
putAll
(
cartGoodsMap
);
operations
.
expire
(
expire
,
timeUnit
);
return
CartResponseUtil
.
success
();
}
catch
(
Exception
e
)
{
ErrorLog
.
printErrorLog
(
"assortment-shoppingcart-sdk"
,
trackingNo
,
e
.
getMessage
(),
"setCartGoodsList"
,
cartParamDto
,
e
,
Level
.
ERROR
);
return
null
;
}
}
@Override
@Override
public
BaseResponse
<
List
<
CartGoods
>>
setCartSendGoodsList
(
CartParamDto
cartParamDto
,
String
trackingNo
,
long
expire
,
TimeUnit
timeUnit
)
{
public
BaseResponse
<
List
<
CartGoods
>>
setCartSendGoodsList
(
CartParamDto
cartParamDto
,
String
trackingNo
,
long
expire
,
TimeUnit
timeUnit
)
{
try
{
try
{
...
...
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
View file @
6f70f6cb
...
@@ -38,6 +38,7 @@ import cn.freemud.entities.dto.delivery.*;
...
@@ -38,6 +38,7 @@ import cn.freemud.entities.dto.delivery.*;
import
cn.freemud.entities.dto.ecology.SendMessageRequest
;
import
cn.freemud.entities.dto.ecology.SendMessageRequest
;
import
cn.freemud.entities.dto.ecology.SendMessageResponse
;
import
cn.freemud.entities.dto.ecology.SendMessageResponse
;
import
cn.freemud.entities.dto.ecology.SubscribeMessageRequest
;
import
cn.freemud.entities.dto.ecology.SubscribeMessageRequest
;
import
cn.freemud.entities.dto.ecology.SendMessageRequest
;
import
cn.freemud.entities.dto.order.CreateOrderOperateDto
;
import
cn.freemud.entities.dto.order.CreateOrderOperateDto
;
import
cn.freemud.entities.dto.order.CreatePrepayRequestDto
;
import
cn.freemud.entities.dto.order.CreatePrepayRequestDto
;
import
cn.freemud.entities.dto.order.FacePayRequestDto
;
import
cn.freemud.entities.dto.order.FacePayRequestDto
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/constant/ApplicationConstant.java
View file @
6f70f6cb
...
@@ -21,4 +21,5 @@ public class ApplicationConstant {
...
@@ -21,4 +21,5 @@ public class ApplicationConstant {
public
final
static
String
DELIVERY_DISCOUNT_DESC1
=
"订单满%s元减%s元配送费"
;
public
final
static
String
DELIVERY_DISCOUNT_DESC1
=
"订单满%s元减%s元配送费"
;
public
final
static
String
DELIVERY_DISCOUNT_DESC2
=
"订单满%s元免配送费"
;
public
final
static
String
DELIVERY_DISCOUNT_DESC2
=
"订单满%s元免配送费"
;
public
final
static
String
DELIVERY_DISCOUNT_DESC3
=
"另需配送费%s元"
;
public
final
static
String
DELIVERY_DISCOUNT_DESC3
=
"另需配送费%s元"
;
public
final
static
String
DELIVERY_DISCOUNT_DESC4
=
" 选择了配送券"
;
}
}
shopping-cart-application-service/src/main/java/cn/freemud/controller/ShoppingCartController.java
View file @
6f70f6cb
...
@@ -35,6 +35,8 @@ import com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustome
...
@@ -35,6 +35,8 @@ import com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustome
import
com.freemud.application.sdk.api.base.SDKCommonBaseContextWare
;
import
com.freemud.application.sdk.api.base.SDKCommonBaseContextWare
;
import
com.freemud.application.sdk.api.log.ApiAnnotation
;
import
com.freemud.application.sdk.api.log.ApiAnnotation
;
import
com.freemud.application.sdk.api.log.LogParams
;
import
com.freemud.application.sdk.api.log.LogParams
;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
ma.glasnost.orika.MapperFacade
;
import
ma.glasnost.orika.MapperFacade
;
...
@@ -50,6 +52,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -50,6 +52,7 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
@RestController
@RestController
@RequestMapping
(
value
=
"/shoppingCart"
,
consumes
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/shoppingCart"
,
consumes
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
...
@@ -267,4 +270,29 @@ public class ShoppingCartController {
...
@@ -267,4 +270,29 @@ public class ShoppingCartController {
return
SDKCommonBaseContextWare
.
getBean
(
ShoppingCartNewServiceImpl
.
class
).
replaceGoodsByShop
(
request
);
return
SDKCommonBaseContextWare
.
getBean
(
ShoppingCartNewServiceImpl
.
class
).
replaceGoodsByShop
(
request
);
}
}
@Autowired
private
ShoppingCartBaseServiceImpl
shoppingCartService
;
@Autowired
private
AssortmentCustomerInfoManager
assortmentCustomerInfoManager
;
/**
* 测试用,后续删除
*/
@PostMapping
(
value
=
"/test/putCache"
)
@LogIgnore
(
excludeStatusCodes
=
{
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
},
logMessage
=
"/putCache"
)
public
BaseResponse
putCache
(
@LogParams
@RequestBody
@Validated
PutCacheVo
request
)
{
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartParamDto
cartParamDto
=
new
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartParamDto
();
cartParamDto
.
setPartnerId
(
request
.
getPartnerId
());
cartParamDto
.
setStoreId
(
request
.
getStoreId
());
cartParamDto
.
setBuyType
(
0
);
cartParamDto
.
setCartGoodsList
(
request
.
getCartGoodsList
());
for
(
String
sessionId
:
request
.
getSessionIds
()){
AssortmentCustomerInfoVo
assortmentCustomerInfoVo
=
assortmentCustomerInfoManager
.
getCustomerInfoByObject
(
sessionId
);
cartParamDto
.
setUserId
(
assortmentCustomerInfoVo
.
getMemberId
());
shoppingCartService
.
setCartGoodsListTest
(
cartParamDto
,
LogThreadLocal
.
getTrackingNo
(),
10
,
TimeUnit
.
MINUTES
);
}
return
new
BaseResponse
(
"1"
,
"100"
,
""
);
}
}
}
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/PutCacheVo.java
0 → 100644
View file @
6f70f6cb
package
cn
.
freemud
.
entities
.
vo
;
import
com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
PutCacheVo
{
private
String
partnerId
;
private
List
<
String
>
sessionIds
;
private
String
storeId
;
// private com.freemud.sdk.api.assortment.shoppingcart.domain.CartParamDto cartParamDto ;
private
List
<
CartGoods
>
cartGoodsList
;
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
6f70f6cb
...
@@ -1705,11 +1705,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1705,11 +1705,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
couponPromotionVO
!=
null
)
{
if
(
couponPromotionVO
!=
null
)
{
couponPromotionVO
.
setDeliveryAmount
(
deliveryAmount
);
couponPromotionVO
.
setDeliveryAmount
(
deliveryAmount
);
}
}
//默认计算优惠
//默认计算优惠
设置包装费 原价 现价 优惠金额
DefaultPromotionService
defaultPromotionService
=
(
DefaultPromotionService
)
PromotionFactory
.
getPromotionService
(
ShoppingCartPromotionEnum
.
DEFAULT_PROMOTION
);
DefaultPromotionService
defaultPromotionService
=
(
DefaultPromotionService
)
PromotionFactory
.
getPromotionService
(
ShoppingCartPromotionEnum
.
DEFAULT_PROMOTION
);
defaultPromotionService
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
activityQueryDto
,
calculationDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
userLoginInfoDto
,
shoppingCartInfoRequestVo
);
defaultPromotionService
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
activityQueryDto
,
calculationDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
userLoginInfoDto
,
shoppingCartInfoRequestVo
);
// 优惠券
// 优惠券
这里设置了优惠券的优惠金额 setCouponDiscount(couponDiscount);
CouponPromotionService
couponPromotionService
=
(
CouponPromotionService
)
PromotionFactory
.
getPromotionService
(
ShoppingCartPromotionEnum
.
COUPON_DISCOUNT
);
CouponPromotionService
couponPromotionService
=
(
CouponPromotionService
)
PromotionFactory
.
getPromotionService
(
ShoppingCartPromotionEnum
.
COUPON_DISCOUNT
);
couponPromotionService
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
activityQueryDto
,
calculationDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
userLoginInfoDto
,
shoppingCartInfoRequestVo
);
couponPromotionService
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
activityQueryDto
,
calculationDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
userLoginInfoDto
,
shoppingCartInfoRequestVo
);
...
@@ -1781,7 +1781,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1781,7 +1781,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
memberDiscountService
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
activityQueryDto
,
calculationDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
userLoginInfoDto
,
shoppingCartInfoRequestVo
);
memberDiscountService
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
activityQueryDto
,
calculationDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
userLoginInfoDto
,
shoppingCartInfoRequestVo
);
/**
/**
* 满额减配送费
* 满额减配送费
优选活动 再配送券
*/
*/
if
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
))
{
if
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
))
{
DecimalFormat
df
=
new
DecimalFormat
(
"###.##"
);
DecimalFormat
df
=
new
DecimalFormat
(
"###.##"
);
...
@@ -1815,10 +1815,17 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1815,10 +1815,17 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
String
desc
=
DELIVERY_DISCOUNT_DESC1
;
String
desc
=
DELIVERY_DISCOUNT_DESC1
;
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
df
.
format
(
beanDto
.
getThresholdAmount
().
doubleValue
()
/
100
)
,
df
.
format
(
beanDto
.
getDiscountAmount
().
doubleValue
()
/
100
)));
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
df
.
format
(
beanDto
.
getThresholdAmount
().
doubleValue
()
/
100
)
,
df
.
format
(
beanDto
.
getDiscountAmount
().
doubleValue
()
/
100
)));
}
}
boolean
isType34
=
verifyActivity
(
calculationDiscountResult
);
if
(
isType34
)
{
String
desc
=
shoppingCartGoodsResponseVo
.
getDeliveryDiscountDesc
();
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
desc
+
","
+
DELIVERY_DISCOUNT_DESC4
);
}
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
calculationDiscountResult
.
getDeliveryAmount
());
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
calculationDiscountResult
.
getDeliveryAmount
());
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
calculationDiscountResult
.
getDistributionFee
());
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
calculationDiscountResult
.
getDistributionFee
());
shoppingCartGoodsResponseVo
.
setThresholdAmount
(
discount
.
getThresholdAmount
());
shoppingCartGoodsResponseVo
.
setThresholdAmount
(
discount
.
getThresholdAmount
());
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
true
);
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
true
);
// fisherman 促销优惠先 剩余的 配送费 怎么处理的? 需要沟通问一下
}
else
{
}
else
{
if
(
activityResponse
!=
null
)
{
if
(
activityResponse
!=
null
)
{
...
@@ -1833,11 +1840,18 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1833,11 +1840,18 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
deliveryAmount
);
// 增加配送券之后的逻辑
// shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult==null?deliveryAmount:calculationDiscountResult.getDistributionFee());
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
false
);
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
false
);
// fisherman 有活动 并且使用了优惠券
boolean
isType34
=
verifyActivity
(
calculationDiscountResult
);
if
(
isType34
)
{
// 使用了优惠券
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
calculationDiscountResult
.
getDistributionFee
());
String
deliveryDiscountDesc
=
shoppingCartGoodsResponseVo
.
getDeliveryDiscountDesc
();
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
deliveryDiscountDesc
+
","
+
DELIVERY_DISCOUNT_DESC4
);
}
}
else
{
}
else
{
// 这里需要看看 选择了 配送券 calculationDiscountResult.getDistributionFee() 这个值是多少
String
desc
=
DELIVERY_DISCOUNT_DESC3
;
String
desc
=
DELIVERY_DISCOUNT_DESC3
;
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
df
.
format
(
deliveryAmount
.
doubleValue
()
/
100
)));
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
df
.
format
(
deliveryAmount
.
doubleValue
()
/
100
)));
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
deliveryAmount
);
...
@@ -1845,6 +1859,14 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1845,6 +1859,14 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 增加配送券之后的逻辑
// 增加配送券之后的逻辑
// shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult==null?deliveryAmount:calculationDiscountResult.getDistributionFee());
// shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult==null?deliveryAmount:calculationDiscountResult.getDistributionFee());
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
false
);
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
false
);
// fisherman 确认是否 使用了优惠券
boolean
isType34
=
verifyActivity
(
calculationDiscountResult
);
if
(
isType34
)
{
// 使用了优惠券
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
calculationDiscountResult
.
getDistributionFee
());
String
deliveryDiscountDesc
=
shoppingCartGoodsResponseVo
.
getDeliveryDiscountDesc
();
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
deliveryDiscountDesc
+
","
+
DELIVERY_DISCOUNT_DESC4
);
}
}
}
}
}
LogUtil
.
info
(
"fisherman 满额减配送算价格"
,
discount
,
shoppingCartGoodsResponseVo
);
LogUtil
.
info
(
"fisherman 满额减配送算价格"
,
discount
,
shoppingCartGoodsResponseVo
);
...
@@ -1860,6 +1882,20 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1860,6 +1882,20 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
}
/**
/**
* 检验是否使用的 配送券
* @param calculationDiscountResult
* @return
*/
private
boolean
verifyActivity
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
)
{
if
(
calculationDiscountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
calculationDiscountResult
.
getCouponDiscounts
()))
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
CouponResults
type34
=
calculationDiscountResult
.
getCouponDiscounts
().
stream
().
filter
(
couponResults
->
couponResults
.
getActivityType
()
!=
null
&&
couponResults
.
getActivityType
().
compareTo
(
ActivityTypeEnum
.
TYPE_34
.
getCode
())
==
0
).
findFirst
().
orElse
(
null
);
return
type34
!=
null
;
}
return
false
;
}
/**
* 促销均摊计算
* 促销均摊计算
*
*
* @param shoppingCartGoodsResponseVo
* @param shoppingCartGoodsResponseVo
...
...
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