forked from angelo/java-retail-app
## 平级收益价格按单商品处理;
This commit is contained in:
parent
147e28fbf6
commit
b9eb35f130
|
@ -38,6 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -1287,6 +1288,9 @@ public class BonusSettleRangeHandle extends BonusSettleHandle {
|
||||||
BigDecimal waresPrice = saOrderItems.getWaresPrice();
|
BigDecimal waresPrice = saOrderItems.getWaresPrice();
|
||||||
// 商品数量
|
// 商品数量
|
||||||
BigDecimal waresQuantityBig = new BigDecimal(saOrderItems.getWaresQuantity());
|
BigDecimal waresQuantityBig = new BigDecimal(saOrderItems.getWaresQuantity());
|
||||||
|
// 单个商品价格
|
||||||
|
BigDecimal waresOnePrice = waresPrice.divide(waresQuantityBig, 6, RoundingMode.FLOOR);
|
||||||
|
|
||||||
// 前一个会员等级
|
// 前一个会员等级
|
||||||
int beforeGradeValue = 0;
|
int beforeGradeValue = 0;
|
||||||
// 前一个会员等级的平级收益人数
|
// 前一个会员等级的平级收益人数
|
||||||
|
@ -1356,7 +1360,7 @@ public class BonusSettleRangeHandle extends BonusSettleHandle {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 平级收益(商品价格 * 千分之五) -- 6位小数,四舍五入
|
// 平级收益(商品价格 * 千分之五) -- 6位小数,四舍五入
|
||||||
sameBonusIncome = waresPrice.multiply(RetailConstants.SAME_RATIO).setScale(6, BigDecimal.ROUND_HALF_UP);
|
sameBonusIncome = waresOnePrice.multiply(RetailConstants.SAME_RATIO).setScale(6, BigDecimal.ROUND_HALF_UP).multiply(waresQuantityBig);
|
||||||
// 平级收益累计
|
// 平级收益累计
|
||||||
beforeSameBonus = beforeSameBonus.add(sameBonusIncome);
|
beforeSameBonus = beforeSameBonus.add(sameBonusIncome);
|
||||||
// 平级等级代数等级
|
// 平级等级代数等级
|
||||||
|
|
Loading…
Reference in New Issue