...
|
...
|
@@ -7,23 +7,75 @@ 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.service.proxy.ResourcesProxyService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Created by chenchao on 2018/9/20.
|
|
|
*/
|
|
|
public final class SellerOrderConvertor {
|
|
|
|
|
|
public static SoldPrdComputeBo computeResult2SoldPrdComputeBo(SellerOrderComputeResult computeResult){
|
|
|
public static SoldPrdComputeBo pureComputeResult2SoldPrdComputeBo(SellerOrderComputeResult computeResult){
|
|
|
//保证金(28-200(按照卖家发布商品的货款金额5%计算,最低28,封顶200))
|
|
|
EarnestMoney earnestMoneyDTO = computeResult.getEarnestMoney();
|
|
|
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()
|
|
|
.amount(buildSubtractFee(formatFee(platformFeeDto.getTotal())))
|
|
|
.appraiseFee(formatFee(platformFeeDto.getAppraiseFee()))
|
|
|
.packageFee(formatFee(platformFeeDto.getPackageFee()))
|
|
|
.serviceFee(formatFee(platformFeeDto.getServiceFee()))
|
|
|
.payChannelPercentage(payPersent)
|
|
|
.build();
|
|
|
//
|
|
|
String incomeStr = formatFee(income);
|
|
|
String earnestMoneyStr = formatFee(earnestMoney);
|
|
|
String bankTransferFeeStr = formatFee(computeResult.getBankTransferfee());
|
|
|
//
|
|
|
SoldPrdComputeBo computeBo = SoldPrdComputeBo.builder()
|
|
|
.earnestMoney(earnestMoney.doubleValue())
|
|
|
.earnestMoneyStr(earnestMoneyStr)
|
|
|
.platformFee(platformFeeWrapper)
|
|
|
.bankTransferFee(buildSubtractFee(bankTransferFeeStr))
|
|
|
.income(incomeStr)
|
|
|
.serviceTipsDesc(serviceTipsDesc)
|
|
|
.serviceTipsSummary(serviceTipsSummary)
|
|
|
.build();
|
|
|
return computeBo;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public static SoldPrdComputeBo computeResult2SoldPrdComputeBo(SellerOrderComputeResult computeResult,
|
|
|
Map<String,String> tipsConfig){
|
|
|
//保证金(28-200(按照卖家发布商品的货款金额5%计算,最低28,封顶200))
|
|
|
EarnestMoney earnestMoneyDTO = computeResult.getEarnestMoney();
|
|
|
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() : "";
|
|
|
if (StringUtils.isNotBlank(payPersent)){
|
|
|
serviceTipsSummary = String.format("(%s)", payPersent);
|
|
|
}else{
|
|
|
if(tipsConfig!=null){
|
|
|
serviceTipsDesc = tipsConfig.get(ResourcesProxyService.KEY_SERVICETIPSDESC);
|
|
|
serviceTipsSummary = tipsConfig.get(ResourcesProxyService.KEY_SERVICETIPSSUMARY);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
PlatformFee platformFeeWrapper = PlatformFee.builder()
|
|
|
.amount(buildSubtractFee(formatFee(platformFeeDto.getTotal())))
|
|
|
.appraiseFee(formatFee(platformFeeDto.getAppraiseFee()))
|
...
|
...
|
@@ -35,12 +87,15 @@ public final class SellerOrderConvertor { |
|
|
String incomeStr = formatFee(income);
|
|
|
String earnestMoneyStr = formatFee(earnestMoney);
|
|
|
String bankTransferFeeStr = formatFee(computeResult.getBankTransferfee());
|
|
|
//
|
|
|
SoldPrdComputeBo computeBo = SoldPrdComputeBo.builder()
|
|
|
.earnestMoney(earnestMoney.doubleValue())
|
|
|
.earnestMoneyStr(earnestMoneyStr)
|
|
|
.platformFee(platformFeeWrapper)
|
|
|
.bankTransferFee(buildSubtractFee(bankTransferFeeStr))
|
|
|
.income(incomeStr)
|
|
|
.serviceTipsDesc(serviceTipsDesc)
|
|
|
.serviceTipsSummary(serviceTipsSummary)
|
|
|
.build();
|
|
|
return computeBo;
|
|
|
|
...
|
...
|
|