|
|
@ -29,6 +29,8 @@ import com.yxt.anrui.portal.api.sysuser.PrivilegeQuery; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserInfoVo; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfinotherPolicy.LoanFinOtherPolicy; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfinpolicy.LoanFinPolicy; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfinpolicy.LoanFinPolicyVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanmortgageinformationtransact.LoanMortgageInformationTransactDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetailsDto; |
|
|
@ -39,6 +41,8 @@ import com.yxt.anrui.riskcenter.api.loansolutionsotherpolicy.LoanSolutionsOtherp |
|
|
|
import com.yxt.anrui.riskcenter.api.loanwarrantinformation.LoanWarrantInformation; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanwarrantinformation.LoanWarrantInformationQuery; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanwarrantinformation.LoanWarrantInformationVo; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanfinotherPolicy.LoanFinOtherPolicyService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanfinpolicy.LoanFinPolicyService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrepaymenthistory.LoanRepaymentHistoryService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrepaymentplandetails.LoanRepaymentPlanDetailsService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansolutions.LoanSolutionsService; |
|
|
@ -108,7 +112,10 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
private LoanWarrantInformationService loanWarrantInformationService; |
|
|
|
@Autowired |
|
|
|
private LoanRepaymentPlanDetailsService loanRepaymentPlanDetailsService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private LoanFinOtherPolicyService loanFinOtherPolicyService; |
|
|
|
@Autowired |
|
|
|
private LoanFinPolicyService loanFinPolicyService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据销售订单SID生成还款计划表回显 |
|
|
@ -123,6 +130,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
vo.setSalesOrderSid(salesOrderSid); |
|
|
|
BusSalesOrderLoancontractDetailsVo loancontract = busSalesOrderLoancontractFeign.fetchDetailsBySid(salesOrderSid).getData(); |
|
|
|
String orderSid = ""; |
|
|
|
String bankNo = ""; |
|
|
|
if (null != loancontract) { |
|
|
|
// 消贷合同编号
|
|
|
|
if (StringUtils.isNotBlank(loancontract.getLoanContractNo())) { |
|
|
@ -139,6 +147,9 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
if (StringUtils.isNotBlank(loancontract.getSalesOrderSid())) { |
|
|
|
orderSid = loancontract.getSalesOrderSid(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(loancontract.getBankContractNo())) { |
|
|
|
bankNo = loancontract.getBankContractNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(orderSid)) { |
|
|
|
LoanSolutions loanSolutions = loanSolutionsService.selectBySaleOrderSid(orderSid); |
|
|
@ -154,7 +165,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
vo.setSolutionsSid(loanSolutions.getSid()); |
|
|
|
// 主金融产品
|
|
|
|
if (StringUtils.isNotBlank(loanSolutions.getPolicyName())) { |
|
|
|
vo.setPolicyName(loanSolutions.getPolicyName()); |
|
|
|
vo.setPolicyName(loanSolutions.getPolicyName() + "-" + bankNo); |
|
|
|
} |
|
|
|
// 主产品贷款金额
|
|
|
|
if (null != loanSolutions.getLoanAmount()) { |
|
|
@ -193,6 +204,33 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
if (null != otherpolicy) { |
|
|
|
if (StringUtils.isNotBlank(otherpolicy.getOtherPolicyPeriod())) { |
|
|
|
vo.setIsOtherPolicy("1"); |
|
|
|
String otherPolicySid = otherpolicy.getOtherPolicySid(); |
|
|
|
String otherBankSid = ""; |
|
|
|
LoanFinOtherPolicy loanFinOtherPolicy = loanFinOtherPolicyService.fetchBySid(otherPolicySid); |
|
|
|
if (loanFinOtherPolicy != null) { |
|
|
|
if (StringUtils.isNotBlank(loanFinOtherPolicy.getBankSid())) { |
|
|
|
otherBankSid = loanFinOtherPolicy.getBankSid(); |
|
|
|
} |
|
|
|
} |
|
|
|
String finBankSid = ""; |
|
|
|
if (null != loanSolutions) { |
|
|
|
if (StringUtils.isNotBlank(loanSolutions.getPolicySid())) { |
|
|
|
LoanFinPolicy finPolicy = loanFinPolicyService.fetchBySid(loanSolutions.getPolicySid()); |
|
|
|
if (null != finPolicy) { |
|
|
|
if (StringUtils.isNotBlank(finPolicy.getBankSid())) { |
|
|
|
finBankSid = finPolicy.getBankSid(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(otherBankSid) && StringUtils.isNotBlank(finBankSid)) { |
|
|
|
if (otherBankSid.equals(finBankSid)) { |
|
|
|
vo.setSameBank("1"); |
|
|
|
vo.setOtherBankNo(bankNo); |
|
|
|
} else { |
|
|
|
vo.setSameBank("0"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 其他融产品
|
|
|
|
if (StringUtils.isNotBlank(otherpolicy.getOtherPolicyName())) { |
|
|
|
vo.setOtherPolicyName(otherpolicy.getOtherPolicyName()); |
|
|
@ -225,6 +263,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
} |
|
|
|
} else { |
|
|
|
vo.setIsOtherPolicy("0"); |
|
|
|
vo.setSameBank("0"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -280,12 +319,16 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
BeanUtil.copyProperties(dto, loanRepaymentSchedule, "id", "sid"); |
|
|
|
loanRepaymentSchedule.setLoanContractSid(dto.getSalesOrderSid()); |
|
|
|
loanRepaymentSchedule.setSalesOrderSid(orderSid); |
|
|
|
if (StringUtils.isNotBlank(dto.getOtherBankNo())) { |
|
|
|
loanRepaymentSchedule.setOtherBankNo(dto.getOtherBankNo()); |
|
|
|
} |
|
|
|
baseMapper.updateById(loanRepaymentSchedule); |
|
|
|
loanRepaymentPlanDetailsService.deletePlanDetails(loanRepaymentSchedule.getSid()); |
|
|
|
BusSalesOrder busSalesOrder = busSalesOrderFeign.fetchBySid(orderSid).getData(); |
|
|
|
//新增还款计划明细
|
|
|
|
LoanRepaymentSchedule scheduleDetails = fetchBySid(loanRepaymentSchedule.getSid()); |
|
|
|
if (null != scheduleDetails) { |
|
|
|
if (scheduleDetails.getSameBank().equals("0")) { |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
String createBySid = scheduleDetails.getCreateBySid(); |
|
|
|
String staffSid = scheduleDetails.getStaffSid(); |
|
|
@ -354,6 +397,10 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
bankContractNo = loancontractVo.getBankContractNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
String otherBankNo = ""; |
|
|
|
if (StringUtils.isNotBlank(scheduleDetails.getOtherBankNo())) { |
|
|
|
otherBankNo = scheduleDetails.getOtherBankNo(); |
|
|
|
} |
|
|
|
List<BusSalesOrderVehicle> vehicles = busSalesOrderVehicleFeign.selectListByOrderSidAndDkrSid(salesOrderSid, borrowerSid).getData(); |
|
|
|
if (!vehicles.isEmpty()) { |
|
|
|
for (BusSalesOrderVehicle vehicle : vehicles) { |
|
|
@ -405,7 +452,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
otherDto.setLoanContractNo(loanContractNo); |
|
|
|
otherDto.setLoanContractSid(loanContractSid); |
|
|
|
otherDto.setPolicyName(policyName); |
|
|
|
otherDto.setBankContractNo(bankContractNo); |
|
|
|
otherDto.setBankContractNo(otherBankNo); |
|
|
|
otherDto.setCreateBySid(createBySid); |
|
|
|
otherDto.setCustomer(customer); |
|
|
|
otherDto.setCustomerSid(customerSid); |
|
|
@ -441,6 +488,134 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (scheduleDetails.getSameBank().equals("1")) { |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
String createBySid = scheduleDetails.getCreateBySid(); |
|
|
|
String staffSid = scheduleDetails.getStaffSid(); |
|
|
|
String bankName = scheduleDetails.getBankName(); |
|
|
|
String borrowerSid = scheduleDetails.getBorrowerSid(); |
|
|
|
String borrowerName = scheduleDetails.getBorrowerName(); |
|
|
|
String staffName = scheduleDetails.getStaffName(); |
|
|
|
String salesOrderSid = scheduleDetails.getSalesOrderSid(); |
|
|
|
String policyName = scheduleDetails.getPolicyName(); |
|
|
|
String loanContractSid = scheduleDetails.getLoanContractSid(); |
|
|
|
String loanContractNo = scheduleDetails.getLoanContractNo(); |
|
|
|
int mainPeriod = Integer.parseInt(scheduleDetails.getMainPeriod()); |
|
|
|
String mainDate = sdf.format(scheduleDetails.getMainRepayDate()); |
|
|
|
List<String> mainDays = returnRepayDate(mainDate, scheduleDetails.getMainPeriod()); |
|
|
|
String mainFirstRepay = String.valueOf(scheduleDetails.getMainFirstRepay()); |
|
|
|
String mainMidRepay = String.valueOf(scheduleDetails.getMainMidRepay()); |
|
|
|
String mainLastRepay = String.valueOf(scheduleDetails.getMainLastRepay()); |
|
|
|
String otherPeriod = ""; |
|
|
|
String otherDate = ""; |
|
|
|
String otherFirstPay = ""; |
|
|
|
String otherMidPay = ""; |
|
|
|
String otherLastPay = ""; |
|
|
|
String deptSid = ""; |
|
|
|
String dept = ""; |
|
|
|
String useOrgName = ""; |
|
|
|
String useOrgSid = ""; |
|
|
|
String orgSidPath = ""; |
|
|
|
String bankContractNo = ""; |
|
|
|
String customer = ""; |
|
|
|
String customerSid = ""; |
|
|
|
if (scheduleDetails.getIsOtherPolicy().equals("1")) { |
|
|
|
otherPeriod = scheduleDetails.getOtherPeriod(); |
|
|
|
otherDate = sdf.format(scheduleDetails.getOtherRepayDate()); |
|
|
|
otherFirstPay = String.valueOf(scheduleDetails.getOtherFirstRepay()); |
|
|
|
otherMidPay = String.valueOf(scheduleDetails.getOtherMidRepay()); |
|
|
|
otherLastPay = String.valueOf(scheduleDetails.getOtherLastRepay()); |
|
|
|
} |
|
|
|
if (null != busSalesOrder) { |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getCustomerName())) { |
|
|
|
customer = busSalesOrder.getCustomerName(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getCustomerSid())) { |
|
|
|
customerSid = busSalesOrder.getCustomerSid(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getOrgSid())) { |
|
|
|
deptSid = busSalesOrder.getOrgSid(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getOrgName())) { |
|
|
|
dept = busSalesOrder.getOrgName(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getOrgSidPath())) { |
|
|
|
orgSidPath = busSalesOrder.getOrgSidPath(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getUseOrgName())) { |
|
|
|
useOrgName = busSalesOrder.getUseOrgName(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getUseOrgSid())) { |
|
|
|
useOrgSid = busSalesOrder.getUseOrgSid(); |
|
|
|
} |
|
|
|
} |
|
|
|
BusSalesOrderLoancontractDetailsVo loancontractVo = busSalesOrderLoancontractFeign.fetchDetailsBySid(dto.getSalesOrderSid()).getData(); |
|
|
|
if (null != loancontractVo) { |
|
|
|
if (StringUtils.isNotBlank(loancontractVo.getBankContractNo())) { |
|
|
|
bankContractNo = loancontractVo.getBankContractNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
List<BusSalesOrderVehicle> vehicles = busSalesOrderVehicleFeign.selectListByOrderSidAndDkrSid(salesOrderSid, borrowerSid).getData(); |
|
|
|
if (!vehicles.isEmpty()) { |
|
|
|
for (BusSalesOrderVehicle vehicle : vehicles) { |
|
|
|
String linkNo = vehicle.getLinkNo(); |
|
|
|
String busVinSid = vehicle.getSid(); |
|
|
|
//主方案
|
|
|
|
for (int i = 0; i < mainPeriod; i++) { |
|
|
|
LoanRepaymentPlanDetailsDto mainDto = new LoanRepaymentPlanDetailsDto(); |
|
|
|
mainDto.setSalesOrderSid(salesOrderSid); |
|
|
|
mainDto.setLoanContractNo(loanContractNo); |
|
|
|
mainDto.setLoanContractSid(loanContractSid); |
|
|
|
mainDto.setPolicyName(policyName); |
|
|
|
mainDto.setBankContractNo(bankContractNo); |
|
|
|
mainDto.setCreateBySid(createBySid); |
|
|
|
mainDto.setCustomer(customer); |
|
|
|
mainDto.setCustomerSid(customerSid); |
|
|
|
mainDto.setBorrowerSid(borrowerSid); |
|
|
|
mainDto.setBorrowerName(borrowerName); |
|
|
|
mainDto.setPeriod(String.valueOf(i + 1)); |
|
|
|
mainDto.setScheduleSid(scheduleDetails.getSid()); |
|
|
|
mainDto.setBankName(bankName); |
|
|
|
mainDto.setDept(dept); |
|
|
|
mainDto.setDeptSid(deptSid); |
|
|
|
mainDto.setUseOrgSid(useOrgSid); |
|
|
|
mainDto.setUseOrgName(useOrgName); |
|
|
|
mainDto.setOrgSidPath(orgSidPath); |
|
|
|
mainDto.setBusVinSid(busVinSid); |
|
|
|
mainDto.setVinNo(linkNo); |
|
|
|
mainDto.setSalesUserSid(staffSid); |
|
|
|
mainDto.setStaffName(staffName); |
|
|
|
mainDto.setPolicyOrOther("1"); |
|
|
|
BigDecimal otherRepay = new BigDecimal(0); |
|
|
|
if (i == 0) { |
|
|
|
otherRepay = new BigDecimal(otherFirstPay); |
|
|
|
} else if (i == Integer.parseInt(otherPeriod) - 1) { |
|
|
|
otherRepay = new BigDecimal(otherLastPay); |
|
|
|
} else { |
|
|
|
otherRepay = new BigDecimal(otherLastPay); |
|
|
|
} |
|
|
|
if (i == 0) { |
|
|
|
BigDecimal mainF = new BigDecimal(mainFirstRepay); |
|
|
|
BigDecimal add = mainF.add(otherRepay); |
|
|
|
mainDto.setDueMoney(String.valueOf(add)); |
|
|
|
} else if (i == mainPeriod - 1) { |
|
|
|
BigDecimal mainL = new BigDecimal(mainLastRepay); |
|
|
|
BigDecimal add = mainL.add(otherRepay); |
|
|
|
mainDto.setDueMoney(String.valueOf(add)); |
|
|
|
} else { |
|
|
|
BigDecimal mainM = new BigDecimal(mainMidRepay); |
|
|
|
BigDecimal add = mainM.add(otherRepay); |
|
|
|
mainDto.setDueMoney(String.valueOf(add)); |
|
|
|
} |
|
|
|
if (!mainDays.isEmpty()) { |
|
|
|
mainDto.setDueDate(mainDays.get(i)); |
|
|
|
} |
|
|
|
loanRepaymentPlanDetailsService.savePlanDetails(mainDto); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
LoanRepaymentSchedule entity = new LoanRepaymentSchedule(); |
|
|
@ -450,6 +625,9 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
if (StringUtils.isNotBlank(dto.getUserSid())) { |
|
|
|
entity.setCreateBySid(dto.getUserSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(dto.getOtherBankNo())) { |
|
|
|
entity.setOtherBankNo(dto.getOtherBankNo()); |
|
|
|
} |
|
|
|
BusSalesOrder busSalesOrder = busSalesOrderFeign.fetchBySid(orderSid).getData(); |
|
|
|
if (null != busSalesOrder) { |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getCreateBySid())) { |
|
|
@ -472,6 +650,9 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
if (StringUtils.isNotBlank(loancontractVo.getBorrowerSid())) { |
|
|
|
entity.setBorrowerSid(loancontractVo.getBorrowerSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(loancontractVo.getBankContractNo())) { |
|
|
|
entity.setBankContractNo(loancontractVo.getBankContractNo()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(loancontractVo.getBankName())) { |
|
|
|
entity.setBankName(loancontractVo.getBankName()); |
|
|
|
} |
|
|
@ -494,6 +675,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
//新增还款计划明细
|
|
|
|
LoanRepaymentSchedule scheduleDetails = fetchBySid(entity.getSid()); |
|
|
|
if (null != scheduleDetails) { |
|
|
|
if (scheduleDetails.getSameBank().equals("0")) { |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
String createBySid = scheduleDetails.getCreateBySid(); |
|
|
|
String staffSid = scheduleDetails.getStaffSid(); |
|
|
@ -561,6 +743,10 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
bankContractNo = loancontractVo.getBankContractNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
String otherBankNo = ""; |
|
|
|
if (StringUtils.isNotBlank(scheduleDetails.getOtherBankNo())) { |
|
|
|
otherBankNo = scheduleDetails.getOtherBankNo(); |
|
|
|
} |
|
|
|
List<BusSalesOrderVehicle> vehicles = busSalesOrderVehicleFeign.selectListByOrderSidAndDkrSid(salesOrderSid, borrowerSid).getData(); |
|
|
|
if (!vehicles.isEmpty()) { |
|
|
|
for (BusSalesOrderVehicle vehicle : vehicles) { |
|
|
@ -612,7 +798,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
otherDto.setLoanContractNo(loanContractNo); |
|
|
|
otherDto.setLoanContractSid(loanContractSid); |
|
|
|
otherDto.setPolicyName(policyName); |
|
|
|
otherDto.setBankContractNo(bankContractNo); |
|
|
|
otherDto.setBankContractNo(otherBankNo); |
|
|
|
otherDto.setCreateBySid(createBySid); |
|
|
|
otherDto.setCustomer(customer); |
|
|
|
otherDto.setCustomerSid(customerSid); |
|
|
@ -648,6 +834,133 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (scheduleDetails.getSameBank().equals("1")) { |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
String createBySid = scheduleDetails.getCreateBySid(); |
|
|
|
String staffSid = scheduleDetails.getStaffSid(); |
|
|
|
String bankName = scheduleDetails.getBankName(); |
|
|
|
String borrowerSid = scheduleDetails.getBorrowerSid(); |
|
|
|
String borrowerName = scheduleDetails.getBorrowerName(); |
|
|
|
String staffName = scheduleDetails.getStaffName(); |
|
|
|
String salesOrderSid = scheduleDetails.getSalesOrderSid(); |
|
|
|
String policyName = scheduleDetails.getPolicyName(); |
|
|
|
String loanContractSid = scheduleDetails.getLoanContractSid(); |
|
|
|
String loanContractNo = scheduleDetails.getLoanContractNo(); |
|
|
|
int mainPeriod = Integer.parseInt(scheduleDetails.getMainPeriod()); |
|
|
|
String mainDate = sdf.format(scheduleDetails.getMainRepayDate()); |
|
|
|
List<String> mainDays = returnRepayDate(mainDate, scheduleDetails.getMainPeriod()); |
|
|
|
String mainFirstRepay = String.valueOf(scheduleDetails.getMainFirstRepay()); |
|
|
|
String mainMidRepay = String.valueOf(scheduleDetails.getMainMidRepay()); |
|
|
|
String mainLastRepay = String.valueOf(scheduleDetails.getMainLastRepay()); |
|
|
|
String otherPeriod = ""; |
|
|
|
String otherDate = ""; |
|
|
|
String otherFirstPay = ""; |
|
|
|
String otherMidPay = ""; |
|
|
|
String otherLastPay = ""; |
|
|
|
String deptSid = ""; |
|
|
|
String dept = ""; |
|
|
|
String useOrgName = ""; |
|
|
|
String useOrgSid = ""; |
|
|
|
String orgSidPath = ""; |
|
|
|
String bankContractNo = ""; |
|
|
|
String customer = ""; |
|
|
|
String customerSid = ""; |
|
|
|
if (scheduleDetails.getIsOtherPolicy().equals("1")) { |
|
|
|
otherPeriod = scheduleDetails.getOtherPeriod(); |
|
|
|
otherDate = sdf.format(scheduleDetails.getOtherRepayDate()); |
|
|
|
otherFirstPay = String.valueOf(scheduleDetails.getOtherFirstRepay()); |
|
|
|
otherMidPay = String.valueOf(scheduleDetails.getOtherMidRepay()); |
|
|
|
otherLastPay = String.valueOf(scheduleDetails.getOtherLastRepay()); |
|
|
|
} |
|
|
|
if (null != busSalesOrder) { |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getCustomerName())) { |
|
|
|
customer = busSalesOrder.getCustomerName(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getCustomerSid())) { |
|
|
|
customerSid = busSalesOrder.getCustomerSid(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getOrgSid())) { |
|
|
|
deptSid = busSalesOrder.getOrgSid(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getOrgName())) { |
|
|
|
dept = busSalesOrder.getOrgName(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getOrgSidPath())) { |
|
|
|
orgSidPath = busSalesOrder.getOrgSidPath(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getUseOrgName())) { |
|
|
|
useOrgName = busSalesOrder.getUseOrgName(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(busSalesOrder.getUseOrgSid())) { |
|
|
|
useOrgSid = busSalesOrder.getUseOrgSid(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (null != loancontractVo) { |
|
|
|
if (StringUtils.isNotBlank(loancontractVo.getBankContractNo())) { |
|
|
|
bankContractNo = loancontractVo.getBankContractNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
List<BusSalesOrderVehicle> vehicles = busSalesOrderVehicleFeign.selectListByOrderSidAndDkrSid(salesOrderSid, borrowerSid).getData(); |
|
|
|
if (!vehicles.isEmpty()) { |
|
|
|
for (BusSalesOrderVehicle vehicle : vehicles) { |
|
|
|
String linkNo = vehicle.getLinkNo(); |
|
|
|
String busVinSid = vehicle.getSid(); |
|
|
|
//主方案
|
|
|
|
for (int i = 0; i < mainPeriod; i++) { |
|
|
|
LoanRepaymentPlanDetailsDto mainDto = new LoanRepaymentPlanDetailsDto(); |
|
|
|
mainDto.setSalesOrderSid(salesOrderSid); |
|
|
|
mainDto.setLoanContractNo(loanContractNo); |
|
|
|
mainDto.setLoanContractSid(loanContractSid); |
|
|
|
mainDto.setPolicyName(policyName); |
|
|
|
mainDto.setBankContractNo(bankContractNo); |
|
|
|
mainDto.setCreateBySid(createBySid); |
|
|
|
mainDto.setCustomer(customer); |
|
|
|
mainDto.setCustomerSid(customerSid); |
|
|
|
mainDto.setBorrowerSid(borrowerSid); |
|
|
|
mainDto.setBorrowerName(borrowerName); |
|
|
|
mainDto.setPeriod(String.valueOf(i + 1)); |
|
|
|
mainDto.setScheduleSid(entity.getSid()); |
|
|
|
mainDto.setBankName(bankName); |
|
|
|
mainDto.setDept(dept); |
|
|
|
mainDto.setDeptSid(deptSid); |
|
|
|
mainDto.setUseOrgSid(useOrgSid); |
|
|
|
mainDto.setUseOrgName(useOrgName); |
|
|
|
mainDto.setOrgSidPath(orgSidPath); |
|
|
|
mainDto.setBusVinSid(busVinSid); |
|
|
|
mainDto.setVinNo(linkNo); |
|
|
|
mainDto.setSalesUserSid(staffSid); |
|
|
|
mainDto.setStaffName(staffName); |
|
|
|
mainDto.setPolicyOrOther("1"); |
|
|
|
BigDecimal otherRepay = new BigDecimal(0); |
|
|
|
if (i == 0) { |
|
|
|
otherRepay = new BigDecimal(otherFirstPay); |
|
|
|
} else if (i == Integer.parseInt(otherPeriod) - 1) { |
|
|
|
otherRepay = new BigDecimal(otherLastPay); |
|
|
|
} else { |
|
|
|
otherRepay = new BigDecimal(otherLastPay); |
|
|
|
} |
|
|
|
if (i == 0) { |
|
|
|
BigDecimal mainF = new BigDecimal(mainFirstRepay); |
|
|
|
BigDecimal add = mainF.add(otherRepay); |
|
|
|
mainDto.setDueMoney(String.valueOf(add)); |
|
|
|
} else if (i == mainPeriod - 1) { |
|
|
|
BigDecimal mainL = new BigDecimal(mainLastRepay); |
|
|
|
BigDecimal add = mainL.add(otherRepay); |
|
|
|
mainDto.setDueMoney(String.valueOf(add)); |
|
|
|
} else { |
|
|
|
BigDecimal mainM = new BigDecimal(mainMidRepay); |
|
|
|
BigDecimal add = mainM.add(otherRepay); |
|
|
|
mainDto.setDueMoney(String.valueOf(add)); |
|
|
|
} |
|
|
|
if (!mainDays.isEmpty()) { |
|
|
|
mainDto.setDueDate(mainDays.get(i)); |
|
|
|
} |
|
|
|
loanRepaymentPlanDetailsService.savePlanDetails(mainDto); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 使用多线程推送站内信发送短信
|
|
|
|
try { |
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() |
|
|
@ -935,6 +1248,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
BigDecimal mainL = new BigDecimal(0); |
|
|
|
BigDecimal otherL = new BigDecimal(0); |
|
|
|
if (null != schedule) { |
|
|
|
if (schedule.getSameBank().equals("0")) { |
|
|
|
BeanUtil.copyProperties(schedule, vo); |
|
|
|
if (null != schedule.getMainRepayDate()) { |
|
|
|
mainDate = sdf.format(schedule.getMainRepayDate()); |
|
|
@ -1078,6 +1392,124 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (schedule.getSameBank().equals("1")) { |
|
|
|
if (null != schedule.getMainRepayDate()) { |
|
|
|
mainDate = sdf.format(schedule.getMainRepayDate()); |
|
|
|
} |
|
|
|
if (null != schedule.getOtherRepayDate()) { |
|
|
|
otherDate = sdf.format(schedule.getOtherRepayDate()); |
|
|
|
} |
|
|
|
//主产品月还日
|
|
|
|
if (StringUtils.isNotBlank(mainDate)) { |
|
|
|
String[] splitMainDate = mainDate.split("-"); |
|
|
|
String day = splitMainDate[2]; |
|
|
|
if (day.length() == 2 && Integer.parseInt(day) >= 10) { |
|
|
|
vo.setMainRepayDate(day); |
|
|
|
} else { |
|
|
|
vo.setMainRepayDate(day.replace("0", "")); |
|
|
|
} |
|
|
|
} |
|
|
|
//月还金额
|
|
|
|
if (null != schedule.getMainFirstRepay()) { |
|
|
|
mainF = schedule.getMainFirstRepay(); |
|
|
|
} |
|
|
|
if (null != schedule.getMainMidRepay()) { |
|
|
|
mainM = schedule.getMainMidRepay(); |
|
|
|
} |
|
|
|
if (null != schedule.getMainLastRepay()) { |
|
|
|
mainL = schedule.getMainLastRepay(); |
|
|
|
} |
|
|
|
if (null != schedule.getOtherFirstRepay()) { |
|
|
|
otherF = schedule.getOtherFirstRepay(); |
|
|
|
} |
|
|
|
if (null != schedule.getOtherMidRepay()) { |
|
|
|
otherM = schedule.getOtherMidRepay(); |
|
|
|
} |
|
|
|
if (null != schedule.getOtherLastRepay()) { |
|
|
|
otherL = schedule.getOtherLastRepay(); |
|
|
|
} |
|
|
|
//-----还款计划表列表信息-------
|
|
|
|
List<LoanCreateScheduleVinsListVo> scheduleVins = new ArrayList<>(); |
|
|
|
if (StringUtils.isNotBlank(schedule.getMainPeriod())) { |
|
|
|
int mainPeriod = Integer.parseInt(schedule.getMainPeriod()); |
|
|
|
if (StringUtils.isNotBlank(schedule.getIsOtherPolicy())) { |
|
|
|
isOther = schedule.getIsOtherPolicy(); |
|
|
|
} |
|
|
|
String otherPer = ""; |
|
|
|
if (StringUtils.isNotBlank(schedule.getOtherPeriod())) { |
|
|
|
otherPer = schedule.getOtherPeriod(); |
|
|
|
} |
|
|
|
int otherMidPer = 0; |
|
|
|
int otherLastPer = 0; |
|
|
|
String month = ""; |
|
|
|
String year = ""; |
|
|
|
String moth = ""; |
|
|
|
String otherMoth = ""; |
|
|
|
String otherFDate = ""; |
|
|
|
String otherMonth = ""; |
|
|
|
if (StringUtils.isNotBlank(mainDate)) { |
|
|
|
String[] splitMain = mainDate.split("-"); |
|
|
|
year = splitMain[0]; |
|
|
|
moth = splitMain[1]; |
|
|
|
if (moth.length() == 2 && Integer.parseInt(moth) >= 10) { |
|
|
|
month = moth; |
|
|
|
} else { |
|
|
|
month = moth.replace("0", ""); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(otherDate)) { |
|
|
|
String[] splitOther = otherDate.split("-"); |
|
|
|
|
|
|
|
otherMoth = splitOther[1]; |
|
|
|
if (otherMoth.length() == 2 && Integer.parseInt(otherMoth) >= 10) { |
|
|
|
otherMonth = otherMoth; |
|
|
|
} else { |
|
|
|
otherMonth = otherMoth.replace("0", ""); |
|
|
|
} |
|
|
|
otherFDate = splitOther[0] + otherMonth; |
|
|
|
} |
|
|
|
for (int i = 1; i <= mainPeriod; i++) { |
|
|
|
String yearMonth = year + month; |
|
|
|
LoanCreateScheduleVinsListVo scheduleVo = new LoanCreateScheduleVinsListVo(); |
|
|
|
scheduleVo.setRepayMonth(year + "年" + month + "月"); |
|
|
|
scheduleVo.setPeriod(String.valueOf(i)); |
|
|
|
int m = Integer.parseInt(month); |
|
|
|
month = String.valueOf(++m); |
|
|
|
if (Integer.parseInt(month) > 12) { |
|
|
|
int y = Integer.parseInt(year); |
|
|
|
year = String.valueOf(++y); |
|
|
|
month = "1"; |
|
|
|
} |
|
|
|
if (isOther.equals("1")) { |
|
|
|
BigDecimal otherRepay = new BigDecimal(0); |
|
|
|
if (i == 1) { |
|
|
|
otherRepay = otherF; |
|
|
|
} else if (i == Integer.parseInt(otherPer)) { |
|
|
|
otherRepay = otherL; |
|
|
|
} else { |
|
|
|
otherRepay = otherM; |
|
|
|
} |
|
|
|
//首期
|
|
|
|
if (i == 1) { |
|
|
|
BigDecimal add = mainF.add(otherRepay); |
|
|
|
scheduleVo.setMainRepay(add.toString()); |
|
|
|
} else if (i == mainPeriod) { |
|
|
|
BigDecimal add = mainL.add(otherRepay); |
|
|
|
scheduleVo.setMainRepay(add.toString()); |
|
|
|
} else { |
|
|
|
BigDecimal add = mainM.add(otherRepay); |
|
|
|
scheduleVo.setMainRepay(add.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
scheduleVins.add(scheduleVo); |
|
|
|
} |
|
|
|
if (!scheduleVins.isEmpty()) { |
|
|
|
vo.setScheduleVins(scheduleVins); |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setIsOtherPolicy("0"); |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setSalesOrderSid(salesOrderSid); |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
@ -1219,6 +1651,7 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
BigDecimal mainL = new BigDecimal(0); |
|
|
|
BigDecimal otherL = new BigDecimal(0); |
|
|
|
if (null != schedule) { |
|
|
|
if (schedule.getSameBank().equals("0")) { |
|
|
|
vo.setSid(sid); |
|
|
|
if (StringUtils.isNotBlank(schedule.getLoanContractNo())) { |
|
|
|
vo.setContractId(schedule.getLoanContractNo()); |
|
|
@ -1388,6 +1821,162 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (schedule.getSameBank().equals("1")) { |
|
|
|
vo.setSid(sid); |
|
|
|
if (StringUtils.isNotBlank(schedule.getLoanContractNo())) { |
|
|
|
vo.setContractId(schedule.getLoanContractNo()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(schedule.getBorrowerName())) { |
|
|
|
vo.setLenderName(schedule.getBorrowerName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(schedule.getVehCount())) { |
|
|
|
vo.setCarNumber(schedule.getVehCount()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(schedule.getVinNo())) { |
|
|
|
List<String> stringList = Arrays.asList(schedule.getVinNo().split(",")); |
|
|
|
vo.setVinNo(stringList); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(schedule.getBankName())) { |
|
|
|
vo.setManagement(schedule.getBankName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(schedule.getPolicyName())) { |
|
|
|
vo.setFinancial(schedule.getPolicyName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(schedule.getStaffName())) { |
|
|
|
vo.setSalesName(schedule.getStaffName()); |
|
|
|
} |
|
|
|
if (null != schedule.getMainRepayDate()) { |
|
|
|
mainDate = sdf.format(schedule.getMainRepayDate()); |
|
|
|
} |
|
|
|
if (null != schedule.getOtherRepayDate()) { |
|
|
|
otherDate = sdf.format(schedule.getOtherRepayDate()); |
|
|
|
} |
|
|
|
String mainRepayDate = ""; |
|
|
|
String otherRepayDate = ""; |
|
|
|
//主产品月还日
|
|
|
|
if (StringUtils.isNotBlank(mainDate)) { |
|
|
|
String[] splitMainDate = mainDate.split("-"); |
|
|
|
String day = splitMainDate[2]; |
|
|
|
if (day.length() == 2 && Integer.parseInt(day) >= 10) { |
|
|
|
mainRepayDate = day; |
|
|
|
} else { |
|
|
|
mainRepayDate = day.replace("0", ""); |
|
|
|
} |
|
|
|
} |
|
|
|
//其他融月还日
|
|
|
|
if (StringUtils.isNotBlank(otherDate)) { |
|
|
|
String[] splitOtherDate = otherDate.split("-"); |
|
|
|
String day = splitOtherDate[2]; |
|
|
|
if (day.length() == 2 && Integer.parseInt(day) >= 10) { |
|
|
|
otherRepayDate = day; |
|
|
|
} else { |
|
|
|
otherRepayDate = day.replace("0", ""); |
|
|
|
} |
|
|
|
} |
|
|
|
//月还金额
|
|
|
|
if (null != schedule.getMainFirstRepay()) { |
|
|
|
mainF = schedule.getMainFirstRepay(); |
|
|
|
} |
|
|
|
if (null != schedule.getMainMidRepay()) { |
|
|
|
mainM = schedule.getMainMidRepay(); |
|
|
|
} |
|
|
|
if (null != schedule.getMainLastRepay()) { |
|
|
|
mainL = schedule.getMainLastRepay(); |
|
|
|
} |
|
|
|
if (null != schedule.getOtherFirstRepay()) { |
|
|
|
otherF = schedule.getOtherFirstRepay(); |
|
|
|
} |
|
|
|
if (null != schedule.getOtherMidRepay()) { |
|
|
|
otherM = schedule.getOtherMidRepay(); |
|
|
|
} |
|
|
|
if (null != schedule.getOtherLastRepay()) { |
|
|
|
otherL = schedule.getOtherLastRepay(); |
|
|
|
} |
|
|
|
//-----还款计划表列表信息-------
|
|
|
|
List<AppRepaymentPlanListDetailsVo> scheduleVins = new ArrayList<>(); |
|
|
|
if (StringUtils.isNotBlank(schedule.getMainPeriod())) { |
|
|
|
int mainPeriod = Integer.parseInt(schedule.getMainPeriod()); |
|
|
|
if (StringUtils.isNotBlank(schedule.getIsOtherPolicy())) { |
|
|
|
isOther = schedule.getIsOtherPolicy(); |
|
|
|
} |
|
|
|
String otherPer = ""; |
|
|
|
if (StringUtils.isNotBlank(schedule.getOtherPeriod())) { |
|
|
|
otherPer = schedule.getOtherPeriod(); |
|
|
|
} |
|
|
|
int otherMidPer = 0; |
|
|
|
int otherLastPer = 0; |
|
|
|
String month = ""; |
|
|
|
String year = ""; |
|
|
|
String moth = ""; |
|
|
|
String otherMoth = ""; |
|
|
|
String otherFDate = ""; |
|
|
|
String otherMonth = ""; |
|
|
|
if (StringUtils.isNotBlank(mainDate)) { |
|
|
|
String[] splitMain = mainDate.split("-"); |
|
|
|
year = splitMain[0]; |
|
|
|
moth = splitMain[1]; |
|
|
|
if (moth.length() == 2 && Integer.parseInt(moth) >= 10) { |
|
|
|
month = moth; |
|
|
|
} else { |
|
|
|
month = moth.replace("0", ""); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(otherDate)) { |
|
|
|
String[] splitOther = otherDate.split("-"); |
|
|
|
|
|
|
|
otherMoth = splitOther[1]; |
|
|
|
if (otherMoth.length() == 2 && Integer.parseInt(otherMoth) >= 10) { |
|
|
|
otherMonth = otherMoth; |
|
|
|
} else { |
|
|
|
otherMonth = otherMoth.replace("0", ""); |
|
|
|
} |
|
|
|
otherFDate = splitOther[0] + otherMonth; |
|
|
|
} |
|
|
|
for (int i = 1; i <= mainPeriod; i++) { |
|
|
|
String yearMonth = year + month; |
|
|
|
AppRepaymentPlanListDetailsVo scheduleVo = new AppRepaymentPlanListDetailsVo(); |
|
|
|
scheduleVo.setTimes(mainRepayDate); |
|
|
|
scheduleVo.setMonth(year + "年" + month + "月"); |
|
|
|
scheduleVo.setNumber(String.valueOf(i)); |
|
|
|
int m = Integer.parseInt(month); |
|
|
|
month = String.valueOf(++m); |
|
|
|
if (Integer.parseInt(month) > 12) { |
|
|
|
int y = Integer.parseInt(year); |
|
|
|
year = String.valueOf(++y); |
|
|
|
month = "1"; |
|
|
|
} |
|
|
|
if (isOther.equals("1")) { |
|
|
|
BigDecimal otherRepay = new BigDecimal(0); |
|
|
|
if (i == 1) { |
|
|
|
otherRepay = otherF; |
|
|
|
} else if (i == Integer.parseInt(otherPer)) { |
|
|
|
otherRepay = otherL; |
|
|
|
} else { |
|
|
|
otherRepay = otherM; |
|
|
|
} |
|
|
|
//首期
|
|
|
|
if (i == 1) { |
|
|
|
BigDecimal add = mainF.add(otherRepay); |
|
|
|
scheduleVo.setMonthlyPayment(add.toString()); |
|
|
|
scheduleVo.setTotal(add.toString()); |
|
|
|
} else if (i == mainPeriod) { |
|
|
|
BigDecimal add = mainL.add(otherRepay); |
|
|
|
scheduleVo.setMonthlyPayment(add.toString()); |
|
|
|
scheduleVo.setTotal(add.toString()); |
|
|
|
} else { |
|
|
|
BigDecimal add = mainM.add(otherRepay); |
|
|
|
scheduleVo.setMonthlyPayment(add.toString()); |
|
|
|
scheduleVo.setTotal(add.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
scheduleVins.add(scheduleVo); |
|
|
|
} |
|
|
|
if (!scheduleVins.isEmpty()) { |
|
|
|
vo.setRecords(scheduleVins); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|