|
|
@ -117,6 +117,7 @@ import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.LoanRepaymentSchedule; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.LoanRepaymentScheduleFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrestorereportapply.AlrepaidAndArrVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrestorereportapply.LoanRestoreReportApplyFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanreturnvehledger.LoanReturnVehLedger; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansettleapply.LoanSettleApplyFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansettleapply.SettleFinVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutions; |
|
|
@ -4379,15 +4380,12 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
} |
|
|
|
List<CollectionVoucher.CollectionVoucherDetail> collectionAfterVoucherDetails = new ArrayList<>(); |
|
|
|
//----------------------------------------------------------
|
|
|
|
//--------------------------推送赎回款
|
|
|
|
//--------------------------推送赎回款---二次销售收款
|
|
|
|
Voucher voucher = new Voucher(); |
|
|
|
if(organizationVo != null){ |
|
|
|
voucher.setAccountBook(organizationVo.getOrgCode()); |
|
|
|
voucher.setVoucherNo(organizationVo.getOrgCode()); |
|
|
|
} |
|
|
|
List<Voucher.VoucherResultDetailDto> voucherResultDetailDtos = new ArrayList<>(); |
|
|
|
AtomicReference<List<Voucher.VoucherResultDetailDto>> resultRef = |
|
|
|
new AtomicReference<>(voucherResultDetailDtos); |
|
|
|
|
|
|
|
//===========================================
|
|
|
|
//查询该申请下的所有待审核的款项明细
|
|
|
@ -4658,9 +4656,6 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
CollectionVoucher.CollectionVoucherDetail d = getBalanceMoneyVoucher(v, collectionDate); |
|
|
|
voucherDetails.add(d); |
|
|
|
} |
|
|
|
if("收回车辆费用".equals(v.getReceivablesName())){ |
|
|
|
resultRef.set(getAll(finalConfirmation, v, collectionDate)); |
|
|
|
} |
|
|
|
}); |
|
|
|
//查询该申请已认款金额总数
|
|
|
|
subscriptionMoneyAll = finSelectedReceivablesDetailedVos.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
@ -4677,6 +4672,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
confirmation.setConfirmDate(DateUtil.today()); |
|
|
|
confirmation.setConfirmNameSid(userSid); |
|
|
|
baseMapper.updateById(confirmation); |
|
|
|
pushToRiskToFin(confirmation,finSelectedReceivablesDetailedVos,collectionDate,voucher); |
|
|
|
//推送凭证业务
|
|
|
|
if (!generalVoucherDetails.isEmpty()) { |
|
|
|
generalVoucher.setVoucherDetails(generalVoucherDetails); |
|
|
@ -4693,16 +4689,241 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
collectionAfterVoucher.setVoucherDetails(collectionAfterVoucherDetails); |
|
|
|
finKingDeeFeignRest.saveFeeVoucher(collectionAfterVoucher); |
|
|
|
} |
|
|
|
if(resultRef.get() != null){ |
|
|
|
voucherResultDetailDtos = resultRef.get(); |
|
|
|
if(!voucherResultDetailDtos.isEmpty()){ |
|
|
|
voucher.setResultDetails(voucherResultDetailDtos); |
|
|
|
finKingDeeFeignRest.saveVoucher(voucher); |
|
|
|
|
|
|
|
|
|
|
|
return rb.success().setMsg("款项确认成功"); |
|
|
|
} |
|
|
|
|
|
|
|
private void pushToRiskToFin(FinCollectionConfirmation finalConfirmation, List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVoList, String collectionDate,Voucher voucher) { |
|
|
|
List<Voucher.VoucherResultDetailDto> list = new ArrayList<>(); |
|
|
|
List<Voucher.VoucherResultDetailDto> list2 = new ArrayList<>(); |
|
|
|
BigDecimal all = BigDecimal.ZERO;//赎回
|
|
|
|
BigDecimal all2 = BigDecimal.ZERO;//二次销售
|
|
|
|
BigDecimal otherMoney = BigDecimal.ZERO; |
|
|
|
String payType = ""; |
|
|
|
DictCommonVo dictCommonVo = dictCommonFeign.selectBykey(finalConfirmation.getCollectionTypeKey(), "payVoucherType").getData(); |
|
|
|
if (null != dictCommonVo) { |
|
|
|
SysMappingListInfoQuery query = new SysMappingListInfoQuery(); |
|
|
|
query.setDictSid(dictCommonVo.getSid()); |
|
|
|
List<SysMappingInfoVo> data = sysMappingFeign.selectMappingListInfo(query).getData(); |
|
|
|
if (!data.isEmpty()) { |
|
|
|
SysMappingInfoVo sysMappingInfoVo = data.get(0); |
|
|
|
payType = sysMappingInfoVo.getMap_itemKey(); |
|
|
|
} |
|
|
|
} |
|
|
|
SysOrganizationVo deptVo = sysOrganizationFeign.fetchBySid(finalConfirmation.getCreateDeptSid()).getData(); |
|
|
|
String customerNumber = ""; |
|
|
|
for (int i = 0; i <finSelectedReceivablesDetailedVoList.size() ; i++) { |
|
|
|
FinSelectedReceivablesDetailedVo v = finSelectedReceivablesDetailedVoList.get(i); |
|
|
|
FinUncollectedReceivablesDetailed finUncollectedReceivablesDetailed = finUncollectedReceivablesDetailedService.fetchBySid(v.getReceivablesSid()); |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(finUncollectedReceivablesDetailed.getBusVinSid()).getData(); |
|
|
|
BusSalesOrder salesOrder = busSalesOrderFeign.fetchBySid(busSalesOrderVehicle.getSalesOrderSid()).getData(); |
|
|
|
if (salesOrder != null && busSalesOrderVehicle != null) { |
|
|
|
//判断财务系统是否有客户
|
|
|
|
Boolean aBoolean = finKingDeeService.customerExistState(busSalesOrderVehicle.getTemporaryNo()).getData(); |
|
|
|
String linkNo = ""; |
|
|
|
BusSalesOrderBorrowerDetailsVo borrowerDetailsVo = busSalesOrderBorrowerFeign.fetchDetailsBySid(busSalesOrderVehicle.getBorrowerSid()).getData(); |
|
|
|
if (!aBoolean) { |
|
|
|
BdCustomer bdCustomer = new BdCustomer(); |
|
|
|
bdCustomer.setFNumber(busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
bdCustomer.setFShortName(salesOrder.getContractNo()); |
|
|
|
if (StringUtils.isNotBlank(salesOrder.getPurchaseSystemSid())) { |
|
|
|
BasePurchaseSystemDetailsVo data = basePurchaseSystemFeign.fetchDetailsByDeptSid(salesOrder.getPurchaseSystemSid()).getData(); |
|
|
|
bdCustomer.setTOrgIds(data.getOrgCode()); |
|
|
|
} |
|
|
|
bdCustomer.setTOrgIds(deptVo.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); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
ResultBean<String> resultBean = finKingDeeFeignRest.draftBdCustomer(bdCustomer); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
customerNumber = bdCustomer.getFNumber(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
customerNumber = busSalesOrderVehicle.getTemporaryNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
if("9".equals(busSalesOrderVehicle.getRiskState().toString())){//赎回中-赎回凭证
|
|
|
|
////营业费用_催收费用 上门催收费用--收回车辆费用(赎回通过后推送的费用)
|
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoJf2 = new Voucher.VoucherResultDetailDto(); |
|
|
|
if("收回车辆费用".equals(v.getReceivablesName())){ |
|
|
|
all = all.add(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherResultDetailDtoJf2.setSummary("收款-赎回费用"); |
|
|
|
voucherResultDetailDtoJf2.setSubjectNo("6601.32.05"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoJf2.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoJf2.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoJf2.setDebit(new BigDecimal(v.getSubscriptionMoney()).negate().toString()); |
|
|
|
list.add(voucherResultDetailDtoJf2); |
|
|
|
} |
|
|
|
//预提费用 待确认逾期利息 待确认途期利息--资金占用费转收入
|
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoJf3 = new Voucher.VoucherResultDetailDto(); |
|
|
|
if("资金占用费".equals(v.getReceivablesName())){//借方
|
|
|
|
voucherResultDetailDtoJf3.setSummary("资金占用费转收入"); |
|
|
|
voucherResultDetailDtoJf3.setSubjectNo("2191.05.00"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoJf3.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoJf3.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoJf3.setDebit(v.getSubscriptionMoney()); |
|
|
|
list.add(voucherResultDetailDtoJf3); |
|
|
|
} |
|
|
|
//应收贷款车欠款_待处理欠款_扣回车辆--月还/资方逾期利息
|
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf = new Voucher.VoucherResultDetailDto(); |
|
|
|
if ("月还".equals(v.getReceivablesName()) || "资方逾期利息".equals(v.getReceivablesName())){ |
|
|
|
all = all.add(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherResultDetailDtoDf.setSummary("收款-赎回款"); |
|
|
|
voucherResultDetailDtoDf.setSubjectNo("1201.03.01"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDf.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDf.setCredit(v.getSubscriptionMoney()); |
|
|
|
list.add(voucherResultDetailDtoDf); |
|
|
|
} |
|
|
|
|
|
|
|
//应收贷款车欠款_到期欠款_逾期利息--资金占用费
|
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf2 = new Voucher.VoucherResultDetailDto(); |
|
|
|
if("资金占用费".equals(v.getReceivablesName())){ |
|
|
|
all = all.add(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherResultDetailDtoDf2.setSummary("收款-赎回款"); |
|
|
|
voucherResultDetailDtoDf2.setSubjectNo("1201.02.03"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf2.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDf2.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDf2.setCredit(v.getSubscriptionMoney()); |
|
|
|
list.add(voucherResultDetailDtoDf2); |
|
|
|
} |
|
|
|
//资金占用费转收入--其他业务收入_消贷收入_消贷利息
|
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf3 = new Voucher.VoucherResultDetailDto(); |
|
|
|
if("资金占用费".equals(v.getReceivablesName())){//贷方
|
|
|
|
voucherResultDetailDtoDf3.setSummary("资金占用费转收入"); |
|
|
|
voucherResultDetailDtoDf3.setSubjectNo("6002.01.17"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf3.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDf3.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDf3.setCredit(v.getSubscriptionMoney()); |
|
|
|
list.add(voucherResultDetailDtoDf3); |
|
|
|
} |
|
|
|
}else if("10".equals(busSalesOrderVehicle.getRiskState().toString())){//二次销售中-二次销售凭证
|
|
|
|
|
|
|
|
if ("月还".equals(v.getReceivablesName()) || "资方逾期利息".equals(v.getReceivablesName())){ |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf = new Voucher.VoucherResultDetailDto(); |
|
|
|
all2 = all2.add(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherResultDetailDtoDf.setSummary("***扣回车辆再次销售款"); |
|
|
|
voucherResultDetailDtoDf.setSubjectNo("1201.03.01"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDf.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDf.setCredit(v.getSubscriptionMoney()); |
|
|
|
list2.add(voucherResultDetailDtoDf); |
|
|
|
} |
|
|
|
|
|
|
|
if("资金占用费".equals(v.getReceivablesName())){ |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf2 = new Voucher.VoucherResultDetailDto(); |
|
|
|
all2 = all2.add(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherResultDetailDtoDf2.setSummary("***扣回车辆再次销售款"); |
|
|
|
voucherResultDetailDtoDf2.setSubjectNo("1201.02.03"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf2.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDf2.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDf2.setCredit(v.getSubscriptionMoney()); |
|
|
|
list2.add(voucherResultDetailDtoDf2); |
|
|
|
} |
|
|
|
|
|
|
|
if("预计资方结清费用".equals(v.getReceivablesName())){ |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf3 = new Voucher.VoucherResultDetailDto(); |
|
|
|
all2 = all2.add(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherResultDetailDtoDf3.setSummary("**扣回车辆再次销售-资方结清费用"); |
|
|
|
voucherResultDetailDtoDf3.setSubjectNo("1201.03.01"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf3.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDf3.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDf3.setCredit(v.getSubscriptionMoney()); |
|
|
|
list2.add(voucherResultDetailDtoDf3); |
|
|
|
} |
|
|
|
|
|
|
|
if("停车费".equals(v.getReceivablesName())){ |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoJf2 = new Voucher.VoucherResultDetailDto(); |
|
|
|
all2 = all2.subtract(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherResultDetailDtoJf2.setSummary("**扣回车辆再次销售-停车费"); |
|
|
|
voucherResultDetailDtoJf2.setSubjectNo("6601.32.02"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoJf2.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoJf2.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoJf2.setDebit(new BigDecimal(v.getSubscriptionMoney()).negate().toString()); |
|
|
|
list2.add(voucherResultDetailDtoJf2); |
|
|
|
} |
|
|
|
if("车辆违章费用".equals(v.getReceivablesName()) || "年检费".equals(v.getReceivablesName()) || |
|
|
|
"保险费".equals(v.getReceivablesName()) || "过户费".equals(v.getReceivablesName()) |
|
|
|
){ |
|
|
|
otherMoney = otherMoney.add(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//客户赎回收款
|
|
|
|
if(all.compareTo(BigDecimal.ZERO)>0){ |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoJf = new Voucher.VoucherResultDetailDto(); |
|
|
|
if (StringUtils.isNotBlank(finalConfirmation.getCollectionBankNum())) { |
|
|
|
voucherResultDetailDtoJf.setBankAccount(finalConfirmation.getCollectionBankNum()); |
|
|
|
} |
|
|
|
voucherResultDetailDtoJf.setSubjectNo(payType); |
|
|
|
voucherResultDetailDtoJf.setSummary("收款-赎回款" + "(" + collectionDate + ")"); |
|
|
|
voucherResultDetailDtoJf.setDebit(String.valueOf(all)); |
|
|
|
list.add(voucherResultDetailDtoJf); |
|
|
|
} |
|
|
|
|
|
|
|
if(otherMoney.compareTo(BigDecimal.ZERO)>0){ |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoJf2 = new Voucher.VoucherResultDetailDto(); |
|
|
|
all2 = all2.subtract(otherMoney); |
|
|
|
voucherResultDetailDtoJf2.setSummary("**扣回车辆再次销售-费用(违章、年检、保险、过户)"); |
|
|
|
voucherResultDetailDtoJf2.setSubjectNo("1133.10.00"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoJf2.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoJf2.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoJf2.setDebit(otherMoney.negate().toString()); |
|
|
|
list2.add(voucherResultDetailDtoJf2); |
|
|
|
} |
|
|
|
if(all2.compareTo(BigDecimal.ZERO)>0){ |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoJf = new Voucher.VoucherResultDetailDto(); |
|
|
|
if (StringUtils.isNotBlank(finalConfirmation.getCollectionBankNum())) { |
|
|
|
voucherResultDetailDtoJf.setBankAccount(finalConfirmation.getCollectionBankNum()); |
|
|
|
} |
|
|
|
voucherResultDetailDtoJf.setSubjectNo(payType); |
|
|
|
voucherResultDetailDtoJf.setSummary("***扣回车辆再次销售-收款" + "(" + collectionDate + ")"); |
|
|
|
voucherResultDetailDtoJf.setDebit(String.valueOf(all2)); |
|
|
|
list2.add(voucherResultDetailDtoJf); |
|
|
|
} |
|
|
|
|
|
|
|
if(!list.isEmpty()){ |
|
|
|
voucher.setResultDetails(list); |
|
|
|
finKingDeeFeignRest.saveVoucher(voucher); |
|
|
|
} |
|
|
|
if(list2.isEmpty()){ |
|
|
|
voucher.setResultDetails(list2); |
|
|
|
finKingDeeFeignRest.saveVoucher(voucher); |
|
|
|
} |
|
|
|
|
|
|
|
return rb.success().setMsg("款项确认成功"); |
|
|
|
} |
|
|
|
|
|
|
|
private List<Voucher.VoucherResultDetailDto> getAll(FinCollectionConfirmation finalConfirmation, FinSelectedReceivablesDetailedVo v, String collectionDate) { |
|
|
|