|
|
@ -4,7 +4,12 @@ import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomer.CrmCustomer; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTemp; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempVo; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CustomerSecondSalesDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanoutboundapply.LoanOutboundApply; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanoutboundapply.LoanOutboundApplyDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanoutboundapply.OutboundVinListDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanreturnvehledger.LoanReturnVehLedger; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalesapply.LoanSecondarySalesApply; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalescost.LoanSecondarySalesCost; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalescustomer.FileQuery; |
|
|
@ -12,6 +17,9 @@ import com.yxt.anrui.riskcenter.api.loansecondarysalescustomer.LoanSecondarySale |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalescustomer.LoanSecondarySalesCustomerDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalescustomer.SalesInitVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalesveh.LoanSecondarySalesVehVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalesveh.SalesVehVo; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanoutboundapply.LoanOutboundApplyService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanreturnvehledger.LoanReturnVehLedgerService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansecondarysalesapply.LoanSecondarySalesApplyService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansecondarysalescost.LoanSecondarySalesCostMapper; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansecondarysalescost.LoanSecondarySalesCostService; |
|
|
@ -44,6 +52,10 @@ public class LoanSecondarySalesCustomerService extends MybatisBaseService<LoanSe |
|
|
|
private LoanSecondarySalesCostMapper loanSecondarySalesCostMapper; |
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
@Autowired |
|
|
|
private LoanOutboundApplyService loanOutboundApplyService; |
|
|
|
@Autowired |
|
|
|
private LoanReturnVehLedgerService loanReturnVehLedgerService; |
|
|
|
|
|
|
|
public ResultBean saveSalesCustomer(LoanSecondarySalesCustomerDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
@ -106,6 +118,10 @@ public class LoanSecondarySalesCustomerService extends MybatisBaseService<LoanSe |
|
|
|
} |
|
|
|
baseMapper.updateById(loanSecondarySalesCustomer); |
|
|
|
} |
|
|
|
if(loanSecondarySalesApply != null){ |
|
|
|
pushVehOutBound(loanSecondarySalesApply); |
|
|
|
} |
|
|
|
|
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
@ -161,4 +177,48 @@ public class LoanSecondarySalesCustomerService extends MybatisBaseService<LoanSe |
|
|
|
|
|
|
|
return rb.success().setData(salesInitVo); |
|
|
|
} |
|
|
|
|
|
|
|
private void pushVehOutBound(LoanSecondarySalesApply loanSecondarySalesApply) { |
|
|
|
LoanOutboundApply loanOutboundApply = loanOutboundApplyService.selectByApplySid(loanSecondarySalesApply.getSid()); |
|
|
|
if(loanOutboundApply == null){ |
|
|
|
LoanOutboundApplyDto dto = new LoanOutboundApplyDto(); |
|
|
|
List<OutboundVinListDto> vinList = new ArrayList<>(); |
|
|
|
BeanUtil.copyProperties(loanSecondarySalesApply, dto); |
|
|
|
dto.setApplySid(loanSecondarySalesApply.getSid()); |
|
|
|
dto.setBorrowerName(loanSecondarySalesApply.getLoanName()); |
|
|
|
dto.setBorrowerSid(loanSecondarySalesApply.getLoanSid()); |
|
|
|
dto.setCustomer(loanSecondarySalesApply.getCustomerName()); |
|
|
|
dto.setDisposalKey("03"); |
|
|
|
dto.setDisposal("二次销售"); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(loanSecondarySalesApply.getCustomerSid())) { |
|
|
|
dto.setNewCustomerSid(loanSecondarySalesApply.getCustomerSid()); |
|
|
|
CrmCustomerTempVo customerTempVo = crmCustomerTempFeign.fetchSid(loanSecondarySalesApply.getCustomerSid()).getData(); |
|
|
|
if (null != customerTempVo) { |
|
|
|
if (StringUtils.isNotBlank(customerTempVo.getMobile())) { |
|
|
|
dto.setPhoneNum(customerTempVo.getMobile()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(loanSecondarySalesApply.getCustomerName())) { |
|
|
|
dto.setNewCustomer(loanSecondarySalesApply.getCustomerName()); |
|
|
|
} |
|
|
|
List<SalesVehVo> vinLists = loanSecondarySalesVehService.selByMainSid(loanSecondarySalesApply.getSid()); |
|
|
|
if (!vinLists.isEmpty()) { |
|
|
|
vinLists.forEach(v -> { |
|
|
|
OutboundVinListDto outboundVinListDto = new OutboundVinListDto(); |
|
|
|
BeanUtil.copyProperties(v, outboundVinListDto); |
|
|
|
LoanReturnVehLedger loanReturnVehLedger = loanReturnVehLedgerService.selVehLedgerBySid(v.getLedgerSid()); |
|
|
|
if (null != loanReturnVehLedger) { |
|
|
|
if (StringUtils.isNotBlank(loanReturnVehLedger.getLocation())) { |
|
|
|
outboundVinListDto.setLocation(loanReturnVehLedger.getLocation()); |
|
|
|
} |
|
|
|
} |
|
|
|
vinList.add(outboundVinListDto); |
|
|
|
}); |
|
|
|
} |
|
|
|
dto.setVinList(vinList); |
|
|
|
loanOutboundApplyService.saveOutbound(dto); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|