From 50b5d5f34e33f12cdaef900ee0f936f854e46c4c Mon Sep 17 00:00:00 2001 From: dimengzhe Date: Tue, 20 May 2025 09:57:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=89=E8=AE=BC=E8=AE=A4=E6=AC=BE=E3=80=81?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E8=AE=A4=E6=AC=BE=E5=87=AD=E8=AF=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusSalesOrderVehicleFeignFallback.java | 5 + .../FinCollectionConfirmationService.java | 315 +++++++++++++++++- .../LoanCaseExecuteApplyService.java | 150 ++++++--- 3 files changed, 406 insertions(+), 64 deletions(-) diff --git a/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bussalesordervehicle/BusSalesOrderVehicleFeignFallback.java b/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bussalesordervehicle/BusSalesOrderVehicleFeignFallback.java index 6a609984fd..c31a968dac 100644 --- a/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bussalesordervehicle/BusSalesOrderVehicleFeignFallback.java +++ b/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bussalesordervehicle/BusSalesOrderVehicleFeignFallback.java @@ -203,4 +203,9 @@ public class BusSalesOrderVehicleFeignFallback implements BusSalesOrderVehicleFe return null; } + @Override + public List selectListBySid(List busVinSidList) { + return null; + } + } diff --git a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/fincollectionconfirmation/FinCollectionConfirmationService.java b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/fincollectionconfirmation/FinCollectionConfirmationService.java index 7babca4c0b..92d15aa9a9 100644 --- a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/fincollectionconfirmation/FinCollectionConfirmationService.java +++ b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/fincollectionconfirmation/FinCollectionConfirmationService.java @@ -4726,10 +4726,12 @@ public class FinCollectionConfirmationService extends MybatisBaseService list2 = new ArrayList<>(); List list3 = new ArrayList<>(); List list4 = new ArrayList<>(); + List list5 = new ArrayList<>(); BigDecimal all = BigDecimal.ZERO;//赎回 BigDecimal all2 = BigDecimal.ZERO;//二次销售 BigDecimal all3 = BigDecimal.ZERO;//亏损立案 - BigDecimal all4 = BigDecimal.ZERO;//亏损立案 + BigDecimal all4 = BigDecimal.ZERO;//未交回立案 + BigDecimal all5 = BigDecimal.ZERO;//执行 BigDecimal otherMoney = BigDecimal.ZERO; String payType = ""; DictCommonVo dictCommonVo = dictCommonFeign.selectBykey(finalConfirmation.getCollectionTypeKey(), "payVoucherType").getData(); @@ -4799,8 +4801,8 @@ public class FinCollectionConfirmationService extends MybatisBaseService bankResultBean = loanFinBankFeign.fetchEntityBySid(bankSid); + if (bankResultBean.getData() != null) { + LoanFinBank loanFinBank = bankResultBean.getData(); + if (null != loanFinBank.getReAdvances()) { + if (loanFinBank.getReAdvances() == 1) { + 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.setPaymentState("待转付"); + historyEntity.setPaymentStateKey("001"); + 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); + } + } + } + } else if (planDetails.getPaymentMoney().compareTo(BigDecimal.ZERO) == 0) { + 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.setPaymentState("待转付"); + historyEntity.setPaymentStateKey("001"); + } + } else { + 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.setPaymentState("待转付"); + historyEntity.setPaymentStateKey("001"); + } + loanRepaymentHistoryFeign.saveHistoryByEntity(historyEntity); + }else{ + 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(); + String isOther = loanRepaymentScheduleFeign.returnBankOrOtherBankByPlanSid(planSid).getData(); + String bankSid = ""; + String scheduleSid = planDetails.getScheduleSid(); + LoanRepaymentSchedule schedule = loanRepaymentScheduleFeign.fetchBySid(scheduleSid).getData(); + if (isOther.equals("0")) { + if (StringUtils.isNotBlank(schedule.getBankSid())) { + bankSid = schedule.getBankSid(); + } + } else if (isOther.equals("1")) { + if (StringUtils.isNotBlank(schedule.getOtherBankSid())) { + bankSid = schedule.getOtherBankSid(); + } + } + ResultBean bankResultBean = loanFinBankFeign.fetchEntityBySid(bankSid); + 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("诉讼保全费".equals(v.getReceivablesName()) || "诉讼费用".equals(v.getReceivablesName())){ Voucher.VoucherResultDetailDto voucherResultDetailDtoDf = new Voucher.VoucherResultDetailDto(); all4 = all4.add(new BigDecimal(v.getSubscriptionMoney())); - voucherResultDetailDtoDf.setSummary(customerNumber+"执行回款诉讼费"); + voucherResultDetailDtoDf.setSummary(customerNumber+"诉讼回款诉讼费"); voucherResultDetailDtoDf.setSubjectNo("2191.25"); //核算部门 voucherResultDetailDtoDf.setDimensionDept(deptVo.getOrgCode()); @@ -5520,12 +5707,28 @@ public class FinCollectionConfirmationService extends MybatisBaseService 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(all5)); + list5.add(voucherResultDetailDtoJf); + } + if (!list.isEmpty()) {//赎回收款(风控状态赎回中以及交回推送) voucher.setResultDetails(list); @@ -5828,10 +6103,14 @@ public class FinCollectionConfirmationService extends MybatisBaseService listPageVo(PagerQuery pq) { LoanCaseExecuteApplyQuery query = pq.getParams(); QueryWrapper qw = new QueryWrapper<>(); @@ -252,7 +254,7 @@ public class LoanCaseExecuteApplyService extends MybatisBaseService p = PagerUtil.pageToVo(pagging, null); return p; } - + public String saveOrUpdateDto(LoanCaseExecuteApplyDto dto){ String dtoSid = dto.getSid(); List pjclFiles = dto.getPjclFiles(); @@ -341,7 +343,7 @@ public class LoanCaseExecuteApplyService extends MybatisBaseService(1024), namedThreadFactory, new org.apache.tomcat.util.threads.ThreadPoolExecutor.AbortPolicy()); - Future future1 = pool.submit(() -> { + LoanCaseExecuteApply finalLoanCaseExecuteApply = loanCaseExecuteApply; + Future future1 = pool.submit(() -> { //推送财务凭证 //TOdO: pushRiskToFin(bv.getBusinessSid()); + //修改风控状态为执行 + //--更新销售订单车辆表的风控状态为执行 + List busVinSidList = loanCaseProgressVehService.selectByMainSid(finalLoanCaseExecuteApply.getBusSid()); + BusVinStateSetQuery busVinStateSetQuery = new BusVinStateSetQuery(); + busVinStateSetQuery.setState(12); + busVinStateSetQuery.setBusVinSidList(busVinSidList); + ResultBean resultBean1 = busSalesOrderVehicleFeign.setRiskState(busVinStateSetQuery); }); } catch (Exception e) { e.printStackTrace(); } + } else { //极光推送 loanCaseExecuteApply = fetchBySid(businessSid); @@ -573,6 +584,7 @@ public class LoanCaseExecuteApplyService extends MybatisBaseService voucherResultDetailDtos = new ArrayList<>(); + List voucherResultDetailDtos2 = new ArrayList<>(); SysOrganizationVo deptVo = sysOrganizationFeign.fetchBySid(loanCaseExecuteApply.getDeptSid()).getData(); List busVinSidList = loanCaseProgressVehService.selectByMainSid(loanCaseExecuteApply.getBusSid()); for (int i = 0; i < busVinSidList.size(); i++) { @@ -629,53 +641,99 @@ public class LoanCaseExecuteApplyService extends MybatisBaseService 0) { - voucherResultDetailDtoDf.setSummary(customerNumber+"转执行"); - voucherResultDetailDtoDf.setSubjectNo("1201.03.04.02"); - //核算部门 - voucherResultDetailDtoDf.setDimensionDept(deptVo.getOrgCode()); - //核算客户 - voucherResultDetailDtoDf.setDimensionCustom(customerNumber); - voucherResultDetailDtoDf.setCredit(all.toString()); - voucherResultDetailDtos.add(voucherResultDetailDtoDf); - } - - //---------------------------------------------待处理财产损溢 风险准备金(输入)-预申请坏账金额 - if (ysqhz.compareTo(BigDecimal.ZERO) > 0) { - voucherResultDetailDtoJf.setSummary(customerNumber+"转执行"); - voucherResultDetailDtoJf.setSubjectNo("1911.05"); - //核算部门 - voucherResultDetailDtoJf.setDimensionDept(deptVo.getOrgCode()); - //核算客户 - voucherResultDetailDtoJf.setDimensionCustom(customerNumber); - voucherResultDetailDtoJf.setDebit(ysqhz.toString()); - voucherResultDetailDtos.add(voucherResultDetailDtoJf); + if("11".equals(busSalesOrderVehicle.getRiskState().toString())){//亏损立案---二次销售后的诉讼后的执行 + //-------------------------------------------应收贷款车欠款_待处理欠款_处置车辆_已诉讼-当前欠款合计 + if (all.compareTo(BigDecimal.ZERO) > 0) { + //贷方 + Voucher.VoucherResultDetailDto voucherResultDetailDtoDf = new Voucher.VoucherResultDetailDto(); + voucherResultDetailDtoDf.setSummary(customerNumber+"转执行"); + voucherResultDetailDtoDf.setSubjectNo("1201.03.04.02"); + //核算部门 + voucherResultDetailDtoDf.setDimensionDept(deptVo.getOrgCode()); + //核算客户 + voucherResultDetailDtoDf.setDimensionCustom(customerNumber); + voucherResultDetailDtoDf.setCredit(all.toString()); + voucherResultDetailDtos.add(voucherResultDetailDtoDf); + } + //---------------------------------------------待处理财产损溢 风险准备金(输入)-预申请坏账金额 + if (ysqhz.compareTo(BigDecimal.ZERO) > 0) { + //借方 + Voucher.VoucherResultDetailDto voucherResultDetailDtoJf = new Voucher.VoucherResultDetailDto(); + voucherResultDetailDtoJf.setSummary(customerNumber+"转执行"); + voucherResultDetailDtoJf.setSubjectNo("1911.05"); + //核算部门 + voucherResultDetailDtoJf.setDimensionDept(deptVo.getOrgCode()); + //核算客户 + voucherResultDetailDtoJf.setDimensionCustom(customerNumber); + voucherResultDetailDtoJf.setDebit(ysqhz.toString()); + voucherResultDetailDtos.add(voucherResultDetailDtoJf); + } + //--------------------------------------------应收贷款车欠款_待处理欠款_待执行-其中执行欠款金额 + if (qzzxqk.compareTo(BigDecimal.ZERO) > 0) { + Voucher.VoucherResultDetailDto voucherResultDetailDtoJf2 = new Voucher.VoucherResultDetailDto(); + voucherResultDetailDtoJf2.setSummary(customerNumber+"转执行"); + voucherResultDetailDtoJf2.setSubjectNo("1201.03.05"); + //核算部门 + voucherResultDetailDtoJf2.setDimensionDept(deptVo.getOrgCode()); + //核算客户 + voucherResultDetailDtoJf2.setDimensionCustom(customerNumber); + voucherResultDetailDtoJf2.setDebit(qzzxqk.toString()); + voucherResultDetailDtos.add(voucherResultDetailDtoJf2); + } } + if("9".equals(busSalesOrderVehicle.getRiskState().toString()) || "10".equals(busSalesOrderVehicle.getRiskState().toString())){ + //未交回立案-交回立案后的执行 + //-------------------------------------------应收贷款车欠款_待处理欠款_诉讼车辆 + if (all.compareTo(BigDecimal.ZERO) > 0) { + //贷方 + Voucher.VoucherResultDetailDto voucherResultDetailDtoDf = new Voucher.VoucherResultDetailDto(); + voucherResultDetailDtoDf.setSummary(customerNumber+"转执行"); + voucherResultDetailDtoDf.setSubjectNo("1201.03.03"); + //核算部门 + voucherResultDetailDtoDf.setDimensionDept(deptVo.getOrgCode()); + //核算客户 + voucherResultDetailDtoDf.setDimensionCustom(customerNumber); + voucherResultDetailDtoDf.setCredit(all.toString()); + voucherResultDetailDtos2.add(voucherResultDetailDtoDf); + } + //---------------------------------------------待处理财产损溢 风险准备金(输入)-预申请坏账金额 + if (ysqhz.compareTo(BigDecimal.ZERO) > 0) { + //借方 + Voucher.VoucherResultDetailDto voucherResultDetailDtoJf = new Voucher.VoucherResultDetailDto(); + voucherResultDetailDtoJf.setSummary(customerNumber+"转执行"); + voucherResultDetailDtoJf.setSubjectNo("1911.05"); + //核算部门 + voucherResultDetailDtoJf.setDimensionDept(deptVo.getOrgCode()); + //核算客户 + voucherResultDetailDtoJf.setDimensionCustom(customerNumber); + voucherResultDetailDtoJf.setDebit(ysqhz.toString()); + voucherResultDetailDtos2.add(voucherResultDetailDtoJf); + } + //--------------------------------------------应收贷款车欠款_待处理欠款_待执行-其中执行欠款金额 + if (qzzxqk.compareTo(BigDecimal.ZERO) > 0) { + Voucher.VoucherResultDetailDto voucherResultDetailDtoJf2 = new Voucher.VoucherResultDetailDto(); + voucherResultDetailDtoJf2.setSummary(customerNumber+"转执行"); + voucherResultDetailDtoJf2.setSubjectNo("1201.03.05"); + //核算部门 + voucherResultDetailDtoJf2.setDimensionDept(deptVo.getOrgCode()); + //核算客户 + voucherResultDetailDtoJf2.setDimensionCustom(customerNumber); + voucherResultDetailDtoJf2.setDebit(qzzxqk.toString()); + voucherResultDetailDtos2.add(voucherResultDetailDtoJf2); + } - //--------------------------------------------应收贷款车欠款_待处理欠款_待执行-其中执行欠款金额 - if (qzzxqk.compareTo(BigDecimal.ZERO) > 0) { - voucherResultDetailDtoJf2.setSummary(customerNumber+"转执行"); - voucherResultDetailDtoJf2.setSubjectNo("1201.03.05"); - //核算部门 - voucherResultDetailDtoJf2.setDimensionDept(deptVo.getOrgCode()); - //核算客户 - voucherResultDetailDtoJf2.setDimensionCustom(customerNumber); - voucherResultDetailDtoJf2.setDebit(qzzxqk.toString()); - voucherResultDetailDtos.add(voucherResultDetailDtoJf2); - } + } } if (!voucherResultDetailDtos.isEmpty()) { voucher.setResultDetails(voucherResultDetailDtos); finKingDeeFeign.saveVoucher(voucher); } + + if (!voucherResultDetailDtos2.isEmpty()) { + voucher.setResultDetails(voucherResultDetailDtos2); + finKingDeeFeign.saveVoucher(voucher); + } } }