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 e712226acc..97fd6cc7a4 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 @@ -3733,44 +3733,69 @@ public class FinCollectionConfirmationService extends MybatisBaseService bankResultBean = loanFinBankFeign.reAdvancesByOrderSid(orderSid); - if (bankResultBean.getData() != null) { - LoanFinBank loanFinBank = bankResultBean.getData(); - if (null != loanFinBank.getReAdvances()) { - if (loanFinBank.getReAdvances() == 1) { - LoanRepaymentHistory historyEntity = new LoanRepaymentHistory(); - historyEntity.setSkdBillNo(finalConfirmation.getBillNo()); - historyEntity.setActualMoney(new BigDecimal(v.getSubscriptionMoney())); - historyEntity.setActualDate(new DateTime()); - historyEntity.setReturnWay("间还"); - historyEntity.setReturnWayKey("02"); - historyEntity.setPaymentState("待转付"); - historyEntity.setPaymentStateKey("001"); - Date dueDate = planDetails.getDueDate(); - if (new Date().compareTo(dueDate) > 0) { + if (null != planDetails.getPaymentMoney()) { + if (planDetails.getPaymentMoney().compareTo(BigDecimal.ZERO) == 1) { + String orderSid = planDetails.getSalesOrderSid(); + ResultBean bankResultBean = loanFinBankFeign.reAdvancesByOrderSid(orderSid); + if (bankResultBean.getData() != null) { + LoanFinBank loanFinBank = bankResultBean.getData(); + if (null != loanFinBank.getReAdvances()) { + if (loanFinBank.getReAdvances() == 1) { + LoanRepaymentHistory historyEntity = new LoanRepaymentHistory(); + historyEntity.setSkdBillNo(finalConfirmation.getBillNo()); + historyEntity.setActualMoney(new BigDecimal(v.getSubscriptionMoney())); + historyEntity.setActualDate(new DateTime()); + historyEntity.setReturnWay("间还"); + historyEntity.setReturnWayKey("02"); + historyEntity.setPaymentState("待转付"); + historyEntity.setPaymentStateKey("001"); + Date dueDate = planDetails.getDueDate(); + if (new Date().compareTo(dueDate) > 0) { + historyEntity.setPrepareDate(new DateTime()); + } else { + Calendar cal_1 = Calendar.getInstance();// 使用默认时区和语言环境获得一个日历 + cal_1.setTime(dueDate); + cal_1.add(Calendar.DAY_OF_MONTH, -1); + historyEntity.setPrepareDate(cal_1.getTime()); + } historyEntity.setPrepareDate(new DateTime()); + historyEntity.setPlanDetailSid(planSid); + historyEntity.setScheduleSid(planDetails.getScheduleSid()); + loanRepaymentHistoryFeign.saveHistoryByEntity(historyEntity); } else { - Calendar cal_1 = Calendar.getInstance();// 使用默认时区和语言环境获得一个日历 - cal_1.setTime(dueDate); - cal_1.add(Calendar.DAY_OF_MONTH, -1); - historyEntity.setPrepareDate(cal_1.getTime()); + BigDecimal paymentMoney = planDetails.getPaymentMoney(); + String subscriptionMoney = v.getSubscriptionMoney(); + BigDecimal subtract = paymentMoney.subtract(new BigDecimal(subscriptionMoney)); + planDetails.setPaymentMoney(subtract); + loanRepaymentPlanDetailsFeign.updateByEntity(planDetails); } - historyEntity.setPrepareDate(new DateTime()); - historyEntity.setPlanDetailSid(planSid); - historyEntity.setScheduleSid(planDetails.getScheduleSid()); - loanRepaymentHistoryFeign.saveHistoryByEntity(historyEntity); - } else { - BigDecimal paymentMoney = planDetails.getPaymentMoney(); - String subscriptionMoney = v.getSubscriptionMoney(); - BigDecimal subtract = paymentMoney.subtract(new BigDecimal(subscriptionMoney)); - planDetails.setPaymentMoney(subtract); - loanRepaymentPlanDetailsFeign.updateByEntity(planDetails); } } + } else { + LoanRepaymentHistory historyEntity = new LoanRepaymentHistory(); + historyEntity.setSkdBillNo(finalConfirmation.getBillNo()); + historyEntity.setActualMoney(new BigDecimal(v.getSubscriptionMoney())); + historyEntity.setActualDate(new DateTime()); + historyEntity.setReturnWay("间还"); + historyEntity.setReturnWayKey("02"); + historyEntity.setPaymentState("待转付"); + historyEntity.setPaymentStateKey("001"); + Date dueDate = planDetails.getDueDate(); + if (new Date().compareTo(dueDate) > 0) { + historyEntity.setPrepareDate(new DateTime()); + } else { + Calendar cal_1 = Calendar.getInstance();// 使用默认时区和语言环境获得一个日历 + cal_1.setTime(dueDate); + cal_1.add(Calendar.DAY_OF_MONTH, -1); + historyEntity.setPrepareDate(cal_1.getTime()); + } + historyEntity.setPrepareDate(new DateTime()); + historyEntity.setPlanDetailSid(planSid); + historyEntity.setScheduleSid(planDetails.getScheduleSid()); + loanRepaymentHistoryFeign.saveHistoryByEntity(historyEntity); + } - } else { + } else { LoanRepaymentHistory historyEntity = new LoanRepaymentHistory(); historyEntity.setSkdBillNo(finalConfirmation.getBillNo()); historyEntity.setActualMoney(new BigDecimal(v.getSubscriptionMoney())); @@ -3794,6 +3819,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService records = loanMonthlyAccrualRecordService.selByMainSid(businessSid); - // xxxxxxxxx + if (!records.isEmpty()) { + + + } } diff --git a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryService.java b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryService.java index 7949ee6b35..91b051ea2d 100644 --- a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryService.java +++ b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryService.java @@ -713,12 +713,6 @@ public class LoanRepaymentHistoryService extends MybatisBaseService monthHeadAndLast = getMonthHeadAndLast(new Date()); - String head = monthHeadAndLast.get(0); - String last = monthHeadAndLast.get(1); - qw.apply(StringUtils.isNotEmpty(head), "date_format (h.actualDate,'%Y-%m-%d') >= date_format('" + head + "','%Y-%m-%d')"). - apply(StringUtils.isNotEmpty(last), "date_format (h.actualDate,'%Y-%m-%d') <= date_format('" + last + "','%Y-%m-%d')" - ); List histories = baseMapper.selUpdateStateList(qw); if (!histories.isEmpty()) { for (String historySid : histories) { @@ -753,12 +747,7 @@ public class LoanRepaymentHistoryService extends MybatisBaseService monthHeadAndLast = getMonthHeadAndLast(new Date()); - String head = monthHeadAndLast.get(0); - String last = monthHeadAndLast.get(1); - qw.apply(StringUtils.isNotEmpty(head), "date_format (h.actualDate,'%Y-%m-%d') >= date_format('" + head + "','%Y-%m-%d')"). - apply(StringUtils.isNotEmpty(last), "date_format (h.actualDate,'%Y-%m-%d') <= date_format('" + last + "','%Y-%m-%d')" - ); + qw.eq("h.updateState","1"); List histories = baseMapper.selbuckleNewInitList(qw); Set planSids = new HashSet<>(); if (!histories.isEmpty()) {