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
b162d6bf
Commit
b162d6bf
authored
May 27, 2021
by
ping.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购物车调券码可用券接口,增加组织结构id
parent
9d365c3a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
46 deletions
+75
-46
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/GetCouponDetailResponseDto.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/CommonService.java
+23
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
+47
-46
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
+4
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/GetCouponDetailResponseDto.java
View file @
b162d6bf
...
@@ -29,6 +29,7 @@ public class GetCouponDetailResponseDto {
...
@@ -29,6 +29,7 @@ public class GetCouponDetailResponseDto {
private
String
valid_start
;
private
String
valid_start
;
private
String
valid_ends
;
private
String
valid_ends
;
private
String
minAmount
;
private
String
minAmount
;
private
Integer
storeChannelLimit
;
private
Active
active
;
private
Active
active
;
private
List
<
ActiveProduct
>
activeProduct
;
private
List
<
ActiveProduct
>
activeProduct
;
private
List
<
ActiveRestrictionVOS
>
activeRestrictionVOS
;
private
List
<
ActiveRestrictionVOS
>
activeRestrictionVOS
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/CommonService.java
View file @
b162d6bf
...
@@ -73,6 +73,29 @@ public interface CommonService {
...
@@ -73,6 +73,29 @@ public interface CommonService {
return
null
;
return
null
;
}
}
/**
* 查询门店服务 - 获取组织结构树
*
* @param partnerId
* @param storeCode
* @return
*/
default
List
<
String
>
getOrgIdsForCoupon
(
String
partnerId
,
String
storeCode
)
{
GetOrgTreeListRequest
request
=
new
GetOrgTreeListRequest
();
request
.
setPartnerId
(
partnerId
);
request
.
setStoreCode
(
storeCode
);
StoreCenterService
storeCenterService
=
SpringBeanUtil
.
getBean
(
StoreCenterService
.
class
);
BaseResponse
<
GetOrgTreeListResponse
>
orgList
=
storeCenterService
.
getOrgTreeList
(
request
,
LogThreadLocal
.
getTrackingNo
());
if
(
orgList
!=
null
&&
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
.
equals
(
orgList
.
getCode
()))
{
List
<
GetOrgTreeListResponse
.
OrgList
>
orgResponseList
=
orgList
.
getData
().
getOrgList
();
if
(
CollectionUtils
.
isEmpty
(
orgResponseList
)){
return
null
;
}
return
orgResponseList
.
stream
().
map
(
org
->
org
.
getOrganizationId
()).
collect
(
Collectors
.
toList
());
}
return
null
;
}
default
String
getOrgIdsAsString
(
String
partnerId
,
String
storeCode
)
{
default
String
getOrgIdsAsString
(
String
partnerId
,
String
storeCode
)
{
List
<
String
>
orgIdList
=
this
.
getOrgIds
(
partnerId
,
storeCode
);
List
<
String
>
orgIdList
=
this
.
getOrgIds
(
partnerId
,
storeCode
);
return
CollectionUtils
.
isNotEmpty
(
orgIdList
)
?
Joiner
.
on
(
","
).
join
(
orgIdList
)
:
""
;
return
CollectionUtils
.
isNotEmpty
(
orgIdList
)
?
Joiner
.
on
(
","
).
join
(
orgIdList
)
:
""
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
View file @
b162d6bf
...
@@ -512,6 +512,7 @@ public class CouponServiceImpl implements CouponService {
...
@@ -512,6 +512,7 @@ public class CouponServiceImpl implements CouponService {
couponAvailableReqVo
.
setTotalAmount
(
Integer
.
valueOf
(
totalAmount
+
""
));
couponAvailableReqVo
.
setTotalAmount
(
Integer
.
valueOf
(
totalAmount
+
""
));
couponAvailableReqVo
.
setProductList
(
productList
);
couponAvailableReqVo
.
setProductList
(
productList
);
couponAvailableReqVo
.
setChannelCodeList
(
commonService
.
getOrgCodes
(
partnerId
,
storeId
));
couponAvailableReqVo
.
setChannelCodeList
(
commonService
.
getOrgCodes
(
partnerId
,
storeId
));
// couponAvailableReqVo.setChannelIdList(commonService.getOrgIdsForCoupon(partnerId, storeId));
if
(
StringUtils
.
isNotBlank
(
menuType
))
{
if
(
StringUtils
.
isNotBlank
(
menuType
))
{
String
code
=
BusinessTypeEnum
.
getByType
(
menuType
).
getCode
();
String
code
=
BusinessTypeEnum
.
getByType
(
menuType
).
getCode
();
String
channel
=
CouponRedeemChannel
.
getChannelByType
(
code
);
String
channel
=
CouponRedeemChannel
.
getChannelByType
(
code
);
...
@@ -1261,52 +1262,52 @@ public class CouponServiceImpl implements CouponService {
...
@@ -1261,52 +1262,52 @@ public class CouponServiceImpl implements CouponService {
return
createCouponBeanVos
;
return
createCouponBeanVos
;
}
}
/**
//
/**
* 查询当前门店下可用商品券,循环获取
//
* 查询当前门店下可用商品券,循环获取
*
//
*
* @param partnerId
//
* @param partnerId
* @param storeId
//
* @param storeId
* @param codes
//
* @param codes
*/
//
*/
public
List
<
CouponStateVo
>
getCouponStateByStoreId
(
String
partnerId
,
String
storeId
,
List
<
String
>
codes
)
{
//
public List<CouponStateVo> getCouponStateByStoreId(String partnerId, String storeId, List<String> codes) {
String
appSecret
=
getAppSecret
(
partnerId
);
//
String appSecret = getAppSecret(partnerId);
// 最大15一提交
//
// 最大15一提交
int
maxNum
=
15
;
//
int maxNum = 15;
int
count
=
codes
.
size
()
/
maxNum
;
//
int count = codes.size() / maxNum;
// 计算可用不可用券
//
// 计算可用不可用券
CouponAvailableReqVo
couponAvailableReqVo
=
new
CouponAvailableReqVo
();
//
CouponAvailableReqVo couponAvailableReqVo = new CouponAvailableReqVo();
couponAvailableReqVo
.
setMerchantId
(
partnerId
);
//
couponAvailableReqVo.setMerchantId(partnerId);
couponAvailableReqVo
.
setProviderId
(
partnerId
);
//
couponAvailableReqVo.setProviderId(partnerId);
couponAvailableReqVo
.
setStoreId
(
storeId
);
//
couponAvailableReqVo.setStoreId(storeId);
List
<
Product
>
productList
=
Lists
.
newArrayList
();
//
List<Product> productList = Lists.newArrayList();
// 优惠券优先级最高,根据商品原价做计算
//
// 优惠券优先级最高,根据商品原价做计算
// 订单金额
//
// 订单金额
Long
totalAmount
=
0L
;
//
Long totalAmount = 0L;
couponAvailableReqVo
.
setTotalAmount
(
Integer
.
valueOf
(
totalAmount
+
""
));
//
couponAvailableReqVo.setTotalAmount(Integer.valueOf(totalAmount + ""));
couponAvailableReqVo
.
setProductList
(
productList
);
//
couponAvailableReqVo.setProductList(productList);
couponAvailableReqVo
.
setChannelCodeList
(
commonService
.
getOrgCodes
(
partnerId
,
storeId
));
//
couponAvailableReqVo.setChannelCodeList(commonService.getOrgCodes(partnerId, storeId));
// 构建计算SDK
//
// 构建计算SDK
List
<
CouponStateVo
>
couponStateList
=
Lists
.
newArrayList
();
//
List<CouponStateVo> couponStateList = Lists.newArrayList();
for
(
int
j
=
0
;
j
<=
count
;
j
++)
{
//
for (int j = 0; j <= count; j++) {
List
calCouponCodes
=
null
;
//
List calCouponCodes = null;
if
(
j
==
count
)
{
//
if (j == count) {
calCouponCodes
=
codes
.
subList
(
maxNum
*
j
,
codes
.
size
());
//
calCouponCodes = codes.subList(maxNum * j, codes.size());
}
else
{
//
} else {
calCouponCodes
=
codes
.
subList
(
maxNum
*
j
,
maxNum
*
j
+
maxNum
);
//
calCouponCodes = codes.subList(maxNum * j, maxNum * j + maxNum);
}
//
}
// 书写逻辑
//
// 书写逻辑
couponAvailableReqVo
.
setCouponCodes
(
calCouponCodes
);
//
couponAvailableReqVo.setCouponCodes(calCouponCodes);
ApiLog
.
debug
(
"availableCoupon couponAvailableService.getCouponsAvailable num:{};start:{}"
,
j
,
JSON
.
toJSONString
(
couponAvailableReqVo
));
//
ApiLog.debug("availableCoupon couponAvailableService.getCouponsAvailable num:{};start:{}", j, JSON.toJSONString(couponAvailableReqVo));
//CouponAvailableRespVo couponsAvailable = couponAvailableService.getCouponsAvailable(couponAvailableReqVo, appSecret);
//
//CouponAvailableRespVo couponsAvailable = couponAvailableService.getCouponsAvailable(couponAvailableReqVo, appSecret);
CouponAvailableRespDto
couponsAvailable
=
couponAdaptClient
.
getCouponsAvailable
(
couponAvailableReqVo
);
//
CouponAvailableRespDto couponsAvailable = couponAdaptClient.getCouponsAvailable(couponAvailableReqVo);
ApiLog
.
debug
(
"availableCoupon couponAvailableService.getCouponsAvailable num:{};end:{}"
,
j
,
JSON
.
toJSONString
(
couponsAvailable
));
//
ApiLog.debug("availableCoupon couponAvailableService.getCouponsAvailable num:{};end:{}", j, JSON.toJSONString(couponsAvailable));
if
(
Objects
.
equals
(
String
.
valueOf
(
couponsAvailable
.
getResult
()),
ResponseResult
.
SUCCESS
.
getCode
())
//
if (Objects.equals(String.valueOf(couponsAvailable.getResult()), ResponseResult.SUCCESS.getCode())
&&
CollectionUtils
.
isNotEmpty
(
couponsAvailable
.
getCouponStateList
()))
{
//
&& CollectionUtils.isNotEmpty(couponsAvailable.getCouponStateList())) {
couponStateList
.
addAll
(
couponsAvailable
.
getCouponStateList
());
//
couponStateList.addAll(couponsAvailable.getCouponStateList());
}
//
}
}
//
}
return
couponStateList
;
//
return couponStateList;
}
//
}
@Override
@Override
public
GetCouponBarCodeResponseVo
getCouponBarCode
(
String
couponCode
)
{
public
GetCouponBarCodeResponseVo
getCouponBarCode
(
String
couponCode
)
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
View file @
b162d6bf
...
@@ -424,6 +424,7 @@ public class CouponDiscountCalculation {
...
@@ -424,6 +424,7 @@ public class CouponDiscountCalculation {
couponAvailableReqVo
.
setTotalAmount
(
Integer
.
valueOf
(
totalAmount
+
""
));
couponAvailableReqVo
.
setTotalAmount
(
Integer
.
valueOf
(
totalAmount
+
""
));
couponAvailableReqVo
.
setProductList
(
productList
);
couponAvailableReqVo
.
setProductList
(
productList
);
couponAvailableReqVo
.
setChannelCodeList
(
commonService
.
getOrgCodes
(
partnerId
,
storeId
));
couponAvailableReqVo
.
setChannelCodeList
(
commonService
.
getOrgCodes
(
partnerId
,
storeId
));
// couponAvailableReqVo.setChannelIdList(commonService.getOrgIdsForCoupon(partnerId, storeId));
couponAvailableReqVo
.
setStationId
(
"999"
);
couponAvailableReqVo
.
setStationId
(
"999"
);
couponAvailableReqVo
.
setOperatorId
(
"999"
);
couponAvailableReqVo
.
setOperatorId
(
"999"
);
// 构建计算SDK
// 构建计算SDK
...
@@ -462,6 +463,9 @@ public class CouponDiscountCalculation {
...
@@ -462,6 +463,9 @@ public class CouponDiscountCalculation {
res
.
setMerchantId
(
requestVo
.
getPartnerId
());
res
.
setMerchantId
(
requestVo
.
getPartnerId
());
res
.
setStoreId
(
requestVo
.
getStoreId
());
res
.
setStoreId
(
requestVo
.
getStoreId
());
res
.
setChannelIdList
(
commonService
.
getOrgCodes
(
requestVo
.
getPartnerId
(),
requestVo
.
getStoreId
()));
res
.
setChannelIdList
(
commonService
.
getOrgCodes
(
requestVo
.
getPartnerId
(),
requestVo
.
getStoreId
()));
// res.setChannelIdList(commonService.getOrgIdsForCoupon(requestVo.getPartnerId(), requestVo.getStoreId()));
// res.setChannelCodeList(commonService.getOrgCodes(requestVo.getPartnerId(), requestVo.getStoreId()));
res
.
setCouponCodes
(
couponCodes
);
res
.
setCouponCodes
(
couponCodes
);
List
<
CouponProductVo
>
calculAmountProductList
=
new
ArrayList
<>();
List
<
CouponProductVo
>
calculAmountProductList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
))
{
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
))
{
...
...
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