|
@@ -2647,6 +2647,8 @@ public class OrderServiceImpl implements OrderService {
|
|
* 根据门店id 和时间查询积分赠送规则
|
|
* 根据门店id 和时间查询积分赠送规则
|
|
*/
|
|
*/
|
|
List<PointsRulesAndDetailVO> pointsRulesAndDetailVOList= mall2PointsRulesService.queryListByTime(new Date(), store.getId().toString());
|
|
List<PointsRulesAndDetailVO> pointsRulesAndDetailVOList= mall2PointsRulesService.queryListByTime(new Date(), store.getId().toString());
|
|
|
|
+ // 将此商品列表信息分组 key:sku 值:购买数量
|
|
|
|
+ Map<String, Integer> queryGoodsVOListMap = queryGoodsVOList.stream().collect(Collectors.toMap(QueryGoodsVO::getSku, QueryGoodsVO::getSellVolume, (k1, k2) -> k2));
|
|
|
|
|
|
// 商品map,key===>sku value===>金额
|
|
// 商品map,key===>sku value===>金额
|
|
Map<String, BigDecimal> goodsMap = goodsEntities.stream().collect(Collectors.toMap(GoodsEntity::getSku, GoodsEntity::getActualPaymentAmount, (k1, k2) -> k2));
|
|
Map<String, BigDecimal> goodsMap = goodsEntities.stream().collect(Collectors.toMap(GoodsEntity::getSku, GoodsEntity::getActualPaymentAmount, (k1, k2) -> k2));
|
|
@@ -2681,7 +2683,7 @@ public class OrderServiceImpl implements OrderService {
|
|
// 商品积分生成规则包含这个sku
|
|
// 商品积分生成规则包含这个sku
|
|
// 订单中该sku的总金额
|
|
// 订单中该sku的总金额
|
|
BigDecimal money = goodsMap.get(pointsDetailNameId);
|
|
BigDecimal money = goodsMap.get(pointsDetailNameId);
|
|
- GoodsEntity goodsEntity = goodsDataMap.get(pointsDetailNameId);
|
|
|
|
|
|
+ Integer number = queryGoodsVOListMap.get(pointsDetailNameId);
|
|
OrderGiftScoreRulesVo orderGiftScoreRulesVo = new OrderGiftScoreRulesVo();
|
|
OrderGiftScoreRulesVo orderGiftScoreRulesVo = new OrderGiftScoreRulesVo();
|
|
orderGiftScoreRulesVo.setGenerateType(Constants.MemberScoreRulesEnum.TWO.getCode());
|
|
orderGiftScoreRulesVo.setGenerateType(Constants.MemberScoreRulesEnum.TWO.getCode());
|
|
BigDecimal bigDecimal = new BigDecimal(0);
|
|
BigDecimal bigDecimal = new BigDecimal(0);
|
|
@@ -2700,7 +2702,7 @@ public class OrderServiceImpl implements OrderService {
|
|
}
|
|
}
|
|
// 在这里计算赠送积分,并放入
|
|
// 在这里计算赠送积分,并放入
|
|
// 判断此sku是否参加活动 并计算活动积分
|
|
// 判断此sku是否参加活动 并计算活动积分
|
|
- getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, pointsDetailNameId, orderGiftScoreRulesVo,goodsEntity);
|
|
|
|
|
|
+ getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, pointsDetailNameId, orderGiftScoreRulesVo,number);
|
|
giftGoodsScoreDetailMap.put(pointsDetailNameId, orderGiftScoreRulesVo);
|
|
giftGoodsScoreDetailMap.put(pointsDetailNameId, orderGiftScoreRulesVo);
|
|
goodsDataMap.remove(pointsDetailNameId);
|
|
goodsDataMap.remove(pointsDetailNameId);
|
|
}
|
|
}
|
|
@@ -2713,6 +2715,7 @@ public class OrderServiceImpl implements OrderService {
|
|
// 商品类别
|
|
// 商品类别
|
|
Integer categoryId = goodsEntity.getCategoryId();
|
|
Integer categoryId = goodsEntity.getCategoryId();
|
|
String sku = goodsEntity.getSku();
|
|
String sku = goodsEntity.getSku();
|
|
|
|
+ Integer number = queryGoodsVOListMap.get(sku);
|
|
OrderGiftScoreRulesVo orderGiftScoreRulesVo = new OrderGiftScoreRulesVo();
|
|
OrderGiftScoreRulesVo orderGiftScoreRulesVo = new OrderGiftScoreRulesVo();
|
|
orderGiftScoreRulesVo.setGenerateType(Constants.MemberScoreRulesEnum.ONE.getCode());
|
|
orderGiftScoreRulesVo.setGenerateType(Constants.MemberScoreRulesEnum.ONE.getCode());
|
|
if (categorySet.contains(categoryId)) {
|
|
if (categorySet.contains(categoryId)) {
|
|
@@ -2734,7 +2737,7 @@ public class OrderServiceImpl implements OrderService {
|
|
orderGiftScoreRulesVo.setGenerateRatio(BigDecimal.ZERO);
|
|
orderGiftScoreRulesVo.setGenerateRatio(BigDecimal.ZERO);
|
|
}
|
|
}
|
|
// 判断此sku是否参加活动 并计算活动积分
|
|
// 判断此sku是否参加活动 并计算活动积分
|
|
- getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, sku, orderGiftScoreRulesVo, goodsEntity);
|
|
|
|
|
|
+ getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, sku, orderGiftScoreRulesVo, number);
|
|
giftGoodsScoreDetailMap.put(sku, orderGiftScoreRulesVo);
|
|
giftGoodsScoreDetailMap.put(sku, orderGiftScoreRulesVo);
|
|
goodsDataMap.remove(sku);
|
|
goodsDataMap.remove(sku);
|
|
}
|
|
}
|
|
@@ -2748,6 +2751,7 @@ public class OrderServiceImpl implements OrderService {
|
|
for(GoodsEntity goodsEntity : goodsEntityCollection){
|
|
for(GoodsEntity goodsEntity : goodsEntityCollection){
|
|
Integer storeId1 = goodsEntity.getStoreId();
|
|
Integer storeId1 = goodsEntity.getStoreId();
|
|
String sku = goodsEntity.getSku();
|
|
String sku = goodsEntity.getSku();
|
|
|
|
+ Integer number = queryGoodsVOListMap.get(sku);
|
|
OrderGiftScoreRulesVo orderGiftScoreRulesVo = new OrderGiftScoreRulesVo();
|
|
OrderGiftScoreRulesVo orderGiftScoreRulesVo = new OrderGiftScoreRulesVo();
|
|
orderGiftScoreRulesVo.setGenerateType(Constants.MemberScoreRulesEnum.ZERO.getCode());
|
|
orderGiftScoreRulesVo.setGenerateType(Constants.MemberScoreRulesEnum.ZERO.getCode());
|
|
BigDecimal bigDecimal = new BigDecimal(0);
|
|
BigDecimal bigDecimal = new BigDecimal(0);
|
|
@@ -2770,7 +2774,7 @@ public class OrderServiceImpl implements OrderService {
|
|
}
|
|
}
|
|
|
|
|
|
// 判断此sku是否参加活动 并计算活动积分
|
|
// 判断此sku是否参加活动 并计算活动积分
|
|
- getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, sku, orderGiftScoreRulesVo,goodsEntity);
|
|
|
|
|
|
+ getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, sku, orderGiftScoreRulesVo,number);
|
|
giftGoodsScoreDetailMap.put(sku, orderGiftScoreRulesVo);
|
|
giftGoodsScoreDetailMap.put(sku, orderGiftScoreRulesVo);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2897,14 +2901,14 @@ public class OrderServiceImpl implements OrderService {
|
|
* @param sku
|
|
* @param sku
|
|
*/
|
|
*/
|
|
private void getGiftScore(AtomicReference<Integer> activityGiftScore, BigDecimal baseScore
|
|
private void getGiftScore(AtomicReference<Integer> activityGiftScore, BigDecimal baseScore
|
|
- , Map<String, MkActivitiesPresentIntegralEntity> mkActivitiesEntityMap, String sku, OrderGiftScoreRulesVo orderGiftScoreRulesVo,GoodsEntity goodsEntity) {
|
|
|
|
|
|
+ , Map<String, MkActivitiesPresentIntegralEntity> mkActivitiesEntityMap, String sku, OrderGiftScoreRulesVo orderGiftScoreRulesVo,Integer number) {
|
|
if(mkActivitiesEntityMap.containsKey(sku)){
|
|
if(mkActivitiesEntityMap.containsKey(sku)){
|
|
// 存在表示它参加赠送积分活动
|
|
// 存在表示它参加赠送积分活动
|
|
MkActivitiesPresentIntegralEntity mkActivitiesPresentIntegralEntity = mkActivitiesEntityMap.get(sku);
|
|
MkActivitiesPresentIntegralEntity mkActivitiesPresentIntegralEntity = mkActivitiesEntityMap.get(sku);
|
|
// 计算活动积分
|
|
// 计算活动积分
|
|
if(ActivityGiveTypeEnum.FIXED_VALUE.getCode().equals(mkActivitiesPresentIntegralEntity.getActivityGiveType())){
|
|
if(ActivityGiveTypeEnum.FIXED_VALUE.getCode().equals(mkActivitiesPresentIntegralEntity.getActivityGiveType())){
|
|
// 固定值 那赠送积分就是固定值
|
|
// 固定值 那赠送积分就是固定值
|
|
- BigDecimal giftScoreTmp = mkActivitiesPresentIntegralEntity.getActivityGiveNum().multiply(new BigDecimal(goodsEntity.getGoodsNumber()));
|
|
|
|
|
|
+ BigDecimal giftScoreTmp = mkActivitiesPresentIntegralEntity.getActivityGiveNum().multiply(new BigDecimal(number));
|
|
// 此sku赠送的积分加上之前赠送的积分 算出来订单赠送总分
|
|
// 此sku赠送的积分加上之前赠送的积分 算出来订单赠送总分
|
|
int giftScore = giftScoreTmp.add(new BigDecimal(activityGiftScore.get())).intValue();
|
|
int giftScore = giftScoreTmp.add(new BigDecimal(activityGiftScore.get())).intValue();
|
|
activityGiftScore.set(giftScore);
|
|
activityGiftScore.set(giftScore);
|