...
|
...
|
@@ -22,9 +22,7 @@ public class SellerOrderComputeHandler { |
|
|
BigDecimal bankTransferfee = calBankTransferFee(prdPrice);
|
|
|
PlatformFeeDto platformFeeDto = calPlatformFee();
|
|
|
BigDecimal income = calIncome(prdPrice, platformFeeDto.getTotal(), bankTransferfee);
|
|
|
|
|
|
//set
|
|
|
|
|
|
SellerOrderComputeResult result = new SellerOrderComputeResult();
|
|
|
result.setEarnestMoney(earnestMoney);
|
|
|
result.setBankTransferfee(bankTransferfee);
|
...
|
...
|
@@ -35,13 +33,18 @@ public class SellerOrderComputeHandler { |
|
|
|
|
|
private BigDecimal calBankTransferFee(BigDecimal prdPrice){
|
|
|
//银行转账费(0.65%+¥1.00)
|
|
|
return prdPrice.multiply(new BigDecimal(0.0065)).add(new BigDecimal(1));
|
|
|
return halfUp(prdPrice.multiply(new BigDecimal(0.0065)).add(new BigDecimal(1)));
|
|
|
}
|
|
|
|
|
|
private BigDecimal calIncome(BigDecimal prdPrice,BigDecimal platformFee,BigDecimal bankTransferfee){
|
|
|
return prdPrice.subtract(platformFee).subtract(bankTransferfee);
|
|
|
return halfUp(prdPrice.subtract(platformFee).subtract(bankTransferfee));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 通过相加得出的数据
|
|
|
* TODO 服务费参与计算后需要考虑精度问题(四舍五入)
|
|
|
* @return
|
|
|
*/
|
|
|
private PlatformFeeDto calPlatformFee(){
|
|
|
|
|
|
BigDecimal appraiseFee = new BigDecimal(10);;
|
...
|
...
|
@@ -57,19 +60,25 @@ public class SellerOrderComputeHandler { |
|
|
return platformFee;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 相对独立 不涉及到计算其他费用
|
|
|
* @param prdPrice
|
|
|
* @return
|
|
|
*/
|
|
|
private BigDecimal calEarnestMoney(BigDecimal prdPrice){
|
|
|
BigDecimal real = prdPrice.multiply(new BigDecimal(0.05));
|
|
|
BigDecimal real = halfUp(prdPrice.multiply(new BigDecimal(0.05)));
|
|
|
final BigDecimal min = EARNESTMONEYRANGE[0];
|
|
|
final BigDecimal max = EARNESTMONEYRANGE[1];
|
|
|
if(real.subtract(min).doubleValue() < 0D){
|
|
|
return min;
|
|
|
}
|
|
|
|
|
|
if (real.subtract(max).doubleValue() > 0D){
|
|
|
return max;
|
|
|
}
|
|
|
|
|
|
return real;
|
|
|
}
|
|
|
|
|
|
private BigDecimal halfUp(BigDecimal fee){
|
|
|
return fee.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
} |
...
|
...
|
|