|
|
@ -3,17 +3,19 @@ package com.yxt.anrui.riskcenter.biz.loanrelievemortgage; |
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.base.api.basetrailer.BaseTrailer; |
|
|
|
import com.yxt.anrui.base.api.basetrailer.BaseTrailerFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTemp; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.PrivilegeQuery; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanredemptionapply.LoanRedemptionApply; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanredemptionapply.LoanRedemptionApplyQuery; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanredemptionapply.LoanRedemptionApplyVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanredemptionapply.RedemptionVinList; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfile.LoanFile; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfile.LoanFileEnum; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanredemptionapply.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanredemptionveh.LoanRedemptionVeh; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrelievemortgage.LoanRelieveMortgage; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrelievemortgage.LoanRelieveMortgageQuery; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrelievemortgage.LoanRelieveMortgageSaveDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrelievemortgage.LoanRelieveMortgageVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrelievemortgage.*; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanfile.LoanFileService; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
@ -22,8 +24,15 @@ import com.yxt.common.core.vo.PagerVo; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: |
|
|
@ -35,6 +44,14 @@ public class LoanRelieveMortgageService extends MybatisBaseService<LoanRelieveMo |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SysUserFeign sysUserFeign; |
|
|
|
@Autowired |
|
|
|
private CrmCustomerTempFeign crmCustomerTempFeign; |
|
|
|
@Autowired |
|
|
|
private BaseTrailerFeign baseTrailerFeign; |
|
|
|
@Autowired |
|
|
|
private LoanFileService loanFileService; |
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
|
|
|
|
public ResultBean saveRelieveMortgage(LoanRelieveMortgageSaveDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
@ -144,4 +161,204 @@ public class LoanRelieveMortgageService extends MybatisBaseService<LoanRelieveMo |
|
|
|
PagerVo<LoanRelieveMortgageVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<MortgageInitVo> mortgageInit(String sid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
MortgageInitVo vo = new MortgageInitVo(); |
|
|
|
LoanRelieveMortgage entity = fetchBySid(sid); |
|
|
|
if (null != entity) { |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
if (StringUtils.isNotBlank(entity.getReceiveFiles())) { |
|
|
|
List<String> stringList = Arrays.asList(entity.getReceiveFiles().split(",")); |
|
|
|
vo.setConfirmFiles(stringList); |
|
|
|
} |
|
|
|
CrmCustomerTemp customerTemp = crmCustomerTempFeign.fetchEntity(entity.getCustomerSid()).getData(); |
|
|
|
if (null != customerTemp) { |
|
|
|
if (StringUtils.isNotBlank(customerTemp.getMobile())) { |
|
|
|
vo.setMobile(customerTemp.getMobile()); |
|
|
|
} |
|
|
|
} |
|
|
|
List<BaseTrailer> trailers = baseTrailerFeign.getByVehSid(entity.getVehSid()).getData(); |
|
|
|
if (!trailers.isEmpty()) { |
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
sb.append(entity.getVinNo()).append("/"); |
|
|
|
for (BaseTrailer trailer : trailers) { |
|
|
|
sb.append(trailer.getVinNo()).append("/"); |
|
|
|
} |
|
|
|
if (sb.length() > 0) { |
|
|
|
sb.delete(sb.length(), sb.length() - 1); |
|
|
|
} |
|
|
|
vo.setVinNo(sb.toString()); |
|
|
|
} |
|
|
|
List<LoanFile> fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.MORTGAGE_NOTICES.getAttachType()); |
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
List<String> files = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()). |
|
|
|
collect(Collectors.toList()); |
|
|
|
List<LoanRelieveMortgageFile> filess = new ArrayList<>(); |
|
|
|
for (String file : files) { |
|
|
|
LoanRelieveMortgageFile f = new LoanRelieveMortgageFile(); |
|
|
|
f.setUrl(file); |
|
|
|
filess.add(f); |
|
|
|
} |
|
|
|
vo.setNotices(filess); |
|
|
|
} |
|
|
|
List<LoanFile> fileList2 = loanFileService.selectByLinkSid(sid, LoanFileEnum.MORTGAGE_POROXY.getAttachType()); |
|
|
|
fileList2.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList2.isEmpty()) { |
|
|
|
List<String> files = fileList2.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()). |
|
|
|
collect(Collectors.toList()); |
|
|
|
List<LoanRelieveMortgageFile> filess = new ArrayList<>(); |
|
|
|
for (String file : files) { |
|
|
|
LoanRelieveMortgageFile f = new LoanRelieveMortgageFile(); |
|
|
|
f.setUrl(file); |
|
|
|
filess.add(f); |
|
|
|
} |
|
|
|
vo.setProxy(filess); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean mortgageHandle(MortgageInitDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String sid = dto.getSid(); |
|
|
|
LoanRelieveMortgage entity = fetchBySid(sid); |
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
if (null != entity) { |
|
|
|
if (StringUtils.isNotBlank(dto.getRemarks())) { |
|
|
|
entity.setRemarks(dto.getRemarks()); |
|
|
|
} |
|
|
|
if (!dto.getConfirmFiles().isEmpty()) { |
|
|
|
dto.getConfirmFiles().stream().forEach(s -> { |
|
|
|
sb.append(s).append(","); |
|
|
|
}); |
|
|
|
if (sb.length() > 0) { |
|
|
|
sb.delete(sb.length(), sb.length() - 1); |
|
|
|
} |
|
|
|
entity.setReceiveFiles(sb.toString()); |
|
|
|
} |
|
|
|
baseMapper.updateById(entity); |
|
|
|
//删除附件表中关于该linkSid的文件
|
|
|
|
loanFileService.delByLinkSidOrType(sid, LoanFileEnum.MORTGAGE_NOTICES.getAttachType()); |
|
|
|
loanFileService.delByLinkSidOrType(sid, LoanFileEnum.MORTGAGE_POROXY.getAttachType()); |
|
|
|
List<LoanRelieveMortgageFile> filess = dto.getNotices(); |
|
|
|
if (!filess.isEmpty()) { |
|
|
|
List<String> files = new ArrayList<>(); |
|
|
|
for (LoanRelieveMortgageFile file : filess) { |
|
|
|
files.add(file.getUrl()); |
|
|
|
} |
|
|
|
loanFileService.saveAll(sid, files, LoanFileEnum.MORTGAGE_NOTICES.getAttachType()); |
|
|
|
} |
|
|
|
List<LoanRelieveMortgageFile> pfiless = dto.getProxy(); |
|
|
|
if (!pfiless.isEmpty()) { |
|
|
|
List<String> files = new ArrayList<>(); |
|
|
|
for (LoanRelieveMortgageFile file : pfiless) { |
|
|
|
files.add(file.getUrl()); |
|
|
|
} |
|
|
|
loanFileService.saveAll(sid, files, LoanFileEnum.MORTGAGE_POROXY.getAttachType()); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<LoanRelieveMortgageTransferVo> transferInit(String sid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
LoanRelieveMortgageTransferVo vo = new LoanRelieveMortgageTransferVo(); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
LoanRelieveMortgage entity = fetchBySid(sid); |
|
|
|
if (null != entity) { |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
if (StringUtils.isNotBlank(entity.getReceiveFiles())) { |
|
|
|
List<String> stringList = Arrays.asList(entity.getReceiveFiles().split(",")); |
|
|
|
vo.setConfirmFiles(stringList); |
|
|
|
} |
|
|
|
if (null != entity.getTransferDate()) { |
|
|
|
vo.setTransferDate(sdf.format(entity.getTransferDate())); |
|
|
|
} |
|
|
|
CrmCustomerTemp customerTemp = crmCustomerTempFeign.fetchEntity(entity.getCustomerSid()).getData(); |
|
|
|
if (null != customerTemp) { |
|
|
|
if (StringUtils.isNotBlank(customerTemp.getMobile())) { |
|
|
|
vo.setMobile(customerTemp.getMobile()); |
|
|
|
} |
|
|
|
} |
|
|
|
List<BaseTrailer> trailers = baseTrailerFeign.getByVehSid(entity.getVehSid()).getData(); |
|
|
|
if (!trailers.isEmpty()) { |
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
sb.append(entity.getVinNo()).append("/"); |
|
|
|
for (BaseTrailer trailer : trailers) { |
|
|
|
sb.append(trailer.getVinNo()).append("/"); |
|
|
|
} |
|
|
|
if (sb.length() > 0) { |
|
|
|
sb.delete(sb.length(), sb.length() - 1); |
|
|
|
} |
|
|
|
vo.setVinNo(sb.toString()); |
|
|
|
} |
|
|
|
List<LoanFile> fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.MORTGAGE_NOTICES.getAttachType()); |
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
List<String> files = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()). |
|
|
|
collect(Collectors.toList()); |
|
|
|
List<LoanRelieveMortgageFile> filess = new ArrayList<>(); |
|
|
|
for (String file : files) { |
|
|
|
LoanRelieveMortgageFile f = new LoanRelieveMortgageFile(); |
|
|
|
f.setUrl(file); |
|
|
|
filess.add(f); |
|
|
|
} |
|
|
|
vo.setNotices(filess); |
|
|
|
} |
|
|
|
List<LoanFile> fileList2 = loanFileService.selectByLinkSid(sid, LoanFileEnum.MORTGAGE_POROXY.getAttachType()); |
|
|
|
fileList2.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList2.isEmpty()) { |
|
|
|
List<String> files = fileList2.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()). |
|
|
|
collect(Collectors.toList()); |
|
|
|
List<LoanRelieveMortgageFile> filess = new ArrayList<>(); |
|
|
|
for (String file : files) { |
|
|
|
LoanRelieveMortgageFile f = new LoanRelieveMortgageFile(); |
|
|
|
f.setUrl(file); |
|
|
|
filess.add(f); |
|
|
|
} |
|
|
|
vo.setProxy(filess); |
|
|
|
} |
|
|
|
List<LoanFile> fileList3 = loanFileService.selectByLinkSid(sid, LoanFileEnum.MORTGAGE_HANDOVER_INFO.getAttachType()); |
|
|
|
fileList3.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList3.isEmpty()) { |
|
|
|
List<String> files = fileList3.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()). |
|
|
|
collect(Collectors.toList()); |
|
|
|
List<LoanRelieveMortgageFile> filess = new ArrayList<>(); |
|
|
|
for (String file : files) { |
|
|
|
LoanRelieveMortgageFile f = new LoanRelieveMortgageFile(); |
|
|
|
f.setUrl(file); |
|
|
|
filess.add(f); |
|
|
|
} |
|
|
|
vo.setHandoverFiles(filess); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean mortgageTransfer(LoanRelieveMortgageTransferDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String sid = dto.getSid(); |
|
|
|
LoanRelieveMortgage entity = fetchBySid(sid); |
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
if (null != entity) { |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
entity.setState(0); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
//删除附件表中关于该linkSid的文件
|
|
|
|
loanFileService.delByLinkSidOrType(sid, LoanFileEnum.MORTGAGE_HANDOVER_INFO.getAttachType()); |
|
|
|
List<LoanRelieveMortgageFile> hfiless = dto.getHandoverFiles(); |
|
|
|
if (!hfiless.isEmpty()) { |
|
|
|
List<String> files = new ArrayList<>(); |
|
|
|
for (LoanRelieveMortgageFile file : hfiless) { |
|
|
|
files.add(file.getUrl()); |
|
|
|
} |
|
|
|
loanFileService.saveAll(sid, files, LoanFileEnum.MORTGAGE_HANDOVER_INFO.getAttachType()); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
} |
|
|
|