|
|
@ -38,10 +38,16 @@ import com.yxt.anrui.riskcenter.api.loansecondarysalesapply.flowable.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalescost.LoanSecondarySalesCostVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalesveh.LoanSecondarySalesVeh; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalesveh.LoanSecondarySalesVehVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutions; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansolutionsdetail.LoanSolutionsDetail; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrestorereportapply.LoanRestoreReportApplyService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanreturninboundapply.LoanReturnInboundApplyService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanreturnvehledger.LoanReturnVehLedgerService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansecondarysalescost.LoanSecondarySalesCostService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansecondarysalesveh.LoanSecondarySalesVehService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansolutions.LoanSolutionsMapper; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansolutions.LoanSolutionsService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansolutionsdetail.LoanSolutionsDetailService; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
@ -56,6 +62,7 @@ import org.apache.tomcat.util.threads.ThreadPoolExecutor; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -92,6 +99,12 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon |
|
|
|
private LoanReturnVehLedgerService loanReturnVehLedgerService; |
|
|
|
@Autowired |
|
|
|
private LoanReturnInboundApplyService loanReturnInboundApplyService; |
|
|
|
@Autowired |
|
|
|
private LoanRestoreReportApplyService loanRestoreReportApplyService; |
|
|
|
@Autowired |
|
|
|
private LoanSolutionsMapper loanSolutionsMapper; |
|
|
|
@Autowired |
|
|
|
private LoanSolutionsDetailService loanSolutionsDetailService; |
|
|
|
|
|
|
|
public PagerVo<LoanSecondarySalesApplyVo> listPageVo(PagerQuery<LoanSecondarySalesApplyQuery> pq) { |
|
|
|
LoanSecondarySalesApplyQuery query = pq.getParams(); |
|
|
@ -538,7 +551,33 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon |
|
|
|
loanSecondarySalesCostService.saveCost(loanSecondarySalesCost, sid); |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
LoanSecondarySalesApply loanSecondarySalesApply = fetchBySid(sid); |
|
|
|
if (loanSecondarySalesApply == null) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
dto.setUserSid(loanSecondarySalesApply.getCreateBySid()); |
|
|
|
BeanUtil.copyProperties(dto, loanSecondarySalesApply, "sid"); |
|
|
|
List<UrlQuery> filss = dto.getFilesList(); |
|
|
|
if (!filss.isEmpty()) { |
|
|
|
List<String> filesList = filss.stream().map(v -> v.getUrl()).collect(Collectors.toList()); |
|
|
|
if (!filesList.isEmpty()) { |
|
|
|
String files = String.join(",", filesList).replaceAll(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
loanSecondarySalesApply.setFiles(files); |
|
|
|
} |
|
|
|
} else { |
|
|
|
loanSecondarySalesApply.setFiles(""); |
|
|
|
} |
|
|
|
//保存车辆
|
|
|
|
List<LoanSecondarySalesVehVo> loanSecondarySalesVehVoList = dto.getLoanSecondarySalesVehVoList(); |
|
|
|
loanSecondarySalesVehVoList.removeAll(Collections.singleton(null)); |
|
|
|
if (!loanSecondarySalesVehVoList.isEmpty()) { |
|
|
|
loanSecondarySalesVehService.saveVeh(loanSecondarySalesVehVoList, sid); |
|
|
|
} |
|
|
|
LoanSecondarySalesCostVo loanSecondarySalesCost = dto.getLoanSecondarySalesCost(); |
|
|
|
if (loanSecondarySalesCost != null) { |
|
|
|
loanSecondarySalesCostService.saveCost(loanSecondarySalesCost, sid); |
|
|
|
} |
|
|
|
baseMapper.updateById(loanSecondarySalesApply); |
|
|
|
} |
|
|
|
return rb.success().setData(sid); |
|
|
|
} |
|
|
@ -593,8 +632,6 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon |
|
|
|
return rb.setMsg("请选择车辆"); |
|
|
|
} |
|
|
|
String busVinSid = ""; |
|
|
|
String vinNo = ""; |
|
|
|
String saleOrderSid = ""; |
|
|
|
List<String> vinNoLists = new ArrayList<>(); |
|
|
|
List<String> bankContractNoList = new ArrayList<>(); |
|
|
|
List<LoanSecondarySalesVehVo> loanSecondarySalesVehVoList = new ArrayList<>(); |
|
|
@ -611,19 +648,66 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon |
|
|
|
} |
|
|
|
busVinSid = loanReturnInboundApply.getBusVinSid(); |
|
|
|
if ("主车".equals(loanReturnVehLedger.getVehType())) { |
|
|
|
if ("未处置".equals(loanReturnVehLedger.getVehType())) { |
|
|
|
if ("未处置".equals(loanReturnVehLedger.getDisposal())) { |
|
|
|
loanSecondarySalesVehVo.setBusVinSid(loanReturnVehLedger.getBusVinSid()); |
|
|
|
loanSecondarySalesVehVo.setVinNo(loanReturnVehLedger.getVinNo()); |
|
|
|
loanSecondarySalesVehVo.setVehMark(loanReturnVehLedger.getVehMark()); |
|
|
|
loanSecondarySalesVehVo.setModelName(loanReturnVehLedger.getVehModel()); |
|
|
|
loanSecondarySalesVehVo.setModelSid(loanReturnVehLedger.getVehModelSid()); |
|
|
|
loanSecondarySalesVehVo.setConfigSid(loanReturnVehLedger.getConfigSid()); |
|
|
|
loanSecondarySalesVehVo.setBusVinSid(busVinSid); |
|
|
|
loanSecondarySalesVehVo.setVehType(loanReturnVehLedger.getVehType()); |
|
|
|
loanSecondarySalesVehVoList.add(loanSecondarySalesVehVo); |
|
|
|
loanSecondarySalesApplyDetailsVo.setCustomerName(loanReturnVehLedger.getCustomer()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setLoanName(loanReturnVehLedger.getBorrowerName()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setCustomerSid(loanReturnVehLedger.getCustomerSid()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setLoanSid(loanReturnVehLedger.getBorrowerSid()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setLoanContractNo(loanReturnInboundApply.getLoanContractNo()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setBankName(loanReturnInboundApply.getBankName()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setBankContractNo(loanReturnInboundApply.getBankContractNo()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setLocationName(loanReturnVehLedger.getLocation()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setSalesOrderSid(loanReturnVehLedger.getSaleOrderSid()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setFirstDate(loanReturnInboundApply.getFirstDate()); |
|
|
|
if (StringUtils.isNotBlank(loanReturnInboundApply.getFiles())) { |
|
|
|
List<UrlQuery> list = new ArrayList<>(); |
|
|
|
if (StringUtils.isNotBlank(loanReturnInboundApply.getFiles())) { |
|
|
|
List<String> fileList = Arrays.asList(loanReturnInboundApply.getFiles().split(",")).stream().map(c -> fileUploadComponent.getUrlPrefix() + c).collect(Collectors.toList()); |
|
|
|
for (int j = 0; j < fileList.size(); j++) { |
|
|
|
UrlQuery urlQuery = new UrlQuery(); |
|
|
|
urlQuery.setUrl(fileList.get(j)); |
|
|
|
list.add(urlQuery); |
|
|
|
} |
|
|
|
loanSecondarySalesApplyDetailsVo.setFilesList(list); |
|
|
|
} |
|
|
|
} |
|
|
|
LoanSecondarySalesCostVo loanSecondarySalesCost = new LoanSecondarySalesCostVo(); |
|
|
|
AlrepaidAndArrVo alrepaidAndArrVo = loanRestoreReportApplyService.getAlrepaidAndArr(busVinSid); |
|
|
|
if (alrepaidAndArrVo != null) { |
|
|
|
BeanUtil.copyProperties(alrepaidAndArrVo, loanSecondarySalesApplyDetailsVo); |
|
|
|
BigDecimal bigDecimal = BigDecimal.ZERO; |
|
|
|
if (StringUtils.isNotBlank(alrepaidAndArrVo.getCurrentBeMoney())) { |
|
|
|
bigDecimal = bigDecimal.add(new BigDecimal(alrepaidAndArrVo.getCurrentBeMoney())); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(alrepaidAndArrVo.getUnexpiredMoney())) { |
|
|
|
bigDecimal = bigDecimal.add(new BigDecimal(alrepaidAndArrVo.getUnexpiredMoney())); |
|
|
|
} |
|
|
|
loanSecondarySalesCost.setArrearsAll(bigDecimal.toString()); |
|
|
|
} |
|
|
|
loanSecondarySalesApplyDetailsVo.setLoanSecondarySalesCost(loanSecondarySalesCost); |
|
|
|
//根据销售订单查询金额方案
|
|
|
|
LoanSolutions loanSolutions = loanSolutionsMapper.selectBySaleOrderSid(loanReturnVehLedger.getSaleOrderSid()); |
|
|
|
if (loanSolutions != null) { |
|
|
|
LoanSolutionsDetail loanSolutionsDetail = loanSolutionsDetailService.selectLoanSid(loanSolutions.getSid()); |
|
|
|
if (loanSolutionsDetail != null) { |
|
|
|
loanSecondarySalesCost.setLoanDeposit(loanSolutionsDetail.getBondAmounts().toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//根据主车查询挂车信息
|
|
|
|
LoanReturnVehLedger loanReturnVehLedgerT = loanReturnVehLedgerService.selectByPSid(loanReturnVehLedger.getSid()); |
|
|
|
if ("未处置".equals(loanReturnVehLedgerT.getVehType())) { |
|
|
|
if ("未处置".equals(loanReturnVehLedgerT.getDisposal())) { |
|
|
|
loanSecondarySalesVehVo = new LoanSecondarySalesVehVo(); |
|
|
|
loanSecondarySalesVehVo.setVehType(loanReturnVehLedgerT.getVehType()); |
|
|
|
loanSecondarySalesVehVo.setVehMark(loanReturnVehLedgerT.getVehMark()); |
|
|
@ -632,15 +716,29 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon |
|
|
|
loanSecondarySalesVehVoList.add(loanSecondarySalesVehVo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
if ("挂车".equals(loanReturnVehLedger.getVehType())) { |
|
|
|
if ("未处置".equals(loanReturnVehLedger.getVehType())) { |
|
|
|
if ("未处置".equals(loanReturnVehLedger.getDisposal())) { |
|
|
|
loanSecondarySalesVehVo = new LoanSecondarySalesVehVo(); |
|
|
|
loanSecondarySalesVehVo.setVehType(loanReturnVehLedger.getVehType()); |
|
|
|
loanSecondarySalesVehVo.setVehMark(loanReturnVehLedger.getVehMark()); |
|
|
|
loanSecondarySalesVehVo.setVinNo(loanReturnVehLedger.getVinNo()); |
|
|
|
loanSecondarySalesVehVo.setModelName(loanReturnVehLedger.getVehModel()); |
|
|
|
loanSecondarySalesVehVoList.add(loanSecondarySalesVehVo); |
|
|
|
loanSecondarySalesApplyDetailsVo.setCustomerName(loanReturnVehLedger.getCustomer()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setLoanName(loanReturnVehLedger.getBorrowerName()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setCustomerSid(loanReturnVehLedger.getCustomerSid()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setLoanSid(loanReturnVehLedger.getBorrowerSid()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setLoanContractNo(loanReturnInboundApply.getLoanContractNo()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setBankName(loanReturnInboundApply.getBankName()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setBankContractNo(loanReturnInboundApply.getBankContractNo()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setLocationName(loanReturnVehLedger.getLocation()); |
|
|
|
loanSecondarySalesApplyDetailsVo.setSalesOrderSid(loanReturnVehLedger.getSaleOrderSid()); |
|
|
|
AlrepaidAndArrVo alrepaidAndArrVo = loanRestoreReportApplyService.getAlrepaidAndArr(busVinSid); |
|
|
|
if (alrepaidAndArrVo != null) { |
|
|
|
BeanUtil.copyProperties(alrepaidAndArrVo, loanSecondarySalesApplyDetailsVo); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|