|
|
@ -112,6 +112,8 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.function.Predicate; |
|
|
@ -3684,7 +3686,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
//与收款金额作比较:更新认款状态 1未认款/2部分认款/3已认款
|
|
|
|
confirmation.setPaymentState(3); |
|
|
|
baseMapper.updateById(confirmation); |
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
//===========================================
|
|
|
|
//查询该申请下的所有待审核的款项明细
|
|
|
|
BigDecimal subscriptionMoneyAll = new BigDecimal("0"); |
|
|
@ -3703,6 +3705,10 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
//推送间还认款记录
|
|
|
|
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"); |
|
|
@ -3710,13 +3716,26 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
historyEntity.setBuckle("审核通过"); |
|
|
|
historyEntity.setBuckleKey("003"); |
|
|
|
historyEntity.setActualMoney(new BigDecimal(v.getSubscriptionMoney())); |
|
|
|
historyEntity.setActualDate(new DateTime()); |
|
|
|
try { |
|
|
|
Date collDate = sdf.parse(finalConfirmation.getCollectionDate()); |
|
|
|
historyEntity.setActualDate(collDate); |
|
|
|
if (planDetails.getDueDate().compareTo(collDate) >= 0) { |
|
|
|
//未逾期
|
|
|
|
Calendar cal_1 = Calendar.getInstance();// 使用默认时区和语言环境获得一个日历
|
|
|
|
cal_1.setTime(collDate); |
|
|
|
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.setPlanDetailSid(v.getReceivablesSid()); |
|
|
|
LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsFeign.fetchDetails(v.getReceivablesSid()).getData(); |
|
|
|
if (null != planDetails) { |
|
|
|
historyEntity.setScheduleSid(planDetails.getScheduleSid()); |
|
|
|
historyEntity.setPaymentState("待转付"); |
|
|
|
historyEntity.setPaymentStateKey("001"); |
|
|
|
} |
|
|
|
loanRepaymentHistoryFeign.saveHistoryByEntity(historyEntity); |
|
|
|
} |
|
|
@ -3740,86 +3759,33 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
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 { |
|
|
|
BigDecimal paymentMoney = planDetails.getPaymentMoney(); |
|
|
|
String subscriptionMoney = v.getSubscriptionMoney(); |
|
|
|
BigDecimal subtract = paymentMoney.subtract(new BigDecimal(subscriptionMoney)); |
|
|
|
planDetails.setPaymentMoney(subtract); |
|
|
|
loanRepaymentPlanDetailsFeign.updateByEntity(planDetails); |
|
|
|
if (loanFinBank.getReAdvances() == 1) { |
|
|
|
FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR(); |
|
|
|
jr.setCreateBySid(userSid); |
|
|
|
SysUserVo userVo = sysUserFeign.fetchBySid(sid).getData(); |
|
|
|
jr.setCreateByName(userVo.getName()); |
|
|
|
jr.setBusSid(planSid); |
|
|
|
jr.setCurrentReceivableMoney(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 { |
|
|
|
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 { |
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
@ -4098,8 +4064,12 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
LoanRepaymentPlanDetails data = loanRepaymentPlanDetailsFeign.fetchDetails(receivablesSid).getData(); |
|
|
|
if (null != data) { |
|
|
|
BeanUtil.copyProperties(data, rsk, "sid"); |
|
|
|
if (StringUtils.isNotBlank(data.getVinNo()) && StringUtils.isNotBlank(data.getVehMark())) { |
|
|
|
if (StringUtils.isNotBlank(data.getVinNo())) { |
|
|
|
if (StringUtils.isNotBlank(data.getVehMark())) { |
|
|
|
rsk.setVin(data.getVinNo() + "/" + data.getVehMark()); |
|
|
|
} else { |
|
|
|
rsk.setVin(data.getVinNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
String noReturnMoney = finUncollectedReceivablesDetailedJRService.selNoReturnMoneyRsk(receivablesSid); |
|
|
|
if (StringUtils.isNotBlank(noReturnMoney)) { |
|
|
@ -4113,8 +4083,12 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
LoanRepaymentPlanDetails data = loanRepaymentPlanDetailsFeign.fetchDetails(busSid).getData(); |
|
|
|
if (null != data) { |
|
|
|
BeanUtil.copyProperties(data, rsk, "sid"); |
|
|
|
if (StringUtils.isNotBlank(data.getVinNo()) && StringUtils.isNotBlank(data.getVehMark())) { |
|
|
|
if (StringUtils.isNotBlank(data.getVinNo())) { |
|
|
|
if (StringUtils.isNotBlank(data.getVehMark())) { |
|
|
|
rsk.setVin(data.getVinNo() + "/" + data.getVehMark()); |
|
|
|
} else { |
|
|
|
rsk.setVin(data.getVinNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
String noReturnMoney = finUncollectedReceivablesDetailedJRService.selNoReturnMoneyJR(busSid); |
|
|
|
if (StringUtils.isNotBlank(noReturnMoney)) { |
|
|
@ -4328,8 +4302,12 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
LoanRepaymentPlanDetails data = loanRepaymentPlanDetailsFeign.fetchDetails(receivablesSid).getData(); |
|
|
|
if (null != data) { |
|
|
|
BeanUtil.copyProperties(data, rsk, "sid"); |
|
|
|
if (StringUtils.isNotBlank(data.getVinNo()) && StringUtils.isNotBlank(data.getVehMark())) { |
|
|
|
if (StringUtils.isNotBlank(data.getVinNo())) { |
|
|
|
if (StringUtils.isNotBlank(data.getVehMark())) { |
|
|
|
rsk.setVin(data.getVinNo() + "/" + data.getVehMark()); |
|
|
|
} else { |
|
|
|
rsk.setVin(data.getVinNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
String noReturnMoney = finUncollectedReceivablesDetailedJRService.selNoReturnMoneyRsk(receivablesSid); |
|
|
|
if (StringUtils.isNotBlank(noReturnMoney)) { |
|
|
@ -4343,8 +4321,12 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
LoanRepaymentPlanDetails data = loanRepaymentPlanDetailsFeign.fetchDetails(busSid).getData(); |
|
|
|
if (null != data) { |
|
|
|
BeanUtil.copyProperties(data, rsk, "sid"); |
|
|
|
if (StringUtils.isNotBlank(data.getVinNo()) && StringUtils.isNotBlank(data.getVehMark())) { |
|
|
|
if (StringUtils.isNotBlank(data.getVinNo())) { |
|
|
|
if (StringUtils.isNotBlank(data.getVehMark())) { |
|
|
|
rsk.setVin(data.getVinNo() + "/" + data.getVehMark()); |
|
|
|
} else { |
|
|
|
rsk.setVin(data.getVinNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
String noReturnMoney = finUncollectedReceivablesDetailedJRService.selNoReturnMoneyJR(busSid); |
|
|
|
if (StringUtils.isNotBlank(noReturnMoney)) { |
|
|
|