|
|
@ -4724,8 +4724,12 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
String collectionDate, Voucher voucher,String userSid) { |
|
|
|
List<Voucher.VoucherResultDetailDto> list = new ArrayList<>(); |
|
|
|
List<Voucher.VoucherResultDetailDto> list2 = new ArrayList<>(); |
|
|
|
List<Voucher.VoucherResultDetailDto> list3 = new ArrayList<>(); |
|
|
|
List<Voucher.VoucherResultDetailDto> list4 = new ArrayList<>(); |
|
|
|
BigDecimal all = BigDecimal.ZERO;//赎回
|
|
|
|
BigDecimal all2 = BigDecimal.ZERO;//二次销售
|
|
|
|
BigDecimal all3 = BigDecimal.ZERO;//亏损立案
|
|
|
|
BigDecimal all4 = BigDecimal.ZERO;//亏损立案
|
|
|
|
BigDecimal otherMoney = BigDecimal.ZERO; |
|
|
|
String payType = ""; |
|
|
|
DictCommonVo dictCommonVo = dictCommonFeign.selectBykey(finalConfirmation.getCollectionTypeKey(), "payVoucherType").getData(); |
|
|
@ -5243,7 +5247,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
if ("预计资方结清费用".equals(v.getReceivablesName())) { |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf3 = new Voucher.VoucherResultDetailDto(); |
|
|
|
all2 = all2.add(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherResultDetailDtoDf3.setSummary(planDetails.getVinNo()+"扣回车辆再次销售-资方结清费用"); |
|
|
|
voucherResultDetailDtoDf3.setSummary(customerNumber+"扣回车辆再次销售-资方结清费用"); |
|
|
|
voucherResultDetailDtoDf3.setSubjectNo("1201.03.01"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf3.setDimensionDept(deptVo.getOrgCode()); |
|
|
@ -5270,6 +5274,104 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
) { |
|
|
|
otherMoney = otherMoney.add(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
} |
|
|
|
}else if("6".equals(busSalesOrderVehicle.getRiskState().toString())){//亏损立案
|
|
|
|
if("诉讼费".equals(v.getReceivablesName())){ |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf = new Voucher.VoucherResultDetailDto(); |
|
|
|
all3 = all3.add(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherResultDetailDtoDf.setSummary(customerNumber+"诉讼回款诉讼费"); |
|
|
|
voucherResultDetailDtoDf.setSubjectNo("2191.25"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDf.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDf.setCredit(v.getSubscriptionMoney()); |
|
|
|
list3.add(voucherResultDetailDtoDf); |
|
|
|
} |
|
|
|
if ("资金占用费".equals(v.getReceivablesName())) { |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf2 = new Voucher.VoucherResultDetailDto(); |
|
|
|
all3 = all3.add(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherResultDetailDtoDf2.setSummary(customerNumber+"诉讼回款资金占用费"); |
|
|
|
voucherResultDetailDtoDf2.setSubjectNo("1201.02.02"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf2.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDf2.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDf2.setCredit(v.getSubscriptionMoney()); |
|
|
|
list3.add(voucherResultDetailDtoDf2); |
|
|
|
//------------------------资金占用费转收入
|
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoJfZjzyf = new Voucher.VoucherResultDetailDto(); |
|
|
|
voucherResultDetailDtoJfZjzyf.setSummary("资金占用费转收入"); |
|
|
|
voucherResultDetailDtoJfZjzyf.setSubjectNo("2191.05.00"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoJfZjzyf.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoJfZjzyf.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoJfZjzyf.setDebit(v.getSubscriptionMoney()); |
|
|
|
list3.add(voucherResultDetailDtoJfZjzyf); |
|
|
|
//资金占用费转收入--其他业务收入_消贷收入_消贷利息
|
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDfZjzyf = new Voucher.VoucherResultDetailDto(); |
|
|
|
voucherResultDetailDtoDfZjzyf.setSummary("资金占用费转收入"); |
|
|
|
voucherResultDetailDtoDfZjzyf.setSubjectNo("6002.01.19"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDfZjzyf.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDfZjzyf.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDfZjzyf.setCredit(v.getSubscriptionMoney()); |
|
|
|
list3.add(voucherResultDetailDtoDfZjzyf); |
|
|
|
} |
|
|
|
//ToDo:应收贷款车欠款_待处理欠款_处置车辆_已诉讼
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if("7".equals(busSalesOrderVehicle.getRiskState().toString())){//亏损执行
|
|
|
|
if("诉讼费".equals(v.getReceivablesName())){ |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf = new Voucher.VoucherResultDetailDto(); |
|
|
|
all4 = all4.add(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherResultDetailDtoDf.setSummary(customerNumber+"执行回款诉讼费"); |
|
|
|
voucherResultDetailDtoDf.setSubjectNo("2191.25"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDf.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDf.setCredit(v.getSubscriptionMoney()); |
|
|
|
list4.add(voucherResultDetailDtoDf); |
|
|
|
|
|
|
|
} |
|
|
|
if("资金占用费".equals(v.getReceivablesName())){ |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf2 = new Voucher.VoucherResultDetailDto(); |
|
|
|
all4 = all4.add(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
voucherResultDetailDtoDf2.setSummary(customerNumber+"执行回款-资金占用费"); |
|
|
|
voucherResultDetailDtoDf2.setSubjectNo("1201.02.02"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf2.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDf2.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDf2.setCredit(v.getSubscriptionMoney()); |
|
|
|
list4.add(voucherResultDetailDtoDf2); |
|
|
|
//------------------------资金占用费转收入
|
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoJfZjzyf = new Voucher.VoucherResultDetailDto(); |
|
|
|
voucherResultDetailDtoJfZjzyf.setSummary("资金占用费转收入"); |
|
|
|
voucherResultDetailDtoJfZjzyf.setSubjectNo("2191.05.00"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoJfZjzyf.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoJfZjzyf.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoJfZjzyf.setDebit(v.getSubscriptionMoney()); |
|
|
|
list4.add(voucherResultDetailDtoJfZjzyf); |
|
|
|
//资金占用费转收入--其他业务收入_消贷收入_消贷利息
|
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDfZjzyf = new Voucher.VoucherResultDetailDto(); |
|
|
|
voucherResultDetailDtoDfZjzyf.setSummary("资金占用费转收入"); |
|
|
|
voucherResultDetailDtoDfZjzyf.setSubjectNo("6002.01.19"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDfZjzyf.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDfZjzyf.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDfZjzyf.setCredit(v.getSubscriptionMoney()); |
|
|
|
list4.add(voucherResultDetailDtoDfZjzyf); |
|
|
|
} |
|
|
|
//ToDo:多收款转收入
|
|
|
|
//TodO:应收贷款车欠款_待处理欠款_待执行
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -5308,132 +5410,46 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
voucherResultDetailDtoJf.setDebit(String.valueOf(all2)); |
|
|
|
list2.add(voucherResultDetailDtoJf); |
|
|
|
} |
|
|
|
if (all3.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoJf = new Voucher.VoucherResultDetailDto(); |
|
|
|
if (StringUtils.isNotBlank(finalConfirmation.getCollectionBankNum())) { |
|
|
|
voucherResultDetailDtoJf.setBankAccount(finalConfirmation.getCollectionBankNum()); |
|
|
|
} |
|
|
|
voucherResultDetailDtoJf.setSubjectNo(payType); |
|
|
|
voucherResultDetailDtoJf.setSummary("收款" +finalConfirmation.getPayerName()+ "(" + collectionDate + ")"); |
|
|
|
voucherResultDetailDtoJf.setDebit(String.valueOf(all3)); |
|
|
|
list3.add(voucherResultDetailDtoJf); |
|
|
|
} |
|
|
|
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
if (all4.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoJf = new Voucher.VoucherResultDetailDto(); |
|
|
|
if (StringUtils.isNotBlank(finalConfirmation.getCollectionBankNum())) { |
|
|
|
voucherResultDetailDtoJf.setBankAccount(finalConfirmation.getCollectionBankNum()); |
|
|
|
} |
|
|
|
voucherResultDetailDtoJf.setSubjectNo(payType); |
|
|
|
voucherResultDetailDtoJf.setSummary("收款" +finalConfirmation.getPayerName()+ "(" + collectionDate + ")"); |
|
|
|
voucherResultDetailDtoJf.setDebit(String.valueOf(all3)); |
|
|
|
list4.add(voucherResultDetailDtoJf); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!list.isEmpty()) {//赎回收款(风控状态赎回中以及交回推送)
|
|
|
|
voucher.setResultDetails(list); |
|
|
|
finKingDeeFeignRest.saveVoucher(voucher); |
|
|
|
} |
|
|
|
if (!list2.isEmpty()) { |
|
|
|
if (!list2.isEmpty()) {//二次销售收款
|
|
|
|
voucher.setResultDetails(list2); |
|
|
|
finKingDeeFeignRest.saveVoucher(voucher); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private List<Voucher.VoucherResultDetailDto> getAll(FinCollectionConfirmation finalConfirmation, FinSelectedReceivablesDetailedVo v, String collectionDate) { |
|
|
|
List<Voucher.VoucherResultDetailDto> list = new ArrayList<>(); |
|
|
|
FinUncollectedReceivablesDetailed finUncollectedReceivablesDetailed = finUncollectedReceivablesDetailedService.fetchBySid(v.getReceivablesSid()); |
|
|
|
SysOrganizationVo deptVo = sysOrganizationFeign.fetchBySid(finalConfirmation.getCreateDeptSid()).getData(); |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(finUncollectedReceivablesDetailed.getBusVinSid()).getData(); |
|
|
|
String customerNumber = ""; |
|
|
|
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(); |
|
|
|
} |
|
|
|
} |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoJf = new Voucher.VoucherResultDetailDto(); |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoJf2 = new Voucher.VoucherResultDetailDto(); |
|
|
|
//贷方
|
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf = new Voucher.VoucherResultDetailDto(); |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf2 = new Voucher.VoucherResultDetailDto(); |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf3 = new Voucher.VoucherResultDetailDto(); |
|
|
|
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(); |
|
|
|
} |
|
|
|
} |
|
|
|
//--收款-赎回款(yyyy-MM-dd)
|
|
|
|
BigDecimal all = new BigDecimal(v.getSubscriptionMoney()); |
|
|
|
if (all.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
voucherResultDetailDtoJf.setSummary("收款-赎回款" + "(" + collectionDate + ")"); |
|
|
|
voucherResultDetailDtoJf.setSubjectNo(payType); |
|
|
|
voucherResultDetailDtoJf.setBankAccount(finalConfirmation.getCollectionBankNum()); |
|
|
|
voucherResultDetailDtoJf.setDebit(all.toString()); |
|
|
|
list.add(voucherResultDetailDtoJf); |
|
|
|
if(!list3.isEmpty()){//诉讼后法院认款
|
|
|
|
voucher.setResultDetails(list3); |
|
|
|
finKingDeeFeignRest.saveVoucher(voucher); |
|
|
|
} |
|
|
|
//-----出纳收款确认后-资金占用费
|
|
|
|
AlrepaidAndArrVo alrepaidAndArrVo = loanRestoreReportApplyFeign.getAlrepaidAndArr2(finUncollectedReceivablesDetailed.getBusVinSid()).getData(); |
|
|
|
BigDecimal zjzyfMoney = BigDecimal.ZERO; |
|
|
|
String zjzyf = alrepaidAndArrVo.getWheFundOccMoney(); |
|
|
|
zjzyfMoney = new BigDecimal(StringUtils.isBlank(zjzyf) ? "0" : zjzyf); |
|
|
|
if (zjzyfMoney.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
voucherResultDetailDtoDf.setSummary("收款-赎回款"); |
|
|
|
voucherResultDetailDtoDf.setSubjectNo("1201.02.03"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDf.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDf.setCredit(zjzyfMoney.toString()); |
|
|
|
list.add(voucherResultDetailDtoDf); |
|
|
|
voucherResultDetailDtoJf2.setSummary("资金占用费转收入"); |
|
|
|
voucherResultDetailDtoJf2.setSubjectNo("2191.05.00"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoJf2.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoJf2.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoJf2.setCredit(zjzyfMoney.toString()); |
|
|
|
list.add(voucherResultDetailDtoJf2); |
|
|
|
voucherResultDetailDtoDf3.setSummary("资金占用费转收入"); |
|
|
|
voucherResultDetailDtoDf3.setSubjectNo("6002.01.17"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf3.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDf3.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDf3.setCredit(zjzyfMoney.toString()); |
|
|
|
list.add(voucherResultDetailDtoDf3); |
|
|
|
} |
|
|
|
BigDecimal allM = BigDecimal.ZERO; |
|
|
|
allM = all.subtract(zjzyfMoney); |
|
|
|
if (allM.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
voucherResultDetailDtoDf2.setSummary("收款-赎回款"); |
|
|
|
voucherResultDetailDtoDf2.setSubjectNo("1201.03.01"); |
|
|
|
//核算部门
|
|
|
|
voucherResultDetailDtoDf2.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
//核算客户
|
|
|
|
voucherResultDetailDtoDf2.setDimensionCustom(customerNumber); |
|
|
|
voucherResultDetailDtoDf2.setCredit(allM.toString()); |
|
|
|
list.add(voucherResultDetailDtoDf2); |
|
|
|
|
|
|
|
if(!list4.isEmpty()){//执行后法院认款
|
|
|
|
voucher.setResultDetails(list4); |
|
|
|
finKingDeeFeignRest.saveVoucher(voucher); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
//名义价其他费用推财务
|
|
|
|