|
|
@ -35,13 +35,21 @@ import com.yxt.anrui.riskcenter.api.loanreturninboundtrailer.LoanReturnInboundTr |
|
|
|
import com.yxt.anrui.riskcenter.api.loanreturnvehledger.LoanReturnVehLedger; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalesapply.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalesapply.flowable.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalescost.LoanSecondarySalesCost; |
|
|
|
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.LoanSecondarySalesCostMapper; |
|
|
|
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 +64,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 +101,14 @@ 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; |
|
|
|
@Autowired |
|
|
|
private LoanSecondarySalesCostMapper loanSecondarySalesCostMapper; |
|
|
|
|
|
|
|
public PagerVo<LoanSecondarySalesApplyVo> listPageVo(PagerQuery<LoanSecondarySalesApplyQuery> pq) { |
|
|
|
LoanSecondarySalesApplyQuery query = pq.getParams(); |
|
|
@ -364,12 +381,26 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean complete(BusinessVariables bv) { |
|
|
|
public ResultBean complete(BusinessVariables bv, String price) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String businessSid = bv.getBusinessSid(); |
|
|
|
LoanSecondarySalesApply loanSecondarySalesApply = fetchBySid(businessSid); |
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
if ("Activity_0rm74ey".equals(bv.getTaskDefKey())) {//风控处置岗审批
|
|
|
|
if (StringUtils.isBlank(price)) { |
|
|
|
return rb.setMsg("请填写评估价格"); |
|
|
|
} |
|
|
|
//保存评估价格
|
|
|
|
LoanSecondarySalesCost loanSecondarySalesCost = loanSecondarySalesCostMapper.selectMainSid(businessSid); |
|
|
|
loanSecondarySalesCost.setVehicleEvaluation(new BigDecimal(price)); |
|
|
|
loanSecondarySalesCostService.updateById(loanSecondarySalesCost); |
|
|
|
if (loanSecondarySalesCost.getVehicleEvaluation().compareTo(loanSecondarySalesCost.getVehPrice()) > 0) { |
|
|
|
variables.put("isTrue", true); |
|
|
|
} else { |
|
|
|
variables.put("isTrue", false); |
|
|
|
} |
|
|
|
} |
|
|
|
appMap.put("sid", businessSid); |
|
|
|
variables.put("app", appMap); |
|
|
|
bv.setFormVariables(variables); |
|
|
@ -441,7 +472,7 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon |
|
|
|
bv.setFormVariables(variables); |
|
|
|
if (r == 1) { |
|
|
|
//ToDo:流程定义id
|
|
|
|
bv.setModelId(ProcDefEnum.LOANRETUENINBOUNDAPPLY.getProDefId()); |
|
|
|
bv.setModelId(ProcDefEnum.LOANSECONDSALEAPPLY.getProDefId()); |
|
|
|
ResultBean<UpdateFlowFieldVo> voResultBean = flowFeign.startProcess(bv); |
|
|
|
if (!voResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(voResultBean.getMsg()); |
|
|
@ -485,7 +516,7 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon |
|
|
|
bv.setTaskDefKey(loanSecondarySalesApply.getTaskDefKey()); |
|
|
|
bv.setComment("重新提交"); |
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
return complete(bv); |
|
|
|
return complete(bv, ""); |
|
|
|
} |
|
|
|
return rb; |
|
|
|
} |
|
|
@ -538,7 +569,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 +650,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 +666,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 +734,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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|