|
@@ -562,7 +562,9 @@ public class OrderServiceImpl implements OrderService {
|
|
|
|
|
|
|
|
|
|
GoodsEntity goodsEntity = goodsService.queryObject(orderGoods.getGoodsId());
|
|
GoodsEntity goodsEntity = goodsService.queryObject(orderGoods.getGoodsId());
|
|
- BigDecimal goodsTax = CalculateTax.calculateFinalTax(goodsEntity, orderGoods.getRetailPrice(), goodsService).setScale(3, RoundingMode.HALF_UP);
|
|
|
|
|
|
+ // 计算算税金额 实际支付价 + 积分抵扣金额
|
|
|
|
+ BigDecimal price = orderGoods.getDeductionPrice().add(orderGoods.getActualPaymentAmount());
|
|
|
|
+ BigDecimal goodsTax = CalculateTax.calculateFinalTax(goodsEntity, price, goodsService).setScale(3, RoundingMode.HALF_UP);
|
|
goodsTax = goodsTax.multiply(new BigDecimal(orderGoods.getNumber())).setScale(2, RoundingMode.HALF_UP);
|
|
goodsTax = goodsTax.multiply(new BigDecimal(orderGoods.getNumber())).setScale(2, RoundingMode.HALF_UP);
|
|
taxTotal = taxTotal.add(goodsTax).setScale(2, RoundingMode.HALF_UP);
|
|
taxTotal = taxTotal.add(goodsTax).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
@@ -2652,7 +2654,9 @@ public class OrderServiceImpl implements OrderService {
|
|
Map<String, GoodsEntity> goodsDataMap = goodsEntities.stream().collect(Collectors.toMap(GoodsEntity::getSku, goodsEntity -> goodsEntity, (k1, k2) -> k2));
|
|
Map<String, GoodsEntity> goodsDataMap = goodsEntities.stream().collect(Collectors.toMap(GoodsEntity::getSku, goodsEntity -> goodsEntity, (k1, k2) -> k2));
|
|
// 根据门店、时间和活动类型 查询参加积分赠送活动的sku,转换为map
|
|
// 根据门店、时间和活动类型 查询参加积分赠送活动的sku,转换为map
|
|
// ,sku为key,对象为值,判断sku是否在此之中,在则计算赠送积分算完
|
|
// ,sku为key,对象为值,判断sku是否在此之中,在则计算赠送积分算完
|
|
- List<MkActivitiesPresentIntegralEntity> mkActivitiesEntityList = mkActivitiesPresentIntegralService.querySkuByNow(store.getId().toString(), DateUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"), Constants.ActivityTopicEnum.ZSJF.getTopicCode());
|
|
|
|
|
|
+ List<MkActivitiesPresentIntegralEntity> mkActivitiesEntityList = mkActivitiesPresentIntegralService.querySkuByNow(store.getId().toString(), DateUtils.format(new Date()
|
|
|
|
+ , "yyyy-MM-dd HH:mm:ss")
|
|
|
|
+ , Constants.ActivityTopicEnum.ZSJF.getTopicCode());
|
|
Map<String, MkActivitiesPresentIntegralEntity> mkActivitiesEntityMap = new HashMap<>();
|
|
Map<String, MkActivitiesPresentIntegralEntity> mkActivitiesEntityMap = new HashMap<>();
|
|
if(!CollectionUtils.isEmpty(mkActivitiesEntityList) && mkActivitiesEntityList.size() > 0){
|
|
if(!CollectionUtils.isEmpty(mkActivitiesEntityList) && mkActivitiesEntityList.size() > 0){
|
|
// 不为空 则处理
|
|
// 不为空 则处理
|
|
@@ -2677,6 +2681,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);
|
|
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);
|
|
@@ -2695,7 +2700,7 @@ public class OrderServiceImpl implements OrderService {
|
|
}
|
|
}
|
|
// 在这里计算赠送积分,并放入
|
|
// 在这里计算赠送积分,并放入
|
|
// 判断此sku是否参加活动 并计算活动积分
|
|
// 判断此sku是否参加活动 并计算活动积分
|
|
- getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, pointsDetailNameId, orderGiftScoreRulesVo);
|
|
|
|
|
|
+ getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, pointsDetailNameId, orderGiftScoreRulesVo,goodsEntity);
|
|
giftGoodsScoreDetailMap.put(pointsDetailNameId, orderGiftScoreRulesVo);
|
|
giftGoodsScoreDetailMap.put(pointsDetailNameId, orderGiftScoreRulesVo);
|
|
goodsDataMap.remove(pointsDetailNameId);
|
|
goodsDataMap.remove(pointsDetailNameId);
|
|
}
|
|
}
|
|
@@ -2729,7 +2734,7 @@ public class OrderServiceImpl implements OrderService {
|
|
orderGiftScoreRulesVo.setGenerateRatio(BigDecimal.ZERO);
|
|
orderGiftScoreRulesVo.setGenerateRatio(BigDecimal.ZERO);
|
|
}
|
|
}
|
|
// 判断此sku是否参加活动 并计算活动积分
|
|
// 判断此sku是否参加活动 并计算活动积分
|
|
- getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, sku, orderGiftScoreRulesVo);
|
|
|
|
|
|
+ getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, sku, orderGiftScoreRulesVo, goodsEntity);
|
|
giftGoodsScoreDetailMap.put(sku, orderGiftScoreRulesVo);
|
|
giftGoodsScoreDetailMap.put(sku, orderGiftScoreRulesVo);
|
|
goodsDataMap.remove(sku);
|
|
goodsDataMap.remove(sku);
|
|
}
|
|
}
|
|
@@ -2765,7 +2770,7 @@ public class OrderServiceImpl implements OrderService {
|
|
}
|
|
}
|
|
|
|
|
|
// 判断此sku是否参加活动 并计算活动积分
|
|
// 判断此sku是否参加活动 并计算活动积分
|
|
- getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, sku, orderGiftScoreRulesVo);
|
|
|
|
|
|
+ getGiftScore(activityGiftScore, bigDecimal, mkActivitiesEntityMap, sku, orderGiftScoreRulesVo,goodsEntity);
|
|
giftGoodsScoreDetailMap.put(sku, orderGiftScoreRulesVo);
|
|
giftGoodsScoreDetailMap.put(sku, orderGiftScoreRulesVo);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2892,14 +2897,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) {
|
|
|
|
|
|
+ , Map<String, MkActivitiesPresentIntegralEntity> mkActivitiesEntityMap, String sku, OrderGiftScoreRulesVo orderGiftScoreRulesVo,GoodsEntity goodsEntity) {
|
|
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();
|
|
|
|
|
|
+ BigDecimal giftScoreTmp = mkActivitiesPresentIntegralEntity.getActivityGiveNum().multiply(new BigDecimal(goodsEntity.getGoodsNumber()));
|
|
// 此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);
|