Authored by chenchao

fix goods service rate percentage

... ... @@ -7,8 +7,9 @@ import com.yohoufo.common.utils.PriceFormater;
import com.yohoufo.order.model.dto.EarnestMoney;
import com.yohoufo.order.model.dto.PlatformFeeDto;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.model.dto.ServiceFeeRate;
import com.yohoufo.order.service.proxy.ResourcesProxyService;
import org.apache.commons.lang3.StringUtils;
import com.yohoufo.order.utils.MathUtils;
import java.math.BigDecimal;
import java.util.Map;
... ... @@ -24,9 +25,6 @@ public final class SellerOrderConvertor {
BigDecimal earnestMoney = earnestMoneyDTO.getEarnestMoney();
PlatformFeeDto platformFeeDto = computeResult.getPlatformFee();
BigDecimal income = computeResult.getIncome();
//service tips
String serviceTipsDesc = null;
String serviceTipsSummary = null;
//
String payPersent = computeResult.getServiceFeeRate() != null ? computeResult.getServiceFeeRate().getPayChannelPercent() : "";
PlatformFee platformFeeWrapper = PlatformFee.builder()
... ... @@ -47,8 +45,6 @@ public final class SellerOrderConvertor {
.platformFee(platformFeeWrapper)
.bankTransferFee(buildSubtractFee(bankTransferFeeStr))
.income(incomeStr)
.serviceTipsDesc(serviceTipsDesc)
.serviceTipsSummary(serviceTipsSummary)
.build();
return computeBo;
... ... @@ -66,9 +62,12 @@ public final class SellerOrderConvertor {
String serviceTipsDesc = null;
String serviceTipsSummary = null;
//
String payPersent = computeResult.getServiceFeeRate() != null ? computeResult.getServiceFeeRate().getPayChannelPercent() : "";
if (StringUtils.isNotBlank(payPersent)){
serviceTipsSummary = String.format("(%s)", payPersent);
boolean feeRateExists;
ServiceFeeRate serviceFeeRate;
String payPercent = (feeRateExists = ((serviceFeeRate=computeResult.getServiceFeeRate()) != null)) ? serviceFeeRate.getPayChannelPercent() : "";
BigDecimal goodsPaymentRate;
if (feeRateExists && (goodsPaymentRate=serviceFeeRate.getGoodsPaymentRate()) != null){
serviceTipsSummary = String.format("(%s)", MathUtils.convert2Percent(goodsPaymentRate));
}else{
if(tipsConfig!=null){
serviceTipsDesc = tipsConfig.get(ResourcesProxyService.KEY_SERVICETIPSDESC);
... ... @@ -81,7 +80,7 @@ public final class SellerOrderConvertor {
.appraiseFee(formatFee(platformFeeDto.getAppraiseFee()))
.packageFee(formatFee(platformFeeDto.getPackageFee()))
.serviceFee(formatFee(platformFeeDto.getServiceFee()))
.payChannelPercentage(payPersent)
.payChannelPercentage(payPercent)
.build();
//
String incomeStr = formatFee(income);
... ...
package com.yohoufo.order.stateMachine;
/**
* 主要用于扭转状态
* Created by chao.chen on 2019/1/3.
*/
public interface Func<StateReference,T> {
... ...
... ... @@ -31,4 +31,9 @@ public class MathUtils {
public static double roundPrice(double price) {
return BigDecimalHelper.round(BigDecimal.valueOf(price));
}
public static String convert2Percent(BigDecimal rate){
return rate.multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP) + "%";
}
}
... ...