|
|
@ -38,12 +38,14 @@ import com.yxt.anrui.riskcenter.api.loanrestorereportapply.AlrepaidAndArrVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansubletapply.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansubletapply.app.AppSubletDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansubletapply.flow.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansubletveh.LoanSubletVeh; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanbuckleapplyrecord.LoanBuckleApplyRecordService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanfile.LoanFileService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanredemptionveh.LoanRedemptionVehService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrepaymenthistory.LoanRepaymentHistoryService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrepaymentplandetails.LoanRepaymentPlanDetailsService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrestorereportapply.LoanRestoreReportApplyService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansubletveh.LoanSubletVehService; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
@ -108,7 +110,7 @@ public class LoanSubletApplyService extends MybatisBaseService<LoanSubletApplyMa |
|
|
|
@Autowired |
|
|
|
private LoanRestoreReportApplyService loanRestoreReportApplyService; |
|
|
|
@Autowired |
|
|
|
private LoanRedemptionVehService loanRedemptionVehService; |
|
|
|
private LoanSubletVehService loanSubletVehService; |
|
|
|
|
|
|
|
public PagerVo<LoanSubletApplyVo> listPage(PagerQuery<LoanSubletApplyQuery> pq) { |
|
|
|
IPage<LoanSubletApply> page = PagerUtil.queryToPage(pq); |
|
|
@ -121,37 +123,37 @@ public class LoanSubletApplyService extends MybatisBaseService<LoanSubletApplyMa |
|
|
|
privilegeQuery.setMenuUrl(pagerQuery.getMenuUrl()); |
|
|
|
privilegeQuery.setUserSid(pagerQuery.getUserSid()); |
|
|
|
ResultBean<String> defaultIdReltBean = sysUserFeign.selectPrivilegeLevel(privilegeQuery); |
|
|
|
if (StringUtils.isNotBlank(defaultIdReltBean.getData())) { |
|
|
|
//数据权限ID(1集团、2事业部、3分公司、4部门、5个人)
|
|
|
|
String orgSidPath = pagerQuery.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("a.orgSidPath", orgSidPath); |
|
|
|
} else if ("2".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i2); |
|
|
|
qw.like("a.orgSidPath", orgSidPath); |
|
|
|
} else if ("3".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i3); |
|
|
|
qw.like("a.orgSidPath", orgSidPath); |
|
|
|
} else if ("4".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i4); |
|
|
|
qw.like("a.orgSidPath", orgSidPath); |
|
|
|
} else if ("5".equals(orgLevelKey)) { |
|
|
|
qw.eq("a.createBySid", pagerQuery.getUserSid()); |
|
|
|
} else { |
|
|
|
PagerVo<LoanSubletApplyVo> p = new PagerVo<>(); |
|
|
|
return p; |
|
|
|
} |
|
|
|
} else { |
|
|
|
PagerVo<LoanSubletApplyVo> p = new PagerVo<>(); |
|
|
|
return p; |
|
|
|
} |
|
|
|
// if (StringUtils.isNotBlank(defaultIdReltBean.getData())) {
|
|
|
|
// //数据权限ID(1集团、2事业部、3分公司、4部门、5个人)
|
|
|
|
// String orgSidPath = pagerQuery.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("a.orgSidPath", orgSidPath);
|
|
|
|
// } else if ("2".equals(orgLevelKey)) {
|
|
|
|
// orgSidPath = orgSidPath.substring(0, i2);
|
|
|
|
// qw.like("a.orgSidPath", orgSidPath);
|
|
|
|
// } else if ("3".equals(orgLevelKey)) {
|
|
|
|
// orgSidPath = orgSidPath.substring(0, i3);
|
|
|
|
// qw.like("a.orgSidPath", orgSidPath);
|
|
|
|
// } else if ("4".equals(orgLevelKey)) {
|
|
|
|
// orgSidPath = orgSidPath.substring(0, i4);
|
|
|
|
// qw.like("a.orgSidPath", orgSidPath);
|
|
|
|
// } else if ("5".equals(orgLevelKey)) {
|
|
|
|
// qw.eq("a.createBySid", pagerQuery.getUserSid());
|
|
|
|
// } else {
|
|
|
|
// PagerVo<LoanSubletApplyVo> p = new PagerVo<>();
|
|
|
|
// return p;
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// PagerVo<LoanSubletApplyVo> p = new PagerVo<>();
|
|
|
|
// return p;
|
|
|
|
// }
|
|
|
|
//=======================
|
|
|
|
//分公司
|
|
|
|
if (StringUtils.isNotBlank(pagerQuery.getCompany())) { |
|
|
@ -187,11 +189,11 @@ public class LoanSubletApplyService extends MybatisBaseService<LoanSubletApplyMa |
|
|
|
} |
|
|
|
//车架号
|
|
|
|
if (StringUtils.isNotBlank(pagerQuery.getVinNo())) { |
|
|
|
qw.like("v.vinNo", pagerQuery.getVinNo()); |
|
|
|
qw.like("a.vinNo", pagerQuery.getVinNo()); |
|
|
|
} |
|
|
|
//车牌号
|
|
|
|
if (StringUtils.isNotBlank(pagerQuery.getVehMark())) { |
|
|
|
qw.like("v.vehMark", pagerQuery.getVehMark()); |
|
|
|
qw.like("a.vehMark", pagerQuery.getVehMark()); |
|
|
|
} |
|
|
|
String applyStartTime = pagerQuery.getApplyStartDate(); |
|
|
|
String applyEndTime = pagerQuery.getApplyEndDate(); |
|
|
@ -204,8 +206,8 @@ public class LoanSubletApplyService extends MybatisBaseService<LoanSubletApplyMa |
|
|
|
apply(StringUtils.isNotEmpty(closingEndDate), "date_format (a.closingDate,'%Y-%m-%d') <= date_format('" + closingEndDate + "','%Y-%m-%d')" |
|
|
|
); |
|
|
|
qw.eq("a.isDelete", 0); |
|
|
|
qw.orderByDesc("a.createTime"); |
|
|
|
qw.eq("v.vehType", "0"); |
|
|
|
qw.orderByDesc("a.applyDate"); |
|
|
|
qw.apply("(a.count > 1 AND a.vehType = '主车' ) OR (a.count = 1)"); |
|
|
|
IPage<LoanSubletApplyVo> pagging = baseMapper.listPage(page, qw); |
|
|
|
PagerVo<LoanSubletApplyVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
@ -232,7 +234,7 @@ public class LoanSubletApplyService extends MybatisBaseService<LoanSubletApplyMa |
|
|
|
qw.eq("v.isDelete", 0); |
|
|
|
qw.orderByDesc("v.createTime"); |
|
|
|
qw.eq("v.stockState", "库存"); |
|
|
|
qw.eq("disposal", "未处置"); |
|
|
|
qw.eq("v.disposal", "未处置"); |
|
|
|
IPage<SubletVinListVo> pagging = baseMapper.getVinList(page, qw); |
|
|
|
PagerVo<SubletVinListVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
@ -240,72 +242,63 @@ public class LoanSubletApplyService extends MybatisBaseService<LoanSubletApplyMa |
|
|
|
|
|
|
|
public ResultBean<LoanSubletApplyInit> subletInit(String ledgerSid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
LoanRedemptionApplyInit vo = new LoanRedemptionApplyInit(); |
|
|
|
RedemptionInitVo redemptionInitVo = baseMapper.redemptionInit(ledgerSid); |
|
|
|
if (null != redemptionInitVo) { |
|
|
|
BeanUtil.copyProperties(redemptionInitVo, vo); |
|
|
|
if (StringUtils.isNotBlank(redemptionInitVo.getBusVinSid())) { |
|
|
|
AlrepaidAndArrVo alrepaidAndArr = loanRestoreReportApplyService.getAlrepaidAndArr(redemptionInitVo.getBusVinSid()); |
|
|
|
if (null != alrepaidAndArr) { |
|
|
|
//已还金额
|
|
|
|
if (StringUtils.isNotBlank(alrepaidAndArr.getAlRepaidMoney())) { |
|
|
|
vo.setAlRepaidMoney(alrepaidAndArr.getAlRepaidMoney()); |
|
|
|
} |
|
|
|
//已还金额换算期数
|
|
|
|
if (StringUtils.isNotBlank(alrepaidAndArr.getAlRepaidMoneyConPeriod())) { |
|
|
|
vo.setAlRepaidMoneyConPeriod(alrepaidAndArr.getAlRepaidMoneyConPeriod()); |
|
|
|
} |
|
|
|
//逾期金额换算期数
|
|
|
|
if (StringUtils.isNotBlank(alrepaidAndArr.getBeOverdueMoneyAndPeriod())) { |
|
|
|
vo.setBeOverdueMoneyAndPeriod(alrepaidAndArr.getBeOverdueMoneyAndPeriod()); |
|
|
|
} |
|
|
|
//总期数
|
|
|
|
if (StringUtils.isNotBlank(alrepaidAndArr.getNper())) { |
|
|
|
vo.setNper(alrepaidAndArr.getNper()); |
|
|
|
LoanSubletApplyInit vo = new LoanSubletApplyInit(); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
vo.setApplyDate(sdf.format(new Date())); |
|
|
|
List<SubletVinList> vinList = new ArrayList<>(); |
|
|
|
SubletInitVo subletInitVo = baseMapper.selReturnLegerBySid(ledgerSid); |
|
|
|
String vehType = ""; |
|
|
|
if (null != subletInitVo) { |
|
|
|
if (StringUtils.isNotBlank(subletInitVo.getCustomer())) { |
|
|
|
vo.setCustomer(subletInitVo.getCustomer()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(subletInitVo.getBorrowerName())) { |
|
|
|
vo.setBorrowerName(subletInitVo.getBorrowerName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(subletInitVo.getVehType())) { |
|
|
|
vehType = subletInitVo.getVehType(); |
|
|
|
if (vehType.equals("主车")) { |
|
|
|
SubletInitVo mainVeh = baseMapper.selLoanInfoByMainVeh(subletInitVo.getBusVinSid()); |
|
|
|
if (null != mainVeh) { |
|
|
|
if (StringUtils.isNotBlank(mainVeh.getBankName())) { |
|
|
|
vo.setBankName(mainVeh.getBankName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(mainVeh.getLoanContractNo())) { |
|
|
|
vo.setLoanContractNo(mainVeh.getLoanContractNo()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(mainVeh.getBankContractNo())) { |
|
|
|
vo.setBankContractNo(mainVeh.getBankContractNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
//当前逾期金额
|
|
|
|
if (StringUtils.isNotBlank(alrepaidAndArr.getCurrentBeMoney())) { |
|
|
|
vo.setCurrentBeMoney(alrepaidAndArr.getCurrentBeMoney()); |
|
|
|
SubletVinList mVeh = baseMapper.selReturnVinLegerBySid(ledgerSid); |
|
|
|
if (null != mVeh) { |
|
|
|
vinList.add(mVeh); |
|
|
|
} |
|
|
|
//当前期数
|
|
|
|
if (StringUtils.isNotBlank(alrepaidAndArr.getCurrentPeriod())) { |
|
|
|
vo.setCurrentPeriod(alrepaidAndArr.getCurrentPeriod()); |
|
|
|
SubletVinList tVeh = baseMapper.selReturnTrVinLegerByPSid(ledgerSid); |
|
|
|
if (null != tVeh) { |
|
|
|
vinList.add(tVeh); |
|
|
|
} |
|
|
|
//未到期金额
|
|
|
|
if (StringUtils.isNotBlank(alrepaidAndArr.getUnexpiredMoney())) { |
|
|
|
vo.setUnexpiredMoney(alrepaidAndArr.getUnexpiredMoney()); |
|
|
|
vo.setVinList(vinList); |
|
|
|
} else if (vehType.equals("挂车")) { |
|
|
|
SubletInitVo trVeh = baseMapper.selLoanInfoByTrVeh(ledgerSid); |
|
|
|
if (null != trVeh) { |
|
|
|
if (StringUtils.isNotBlank(trVeh.getBankName())) { |
|
|
|
vo.setBankName(trVeh.getBankName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(trVeh.getLoanContractNo())) { |
|
|
|
vo.setLoanContractNo(trVeh.getLoanContractNo()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(trVeh.getBankContractNo())) { |
|
|
|
vo.setBankContractNo(trVeh.getBankContractNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
//其中资金占用费
|
|
|
|
if (StringUtils.isNotBlank(alrepaidAndArr.getWheFundOccMoney())) { |
|
|
|
vo.setWheFundOccMoney(alrepaidAndArr.getWheFundOccMoney()); |
|
|
|
SubletVinList tVeh = baseMapper.selReturnTrVinLegerBySid(ledgerSid); |
|
|
|
if (null != tVeh) { |
|
|
|
vinList.add(tVeh); |
|
|
|
} |
|
|
|
vo.setVinList(vinList); |
|
|
|
} |
|
|
|
} |
|
|
|
List<RedemptionVinList> vinList = new ArrayList<>(); |
|
|
|
RedemptionVinList mainVeh = new RedemptionVinList(); |
|
|
|
if (StringUtils.isNotBlank(redemptionInitVo.getVinSid())) { |
|
|
|
mainVeh.setVinSid(redemptionInitVo.getVinSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(redemptionInitVo.getVinNo())) { |
|
|
|
mainVeh.setVinNo(redemptionInitVo.getVinNo()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(redemptionInitVo.getVehModel())) { |
|
|
|
mainVeh.setVehModel(redemptionInitVo.getVehModel()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(redemptionInitVo.getVehMark())) { |
|
|
|
mainVeh.setVehMark(redemptionInitVo.getVehMark()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(redemptionInitVo.getVehType())) { |
|
|
|
mainVeh.setVehType(redemptionInitVo.getVehType()); |
|
|
|
} |
|
|
|
vinList.add(mainVeh); |
|
|
|
if (StringUtils.isNotBlank(redemptionInitVo.getLedgerSid())) { |
|
|
|
RedemptionVinList trailerVeh = baseMapper.selTrailerByLedgerSid(redemptionInitVo.getLedgerSid()); |
|
|
|
if (null != trailerVeh) { |
|
|
|
vinList.add(trailerVeh); |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setVinList(vinList); |
|
|
|
} |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
@ -313,218 +306,163 @@ public class LoanSubletApplyService extends MybatisBaseService<LoanSubletApplyMa |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean<String> saveSublet(LoanSubletApplyDto dto) { |
|
|
|
// ResultBean<String> rb = ResultBean.fireFail();
|
|
|
|
// String sid = "";
|
|
|
|
// if (StringUtils.isNotBlank(dto.getSid())) {
|
|
|
|
// sid = dto.getSid();
|
|
|
|
// LoanRedemptionApply updateEntity = fetchBySid(sid);
|
|
|
|
// if (null != updateEntity) {
|
|
|
|
// BeanUtil.copyProperties(dto, updateEntity, "id", "sid");
|
|
|
|
// baseMapper.updateById(updateEntity);
|
|
|
|
// loanRedemptionVehService.deleteByMainSid(sid);
|
|
|
|
// //删除附件表中关于该linkSid的文件
|
|
|
|
// loanFileService.deleteByLinkSid(sid);
|
|
|
|
// List<LoanRedemptionApplyFile> filess = dto.getFiles();
|
|
|
|
// if (!filess.isEmpty()) {
|
|
|
|
// List<String> files = new ArrayList<>();
|
|
|
|
// for (LoanRedemptionApplyFile file : filess) {
|
|
|
|
// files.add(file.getUrl());
|
|
|
|
// }
|
|
|
|
// loanFileService.saveAll(sid, files, LoanFileEnum.REDEMPTION.getAttachType());
|
|
|
|
// }
|
|
|
|
// List<RedemptionVinList> vinList = dto.getVinList();
|
|
|
|
// if (!vinList.isEmpty()) {
|
|
|
|
// for (RedemptionVinList record : vinList) {
|
|
|
|
// LoanRedemptionVeh redemptionVeh = new LoanRedemptionVeh();
|
|
|
|
// redemptionVeh.setMainSid(sid);
|
|
|
|
// if (StringUtils.isNotBlank(record.getVinSid())) {
|
|
|
|
// redemptionVeh.setVinSid(record.getVinSid());
|
|
|
|
// }
|
|
|
|
// if (StringUtils.isNotBlank(record.getVinNo())) {
|
|
|
|
// redemptionVeh.setVinNo(record.getVinNo());
|
|
|
|
// }
|
|
|
|
// if (StringUtils.isNotBlank(record.getVehMark())) {
|
|
|
|
// redemptionVeh.setVehMark(record.getVehMark());
|
|
|
|
// }
|
|
|
|
// if (StringUtils.isNotBlank(record.getVehModel())) {
|
|
|
|
// redemptionVeh.setVehModel(record.getVehModel());
|
|
|
|
// }
|
|
|
|
// if (StringUtils.isNotBlank(record.getVehType())) {
|
|
|
|
// redemptionVeh.setVehType(record.getVehType());
|
|
|
|
// if (record.getVehType().equals("主车")) {
|
|
|
|
// if (StringUtils.isNotBlank(dto.getBusVinSid())) {
|
|
|
|
// redemptionVeh.setBusVinSid(dto.getBusVinSid());
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// loanRedemptionVehService.insert(redemptionVeh);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// LoanRedemptionApply loanRedemptionApply = new LoanRedemptionApply();
|
|
|
|
// sid = loanRedemptionApply.getSid();
|
|
|
|
// BeanUtil.copyProperties(dto, loanRedemptionApply, "id", "sid");
|
|
|
|
// loanRedemptionApply.setCreateBySid(dto.getUserSid());
|
|
|
|
// loanRedemptionApply.setOrgSidPath(dto.getOrgPath());
|
|
|
|
// ResultBean<String> orgSidByPath = sysStaffOrgFeign.getOrgSidByPath(dto.getOrgPath());
|
|
|
|
// if (orgSidByPath.getSuccess()) {
|
|
|
|
// String userOrgSid = orgSidByPath.getData();
|
|
|
|
// loanRedemptionApply.setUseOrgSid(userOrgSid);
|
|
|
|
// ResultBean<SysOrganizationVo> organizationVo = sysOrganizationFeign.fetchBySid(userOrgSid);
|
|
|
|
// if (organizationVo.getSuccess()) {
|
|
|
|
// SysOrganizationVo organizationVoData = organizationVo.getData();
|
|
|
|
// if (null != organizationVoData) {
|
|
|
|
// loanRedemptionApply.setUseOrgName(organizationVoData.getName());
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// loanRedemptionApply.setNodeState("待提交");
|
|
|
|
// baseMapper.insert(loanRedemptionApply);
|
|
|
|
// List<RedemptionVinList> vinList = dto.getVinList();
|
|
|
|
// if (!vinList.isEmpty()) {
|
|
|
|
// for (RedemptionVinList record : vinList) {
|
|
|
|
// LoanRedemptionVeh redemptionVeh = new LoanRedemptionVeh();
|
|
|
|
// redemptionVeh.setMainSid(sid);
|
|
|
|
ResultBean<String> rb = ResultBean.fireFail(); |
|
|
|
String sid = ""; |
|
|
|
if (StringUtils.isNotBlank(dto.getSid())) { |
|
|
|
sid = dto.getSid(); |
|
|
|
LoanSubletApply updateEntity = fetchBySid(sid); |
|
|
|
if (null != updateEntity) { |
|
|
|
BeanUtil.copyProperties(dto, updateEntity, "id", "sid"); |
|
|
|
baseMapper.updateById(updateEntity); |
|
|
|
//todo 修改车辆交回台账
|
|
|
|
List<SubletVinList> subletVinLists = loanSubletVehService.selByMainSid(sid); |
|
|
|
if (!subletVinLists.isEmpty()) { |
|
|
|
|
|
|
|
} |
|
|
|
loanSubletVehService.deleteByMainSid(sid); |
|
|
|
//删除附件表中关于该linkSid的文件
|
|
|
|
loanFileService.deleteByLinkSid(sid); |
|
|
|
List<LoanSubletApplyFile> filess = dto.getFiles(); |
|
|
|
if (!filess.isEmpty()) { |
|
|
|
List<String> files = new ArrayList<>(); |
|
|
|
for (LoanSubletApplyFile file : filess) { |
|
|
|
files.add(file.getUrl()); |
|
|
|
} |
|
|
|
loanFileService.saveAll(sid, files, LoanFileEnum.SUBLETAPPLY.getAttachType()); |
|
|
|
} |
|
|
|
List<SubletVinList> vinList = dto.getVinList(); |
|
|
|
if (!vinList.isEmpty()) { |
|
|
|
for (SubletVinList record : vinList) { |
|
|
|
LoanSubletVeh subletVeh = new LoanSubletVeh(); |
|
|
|
BeanUtil.copyProperties(record, subletVeh, "id", "sid"); |
|
|
|
subletVeh.setMainSid(sid); |
|
|
|
loanSubletVehService.insert(subletVeh); |
|
|
|
//todo 交回车辆状态处置状态修改
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
LoanSubletApply apply = new LoanSubletApply(); |
|
|
|
sid = apply.getSid(); |
|
|
|
BeanUtil.copyProperties(dto, apply, "id", "sid"); |
|
|
|
apply.setCreateBySid(dto.getUserSid()); |
|
|
|
apply.setOrgSidPath(dto.getOrgPath()); |
|
|
|
ResultBean<String> orgSidByPath = sysStaffOrgFeign.getOrgSidByPath(dto.getOrgPath()); |
|
|
|
if (orgSidByPath.getSuccess()) { |
|
|
|
String userOrgSid = orgSidByPath.getData(); |
|
|
|
apply.setUseOrgSid(userOrgSid); |
|
|
|
ResultBean<SysOrganizationVo> organizationVo = sysOrganizationFeign.fetchBySid(userOrgSid); |
|
|
|
if (organizationVo.getSuccess()) { |
|
|
|
SysOrganizationVo organizationVoData = organizationVo.getData(); |
|
|
|
if (null != organizationVoData) { |
|
|
|
apply.setUseOrgName(organizationVoData.getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
apply.setNodeState("待提交"); |
|
|
|
baseMapper.insert(apply); |
|
|
|
List<SubletVinList> vinList = dto.getVinList(); |
|
|
|
if (!vinList.isEmpty()) { |
|
|
|
for (SubletVinList record : vinList) { |
|
|
|
LoanSubletVeh subletVeh = new LoanSubletVeh(); |
|
|
|
BeanUtil.copyProperties(record, subletVeh, "id", "sid"); |
|
|
|
subletVeh.setMainSid(sid); |
|
|
|
// if (StringUtils.isNotBlank(record.getVinSid())) {
|
|
|
|
// redemptionVeh.setVinSid(record.getVinSid());
|
|
|
|
// subletVeh.setVinSid(record.getVinSid());
|
|
|
|
// }
|
|
|
|
// if (StringUtils.isNotBlank(record.getVinNo())) {
|
|
|
|
// redemptionVeh.setVinNo(record.getVinNo());
|
|
|
|
// subletVeh.setVinNo(record.getVinNo());
|
|
|
|
// }
|
|
|
|
// if (StringUtils.isNotBlank(record.getVehMark())) {
|
|
|
|
// redemptionVeh.setVehMark(record.getVehMark());
|
|
|
|
// subletVeh.setVehMark(record.getVehMark());
|
|
|
|
// }
|
|
|
|
// if (StringUtils.isNotBlank(record.getVehModel())) {
|
|
|
|
// redemptionVeh.setVehModel(record.getVehModel());
|
|
|
|
// subletVeh.setVehModel(record.getVehModel());
|
|
|
|
// }
|
|
|
|
// if (StringUtils.isNotBlank(record.getVehType())) {
|
|
|
|
// redemptionVeh.setVehType(record.getVehType());
|
|
|
|
// if (record.getVehType().equals("主车")) {
|
|
|
|
// if (StringUtils.isNotBlank(dto.getBusVinSid())) {
|
|
|
|
// redemptionVeh.setBusVinSid(dto.getBusVinSid());
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// subletVeh.setVehType(record.getVehType());
|
|
|
|
// }
|
|
|
|
// loanRedemptionVehService.insert(redemptionVeh);
|
|
|
|
// //todo 交回车辆状态处置状态修改
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// //删除附件表中关于该linkSid的文件
|
|
|
|
// loanFileService.deleteByLinkSid(sid);
|
|
|
|
// List<LoanRedemptionApplyFile> filess = dto.getFiles();
|
|
|
|
// if (!filess.isEmpty()) {
|
|
|
|
// List<String> files = new ArrayList<>();
|
|
|
|
// for (LoanRedemptionApplyFile file : filess) {
|
|
|
|
// files.add(file.getUrl());
|
|
|
|
// }
|
|
|
|
// loanFileService.saveAll(sid, files, LoanFileEnum.REDEMPTION.getAttachType());
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// return rb.success().setData(sid);
|
|
|
|
return null; |
|
|
|
// if (StringUtils.isNotBlank(record.getBusVinSid())) {
|
|
|
|
// subletVeh.setBusVinSid(record.getBusVinSid());
|
|
|
|
// }
|
|
|
|
// if (StringUtils.isNotBlank(record.getLedgerSid())) {
|
|
|
|
// subletVeh.setLedgerSid(record.getLedgerSid());
|
|
|
|
// }
|
|
|
|
loanSubletVehService.insert(subletVeh); |
|
|
|
//todo 交回车辆状态处置状态修改
|
|
|
|
} |
|
|
|
} |
|
|
|
//删除附件表中关于该linkSid的文件
|
|
|
|
loanFileService.deleteByLinkSid(sid); |
|
|
|
List<LoanSubletApplyFile> filess = dto.getFiles(); |
|
|
|
if (!filess.isEmpty()) { |
|
|
|
List<String> files = new ArrayList<>(); |
|
|
|
for (LoanSubletApplyFile file : filess) { |
|
|
|
files.add(file.getUrl()); |
|
|
|
} |
|
|
|
loanFileService.saveAll(sid, files, LoanFileEnum.SUBLETAPPLY.getAttachType()); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(sid); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<LoanSubletApplyInit> subletDetails(String sid) { |
|
|
|
// ResultBean rb = ResultBean.fireFail();
|
|
|
|
// LoanRedemptionApplyInit vo = new LoanRedemptionApplyInit();
|
|
|
|
// LoanRedemptionApply entity = fetchBySid(sid);
|
|
|
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
// if (null != entity) {
|
|
|
|
// BeanUtil.copyProperties(entity, vo);
|
|
|
|
// if (null != entity.getApplyDate()) {
|
|
|
|
// vo.setApplyDate(sdf.format(entity.getApplyDate()));
|
|
|
|
// }
|
|
|
|
// if (StringUtils.isNotBlank(entity.getProcInstId())) {
|
|
|
|
// vo.setInstanceId(entity.getProcInstId());
|
|
|
|
// }
|
|
|
|
// if (StringUtils.isNotBlank(entity.getCreateBySid())) {
|
|
|
|
// vo.setUserSid(entity.getCreateBySid());
|
|
|
|
// }
|
|
|
|
// if (StringUtils.isNotBlank(entity.getOrgSidPath())) {
|
|
|
|
// vo.setOrgPath(entity.getOrgSidPath());
|
|
|
|
// }
|
|
|
|
// List<RedemptionVinList> redemptionVinLists = loanRedemptionVehService.selByMainSid(sid);
|
|
|
|
// if (!redemptionVinLists.isEmpty()) {
|
|
|
|
// redemptionVinLists.stream().forEach(v -> {
|
|
|
|
// if (v.getVehType().equals("主车")) {
|
|
|
|
// vo.setBusVinSid(v.getBusVinSid());
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// vo.setVinList(redemptionVinLists);
|
|
|
|
// }
|
|
|
|
// if (StringUtils.isNotBlank(vo.getBusVinSid())) {
|
|
|
|
// AlrepaidAndArrVo alrepaidAndArr = loanRestoreReportApplyService.getAlrepaidAndArr(vo.getBusVinSid());
|
|
|
|
// if (null != alrepaidAndArr) {
|
|
|
|
// //已还金额
|
|
|
|
// if (StringUtils.isNotBlank(alrepaidAndArr.getAlRepaidMoney())) {
|
|
|
|
// vo.setAlRepaidMoney(alrepaidAndArr.getAlRepaidMoney());
|
|
|
|
// }
|
|
|
|
// //已还金额换算期数
|
|
|
|
// if (StringUtils.isNotBlank(alrepaidAndArr.getAlRepaidMoneyConPeriod())) {
|
|
|
|
// vo.setAlRepaidMoneyConPeriod(alrepaidAndArr.getAlRepaidMoneyConPeriod());
|
|
|
|
// }
|
|
|
|
// //逾期金额换算期数
|
|
|
|
// if (StringUtils.isNotBlank(alrepaidAndArr.getBeOverdueMoneyAndPeriod())) {
|
|
|
|
// vo.setBeOverdueMoneyAndPeriod(alrepaidAndArr.getBeOverdueMoneyAndPeriod());
|
|
|
|
// }
|
|
|
|
// //总期数
|
|
|
|
// if (StringUtils.isNotBlank(alrepaidAndArr.getNper())) {
|
|
|
|
// vo.setNper(alrepaidAndArr.getNper());
|
|
|
|
// }
|
|
|
|
// //当前逾期金额
|
|
|
|
// if (StringUtils.isNotBlank(alrepaidAndArr.getCurrentBeMoney())) {
|
|
|
|
// vo.setCurrentBeMoney(alrepaidAndArr.getCurrentBeMoney());
|
|
|
|
// }
|
|
|
|
// //当前期数
|
|
|
|
// if (StringUtils.isNotBlank(alrepaidAndArr.getCurrentPeriod())) {
|
|
|
|
// vo.setCurrentPeriod(alrepaidAndArr.getCurrentPeriod());
|
|
|
|
// }
|
|
|
|
// //未到期金额
|
|
|
|
// if (StringUtils.isNotBlank(alrepaidAndArr.getUnexpiredMoney())) {
|
|
|
|
// vo.setUnexpiredMoney(alrepaidAndArr.getUnexpiredMoney());
|
|
|
|
// }
|
|
|
|
// //其中资金占用费
|
|
|
|
// if (StringUtils.isNotBlank(alrepaidAndArr.getWheFundOccMoney())) {
|
|
|
|
// vo.setWheFundOccMoney(alrepaidAndArr.getWheFundOccMoney());
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// List<LoanFile> fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.REDEMPTION.getAttachType());
|
|
|
|
// fileList.removeAll(Collections.singleton(null));
|
|
|
|
// if (!fileList.isEmpty()) {
|
|
|
|
// List<String> files = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).
|
|
|
|
// collect(Collectors.toList());
|
|
|
|
// List<LoanRedemptionApplyFile> applyFiles = new ArrayList<>();
|
|
|
|
// for (String file : files) {
|
|
|
|
// LoanRedemptionApplyFile applyFile = new LoanRedemptionApplyFile();
|
|
|
|
// applyFile.setUrl(file);
|
|
|
|
// applyFiles.add(applyFile);
|
|
|
|
// }
|
|
|
|
// vo.setFiles(applyFiles);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// return rb.success().setData(vo);
|
|
|
|
return null; |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
LoanSubletApplyInit vo = new LoanSubletApplyInit(); |
|
|
|
LoanSubletApply entity = fetchBySid(sid); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
if (null != entity) { |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
if (null != entity.getApplyDate()) { |
|
|
|
vo.setApplyDate(sdf.format(entity.getApplyDate())); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getProcInstId())) { |
|
|
|
vo.setInstanceId(entity.getProcInstId()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getCreateBySid())) { |
|
|
|
vo.setUserSid(entity.getCreateBySid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getOrgSidPath())) { |
|
|
|
vo.setOrgPath(entity.getOrgSidPath()); |
|
|
|
} |
|
|
|
List<SubletVinList> vinLists = loanSubletVehService.selByMainSid(sid); |
|
|
|
if (!vinLists.isEmpty()) { |
|
|
|
vo.setVinList(vinLists); |
|
|
|
} |
|
|
|
List<LoanFile> fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.SUBLETAPPLY.getAttachType()); |
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
List<String> files = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()). |
|
|
|
collect(Collectors.toList()); |
|
|
|
List<LoanSubletApplyFile> applyFiles = new ArrayList<>(); |
|
|
|
for (String file : files) { |
|
|
|
LoanSubletApplyFile applyFile = new LoanSubletApplyFile(); |
|
|
|
applyFile.setUrl(file); |
|
|
|
applyFiles.add(applyFile); |
|
|
|
} |
|
|
|
vo.setFiles(applyFiles); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean deleteBySids(String[] sids) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
// for (String sid : sids) {
|
|
|
|
// LoanRedemptionApply entity = fetchBySid(sid);
|
|
|
|
// if (null != entity) {
|
|
|
|
// if (!entity.getNodeState().equals("待提交")) {
|
|
|
|
// return rb.setMsg("删除的数据中包含已经提交审批的数据,删除失败");
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// entity.setIsDelete(1);
|
|
|
|
// int i = baseMapper.updateById(entity);
|
|
|
|
// if (i == 0) {
|
|
|
|
// return rb.setMsg("删除失败");
|
|
|
|
// }
|
|
|
|
// //todo 修改交回车辆台账状态
|
|
|
|
// }
|
|
|
|
for (String sid : sids) { |
|
|
|
LoanSubletApply entity = fetchBySid(sid); |
|
|
|
if (null != entity) { |
|
|
|
if (!entity.getNodeState().equals("待提交")) { |
|
|
|
return rb.setMsg("删除的数据中包含已经提交审批的数据,删除失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
entity.setIsDelete(1); |
|
|
|
int i = baseMapper.updateById(entity); |
|
|
|
if (i == 0) { |
|
|
|
return rb.setMsg("删除失败"); |
|
|
|
} |
|
|
|
//todo 修改交回车辆台账状态
|
|
|
|
} |
|
|
|
return ResultBean.fireSuccess().setMsg("删除成功"); |
|
|
|
} |
|
|
|
|
|
|
|