|
|
@ -96,8 +96,11 @@ 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.loanpushfundhistory.LoanPushFundHistory; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanpushfundhistory.LoanPushFundHistoryFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymenthistory.LoanRepaymentHistory; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymenthistory.LoanRepaymentHistoryFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanPlanDetailsVoForFundVoucher; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetails; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetailsFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetailsForOverDue; |
|
|
@ -204,7 +207,8 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
private BusSalesOrderFeign busSalesOrderFeign; |
|
|
|
@Autowired |
|
|
|
private FinPaymentrecordService finPaymentrecordService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private LoanPushFundHistoryFeign loanPushFundHistoryFeign; |
|
|
|
private QueryWrapper<FinCollectionConfirmation> createQueryWrapper(FinCollectionConfirmationQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
@ -3694,6 +3698,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
return rb.success().setMsg("驳回成功"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean rskCashierConfirm(String sid, String userSid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
FinCollectionConfirmation confirmation = fetchBySid(sid); |
|
|
@ -3715,6 +3720,40 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
confirmation.setPaymentState(3); |
|
|
|
baseMapper.updateById(confirmation); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
String collectionDate = confirmation.getCollectionDate(); |
|
|
|
//-------收款凭证组装---------
|
|
|
|
CollectionVoucher collectionVoucher = new CollectionVoucher(); |
|
|
|
//收款方式key
|
|
|
|
collectionVoucher.setPayTypeCode(confirmation.getCollectionTypeKey()); |
|
|
|
//收款银行账号
|
|
|
|
if (StringUtils.isNotBlank(confirmation.getCollectionBankNum())) { |
|
|
|
collectionVoucher.setBankAccount(confirmation.getCollectionBankNum()); |
|
|
|
} |
|
|
|
SysOrganizationVo organizationVo = sysOrganizationFeign.fetchBySid(confirmation.getUseOrgSid()).getData(); |
|
|
|
if (null != organizationVo) { |
|
|
|
collectionVoucher.setUseOrgCode(organizationVo.getOrgCode()); |
|
|
|
} |
|
|
|
List<CollectionVoucher.CollectionVoucherDetail> voucherDetails = new ArrayList<>(); |
|
|
|
//-------计提资金占用费组装------------------
|
|
|
|
GeneralVoucher generalVoucher = new GeneralVoucher(); |
|
|
|
if (null != organizationVo) { |
|
|
|
generalVoucher.setUseOrgCode(organizationVo.getOrgCode()); |
|
|
|
} |
|
|
|
List<GeneralVoucher.GeneralVoucherDetail> generalVoucherDetails = new ArrayList<>(); |
|
|
|
//--------------推送资金占用费计提记录表--------------------
|
|
|
|
List<LoanPushFundHistory> fundHistoryList = new ArrayList<>(); |
|
|
|
//-------资金占用费出纳确认收入---------
|
|
|
|
CollectionVoucher collectionAfterVoucher = new CollectionVoucher(); |
|
|
|
//收款方式key
|
|
|
|
collectionAfterVoucher.setPayTypeCode(confirmation.getCollectionTypeKey()); |
|
|
|
//收款银行账号
|
|
|
|
if (StringUtils.isNotBlank(confirmation.getCollectionBankNum())) { |
|
|
|
collectionAfterVoucher.setBankAccount(confirmation.getCollectionBankNum()); |
|
|
|
} |
|
|
|
if (null != organizationVo) { |
|
|
|
collectionAfterVoucher.setUseOrgCode(organizationVo.getOrgCode()); |
|
|
|
} |
|
|
|
List<CollectionVoucher.CollectionVoucherDetail> collectionAfterVoucherDetails = new ArrayList<>(); |
|
|
|
//===========================================
|
|
|
|
//查询该申请下的所有待审核的款项明细
|
|
|
|
BigDecimal subscriptionMoneyAll = new BigDecimal("0"); |
|
|
@ -3768,7 +3807,8 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
loanRepaymentHistoryFeign.saveHistoryByEntity(historyEntity); |
|
|
|
} |
|
|
|
if (v.getReceivablesName().equals("资方退还垫款")) { |
|
|
|
pushReturnVoucher(v, sid); |
|
|
|
CollectionVoucher.CollectionVoucherDetail d = getReturnBackMoneyVoucher(v, collectionDate); |
|
|
|
voucherDetails.add(d); |
|
|
|
} |
|
|
|
//推送间还待转付列表
|
|
|
|
if (v.getReceivablesName().equals("月还") || v.getReceivablesName().equals("资方逾期利息")) { |
|
|
@ -3862,14 +3902,48 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
} |
|
|
|
} |
|
|
|
//推送间还月还收款凭证
|
|
|
|
pushIndirectVoucher(v, sid); |
|
|
|
CollectionVoucher.CollectionVoucherDetail d = getDueMoneyAndOverDueMoneyVoucher(v, collectionDate); |
|
|
|
voucherDetails.add(d); |
|
|
|
} |
|
|
|
//认资金占用费消减平台资金占用费
|
|
|
|
if (v.getReceivablesName().equals("资金占用费")) { |
|
|
|
//推送资金占用费计提凭证
|
|
|
|
pushFundVoucher(v, sid); |
|
|
|
//推送资金占用费出纳确认后
|
|
|
|
pushFeeVoucher(v, sid); |
|
|
|
String planSid = ""; |
|
|
|
FinUncollectedReceivablesDetailedJR jr = finUncollectedReceivablesDetailedJRService.fetchBySid(v.getReceivablesSid()); |
|
|
|
if (jr != null) { |
|
|
|
planSid = jr.getBusSid(); |
|
|
|
} |
|
|
|
LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsFeign.fetchDetails(planSid).getData(); |
|
|
|
if (null != planDetails) { |
|
|
|
LoanPlanDetailsVoForFundVoucher f = loanRepaymentPlanDetailsFeign.getLoanPlanDetailsVoForFundVoucher(planDetails.getBusVinSid()); |
|
|
|
if (null != f) { |
|
|
|
List<GeneralVoucher.GeneralVoucherDetail> g = getFundGenralVoucher(planDetails, f); |
|
|
|
if (!g.isEmpty()) { |
|
|
|
g.stream().forEach(gv -> { |
|
|
|
generalVoucherDetails.add(gv); |
|
|
|
}); |
|
|
|
} |
|
|
|
LoanPushFundHistory loanPushFundHistory = new LoanPushFundHistory(); |
|
|
|
if (null != f.getDuePushMoney()) { |
|
|
|
loanPushFundHistory.setFund(f.getDuePushMoney()); |
|
|
|
} |
|
|
|
loanPushFundHistory.setBusVinSid(planDetails.getBusVinSid()); |
|
|
|
loanPushFundHistory.setUseOrgName(planDetails.getUseOrgName()); |
|
|
|
loanPushFundHistory.setUseOrgSid(planDetails.getUseOrgSid()); |
|
|
|
fundHistoryList.add(loanPushFundHistory); |
|
|
|
} |
|
|
|
//推送资金占用费出纳确认后
|
|
|
|
CollectionVoucher.CollectionVoucherDetail d = getFundVoucher(v, collectionDate, planDetails); |
|
|
|
if (null != d) { |
|
|
|
CollectionVoucher.CollectionVoucherDetail v1 = new CollectionVoucher.CollectionVoucherDetail(); |
|
|
|
BeanUtil.copyProperties(d,v1); |
|
|
|
v1.setSceneCode(SceneCodeEnum.FUND_VOUCHER1.getCode()); |
|
|
|
voucherDetails.add(v1); |
|
|
|
CollectionVoucher.CollectionVoucherDetail v2 = new CollectionVoucher.CollectionVoucherDetail(); |
|
|
|
BeanUtil.copyProperties(d,v2); |
|
|
|
v2.setSceneCode(SceneCodeEnum.FUND_VOUCHER2.getCode()); |
|
|
|
collectionAfterVoucherDetails.add(v2); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if ("月还".equals(v.getReceivablesName()) |
|
|
|
|| "垫资方逾期利息".equals(v.getReceivablesName()) |
|
|
@ -3991,9 +4065,670 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
confirmation.setConfirmDate(DateUtil.today()); |
|
|
|
confirmation.setConfirmNameSid(userSid); |
|
|
|
baseMapper.updateById(confirmation); |
|
|
|
//推送凭证业务
|
|
|
|
if (!generalVoucherDetails.isEmpty()) { |
|
|
|
generalVoucher.setVoucherDetails(generalVoucherDetails); |
|
|
|
finKingDeeFeignRest.saveFundVoucher(generalVoucher); |
|
|
|
} |
|
|
|
if (!fundHistoryList.isEmpty()) { |
|
|
|
loanPushFundHistoryFeign.saveHistory(fundHistoryList); |
|
|
|
} |
|
|
|
if (!voucherDetails.isEmpty()) { |
|
|
|
collectionVoucher.setVoucherDetails(voucherDetails); |
|
|
|
finKingDeeFeignRest.saveCollectionVoucher(collectionVoucher); |
|
|
|
} |
|
|
|
if (!collectionAfterVoucherDetails.isEmpty()) { |
|
|
|
collectionAfterVoucher.setVoucherDetails(collectionAfterVoucherDetails); |
|
|
|
finKingDeeFeignRest.saveFeeVoucher(collectionAfterVoucher); |
|
|
|
} |
|
|
|
return rb.success().setMsg("款项确认成功"); |
|
|
|
} |
|
|
|
|
|
|
|
private CollectionVoucher.CollectionVoucherDetail getReturnBackMoneyVoucher(FinSelectedReceivablesDetailedVo v, String collectionDate) { |
|
|
|
String planSid = ""; |
|
|
|
CollectionVoucher.CollectionVoucherDetail voucherDetail = new CollectionVoucher.CollectionVoucherDetail(); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
FinUncollectedReceivablesDetailedJR jr = finUncollectedReceivablesDetailedJRService.fetchBySid(v.getReceivablesSid()); |
|
|
|
if (jr != null) { |
|
|
|
planSid = jr.getBusSid(); |
|
|
|
} |
|
|
|
LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsFeign.fetchDetails(planSid).getData(); |
|
|
|
if (null != planDetails) { |
|
|
|
voucherDetail.setPayCostTitleValue(v.getReceivablesName()); |
|
|
|
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(collectionDate)); |
|
|
|
} catch (ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
voucherDetail.setAmount(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
} |
|
|
|
return voucherDetail; |
|
|
|
} |
|
|
|
|
|
|
|
private CollectionVoucher.CollectionVoucherDetail getFundVoucher(FinSelectedReceivablesDetailedVo v, String collectionDate, LoanRepaymentPlanDetails planDetails) { |
|
|
|
CollectionVoucher.CollectionVoucherDetail voucherDetail = new CollectionVoucher.CollectionVoucherDetail(); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
if (null != planDetails) { |
|
|
|
voucherDetail.setPayCostTitleValue(v.getReceivablesName()); |
|
|
|
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(collectionDate)); |
|
|
|
} catch (ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
voucherDetail.setAmount(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
} |
|
|
|
return voucherDetail; |
|
|
|
} |
|
|
|
|
|
|
|
private List<GeneralVoucher.GeneralVoucherDetail> getFundGenralVoucher(LoanRepaymentPlanDetails planDetails, LoanPlanDetailsVoForFundVoucher v) { |
|
|
|
List<GeneralVoucher.GeneralVoucherDetail> voucherDetails = new ArrayList<>(); |
|
|
|
if (null != planDetails) { |
|
|
|
if (null != v) { |
|
|
|
GeneralVoucher.GeneralVoucherDetail voucherDetail1 = new GeneralVoucher.GeneralVoucherDetail(); |
|
|
|
voucherDetail1.setTimeFlag("1"); |
|
|
|
voucherDetail1.setSceneCode("贷方"); |
|
|
|
voucherDetail1.setDataTime(new DateTime()); |
|
|
|
voucherDetail1.setAmount(v.getDuePushMoney()); |
|
|
|
List<SysOrganizationVo> deptVo = sysOrganizationFeign.selectChildrenListBySid(planDetails.getUseOrgSid()).getData(); |
|
|
|
if (!deptVo.isEmpty()) { |
|
|
|
for (SysOrganizationVo d : deptVo) { |
|
|
|
if (d.getName().equals("金融服务部")) { |
|
|
|
voucherDetail1.setDeptCode(d.getOrgCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
voucherDetails.add(voucherDetail1); |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(planDetails.getBusVinSid()).getData(); |
|
|
|
if (null != busSalesOrderVehicle) { |
|
|
|
BusSalesOrder salesOrder = busSalesOrderFeign.fetchBySid(busSalesOrderVehicle.getSalesOrderSid()).getData(); |
|
|
|
String deptSid = salesOrder.getOrgSid(); |
|
|
|
GeneralVoucher.GeneralVoucherDetail voucherDetail = new GeneralVoucher.GeneralVoucherDetail(); |
|
|
|
voucherDetail.setSceneCode("借方"); |
|
|
|
voucherDetail.setTimeFlag("1"); |
|
|
|
voucherDetail.setDataTime(new DateTime()); |
|
|
|
SysOrganizationVo organizationDeptVo = sysOrganizationFeign.fetchBySid(deptSid).getData(); |
|
|
|
if (null != organizationDeptVo) { |
|
|
|
voucherDetail.setDeptCode(organizationDeptVo.getOrgCode()); |
|
|
|
} |
|
|
|
if (null != salesOrder) { |
|
|
|
if (null != busSalesOrderVehicle) { |
|
|
|
String customerNumber = ""; |
|
|
|
//判断财务系统是否有客户
|
|
|
|
Boolean aBoolean = finKingDeeFeignRest.customerExistState(busSalesOrderVehicle.getTemporaryNo()).getData(); |
|
|
|
String linkNo = ""; |
|
|
|
BusSalesOrderBorrowerDetailsVo borrowerDetailsVo = busSalesOrderBorrowerFeign.fetchDetailsBySid(busSalesOrderVehicle.getBorrowerSid()).getData(); |
|
|
|
if (!aBoolean) { |
|
|
|
// List<BdCustomer> bdCustomers = new ArrayList<>();
|
|
|
|
BdCustomer bdCustomer = new BdCustomer(); |
|
|
|
bdCustomer.setFNumber(busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
bdCustomer.setFShortName(salesOrder.getContractNo()); |
|
|
|
BasePurchaseSystemDetailsVo data = basePurchaseSystemFeign.fetchDetailsByDeptSid(salesOrder.getPurchaseSystemSid()).getData(); |
|
|
|
bdCustomer.setTOrgIds(data.getOrgCode()); |
|
|
|
if (org.apache.commons.lang3.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); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
// bdCustomers.add(bdCustomer);
|
|
|
|
ResultBean<String> resultBean = finKingDeeFeignRest.draftBdCustomer(bdCustomer); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
customerNumber = bdCustomer.getFNumber(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
customerNumber = busSalesOrderVehicle.getTemporaryNo(); |
|
|
|
} |
|
|
|
voucherDetail.setCustomerCode(customerNumber); |
|
|
|
} |
|
|
|
} |
|
|
|
voucherDetail.setAmount(v.getDuePushMoney()); |
|
|
|
voucherDetails.add(voucherDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return voucherDetails; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private CollectionVoucher.CollectionVoucherDetail getDueMoneyAndOverDueMoneyVoucher(FinSelectedReceivablesDetailedVo v, String collectionDate) { |
|
|
|
String planSid = ""; |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
CollectionVoucher.CollectionVoucherDetail voucherDetail = new CollectionVoucher.CollectionVoucherDetail(); |
|
|
|
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) { |
|
|
|
voucherDetail.setPayCostTitleValue(v.getReceivablesName()); |
|
|
|
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 (null != planDetails.getOweState()) { |
|
|
|
if (planDetails.getOweState() == 0) { |
|
|
|
voucherDetail.setSceneCode(SceneCodeEnum.INDIRECT_VOUCHER2.getCode()); |
|
|
|
} else if (planDetails.getOweState() == 1) { |
|
|
|
voucherDetail.setSceneCode(SceneCodeEnum.INDIRECT_VOUCHER1.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
voucherDetail.setDataTime(sdf.parse(collectionDate)); |
|
|
|
} catch (ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
voucherDetail.setAmount(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
} |
|
|
|
return voucherDetail; |
|
|
|
} |
|
|
|
|
|
|
|
// public ResultBean rskCashierConfirm(String sid, String userSid) {
|
|
|
|
// ResultBean rb = ResultBean.fireFail();
|
|
|
|
// FinCollectionConfirmation confirmation = fetchBySid(sid);
|
|
|
|
// if (confirmation == null) {
|
|
|
|
// return rb.setMsg("该申请不存在");
|
|
|
|
// }
|
|
|
|
// if ("3".equals(confirmation.getAuditState())) {
|
|
|
|
// return rb.setMsg("该申请已审核通过,不允许重复操作");
|
|
|
|
// }
|
|
|
|
// if ("2".equals(confirmation.getAuditState())) {
|
|
|
|
// return rb.setMsg("该申请已驳回,不允许确认");
|
|
|
|
// }
|
|
|
|
// if ("4".equals(confirmation.getAuditState())) {
|
|
|
|
// return rb.setMsg("该申请已撤回,不允许确认");
|
|
|
|
// }
|
|
|
|
// String collectionTypeKey = confirmation.getCollectionTypeKey(); //收款方式
|
|
|
|
// confirmation.setAuditState(3);
|
|
|
|
// //与收款金额作比较:更新认款状态 1未认款/2部分认款/3已认款
|
|
|
|
// confirmation.setPaymentState(3);
|
|
|
|
// baseMapper.updateById(confirmation);
|
|
|
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
// //===========================================
|
|
|
|
// //查询该申请下的所有待审核的款项明细
|
|
|
|
// BigDecimal subscriptionMoneyAll = new BigDecimal("0");
|
|
|
|
// List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVos = finSelectedReceivablesDetailedService.fetchByAuditState(sid, 1);
|
|
|
|
// if (finSelectedReceivablesDetailedVos.size() > 0) {
|
|
|
|
// FinCollectionConfirmation finalConfirmation = confirmation;
|
|
|
|
// finSelectedReceivablesDetailedVos.stream().forEach(v -> {
|
|
|
|
// //已选款项明细sid
|
|
|
|
// String selectSid = v.getSid();
|
|
|
|
// FinSelectedReceivablesDetailed finSelectedReceivablesDetailed = finSelectedReceivablesDetailedService.fetchBySid(selectSid);
|
|
|
|
// //更新已选款项明细的审核状态1待审核/2已驳回/3已审核
|
|
|
|
// finSelectedReceivablesDetailed.setAuditState(3);
|
|
|
|
// //更新审核时间
|
|
|
|
// finSelectedReceivablesDetailed.setAuditDate(DateUtil.today());
|
|
|
|
// finSelectedReceivablesDetailedService.updateById(finSelectedReceivablesDetailed);
|
|
|
|
// //推送间还认款记录
|
|
|
|
// if (v.getReceivablesName().equals("月还")) {
|
|
|
|
// LoanRepaymentHistory historyEntity = new LoanRepaymentHistory();
|
|
|
|
// historyEntity.setPlanDetailSid(v.getReceivablesSid());
|
|
|
|
// LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsFeign.fetchDetails(v.getReceivablesSid()).getData();
|
|
|
|
// if (null != planDetails) {
|
|
|
|
// historyEntity.setScheduleSid(planDetails.getScheduleSid());
|
|
|
|
// historyEntity.setSkdBillNo(finalConfirmation.getBillNo());
|
|
|
|
// historyEntity.setUpdateTime(new DateTime());
|
|
|
|
// historyEntity.setUpdateState("1");
|
|
|
|
// historyEntity.setDataTime(new DateTime());
|
|
|
|
// historyEntity.setBuckle("审核通过");
|
|
|
|
// historyEntity.setBuckleKey("003");
|
|
|
|
// historyEntity.setActualMoney(new BigDecimal(v.getSubscriptionMoney()));
|
|
|
|
// try {
|
|
|
|
// Date collDate = sdf.parse(finalConfirmation.getCollectionDate());
|
|
|
|
// historyEntity.setActualDate(collDate);
|
|
|
|
// if (planDetails.getDueDate().compareTo(collDate) >= 0) {
|
|
|
|
// //未逾期
|
|
|
|
// Calendar cal_1 = Calendar.getInstance();// 使用默认时区和语言环境获得一个日历
|
|
|
|
// cal_1.setTime(planDetails.getDueDate());
|
|
|
|
// cal_1.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
|
// historyEntity.setPrepareDate(cal_1.getTime());
|
|
|
|
// } else {
|
|
|
|
// //已逾期
|
|
|
|
// historyEntity.setPrepareDate(new DateTime());
|
|
|
|
// }
|
|
|
|
// } catch (ParseException e) {
|
|
|
|
// e.printStackTrace();
|
|
|
|
// }
|
|
|
|
// historyEntity.setReturnWay("间还");
|
|
|
|
// historyEntity.setReturnWayKey("02");
|
|
|
|
// historyEntity.setPaymentState("待转付");
|
|
|
|
// historyEntity.setPaymentStateKey("001");
|
|
|
|
// }
|
|
|
|
// loanRepaymentHistoryFeign.saveHistoryByEntity(historyEntity);
|
|
|
|
// }
|
|
|
|
// if (v.getReceivablesName().equals("资方退还垫款")) {
|
|
|
|
// pushReturnVoucher(v, sid);
|
|
|
|
// }
|
|
|
|
// //推送间还待转付列表
|
|
|
|
// if (v.getReceivablesName().equals("月还") || v.getReceivablesName().equals("资方逾期利息")) {
|
|
|
|
// String planSid = "";
|
|
|
|
// 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) {
|
|
|
|
// if (v.getReceivablesName().equals("月还")) {
|
|
|
|
// if (null != planDetails.getPaymentMoney()) {
|
|
|
|
// if (planDetails.getPaymentMoney().compareTo(BigDecimal.ZERO) == 1) {
|
|
|
|
// BigDecimal paymentMoney = planDetails.getPaymentMoney();
|
|
|
|
// String subscriptionMoney = v.getSubscriptionMoney();
|
|
|
|
// BigDecimal subtract = paymentMoney.subtract(new BigDecimal(subscriptionMoney));
|
|
|
|
// planDetails.setPaymentMoney(subtract);
|
|
|
|
// loanRepaymentPlanDetailsFeign.updateByEntity(planDetails);
|
|
|
|
// String orderSid = planDetails.getSalesOrderSid();
|
|
|
|
// ResultBean<LoanFinBank> bankResultBean = loanFinBankFeign.reAdvancesByOrderSid(orderSid);
|
|
|
|
// if (bankResultBean.getData() != null) {
|
|
|
|
// LoanFinBank loanFinBank = bankResultBean.getData();
|
|
|
|
// if (null != loanFinBank.getReAdvances()) {
|
|
|
|
// if (loanFinBank.getReAdvances() == 1) {
|
|
|
|
// FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
|
|
|
|
// jr.setCreateBySid(userSid);
|
|
|
|
// SysUserVo userVo = sysUserFeign.fetchBySid(userSid).getData();
|
|
|
|
// jr.setCreateByName(userVo.getName());
|
|
|
|
// jr.setBusSid(planSid);
|
|
|
|
// jr.setCurrentReceivableMoney(new BigDecimal(v.getSubscriptionMoney()));
|
|
|
|
// jr.setReveivableMoney(new BigDecimal(v.getSubscriptionMoney()));
|
|
|
|
// jr.setPayCostTitleKey("007");
|
|
|
|
// jr.setPayCostTitleValue("资方退还垫款");
|
|
|
|
// jr.setOrgSidPath(planDetails.getOrgSidPath());
|
|
|
|
// jr.setUseOrgName(planDetails.getUseOrgName());
|
|
|
|
// jr.setUseOrgSid(planDetails.getUseOrgSid());
|
|
|
|
// jr.setStaffDeptName(planDetails.getDept());
|
|
|
|
// jr.setStaffName(planDetails.getStaffName());
|
|
|
|
// jr.setStaffDeptSid(planDetails.getDeptSid());
|
|
|
|
// jr.setStaffUserSid(planDetails.getSalesUserSid());
|
|
|
|
// finUncollectedReceivablesDetailedJRService.insert(jr);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// if (v.getReceivablesName().equals("资方逾期利息")) {
|
|
|
|
// if (null != planDetails.getPaymentInterest()) {
|
|
|
|
// if (planDetails.getPaymentInterest().compareTo(BigDecimal.ZERO) == 1) {
|
|
|
|
// BigDecimal paymentInterest = planDetails.getPaymentInterest();
|
|
|
|
// String subscriptionMoney = v.getSubscriptionMoney();
|
|
|
|
// BigDecimal subtract = paymentInterest.subtract(new BigDecimal(subscriptionMoney));
|
|
|
|
// planDetails.setPaymentInterest(subtract);
|
|
|
|
// BigDecimal paymentMoney = planDetails.getPaymentMoney();
|
|
|
|
// BigDecimal subtract2 = paymentMoney.subtract(new BigDecimal(subscriptionMoney));
|
|
|
|
// planDetails.setPaymentMoney(subtract2);
|
|
|
|
// loanRepaymentPlanDetailsFeign.updateByEntity(planDetails);
|
|
|
|
// String orderSid = planDetails.getSalesOrderSid();
|
|
|
|
// ResultBean<LoanFinBank> bankResultBean = loanFinBankFeign.reAdvancesByOrderSid(orderSid);
|
|
|
|
// if (bankResultBean.getData() != null) {
|
|
|
|
// LoanFinBank loanFinBank = bankResultBean.getData();
|
|
|
|
// if (null != loanFinBank.getReAdvances()) {
|
|
|
|
// if (loanFinBank.getReAdvances() == 1) {
|
|
|
|
// FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR();
|
|
|
|
// jr.setCreateBySid(userSid);
|
|
|
|
// SysUserVo userVo = sysUserFeign.fetchBySid(userSid).getData();
|
|
|
|
// jr.setCreateByName(userVo.getName());
|
|
|
|
// jr.setBusSid(planSid);
|
|
|
|
// jr.setCurrentReceivableMoney(new BigDecimal(v.getSubscriptionMoney()));
|
|
|
|
// jr.setReveivableMoney(new BigDecimal(v.getSubscriptionMoney()));
|
|
|
|
// jr.setPayCostTitleKey("007");
|
|
|
|
// jr.setPayCostTitleValue("资方退还垫款");
|
|
|
|
// jr.setOrgSidPath(planDetails.getOrgSidPath());
|
|
|
|
// jr.setUseOrgName(planDetails.getUseOrgName());
|
|
|
|
// jr.setUseOrgSid(planDetails.getUseOrgSid());
|
|
|
|
// jr.setStaffDeptName(planDetails.getDept());
|
|
|
|
// jr.setStaffName(planDetails.getStaffName());
|
|
|
|
// jr.setStaffDeptSid(planDetails.getDeptSid());
|
|
|
|
// jr.setStaffUserSid(planDetails.getSalesUserSid());
|
|
|
|
// finUncollectedReceivablesDetailedJRService.insert(jr);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// //推送间还月还收款凭证
|
|
|
|
// pushIndirectVoucher(v, sid);
|
|
|
|
// }
|
|
|
|
// //认资金占用费消减平台资金占用费
|
|
|
|
// if (v.getReceivablesName().equals("资金占用费")) {
|
|
|
|
// //推送资金占用费计提凭证
|
|
|
|
// pushFundVoucher(v, sid);
|
|
|
|
// //推送资金占用费出纳确认后
|
|
|
|
// pushFeeVoucher(v, sid);
|
|
|
|
// }
|
|
|
|
// if ("月还".equals(v.getReceivablesName())
|
|
|
|
// || "垫资方逾期利息".equals(v.getReceivablesName())
|
|
|
|
// || "资金占用费".equals(v.getReceivablesName())
|
|
|
|
// || "结清时资方逾期利息".equals(v.getReceivablesName())
|
|
|
|
// || "资方逾期利息".equals(v.getReceivablesName())
|
|
|
|
// || "名义价".equals(v.getReceivablesName())
|
|
|
|
// || "合同违约金".equals(v.getReceivablesName())
|
|
|
|
// || "其他费用".equals(v.getReceivablesName())
|
|
|
|
// ) {
|
|
|
|
// BigDecimal unall = BigDecimal.ZERO;//应收
|
|
|
|
// String busVinSid = "";
|
|
|
|
// BigDecimal yAll = BigDecimal.ZERO;
|
|
|
|
// FinUncollectedReceivablesDetailedJR finUncollectedReceivablesDetailedJR = finUncollectedReceivablesDetailedJRService.fetchBySid(v.getReceivablesSid());
|
|
|
|
// if (finUncollectedReceivablesDetailedJR == null) {
|
|
|
|
// LoanRepaymentPlanDetails loanRepaymentPlanDetails = baseMapper.selectByBss(v.getReceivablesSid());
|
|
|
|
// if (loanRepaymentPlanDetails != null) {
|
|
|
|
// busVinSid = loanRepaymentPlanDetails.getBusVinSid();
|
|
|
|
// BigDecimal a1 = baseMapper.selectA1(busVinSid);
|
|
|
|
//// BigDecimal a2 = baseMapper.selectA2(busVinSid);
|
|
|
|
// List<String> stringList = baseMapper.selectBys(loanRepaymentPlanDetails.getBusVinSid());
|
|
|
|
// stringList.removeAll(Collections.singleton(null));
|
|
|
|
// BigDecimal a3 = BigDecimal.ZERO;
|
|
|
|
// if (!stringList.isEmpty()) {
|
|
|
|
// a3 = baseMapper.selectA3(stringList);
|
|
|
|
// }
|
|
|
|
// unall = unall.add(a1).add(a3);
|
|
|
|
// List<String> unList = baseMapper.selectUnA(busVinSid);
|
|
|
|
// unList.removeAll(Collections.singleton(null));
|
|
|
|
// BigDecimal a4 = BigDecimal.ZERO;
|
|
|
|
// if (!unList.isEmpty()) {
|
|
|
|
// //已收
|
|
|
|
// a4 = baseMapper.selectA4(unList);
|
|
|
|
// }
|
|
|
|
// BigDecimal a5 = BigDecimal.ZERO;
|
|
|
|
// if (!stringList.isEmpty()) {
|
|
|
|
// a5 = baseMapper.selectA5(stringList);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// yAll = yAll.add(a4).add(a5);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// } else {
|
|
|
|
// LoanRepaymentPlanDetails loanRepaymentPlanDetails = baseMapper.selectByBss(finUncollectedReceivablesDetailedJR.getBusSid());
|
|
|
|
// if (loanRepaymentPlanDetails != null) {
|
|
|
|
// busVinSid = loanRepaymentPlanDetails.getBusVinSid();
|
|
|
|
// List<String> stringList = baseMapper.selectBys(loanRepaymentPlanDetails.getBusVinSid());
|
|
|
|
// stringList.removeAll(Collections.singleton(null));
|
|
|
|
// BigDecimal a3 = BigDecimal.ZERO;
|
|
|
|
// if (!stringList.isEmpty()) {
|
|
|
|
// a3 = baseMapper.selectA3(stringList);
|
|
|
|
// }
|
|
|
|
// BigDecimal a1 = baseMapper.selectA1(busVinSid);
|
|
|
|
// unall = unall.add(a1).add(a3);
|
|
|
|
// List<String> unList = baseMapper.selectUnA(busVinSid);
|
|
|
|
// //已收
|
|
|
|
// unList.removeAll(Collections.singleton(null));
|
|
|
|
// BigDecimal a4 = BigDecimal.ZERO;
|
|
|
|
// if (!unList.isEmpty()) {
|
|
|
|
// //已收
|
|
|
|
// a4 = baseMapper.selectA4(unList);
|
|
|
|
// }
|
|
|
|
// BigDecimal a5 = BigDecimal.ZERO;
|
|
|
|
// if (!stringList.isEmpty()) {
|
|
|
|
// a5 = baseMapper.selectA5(stringList);
|
|
|
|
// }
|
|
|
|
// yAll = yAll.add(a4).add(a5);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// if (yAll.compareTo(unall) >= 0) {
|
|
|
|
// LoanSettleApply loanSettleApply = baseMapper.selectApply(busVinSid);
|
|
|
|
// LoanSettleBankCost loanSettleBankCost = baseMapper.selectMainSid(loanSettleApply.getSid());
|
|
|
|
// LoanFinBank loanFinBank = baseMapper.selectByBanks(loanSettleApply.getSaleOrderSid());
|
|
|
|
// //推送出纳付款
|
|
|
|
// FinPaymentrecordDto finPaymentrecordDto = new FinPaymentrecordDto();
|
|
|
|
// finPaymentrecordDto.setApplySid("");
|
|
|
|
// finPaymentrecordDto.setPayCompanySid("");
|
|
|
|
// finPaymentrecordDto.setPayType(1);
|
|
|
|
// finPaymentrecordDto.setCreateOrgSid(loanSettleApply.getUseOrgSid());
|
|
|
|
// finPaymentrecordDto.setUseOrgSid(loanSettleApply.getUseOrgSid());
|
|
|
|
// /*finPaymentrecordDto.setCostTypeKey("007");
|
|
|
|
// finPaymentrecordDto.setCostTypeValue("垫款");
|
|
|
|
// finPaymentrecordDto.setCostTitleKey("008");*/
|
|
|
|
// finPaymentrecordDto.setCostTitleValue("资方结清款");
|
|
|
|
// /* if(loanFinBank != null){
|
|
|
|
// finPaymentrecordDto.setReceiveBank(loanFinBank.getBankCollectionAcc());
|
|
|
|
// finPaymentrecordDto.setReceiveBankAccount(loanFinBank.getBankCollectionNum());
|
|
|
|
// }*/
|
|
|
|
//
|
|
|
|
// finPaymentrecordDto.setReceiveCompany("");
|
|
|
|
// finPaymentrecordDto.setCost(loanSettleBankCost.getBankSettlePrice().toString());
|
|
|
|
// finPaymentrecordDto.setAccountsReceive(loanSettleBankCost.getBankSettlePrice().toString());
|
|
|
|
// finPaymentrecordDto.setBusSid(loanSettleApply.getSid());
|
|
|
|
// finPaymentrecordDto.setPayCode("");
|
|
|
|
// finPaymentrecordDto.setCreateBySid(loanSettleApply.getCreateBySid());
|
|
|
|
// finPaymentrecordDto.setUpdateBySid(loanSettleApply.getCreateBySid());
|
|
|
|
// finPaymentrecordDto.setRemarks(loanSettleApply.getRemarks());
|
|
|
|
// finPaymentrecordDto.setPurchaseSystemSid("");
|
|
|
|
// finPaymentrecordDto.setPurchaseSystemName("");
|
|
|
|
// finPaymentrecordService.saveDto(finPaymentrecordDto).getData();
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// //查询该申请已认款金额总数
|
|
|
|
// subscriptionMoneyAll = finSelectedReceivablesDetailedVos.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
// }
|
|
|
|
// confirmation = fetchBySid(sid);
|
|
|
|
// //更新收款申请的余额以及审核状态
|
|
|
|
// BigDecimal balanceBigDecimal = confirmation.getCollectionMoney().subtract(subscriptionMoneyAll);
|
|
|
|
// confirmation.setBalance(balanceBigDecimal);
|
|
|
|
// //查询当前登录人信息并更新审核人和审核时间
|
|
|
|
// ResultBean<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(userSid);
|
|
|
|
// if (userVoResultBean.getData() != null) {
|
|
|
|
// confirmation.setConfirmName(userVoResultBean.getData().getName());
|
|
|
|
// }
|
|
|
|
// confirmation.setConfirmDate(DateUtil.today());
|
|
|
|
// confirmation.setConfirmNameSid(userSid);
|
|
|
|
// baseMapper.updateById(confirmation);
|
|
|
|
// return rb.success().setMsg("款项确认成功");
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
private void pushFundVoucher(FinSelectedReceivablesDetailedVo v, String sid) { |
|
|
|
String planSid = ""; |
|
|
@ -4317,7 +5052,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
voucherDetail.setCustomerCode(customerNumber); |
|
|
|
voucherDetail.setCustomerName(customerName); |
|
|
|
} |
|
|
|
if (null !=planDetails.getOweState()){ |
|
|
|
if (null != planDetails.getOweState()) { |
|
|
|
if (planDetails.getOweState() == 0) { |
|
|
|
voucherDetail.setSceneCode(SceneCodeEnum.INDIRECT_VOUCHER2.getCode()); |
|
|
|
} else if (planDetails.getOweState() == 1) { |
|
|
|