|
|
@ -26,27 +26,35 @@ |
|
|
|
package com.yxt.anrui.riskcenter.biz.loanvehclearanceapply; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.base.common.utils.Rule; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationVo; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.PrivilegeQuery; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionapply.LoanBeCollectionApplyVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionapply.LoanBeCollectionFileVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.LoanBeCollectionVehDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfile.LoanFile; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfile.LoanFileEnum; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanvehclearanceapply.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanvehclearanceveh.LoanVehClearanceVehDto; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanfile.LoanFileService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanvehclearanceveh.LoanVehClearanceVehService; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
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.loanvehclearanceapply.LoanVehClearanceApply; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanvehclearanceapply.LoanVehClearanceApplyQuery; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanvehclearanceapply.LoanVehClearanceApplyVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanvehclearanceapply.LoanVehClearanceApplyDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanvehclearanceapply.LoanVehClearanceApplyDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanvehclearanceapply.LoanVehClearanceApplyFeign; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -67,6 +75,14 @@ public class LoanVehClearanceApplyService extends MybatisBaseService<LoanVehClea |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SysUserFeign sysUserFeign; |
|
|
|
@Resource |
|
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
@Autowired |
|
|
|
private LoanFileService loanFileService; |
|
|
|
@Autowired |
|
|
|
private LoanVehClearanceVehService loanVehClearanceVehService; |
|
|
|
|
|
|
|
public PagerVo<LoanVehClearanceApplyVo> listPageVo(PagerQuery<LoanVehClearanceApplyQuery> pq) { |
|
|
|
LoanVehClearanceApplyQuery query = pq.getParams(); |
|
|
@ -133,19 +149,73 @@ public class LoanVehClearanceApplyService extends MybatisBaseService<LoanVehClea |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public void saveOrUpdateDto(LoanVehClearanceApplyDto dto){ |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
this.insertByDto(dto); |
|
|
|
return; |
|
|
|
} |
|
|
|
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 void insertByDto(LoanVehClearanceApplyDto dto){ |
|
|
|
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){ |
|
|
|