|
|
@ -3733,44 +3733,69 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
} |
|
|
|
LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsFeign.fetchDetails(planSid).getData(); |
|
|
|
if (null != planDetails) { |
|
|
|
if (planDetails.getPaymentMoney().compareTo(BigDecimal.ZERO) == 1) { |
|
|
|
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) { |
|
|
|
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<LoanFinBank> 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<FinColl |
|
|
|
loanRepaymentHistoryFeign.saveHistoryByEntity(historyEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|