@ -34,6 +34,7 @@ import com.yxt.anrui.buscenter.api.busarrearscarryvehicledetails.BusArrearsCarry
import com.yxt.anrui.buscenter.api.buscenterfile.BuscenterFile ;
import com.yxt.anrui.buscenter.api.buscenterfile.BuscenterFileEnum ;
import com.yxt.anrui.buscenter.api.busdelivered.BusDeliveredDto ;
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrder ;
import com.yxt.anrui.buscenter.api.bussalesorder.app.order.* ;
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle ;
import com.yxt.anrui.buscenter.biz.busarrearscarryvehicledetails.BusArrearsCarryVehicleDetailsService ;
@ -64,6 +65,8 @@ import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign;
import com.yxt.anrui.portal.api.sysuser.SysUserFeign ;
import com.yxt.anrui.portal.api.sysuser.SysUserVo ;
import com.yxt.anrui.portal.api.sysuser.UserRoleQuery ;
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutionsFeign ;
import com.yxt.anrui.riskcenter.api.loansolutions.app.SolutionsDetailsVo ;
import com.yxt.anrui.scm.api.scmwarehouse.ScmWarehouseFeign ;
import com.yxt.anrui.scm.api.scmwarehouse.ScmWarehouseVo ;
import com.yxt.common.base.config.component.DocPdfComponent ;
@ -187,6 +190,8 @@ public class BusArrearsCarryVehicleApplyService extends MybatisBaseService<BusAr
private ScmWarehouseFeign scmWarehouseFeign ;
@Autowired
private BusSalesOrderVehicleService busSalesOrderVehicleService ;
@Autowired
private LoanSolutionsFeign loanSolutionsFeign ;
/ * *
* 欠款提车分页列表查询条件
@ -1307,25 +1312,64 @@ public class BusArrearsCarryVehicleApplyService extends MybatisBaseService<BusAr
map . put ( "remarks" , remarks ) ;
//合同
AppOrderPriceInfoVo appOrderPriceInfoVo = appOrderDetailsVo . getPriceInfo ( ) ;
map . put ( "money" , appOrderPriceInfoVo . getTotalPrice ( ) ) ;
//单车价格
BigDecimal wMoneyAll = BigDecimal . ZERO ;
if ( StringUtils . isNotBlank ( appOrderPriceInfoVo . getTotalPrice ( ) ) ) {
wMoneyAll = wMoneyAll . add ( new BigDecimal ( appOrderPriceInfoVo . getTotalPrice ( ) ) ) ;
//=================================================
BusSalesOrder busSalesOrder = busSalesOrderService . selectDetailsByContractNo ( dto . getContractId ( ) ) ;
if ( "2" . equals ( busSalesOrder . getFinancePlan ( ) ) | | "2" . equals ( busSalesOrder . getPayTypeKey ( ) ) ) {
//根据销售订单sid查询金融方案
ResultBean < SolutionsDetailsVo > solutionsDetailsVoResultBean = loanSolutionsFeign . selectDetailsss ( busSalesOrder . getSid ( ) ) ;
SolutionsDetailsVo solutionsDetailsVo = solutionsDetailsVoResultBean . getData ( ) ;
if ( solutionsDetailsVo ! = null ) {
if ( StringUtils . isNotBlank ( solutionsDetailsVo . getTypeKey ( ) ) ) {
//推送车款
if ( "02" . equals ( solutionsDetailsVo . getTypeKey ( ) ) ) {
//外部金融:单车整体成交价-厂家贴息+服务费
wMoneyAll = wMoneyAll . add ( new BigDecimal ( appOrderPriceInfoVo . getSingleFinalPrice ( ) ) . subtract ( new BigDecimal ( solutionsDetailsVo . getFactoryDiscount ( ) ) ) . add ( new BigDecimal ( solutionsDetailsVo . getServiceAmount ( ) ) ) ) ;
} else {
//自营非担保:实收合计
wMoneyAll = wMoneyAll . add ( new BigDecimal ( solutionsDetailsVo . getRealTotal ( ) ) ) ;
}
map . put ( "DaXieMoney" , TransformMoney . transform ( TransformMoney . getDecimalStr ( Double . valueOf ( appOrderPriceInfoVo . getTotalPrice ( ) ) . doubleValue ( ) ) ) ) ;
//根据合同号查询已经审核通过的总认款
ResultBean < String > subscribtAllResultBean = finCollectionConfirmationFeign . selectCollectionMoney ( dto . getContractId ( ) ) ;
} else { //担保贷款: 实收合计
wMoneyAll = wMoneyAll . add ( new BigDecimal ( solutionsDetailsVo . getRealTotal ( ) ) ) ;
}
} else {
//推送车款:单车整体成交价
wMoneyAll = wMoneyAll . add ( new BigDecimal ( appOrderPriceInfoVo . getSingleFinalPrice ( ) ) ) ;
}
} else {
//推送车款:单车整体成交价
wMoneyAll = wMoneyAll . add ( new BigDecimal ( appOrderPriceInfoVo . getSingleFinalPrice ( ) ) ) ;
}
//总价款
wMoneyAll = wMoneyAll . multiply ( new BigDecimal ( stringList . size ( ) ) ) ;
map . put ( "money" , wMoneyAll . toString ( ) ) ;
//=================================================
/ * if ( StringUtils . isNotBlank ( appOrderPriceInfoVo . getTotalPrice ( ) ) ) {
wMoneyAll = wMoneyAll . add ( new BigDecimal ( appOrderPriceInfoVo . getTotalPrice ( ) ) ) ;
} * /
map . put ( "DaXieMoney" , TransformMoney . transform ( TransformMoney . getDecimalStr ( Double . valueOf ( wMoneyAll . toString ( ) ) . doubleValue ( ) ) ) ) ;
BigDecimal sqMoney = BigDecimal . ZERO ;
//已付车款
List < String > vinSidList = vinList . stream ( ) . map ( v - > v . getCarSid ( ) ) . collect ( Collectors . toList ( ) ) ;
List < String > busVinSidList = busSalesOrderVehicleService . selectByVinSidAndContractNo ( vinSidList , dto . getContractId ( ) ) ;
ResultBean < String > subscribtAllResultBean = finCollectionConfirmationFeign . selectCollectionMoneys ( dto . getContractId ( ) , busVinSidList ) ;
if ( subscribtAllResultBean . getData ( ) ! = null ) {
map . put ( "YMoney" , subscribtAllResultBean . getData ( ) ) ;
wMoneyAll = wMoneyAll . subtract ( new BigDecimal ( subscribtAllResultBean . getData ( ) ) ) ;
sqMoney = wMoneyAll . subtract ( new BigDecimal ( subscribtAllResultBean . getData ( ) ) ) ;
} else {
map . put ( "YMoney" , BigDecimal . ZERO ) ;
sqMoney = wMoneyAll . subtract ( BigDecimal . ZERO ) ;
}
if ( wMoneyAll . compareTo ( BigDecimal . ZERO ) < 0 ) {
//尚欠车款
if ( sqMoney . compareTo ( BigDecimal . ZERO ) < = 0 ) {
map . put ( "wMoney" , "0" ) ;
} else {
map . put ( "wMoney" , wMoneyAll . toString ( ) ) ;
map . put ( "wMoney" , sqMoney . toString ( ) ) ;
}
//尚欠车款大写
if ( StringUtils . isNotBlank ( subscribtAllResultBean . getData ( ) ) ) {
map . put ( "DyMoney" , TransformMoney . transform ( TransformMoney . getDecimalStr ( Double . valueOf ( subscribtAllResultBean . getData ( ) ) . doubleValue ( ) ) ) ) ;
map . put ( "DyMoney" , TransformMoney . transform ( TransformMoney . getDecimalStr ( Double . valueOf ( sqMoney . toString ( ) ) . doubleValue ( ) ) ) ) ;
} else {
map . put ( "DyMoney" , TransformMoney . transform ( TransformMoney . getDecimalStr ( Double . valueOf ( String . valueOf ( BigDecimal . ZERO ) ) . doubleValue ( ) ) ) ) ;
}