|
|
@ -7,23 +7,28 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
import com.yxt.anrui.base.api.basemiddleman.BaseMiddlemanDetailsVo; |
|
|
|
import com.yxt.anrui.base.api.basepurchasesystem.BasePurchaseSystemDetailsVo; |
|
|
|
import com.yxt.anrui.base.api.basepurchasesystem.BasePurchaseSystemFeign; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContract; |
|
|
|
import com.yxt.anrui.base.common.enums.BillTypeEnum; |
|
|
|
import com.yxt.anrui.base.common.utils.Rule; |
|
|
|
import com.yxt.anrui.base.common.utils.domain.BillNo; |
|
|
|
import com.yxt.anrui.buscenter.api.busdeposit.BusDeposit; |
|
|
|
import com.yxt.anrui.buscenter.api.busdepositfictitious.BusDepositFictitious; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrder; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderFL; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderSourceLCVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.*; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.app.order.AppOrderDiscountListVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.flowable.BusSalesOrderDelegateQuery; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorderborrower.BusSalesOrderBorrowerDetailsVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorderborrower.BusSalesOrderBorrowerFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorderdeposit.BusSalesOrderDeposit; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorderinsurance.BusSalesOrderInsuranceDetailsVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordermodel.BusSalesOrderModel; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorderprice.BusSalesOrderPrice; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordersubmit.BusSalesOrderSubmit; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicleFeign; |
|
|
|
import com.yxt.anrui.fin.api.finmanufacturerbank.FinManufacturerBank; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentrecord.FinPaymentrecord; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentrecord.FinPaymentrecordDto; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentrecord.FinPaymentrecordFeign; |
|
|
|
import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivablesDetailed; |
|
|
@ -31,6 +36,11 @@ import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivabl |
|
|
|
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.FinUncollectedReceivablesDetailed; |
|
|
|
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailedjr.FinUncollectedReceivablesDetailedJR; |
|
|
|
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailedjr.FinUncollectedReceivablesDetailedJRFeign; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.FinKingDeeFeign; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.bdcustomer.BdCustomer; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.voucher.GeneralVoucher; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.voucher.PaymentVoucher; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.voucher.SceneCodeEnum; |
|
|
|
import com.yxt.anrui.flowable.api.flow.FlowableFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo; |
|
|
|
import com.yxt.anrui.flowable.api.flow2.FlowDelegateQuery; |
|
|
@ -50,6 +60,7 @@ import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgVo; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.PrivilegeQuery; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanmonthlyaccrualrecord.LoanMonthlyAccrualRecord; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanoverduefin.UrlQuery; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymenthistory.LoanRepaymentHistory; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetails; |
|
|
@ -66,6 +77,7 @@ import com.yxt.anrui.riskcenter.api.loansettlevehicle.LoanSettleVehicleDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutions; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansolutions.app.SolutionsDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansolutionsdetail.LoanSolutionsDetail; |
|
|
|
import com.yxt.anrui.riskcenter.api.loantransferpaymentrecord.LoanTransferPaymentRecord; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrepaymenthistory.LoanRepaymentHistoryService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrepaymentplandetails.LoanRepaymentPlanDetailsService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrepaymentschedule.LoanRepaymentScheduleService; |
|
|
@ -92,6 +104,7 @@ import com.yxt.messagecenter.api.message.MessageFlowVo; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowableQuery; |
|
|
|
import com.yxt.messagecenter.api.messagelist.MessageList; |
|
|
|
import com.yxt.messagecenter.api.messagelist.MessageListFeign; |
|
|
|
import io.swagger.annotations.ApiModelProperty; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.tomcat.util.threads.ThreadPoolExecutor; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -173,6 +186,16 @@ public class LoanSettleApplyService extends MybatisBaseService<LoanSettleApplyMa |
|
|
|
private MessageListFeign messageListFeign; |
|
|
|
@Autowired |
|
|
|
private DocPdfComponent docPdfComponent; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderVehicleFeign busSalesOrderVehicleFeign; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderFeign busSalesOrderFeign; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderBorrowerFeign busSalesOrderBorrowerFeign; |
|
|
|
@Autowired |
|
|
|
private FinKingDeeFeign finKingDeeFeign; |
|
|
|
@Autowired |
|
|
|
private BasePurchaseSystemFeign basePurchaseSystemFeign; |
|
|
|
|
|
|
|
public PagerVo<LoanSettleApplyVo> listPageVo(PagerQuery<LoanSettleApplyQuery> pq) { |
|
|
|
LoanSettleApplyQuery query = pq.getParams(); |
|
|
@ -676,6 +699,35 @@ public class LoanSettleApplyService extends MybatisBaseService<LoanSettleApplyMa |
|
|
|
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
BigDecimal jmRate = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
BigDecimal rate1 = new BigDecimal("0.18"); //利率18%
|
|
|
|
BigDecimal rate2 = new BigDecimal("0.144"); //利率14.4%
|
|
|
|
BigDecimal fund = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
BigDecimal fundJm = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
LoanSettleCompanyCost companyCost = loanSettleCompanyCostService.selectByMainSid(businessSid); |
|
|
|
if (null != companyCost) { |
|
|
|
if (null != companyCost.getFunfCost()) { |
|
|
|
fund = companyCost.getFunfCost(); |
|
|
|
} |
|
|
|
} |
|
|
|
LoanSettleCompanyReduction reduction = loanSettleCompanyReductionService.selectByMainSid(businessSid); |
|
|
|
if (null != reduction) { |
|
|
|
if (null != reduction.getFundPenalty()) { |
|
|
|
fundJm = reduction.getFundPenalty(); |
|
|
|
} |
|
|
|
} |
|
|
|
jmRate = (fund.subtract(fundJm)).divide(fund,2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.36")); |
|
|
|
boolean isTure = false; |
|
|
|
boolean isTure2 = false; |
|
|
|
if (jmRate.compareTo(rate1) < 0) { |
|
|
|
isTure = true; |
|
|
|
} |
|
|
|
if (jmRate.compareTo(rate2) < 0) { |
|
|
|
isTure2 = true; |
|
|
|
} |
|
|
|
variables.put("isTure", isTure); |
|
|
|
variables.put("isTure2", isTure2); |
|
|
|
appMap.put("sid", businessSid); |
|
|
|
variables.put("app", appMap); |
|
|
|
//用户的部门全路径sid
|
|
|
@ -786,6 +838,36 @@ public class LoanSettleApplyService extends MybatisBaseService<LoanSettleApplyMa |
|
|
|
LoanSettleApply loanSettleApply = fetchBySid(businessSid); |
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
|
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
BigDecimal jmRate = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
BigDecimal rate1 = new BigDecimal("0.18"); //利率18%
|
|
|
|
BigDecimal rate2 = new BigDecimal("0.144"); //利率14.4%
|
|
|
|
BigDecimal fund = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
BigDecimal fundJm = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
LoanSettleCompanyCost companyCost = loanSettleCompanyCostService.selectByMainSid(businessSid); |
|
|
|
if (null != companyCost) { |
|
|
|
if (null != companyCost.getFunfCost()) { |
|
|
|
fund = companyCost.getFunfCost(); |
|
|
|
} |
|
|
|
} |
|
|
|
LoanSettleCompanyReduction reduction2 = loanSettleCompanyReductionService.selectByMainSid(businessSid); |
|
|
|
if (null != reduction2) { |
|
|
|
if (null != reduction2.getFundPenalty()) { |
|
|
|
fundJm = reduction2.getFundPenalty(); |
|
|
|
} |
|
|
|
} |
|
|
|
jmRate = (fund.subtract(fundJm)).divide(fund,2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.36")); |
|
|
|
boolean isTure = false; |
|
|
|
boolean isTure2 = false; |
|
|
|
if (jmRate.compareTo(rate1) < 0) { |
|
|
|
isTure = true; |
|
|
|
} |
|
|
|
if (jmRate.compareTo(rate2) < 0) { |
|
|
|
isTure2 = true; |
|
|
|
} |
|
|
|
variables.put("isTure", isTure); |
|
|
|
variables.put("isTure2", isTure2); |
|
|
|
appMap.put("sid", businessSid); |
|
|
|
variables.put("app", appMap); |
|
|
|
if (StringUtils.isNotBlank(loanSettleApply.getBusSid())) { |
|
|
@ -839,6 +921,8 @@ public class LoanSettleApplyService extends MybatisBaseService<LoanSettleApplyMa |
|
|
|
pushBankSettlePrice(loanSettleApply); |
|
|
|
//设置认款月还为已转付
|
|
|
|
updatePaymentStateByBusVinSid(loanSettleApply.getBusVinSid()); |
|
|
|
//推送财务凭证
|
|
|
|
pushSettleVoucher(loanSettleApply); |
|
|
|
} |
|
|
|
baseMapper.updateById(loanSettleApply); |
|
|
|
} else { |
|
|
@ -1444,6 +1528,156 @@ public class LoanSettleApplyService extends MybatisBaseService<LoanSettleApplyMa |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//--------推送财务结清凭证------------------
|
|
|
|
private void pushSettleVoucher(LoanSettleApply loanSettleApply) { |
|
|
|
String sid = loanSettleApply.getSid(); |
|
|
|
LoanSettleCompanyCost companyCost = loanSettleCompanyCostService.selectByMainSid(sid); |
|
|
|
LoanSettleCompanyReduction reduction = loanSettleCompanyReductionService.selectByMainSid(sid); |
|
|
|
LoanSettleBankCost bankCost = loanSettleBankCostService.selectByMainSid(sid); |
|
|
|
GeneralVoucher generalVoucher = new GeneralVoucher(); |
|
|
|
List<GeneralVoucher.GeneralVoucherDetail> voucherDetails = new ArrayList<>(); |
|
|
|
LoanRepaymentPlanDetails planDetails = baseMapper.selectMainPeriodByBusVinSid(loanSettleApply.getBusVinSid()); |
|
|
|
if (null != planDetails) { |
|
|
|
String useOrgSid = planDetails.getUseOrgSid(); |
|
|
|
SysOrganizationVo organizationVo = sysOrganizationFeign.fetchBySid(useOrgSid).getData(); |
|
|
|
if (null != organizationVo) { |
|
|
|
generalVoucher.setUseOrgCode(organizationVo.getOrgCode()); |
|
|
|
} |
|
|
|
String deptCode = ""; |
|
|
|
String customerNumber = ""; |
|
|
|
String scheduleSid = planDetails.getScheduleSid(); |
|
|
|
LoanRepaymentSchedule repaymentSchedule = loanRepaymentScheduleService.fetchBySid(scheduleSid); |
|
|
|
if (null != repaymentSchedule) { |
|
|
|
if (StringUtils.isNotBlank(repaymentSchedule.getCwDeptNo())) { |
|
|
|
deptCode = repaymentSchedule.getCwDeptNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(planDetails.getBusVinSid()).getData(); |
|
|
|
BusSalesOrder salesOrder = busSalesOrderFeign.fetchBySid(planDetails.getSalesOrderSid()).getData(); |
|
|
|
if (null != salesOrder) { |
|
|
|
if (null != busSalesOrderVehicle) { |
|
|
|
//判断财务系统是否有客户
|
|
|
|
Boolean aBoolean = finKingDeeFeign.customerExistState(busSalesOrderVehicle.getTemporaryNo()).getData(); |
|
|
|
String linkNo = ""; |
|
|
|
BusSalesOrderBorrowerDetailsVo borrowerDetailsVo = busSalesOrderBorrowerFeign.fetchDetailsBySid(busSalesOrderVehicle.getBorrowerSid()).getData(); |
|
|
|
if (!aBoolean) { |
|
|
|
// List<BdCustomer> bdCustomers = new ArrayList<>();
|
|
|
|
BdCustomer bdCustomer = new BdCustomer(); |
|
|
|
bdCustomer.setFNumber(busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
bdCustomer.setFShortName(salesOrder.getContractNo()); |
|
|
|
if (StringUtils.isNotBlank(salesOrder.getPurchaseSystemSid())) { |
|
|
|
BasePurchaseSystemDetailsVo data = basePurchaseSystemFeign.fetchDetailsByDeptSid(salesOrder.getPurchaseSystemSid()).getData(); |
|
|
|
bdCustomer.setTOrgIds(data.getOrgCode()); |
|
|
|
} |
|
|
|
bdCustomer.setTOrgIds(deptCode); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(busSalesOrderVehicle.getLinkNo())) { |
|
|
|
String vinNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
if (vinNo.length() > 8) { |
|
|
|
linkNo = vinNo.substring(vinNo.length() - 8); |
|
|
|
} else { |
|
|
|
linkNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
} |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + linkNo); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
// bdCustomers.add(bdCustomer);
|
|
|
|
ResultBean<String> resultBean = finKingDeeFeign.draftBdCustomer(bdCustomer); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
customerNumber = bdCustomer.getFNumber(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
customerNumber = busSalesOrderVehicle.getTemporaryNo(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BigDecimal fund = BigDecimal.ZERO;//资金占用费减免
|
|
|
|
BigDecimal bzjMoney = BigDecimal.ZERO;//剩余贷款保证金结转
|
|
|
|
BigDecimal bzjJM = BigDecimal.ZERO;//贷款保证金减免
|
|
|
|
BigDecimal bzjKF = BigDecimal.ZERO;//贷款保证金扣罚
|
|
|
|
BigDecimal sybzj = BigDecimal.ZERO;//贷款保证金扣罚
|
|
|
|
BigDecimal zfJQK = BigDecimal.ZERO;//资方结清款
|
|
|
|
int topping = 0; |
|
|
|
BigDecimal bbjDDMoney = BigDecimal.ZERO; //资方保证金抵顶
|
|
|
|
if (null != reduction) { |
|
|
|
if (null != reduction.getFundPenalty()) { |
|
|
|
fund = reduction.getFundPenalty(); |
|
|
|
} |
|
|
|
if (null != reduction.getDepositPenalty()) { |
|
|
|
bzjJM = reduction.getDepositPenalty(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (null != companyCost) { |
|
|
|
if (null != companyCost.getLoanDeposit()) { |
|
|
|
bzjMoney = companyCost.getLoanDeposit(); |
|
|
|
} |
|
|
|
if (null != companyCost.getDeductionAmount()) { |
|
|
|
bzjKF = companyCost.getDeductionAmount(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (null != bankCost) { |
|
|
|
if (null != bankCost.getBankSettlePrice()) { |
|
|
|
zfJQK = bankCost.getBankSettlePrice(); |
|
|
|
} |
|
|
|
topping = bankCost.getTopping(); |
|
|
|
if (null != bankCost.getLoanDeposit()) { |
|
|
|
bbjDDMoney = bankCost.getLoanDeposit(); |
|
|
|
} |
|
|
|
} |
|
|
|
sybzj = bzjMoney.subtract(bzjKF).add(bzjJM); |
|
|
|
//资金占用费减免凭证
|
|
|
|
if (fund.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
GeneralVoucher.GeneralVoucherDetail voucherDetail = new GeneralVoucher.GeneralVoucherDetail(); |
|
|
|
voucherDetail.setSceneCode("资金占用费减免"); |
|
|
|
voucherDetail.setBankName(planDetails.getBankName()); |
|
|
|
voucherDetail.setDeptCode(deptCode); |
|
|
|
voucherDetail.setCustomerCode(customerNumber); |
|
|
|
voucherDetail.setAmount(fund); |
|
|
|
voucherDetails.add(voucherDetail); |
|
|
|
} |
|
|
|
//剩余贷款保证金结转
|
|
|
|
if (sybzj.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
GeneralVoucher.GeneralVoucherDetail voucherDetail = new GeneralVoucher.GeneralVoucherDetail(); |
|
|
|
voucherDetail.setSceneCode("剩余贷款保证金结转"); |
|
|
|
voucherDetail.setBankName(planDetails.getBankName()); |
|
|
|
voucherDetail.setDeptCode(deptCode); |
|
|
|
voucherDetail.setCustomerCode(customerNumber); |
|
|
|
voucherDetail.setAmount(sybzj); |
|
|
|
voucherDetails.add(voucherDetail); |
|
|
|
} |
|
|
|
//贷款保证金扣罚
|
|
|
|
if (bzjKF.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
GeneralVoucher.GeneralVoucherDetail voucherDetail = new GeneralVoucher.GeneralVoucherDetail(); |
|
|
|
voucherDetail.setSceneCode("贷款保证金扣罚"); |
|
|
|
voucherDetail.setBankName(planDetails.getBankName()); |
|
|
|
voucherDetail.setDeptCode(deptCode); |
|
|
|
voucherDetail.setCustomerCode(customerNumber); |
|
|
|
voucherDetail.setAmount(bzjKF); |
|
|
|
voucherDetails.add(voucherDetail); |
|
|
|
} |
|
|
|
//资方结清款付款
|
|
|
|
if (zfJQK.compareTo(BigDecimal.ZERO) <= 0) { |
|
|
|
if (topping == 1) { |
|
|
|
if (bbjDDMoney.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
GeneralVoucher.GeneralVoucherDetail voucherDetail = new GeneralVoucher.GeneralVoucherDetail(); |
|
|
|
voucherDetail.setSceneCode("资方结清款付款"); |
|
|
|
voucherDetail.setBankName(planDetails.getBankName()); |
|
|
|
voucherDetail.setDeptCode(deptCode); |
|
|
|
voucherDetail.setCustomerCode(customerNumber); |
|
|
|
voucherDetail.setAmount(bbjDDMoney); |
|
|
|
voucherDetails.add(voucherDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
generalVoucher.setVoucherDetails(voucherDetails); |
|
|
|
finKingDeeFeign.saveSettleVoucher(generalVoucher); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//--------------------资方结清款到出纳代付款列表------------------
|
|
|
|
private void pushBankSettlePrice(LoanSettleApply loanSettleApply) { |
|
|
|
if (StringUtils.isBlank(loanSettleApply.getBusSid())) { |
|
|
@ -2054,6 +2288,38 @@ public class LoanSettleApplyService extends MybatisBaseService<LoanSettleApplyMa |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
LoanSettleApply loanSettleApply = fetchBySid(query.getBusinessSid()); |
|
|
|
bv.setModelId(loanSettleApply.getProcDefId()); |
|
|
|
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
BigDecimal jmRate = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
BigDecimal rate1 = new BigDecimal("0.18"); //利率18%
|
|
|
|
BigDecimal rate2 = new BigDecimal("0.144"); //利率14.4%
|
|
|
|
BigDecimal fund = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
BigDecimal fundJm = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
LoanSettleCompanyCost companyCost = loanSettleCompanyCostService.selectByMainSid(query.getBusinessSid()); |
|
|
|
if (null != companyCost) { |
|
|
|
if (null != companyCost.getFunfCost()) { |
|
|
|
fund = companyCost.getFunfCost(); |
|
|
|
} |
|
|
|
} |
|
|
|
LoanSettleCompanyReduction reduction = loanSettleCompanyReductionService.selectByMainSid(query.getBusinessSid()); |
|
|
|
if (null != reduction) { |
|
|
|
if (null != reduction.getFundPenalty()) { |
|
|
|
fundJm = reduction.getFundPenalty(); |
|
|
|
} |
|
|
|
} |
|
|
|
jmRate = (fund.subtract(fundJm)).divide(fund,2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.36")); |
|
|
|
boolean isTure = false; |
|
|
|
boolean isTure2 = false; |
|
|
|
if (jmRate.compareTo(rate1) < 0) { |
|
|
|
isTure = true; |
|
|
|
} |
|
|
|
if (jmRate.compareTo(rate2) < 0) { |
|
|
|
isTure2 = true; |
|
|
|
} |
|
|
|
variables.put("isTure", isTure); |
|
|
|
variables.put("isTure2", isTure2); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getPreviousNodesForReject(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给TemplateApplyNodeVo
|
|
|
|
List<LoanSettleApplyNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), LoanSettleApplyNodeVo.class)).collect(Collectors.toList()); |
|
|
@ -2066,6 +2332,38 @@ public class LoanSettleApplyService extends MybatisBaseService<LoanSettleApplyMa |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
LoanSettleApply loanSettleApply = fetchBySid(query.getBusinessSid()); |
|
|
|
bv.setModelId(loanSettleApply.getProcDefId()); |
|
|
|
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
BigDecimal jmRate = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
BigDecimal rate1 = new BigDecimal("0.18"); //利率18%
|
|
|
|
BigDecimal rate2 = new BigDecimal("0.144"); //利率14.4%
|
|
|
|
BigDecimal fund = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
BigDecimal fundJm = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
LoanSettleCompanyCost companyCost = loanSettleCompanyCostService.selectByMainSid(query.getBusinessSid()); |
|
|
|
if (null != companyCost) { |
|
|
|
if (null != companyCost.getFunfCost()) { |
|
|
|
fund = companyCost.getFunfCost(); |
|
|
|
} |
|
|
|
} |
|
|
|
LoanSettleCompanyReduction reduction = loanSettleCompanyReductionService.selectByMainSid(query.getBusinessSid()); |
|
|
|
if (null != reduction) { |
|
|
|
if (null != reduction.getFundPenalty()) { |
|
|
|
fundJm = reduction.getFundPenalty(); |
|
|
|
} |
|
|
|
} |
|
|
|
jmRate = (fund.subtract(fundJm)).divide(fund,2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.36")); |
|
|
|
boolean isTure = false; |
|
|
|
boolean isTure2 = false; |
|
|
|
if (jmRate.compareTo(rate1) < 0) { |
|
|
|
isTure = true; |
|
|
|
} |
|
|
|
if (jmRate.compareTo(rate2) < 0) { |
|
|
|
isTure2 = true; |
|
|
|
} |
|
|
|
variables.put("isTure", isTure); |
|
|
|
variables.put("isTure2", isTure2); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getNextNodesForSubmit(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给TemplateApplyNodeVo
|
|
|
|
List<LoanSettleApplyNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), LoanSettleApplyNodeVo.class)).collect(Collectors.toList()); |
|
|
@ -2093,6 +2391,35 @@ public class LoanSettleApplyService extends MybatisBaseService<LoanSettleApplyMa |
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
appMap.put("sid", businessSid); |
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
BigDecimal jmRate = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
BigDecimal rate1 = new BigDecimal("0.18"); //利率18%
|
|
|
|
BigDecimal rate2 = new BigDecimal("0.144"); //利率14.4%
|
|
|
|
BigDecimal fund = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
BigDecimal fundJm = BigDecimal.ZERO; //减免后的占用费年利率
|
|
|
|
LoanSettleCompanyCost companyCost = loanSettleCompanyCostService.selectByMainSid(businessSid); |
|
|
|
if (null != companyCost) { |
|
|
|
if (null != companyCost.getFunfCost()) { |
|
|
|
fund = companyCost.getFunfCost(); |
|
|
|
} |
|
|
|
} |
|
|
|
LoanSettleCompanyReduction reduction = loanSettleCompanyReductionService.selectByMainSid(businessSid); |
|
|
|
if (null != reduction) { |
|
|
|
if (null != reduction.getFundPenalty()) { |
|
|
|
fundJm = reduction.getFundPenalty(); |
|
|
|
} |
|
|
|
} |
|
|
|
jmRate = (fund.subtract(fundJm)).divide(fund,2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.36")); |
|
|
|
boolean isTure = false; |
|
|
|
boolean isTure2 = false; |
|
|
|
if (jmRate.compareTo(rate1) < 0) { |
|
|
|
isTure = true; |
|
|
|
} |
|
|
|
if (jmRate.compareTo(rate2) < 0) { |
|
|
|
isTure2 = true; |
|
|
|
} |
|
|
|
variables.put("isTure", isTure); |
|
|
|
variables.put("isTure2", isTure2); |
|
|
|
if (StringUtils.isNotBlank(loanSettleApply.getBusSid())) { |
|
|
|
variables.put("orderNames", "提前结清申请"); |
|
|
|
} |
|
|
@ -2431,6 +2758,8 @@ public class LoanSettleApplyService extends MybatisBaseService<LoanSettleApplyMa |
|
|
|
pushBankSettlePrice(loanSettleApply); |
|
|
|
//设置认款月还为已转付
|
|
|
|
updatePaymentStateByBusVinSid(loanSettleApply.getBusVinSid()); |
|
|
|
//推送财务凭证
|
|
|
|
pushSettleVoucher(loanSettleApply); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
@ -2794,4 +3123,162 @@ public class LoanSettleApplyService extends MybatisBaseService<LoanSettleApplyMa |
|
|
|
} |
|
|
|
return imgUrl; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<SettleFinVo> getFinSettleVo(String busVinSid, String receivablesName) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
SettleFinVo vo = new SettleFinVo(); |
|
|
|
LoanSettleApply apply = baseMapper.getFinSettleVo(busVinSid); |
|
|
|
if (null != apply) { |
|
|
|
String sid = apply.getSid(); |
|
|
|
BigDecimal amount = BigDecimal.ZERO; |
|
|
|
BigDecimal balance = BigDecimal.ZERO; |
|
|
|
BigDecimal subtrahend = BigDecimal.ZERO; |
|
|
|
LoanSettleCompanyCost companyCost = loanSettleCompanyCostService.selectByMainSid(sid); |
|
|
|
LoanSettleBankCost bankCost = loanSettleBankCostService.selectByMainSid(sid); |
|
|
|
if (null != companyCost) { |
|
|
|
if (receivablesName.equals("名义价")) { |
|
|
|
if (null != companyCost.getCompanyNominalPrice()) { |
|
|
|
amount = companyCost.getCompanyNominalPrice(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (receivablesName.equals("合同违约金")) { |
|
|
|
if (null != companyCost.getContractLiquidated()) { |
|
|
|
amount = companyCost.getContractLiquidated(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (receivablesName.equals("其他费用")) { |
|
|
|
if (null != companyCost.getCompanyOtherPrice()) { |
|
|
|
amount = companyCost.getCompanyOtherPrice(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (null != bankCost) { |
|
|
|
if (receivablesName.equals("名义价")) { |
|
|
|
if (null != bankCost.getBankNominalPrice()) { |
|
|
|
subtrahend = bankCost.getBankNominalPrice(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (receivablesName.equals("合同违约金")) { |
|
|
|
if (null != bankCost.getBankContractLiquidated()) { |
|
|
|
subtrahend = bankCost.getBankContractLiquidated(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (receivablesName.equals("其他费用")) { |
|
|
|
if (null != bankCost.getBankOtherReceivable()) { |
|
|
|
subtrahend = bankCost.getBankOtherReceivable(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
balance = amount.subtract(subtrahend); |
|
|
|
vo.setBusSid(sid); |
|
|
|
vo.setAmount(amount); |
|
|
|
vo.setBalance(balance); |
|
|
|
vo.setSubtrahend(subtrahend); |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
return rb; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean pushBankVoucher(String sid, String accountNumber, String payTypeCode) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
LoanSettleApply apply = fetchBySid(sid); |
|
|
|
LoanSettleBankCost bankCost = loanSettleBankCostService.selectByMainSid(sid); |
|
|
|
if (null != apply) { |
|
|
|
BigDecimal zfJQK = BigDecimal.ZERO;//资方结清款
|
|
|
|
int topping = 0; |
|
|
|
BigDecimal bbjDDMoney = BigDecimal.ZERO; //资方保证金抵顶
|
|
|
|
BigDecimal sub = BigDecimal.ZERO; //资方保证金差额
|
|
|
|
if (null != bankCost) { |
|
|
|
if (null != bankCost.getBankSettlePrice()) { |
|
|
|
zfJQK = bankCost.getBankSettlePrice(); |
|
|
|
} |
|
|
|
topping = bankCost.getTopping(); |
|
|
|
if (null != bankCost.getLoanDeposit()) { |
|
|
|
bbjDDMoney = bankCost.getLoanDeposit(); |
|
|
|
} |
|
|
|
} |
|
|
|
sub = zfJQK.subtract(bbjDDMoney); |
|
|
|
if (zfJQK.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
PaymentVoucher paymentVoucher = new PaymentVoucher(); |
|
|
|
paymentVoucher.setBankAccount(accountNumber); |
|
|
|
paymentVoucher.setPayTypeCode(payTypeCode); |
|
|
|
List<PaymentVoucher.PaymentVoucherDetail> voucherDetails = new ArrayList<>(); |
|
|
|
LoanRepaymentPlanDetails planDetails = baseMapper.selectMainPeriodByBusVinSid(apply.getBusVinSid()); |
|
|
|
if (null != planDetails) { |
|
|
|
PaymentVoucher.PaymentVoucherDetail voucherDetail = new PaymentVoucher.PaymentVoucherDetail(); |
|
|
|
if (topping == 1) { |
|
|
|
if (bbjDDMoney.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
voucherDetail.setSceneCode(SceneCodeEnum.settle_VOUCHER1.getCode()); |
|
|
|
} else { |
|
|
|
voucherDetail.setSceneCode(SceneCodeEnum.settle_VOUCHER2.getCode()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
voucherDetail.setSceneCode(SceneCodeEnum.settle_VOUCHER2.getCode()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(planDetails.getBankName())) { |
|
|
|
voucherDetail.setBankName(planDetails.getBankName()); |
|
|
|
} |
|
|
|
String useOrgSid = planDetails.getUseOrgSid(); |
|
|
|
SysOrganizationVo organizationVo = sysOrganizationFeign.fetchBySid(useOrgSid).getData(); |
|
|
|
if (null != organizationVo) { |
|
|
|
paymentVoucher.setUseOrgCode(organizationVo.getOrgCode()); |
|
|
|
} |
|
|
|
LoanRepaymentSchedule schedule = loanRepaymentScheduleService.fetchBySid(planDetails.getScheduleSid()); |
|
|
|
if (StringUtils.isNotBlank(schedule.getCwDeptNo())) { |
|
|
|
voucherDetail.setDeptCode(schedule.getCwDeptNo()); |
|
|
|
} |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(planDetails.getBusVinSid()).getData(); |
|
|
|
BusSalesOrder salesOrder = busSalesOrderFeign.fetchBySid(planDetails.getSalesOrderSid()).getData(); |
|
|
|
if (null != salesOrder) { |
|
|
|
if (null != busSalesOrderVehicle) { |
|
|
|
String customerNumber = ""; |
|
|
|
//判断财务系统是否有客户
|
|
|
|
Boolean aBoolean = finKingDeeFeign.customerExistState(busSalesOrderVehicle.getTemporaryNo()).getData(); |
|
|
|
String linkNo = ""; |
|
|
|
BusSalesOrderBorrowerDetailsVo borrowerDetailsVo = busSalesOrderBorrowerFeign.fetchDetailsBySid(busSalesOrderVehicle.getBorrowerSid()).getData(); |
|
|
|
if (!aBoolean) { |
|
|
|
// List<BdCustomer> bdCustomers = new ArrayList<>();
|
|
|
|
BdCustomer bdCustomer = new BdCustomer(); |
|
|
|
bdCustomer.setFNumber(busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
bdCustomer.setFShortName(salesOrder.getContractNo()); |
|
|
|
BasePurchaseSystemDetailsVo data = basePurchaseSystemFeign.fetchDetailsByDeptSid(salesOrder.getPurchaseSystemSid()).getData(); |
|
|
|
bdCustomer.setTOrgIds(data.getOrgCode()); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(busSalesOrderVehicle.getLinkNo())) { |
|
|
|
String vinNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
if (vinNo.length() > 8) { |
|
|
|
linkNo = vinNo.substring(vinNo.length() - 8); |
|
|
|
} else { |
|
|
|
linkNo = busSalesOrderVehicle.getLinkNo(); |
|
|
|
} |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + linkNo); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (null != borrowerDetailsVo) { |
|
|
|
bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
// bdCustomers.add(bdCustomer);
|
|
|
|
ResultBean<String> resultBean = finKingDeeFeign.draftBdCustomer(bdCustomer); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
customerNumber = bdCustomer.getFNumber(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
customerNumber = busSalesOrderVehicle.getTemporaryNo(); |
|
|
|
} |
|
|
|
voucherDetail.setCustomerCode(customerNumber); |
|
|
|
} |
|
|
|
} |
|
|
|
voucherDetail.setAmount(zfJQK); |
|
|
|
voucherDetail.setSubtrahend(bbjDDMoney); |
|
|
|
voucherDetail.setBalance(sub); |
|
|
|
voucherDetails.add(voucherDetail); |
|
|
|
} |
|
|
|
paymentVoucher.setVoucherDetails(voucherDetails); |
|
|
|
finKingDeeFeign.saveSettleBankVoucher(paymentVoucher); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
} |
|
|
|