|
|
@ -47,6 +47,9 @@ import com.yxt.anrui.base.common.utils.domain.BillNo; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeposit.AppBusDepositBuscenterDetailVo; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeposit.BusDepositFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrder; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorderborrower.BusSalesOrderBorrowerDetailsVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorderborrower.BusSalesOrderBorrowerFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicleFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.*; |
|
|
@ -62,9 +65,13 @@ import com.yxt.anrui.fin.api.kingdee.arreceivebill.ARReceivebill; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.bdcustomer.BdCustomer; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.capitalcreditresult.CapitalCreditResult; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.capitalcreditresult.CwSystemYT; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.voucher.CollectionVoucher; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.voucher.GeneralVoucher; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.voucher.SceneCodeEnum; |
|
|
|
import com.yxt.anrui.fin.biz.finselectedreceivablesdetailed.FinSelectedReceivablesDetailedService; |
|
|
|
import com.yxt.anrui.fin.biz.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailedService; |
|
|
|
import com.yxt.anrui.fin.biz.finuncollectedreceivablesdetailedjr.FinUncollectedReceivablesDetailedJRService; |
|
|
|
import com.yxt.anrui.fin.biz.kingdee.FinKingDeeFeignRest; |
|
|
|
import com.yxt.anrui.fin.biz.kingdee.FinKingDeeService; |
|
|
|
import com.yxt.anrui.fin.biz.kingdee.arreceivebill.ArReceivebillService; |
|
|
|
import com.yxt.anrui.fin.biz.kingdee.bdcustomer.BdCustomerService; |
|
|
@ -86,10 +93,12 @@ import com.yxt.anrui.riskcenter.api.loanfinotherPolicy.LoanFinOtherPolicy; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfinpolicy.LoanFinPolicy; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfinpolicy.LoanFinPolicyFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfinpolicy.LoanFinPolicyVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanmonthlyaccrualrecord.LoanMonthlyAccrualRecord; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymenthistory.LoanRepaymentHistory; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymenthistory.LoanRepaymentHistoryFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetails; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetailsFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetailsForOverDue; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutions; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutionsFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansolutionsdetail.LoanSolutionsDetail; |
|
|
@ -183,6 +192,12 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
private LoanRepaymentHistoryFeign loanRepaymentHistoryFeign; |
|
|
|
@Autowired |
|
|
|
private LoanFinBankFeign loanFinBankFeign; |
|
|
|
@Autowired |
|
|
|
private FinKingDeeFeignRest finKingDeeFeignRest; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderBorrowerFeign busSalesOrderBorrowerFeign; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderFeign busSalesOrderFeign; |
|
|
|
|
|
|
|
private QueryWrapper<FinCollectionConfirmation> createQueryWrapper(FinCollectionConfirmationQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
@ -3682,6 +3697,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
if ("4".equals(confirmation.getAuditState())) { |
|
|
|
return rb.setMsg("该申请已撤回,不允许确认"); |
|
|
|
} |
|
|
|
String collectionTypeKey = confirmation.getCollectionTypeKey(); //收款方式
|
|
|
|
confirmation.setAuditState(3); |
|
|
|
//与收款金额作比较:更新认款状态 1未认款/2部分认款/3已认款
|
|
|
|
confirmation.setPaymentState(3); |
|
|
@ -3739,8 +3755,38 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
} |
|
|
|
loanRepaymentHistoryFeign.saveHistoryByEntity(historyEntity); |
|
|
|
} |
|
|
|
if (v.getReceivablesName().equals("资方退还垫款")) { |
|
|
|
try { |
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() |
|
|
|
.setNameFormat("demo-pool-%d").build(); |
|
|
|
ExecutorService pool = new org.apache.tomcat.util.threads.ThreadPoolExecutor(1, 10, |
|
|
|
1000, TimeUnit.MILLISECONDS, |
|
|
|
new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new org.apache.tomcat.util.threads.ThreadPoolExecutor.AbortPolicy()); |
|
|
|
//推送资方退还垫款收款凭证
|
|
|
|
Future future = pool.submit(() -> { |
|
|
|
pushReturnVoucher(v, sid); |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
log.error("推送数据失败=========================" + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
//推送间还待转付列表
|
|
|
|
if (v.getReceivablesName().equals("月还") || v.getReceivablesName().equals("资方逾期利息")) { |
|
|
|
try { |
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() |
|
|
|
.setNameFormat("demo-pool-%d").build(); |
|
|
|
ExecutorService pool = new org.apache.tomcat.util.threads.ThreadPoolExecutor(1, 10, |
|
|
|
1000, TimeUnit.MILLISECONDS, |
|
|
|
new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new org.apache.tomcat.util.threads.ThreadPoolExecutor.AbortPolicy()); |
|
|
|
//推送间还月还收款凭证
|
|
|
|
Future future = pool.submit(() -> { |
|
|
|
pushIndirectVoucher(v, sid); |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
log.error("推送数据失败=========================" + e.getMessage()); |
|
|
|
} |
|
|
|
String planSid = ""; |
|
|
|
if (v.getReceivablesName().equals("月还")) { |
|
|
|
planSid = v.getReceivablesSid(); |
|
|
@ -3802,6 +3848,20 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
loanRepaymentPlanDetailsFeign.updateByEntity(planDetails); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() |
|
|
|
.setNameFormat("demo-pool-%d").build(); |
|
|
|
ExecutorService pool = new org.apache.tomcat.util.threads.ThreadPoolExecutor(1, 10, |
|
|
|
1000, TimeUnit.MILLISECONDS, |
|
|
|
new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new org.apache.tomcat.util.threads.ThreadPoolExecutor.AbortPolicy()); |
|
|
|
//推送资金占用费收款凭证
|
|
|
|
Future future = pool.submit(() -> { |
|
|
|
pushFeeVoucher(v, sid); |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
log.error("推送数据失败=========================" + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
//查询该申请已认款金额总数
|
|
|
@ -3822,6 +3882,346 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
return rb.success().setMsg("款项确认成功"); |
|
|
|
} |
|
|
|
|
|
|
|
private void pushFeeVoucher(FinSelectedReceivablesDetailedVo v, String sid) { |
|
|
|
String planSid = ""; |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
FinCollectionConfirmation finCollectionConfirmation = fetchBySid(sid); |
|
|
|
if (null != finCollectionConfirmation) { |
|
|
|
FinUncollectedReceivablesDetailedJR jr = finUncollectedReceivablesDetailedJRService.fetchBySid(v.getReceivablesSid()); |
|
|
|
if (jr != null) { |
|
|
|
planSid = jr.getBusSid(); |
|
|
|
} |
|
|
|
LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsFeign.fetchDetails(planSid).getData(); |
|
|
|
if (null != planDetails) { |
|
|
|
for (int i = 0; i <= 1; i++) { |
|
|
|
CollectionVoucher collectionVoucher = new CollectionVoucher(); |
|
|
|
//收款方式key
|
|
|
|
collectionVoucher.setPayTypeCode(finCollectionConfirmation.getCollectionTypeKey()); |
|
|
|
//收款银行账号
|
|
|
|
if (StringUtils.isNotBlank(finCollectionConfirmation.getCollectionBankNum())) { |
|
|
|
collectionVoucher.setBankAccount(finCollectionConfirmation.getCollectionBankNum()); |
|
|
|
} |
|
|
|
List<CollectionVoucher.CollectionVoucherDetail> voucherDetails = new ArrayList<>(); |
|
|
|
CollectionVoucher.CollectionVoucherDetail voucherDetail = new CollectionVoucher.CollectionVoucherDetail(); |
|
|
|
if (i == 0) { |
|
|
|
voucherDetail.setSceneCode(SceneCodeEnum.FUND_VOUCHER1.getCode()); |
|
|
|
} else if (i == 1) { |
|
|
|
voucherDetail.setSceneCode(SceneCodeEnum.FUND_VOUCHER2.getCode()); |
|
|
|
} |
|
|
|
String useOrgSid = planDetails.getUseOrgSid(); |
|
|
|
SysOrganizationVo organizationVo = sysOrganizationFeign.fetchBySid(useOrgSid).getData(); |
|
|
|
if (null != organizationVo) { |
|
|
|
collectionVoucher.setUseOrgCode(organizationVo.getOrgCode()); |
|
|
|
} |
|
|
|
String deptSid = planDetails.getDeptSid(); |
|
|
|
SysOrganizationVo organizationDeptVo = sysOrganizationFeign.fetchBySid(deptSid).getData(); |
|
|
|
if (null != organizationDeptVo) { |
|
|
|
voucherDetail.setDeptCode(organizationDeptVo.getOrgCode()); |
|
|
|
} |
|
|
|
String busVinSid = planDetails.getBusVinSid(); |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(busVinSid).getData(); |
|
|
|
if (null != busSalesOrderVehicle) { |
|
|
|
String customerNumber = ""; |
|
|
|
//判断财务系统是否有客户
|
|
|
|
Boolean aBoolean = finKingDeeFeignRest.customerExistState(busSalesOrderVehicle.getTemporaryNo()).getData(); |
|
|
|
String linkNo = ""; |
|
|
|
String customerName = ""; |
|
|
|
BusSalesOrderBorrowerDetailsVo borrowerDetailsVo = busSalesOrderBorrowerFeign.fetchDetailsBySid(busSalesOrderVehicle.getBorrowerSid()).getData(); |
|
|
|
if (!aBoolean) { |
|
|
|
// List<BdCustomer> bdCustomers = new ArrayList<>();
|
|
|
|
BdCustomer bdCustomer = new BdCustomer(); |
|
|
|
bdCustomer.setFNumber(busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
String salesOrderSid = planDetails.getSalesOrderSid(); |
|
|
|
BusSalesOrder salesOrder = busSalesOrderFeign.fetchBySid(salesOrderSid).getData(); |
|
|
|
bdCustomer.setFShortName(salesOrder.getContractNo()); |
|
|
|
BasePurchaseSystemDetailsVo data = basePurchaseSystemFeign.fetchDetailsByDeptSid(salesOrder.getPurchaseSystemSid()).getData(); |
|
|
|
bdCustomer.setTOrgIds(data.getOrgCode()); |
|
|
|
if (StringUtils.isNotBlank(busSalesOrderVehicle.getLinkNo())) { |
|
|
|
String vinNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
if (vinNo.length() > 8) { |
|
|
|
linkNo = vinNo.substring(vinNo.length() - 8); |
|
|
|
} else { |
|
|
|
linkNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
} |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + linkNo); |
|
|
|
customerName = borrowerDetailsVo.getBorrowerName() + linkNo; |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
customerName = borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
// bdCustomers.add(bdCustomer);
|
|
|
|
ResultBean<String> resultBean = finKingDeeFeignRest.draftBdCustomer(bdCustomer); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
customerNumber = bdCustomer.getFNumber(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
customerNumber = busSalesOrderVehicle.getTemporaryNo(); |
|
|
|
if (StringUtils.isNotBlank(busSalesOrderVehicle.getLinkNo())) { |
|
|
|
String vinNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
if (vinNo.length() > 8) { |
|
|
|
linkNo = vinNo.substring(vinNo.length() - 8); |
|
|
|
} else { |
|
|
|
linkNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
} |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
customerName = borrowerDetailsVo.getBorrowerName() + linkNo; |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
customerName = borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
voucherDetail.setCustomerCode(customerNumber); |
|
|
|
voucherDetail.setCustomerName(customerName); |
|
|
|
} |
|
|
|
try { |
|
|
|
voucherDetail.setDataTime(sdf.parse(finCollectionConfirmation.getCollectionDate())); |
|
|
|
} catch (ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
voucherDetail.setAmount(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherDetails.add(voucherDetail); |
|
|
|
collectionVoucher.setVoucherDetails(voucherDetails); |
|
|
|
finKingDeeFeignRest.saveFeeVoucher(collectionVoucher); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void pushReturnVoucher(FinSelectedReceivablesDetailedVo v, String sid) { |
|
|
|
String planSid = ""; |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
FinCollectionConfirmation finCollectionConfirmation = fetchBySid(sid); |
|
|
|
if (null != finCollectionConfirmation) { |
|
|
|
FinUncollectedReceivablesDetailedJR jr = finUncollectedReceivablesDetailedJRService.fetchBySid(v.getReceivablesSid()); |
|
|
|
if (jr != null) { |
|
|
|
planSid = jr.getBusSid(); |
|
|
|
} |
|
|
|
LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsFeign.fetchDetails(planSid).getData(); |
|
|
|
if (null != planDetails) { |
|
|
|
CollectionVoucher collectionVoucher = new CollectionVoucher(); |
|
|
|
//收款方式key
|
|
|
|
collectionVoucher.setPayTypeCode(finCollectionConfirmation.getCollectionTypeKey()); |
|
|
|
//收款银行账号
|
|
|
|
if (StringUtils.isNotBlank(finCollectionConfirmation.getCollectionBankNum())) { |
|
|
|
collectionVoucher.setBankAccount(finCollectionConfirmation.getCollectionBankNum()); |
|
|
|
} |
|
|
|
List<CollectionVoucher.CollectionVoucherDetail> voucherDetails = new ArrayList<>(); |
|
|
|
CollectionVoucher.CollectionVoucherDetail voucherDetail = new CollectionVoucher.CollectionVoucherDetail(); |
|
|
|
String useOrgSid = planDetails.getUseOrgSid(); |
|
|
|
SysOrganizationVo organizationVo = sysOrganizationFeign.fetchBySid(useOrgSid).getData(); |
|
|
|
if (null != organizationVo) { |
|
|
|
collectionVoucher.setUseOrgCode(organizationVo.getOrgCode()); |
|
|
|
} |
|
|
|
String deptSid = planDetails.getDeptSid(); |
|
|
|
SysOrganizationVo organizationDeptVo = sysOrganizationFeign.fetchBySid(deptSid).getData(); |
|
|
|
if (null != organizationDeptVo) { |
|
|
|
voucherDetail.setDeptCode(organizationDeptVo.getOrgCode()); |
|
|
|
} |
|
|
|
String busVinSid = planDetails.getBusVinSid(); |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(busVinSid).getData(); |
|
|
|
if (null != busSalesOrderVehicle) { |
|
|
|
String customerNumber = ""; |
|
|
|
//判断财务系统是否有客户
|
|
|
|
Boolean aBoolean = finKingDeeFeignRest.customerExistState(busSalesOrderVehicle.getTemporaryNo()).getData(); |
|
|
|
String linkNo = ""; |
|
|
|
String customerName = ""; |
|
|
|
BusSalesOrderBorrowerDetailsVo borrowerDetailsVo = busSalesOrderBorrowerFeign.fetchDetailsBySid(busSalesOrderVehicle.getBorrowerSid()).getData(); |
|
|
|
if (!aBoolean) { |
|
|
|
// List<BdCustomer> bdCustomers = new ArrayList<>();
|
|
|
|
BdCustomer bdCustomer = new BdCustomer(); |
|
|
|
bdCustomer.setFNumber(busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
String salesOrderSid = planDetails.getSalesOrderSid(); |
|
|
|
BusSalesOrder salesOrder = busSalesOrderFeign.fetchBySid(salesOrderSid).getData(); |
|
|
|
bdCustomer.setFShortName(salesOrder.getContractNo()); |
|
|
|
BasePurchaseSystemDetailsVo data = basePurchaseSystemFeign.fetchDetailsByDeptSid(salesOrder.getPurchaseSystemSid()).getData(); |
|
|
|
bdCustomer.setTOrgIds(data.getOrgCode()); |
|
|
|
if (StringUtils.isNotBlank(busSalesOrderVehicle.getLinkNo())) { |
|
|
|
String vinNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
if (vinNo.length() > 8) { |
|
|
|
linkNo = vinNo.substring(vinNo.length() - 8); |
|
|
|
} else { |
|
|
|
linkNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
} |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + linkNo); |
|
|
|
customerName = borrowerDetailsVo.getBorrowerName() + linkNo; |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
customerName = borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
// bdCustomers.add(bdCustomer);
|
|
|
|
ResultBean<String> resultBean = finKingDeeFeignRest.draftBdCustomer(bdCustomer); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
customerNumber = bdCustomer.getFNumber(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
customerNumber = busSalesOrderVehicle.getTemporaryNo(); |
|
|
|
if (StringUtils.isNotBlank(busSalesOrderVehicle.getLinkNo())) { |
|
|
|
String vinNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
if (vinNo.length() > 8) { |
|
|
|
linkNo = vinNo.substring(vinNo.length() - 8); |
|
|
|
} else { |
|
|
|
linkNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
} |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
customerName = borrowerDetailsVo.getBorrowerName() + linkNo; |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
customerName = borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
voucherDetail.setCustomerCode(customerNumber); |
|
|
|
voucherDetail.setCustomerName(customerName); |
|
|
|
} |
|
|
|
try { |
|
|
|
voucherDetail.setDataTime(sdf.parse(finCollectionConfirmation.getCollectionDate())); |
|
|
|
} catch (ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
voucherDetail.setAmount(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherDetails.add(voucherDetail); |
|
|
|
collectionVoucher.setVoucherDetails(voucherDetails); |
|
|
|
finKingDeeFeignRest.saveReturnVoucher(collectionVoucher); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void pushIndirectVoucher(FinSelectedReceivablesDetailedVo v, String sid) { |
|
|
|
String planSid = ""; |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
FinCollectionConfirmation finCollectionConfirmation = fetchBySid(sid); |
|
|
|
if (null != finCollectionConfirmation) { |
|
|
|
if (v.getReceivablesName().equals("月还")) { |
|
|
|
planSid = v.getReceivablesSid(); |
|
|
|
} else { |
|
|
|
FinUncollectedReceivablesDetailedJR jr = finUncollectedReceivablesDetailedJRService.fetchBySid(v.getReceivablesSid()); |
|
|
|
if (jr != null) { |
|
|
|
planSid = jr.getBusSid(); |
|
|
|
} |
|
|
|
} |
|
|
|
LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsFeign.fetchDetails(planSid).getData(); |
|
|
|
if (null != planDetails) { |
|
|
|
CollectionVoucher collectionVoucher = new CollectionVoucher(); |
|
|
|
//收款方式key
|
|
|
|
collectionVoucher.setPayTypeCode(finCollectionConfirmation.getCollectionTypeKey()); |
|
|
|
//收款银行账号
|
|
|
|
if (StringUtils.isNotBlank(finCollectionConfirmation.getCollectionBankNum())) { |
|
|
|
collectionVoucher.setBankAccount(finCollectionConfirmation.getCollectionBankNum()); |
|
|
|
} |
|
|
|
List<CollectionVoucher.CollectionVoucherDetail> voucherDetails = new ArrayList<>(); |
|
|
|
CollectionVoucher.CollectionVoucherDetail voucherDetail = new CollectionVoucher.CollectionVoucherDetail(); |
|
|
|
String useOrgSid = planDetails.getUseOrgSid(); |
|
|
|
SysOrganizationVo organizationVo = sysOrganizationFeign.fetchBySid(useOrgSid).getData(); |
|
|
|
if (null != organizationVo) { |
|
|
|
collectionVoucher.setUseOrgCode(organizationVo.getOrgCode()); |
|
|
|
} |
|
|
|
String deptSid = planDetails.getDeptSid(); |
|
|
|
SysOrganizationVo organizationDeptVo = sysOrganizationFeign.fetchBySid(deptSid).getData(); |
|
|
|
if (null != organizationDeptVo) { |
|
|
|
voucherDetail.setDeptCode(organizationDeptVo.getOrgCode()); |
|
|
|
} |
|
|
|
String busVinSid = planDetails.getBusVinSid(); |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(busVinSid).getData(); |
|
|
|
if (null != busSalesOrderVehicle) { |
|
|
|
String customerNumber = ""; |
|
|
|
//判断财务系统是否有客户
|
|
|
|
Boolean aBoolean = finKingDeeFeignRest.customerExistState(busSalesOrderVehicle.getTemporaryNo()).getData(); |
|
|
|
String linkNo = ""; |
|
|
|
String customerName = ""; |
|
|
|
BusSalesOrderBorrowerDetailsVo borrowerDetailsVo = busSalesOrderBorrowerFeign.fetchDetailsBySid(busSalesOrderVehicle.getBorrowerSid()).getData(); |
|
|
|
if (!aBoolean) { |
|
|
|
// List<BdCustomer> bdCustomers = new ArrayList<>();
|
|
|
|
BdCustomer bdCustomer = new BdCustomer(); |
|
|
|
bdCustomer.setFNumber(busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
String salesOrderSid = planDetails.getSalesOrderSid(); |
|
|
|
BusSalesOrder salesOrder = busSalesOrderFeign.fetchBySid(salesOrderSid).getData(); |
|
|
|
bdCustomer.setFShortName(salesOrder.getContractNo()); |
|
|
|
BasePurchaseSystemDetailsVo data = basePurchaseSystemFeign.fetchDetailsByDeptSid(salesOrder.getPurchaseSystemSid()).getData(); |
|
|
|
bdCustomer.setTOrgIds(data.getOrgCode()); |
|
|
|
if (StringUtils.isNotBlank(busSalesOrderVehicle.getLinkNo())) { |
|
|
|
String vinNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
if (vinNo.length() > 8) { |
|
|
|
linkNo = vinNo.substring(vinNo.length() - 8); |
|
|
|
} else { |
|
|
|
linkNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
} |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + linkNo); |
|
|
|
customerName = borrowerDetailsVo.getBorrowerName() + linkNo; |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
customerName = borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
// bdCustomers.add(bdCustomer);
|
|
|
|
ResultBean<String> resultBean = finKingDeeFeignRest.draftBdCustomer(bdCustomer); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
customerNumber = bdCustomer.getFNumber(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
customerNumber = busSalesOrderVehicle.getTemporaryNo(); |
|
|
|
if (StringUtils.isNotBlank(busSalesOrderVehicle.getLinkNo())) { |
|
|
|
String vinNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
if (vinNo.length() > 8) { |
|
|
|
linkNo = vinNo.substring(vinNo.length() - 8); |
|
|
|
} else { |
|
|
|
linkNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
} |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
customerName = borrowerDetailsVo.getBorrowerName() + linkNo; |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
customerName = borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
voucherDetail.setCustomerCode(customerNumber); |
|
|
|
voucherDetail.setCustomerName(customerName); |
|
|
|
} |
|
|
|
if (v.getReceivablesName().equals("资方逾期利息")) { |
|
|
|
//间还已逾期
|
|
|
|
voucherDetail.setSceneCode(SceneCodeEnum.INDIRECT_VOUCHER2.getCode()); |
|
|
|
} else { |
|
|
|
LoanRepaymentPlanDetailsForOverDue checkOverdue = loanRepaymentPlanDetailsFeign.checkOverDue(planSid).getData(); |
|
|
|
if (checkOverdue != null) { |
|
|
|
if (StringUtils.isNotBlank(checkOverdue.getOverdueState())) { |
|
|
|
if (checkOverdue.getOverdueState().equals("0")) { |
|
|
|
//间还已逾期
|
|
|
|
voucherDetail.setSceneCode(SceneCodeEnum.INDIRECT_VOUCHER2.getCode()); |
|
|
|
} else if (checkOverdue.getOverdueState().equals("1")) { |
|
|
|
//间还未逾期
|
|
|
|
voucherDetail.setSceneCode(SceneCodeEnum.INDIRECT_VOUCHER1.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
voucherDetail.setDataTime(sdf.parse(finCollectionConfirmation.getCollectionDate())); |
|
|
|
} catch (ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
voucherDetail.setAmount(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherDetails.add(voucherDetail); |
|
|
|
collectionVoucher.setVoucherDetails(voucherDetails); |
|
|
|
finKingDeeFeignRest.saveIndirectVoucher(collectionVoucher); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public IPage<AppFinCollectionConfirmationPageVo> getRskCollectionConfirmList(PagerQuery<AppFinCollectionConfirmationQuery> pq) { |
|
|
|
IPage<AppFinCollectionConfirmationQuery> page = PagerUtil.queryToPage(pq); |
|
|
|
String orgPath = pq.getParams().getOrgPath(); |
|
|
|