@ -35,12 +35,21 @@ import com.yxt.anrui.riskcenter.api.loanreturninboundtrailer.LoanReturnInboundTr
import com.yxt.anrui.riskcenter.api.loanreturnvehledger.LoanReturnVehLedger ;
import com.yxt.anrui.riskcenter.api.loansecondarysalesapply.* ;
import com.yxt.anrui.riskcenter.api.loansecondarysalesapply.flowable.* ;
import com.yxt.anrui.riskcenter.api.loansecondarysalescost.LoanSecondarySalesCost ;
import com.yxt.anrui.riskcenter.api.loansecondarysalescost.LoanSecondarySalesCostVo ;
import com.yxt.anrui.riskcenter.api.loansecondarysalesveh.LoanSecondarySalesVeh ;
import com.yxt.anrui.riskcenter.api.loansecondarysalesveh.LoanSecondarySalesVehVo ;
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutions ;
import com.yxt.anrui.riskcenter.api.loansolutionsdetail.LoanSolutionsDetail ;
import com.yxt.anrui.riskcenter.biz.loanrestorereportapply.LoanRestoreReportApplyService ;
import com.yxt.anrui.riskcenter.biz.loanreturninboundapply.LoanReturnInboundApplyService ;
import com.yxt.anrui.riskcenter.biz.loanreturnvehledger.LoanReturnVehLedgerService ;
import com.yxt.anrui.riskcenter.biz.loansecondarysalescost.LoanSecondarySalesCostMapper ;
import com.yxt.anrui.riskcenter.biz.loansecondarysalescost.LoanSecondarySalesCostService ;
import com.yxt.anrui.riskcenter.biz.loansecondarysalesveh.LoanSecondarySalesVehService ;
import com.yxt.anrui.riskcenter.biz.loansolutions.LoanSolutionsMapper ;
import com.yxt.anrui.riskcenter.biz.loansolutions.LoanSolutionsService ;
import com.yxt.anrui.riskcenter.biz.loansolutionsdetail.LoanSolutionsDetailService ;
import com.yxt.common.base.config.component.FileUploadComponent ;
import com.yxt.common.base.service.MybatisBaseService ;
import com.yxt.common.base.utils.PagerUtil ;
@ -55,6 +64,7 @@ import org.apache.tomcat.util.threads.ThreadPoolExecutor;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Service ;
import java.math.BigDecimal ;
import java.util.* ;
import java.util.concurrent.* ;
import java.util.stream.Collectors ;
@ -89,6 +99,16 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
private FileUploadComponent fileUploadComponent ;
@Autowired
private LoanReturnVehLedgerService loanReturnVehLedgerService ;
@Autowired
private LoanReturnInboundApplyService loanReturnInboundApplyService ;
@Autowired
private LoanRestoreReportApplyService loanRestoreReportApplyService ;
@Autowired
private LoanSolutionsMapper loanSolutionsMapper ;
@Autowired
private LoanSolutionsDetailService loanSolutionsDetailService ;
@Autowired
private LoanSecondarySalesCostMapper loanSecondarySalesCostMapper ;
public PagerVo < LoanSecondarySalesApplyVo > listPageVo ( PagerQuery < LoanSecondarySalesApplyQuery > pq ) {
LoanSecondarySalesApplyQuery query = pq . getParams ( ) ;
@ -110,13 +130,6 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
if ( StringUtils . isNotBlank ( query . getLoanContractNo ( ) ) ) {
qw . like ( "la.loanContractNo" , query . getLoanContractNo ( ) ) ;
}
//ToDo:车架号
if ( StringUtils . isNotBlank ( query . getVinNo ( ) ) ) {
}
//车牌号
if ( StringUtils . isNotBlank ( query . getVehMark ( ) ) ) {
}
//贷款人
if ( StringUtils . isNotBlank ( query . getLoanName ( ) ) ) {
qw . like ( "la.loanName" , query . getLoanName ( ) ) ;
@ -142,6 +155,9 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
qw . apply ( StringUtils . isNotBlank ( query . getCreateTimeStart ( ) ) , "date_format (la.createTime,'%Y-%m-%d') >= date_format('" + query . getCreateTimeStart ( ) + "','%Y-%m-%d')" ) .
apply ( StringUtils . isNotBlank ( query . getCreateTimeEnd ( ) ) , "date_format (la.createTime,'%Y-%m-%d') <= date_format('" + query . getCreateTimeEnd ( ) + "','%Y-%m-%d')"
) ;
if ( StringUtils . isNotBlank ( query . getArrearsAll ( ) ) ) {
qw . like ( "lc.arrearsAll" , query . getArrearsAll ( ) ) ;
}
//========================================数据授权开始
if ( StringUtils . isNotBlank ( query . getMenuUrl ( ) ) ) {
//=======================
@ -183,9 +199,8 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
}
}
}
qw . orderByDesc ( "la.createTime" ) ;
IPage < LoanSecondarySalesApply > page = PagerUtil . queryToPage ( pq ) ;
IPage < LoanSecondarySalesApplyVo > pagging = baseMapper . selectPageVo ( page , qw ) ;
IPage < LoanSecondarySalesApplyVo > pagging = baseMapper . selectPageVo ( page , qw , query . getVinNo ( ) , query . getVehMark ( ) ) ;
List < LoanSecondarySalesApplyVo > paggingRecords = pagging . getRecords ( ) ;
paggingRecords . removeAll ( Collections . singleton ( null ) ) ;
if ( ! paggingRecords . isEmpty ( ) ) {
@ -207,6 +222,20 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
BeanUtil . copyProperties ( query , bv ) ;
LoanSecondarySalesApply loanSecondarySalesApply = fetchBySid ( query . getBusinessSid ( ) ) ;
bv . setModelId ( loanSecondarySalesApply . getProcDefId ( ) ) ;
Map < String , Object > variables = new HashMap < > ( ) ;
Map < String , Object > appMap = new HashMap < > ( ) ;
LoanSecondarySalesCost loanSecondarySalesCost = loanSecondarySalesCostMapper . selectMainSid ( query . getBusinessSid ( ) ) ;
if ( loanSecondarySalesCost ! = null ) {
if ( ( loanSecondarySalesCost . getVehicleEvaluation ( ) = = null ? BigDecimal . ZERO : loanSecondarySalesCost . getVehicleEvaluation ( ) ) . compareTo ( loanSecondarySalesCost . getVehPrice ( ) ) > 0 ) {
variables . put ( "isTrue" , true ) ;
} else {
variables . put ( "isTrue" , false ) ;
}
}
appMap . put ( "sid" , query . getBusinessSid ( ) ) ;
variables . put ( "app" , appMap ) ;
bv . setFormVariables ( variables ) ;
ResultBean < List < Map < String , Object > > > resultBean = flowTaskFeign . getPreviousNodesForReject ( bv ) ;
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给TemplateApplyNodeVo
List < LoanSecondarySalesApplyNodeVo > voList = Optional . ofNullable ( resultBean . getData ( ) ) . orElse ( new ArrayList < > ( ) ) . stream ( ) . map ( m - > JSON . parseObject ( JSON . toJSONString ( m ) , LoanSecondarySalesApplyNodeVo . class ) ) . collect ( Collectors . toList ( ) ) ;
@ -219,6 +248,24 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
BeanUtil . copyProperties ( query , bv ) ;
LoanSecondarySalesApply loanSecondarySalesApply = fetchBySid ( query . getBusinessSid ( ) ) ;
bv . setModelId ( loanSecondarySalesApply . getProcDefId ( ) ) ;
Map < String , Object > variables = new HashMap < > ( ) ;
Map < String , Object > appMap = new HashMap < > ( ) ;
if ( "Activity_0rm74ey" . equals ( bv . getTaskDefKey ( ) ) ) { //风控处置岗审批
if ( StringUtils . isBlank ( query . getVehicleEvaluation ( ) ) ) {
return rb . setMsg ( "请填写评估价格" ) ;
}
LoanSecondarySalesCost loanSecondarySalesCost = loanSecondarySalesCostMapper . selectMainSid ( query . getBusinessSid ( ) ) ;
if ( loanSecondarySalesCost ! = null ) {
if ( new BigDecimal ( query . getVehicleEvaluation ( ) ) . compareTo ( loanSecondarySalesCost . getVehPrice ( ) ) > 0 ) {
variables . put ( "isTrue" , true ) ;
} else {
variables . put ( "isTrue" , false ) ;
}
}
}
appMap . put ( "sid" , query . getBusinessSid ( ) ) ;
variables . put ( "app" , appMap ) ;
bv . setFormVariables ( variables ) ;
ResultBean < List < Map < String , Object > > > resultBean = flowTaskFeign . getNextNodesForSubmit ( bv ) ;
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给TemplateApplyNodeVo
List < LoanSecondarySalesApplyNodeVo > voList = Optional . ofNullable ( resultBean . getData ( ) ) . orElse ( new ArrayList < > ( ) ) . stream ( ) . map ( m - > JSON . parseObject ( JSON . toJSONString ( m ) , LoanSecondarySalesApplyNodeVo . class ) ) . collect ( Collectors . toList ( ) ) ;
@ -247,6 +294,15 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
Map < String , Object > appMap = new HashMap < > ( ) ;
appMap . put ( "sid" , businessSid ) ;
variables . put ( "app" , appMap ) ;
LoanSecondarySalesCost loanSecondarySalesCost = loanSecondarySalesCostMapper . selectMainSid ( query . getBusinessSid ( ) ) ;
if ( loanSecondarySalesCost ! = null ) {
if ( ( loanSecondarySalesCost . getVehicleEvaluation ( ) = = null ? BigDecimal . ZERO : loanSecondarySalesCost . getVehicleEvaluation ( ) ) . compareTo ( loanSecondarySalesCost . getVehPrice ( ) ) > 0 ) {
variables . put ( "isTrue" , true ) ;
} else {
variables . put ( "isTrue" , false ) ;
}
}
flowTaskVo . setValues ( variables ) ;
ResultBean < UpdateFlowFieldVo > resultBean = flowableFeign . taskReject ( flowTaskVo ) ;
if ( ! resultBean . getSuccess ( ) ) {
return rb . setMsg ( resultBean . getMsg ( ) ) ;
@ -295,6 +351,20 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
if ( businessTaskId . equals ( query . getTaskId ( ) ) ) {
FlowTaskVo flowTaskVo = new FlowTaskVo ( ) ;
BeanUtil . copyProperties ( query , flowTaskVo ) ;
Map < String , Object > variables = new HashMap < > ( ) ;
Map < String , Object > appMap = new HashMap < > ( ) ;
LoanSecondarySalesCost loanSecondarySalesCost = loanSecondarySalesCostMapper . selectMainSid ( query . getBusinessSid ( ) ) ;
if ( loanSecondarySalesCost ! = null ) {
if ( ( loanSecondarySalesCost . getVehicleEvaluation ( ) = = null ? BigDecimal . ZERO : loanSecondarySalesCost . getVehicleEvaluation ( ) ) . compareTo ( loanSecondarySalesCost . getVehPrice ( ) ) > 0 ) {
variables . put ( "isTrue" , true ) ;
} else {
variables . put ( "isTrue" , false ) ;
}
}
appMap . put ( "sid" , query . getBusinessSid ( ) ) ;
variables . put ( "app" , appMap ) ;
flowTaskVo . setValues ( variables ) ;
ResultBean < UpdateFlowFieldVo > resultBean = flowableFeign . revokeProcess ( flowTaskVo ) ;
if ( ! resultBean . getSuccess ( ) ) {
return rb . setMsg ( resultBean . getMsg ( ) ) ;
@ -361,12 +431,28 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
return rb . success ( ) ;
}
public ResultBean complete ( BusinessVariables bv ) {
public ResultBean complete ( BusinessVariables bv , String price ) {
ResultBean rb = ResultBean . fireFail ( ) ;
String businessSid = bv . getBusinessSid ( ) ;
LoanSecondarySalesApply loanSecondarySalesApply = fetchBySid ( businessSid ) ;
Map < String , Object > variables = new HashMap < > ( ) ;
Map < String , Object > appMap = new HashMap < > ( ) ;
if ( "Activity_0rm74ey" . equals ( bv . getTaskDefKey ( ) ) ) { //风控处置岗审批
if ( StringUtils . isBlank ( price ) ) {
return rb . setMsg ( "请填写评估价格" ) ;
}
//保存评估价格
LoanSecondarySalesCost loanSecondarySalesCost = loanSecondarySalesCostMapper . selectMainSid ( businessSid ) ;
loanSecondarySalesCost . setVehicleEvaluation ( new BigDecimal ( price ) ) ;
loanSecondarySalesCostService . updateById ( loanSecondarySalesCost ) ;
if ( loanSecondarySalesCost ! = null ) {
if ( ( loanSecondarySalesCost . getVehicleEvaluation ( ) = = null ? BigDecimal . ZERO : loanSecondarySalesCost . getVehicleEvaluation ( ) ) . compareTo ( loanSecondarySalesCost . getVehPrice ( ) ) > 0 ) {
variables . put ( "isTrue" , true ) ;
} else {
variables . put ( "isTrue" , false ) ;
}
}
}
appMap . put ( "sid" , businessSid ) ;
variables . put ( "app" , appMap ) ;
bv . setFormVariables ( variables ) ;
@ -417,7 +503,24 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
return rb . setMsg ( "操作失败!提交的数据不一致" ) ;
}
//ToDo:验证车辆是否已处置
List < LoanSecondarySalesVehVo > loanSecondarySalesVehVoList = dto . getLoanSecondarySalesVehVoList ( ) ;
loanSecondarySalesVehVoList . removeAll ( Collections . singleton ( null ) ) ;
if ( loanSecondarySalesVehVoList . isEmpty ( ) ) {
return rb . setMsg ( "请选择车辆" ) ;
}
List < String > vinNoLists = new ArrayList < > ( ) ;
List < String > chooseSidList = loanSecondarySalesVehVoList . stream ( ) . map ( v - > v . getBusSid ( ) ) . collect ( Collectors . toList ( ) ) ;
for ( int i = 0 ; i < chooseSidList . size ( ) ; i + + ) {
String s = chooseSidList . get ( i ) ;
LoanReturnVehLedger loanReturnVehLedger = loanReturnVehLedgerService . fetchBySid ( s ) ;
if ( ! "未处置" . equals ( loanReturnVehLedger . getDisposal ( ) ) ) {
vinNoLists . add ( loanReturnVehLedger . getVinNo ( ) ) ;
}
}
vinNoLists . removeAll ( Collections . singleton ( null ) ) ;
if ( ! vinNoLists . isEmpty ( ) ) {
return rb . setMsg ( String . join ( "," , vinNoLists ) + "车架号处置方式非未处置,不能二次销售" ) ;
}
ResultBean < String > resultBean = saveOrUpdateSecondarySales ( dto ) ;
if ( ! resultBean . getSuccess ( ) ) {
return rb . setMsg ( resultBean . getMsg ( ) ) ;
@ -436,9 +539,20 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
bv . setBusinessSid ( businessSid ) ;
bv . setUserSid ( dto . getUserSid ( ) ) ;
bv . setFormVariables ( variables ) ;
List < String > orgPathList = Arrays . asList ( dto . getOrgPath ( ) . split ( "/" ) ) ;
SysOrganizationVo sysOrganization = sysOrganizationFeign . fetchBySid ( orgPathList . get ( orgPathList . size ( ) - 1 ) ) . getData ( ) ;
if ( sysOrganization = = null ) {
return rb . setMsg ( "当前所在的组织机构不存在" ) ;
}
if ( StringUtils . isBlank ( sysOrganization . getManagerSid ( ) ) ) {
// return rb.setMsg("当前所在的组织机构未设置主管人员");
sysOrganization . setManagerSid ( ProcDefEnum . DEFAUL_TADMIN_SID . getProDefId ( ) ) ;
}
String nextNodeUserSids_ = sysOrganization . getManagerSid ( ) ;
bv . setNextNodeUserSids ( nextNodeUserSids_ ) ;
if ( r = = 1 ) {
//ToDo:流程定义id
bv . setModelId ( ProcDefEnum . LOANRETUENINBOUNDAPPLY . getProDefId ( ) ) ;
bv . setModelId ( ProcDefEnum . LOANSECONDSALE APPLY . getProDefId ( ) ) ;
ResultBean < UpdateFlowFieldVo > voResultBean = flowFeign . startProcess ( bv ) ;
if ( ! voResultBean . getSuccess ( ) ) {
return rb . setMsg ( voResultBean . getMsg ( ) ) ;
@ -482,13 +596,89 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
bv . setTaskDefKey ( loanSecondarySalesApply . getTaskDefKey ( ) ) ;
bv . setComment ( "重新提交" ) ;
bv . setInstanceId ( dto . getInstanceId ( ) ) ;
return complete ( bv ) ;
return complete ( bv , "" ) ;
}
return rb ;
}
public ResultBean < String > saveOrUpdateSecondarySales ( LoanSecondarySalesApplyDto dto ) {
return null ;
ResultBean < String > rb = ResultBean . fireFail ( ) ;
String sid = dto . getSid ( ) ;
if ( StringUtils . isBlank ( sid ) ) { //新增
LoanSecondarySalesApply loanSecondarySalesApply = new LoanSecondarySalesApply ( ) ;
BeanUtil . copyProperties ( dto , loanSecondarySalesApply , "sid" ) ;
loanSecondarySalesApply . setCreateBySid ( dto . getUserSid ( ) ) ;
loanSecondarySalesApply . setOrgSidPath ( dto . getOrgPath ( ) ) ;
String useOrgSid = sysStaffOrgFeign . getOrgSidByPath ( dto . getOrgPath ( ) ) . getData ( ) ;
loanSecondarySalesApply . setUseOrgSid ( useOrgSid ) ;
//创建组织使用组织
ResultBean < SysOrganizationVo > organizationResultBean = sysOrganizationFeign . fetchBySid ( useOrgSid ) ;
if ( organizationResultBean . getData ( ) ! = null ) {
loanSecondarySalesApply . setUseOrgName ( organizationResultBean . getData ( ) . getName ( ) ) ;
}
//申请部门
List < String > orgList = Arrays . asList ( dto . getOrgPath ( ) . split ( "/" ) ) ;
String deptSid = orgList . get ( orgList . size ( ) - 1 ) ;
ResultBean < SysOrganizationVo > sysOrganizationVoResultBean = sysOrganizationFeign . fetchBySid ( deptSid ) ;
if ( sysOrganizationVoResultBean . getData ( ) ! = null ) {
loanSecondarySalesApply . setCreateDept ( sysOrganizationVoResultBean . getData ( ) . getName ( ) ) ;
loanSecondarySalesApply . setCreateDeptSid ( deptSid ) ;
}
//根据用户sid查询人员姓名
ResultBean < SysUserVo > userVoResultBean = sysUserFeign . fetchBySid ( dto . getUserSid ( ) ) ;
if ( ! userVoResultBean . getSuccess ( ) ) {
return rb . setMsg ( userVoResultBean . getMsg ( ) ) ;
}
loanSecondarySalesApply . setCreateByName ( userVoResultBean . getData ( ) . getName ( ) ) ;
List < String > filss = dto . getFilesList ( ) ;
filss . removeAll ( Collections . singleton ( null ) ) ;
if ( filss . size ( ) > 0 ) {
if ( ! filss . isEmpty ( ) ) {
String files = String . join ( "," , filss ) . replaceAll ( fileUploadComponent . getUrlPrefix ( ) , "" ) ;
loanSecondarySalesApply . setFiles ( files ) ;
}
}
baseMapper . insert ( loanSecondarySalesApply ) ;
sid = loanSecondarySalesApply . getSid ( ) ;
//保存车辆
List < LoanSecondarySalesVehVo > loanSecondarySalesVehVoList = dto . getLoanSecondarySalesVehVoList ( ) ;
loanSecondarySalesVehVoList . removeAll ( Collections . singleton ( null ) ) ;
if ( ! loanSecondarySalesVehVoList . isEmpty ( ) ) {
loanSecondarySalesVehService . saveVeh ( loanSecondarySalesVehVoList , sid ) ;
}
LoanSecondarySalesCostVo loanSecondarySalesCost = dto . getLoanSecondarySalesCost ( ) ;
if ( loanSecondarySalesCost ! = null ) {
loanSecondarySalesCostService . saveCost ( loanSecondarySalesCost , sid ) ;
}
} else {
LoanSecondarySalesApply loanSecondarySalesApply = fetchBySid ( sid ) ;
if ( loanSecondarySalesApply = = null ) {
return rb . setMsg ( "该申请不存在" ) ;
}
dto . setUserSid ( loanSecondarySalesApply . getCreateBySid ( ) ) ;
BeanUtil . copyProperties ( dto , loanSecondarySalesApply , "sid" ) ;
List < String > filss = dto . getFilesList ( ) ;
if ( ! filss . isEmpty ( ) ) {
if ( ! filss . isEmpty ( ) ) {
String files = String . join ( "," , filss ) . replaceAll ( fileUploadComponent . getUrlPrefix ( ) , "" ) ;
loanSecondarySalesApply . setFiles ( files ) ;
}
} else {
loanSecondarySalesApply . setFiles ( "" ) ;
}
//保存车辆
List < LoanSecondarySalesVehVo > loanSecondarySalesVehVoList = dto . getLoanSecondarySalesVehVoList ( ) ;
loanSecondarySalesVehVoList . removeAll ( Collections . singleton ( null ) ) ;
if ( ! loanSecondarySalesVehVoList . isEmpty ( ) ) {
loanSecondarySalesVehService . saveVeh ( loanSecondarySalesVehVoList , sid ) ;
}
LoanSecondarySalesCostVo loanSecondarySalesCost = dto . getLoanSecondarySalesCost ( ) ;
if ( loanSecondarySalesCost ! = null ) {
loanSecondarySalesCostService . saveCost ( loanSecondarySalesCost , sid ) ;
}
baseMapper . updateById ( loanSecondarySalesApply ) ;
}
return rb . success ( ) . setData ( sid ) ;
}
private int submitBusinessData ( SubmitLoanSecondarySalesApplyDto dto , LoanSecondarySalesApply loanSecondarySalesApply ) {
@ -541,14 +731,129 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
return rb . setMsg ( "请选择车辆" ) ;
}
String busVinSid = "" ;
String vinNo = "" ;
List < String > vinNoLists = new ArrayList < > ( ) ;
List < String > bankContractNoList = new ArrayList < > ( ) ;
List < LoanSecondarySalesVehVo > loanSecondarySalesVehVoList = new ArrayList < > ( ) ;
for ( int i = 0 ; i < chooseSidList . size ( ) ; i + + ) {
LoanSecondarySalesVehVo loanSecondarySalesVehVo = new LoanSecondarySalesVehVo ( ) ;
String s = chooseSidList . get ( i ) ;
LoanReturnVehLedger loanReturnVehLedger = loanReturnVehLedgerService . fetchBySid ( s ) ;
if ( "未处置" . equals ( loanReturnVehLedger . getDisposal ( ) ) ) {
if ( ! "未处置" . equals ( loanReturnVehLedger . getDisposal ( ) ) ) {
vinNoLists . add ( loanReturnVehLedger . getVinNo ( ) ) ;
}
LoanReturnInboundApply loanReturnInboundApply = loanReturnInboundApplyService . fetchBySid ( loanReturnVehLedger . getBusSid ( ) ) ;
if ( StringUtils . isNotBlank ( loanReturnInboundApply . getBankContractNo ( ) ) ) {
bankContractNoList . add ( loanReturnInboundApply . getBankContractNo ( ) ) ;
}
busVinSid = loanReturnInboundApply . getBusVinSid ( ) ;
if ( "主车" . equals ( loanReturnVehLedger . getVehType ( ) ) ) {
if ( "未处置" . equals ( loanReturnVehLedger . getDisposal ( ) ) ) {
loanSecondarySalesVehVo . setBusVinSid ( loanReturnVehLedger . getBusVinSid ( ) ) ;
loanSecondarySalesVehVo . setVinNo ( loanReturnVehLedger . getVinNo ( ) ) ;
loanSecondarySalesVehVo . setVehMark ( loanReturnVehLedger . getVehMark ( ) ) ;
loanSecondarySalesVehVo . setModelName ( loanReturnVehLedger . getVehModel ( ) ) ;
loanSecondarySalesVehVo . setModelSid ( loanReturnVehLedger . getVehModelSid ( ) ) ;
loanSecondarySalesVehVo . setConfigSid ( loanReturnVehLedger . getConfigSid ( ) ) ;
loanSecondarySalesVehVo . setBusVinSid ( busVinSid ) ;
loanSecondarySalesVehVo . setBusSid ( s ) ;
loanSecondarySalesVehVo . setVehType ( loanReturnVehLedger . getVehType ( ) ) ;
loanSecondarySalesVehVoList . add ( loanSecondarySalesVehVo ) ;
loanSecondarySalesApplyDetailsVo . setCustomerName ( loanReturnVehLedger . getCustomer ( ) ) ;
loanSecondarySalesApplyDetailsVo . setLoanName ( loanReturnVehLedger . getBorrowerName ( ) ) ;
loanSecondarySalesApplyDetailsVo . setCustomerSid ( loanReturnVehLedger . getCustomerSid ( ) ) ;
loanSecondarySalesApplyDetailsVo . setLoanSid ( loanReturnVehLedger . getBorrowerSid ( ) ) ;
loanSecondarySalesApplyDetailsVo . setLoanContractNo ( loanReturnInboundApply . getLoanContractNo ( ) ) ;
loanSecondarySalesApplyDetailsVo . setBankName ( loanReturnInboundApply . getBankName ( ) ) ;
loanSecondarySalesApplyDetailsVo . setBankContractNo ( loanReturnInboundApply . getBankContractNo ( ) ) ;
loanSecondarySalesApplyDetailsVo . setLocationName ( loanReturnVehLedger . getLocation ( ) ) ;
loanSecondarySalesApplyDetailsVo . setSalesOrderSid ( loanReturnVehLedger . getSaleOrderSid ( ) ) ;
loanSecondarySalesApplyDetailsVo . setFirstDate ( loanReturnInboundApply . getFirstDate ( ) ) ;
if ( StringUtils . isNotBlank ( loanReturnInboundApply . getFiles ( ) ) ) {
List < UrlQuery > list = new ArrayList < > ( ) ;
if ( StringUtils . isNotBlank ( loanReturnInboundApply . getFiles ( ) ) ) {
List < String > fileList = Arrays . asList ( loanReturnInboundApply . getFiles ( ) . split ( "," ) ) . stream ( ) . map ( c - > fileUploadComponent . getUrlPrefix ( ) + c ) . collect ( Collectors . toList ( ) ) ;
loanSecondarySalesApplyDetailsVo . setFilesList ( fileList ) ;
}
}
LoanSecondarySalesCostVo loanSecondarySalesCost = new LoanSecondarySalesCostVo ( ) ;
AlrepaidAndArrVo alrepaidAndArrVo = loanRestoreReportApplyService . getAlrepaidAndArr ( busVinSid ) ;
if ( alrepaidAndArrVo ! = null ) {
BeanUtil . copyProperties ( alrepaidAndArrVo , loanSecondarySalesApplyDetailsVo ) ;
BigDecimal bigDecimal = BigDecimal . ZERO ;
if ( StringUtils . isNotBlank ( alrepaidAndArrVo . getCurrentBeMoney ( ) ) ) {
bigDecimal = bigDecimal . add ( new BigDecimal ( alrepaidAndArrVo . getCurrentBeMoney ( ) ) ) ;
}
if ( StringUtils . isNotBlank ( alrepaidAndArrVo . getUnexpiredMoney ( ) ) ) {
bigDecimal = bigDecimal . add ( new BigDecimal ( alrepaidAndArrVo . getUnexpiredMoney ( ) ) ) ;
}
loanSecondarySalesCost . setArrearsAll ( bigDecimal . toString ( ) ) ;
}
loanSecondarySalesApplyDetailsVo . setLoanSecondarySalesCost ( loanSecondarySalesCost ) ;
//根据销售订单查询金额方案
LoanSolutions loanSolutions = loanSolutionsMapper . selectBySaleOrderSid ( loanReturnVehLedger . getSaleOrderSid ( ) ) ;
if ( loanSolutions ! = null ) {
LoanSolutionsDetail loanSolutionsDetail = loanSolutionsDetailService . selectLoanSid ( loanSolutions . getSid ( ) ) ;
if ( loanSolutionsDetail ! = null ) {
loanSecondarySalesCost . setLoanDeposit ( loanSolutionsDetail . getBondAmounts ( ) . toString ( ) ) ;
}
}
}
//根据主车查询挂车信息
LoanReturnVehLedger loanReturnVehLedgerT = loanReturnVehLedgerService . selectByPSid ( loanReturnVehLedger . getSid ( ) ) ;
if ( "未处置" . equals ( loanReturnVehLedgerT . getDisposal ( ) ) ) {
loanSecondarySalesVehVo = new LoanSecondarySalesVehVo ( ) ;
loanSecondarySalesVehVo . setVehType ( loanReturnVehLedgerT . getVehType ( ) ) ;
loanSecondarySalesVehVo . setVehMark ( loanReturnVehLedgerT . getVehMark ( ) ) ;
loanSecondarySalesVehVo . setVinNo ( loanReturnVehLedgerT . getVinNo ( ) ) ;
loanSecondarySalesVehVo . setModelName ( loanReturnVehLedgerT . getVehModel ( ) ) ;
loanSecondarySalesVehVo . setBusSid ( s ) ;
loanSecondarySalesVehVoList . add ( loanSecondarySalesVehVo ) ;
}
}
if ( "挂车" . equals ( loanReturnVehLedger . getVehType ( ) ) ) {
if ( "未处置" . equals ( loanReturnVehLedger . getDisposal ( ) ) ) {
loanSecondarySalesVehVo = new LoanSecondarySalesVehVo ( ) ;
loanSecondarySalesVehVo . setVehType ( loanReturnVehLedger . getVehType ( ) ) ;
loanSecondarySalesVehVo . setVehMark ( loanReturnVehLedger . getVehMark ( ) ) ;
loanSecondarySalesVehVo . setVinNo ( loanReturnVehLedger . getVinNo ( ) ) ;
loanSecondarySalesVehVo . setModelName ( loanReturnVehLedger . getVehModel ( ) ) ;
loanSecondarySalesVehVo . setBusSid ( s ) ;
loanSecondarySalesVehVoList . add ( loanSecondarySalesVehVo ) ;
loanSecondarySalesApplyDetailsVo . setCustomerName ( loanReturnVehLedger . getCustomer ( ) ) ;
loanSecondarySalesApplyDetailsVo . setLoanName ( loanReturnVehLedger . getBorrowerName ( ) ) ;
loanSecondarySalesApplyDetailsVo . setCustomerSid ( loanReturnVehLedger . getCustomerSid ( ) ) ;
loanSecondarySalesApplyDetailsVo . setLoanSid ( loanReturnVehLedger . getBorrowerSid ( ) ) ;
loanSecondarySalesApplyDetailsVo . setLoanContractNo ( loanReturnInboundApply . getLoanContractNo ( ) ) ;
loanSecondarySalesApplyDetailsVo . setBankName ( loanReturnInboundApply . getBankName ( ) ) ;
loanSecondarySalesApplyDetailsVo . setBankContractNo ( loanReturnInboundApply . getBankContractNo ( ) ) ;
loanSecondarySalesApplyDetailsVo . setLocationName ( loanReturnVehLedger . getLocation ( ) ) ;
loanSecondarySalesApplyDetailsVo . setSalesOrderSid ( loanReturnVehLedger . getSaleOrderSid ( ) ) ;
AlrepaidAndArrVo alrepaidAndArrVo = loanRestoreReportApplyService . getAlrepaidAndArr ( busVinSid ) ;
if ( alrepaidAndArrVo ! = null ) {
BeanUtil . copyProperties ( alrepaidAndArrVo , loanSecondarySalesApplyDetailsVo ) ;
}
}
}
}
vinNoLists . removeAll ( Collections . singleton ( null ) ) ;
if ( ! vinNoLists . isEmpty ( ) ) {
return rb . setMsg ( String . join ( "," , vinNoLists ) + "车架号处置方式非未处置,不能二次销售" ) ;
}
loanSecondarySalesVehVoList . removeAll ( Collections . singleton ( null ) ) ;
//去重车架号
loanSecondarySalesVehVoList = loanSecondarySalesVehVoList . stream ( )
. collect ( Collectors . collectingAndThen ( Collectors . toCollection ( ( ) - > new TreeSet < > ( Comparator . comparing ( o - > o . getVinNo ( ) ) ) ) , ArrayList : : new ) ) ;
Set < String > set = new HashSet < > ( bankContractNoList ) ; // 创建HashSet对象,自动去重
List < String > distinctList = new ArrayList < > ( set ) ;
distinctList . removeAll ( Collections . singleton ( null ) ) ;
if ( distinctList . size ( ) ! = 1 ) {
return rb . setMsg ( "请选择相同资方合同编号的车辆" ) ;
}
loanSecondarySalesApplyDetailsVo . setLoanSecondarySalesVehVoList ( loanSecondarySalesVehVoList ) ;
//根据用户查询发起人、发起部门、发起日期为当前日期
String deptName = "" ;
String deptSid = "" ;
@ -594,12 +899,7 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
List < UrlQuery > list = new ArrayList < > ( ) ;
if ( StringUtils . isNotBlank ( files ) ) {
List < String > fileList = Arrays . asList ( files . split ( "," ) ) . stream ( ) . map ( c - > fileUploadComponent . getUrlPrefix ( ) + c ) . collect ( Collectors . toList ( ) ) ;
for ( int i = 0 ; i < fileList . size ( ) ; i + + ) {
UrlQuery urlQuery = new UrlQuery ( ) ;
urlQuery . setUrl ( fileList . get ( i ) ) ;
list . add ( urlQuery ) ;
}
loanSecondarySalesApplyDetailsVo . setFilesList ( list ) ;
loanSecondarySalesApplyDetailsVo . setFilesList ( fileList ) ;
}
loanSecondarySalesApplyDetailsVo . setOrgPath ( loanSecondarySalesApply . getOrgSidPath ( ) ) ;
@ -613,8 +913,53 @@ public class LoanSecondarySalesApplyService extends MybatisBaseService<LoanSecon
loanSecondarySalesApplyDetailsVo . setLoanSecondarySalesVehVoList ( loanSecondarySalesVehVoList ) ;
}
LoanSecondarySalesCostVo loanSecondarySalesCost = loanSecondarySalesCostService . selectByMainSid ( sid ) ;
if ( loanSecondarySalesCost ! = null ) {
String filesss = loanSecondarySalesCost . getFilesss ( ) ;
List < UrlQuery > lists = new ArrayList < > ( ) ;
if ( StringUtils . isNotBlank ( filesss ) ) {
List < String > fileList = Arrays . asList ( filesss . split ( "," ) ) . stream ( ) . map ( c - > fileUploadComponent . getUrlPrefix ( ) + c ) . collect ( Collectors . toList ( ) ) ;
for ( int i = 0 ; i < fileList . size ( ) ; i + + ) {
UrlQuery urlQuery = new UrlQuery ( ) ;
urlQuery . setUrl ( fileList . get ( i ) ) ;
lists . add ( urlQuery ) ;
}
loanSecondarySalesCost . setFiles ( lists ) ;
}
}
loanSecondarySalesApplyDetailsVo . setLoanSecondarySalesCost ( loanSecondarySalesCost ) ;
}
return rb . success ( ) . setData ( loanSecondarySalesApplyDetailsVo ) ;
}
public ResultBean < SecondarySalesAppVo > getAppDetails ( String sid ) {
ResultBean < SecondarySalesAppVo > rb = ResultBean . fireFail ( ) ;
LoanSecondarySalesApply loanSecondarySalesApply = fetchBySid ( sid ) ;
if ( loanSecondarySalesApply = = null ) {
return rb . setMsg ( "该申请不存在" ) ;
}
SecondarySalesAppVo secondarySalesAppVo = baseMapper . getAppDetails ( sid ) ;
if ( StringUtils . isNotBlank ( secondarySalesAppVo . getFiles ( ) ) ) {
List < String > fileList = Arrays . asList ( secondarySalesAppVo . getFiles ( ) . split ( "," ) ) . stream ( ) . map ( c - > fileUploadComponent . getUrlPrefix ( ) + c ) . collect ( Collectors . toList ( ) ) ;
secondarySalesAppVo . setFilesList ( fileList ) ;
}
secondarySalesAppVo . setOrgPath ( loanSecondarySalesApply . getOrgSidPath ( ) ) ;
secondarySalesAppVo . setUserSid ( loanSecondarySalesApply . getCreateBySid ( ) ) ;
secondarySalesAppVo . setProcInstId ( loanSecondarySalesApply . getProcInstId ( ) ) ;
secondarySalesAppVo . setTaskId ( loanSecondarySalesApply . getTaskId ( ) ) ;
List < LoanSecondarySalesVehAppVo > loanSecondarySalesVehVoList = loanSecondarySalesVehService . selectByMainSidApp ( sid ) ;
loanSecondarySalesVehVoList . removeAll ( Collections . singleton ( null ) ) ;
if ( ! loanSecondarySalesVehVoList . isEmpty ( ) ) {
secondarySalesAppVo . setLoanSecondarySalesVehVoList ( loanSecondarySalesVehVoList ) ;
}
LoanSecondarySalesCostAppVo loanSecondarySalesCost = loanSecondarySalesCostService . selectByMainSidApp ( sid ) ;
if ( loanSecondarySalesCost ! = null ) {
String filesss = loanSecondarySalesCost . getFilesss ( ) ;
if ( StringUtils . isNotBlank ( filesss ) ) {
List < String > fileList = Arrays . asList ( filesss . split ( "," ) ) . stream ( ) . map ( c - > fileUploadComponent . getUrlPrefix ( ) + c ) . collect ( Collectors . toList ( ) ) ;
loanSecondarySalesCost . setFiles ( fileList ) ;
}
}
secondarySalesAppVo . setLoanSecondarySalesCost ( loanSecondarySalesCost ) ;
return rb . success ( ) . setData ( secondarySalesAppVo ) ;
}
}