Browse Source

优化间还认款推送间还还款记录

master
fanzongzhe 6 months ago
parent
commit
6a2bea55a5
  1. 107
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/fincollectionconfirmation/FinCollectionConfirmationService.java

107
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/fincollectionconfirmation/FinCollectionConfirmationService.java

@ -3881,43 +3881,6 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
//更新审核时间
finSelectedReceivablesDetailed.setAuditDate(DateUtil.today());
finSelectedReceivablesDetailedService.updateById(finSelectedReceivablesDetailed);
//推送间还认款记录
if (v.getReceivablesName().equals("月还")) {
LoanRepaymentHistory historyEntity = new LoanRepaymentHistory();
historyEntity.setPlanDetailSid(v.getReceivablesSid());
LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsFeign.fetchDetails(v.getReceivablesSid()).getData();
if (null != planDetails) {
historyEntity.setScheduleSid(planDetails.getScheduleSid());
historyEntity.setSkdBillNo(finalConfirmation.getBillNo());
historyEntity.setUpdateTime(new DateTime());
historyEntity.setUpdateState("1");
historyEntity.setDataTime(new DateTime());
historyEntity.setBuckle("审核通过");
historyEntity.setBuckleKey("003");
historyEntity.setActualMoney(new BigDecimal(v.getSubscriptionMoney()));
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.setReturnWay("间还");
historyEntity.setReturnWayKey("02");
historyEntity.setPaymentState("待转付");
historyEntity.setPaymentStateKey("001");
}
loanRepaymentHistoryFeign.saveHistoryByEntity(historyEntity);
}
//认资方退还垫款或者结清时资方逾期利息
if (v.getReceivablesName().equals("资方退还垫款") || v.getReceivablesName().equals("贷款保证金扣罚")) {
CollectionVoucher.CollectionVoucherDetail d = getReturnBackMoneyVoucher(v, collectionDate);
@ -3937,6 +3900,19 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsFeign.fetchDetails(planSid).getData();
if (null != planDetails) {
if (v.getReceivablesName().equals("月还")) {
//推送间还认款记录
LoanRepaymentHistory historyEntity = new LoanRepaymentHistory();
historyEntity.setPlanDetailSid(planSid);
historyEntity.setScheduleSid(planDetails.getScheduleSid());
historyEntity.setSkdBillNo(finalConfirmation.getBillNo());
historyEntity.setUpdateTime(new DateTime());
historyEntity.setUpdateState("1");
historyEntity.setDataTime(new DateTime());
historyEntity.setBuckle("审核通过");
historyEntity.setBuckleKey("003");
historyEntity.setActualMoney(new BigDecimal(v.getSubscriptionMoney()));
historyEntity.setReturnWay("间还");
historyEntity.setReturnWayKey("02");
if (null != planDetails.getPaymentMoney()) {
if (planDetails.getPaymentMoney().compareTo(BigDecimal.ZERO) == 1) {
BigDecimal paymentMoney = planDetails.getPaymentMoney();
@ -3963,6 +3939,24 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
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();
@ -3983,8 +3977,47 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
}
}
}
} 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);
}
if (v.getReceivablesName().equals("资方逾期利息")) {
if (null != planDetails.getPaymentInterest()) {

Loading…
Cancel
Save