|
|
@ -143,14 +143,46 @@ public class CarsSoldProfitService extends MybatisBaseService<CarsSoldProfitMapp |
|
|
|
CarsSoldProfitVo carsSoldProfitVo = recordList.get(i); |
|
|
|
//预计毛利=出库价-成本+服务费+返利-中介费-调车费
|
|
|
|
BigDecimal expectedMaoriBig = BigDecimal.ZERO; |
|
|
|
//车辆成本 = 厂家结算价-返利
|
|
|
|
BigDecimal carCostBig = BigDecimal.ZERO; |
|
|
|
BigDecimal adjustedMaoriBig = BigDecimal.ZERO; |
|
|
|
String vinSid = carsSoldProfitVo.getVinSid(); |
|
|
|
CarsSoldProfitRebateAllVo carsSoldProfitRebateAllVo = rebates(vinSid).getData(); |
|
|
|
if(carsSoldProfitRebateAllVo != null){ |
|
|
|
String expectedRebateTotal = carsSoldProfitRebateAllVo.getExpectedRebateTotal(); |
|
|
|
carsSoldProfitVo.setRebatesTotal(expectedRebateTotal); |
|
|
|
carsSoldProfitVo.setMakersSettlementPrice(carsSoldProfitRebateAllVo.getMakersSettlementPrice()); |
|
|
|
carsSoldProfitVo.setRebatesAdjust(carsSoldProfitRebateAllVo.getAdjustedRebateTotal()); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(carsSoldProfitVo.getExStockPrice())){ |
|
|
|
expectedMaoriBig = expectedMaoriBig.add(new BigDecimal(carsSoldProfitVo.getExStockPrice())); |
|
|
|
|
|
|
|
} |
|
|
|
//厂家结算价
|
|
|
|
if(StringUtils.isNotBlank(carsSoldProfitVo.getMakersSettlementPrice())){ |
|
|
|
carCostBig = carCostBig.add(new BigDecimal(carsSoldProfitVo.getMakersSettlementPrice())); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(carsSoldProfitVo.getRebatesTotal())){ |
|
|
|
carCostBig = carCostBig.subtract(new BigDecimal(carsSoldProfitVo.getRebatesTotal())); |
|
|
|
carsSoldProfitVo.setCarCost(carCostBig.toString()); |
|
|
|
expectedMaoriBig = expectedMaoriBig.add(new BigDecimal(carsSoldProfitVo.getRebatesTotal())); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(carsSoldProfitVo.getCarCost())){ |
|
|
|
expectedMaoriBig = expectedMaoriBig.subtract(carCostBig); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(carsSoldProfitVo.getFinanceServiceCharge())){ |
|
|
|
expectedMaoriBig = expectedMaoriBig.add(new BigDecimal(carsSoldProfitVo.getFinanceServiceCharge())); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(carsSoldProfitVo.getMediatorRebatePrice())){ |
|
|
|
expectedMaoriBig = expectedMaoriBig.subtract(new BigDecimal(carsSoldProfitVo.getMediatorRebatePrice())); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(carsSoldProfitVo.getMoveCarPrice())){ |
|
|
|
expectedMaoriBig = expectedMaoriBig.subtract(new BigDecimal(carsSoldProfitVo.getMoveCarPrice())); |
|
|
|
} |
|
|
|
carsSoldProfitVo.setExpectedMaori(expectedMaoriBig.toString()); |
|
|
|
carsSoldProfitVo.setAdjustedMaori(expectedMaoriBig.subtract(new BigDecimal(carsSoldProfitVo.getRebatesAdjust())).toString()); |
|
|
|
if(StringUtils.isBlank(carsSoldProfitVo.getMakersSettlementPrice())){ |
|
|
|
carsSoldProfitVo.setMakersSettlementPrice("-"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -168,6 +200,7 @@ public class CarsSoldProfitService extends MybatisBaseService<CarsSoldProfitMapp |
|
|
|
String vinSid = sid; |
|
|
|
BigDecimal expectedRebateTotalAll = BigDecimal.ZERO; |
|
|
|
BigDecimal adjustedRebateTotalAll = BigDecimal.ZERO; |
|
|
|
String makersSettlementPrice = ""; |
|
|
|
List<ScmVehRebateCarsSoldProfitVo> scmList = scmVehRebateFeign.getDetailByVinSid(vinSid).getData(); |
|
|
|
if (!scmList.isEmpty()) { |
|
|
|
for (int i = 0; i < scmList.size(); i++) { |
|
|
@ -186,9 +219,11 @@ public class CarsSoldProfitService extends MybatisBaseService<CarsSoldProfitMapp |
|
|
|
if (StringUtils.isNotBlank(scmVehRebateCarsSoldProfitVo.getAdjustmentMoney())) { |
|
|
|
adjustedRebateTotalAll = adjustedRebateTotalAll.add(new BigDecimal(scmVehRebateCarsSoldProfitVo.getAdjustmentMoney())); |
|
|
|
} |
|
|
|
makersSettlementPrice = scmVehRebateCarsSoldProfitVo.getManufactorSettlementPrice(); |
|
|
|
} |
|
|
|
} |
|
|
|
carsSoldProfitRebateAllVo.setList(list); |
|
|
|
carsSoldProfitRebateAllVo.setMakersSettlementPrice(makersSettlementPrice); |
|
|
|
carsSoldProfitRebateAllVo.setAdjustedRebateTotal(adjustedRebateTotalAll.toString()); |
|
|
|
carsSoldProfitRebateAllVo.setExpectedRebateTotal(expectedRebateTotalAll.toString()); |
|
|
|
return rb.success().setData(carsSoldProfitRebateAllVo); |
|
|
|