Commit e78b1b1b authored by zhangfeng's avatar zhangfeng

订单V值规则计算积分修改

parent 2c427a30
......@@ -290,19 +290,19 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
* @return
*/
private Integer computeScoreCount(BigDecimal weightOrVolume, List<ScoreRuleOrderVExtraVO.OrderVRule> orderVRules) {
Integer scoreCount = 0;
int w = weightOrVolume.setScale(0, RoundingMode.HALF_UP).intValue();
if (orderVRules.isEmpty()) {
return 0;
}
int wOrV = weightOrVolume.setScale(0, RoundingMode.HALF_UP).intValue();
ScoreRuleOrderVExtraVO.OrderVRule lastRule = orderVRules.get(orderVRules.size() - 1);
if (w >= lastRule.getHigh()) {
scoreCount = lastRule.getScore();
if (wOrV >= lastRule.getHigh()) {
return lastRule.getScore();
}
for (int i = orderVRules.size() - 1; i >= 0; i--) {
ScoreRuleOrderVExtraVO.OrderVRule orderVRule = orderVRules.get(i);
if (orderVRule.getLow() <= w && orderVRule.getHigh() >= w) {
scoreCount = orderVRule.getScore();
break;
for (ScoreRuleOrderVExtraVO.OrderVRule rule : orderVRules) {
if (rule.getLow() <= wOrV && wOrV < rule.getHigh()) {
return rule.getScore();
}
}
return scoreCount;
return 0;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment