@ -73,6 +73,8 @@ import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg;
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign ;
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign ;
import com.yxt.anrui.portal.api.sysuser.SysUserFeign ;
import com.yxt.anrui.portal.api.sysuser.SysUserFeign ;
import com.yxt.anrui.portal.api.sysuser.SysUserVo ;
import com.yxt.anrui.portal.api.sysuser.SysUserVo ;
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutionsFeign ;
import com.yxt.anrui.riskcenter.api.loansolutions.app.SolutionsDetailsVo ;
import com.yxt.common.base.config.component.FileUploadComponent ;
import com.yxt.common.base.config.component.FileUploadComponent ;
import com.yxt.common.base.service.MybatisBaseService ;
import com.yxt.common.base.service.MybatisBaseService ;
import com.yxt.common.base.utils.HanZiConverterPinYin ;
import com.yxt.common.base.utils.HanZiConverterPinYin ;
@ -147,6 +149,8 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
private CrmCustomerTempFeign crmCustomerTempFeign ;
private CrmCustomerTempFeign crmCustomerTempFeign ;
@Autowired
@Autowired
private BasePurchaseSystemFeign basePurchaseSystemFeign ;
private BasePurchaseSystemFeign basePurchaseSystemFeign ;
@Autowired
private LoanSolutionsFeign loanSolutionsFeign ;
private QueryWrapper < FinCollectionConfirmation > createQueryWrapper ( FinCollectionConfirmationQuery query ) {
private QueryWrapper < FinCollectionConfirmation > createQueryWrapper ( FinCollectionConfirmationQuery query ) {
// todo: 这里根据具体业务调整查询条件
// todo: 这里根据具体业务调整查询条件
@ -1236,17 +1240,14 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
* 全款 :
* 全款 :
* 推送车款 , 根据客户名称和手机号查询分组 , 查询是否有车架号 , 若有车架号 , 则需要推送具体的车架号的数组 。 若没有车架号 , 则按照客户名称和手机号推送该客户整体的车款
* 推送车款 , 根据客户名称和手机号查询分组 , 查询是否有车架号 , 若有车架号 , 则需要推送具体的车架号的数组 。 若没有车架号 , 则按照客户名称和手机号推送该客户整体的车款
* 推送订金 , 根据客户名称和手机号查询分组 , 查询是否有车架号 , 若有车架号 , 则需要推送具体的车架号的数组 。 若没有车架号 , 则按照客户名称和手机号推送该客户整体的订金
* 推送订金 , 根据客户名称和手机号查询分组 , 查询是否有车架号 , 若有车架号 , 则需要推送具体的车架号的数组 。 若没有车架号 , 则按照客户名称和手机号推送该客户整体的订金
*
* < p >
* 贷款 :
* 贷款 :
* 推送车款 ,
* 推送车款 ,
* 查询所有的贷款的车款数据 , 推送临时车架号 。
* 查询所有的贷款的车款数据 , 推送临时车架号 。
*
* < p >
* 推送订金 ,
* 推送订金 ,
* 查询所有的贷款的订金数据 , 推送临时车架号 。
* 查询所有的贷款的订金数据 , 推送临时车架号 。
*
*
*
*
*
* @param sid
* @param sid
* @param userSid
* @param userSid
* @return
* @return
@ -1852,7 +1853,6 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
}
}
}
}
//==========================================贷款首付款结束
//==========================================贷款首付款结束
//简易订单-订金收取
//简易订单-订金收取
if ( finSelectedReceivablesDetailedVos1 . isEmpty ( ) & &
if ( finSelectedReceivablesDetailedVos1 . isEmpty ( ) & &
@ -1931,8 +1931,50 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
AppOrderDetailsVo vo = orderDetails . getData ( ) ;
AppOrderDetailsVo vo = orderDetails . getData ( ) ;
if ( vo ! = null ) {
if ( vo ! = null ) {
AppOrderPriceInfoVo priceInfoVo = vo . getPriceInfo ( ) ;
AppOrderPriceInfoVo priceInfoVo = vo . getPriceInfo ( ) ;
//单台整体成交价
BigDecimal singleFinalPrice = new BigDecimal ( priceInfoVo . getSingleFinalPrice ( ) ) ;
BigDecimal singleFinalPrice = new BigDecimal ( priceInfoVo . getSingleFinalPrice ( ) ) ;
if ( singleFinalPrice . compareTo ( bigDecimalVinAll ) = = 0 ) { //推送待出库
BigDecimal leftAll = BigDecimal . ZERO ;
BigDecimal rightAll = BigDecimal . ZERO ;
if ( "2" . equals ( vo . getFinancePlan ( ) ) | | "2" . equals ( vo . getPayTypeKey ( ) ) ) {
//根据销售订单sid查询金融方案
ResultBean < SolutionsDetailsVo > solutionsDetailsVoResultBean = loanSolutionsFeign . selectDetailss ( commonContract . getBusSid ( ) ) ;
SolutionsDetailsVo solutionsDetailsVo = solutionsDetailsVoResultBean . getData ( ) ;
if ( solutionsDetailsVo ! = null ) {
if ( StringUtils . isNotBlank ( solutionsDetailsVo . getTypeKey ( ) ) ) {
if ( "02" . equals ( solutionsDetailsVo . getTypeKey ( ) ) ) {
//外部金融:成交价 = 订金+车款+厂家贴息-服务费
leftAll = leftAll . add ( singleFinalPrice ) ;
if ( StringUtils . isNotBlank ( solutionsDetailsVo . getFactoryDiscount ( ) ) ) {
leftAll = leftAll . add ( new BigDecimal ( solutionsDetailsVo . getFactoryDiscount ( ) ) ) ;
}
if ( StringUtils . isNotBlank ( solutionsDetailsVo . getServiceAmount ( ) ) ) {
leftAll = leftAll . subtract ( new BigDecimal ( solutionsDetailsVo . getServiceAmount ( ) ) ) ;
}
rightAll = rightAll . add ( bigDecimalVinAll ) ;
} else {
//自营非担保: 实收订金 = 首付款及费用+订金
if ( StringUtils . isNotBlank ( solutionsDetailsVo . getRealTotal ( ) ) ) {
leftAll = leftAll . add ( new BigDecimal ( solutionsDetailsVo . getRealTotal ( ) ) ) ;
}
rightAll = rightAll . add ( bigDecimalVinAll ) ;
}
} else { //担保贷款: 实收订金 = 首付款及费用+订金
if ( StringUtils . isNotBlank ( solutionsDetailsVo . getRealTotal ( ) ) ) {
leftAll = leftAll . add ( new BigDecimal ( solutionsDetailsVo . getRealTotal ( ) ) ) ;
}
rightAll = rightAll . add ( bigDecimalVinAll ) ;
}
} else {
// 成交价 = 车款+订金
leftAll = leftAll . add ( singleFinalPrice ) ;
rightAll = rightAll . add ( bigDecimalVinAll ) ;
}
} else {
// 成交价 = 车款+订金
leftAll = leftAll . add ( singleFinalPrice ) ;
rightAll = rightAll . add ( bigDecimalVinAll ) ;
}
if ( leftAll . compareTo ( rightAll ) = = 0 ) { //推送待出库
BusDeliveredDto busDeliveredDto = new BusDeliveredDto ( ) ;
BusDeliveredDto busDeliveredDto = new BusDeliveredDto ( ) ;
busDeliveredDto . setSubscriptionKey ( VehicleStateTempOrLast . PaymentEnum . PAY_MODELS . getCode ( ) ) ;
busDeliveredDto . setSubscriptionKey ( VehicleStateTempOrLast . PaymentEnum . PAY_MODELS . getCode ( ) ) ;
busDeliveredDto . setSubscription ( VehicleStateTempOrLast . PaymentEnum . PAY_MODELS . getRemarks ( ) ) ;
busDeliveredDto . setSubscription ( VehicleStateTempOrLast . PaymentEnum . PAY_MODELS . getRemarks ( ) ) ;
@ -1944,12 +1986,12 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
busDeliveredDto . setMobile ( v . getCustomerPhone ( ) ) ;
busDeliveredDto . setMobile ( v . getCustomerPhone ( ) ) ;
busDeliveredDto . setPrice ( priceInfoVo . getSingleFinalPrice ( ) ) ;
busDeliveredDto . setPrice ( priceInfoVo . getSingleFinalPrice ( ) ) ;
SubmitVo intermediary1 = vo . getIntermediary1 ( ) ;
SubmitVo intermediary1 = vo . getIntermediary1 ( ) ;
if ( intermediary1 ! = null ) {
if ( intermediary1 ! = null ) {
busDeliveredDto . setDistributorName ( intermediary1 . getIntermediaryName ( ) ) ;
busDeliveredDto . setDistributorName ( intermediary1 . getIntermediaryName ( ) ) ;
busDeliveredDto . setDistributorPrice ( intermediary1 . getAgencyFee ( ) ) ;
busDeliveredDto . setDistributorPrice ( intermediary1 . getAgencyFee ( ) ) ;
}
}
SubmitVo intermediary2 = vo . getIntermediary2 ( ) ;
SubmitVo intermediary2 = vo . getIntermediary2 ( ) ;
if ( intermediary2 ! = null ) {
if ( intermediary2 ! = null ) {
busDeliveredDto . setDistributorNameTwo ( intermediary2 . getIntermediaryName ( ) ) ;
busDeliveredDto . setDistributorNameTwo ( intermediary2 . getIntermediaryName ( ) ) ;
busDeliveredDto . setDistributorPriceTwo ( intermediary2 . getAgencyFee ( ) ) ;
busDeliveredDto . setDistributorPriceTwo ( intermediary2 . getAgencyFee ( ) ) ;
}
}
@ -1962,18 +2004,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
if ( sysOrganizationVoResultBean . getData ( ) ! = null ) {
if ( sysOrganizationVoResultBean . getData ( ) ! = null ) {
busDeliveredDto . setUseOrgName ( sysOrganizationVoResultBean . getData ( ) . getName ( ) ) ;
busDeliveredDto . setUseOrgName ( sysOrganizationVoResultBean . getData ( ) . getName ( ) ) ;
}
}
//根据应收未收表中的业务车辆sid查询车辆的sid
busDeliveredDto . setBusVinSid ( finUncollectedReceivablesDetailed . getBusVinSid ( ) ) ;
FinUncollectedReceivablesDetailed finUncollectedReceivablesDetailed1 = finUncollectedReceivablesDetailedService . fetchBySid ( v . getReceivablesSid ( ) ) ;
if ( finUncollectedReceivablesDetailed1 ! = null ) {
String busVinSid = finUncollectedReceivablesDetailed1 . getBusVinSid ( ) ;
if ( StringUtils . isNotBlank ( busVinSid ) ) {
//查询销售订单中的车辆列表的车辆相关的sid
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign . details ( busVinSid ) . getData ( ) ;
if ( busSalesOrderVehicle ! = null ) {
busDeliveredDto . setVinNo ( busSalesOrderVehicle . getLinkNo ( ) ) ;
}
}
}
ResultBean resultBean1 = busDeliveredFeign . save ( busDeliveredDto ) ;
ResultBean resultBean1 = busDeliveredFeign . save ( busDeliveredDto ) ;
}
}
}
}