|
|
@ -38,22 +38,19 @@ import com.yxt.anrui.fin.api.finvehicleinvoice.FinVehicleInvoice; |
|
|
|
import com.yxt.anrui.fin.api.finvehicleinvoice.FinVehicleInvoiceFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationVo; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.PrivilegeQuery; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionapply.LoanBeCollectionApply; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionapply.LoanBeCollectionApplyDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionapply.LoanBeCollectionApplyVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionapply.LoanBeCollectionFileVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionrecord.LoanBeCollectionRecordVehInit; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.LoanBeCollectionVehDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.LoanBeCollectionVehDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.LoanBeCollectionVehFile; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfile.LoanFile; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfile.LoanFileEnum; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutions; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanvehclearanceapply.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanvehclearanceveh.LoanVehClearanceVehDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanvehclearanceveh.LoanVehClearanceVehDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanvehclearanceveh.LoanVehClearanceVehFile; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanvehclearanceveh.*; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanfile.LoanFileService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanhomevisitinvestigate.LoanHomevisitInvestigateService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansolutions.LoanSolutionsService; |
|
|
@ -71,7 +68,7 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -90,230 +87,321 @@ import java.util.List; |
|
|
|
@Service |
|
|
|
public class LoanVehClearanceApplyService extends MybatisBaseService<LoanVehClearanceApplyMapper, LoanVehClearanceApply> { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SysUserFeign sysUserFeign; |
|
|
|
@Resource |
|
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
@Autowired |
|
|
|
private LoanFileService loanFileService; |
|
|
|
@Autowired |
|
|
|
private LoanVehClearanceVehService loanVehClearanceVehService; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderVehicleFeign busSalesOrderVehicleFeign; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderFeign busSalesOrderFeign; |
|
|
|
@Autowired |
|
|
|
private LoanSolutionsService loanSolutionsService; |
|
|
|
@Autowired |
|
|
|
private FinVehicleInvoiceFeign finVehicleInvoiceFeign; |
|
|
|
@Autowired |
|
|
|
private LoanHomevisitInvestigateService loanHomevisitInvestigateService; |
|
|
|
@Autowired |
|
|
|
private SysUserFeign sysUserFeign; |
|
|
|
@Resource |
|
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
@Autowired |
|
|
|
private LoanFileService loanFileService; |
|
|
|
@Autowired |
|
|
|
private LoanVehClearanceVehService loanVehClearanceVehService; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderVehicleFeign busSalesOrderVehicleFeign; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderFeign busSalesOrderFeign; |
|
|
|
@Autowired |
|
|
|
private LoanSolutionsService loanSolutionsService; |
|
|
|
@Autowired |
|
|
|
private FinVehicleInvoiceFeign finVehicleInvoiceFeign; |
|
|
|
@Autowired |
|
|
|
private LoanHomevisitInvestigateService loanHomevisitInvestigateService; |
|
|
|
@Autowired |
|
|
|
SysStaffOrgFeign sysStaffOrgFeign; |
|
|
|
|
|
|
|
public PagerVo<LoanVehClearanceApplyVo> listPageVo(PagerQuery<LoanVehClearanceApplyQuery> pq) { |
|
|
|
LoanVehClearanceApplyQuery query = pq.getParams(); |
|
|
|
QueryWrapper<LoanVehClearanceApply> qw = new QueryWrapper<>(); |
|
|
|
//========================================数据授权开始
|
|
|
|
if (StringUtils.isNotBlank(query.getMenuUrl())) { |
|
|
|
PrivilegeQuery privilegeQuery = new PrivilegeQuery(); |
|
|
|
privilegeQuery.setOrgPath(query.getOrgPath()); |
|
|
|
privilegeQuery.setMenuUrl(query.getMenuUrl()); |
|
|
|
privilegeQuery.setMenuSid(query.getMenuSid()); |
|
|
|
privilegeQuery.setUserSid(query.getUserSid()); |
|
|
|
ResultBean<String> defaultIdReltBean = sysUserFeign.selectPrivilegeLevel(privilegeQuery); |
|
|
|
if (StringUtils.isNotBlank(defaultIdReltBean.getData())) { |
|
|
|
//数据权限ID(1集团、2事业部、3分公司、4部门、5个人)
|
|
|
|
String orgSidPath = query.getOrgPath(); |
|
|
|
orgSidPath = orgSidPath + "/"; |
|
|
|
int i1 = orgSidPath.indexOf("/"); |
|
|
|
int i2 = orgSidPath.indexOf("/", i1 + 1); |
|
|
|
int i3 = orgSidPath.indexOf("/", i2 + 1); |
|
|
|
int i4 = orgSidPath.indexOf("/", i3 + 1); |
|
|
|
String orgLevelKey = defaultIdReltBean.getData(); |
|
|
|
if ("1".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i1); |
|
|
|
qw.like("orgPath", orgSidPath); |
|
|
|
} else if ("2".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i2); |
|
|
|
qw.like("orgPath", orgSidPath); |
|
|
|
} else if ("3".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i3); |
|
|
|
qw.like("orgPath", orgSidPath); |
|
|
|
} else if ("4".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i4); |
|
|
|
qw.like("orgPath", orgSidPath); |
|
|
|
} else if ("5".equals(orgLevelKey)) { |
|
|
|
qw.eq("createBySid", query.getUserSid()); |
|
|
|
} else { |
|
|
|
PagerVo<LoanVehClearanceApplyVo> p = new PagerVo<>(); |
|
|
|
return p; |
|
|
|
} |
|
|
|
} else { |
|
|
|
PagerVo<LoanVehClearanceApplyVo> p = new PagerVo<>(); |
|
|
|
return p; |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getUseOrgName())) { |
|
|
|
qw.like("useOrgName", query.getUseOrgName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getDeptName())) { |
|
|
|
qw.like("deptName", query.getDeptName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getCreateByName())) { |
|
|
|
qw.like("createByName", query.getCreateByName()); |
|
|
|
} |
|
|
|
qw.apply(StringUtils.isNotBlank(query.getCreateStartTime()), "date_format (createTime,'%Y-%m-%d') >= date_format('" + query.getCreateStartTime() + "','%Y-%m-%d')"). |
|
|
|
apply(StringUtils.isNotBlank(query.getCreateEndTime()), "date_format (createTime,'%Y-%m-%d') <= date_format('" + query.getCreateEndTime() + "','%Y-%m-%d')" |
|
|
|
); |
|
|
|
qw.apply(StringUtils.isNotBlank(query.getModifyStartTime()), "date_format (modifyTime,'%Y-%m-%d') >= date_format('" + query.getModifyStartTime() + "','%Y-%m-%d')"). |
|
|
|
apply(StringUtils.isNotBlank(query.getModifyEndTime()), "date_format (modifyTime,'%Y-%m-%d') <= date_format('" + query.getModifyEndTime() + "','%Y-%m-%d')" |
|
|
|
); |
|
|
|
qw.orderByDesc("createTime"); |
|
|
|
IPage<LoanVehClearanceApply> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<LoanVehClearanceApplyVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<LoanVehClearanceApplyVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public String saveOrUpdateDto(LoanVehClearanceApplyDto dto){ |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
List<LoanVehClearanceVehDto> loanVehClearanceVehDtoList = dto.getLoanVehClearanceVehDtoList(); |
|
|
|
List<LoanVehClearanceFileVo> files = dto.getFiles(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
//生成单据编号
|
|
|
|
String billNo = ""; |
|
|
|
String date = DateUtil.format(DateUtil.date(), "yyyyMM"); |
|
|
|
SysOrganizationVo sysOrganizationVo = sysOrganizationFeign.fetchBySid(dto.getUseOrgSid()).getData(); |
|
|
|
billNo = "CLYCJK" + sysOrganizationVo.getOrgCode() + date; |
|
|
|
String i = baseMapper.selectNum(billNo); |
|
|
|
if (StringUtils.isNotBlank(i)) { |
|
|
|
billNo = Rule.getBillNo(billNo, Integer.valueOf(i).intValue()); |
|
|
|
} else { |
|
|
|
billNo = Rule.getBillNo(billNo, 0); |
|
|
|
} |
|
|
|
dto.setBillNo(billNo); |
|
|
|
String sid = this.insertByDto(dto); |
|
|
|
if (files != null && files.size() > 0){ |
|
|
|
for (LoanVehClearanceFileVo file : files) { |
|
|
|
LoanFile loanFile = new LoanFile(); |
|
|
|
loanFile.setLinkSid(sid); |
|
|
|
loanFile.setAttachType(LoanFileEnum.VEHCLEARANCE.getAttachType()); |
|
|
|
String filePath = file.getUrl(); |
|
|
|
if (filePath.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
|
|
filePath = filePath.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
} |
|
|
|
loanFile.setFilePath(filePath); |
|
|
|
loanFileService.save(loanFile); |
|
|
|
} |
|
|
|
} |
|
|
|
for (LoanVehClearanceVehDto loanVehClearanceVehDto : loanVehClearanceVehDtoList) { |
|
|
|
loanVehClearanceVehDto.setMainSid(sid); |
|
|
|
loanVehClearanceVehService.saveOrUpdateDto(loanVehClearanceVehDto); |
|
|
|
} |
|
|
|
return sid; |
|
|
|
} |
|
|
|
this.updateByDto(dto); |
|
|
|
loanFileService.delByLinkSidOrType(dtoSid,LoanFileEnum.VEHCLEARANCE.getAttachType()); |
|
|
|
if (files != null && files.size() > 0){ |
|
|
|
for (LoanVehClearanceFileVo file : files) { |
|
|
|
LoanFile loanFile = new LoanFile(); |
|
|
|
loanFile.setLinkSid(dtoSid); |
|
|
|
loanFile.setAttachType(LoanFileEnum.VEHCLEARANCE.getAttachType()); |
|
|
|
String filePath = file.getUrl(); |
|
|
|
if (filePath.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
|
|
filePath = filePath.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
} |
|
|
|
loanFile.setFilePath(filePath); |
|
|
|
loanFileService.save(loanFile); |
|
|
|
} |
|
|
|
} |
|
|
|
loanVehClearanceVehService.delByMainSid(dtoSid); |
|
|
|
for (LoanVehClearanceVehDto loanVehClearanceVehDto : loanVehClearanceVehDtoList) { |
|
|
|
loanVehClearanceVehDto.setMainSid(dtoSid); |
|
|
|
loanVehClearanceVehDto.setSid(""); |
|
|
|
loanVehClearanceVehService.saveOrUpdateDto(loanVehClearanceVehDto); |
|
|
|
} |
|
|
|
return dtoSid; |
|
|
|
} |
|
|
|
|
|
|
|
public String insertByDto(LoanVehClearanceApplyDto dto){ |
|
|
|
LoanVehClearanceApply entity = new LoanVehClearanceApply(); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
entity.setNodeState("待提交"); |
|
|
|
baseMapper.insert(entity); |
|
|
|
return entity.getSid(); |
|
|
|
} |
|
|
|
|
|
|
|
public void updateByDto(LoanVehClearanceApplyDto dto){ |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
public PagerVo<LoanVehClearanceApplyVo> listPageVo(PagerQuery<LoanVehClearanceApplyQuery> pq) { |
|
|
|
LoanVehClearanceApplyQuery query = pq.getParams(); |
|
|
|
QueryWrapper<LoanVehClearanceApply> qw = new QueryWrapper<>(); |
|
|
|
//========================================数据授权开始
|
|
|
|
if (StringUtils.isNotBlank(query.getMenuUrl())) { |
|
|
|
PrivilegeQuery privilegeQuery = new PrivilegeQuery(); |
|
|
|
privilegeQuery.setOrgPath(query.getOrgPath()); |
|
|
|
privilegeQuery.setMenuUrl(query.getMenuUrl()); |
|
|
|
privilegeQuery.setMenuSid(query.getMenuSid()); |
|
|
|
privilegeQuery.setUserSid(query.getUserSid()); |
|
|
|
ResultBean<String> defaultIdReltBean = sysUserFeign.selectPrivilegeLevel(privilegeQuery); |
|
|
|
if (StringUtils.isNotBlank(defaultIdReltBean.getData())) { |
|
|
|
//数据权限ID(1集团、2事业部、3分公司、4部门、5个人)
|
|
|
|
String orgSidPath = query.getOrgPath(); |
|
|
|
orgSidPath = orgSidPath + "/"; |
|
|
|
int i1 = orgSidPath.indexOf("/"); |
|
|
|
int i2 = orgSidPath.indexOf("/", i1 + 1); |
|
|
|
int i3 = orgSidPath.indexOf("/", i2 + 1); |
|
|
|
int i4 = orgSidPath.indexOf("/", i3 + 1); |
|
|
|
String orgLevelKey = defaultIdReltBean.getData(); |
|
|
|
if ("1".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i1); |
|
|
|
qw.like("orgPath", orgSidPath); |
|
|
|
} else if ("2".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i2); |
|
|
|
qw.like("orgPath", orgSidPath); |
|
|
|
} else if ("3".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i3); |
|
|
|
qw.like("orgPath", orgSidPath); |
|
|
|
} else if ("4".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i4); |
|
|
|
qw.like("orgPath", orgSidPath); |
|
|
|
} else if ("5".equals(orgLevelKey)) { |
|
|
|
qw.eq("createBySid", query.getUserSid()); |
|
|
|
} else { |
|
|
|
PagerVo<LoanVehClearanceApplyVo> p = new PagerVo<>(); |
|
|
|
return p; |
|
|
|
} |
|
|
|
} else { |
|
|
|
PagerVo<LoanVehClearanceApplyVo> p = new PagerVo<>(); |
|
|
|
return p; |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getUseOrgName())) { |
|
|
|
qw.like("useOrgName", query.getUseOrgName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getDeptName())) { |
|
|
|
qw.like("deptName", query.getDeptName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getCreateByName())) { |
|
|
|
qw.like("createByName", query.getCreateByName()); |
|
|
|
} |
|
|
|
qw.apply(StringUtils.isNotBlank(query.getCreateStartTime()), "date_format (createTime,'%Y-%m-%d') >= date_format('" + query.getCreateStartTime() + "','%Y-%m-%d')"). |
|
|
|
apply(StringUtils.isNotBlank(query.getCreateEndTime()), "date_format (createTime,'%Y-%m-%d') <= date_format('" + query.getCreateEndTime() + "','%Y-%m-%d')" |
|
|
|
); |
|
|
|
qw.apply(StringUtils.isNotBlank(query.getModifyStartTime()), "date_format (modifyTime,'%Y-%m-%d') >= date_format('" + query.getModifyStartTime() + "','%Y-%m-%d')"). |
|
|
|
apply(StringUtils.isNotBlank(query.getModifyEndTime()), "date_format (modifyTime,'%Y-%m-%d') <= date_format('" + query.getModifyEndTime() + "','%Y-%m-%d')" |
|
|
|
); |
|
|
|
qw.orderByDesc("createTime"); |
|
|
|
IPage<LoanVehClearanceApply> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<LoanVehClearanceApplyVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<LoanVehClearanceApplyVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<LoanVehClearanceLockCarVo> lockCarList(PagerQuery<LoanVehClearanceLockCarQuery> pq) { |
|
|
|
LoanVehClearanceLockCarQuery query = pq.getParams(); |
|
|
|
QueryWrapper<LoanVehClearanceApply> qw = new QueryWrapper<>(); |
|
|
|
qw.eq("la.useOrgSid", query.getUseOrgSid()); |
|
|
|
qw.eq("lv.lockCarState","1"); |
|
|
|
if (StringUtils.isNotBlank(query.getCustName())) { |
|
|
|
qw.like("lv.customerName", query.getCustName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getBorrowerName())) { |
|
|
|
qw.like("lv.borrowerName", query.getBorrowerName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getCarNum())) { |
|
|
|
qw.like("lv.carNum", query.getCarNum()); |
|
|
|
} |
|
|
|
if (query.getSaleVehSids().size() != 0) { |
|
|
|
qw.notIn("lv.saleVehSid", query.getSaleVehSids()); |
|
|
|
} |
|
|
|
qw.groupBy("lv.saleVehSid"); |
|
|
|
IPage<LoanVehClearanceApply> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<LoanVehClearanceLockCarVo> pagging = baseMapper.lockCarList(page, qw); |
|
|
|
PagerVo<LoanVehClearanceLockCarVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public String saveOrUpdateDto(LoanVehClearanceApplyDto dto) { |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
List<LoanVehClearanceVehDto> loanVehClearanceVehDtoList = dto.getLoanVehClearanceVehDtoList(); |
|
|
|
List<LoanVehClearanceFileVo> files = dto.getFiles(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
//生成单据编号
|
|
|
|
String billNo = ""; |
|
|
|
String date = DateUtil.format(DateUtil.date(), "yyyyMM"); |
|
|
|
SysOrganizationVo sysOrganizationVo = sysOrganizationFeign.fetchBySid(dto.getUseOrgSid()).getData(); |
|
|
|
billNo = "CLYCJK" + sysOrganizationVo.getOrgCode() + date; |
|
|
|
String i = baseMapper.selectNum(billNo); |
|
|
|
if (StringUtils.isNotBlank(i)) { |
|
|
|
billNo = Rule.getBillNo(billNo, Integer.valueOf(i).intValue()); |
|
|
|
} else { |
|
|
|
billNo = Rule.getBillNo(billNo, 0); |
|
|
|
} |
|
|
|
dto.setBillNo(billNo); |
|
|
|
String sid = this.insertByDto(dto); |
|
|
|
if (files != null && files.size() > 0) { |
|
|
|
for (LoanVehClearanceFileVo file : files) { |
|
|
|
LoanFile loanFile = new LoanFile(); |
|
|
|
loanFile.setLinkSid(sid); |
|
|
|
loanFile.setAttachType(LoanFileEnum.VEHCLEARANCE.getAttachType()); |
|
|
|
String filePath = file.getUrl(); |
|
|
|
if (filePath.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
|
|
filePath = filePath.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
} |
|
|
|
loanFile.setFilePath(filePath); |
|
|
|
loanFileService.save(loanFile); |
|
|
|
} |
|
|
|
} |
|
|
|
for (LoanVehClearanceVehDto loanVehClearanceVehDto : loanVehClearanceVehDtoList) { |
|
|
|
loanVehClearanceVehDto.setMainSid(sid); |
|
|
|
loanVehClearanceVehService.saveOrUpdateDto(loanVehClearanceVehDto); |
|
|
|
} |
|
|
|
return sid; |
|
|
|
} |
|
|
|
this.updateByDto(dto); |
|
|
|
loanFileService.delByLinkSidOrType(dtoSid, LoanFileEnum.VEHCLEARANCE.getAttachType()); |
|
|
|
if (files != null && files.size() > 0) { |
|
|
|
for (LoanVehClearanceFileVo file : files) { |
|
|
|
LoanFile loanFile = new LoanFile(); |
|
|
|
loanFile.setLinkSid(dtoSid); |
|
|
|
loanFile.setAttachType(LoanFileEnum.VEHCLEARANCE.getAttachType()); |
|
|
|
String filePath = file.getUrl(); |
|
|
|
if (filePath.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
|
|
filePath = filePath.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
} |
|
|
|
loanFile.setFilePath(filePath); |
|
|
|
loanFileService.save(loanFile); |
|
|
|
} |
|
|
|
} |
|
|
|
loanVehClearanceVehService.delByMainSid(dtoSid); |
|
|
|
for (LoanVehClearanceVehDto loanVehClearanceVehDto : loanVehClearanceVehDtoList) { |
|
|
|
loanVehClearanceVehDto.setMainSid(dtoSid); |
|
|
|
loanVehClearanceVehDto.setSid(""); |
|
|
|
loanVehClearanceVehService.saveOrUpdateDto(loanVehClearanceVehDto); |
|
|
|
} |
|
|
|
return dtoSid; |
|
|
|
} |
|
|
|
|
|
|
|
public String insertByDto(LoanVehClearanceApplyDto dto) { |
|
|
|
LoanVehClearanceApply entity = new LoanVehClearanceApply(); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
entity.setNodeState("待提交"); |
|
|
|
baseMapper.insert(entity); |
|
|
|
return entity.getSid(); |
|
|
|
} |
|
|
|
|
|
|
|
public void updateByDto(LoanVehClearanceApplyDto dto) { |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
LoanVehClearanceApply entity = fetchBySid(dtoSid); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
public LoanVehClearanceApplyDetailsVo fetchDetailsVoBySid(String sid){ |
|
|
|
LoanVehClearanceApply entity = fetchBySid(sid); |
|
|
|
LoanVehClearanceApplyDetailsVo vo = new LoanVehClearanceApplyDetailsVo(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
vo.setCreateTime(DateUtil.formatDate(entity.getCreateTime())); |
|
|
|
List<LoanFile> loanFiles = loanFileService.selectByLinkSid(sid, LoanFileEnum.VEHCLEARANCE.getAttachType()); |
|
|
|
List<LoanVehClearanceFileVo> loanVehClearanceFileVos = new ArrayList<>(); |
|
|
|
if (loanFiles != null && loanFiles.size() > 0){ |
|
|
|
for (LoanFile loanFile : loanFiles) { |
|
|
|
LoanVehClearanceFileVo loanVehClearanceFileVo = new LoanVehClearanceFileVo(); |
|
|
|
String filePath = loanFile.getFilePath(); |
|
|
|
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|
|
|
filePath = urlPrefix + filePath; |
|
|
|
loanVehClearanceFileVo.setUrl(filePath); |
|
|
|
loanVehClearanceFileVos.add(loanVehClearanceFileVo); |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setFiles(loanVehClearanceFileVos); |
|
|
|
List<LoanVehClearanceVehDetailsVo> loanVehClearanceVehDetailsVoList = loanVehClearanceVehService.selByMainSid(sid); |
|
|
|
for (LoanVehClearanceVehDetailsVo loanVehClearanceVehDetailsVo : loanVehClearanceVehDetailsVoList) { |
|
|
|
List<LoanVehClearanceVehFile> loanVehClearanceVehFiles = new ArrayList<>(); |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle1 = busSalesOrderVehicleFeign.details(loanVehClearanceVehDetailsVo.getSaleVehSid()).getData(); |
|
|
|
BusSalesOrder busSalesOrder = busSalesOrderFeign.fetchBySid(busSalesOrderVehicle1.getSalesOrderSid()).getData(); |
|
|
|
//催收记录sid
|
|
|
|
LoanVehClearanceVehFile loanVehClearanceVehFile1 = new LoanVehClearanceVehFile(); |
|
|
|
loanVehClearanceVehFile1.setName("催收记录"); |
|
|
|
loanVehClearanceVehFile1.setSid(loanVehClearanceVehDetailsVo.getSaleVehSid()); |
|
|
|
loanVehClearanceVehFiles.add(loanVehClearanceVehFile1); |
|
|
|
//开票管理sid
|
|
|
|
FinVehicleInvoice finVehicleInvoice = finVehicleInvoiceFeign.selectByVinAndContractNo(busSalesOrderVehicle1.getLinkSid(), busSalesOrder.getContractNo()).getData(); |
|
|
|
LoanVehClearanceVehFile loanVehClearanceVehFile2 = new LoanVehClearanceVehFile(); |
|
|
|
loanVehClearanceVehFile2.setName("开票信息"); |
|
|
|
loanVehClearanceVehFile2.setSid(finVehicleInvoice.getSid()); |
|
|
|
loanVehClearanceVehFiles.add(loanVehClearanceVehFile2); |
|
|
|
//月还明细sid
|
|
|
|
LoanVehClearanceVehFile loanVehClearanceVehFile3 = new LoanVehClearanceVehFile(); |
|
|
|
loanVehClearanceVehFile3.setName("月还明细"); |
|
|
|
loanVehClearanceVehFile3.setSid(loanVehClearanceVehDetailsVo.getSaleVehSid()); |
|
|
|
loanVehClearanceVehFiles.add(loanVehClearanceVehFile3); |
|
|
|
//金融方案sid
|
|
|
|
LoanSolutions loanSolutions = loanSolutionsService.selectBySaleOrderSid(busSalesOrder.getSid()); |
|
|
|
LoanVehClearanceVehFile loanVehClearanceVehFile4 = new LoanVehClearanceVehFile(); |
|
|
|
loanVehClearanceVehFile4.setName("金融方案"); |
|
|
|
loanVehClearanceVehFile4.setSid(loanSolutions.getSid()); |
|
|
|
loanVehClearanceVehFiles.add(loanVehClearanceVehFile4); |
|
|
|
//家访考察报告sid
|
|
|
|
String jfkcSid = loanHomevisitInvestigateService.selectByBorrSid(busSalesOrderVehicle1.getBorrowerSid()); |
|
|
|
LoanVehClearanceVehFile loanVehClearanceVehFile5 = new LoanVehClearanceVehFile(); |
|
|
|
loanVehClearanceVehFile5.setName("家访考察报告"); |
|
|
|
loanVehClearanceVehFile5.setSid(jfkcSid); |
|
|
|
loanVehClearanceVehFiles.add(loanVehClearanceVehFile5); |
|
|
|
//家访考察资料sid
|
|
|
|
LoanVehClearanceVehFile loanVehClearanceVehFile6 = new LoanVehClearanceVehFile(); |
|
|
|
loanVehClearanceVehFile6.setName("家访考察资料"); |
|
|
|
loanVehClearanceVehFile6.setSid(jfkcSid); |
|
|
|
loanVehClearanceVehFiles.add(loanVehClearanceVehFile6); |
|
|
|
loanVehClearanceVehDetailsVo.setSids(loanVehClearanceVehFiles); |
|
|
|
} |
|
|
|
vo.setLoanVehClearanceVehDetailsVoList(loanVehClearanceVehDetailsVoList); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
} |
|
|
|
LoanVehClearanceApply entity = fetchBySid(dtoSid); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
public LoanVehClearanceApplyDetailsVo fetchDetailsVoBySid(String sid) { |
|
|
|
LoanVehClearanceApply entity = fetchBySid(sid); |
|
|
|
LoanVehClearanceApplyDetailsVo vo = new LoanVehClearanceApplyDetailsVo(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
vo.setCreateTime(DateUtil.formatDate(entity.getCreateTime())); |
|
|
|
List<LoanFile> loanFiles = loanFileService.selectByLinkSid(sid, LoanFileEnum.VEHCLEARANCE.getAttachType()); |
|
|
|
List<LoanVehClearanceFileVo> loanVehClearanceFileVos = new ArrayList<>(); |
|
|
|
if (loanFiles != null && loanFiles.size() > 0) { |
|
|
|
for (LoanFile loanFile : loanFiles) { |
|
|
|
LoanVehClearanceFileVo loanVehClearanceFileVo = new LoanVehClearanceFileVo(); |
|
|
|
String filePath = loanFile.getFilePath(); |
|
|
|
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|
|
|
filePath = urlPrefix + filePath; |
|
|
|
loanVehClearanceFileVo.setUrl(filePath); |
|
|
|
loanVehClearanceFileVos.add(loanVehClearanceFileVo); |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setFiles(loanVehClearanceFileVos); |
|
|
|
List<LoanVehClearanceVehDetailsVo> loanVehClearanceVehDetailsVoList = loanVehClearanceVehService.selByMainSid(sid); |
|
|
|
for (LoanVehClearanceVehDetailsVo loanVehClearanceVehDetailsVo : loanVehClearanceVehDetailsVoList) { |
|
|
|
List<LoanVehClearanceVehFile> loanVehClearanceVehFiles = new ArrayList<>(); |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle1 = busSalesOrderVehicleFeign.details(loanVehClearanceVehDetailsVo.getSaleVehSid()).getData(); |
|
|
|
BusSalesOrder busSalesOrder = busSalesOrderFeign.fetchBySid(busSalesOrderVehicle1.getSalesOrderSid()).getData(); |
|
|
|
//催收记录sid
|
|
|
|
LoanVehClearanceVehFile loanVehClearanceVehFile1 = new LoanVehClearanceVehFile(); |
|
|
|
loanVehClearanceVehFile1.setName("催收记录"); |
|
|
|
loanVehClearanceVehFile1.setSid(loanVehClearanceVehDetailsVo.getSaleVehSid()); |
|
|
|
loanVehClearanceVehFiles.add(loanVehClearanceVehFile1); |
|
|
|
//开票管理sid
|
|
|
|
FinVehicleInvoice finVehicleInvoice = finVehicleInvoiceFeign.selectByVinAndContractNo(busSalesOrderVehicle1.getLinkSid(), busSalesOrder.getContractNo()).getData(); |
|
|
|
LoanVehClearanceVehFile loanVehClearanceVehFile2 = new LoanVehClearanceVehFile(); |
|
|
|
loanVehClearanceVehFile2.setName("开票信息"); |
|
|
|
loanVehClearanceVehFile2.setSid(finVehicleInvoice.getSid()); |
|
|
|
loanVehClearanceVehFiles.add(loanVehClearanceVehFile2); |
|
|
|
//月还明细sid
|
|
|
|
LoanVehClearanceVehFile loanVehClearanceVehFile3 = new LoanVehClearanceVehFile(); |
|
|
|
loanVehClearanceVehFile3.setName("月还明细"); |
|
|
|
loanVehClearanceVehFile3.setSid(loanVehClearanceVehDetailsVo.getSaleVehSid()); |
|
|
|
loanVehClearanceVehFiles.add(loanVehClearanceVehFile3); |
|
|
|
//金融方案sid
|
|
|
|
LoanSolutions loanSolutions = loanSolutionsService.selectBySaleOrderSid(busSalesOrder.getSid()); |
|
|
|
LoanVehClearanceVehFile loanVehClearanceVehFile4 = new LoanVehClearanceVehFile(); |
|
|
|
loanVehClearanceVehFile4.setName("金融方案"); |
|
|
|
loanVehClearanceVehFile4.setSid(loanSolutions.getSid()); |
|
|
|
loanVehClearanceVehFiles.add(loanVehClearanceVehFile4); |
|
|
|
//家访考察报告sid
|
|
|
|
String jfkcSid = loanHomevisitInvestigateService.selectByBorrSid(busSalesOrderVehicle1.getBorrowerSid()); |
|
|
|
LoanVehClearanceVehFile loanVehClearanceVehFile5 = new LoanVehClearanceVehFile(); |
|
|
|
loanVehClearanceVehFile5.setName("家访考察报告"); |
|
|
|
loanVehClearanceVehFile5.setSid(jfkcSid); |
|
|
|
loanVehClearanceVehFiles.add(loanVehClearanceVehFile5); |
|
|
|
//家访考察资料sid
|
|
|
|
LoanVehClearanceVehFile loanVehClearanceVehFile6 = new LoanVehClearanceVehFile(); |
|
|
|
loanVehClearanceVehFile6.setName("家访考察资料"); |
|
|
|
loanVehClearanceVehFile6.setSid(jfkcSid); |
|
|
|
loanVehClearanceVehFiles.add(loanVehClearanceVehFile6); |
|
|
|
loanVehClearanceVehDetailsVo.setSids(loanVehClearanceVehFiles); |
|
|
|
} |
|
|
|
vo.setLoanVehClearanceVehDetailsVoList(loanVehClearanceVehDetailsVoList); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public LoanVehClearanceApplyDetailsVo init(LoanVehClearanceInitQuery query) { |
|
|
|
List<String> saleVehSids = query.getSaleVehSids(); |
|
|
|
LoanVehClearanceApplyDetailsVo loanVehClearanceApplyDetailsVo = new LoanVehClearanceApplyDetailsVo(); |
|
|
|
SysOrganizationVo sysOrganizationVo = sysOrganizationFeign.selectByOrgSidPath(query.getOrgPath()).getData(); |
|
|
|
loanVehClearanceApplyDetailsVo.setDeptSid(sysOrganizationVo.getSid()); |
|
|
|
loanVehClearanceApplyDetailsVo.setDeptName(sysOrganizationVo.getName()); |
|
|
|
SysUserVo sysUserVo = sysUserFeign.fetchBySid(query.getUserSid()).getData(); |
|
|
|
loanVehClearanceApplyDetailsVo.setCreateBySid(query.getUserSid()); |
|
|
|
loanVehClearanceApplyDetailsVo.setCreateByName(sysUserVo.getName()); |
|
|
|
loanVehClearanceApplyDetailsVo.setCreateTime(DateUtil.formatDate(new Date())); |
|
|
|
String useOrgSid = sysStaffOrgFeign.getOrgSidByPath(query.getOrgPath()).getData(); |
|
|
|
SysOrganizationVo sysOrganizationVo1 = sysOrganizationFeign.fetchBySid(useOrgSid).getData(); |
|
|
|
loanVehClearanceApplyDetailsVo.setUseOrgSid(useOrgSid); |
|
|
|
loanVehClearanceApplyDetailsVo.setUseOrgName(sysOrganizationVo1.getName()); |
|
|
|
loanVehClearanceApplyDetailsVo.setOrgPath(query.getOrgPath()); |
|
|
|
List<LoanVehClearanceVehDetailsVo> loanVehClearanceVehDetailsVoList = new ArrayList<>(); |
|
|
|
for (String saleVehSid : saleVehSids) { |
|
|
|
LoanVehClearanceVehInit loanVehClearanceVehInit = baseMapper.initVehListBySaleVehSid(saleVehSid); |
|
|
|
LoanVehClearanceVehDetailsVo loanVehClearanceVehDetailsVo = new LoanVehClearanceVehDetailsVo(); |
|
|
|
BeanUtil.copyProperties(loanVehClearanceVehInit, loanVehClearanceVehDetailsVo); |
|
|
|
loanVehClearanceVehDetailsVo.setCustomerName(loanVehClearanceVehInit.getCustName()); |
|
|
|
loanVehClearanceVehDetailsVo.setBorrowerName(loanVehClearanceVehInit.getLoanName()); |
|
|
|
List<LoanVehClearanceVehFile> loanVehClearanceVehFiles = new ArrayList<>(); |
|
|
|
BusSalesOrder busSalesOrder = busSalesOrderFeign.fetchBySid(loanVehClearanceVehInit.getSalesOrderSid()).getData(); |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(loanVehClearanceVehInit.getSaleVehSid()).getData(); |
|
|
|
//催收记录sid
|
|
|
|
LoanVehClearanceVehFile LoanVehClearanceVehFile1 = new LoanVehClearanceVehFile(); |
|
|
|
LoanVehClearanceVehFile1.setName("催收记录"); |
|
|
|
LoanVehClearanceVehFile1.setSid(loanVehClearanceVehInit.getSaleVehSid()); |
|
|
|
loanVehClearanceVehFiles.add(LoanVehClearanceVehFile1); |
|
|
|
//开票管理sid
|
|
|
|
FinVehicleInvoice finVehicleInvoice = finVehicleInvoiceFeign.selectByVinAndContractNo(busSalesOrderVehicle.getLinkSid(), busSalesOrder.getContractNo()).getData(); |
|
|
|
LoanVehClearanceVehFile LoanVehClearanceVehFile2 = new LoanVehClearanceVehFile(); |
|
|
|
LoanVehClearanceVehFile2.setName("开票信息"); |
|
|
|
LoanVehClearanceVehFile2.setSid(finVehicleInvoice.getSid()); |
|
|
|
loanVehClearanceVehFiles.add(LoanVehClearanceVehFile2); |
|
|
|
//月还明细sid
|
|
|
|
LoanVehClearanceVehFile LoanVehClearanceVehFile3 = new LoanVehClearanceVehFile(); |
|
|
|
LoanVehClearanceVehFile3.setName("月还明细"); |
|
|
|
LoanVehClearanceVehFile3.setSid(saleVehSid); |
|
|
|
loanVehClearanceVehFiles.add(LoanVehClearanceVehFile3); |
|
|
|
//金融方案sid
|
|
|
|
LoanVehClearanceVehFile LoanVehClearanceVehFile4 = new LoanVehClearanceVehFile(); |
|
|
|
LoanVehClearanceVehFile4.setName("金融方案"); |
|
|
|
LoanVehClearanceVehFile4.setSid(loanVehClearanceVehInit.getSalesOrderSid()); |
|
|
|
loanVehClearanceVehFiles.add(LoanVehClearanceVehFile4); |
|
|
|
//家访考察报告sid
|
|
|
|
String sid = loanHomevisitInvestigateService.selectByBorrSid(busSalesOrderVehicle.getBorrowerSid()); |
|
|
|
LoanVehClearanceVehFile LoanVehClearanceVehFile5 = new LoanVehClearanceVehFile(); |
|
|
|
LoanVehClearanceVehFile5.setName("家访考察报告"); |
|
|
|
LoanVehClearanceVehFile5.setSid(sid); |
|
|
|
loanVehClearanceVehFiles.add(LoanVehClearanceVehFile5); |
|
|
|
//家访考察资料sid
|
|
|
|
LoanVehClearanceVehFile LoanVehClearanceVehFile6 = new LoanVehClearanceVehFile(); |
|
|
|
LoanVehClearanceVehFile6.setName("家访考察资料"); |
|
|
|
LoanVehClearanceVehFile6.setSid(sid); |
|
|
|
loanVehClearanceVehFiles.add(LoanVehClearanceVehFile6); |
|
|
|
loanVehClearanceVehDetailsVo.setSids(loanVehClearanceVehFiles); |
|
|
|
loanVehClearanceVehDetailsVoList.add(loanVehClearanceVehDetailsVo); |
|
|
|
} |
|
|
|
loanVehClearanceApplyDetailsVo.setLoanVehClearanceVehDetailsVoList(loanVehClearanceVehDetailsVoList); |
|
|
|
return loanVehClearanceApplyDetailsVo; |
|
|
|
} |
|
|
|
} |