Authored by chenchao

add rate

package com.yohoufo.order.service.seller;
import com.alibaba.fastjson.JSONObject;
import com.yohoufo.order.model.dto.EarnestMoney;
import com.yohoufo.order.model.dto.ServiceFeeRate;
import org.springframework.stereotype.Component;
... ... @@ -18,16 +19,22 @@ public class SellerAdvanceOrderComputeHandler extends AbsSellerOrderComputeHandl
earnestMoney.setPrdSalePrice(prdPrice);
//TODO earnestMoney.rate 需要调整为动态可配
BigDecimal real = halfUp(prdPrice.multiply(new BigDecimal(0.08D)));
final BigDecimal rate = new BigDecimal(0.08D);
BigDecimal real = halfUp(prdPrice.multiply(rate));
final BigDecimal min = new BigDecimal(56);
final BigDecimal max = new BigDecimal(438);
real = calCrossWithThreshold(min, max, real);
earnestMoney.setMin(min);
earnestMoney.setMax(max);
earnestMoney.setRate(rate);
earnestMoney.setEarnestMoney(real);
return earnestMoney;
}
public static void main(String[] args) {
System.out.println(JSONObject.toJSONString(new EarnestMoney()));
}
@Override
protected ServiceFeeRate buildServiceFeeRate() {
ServiceFeeRate serviceFeeRate = orderDynamicConfig.getServiceFeeRate();
... ...