|
|
@ -28,19 +28,20 @@ package com.yxt.anrui.riskcenter.biz.loanbecollectionveh; |
|
|
|
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.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicleFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanhomevisitinvestigateotherpeo.LoanHomevisitInvestigateOtherpeoDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanhomevisitinvestigate.LoanHomevisitInvestigateService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanhomevisitinvestigateotherpeo.LoanHomevisitInvestigateOtherpeoService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.LoanBeCollectionVeh; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.LoanBeCollectionVehQuery; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.LoanBeCollectionVehVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.LoanBeCollectionVehDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.LoanBeCollectionVehDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.LoanBeCollectionVehFeign; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
@ -60,66 +61,83 @@ import java.util.List; |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class LoanBeCollectionVehService extends MybatisBaseService<LoanBeCollectionVehMapper, LoanBeCollectionVeh> { |
|
|
|
private QueryWrapper<LoanBeCollectionVeh> createQueryWrapper(LoanBeCollectionVehQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
|
QueryWrapper<LoanBeCollectionVeh> qw = new QueryWrapper<>(); |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<LoanBeCollectionVehVo> listPageVo(PagerQuery<LoanBeCollectionVehQuery> pq) { |
|
|
|
LoanBeCollectionVehQuery query = pq.getParams(); |
|
|
|
QueryWrapper<LoanBeCollectionVeh> qw = createQueryWrapper(query); |
|
|
|
IPage<LoanBeCollectionVeh> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<LoanBeCollectionVehVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<LoanBeCollectionVehVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public String saveOrUpdateDto(LoanBeCollectionVehDto dto){ |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private BusSalesOrderVehicleFeign busSalesOrderVehicleFeign; |
|
|
|
@Autowired |
|
|
|
private LoanHomevisitInvestigateService loanHomevisitInvestigateService; |
|
|
|
@Autowired |
|
|
|
private LoanHomevisitInvestigateOtherpeoService loanHomevisitInvestigateOtherpeoService; |
|
|
|
|
|
|
|
private QueryWrapper<LoanBeCollectionVeh> createQueryWrapper(LoanBeCollectionVehQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
|
QueryWrapper<LoanBeCollectionVeh> qw = new QueryWrapper<>(); |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<LoanBeCollectionVehVo> listPageVo(PagerQuery<LoanBeCollectionVehQuery> pq) { |
|
|
|
LoanBeCollectionVehQuery query = pq.getParams(); |
|
|
|
QueryWrapper<LoanBeCollectionVeh> qw = createQueryWrapper(query); |
|
|
|
IPage<LoanBeCollectionVeh> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<LoanBeCollectionVehVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<LoanBeCollectionVehVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public String saveOrUpdateDto(LoanBeCollectionVehDto dto) { |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
String sid = this.insertByDto(dto); |
|
|
|
return sid; |
|
|
|
String sid = this.insertByDto(dto); |
|
|
|
return sid; |
|
|
|
} |
|
|
|
String sid = this.updateByDto(dto); |
|
|
|
return sid; |
|
|
|
} |
|
|
|
|
|
|
|
public String insertByDto(LoanBeCollectionVehDto dto){ |
|
|
|
LoanBeCollectionVeh entity = new LoanBeCollectionVeh(); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
entity.setCustomerName(dto.getCustName()); |
|
|
|
entity.setCustomerPhone(dto.getCustPhone()); |
|
|
|
baseMapper.insert(entity); |
|
|
|
return entity.getSid(); |
|
|
|
} |
|
|
|
|
|
|
|
public String updateByDto(LoanBeCollectionVehDto dto){ |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
String sid = this.updateByDto(dto); |
|
|
|
return sid; |
|
|
|
} |
|
|
|
|
|
|
|
public String insertByDto(LoanBeCollectionVehDto dto) { |
|
|
|
LoanBeCollectionVeh entity = new LoanBeCollectionVeh(); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
entity.setCustomerName(dto.getCustName()); |
|
|
|
entity.setCustomerPhone(dto.getCustPhone()); |
|
|
|
baseMapper.insert(entity); |
|
|
|
return entity.getSid(); |
|
|
|
} |
|
|
|
|
|
|
|
public String updateByDto(LoanBeCollectionVehDto dto) { |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
LoanBeCollectionVeh entity = fetchBySid(dtoSid); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
entity.setCustomerName(dto.getCustName()); |
|
|
|
entity.setCustomerPhone(dto.getCustPhone()); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
return entity.getSid(); |
|
|
|
} |
|
|
|
|
|
|
|
public LoanBeCollectionVehDetailsVo fetchDetailsVoBySid(String sid){ |
|
|
|
LoanBeCollectionVeh entity = fetchBySid(sid); |
|
|
|
LoanBeCollectionVehDetailsVo vo = new LoanBeCollectionVehDetailsVo(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
} |
|
|
|
LoanBeCollectionVeh entity = fetchBySid(dtoSid); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
entity.setCustomerName(dto.getCustName()); |
|
|
|
entity.setCustomerPhone(dto.getCustPhone()); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
return entity.getSid(); |
|
|
|
} |
|
|
|
|
|
|
|
public LoanBeCollectionVehDetailsVo fetchDetailsVoBySid(String sid) { |
|
|
|
LoanBeCollectionVeh entity = fetchBySid(sid); |
|
|
|
LoanBeCollectionVehDetailsVo vo = new LoanBeCollectionVehDetailsVo(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
|
|
|
|
public void delByMainSid(String dtoSid) { |
|
|
|
baseMapper.delByMainSid(dtoSid); |
|
|
|
} |
|
|
|
|
|
|
|
public void delByMainSid(String dtoSid) { |
|
|
|
baseMapper.delByMainSid(dtoSid); |
|
|
|
} |
|
|
|
public List<LoanBeCollectionVehDetailsVo> selByMainSid(String sid) { |
|
|
|
return baseMapper.selByMainSid(sid); |
|
|
|
} |
|
|
|
|
|
|
|
public List<LoanBeCollectionVehDetailsVo> selByMainSid(String sid) { |
|
|
|
return baseMapper.selByMainSid(sid); |
|
|
|
} |
|
|
|
public LoanBeCollectionVehDbrDetailsVo initDbr(String saleVehSid) { |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(saleVehSid).getData(); |
|
|
|
String sid = loanHomevisitInvestigateService.selectByBorrSid(busSalesOrderVehicle.getBorrowerSid()); |
|
|
|
LoanHomevisitInvestigateOtherpeoDetailsVo loanHomevisitInvestigateOtherpeoDetailsVo = loanHomevisitInvestigateOtherpeoService.selByMainSidAndSaleVehSid(sid, saleVehSid); |
|
|
|
LoanBeCollectionVehDbrDetailsVo loanBeCollectionVehDbrDetailsVo = new LoanBeCollectionVehDbrDetailsVo(); |
|
|
|
BeanUtil.copyProperties(loanHomevisitInvestigateOtherpeoDetailsVo, loanBeCollectionVehDbrDetailsVo); |
|
|
|
return loanBeCollectionVehDbrDetailsVo; |
|
|
|
} |
|
|
|
} |