防止电费大于总金额,服务费出现负数
This commit is contained in:
parent
67466d5ba0
commit
37a47ad193
@ -308,8 +308,14 @@ public class XhpcPileOrderController extends BaseController {
|
||||
powerPrice=powerPrice.add(multiply);
|
||||
}
|
||||
powerPrice =powerPrice.setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
//总服务费
|
||||
BigDecimal servicePrice = money.subtract(powerPrice);
|
||||
//防止出现负数
|
||||
if(powerPrice.compareTo(money)>0){
|
||||
powerPrice =money;
|
||||
servicePrice = money.subtract(powerPrice);
|
||||
}
|
||||
//剩余的电费
|
||||
BigDecimal surplusPowerPrice = powerPrice;
|
||||
//剩余的服务费
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user