@ -71,6 +71,10 @@ import com.yxt.anrui.fin.api.finbillapplication.FinBillApplicationFeign;
import com.yxt.anrui.fin.api.finbillvehicle.FinBillVehicleDto ;
import com.yxt.anrui.fin.api.finbillvehicle.FinBillVehicleDto ;
import com.yxt.anrui.fin.api.fincompanyinvoicing.FinCompanyInvoicingDetailsVo ;
import com.yxt.anrui.fin.api.fincompanyinvoicing.FinCompanyInvoicingDetailsVo ;
import com.yxt.anrui.fin.api.fincompanyinvoicing.FinCompanyInvoicingFeign ;
import com.yxt.anrui.fin.api.fincompanyinvoicing.FinCompanyInvoicingFeign ;
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailedFeign ;
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.ReceiveInvoiceVo ;
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.ReceiveSeleteVo ;
import com.yxt.anrui.fin.api.finvehicleinvoice.InvoiceVo ;
import com.yxt.anrui.flowable.api.flow.FlowableFeign ;
import com.yxt.anrui.flowable.api.flow.FlowableFeign ;
import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo ;
import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo ;
import com.yxt.anrui.flowable.api.flowtask.FlowTaskFeign ;
import com.yxt.anrui.flowable.api.flowtask.FlowTaskFeign ;
@ -161,6 +165,8 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp
private BusSalesOrderVehicleService busSalesOrderVehicleService ;
private BusSalesOrderVehicleService busSalesOrderVehicleService ;
@Autowired
@Autowired
private BusDiscountpackageHandoverService busDiscountpackageHandoverService ;
private BusDiscountpackageHandoverService busDiscountpackageHandoverService ;
@Autowired
private FinUncollectedReceivablesDetailedFeign finUncollectedReceivablesDetailedFeign ;
/ * *
/ * *
* 构造出库申请的查询条件
* 构造出库申请的查询条件
@ -177,7 +183,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp
}
}
//客户名称
//客户名称
if ( StringUtils . isNotBlank ( query . getName ( ) ) ) {
if ( StringUtils . isNotBlank ( query . getName ( ) ) ) {
qw . eq ( "bd.name" , query . getName ( ) ) ;
qw . lik e( "bd.name" , query . getName ( ) ) ;
}
}
if ( StringUtils . isNotBlank ( query . getApplyDateStart ( ) ) & & StringUtils . isNotBlank ( query . getApplyDateEnd ( ) ) ) {
if ( StringUtils . isNotBlank ( query . getApplyDateStart ( ) ) & & StringUtils . isNotBlank ( query . getApplyDateEnd ( ) ) ) {
qw . between ( "bd.createTime" , query . getApplyDateStart ( ) , query . getApplyDateEnd ( ) ) ;
qw . between ( "bd.createTime" , query . getApplyDateStart ( ) , query . getApplyDateEnd ( ) ) ;
@ -186,6 +192,9 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp
qw . like ( "bd.applyName" , query . getApplyName ( ) ) ;
qw . like ( "bd.applyName" , query . getApplyName ( ) ) ;
}
}
qw . eq ( "bd.applySid" , query . getApplySid ( ) ) ;
qw . eq ( "bd.applySid" , query . getApplySid ( ) ) ;
if ( StringUtils . isNotBlank ( query . getPaymentMethodKey ( ) ) ) {
qw . eq ( "bd.paymentMethodKey" , query . getPaymentMethodKey ( ) ) ;
}
}
}
return qw ;
return qw ;
}
}
@ -409,22 +418,28 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp
}
}
//客户名称
//客户名称
if ( StringUtils . isNotBlank ( query . getName ( ) ) ) {
if ( StringUtils . isNotBlank ( query . getName ( ) ) ) {
qw . eq ( "bd.name" , query . getName ( ) ) ;
qw . lik e( "bd.name" , query . getName ( ) ) ;
}
}
if ( StringUtils . isNotBlank ( query . getApplyDateStart ( ) ) & & StringUtils . isNotBlank ( query . getApplyDateEnd ( ) ) ) {
if ( StringUtils . isNotBlank ( query . getApplyDateStart ( ) ) & & StringUtils . isNotBlank ( query . getApplyDateEnd ( ) ) ) {
qw . between ( "bd.applyDat e" , query . getApplyDateStart ( ) , query . getApplyDateEnd ( ) ) ;
qw . between ( "bd.createTim e" , query . getApplyDateStart ( ) , query . getApplyDateEnd ( ) ) ;
}
}
if ( StringUtils . isNotBlank ( query . getApplyName ( ) ) ) {
if ( StringUtils . isNotBlank ( query . getApplyName ( ) ) ) {
qw . like ( "bd.applyName" , query . getApplyName ( ) ) ;
qw . like ( "bd.applyName" , query . getApplyName ( ) ) ;
}
}
//根据申请人sid查询分公司sid
//根据申请人sid查询分公司sid
String orgSid = "" ;
String orgSid = "" ;
ResultBean < String > stringResultBean = sysStaffOrgFeign . selectSidPathByStaffSid ( query . getStaffSid ( ) ) ;
/ * ResultBean < String > stringResultBean = sysStaffOrgFeign . selectSidPathByStaffSid ( query . getStaffSid ( ) ) ;
if ( stringResultBean . getSuccess ( ) ) {
if ( stringResultBean . getSuccess ( ) ) {
orgSid = stringResultBean . getData ( ) ;
orgSid = stringResultBean . getData ( ) ;
} * /
if ( StringUtils . isNotBlank ( query . getOrgPath ( ) ) ) {
orgSid = sysStaffOrgFeign . getOrgSidByPath ( query . getOrgPath ( ) ) . getData ( ) ;
}
}
qw . eq ( "bd.orgSid" , orgSid ) ;
qw . eq ( "bd.useO rgSid" , orgSid ) ;
qw . ne ( "bd.state" , 1 ) ;
qw . ne ( "bd.state" , 1 ) ;
if ( StringUtils . isNotBlank ( query . getPaymentMethodKey ( ) ) ) {
qw . eq ( "bd.paymentMethodKey" , query . getPaymentMethodKey ( ) ) ;
}
}
}
return qw ;
return qw ;
}
}
@ -757,7 +772,6 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp
* @return
* @return
* /
* /
public ResultBean taskReject ( BusDeliveredApplyTaskQuery query ) {
public ResultBean taskReject ( BusDeliveredApplyTaskQuery query ) {
ResultBean rb = ResultBean . fireFail ( ) ;
ResultBean rb = ResultBean . fireFail ( ) ;
BusDeliveredApply busDeliveredApply = fetchBySid ( query . getBusinessSid ( ) ) ;
BusDeliveredApply busDeliveredApply = fetchBySid ( query . getBusinessSid ( ) ) ;
if ( busDeliveredApply = = null ) {
if ( busDeliveredApply = = null ) {
@ -776,6 +790,10 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp
Map < String , Object > map = BeanUtil . beanToMap ( resultBean . getData ( ) ) ;
Map < String , Object > map = BeanUtil . beanToMap ( resultBean . getData ( ) ) ;
//更新业务中的流程相关的参数
//更新业务中的流程相关的参数
updateFlowFiled ( map ) ;
updateFlowFiled ( map ) ;
//将该申请的车架号的待出库中的状态修改为出库中
List < String > vinSidList = busDeliveredApplyDetailsService . selectVinSidByApplySid ( query . getBusinessSid ( ) ) ;
//更新该合同的该车架号的状态为0
busDeliveredService . updateStateByContractNo ( busDeliveredApply . getContractNo ( ) , vinSidList , 1 ) ;
return rb . success ( ) ;
return rb . success ( ) ;
}
}
}
}
@ -808,6 +826,10 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp
}
}
baseMapper . updateStateBySid ( 1 , query . getBusinessSid ( ) ) ;
baseMapper . updateStateBySid ( 1 , query . getBusinessSid ( ) ) ;
updateFlowFiled ( BeanUtil . beanToMap ( resultBean . getData ( ) ) ) ;
updateFlowFiled ( BeanUtil . beanToMap ( resultBean . getData ( ) ) ) ;
//将该申请的车架号的待出库中的状态修改为出库中
List < String > vinSidList = busDeliveredApplyDetailsService . selectVinSidByApplySid ( query . getBusinessSid ( ) ) ;
//更新该合同的该车架号的状态为0
busDeliveredService . updateStateByContractNo ( busDeliveredApply . getContractNo ( ) , vinSidList , 1 ) ;
return rb . success ( ) . setData ( resultBean . getData ( ) ) ;
return rb . success ( ) . setData ( resultBean . getData ( ) ) ;
}
}
}
}
@ -841,6 +863,10 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp
}
}
baseMapper . updateStateBySid ( 4 , query . getBusinessSid ( ) ) ;
baseMapper . updateStateBySid ( 4 , query . getBusinessSid ( ) ) ;
updateFlowFiled ( BeanUtil . beanToMap ( resultBean . getData ( ) ) ) ;
updateFlowFiled ( BeanUtil . beanToMap ( resultBean . getData ( ) ) ) ;
//将该申请的车架号的待出库中的状态修改为出库中
List < String > vinSidList = busDeliveredApplyDetailsService . selectVinSidByApplySid ( query . getBusinessSid ( ) ) ;
//更新该合同的该车架号的状态为0
busDeliveredService . updateStateByContractNo ( busDeliveredApply . getContractNo ( ) , vinSidList , 1 ) ;
return rb . success ( ) . setData ( resultBean . getData ( ) ) ;
return rb . success ( ) . setData ( resultBean . getData ( ) ) ;
}
}
}
}
@ -1299,7 +1325,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp
appCarListVo . setDiscount ( busDeliveredApplyDetails . getSingleCarDiscountPrice ( ) ) ;
appCarListVo . setDiscount ( busDeliveredApplyDetails . getSingleCarDiscountPrice ( ) ) ;
appCarListVo . setVinSid ( busDeliveredApplyDetails . getVinSid ( ) ) ;
appCarListVo . setVinSid ( busDeliveredApplyDetails . getVinSid ( ) ) ;
//查询该车辆是否有挂车
//查询该车辆是否有挂车
ResultBean < TraliveredVo > trailerList = baseTrailerFeign . trailerList ( busDeliveredApplyDetails . getVinSid ( ) , busDeliveredApply . getContractNo ( ) ) ;
ResultBean < TraliveredVo > trailerList = baseTrailerFeign . trailerList ( busDeliveredApplyDetails . getVinSid ( ) , busDeliveredApply . getContractNo ( ) ) ;
if ( trailerList . getData ( ) . getList ( ) . isEmpty ( ) ) {
if ( trailerList . getData ( ) . getList ( ) . isEmpty ( ) ) {
appCarListVo . setShowHandCarBtn ( false ) ;
appCarListVo . setShowHandCarBtn ( false ) ;
} else {
} else {
@ -1479,7 +1505,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp
if ( r = = 2 ) {
if ( r = = 2 ) {
// ToDo:驳回到发起人后再次提交
// ToDo:驳回到发起人后再次提交
if ( StringUtils . isBlank ( dto . getInstanceId ( ) ) ) {
if ( StringUtils . isBlank ( dto . getInstanceId ( ) ) ) {
return rb . setMsg ( "参数错误:instance Id" ) ;
return rb . setMsg ( "参数错误:procIns Id" ) ;
}
}
bv . setTaskId ( busDeliveredApply . getTaskId ( ) ) ;
bv . setTaskId ( busDeliveredApply . getTaskId ( ) ) ;
bv . setTaskDefKey ( busDeliveredApply . getTaskDefKey ( ) ) ;
bv . setTaskDefKey ( busDeliveredApply . getTaskDefKey ( ) ) ;
@ -1520,6 +1546,35 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp
return r ;
return r ;
}
}
public ResultBean < DeliveredFinVo > deliveredFinSelect ( String contractNo , String vinSid ) {
ResultBean < DeliveredFinVo > rb = ResultBean . fireFail ( ) ;
DeliveredFinVo deliveredFinVo = new DeliveredFinVo ( ) ;
//查询销售订单
ResultBean < AppOrderDetailsVo > resultBean = busSalesOrderService . getSaleOrderDetailsByContractNo ( contractNo ) ;
AppOrderDetailsVo appOrderDetailsVo = resultBean . getData ( ) ;
//根据合同号和车辆sid查询车辆
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleService . selectByNoAndVinSid ( contractNo , vinSid ) ;
deliveredFinVo . setVinNo ( busSalesOrderVehicle . getLinkNo ( ) ) ;
deliveredFinVo . setPaymentMethod ( appOrderDetailsVo . getPayType ( ) ) ;
deliveredFinVo . setContractNo ( contractNo ) ;
deliveredFinVo . setCustomerName ( appOrderDetailsVo . getName ( ) ) ;
deliveredFinVo . setModelName ( appOrderDetailsVo . getModelInfo ( ) . getModelName ( ) ) ;
//根据销售订单车辆查询款项情况
ResultBean < ReceiveInvoiceVo > receiveInvoiceVoResultBean = finUncollectedReceivablesDetailedFeign . receivedSelect ( busSalesOrderVehicle . getSid ( ) , busSalesOrderVehicle . getLinkSid ( ) ) ;
if ( receiveInvoiceVoResultBean . getData ( ) ! = null ) {
List < ReceiveSeleteVo > receiveSeleteVoList = receiveInvoiceVoResultBean . getData ( ) . getReceiveSeleteVoList ( ) ;
List < FinSelectVo > voList = Optional . ofNullable ( receiveSeleteVoList ) . orElse ( new ArrayList < > ( ) ) . stream ( ) . map ( m - > JSON . parseObject ( JSON . toJSONString ( m ) , FinSelectVo . class ) ) . collect ( Collectors . toList ( ) ) ;
deliveredFinVo . setFinSelectVoList ( voList ) ;
InvoiceVo invoiceVo = receiveInvoiceVoResultBean . getData ( ) . getInvoiceVo ( ) ;
if ( invoiceVo ! = null ) {
VinInvoiceVo vinInvoiceVo = new VinInvoiceVo ( ) ;
BeanUtil . copyProperties ( invoiceVo , vinInvoiceVo ) ;
deliveredFinVo . setVinInvoiceVo ( vinInvoiceVo ) ;
}
}
return rb . success ( ) . setData ( deliveredFinVo ) ;
}
// public ResultBean<AppDeliveredApplyInfoVo> getRetrievalDetail(String contractSid) {
// public ResultBean<AppDeliveredApplyInfoVo> getRetrievalDetail(String contractSid) {
// ResultBean<AppDeliveredApplyInfoVo> rb = ResultBean.fireFail();
// ResultBean<AppDeliveredApplyInfoVo> rb = ResultBean.fireFail();
// AppDeliveredApplyInfoVo vo = new AppDeliveredApplyInfoVo();
// AppDeliveredApplyInfoVo vo = new AppDeliveredApplyInfoVo();