|
|
@ -2802,6 +2802,24 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
return rb.setMsg("订金信息存在错误,请检查"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ("2".equals(busSalesOrder.getFinancePlan()) || "2".equals(busSalesOrder.getPayTypeKey())) { |
|
|
|
//根据销售订单sid查询金融方案
|
|
|
|
ResultBean<SolutionsDetailsVo> solutionsDetailsVoResultBean = loanSolutionsFeign.selectDetailss(sid); |
|
|
|
SolutionsDetailsVo solutionsDetailsVo = solutionsDetailsVoResultBean.getData(); |
|
|
|
if (solutionsDetailsVo != null) { |
|
|
|
if (StringUtils.isNotBlank(solutionsDetailsVo.getTypeKey())) { |
|
|
|
if (!"02".equals(solutionsDetailsVo.getTypeKey())) { |
|
|
|
//判断实收和单台订金
|
|
|
|
if(new BigDecimal(solutionsDetailsVo.getRealTotal()).compareTo(busSalesOrderDeposit.getDeposit())<0){ |
|
|
|
return rb.setMsg("金融方案中实收金额小于单台订金"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else {//担保贷款
|
|
|
|
return rb.setMsg("金融方案中实收金额小于单台订金"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
@ -3178,6 +3196,7 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
vo.setPriceInfo(priceInfo); |
|
|
|
} |
|
|
|
/***************************上装信息***************************************/ |
|
|
|
String topPriice = "¥0"; |
|
|
|
if (BusSalesOrderConstantUtils.TopType.YES.getCode().equals(busSalesOrder.getIsTop())) { |
|
|
|
AppOrderTopInfoVo topInfo = busSalesOrderMakeupService.selectTop(sid); |
|
|
|
if (topInfo != null) { |
|
|
@ -3195,6 +3214,7 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
topInfo.setTopBean(topInfo.getTopBean() + "\n\n" + "备注:" + topInfo.getRemarks()); |
|
|
|
} |
|
|
|
vo.setTopInfo(topInfo); |
|
|
|
topPriice = "¥"+topInfo.getTopPrice(); |
|
|
|
} |
|
|
|
BusSalesOrderMakeup busSalesOrderMakeup = busSalesOrderMakeupService.detailsss(sid); |
|
|
|
String topMessage = ""; |
|
|
@ -3256,17 +3276,21 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
vo.setTotaldiscount(bigDecimalAll.toString()); |
|
|
|
} |
|
|
|
/*************************返利信息*******************************************/ |
|
|
|
BigDecimal zjAll = BigDecimal.ZERO; |
|
|
|
BusSalesOrderSubmit busSalesOrderSubmit = busSalesOrderSubmitService.selectBySaleOrderSid(sid); |
|
|
|
if (busSalesOrderSubmit != null) { |
|
|
|
//内部推荐人
|
|
|
|
if (StringUtils.isNotBlank(busSalesOrderSubmit.getName())) { |
|
|
|
vo.setRecommender(busSalesOrderSubmit.getName()); |
|
|
|
} |
|
|
|
//中介返利(元/台)
|
|
|
|
String zjReturnPrice = ""; |
|
|
|
if (StringUtils.isNotBlank(busSalesOrderSubmit.getDistributorName())) { |
|
|
|
SubmitVo submitVo = new SubmitVo(); |
|
|
|
submitVo.setIntermediaryName(busSalesOrderSubmit.getDistributorName()); |
|
|
|
submitVo.setIntermediaryMobile(busSalesOrderSubmit.getDistributorMobile()); |
|
|
|
if (busSalesOrderSubmit.getDistributorPrice() != null) { |
|
|
|
zjAll = zjAll.add(busSalesOrderSubmit.getDistributorPrice()); |
|
|
|
submitVo.setAgencyFee(busSalesOrderSubmit.getDistributorPrice().toString()); |
|
|
|
if (priceInfo != null) { |
|
|
|
submitVo.setAgencyFeeTotal(busSalesOrderSubmit.getDistributorPrice().multiply(new BigDecimal(priceInfo.getNumber())).toString()); |
|
|
@ -3280,6 +3304,7 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
submitVo.setIntermediaryName(busSalesOrderSubmit.getDistributorNameTwo()); |
|
|
|
submitVo.setIntermediaryMobile(busSalesOrderSubmit.getDistributorMobileTwo()); |
|
|
|
if (busSalesOrderSubmit.getDistributorPriceTwo() != null) { |
|
|
|
zjAll = zjAll.add(busSalesOrderSubmit.getDistributorPriceTwo()); |
|
|
|
submitVo.setAgencyFee(busSalesOrderSubmit.getDistributorPriceTwo().toString()); |
|
|
|
if (priceInfo != null) { |
|
|
|
submitVo.setAgencyFeeTotal(busSalesOrderSubmit.getDistributorPriceTwo().multiply(new BigDecimal(priceInfo.getNumber())).toString()); |
|
|
@ -3287,6 +3312,17 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
} |
|
|
|
vo.setIntermediary2(submitVo); |
|
|
|
} |
|
|
|
if (priceInfo != null) { |
|
|
|
if(zjAll.compareTo(BigDecimal.ZERO)>0){ |
|
|
|
//如果中介返利小于0,乘以-1
|
|
|
|
zjAll = zjAll.multiply(new BigDecimal(-1)); |
|
|
|
zjReturnPrice = "-¥"+zjAll.toString(); |
|
|
|
}else{ |
|
|
|
zjReturnPrice = "¥"+zjAll.toString(); |
|
|
|
} |
|
|
|
priceInfo.setZjReturnPrice(zjReturnPrice); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//计算单台折让
|
|
|
|
BigDecimal bigDecimalSing = new BigDecimal("0"); |
|
|
@ -3330,8 +3366,14 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
list.removeAll(Collections.singleton(null)); |
|
|
|
List<String> stringList = new ArrayList<>(); |
|
|
|
if (!list.isEmpty()) { |
|
|
|
for (BusDepositFictitiousDetailsVo v : list) { |
|
|
|
String b = "编号为" + v.getDepositBillNo() + "简易订单订金转入" + v.getPrice() + "元,"; |
|
|
|
for (int j = 0;j<list.size();j++) { |
|
|
|
BusDepositFictitiousDetailsVo v = list.get(j); |
|
|
|
String b = ""; |
|
|
|
if(j == list.size() - 1){ |
|
|
|
b = "编号为" + v.getDepositBillNo() + "简易订单订金转入" + v.getPrice() + "元。"; |
|
|
|
}else{ |
|
|
|
b = "编号为" + v.getDepositBillNo() + "简易订单订金转入" + v.getPrice() + "元,"; |
|
|
|
} |
|
|
|
a = a + b; |
|
|
|
if (StringUtils.isNotBlank(v.getPayPath())) { |
|
|
|
List<String> payPathList = Arrays.asList(v.getPayPath().split(",")); |
|
|
@ -3340,7 +3382,7 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
a = a + "原订金额度使用完后,其收据自动作废。"; |
|
|
|
// a = a + "原订金额度使用完后,其收据自动作废。";
|
|
|
|
depositInfo.setDepositRemarks(a); |
|
|
|
depositInfo.setImages(stringList); |
|
|
|
} |
|
|
@ -3364,6 +3406,62 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
} |
|
|
|
// vo = selectSolution(vo, sid);
|
|
|
|
vo = selectSolutions(vo, sid); |
|
|
|
//===============================================
|
|
|
|
//挂车价格(金融方案中取)
|
|
|
|
ResultBean<SolutionsDetailsVo> solutionsDetailsVoResultBean = loanSolutionsFeign.selectDetailss(sid); |
|
|
|
List<OrderSolutionVo> list = new ArrayList<>(); |
|
|
|
if (solutionsDetailsVoResultBean.getData() != null) { |
|
|
|
SolutionsDetailsVo solutionsDetailsVo = solutionsDetailsVoResultBean.getData(); |
|
|
|
//挂车
|
|
|
|
if (StringUtils.isNotBlank(solutionsDetailsVo.getTrailerAmount())) { |
|
|
|
if(priceInfo != null){ |
|
|
|
priceInfo.setGcPrice(solutionsDetailsVo.getTrailerAmount()); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
priceInfo.setGcPrice("¥0"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(priceInfo != null){ |
|
|
|
priceInfo.setSzPrice(topPriice); |
|
|
|
//价格折让 = 销售合同价(整体成交价)-销售指导价(整体指导价)
|
|
|
|
//销售合同价-销售指导价
|
|
|
|
BigDecimal all = new BigDecimal(priceInfo.getSingleFinalPrice()).subtract(new BigDecimal(priceInfo.getSingleGuildPrice())); |
|
|
|
String priceAll = ""; |
|
|
|
if(all.compareTo(BigDecimal.ZERO) <0){ |
|
|
|
//如果价格折让小于0,乘以-1
|
|
|
|
all = all.multiply(new BigDecimal(-1)); |
|
|
|
priceAll = "-¥"+all.toString(); |
|
|
|
}else{ |
|
|
|
priceAll = "¥"+all.toString(); |
|
|
|
} |
|
|
|
priceInfo.setPriceDiscount(priceAll); |
|
|
|
//优惠套餐 = 优惠套餐总额/台数(保留到个位)
|
|
|
|
String pkgPrice = ""; |
|
|
|
BigDecimal oneAll = BigDecimal.ZERO; |
|
|
|
if(StringUtils.isNotBlank(vo.getTotaldiscount())){ |
|
|
|
//总优惠/台数
|
|
|
|
oneAll = new BigDecimal(vo.getTotaldiscount()).divide(new BigDecimal(priceInfo.getNumber())); |
|
|
|
if(oneAll.compareTo(BigDecimal.ZERO) >0){ |
|
|
|
//如果小于0,乘以-1
|
|
|
|
oneAll = oneAll.multiply(new BigDecimal(-1)); |
|
|
|
pkgPrice = "-¥"+oneAll.toString(); |
|
|
|
}else{ |
|
|
|
pkgPrice = "¥"+oneAll.toString(); |
|
|
|
} |
|
|
|
priceInfo.setPkgPrice(pkgPrice); |
|
|
|
} |
|
|
|
//实际成交 = 销售指导价-价格折让-中介返利-优惠套餐
|
|
|
|
BigDecimal realAll = BigDecimal.ZERO; |
|
|
|
realAll = realAll.add(new BigDecimal(priceInfo.getSingleGuildPrice())).add(all).add(zjAll.multiply(new BigDecimal(-1))).add(oneAll.multiply(new BigDecimal(-1))); |
|
|
|
priceInfo.setRealPrice("¥"+realAll.toString()); |
|
|
|
//差额 = 实际成交价-销售指导价
|
|
|
|
BigDecimal diffAll = BigDecimal.ZERO; |
|
|
|
diffAll = realAll.subtract(new BigDecimal(priceInfo.getSingleGuildPrice())); |
|
|
|
priceInfo.setDiffPrice(diffAll.toString()); |
|
|
|
} |
|
|
|
|
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|