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
f6e2bd05
Commit
f6e2bd05
authored
Nov 04, 2021
by
查志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复新算价均摊赠品属性未显示问题
parent
c4f18bc2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
57 deletions
+79
-57
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/product/info/ProductAttributeGroupListBean.java
+24
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/BuyAndGiftsPromotionService.java
+1
-2
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingEquallyService.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/GiftSharingService.java
+52
-53
shopping-cart-application-service/src/main/java/cn/freemud/service/product/ProductInfoManager.java
+1
-1
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/product/info/ProductAttributeGroupListBean.java
View file @
f6e2bd05
...
@@ -7,8 +7,32 @@ import java.util.List;
...
@@ -7,8 +7,32 @@ import java.util.List;
@Data
@Data
public
class
ProductAttributeGroupListBean
{
public
class
ProductAttributeGroupListBean
{
/**
* 名称
*/
private
String
attributeName
;
private
String
attributeName
;
/**
* 别名
*/
private
String
foreignAttributeName
;
/**
* 属性类型
*/
private
Integer
attributeType
;
private
Integer
attributeType
;
/**
* 三方编号
*/
private
String
customerCode
;
private
Integer
maxNumber
;
private
Integer
minNumber
;
private
Integer
must
;
private
String
options
;
/**
* 排序,越小越靠前
*/
private
Integer
sequence
;
private
List
<
AttributeValueBean
>
attributeValues
;
private
List
<
AttributeValueBean
>
attributeValues
;
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/BuyAndGiftsPromotionService.java
View file @
f6e2bd05
...
@@ -218,9 +218,8 @@ public class BuyAndGiftsPromotionService implements IPromotionService {
...
@@ -218,9 +218,8 @@ public class BuyAndGiftsPromotionService implements IPromotionService {
List
<
CartGoods
>
result
=
new
ArrayList
<>();
List
<
CartGoods
>
result
=
new
ArrayList
<>();
result
.
add
(
cartGoods
);
result
.
add
(
cartGoods
);
long
count
=
cartGoodsList
.
stream
().
filter
(
c
->
c
.
getSpuId
().
equals
(
cartGoods
.
getSpuId
())).
count
();
//购物车内存在同类
//购物车内存在同类
if
(
count
>
0
)
{
if
(
null
!=
cartGoodsList
&&
cartGoodsList
.
stream
().
filter
(
c
->
c
.
getSpuId
().
equals
(
cartGoods
.
getSpuId
())).
count
()
>
0
)
{
CartGoods
find
=
cartGoodsList
.
stream
().
filter
(
c
->
c
.
getCartGoodsUid
().
equals
(
cartGoods
.
getOriginalGoodsUid
())).
findFirst
().
orElse
(
null
);
CartGoods
find
=
cartGoodsList
.
stream
().
filter
(
c
->
c
.
getCartGoodsUid
().
equals
(
cartGoods
.
getOriginalGoodsUid
())).
findFirst
().
orElse
(
null
);
if
(
null
==
find
)
{
if
(
null
==
find
)
{
find
=
cartGoodsList
.
stream
().
filter
(
c
->
c
.
getSpuId
().
equals
(
cartGoods
.
getSpuId
())).
findFirst
().
get
();
find
=
cartGoodsList
.
stream
().
filter
(
c
->
c
.
getSpuId
().
equals
(
cartGoods
.
getSpuId
())).
findFirst
().
get
();
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingEquallyService.java
View file @
f6e2bd05
...
@@ -128,7 +128,7 @@ public class CalculationSharingEquallyService {
...
@@ -128,7 +128,7 @@ public class CalculationSharingEquallyService {
/**
/**
* 赠品
* 赠品
*/
*/
giftSharingService
.
equally
(
discountResult
,
cartGoodsDetailDtoList
,
activityQueryDto
,
menuType
);
giftSharingService
.
equally
(
discountResult
,
cartGoodsDetailDtoList
,
activityQueryDto
,
menuType
,
userLoginInfoDto
);
/**
/**
* 加价购商品
* 加价购商品
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/GiftSharingService.java
View file @
f6e2bd05
package
cn
.
freemud
.
service
.
impl
.
calculate
.
promotion
;
package
cn
.
freemud
.
service
.
impl
.
calculate
.
promotion
;
import
cn.freemud.entities.dto.
activity.ActivityDiscounts
Dto
;
import
cn.freemud.entities.dto.
UserLoginInfo
Dto
;
import
cn.freemud.entities.dto.activity.ActivityQueryDto
;
import
cn.freemud.entities.dto.activity.ActivityQueryDto
;
import
cn.freemud.entities.dto.calculate.CalculationDiscountResult
;
import
cn.freemud.entities.dto.calculate.CalculationDiscountResult
;
import
cn.freemud.entities.dto.calculate.Goods
;
import
cn.freemud.entities.dto.calculate.Goods
;
...
@@ -15,9 +15,10 @@ import cn.freemud.enums.ResponseResult;
...
@@ -15,9 +15,10 @@ import cn.freemud.enums.ResponseResult;
import
cn.freemud.interceptor.ServiceException
;
import
cn.freemud.interceptor.ServiceException
;
import
cn.freemud.service.active.ActiveFactory
;
import
cn.freemud.service.active.ActiveFactory
;
import
cn.freemud.service.active.ActiveService
;
import
cn.freemud.service.active.ActiveService
;
import
cn.freemud.service.impl.AssortmentSdkService
;
import
cn.freemud.service.cache.GiftCacheManager
;
import
cn.freemud.service.impl.BuyAndGiftsPromotionService
;
import
cn.freemud.service.impl.calculate.CalculationCommonService
;
import
cn.freemud.service.product.ProductInfoManager
;
import
cn.freemud.service.product.ProductInfoManager
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -26,6 +27,7 @@ import org.springframework.stereotype.Service;
...
@@ -26,6 +27,7 @@ import org.springframework.stereotype.Service;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -43,12 +45,13 @@ import java.util.stream.Collectors;
...
@@ -43,12 +45,13 @@ import java.util.stream.Collectors;
public
class
GiftSharingService
{
public
class
GiftSharingService
{
@Autowired
@Autowired
private
AssortmentSdkService
assortmentSdk
Service
;
private
BuyAndGiftsPromotionService
buyAndGiftsPromotion
Service
;
@Autowired
@Autowired
private
ShoppingCartBaseServiceImpl
shoppingCartBaseService
;
private
GiftCacheManager
giftCacheManager
;
@Autowired
@Autowired
private
ProductInfoManager
productInfoManager
;
private
ProductInfoManager
productInfoManager
;
@Autowired
private
CalculationCommonService
calculationCommonService
;
@Autowired
@Autowired
private
ActiveFactory
activeFactory
;
private
ActiveFactory
activeFactory
;
...
@@ -153,12 +156,13 @@ public class GiftSharingService {
...
@@ -153,12 +156,13 @@ public class GiftSharingService {
public
void
equally
(
CalculationDiscountResult
discountResult
public
void
equally
(
CalculationDiscountResult
discountResult
,
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
cartGoodsDetailDtoList
,
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
cartGoodsDetailDtoList
,
ActivityQueryDto
activityQueryDto
,
ActivityQueryDto
activityQueryDto
,
String
menuType
)
{
,
String
menuType
,
UserLoginInfoDto
userLoginInfoDto
)
{
if
(
discountResult
==
null
||
CollectionUtils
.
isEmpty
(
discountResult
.
getGoods
()))
{
if
(
discountResult
==
null
||
CollectionUtils
.
isEmpty
(
discountResult
.
getGoods
()))
{
return
;
return
;
}
}
List
<
ProductBean
>
beanDTOList
=
this
.
drawGiftInfo
(
discountResult
,
activityQueryDto
,
menuType
);
List
<
ProductBean
>
beanDTOList
=
this
.
drawGiftInfo
(
discountResult
,
activityQueryDto
,
menuType
);
this
.
doCartGoodsDetailDto
(
discountResult
,
cartGoodsDetailDtoList
,
beanDTOList
);
this
.
doCartGoodsDetailDto
(
discountResult
,
cartGoodsDetailDtoList
,
activityQueryDto
,
beanDTOList
,
userLoginInfoDto
);
}
}
/**
/**
...
@@ -170,57 +174,52 @@ public class GiftSharingService {
...
@@ -170,57 +174,52 @@ public class GiftSharingService {
*/
*/
private
void
doCartGoodsDetailDto
(
CalculationDiscountResult
discountResult
private
void
doCartGoodsDetailDto
(
CalculationDiscountResult
discountResult
,
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
cartGoodsDetailDtoList
,
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
cartGoodsDetailDtoList
,
List
<
ProductBean
>
products
)
{
,
ActivityQueryDto
activityQueryDto
,
List
<
ProductBean
>
products
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
manyCartGoodsDetailDto
=
new
ArrayList
<>();
,
UserLoginInfoDto
userLoginInfoDto
)
{
if
(
CollectionUtils
.
isEmpty
(
products
))
cartGoodsDetailDtoList
.
addAll
(
manyCartGoodsDetailDto
);
else
{
if
(
CollectionUtils
.
isNotEmpty
(
products
))
{
List
<
CartGoods
>
list
=
new
ArrayList
<>();
Map
<
String
,
Goods
>
discountForGift
=
this
.
getDiscountForGift
(
discountResult
);
Map
<
String
,
Goods
>
discountForGift
=
this
.
getDiscountForGift
(
discountResult
);
for
(
ProductBean
product
:
products
)
{
for
(
ProductBean
product
:
products
)
{
String
k
=
product
.
getPid
();
Goods
goods
=
discountForGift
.
get
(
product
.
getPid
());
Goods
goods
=
discountForGift
.
get
(
k
);
GoodsDiscount
discount
=
this
.
discountInfo
(
goods
);
GoodsDiscount
discount
=
this
.
discountInfo
(
goods
);
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
=
new
ShoppingCartGoodsDto
.
CartGoodsDetailDto
();
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
=
new
ShoppingCartGoodsDto
.
CartGoodsDetailDto
();
cartGoodsDetailDto
.
setOriginalGoodsUid
(
goods
.
getOriginalGoodsUid
());
CartGoods
cartGood
=
new
CartGoods
();
cartGoodsDetailDto
.
setCartGoodsUid
(
goods
.
getCartGoodsUid
());
cartGood
.
setGoodsId
(
goods
.
getGoodsId
());
cartGoodsDetailDto
.
setTaxId
(
product
.
getTaxId
());
cartGood
.
setGoodsType
(
1
);
cartGoodsDetailDto
.
setTax
(
product
.
getTax
());
cartGood
.
setSpuId
(
Objects
.
equals
(
product
.
getIsSkuProduct
(),
1
)
?
product
.
getSpecProductId
()
:
goods
.
getGoodsId
());
cartGoodsDetailDto
.
setSpuId
(
product
.
getPid
());
cartGood
.
setSkuId
(
goods
.
getGoodsId
());
cartGoodsDetailDto
.
setSpuName
(
product
.
getName
());
cartGood
.
setOriginalPrice
(
product
.
getFinalPrice
());
cartGoodsDetailDto
.
setSkuId
(
goods
.
getGoodsId
());
cartGood
.
setPackPrice
(
product
.
getPackPrice
());
cartGoodsDetailDto
.
setSkuName
(
product
.
getName
());
cartGood
.
setOriginalAmount
(
goods
.
getOriginalPrice
()
*
goods
.
getGoodsQuantity
());
cartGoodsDetailDto
.
setIsSendGoods
(
ObjectUtils
.
equals
(
1
,
goods
.
getCartGoodType
()));
cartGood
.
setAmount
(
goods
.
getRealAmount
());
cartGoodsDetailDto
.
setSalePrice
(
product
.
getOriginalPrice
());
cartGood
.
setName
(
product
.
getName
());
cartGoodsDetailDto
.
setPicture
(
product
.
getPicture
());
cartGood
.
setSpuName
(
product
.
getName
());
cartGoodsDetailDto
.
setQty
(
goods
.
getGoodsQuantity
());
cartGood
.
setCategoryName
(
product
.
getName
());
cartGoodsDetailDto
.
setActivityType
(
discount
.
getType
());
cartGood
.
setPic
(
product
.
getPicture
());
cartGoodsDetailDto
.
setNodeId
(
discount
.
getActivityCode
());
cartGood
.
setSkuName
(
product
.
getName
());
cartGoodsDetailDto
.
setCategoryName
(
product
.
getCategoryName
());
cartGood
.
setActivityType
(
discount
.
getType
());
cartGoodsDetailDto
.
setStockLimit
(
ObjectUtils
.
equals
(
1
,
product
.
getStockLimit
()));
cartGood
.
setActivityCode
(
discount
.
getActivityCode
());
cartGoodsDetailDto
.
setProductCode
(
product
.
getCustomerCode
());
cartGood
.
setStockLimit
(
ObjectUtils
.
equals
(
1
,
product
.
getStockLimit
()));
cartGoodsDetailDto
.
setCustomerCode
(
product
.
getCustomerCode
());
cartGood
.
setCustomerCode
(
product
.
getCustomerCode
());
cartGoodsDetailDto
.
setWeight
(
product
.
getWeight
());
cartGood
.
setUnit
(
product
.
getUnit
());
cartGoodsDetailDto
.
setUnit
(
product
.
getUnit
());
cartGood
.
setWeight
(
product
.
getWeight
());
cartGoodsDetailDto
.
setActivityDiscountsDtos
(
new
ArrayList
<>());
cartGood
.
setQty
(
goods
.
getGoodsQuantity
());
cartGoodsDetailDto
.
setClassificationId
(
product
.
getCategory
());
cartGood
.
setClassificationId
(
product
.
getCategory
());
cartGoodsDetailDto
.
setClassificationName
(
product
.
getCategoryName
());
cartGood
.
setClassificationName
(
product
.
getCategoryName
());
cartGoodsDetailDto
.
setOriginalPrice
(
product
.
getOriginalPrice
());
// nodeId标识activeCode,用于计算均摊时每个商品在每个活动上均摊金额
cartGoodsDetailDto
.
setTotalDiscountAmount
(
goods
.
getDiscountAmount
().
intValue
());
cartGood
.
setNodeId
(
discount
.
getActivityCode
());
List
<
ActivityDiscountsDto
>
activityDto
=
new
ArrayList
<>();
list
.
addAll
(
buyAndGiftsPromotionService
.
setGiftExtra
(
cartGood
,
product
,
null
));
ActivityDiscountsDto
dto
=
new
ActivityDiscountsDto
();
dto
.
setActivityCode
(
discount
.
getActivityCode
());
dto
.
setActivityName
(
discount
.
getActivityName
());
dto
.
setActivityType
(
discount
.
getType
());
dto
.
setDiscountAmount
(
discount
.
getDiscount
().
intValue
());
dto
.
setActualActivityGoodsNumber
(
discount
.
getActualGoodsNumber
());
activityDto
.
add
(
dto
);
cartGoodsDetailDto
.
setActivityDiscountsDtos
(
activityDto
);
cartGoodsDetailDto
.
setOriginalProductType
(
product
.
getType
());
manyCartGoodsDetailDto
.
add
(
cartGoodsDetailDto
);
}
}
cartGoodsDetailDtoList
.
addAll
(
manyCartGoodsDetailDto
);
// 因为有涉及到用户选择的属性,存入redis
list
=
giftCacheManager
.
resetGiftCache
(
list
,
null
,
activityQueryDto
.
getPartnerId
(),
activityQueryDto
.
getStoreId
(),
userLoginInfoDto
.
getMemberId
());
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
detail
=
new
ArrayList
<>();
list
.
forEach
(
c
->
{
Goods
goods
=
discountForGift
.
get
(
c
.
getGoodsId
());
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
=
calculationCommonService
.
convertCartGoods2DetailGoodsList
(
goods
,
c
,
activityQueryDto
.
getPartnerId
());
cartGoodsDetailDtoList
.
add
(
cartGoodsDetailDto
);
});
}
}
}
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/product/ProductInfoManager.java
View file @
f6e2bd05
...
@@ -73,7 +73,7 @@ public class ProductInfoManager {
...
@@ -73,7 +73,7 @@ public class ProductInfoManager {
query
.
setShopId
(
storeCode
);
query
.
setShopId
(
storeCode
);
query
.
setProductInfoType
(
2
);
query
.
setProductInfoType
(
2
);
query
.
setProductIds
(
goodsIdList
);
query
.
setProductIds
(
goodsIdList
);
query
.
setChannel
(
menuType
);
query
.
setChannel
(
StringUtils
.
isBlank
(
menuType
)
?
"saas"
:
menuType
);
query
.
setAutoFillSkuAttr
(
querySkuAttr
);
query
.
setAutoFillSkuAttr
(
querySkuAttr
);
ProductInfosDto
response
=
productClient
.
listProductInfos
(
query
);
ProductInfosDto
response
=
productClient
.
listProductInfos
(
query
);
if
(
null
==
response
||
!
Objects
.
equals
(
ResponseCodeConstant
.
RESPONSE_SUCCESS
,
response
.
getErrcode
())
||
null
==
response
.
getData
())
{
if
(
null
==
response
||
!
Objects
.
equals
(
ResponseCodeConstant
.
RESPONSE_SUCCESS
,
response
.
getErrcode
())
||
null
==
response
.
getData
())
{
...
...
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