|
|
@ -2208,13 +2208,13 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
creditResult.setRemarks("放款差额"); |
|
|
|
creditResultService.pushOtherReceivableBill(creditResult); |
|
|
|
BigDecimal all = BigDecimal.ZERO; |
|
|
|
if(loanSolutions.getActualDiscount() != null){ |
|
|
|
if (loanSolutions.getActualDiscount() != null) { |
|
|
|
all = all.add(loanSolutions.getActualDiscount()); |
|
|
|
} |
|
|
|
if(loanSolutionsOtherpolicy != null && loanSolutionsOtherpolicy.getOtherActualDiscount() != null){ |
|
|
|
if (loanSolutionsOtherpolicy != null && loanSolutionsOtherpolicy.getOtherActualDiscount() != null) { |
|
|
|
all = all.add(loanSolutionsOtherpolicy.getOtherActualDiscount()); |
|
|
|
} |
|
|
|
if(all.compareTo(BigDecimal.ZERO) > 0){ |
|
|
|
if (all.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
//推送单车返利管理
|
|
|
|
ScmVehRebateDto scmVehRebateDto = new ScmVehRebateDto(); |
|
|
|
List<ScmVehRebateVehDto> scmVehRebateVehDtos = new ArrayList<>(); |
|
|
@ -2238,10 +2238,10 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
scmVehRebateVehDto.setManufactorSettlementPrice(baseVehicle.getCostPrice().toString()); |
|
|
|
scmVehRebateVehDto.setFreight(baseVehicle.getFreight().toString()); |
|
|
|
BigDecimal ll = BigDecimal.ZERO; |
|
|
|
if(loanSolutions.getActualDiscount() != null){ |
|
|
|
if (loanSolutions.getActualDiscount() != null) { |
|
|
|
ll = ll.add(loanSolutions.getActualDiscount()); |
|
|
|
} |
|
|
|
if(loanSolutionsOtherpolicy != null && loanSolutionsOtherpolicy.getOtherActualDiscount() != null){ |
|
|
|
if (loanSolutionsOtherpolicy != null && loanSolutionsOtherpolicy.getOtherActualDiscount() != null) { |
|
|
|
ll = ll.add(loanSolutionsOtherpolicy.getOtherActualDiscount()); |
|
|
|
} |
|
|
|
scmVehRebateVehDto.setEstimateRebate(ll.toString()); |
|
|
@ -2383,13 +2383,13 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
creditResult.setRemarks("放款差额"); |
|
|
|
creditResultService.pushOtherReceivableBill(creditResult); |
|
|
|
BigDecimal all = BigDecimal.ZERO; |
|
|
|
if(loanSolutions.getActualDiscount() != null){ |
|
|
|
if (loanSolutions.getActualDiscount() != null) { |
|
|
|
all = all.add(loanSolutions.getActualDiscount()); |
|
|
|
} |
|
|
|
if(loanSolutionsOtherpolicy != null && loanSolutionsOtherpolicy.getOtherActualDiscount() != null){ |
|
|
|
if (loanSolutionsOtherpolicy != null && loanSolutionsOtherpolicy.getOtherActualDiscount() != null) { |
|
|
|
all = all.add(loanSolutionsOtherpolicy.getOtherActualDiscount()); |
|
|
|
} |
|
|
|
if(all.compareTo(BigDecimal.ZERO)>0){ |
|
|
|
if (all.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
//推送单车返利管理
|
|
|
|
ScmVehRebateDto scmVehRebateDto = new ScmVehRebateDto(); |
|
|
|
List<ScmVehRebateVehDto> scmVehRebateVehDtos = new ArrayList<>(); |
|
|
@ -2414,10 +2414,10 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
scmVehRebateVehDto.setManufactorSettlementPrice(baseVehicle.getCostPrice().toString()); |
|
|
|
scmVehRebateVehDto.setFreight(baseVehicle.getFreight().toString()); |
|
|
|
BigDecimal ll = BigDecimal.ZERO; |
|
|
|
if(loanSolutions.getActualDiscount() != null){ |
|
|
|
if (loanSolutions.getActualDiscount() != null) { |
|
|
|
ll = ll.add(loanSolutions.getActualDiscount()); |
|
|
|
} |
|
|
|
if(loanSolutionsOtherpolicy != null && loanSolutionsOtherpolicy.getOtherActualDiscount() != null){ |
|
|
|
if (loanSolutionsOtherpolicy != null && loanSolutionsOtherpolicy.getOtherActualDiscount() != null) { |
|
|
|
ll = ll.add(loanSolutionsOtherpolicy.getOtherActualDiscount()); |
|
|
|
} |
|
|
|
scmVehRebateVehDto.setEstimateRebate(ll.toString()); |
|
|
@ -6167,4 +6167,122 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean<List<Map<String, Object>>> getNotPushScmVehRebate() { |
|
|
|
ResultBean<List<Map<String, Object>>> rb = ResultBean.fireFail(); |
|
|
|
List<Map<String, Object>> lllist = new ArrayList<>(); |
|
|
|
List<FinCollectionConfirmation> list = baseMapper.selectNotPush(); |
|
|
|
for (int a = 0; a < list.size(); a++) { |
|
|
|
FinCollectionConfirmation confirmation = list.get(a); |
|
|
|
String sid = confirmation.getSid(); |
|
|
|
List<FinSelectedReceivablesDetailed> finLi = finSelectedReceivablesDetailedService.selectLiBy(sid); |
|
|
|
finLi.removeAll(Collections.singleton(null)); |
|
|
|
if (!finLi.isEmpty()) { |
|
|
|
//根据车辆sid查询金融方案
|
|
|
|
for (int i = 0; i < finLi.size(); i++) { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
FinSelectedReceivablesDetailed finSelectedReceivablesDetailed = finLi.get(i); |
|
|
|
FinUncollectedReceivablesDetailed finUncollectedReceivablesDetailed = finUncollectedReceivablesDetailedService.fetchBySid(finSelectedReceivablesDetailed.getReceivablesSid()); |
|
|
|
BaseVehicle baseVehicle = baseMapper.selectByVSid(finUncollectedReceivablesDetailed.getBusVinSid()); |
|
|
|
BigDecimal bigAdd = BigDecimal.ZERO; |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle = baseMapper.selectByVinSid(finUncollectedReceivablesDetailed.getBusVinSid()); |
|
|
|
LoanSolutions loanSolutions = baseMapper.selectLoanBySid(finUncollectedReceivablesDetailed.getBusVinSid()); |
|
|
|
LoanSolutionsDetail loanSolutionsDetail = null; |
|
|
|
LoanSolutionsOtherpolicy loanSolutionsOtherpolicy = null; |
|
|
|
LoanFinPolicy loanFinPolicy = null; |
|
|
|
LoanFinOtherPolicy loanFinOtherPolicy = null; |
|
|
|
boolean isTue = false; |
|
|
|
if (loanSolutions != null) { |
|
|
|
loanSolutionsDetail = baseMapper.selectByLoanSid(loanSolutions.getSid()); |
|
|
|
loanSolutionsOtherpolicy = baseMapper.selectBySoluSid(loanSolutions.getSid()); |
|
|
|
if (loanSolutionsDetail.getBondAmounts() != null) { |
|
|
|
bigAdd = bigAdd.add(loanSolutionsDetail.getBondAmounts()); |
|
|
|
} |
|
|
|
if (loanSolutions.getActualDiscount() != null) { |
|
|
|
bigAdd = bigAdd.add(loanSolutions.getActualDiscount()); |
|
|
|
} |
|
|
|
|
|
|
|
if (loanSolutionsOtherpolicy != null) { |
|
|
|
if (loanSolutionsOtherpolicy.getOtherActualDiscount() != null) { |
|
|
|
bigAdd = bigAdd.add(loanSolutionsOtherpolicy.getOtherActualDiscount()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (loanSolutionsDetail != null) { |
|
|
|
if (loanSolutionsDetail.getProxyAccidentPremium() != null) { |
|
|
|
bigAdd = bigAdd.add(loanSolutionsDetail.getProxyAccidentPremium()); |
|
|
|
} |
|
|
|
} |
|
|
|
//查询主方案的资方和其他融的资方是否一致
|
|
|
|
loanFinPolicy = baseMapper.selectBySoll(loanSolutions.getPolicySid()); |
|
|
|
|
|
|
|
loanFinOtherPolicy = baseMapper.selectByOtherSid(loanSolutionsOtherpolicy.getOtherPolicySid()); |
|
|
|
if (loanFinOtherPolicy != null) { |
|
|
|
if (!loanFinPolicy.getBankSid().equals(loanFinOtherPolicy.getBankSid())) { |
|
|
|
isTue = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BigDecimal decimalAll = new BigDecimal(finUncollectedReceivablesDetailed.getReveivableMoney()).subtract(finSelectedReceivablesDetailed.getSubscriptionMoney()); |
|
|
|
if (finSelectedReceivablesDetailed.getSubscriptionMoney().compareTo(new BigDecimal(finUncollectedReceivablesDetailed.getReveivableMoney())) != 0) { |
|
|
|
//有差额
|
|
|
|
if (isTue) {//不一致
|
|
|
|
//根据busVinSid查询融资放款的是否已认完款,若已认完,则推送,若未认完则不推送
|
|
|
|
List<FinSelectedReceivablesDetailedVo> voList = finSelectedReceivablesDetailedService.selectListByVin2(finUncollectedReceivablesDetailed.getContractNo(), finUncollectedReceivablesDetailed.getBusVinSid(), 3); |
|
|
|
BigDecimal bigDecimalVinAll = voList.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
List<FinUncollectedReceivablesDetailed> unList = finUncollectedReceivablesDetailedService.selectListByBusVinSid2(finUncollectedReceivablesDetailed.getBusVinSid()); |
|
|
|
BigDecimal unDecimalVinAll = unList.stream().map(FinUncollectedReceivablesDetailed::getReveivableMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
if (bigDecimalVinAll.compareTo(unDecimalVinAll) == 0) {//认完
|
|
|
|
if (bigAdd.compareTo(decimalAll) != 0) {//不相等,推送放款差额确认待办
|
|
|
|
|
|
|
|
} else { |
|
|
|
BigDecimal all = BigDecimal.ZERO; |
|
|
|
if (loanSolutions.getActualDiscount() != null) { |
|
|
|
all = all.add(loanSolutions.getActualDiscount()); |
|
|
|
} |
|
|
|
if (loanSolutionsOtherpolicy != null && loanSolutionsOtherpolicy.getOtherActualDiscount() != null) { |
|
|
|
all = all.add(loanSolutionsOtherpolicy.getOtherActualDiscount()); |
|
|
|
} |
|
|
|
if (all.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
//推送单车返利管理
|
|
|
|
map.put("billNo", confirmation.getBillNo()); |
|
|
|
map.put("vinNo", baseVehicle.getVinNo()); |
|
|
|
map.put("vinSid", baseVehicle.getSid()); |
|
|
|
map.put("contractNo", finSelectedReceivablesDetailed.getContractNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (bigAdd.compareTo(decimalAll) != 0) {//不相等,推送放款差额确认待办
|
|
|
|
|
|
|
|
} else { |
|
|
|
BigDecimal all = BigDecimal.ZERO; |
|
|
|
if (loanSolutions.getActualDiscount() != null) { |
|
|
|
all = all.add(loanSolutions.getActualDiscount()); |
|
|
|
} |
|
|
|
if (loanSolutionsOtherpolicy != null && loanSolutionsOtherpolicy.getOtherActualDiscount() != null) { |
|
|
|
all = all.add(loanSolutionsOtherpolicy.getOtherActualDiscount()); |
|
|
|
} |
|
|
|
if (all.compareTo(BigDecimal.ZERO) > 0) { |
|
|
|
//推送单车返利管理
|
|
|
|
map.put("billNo", confirmation.getBillNo()); |
|
|
|
map.put("vinNo", baseVehicle.getVinNo()); |
|
|
|
map.put("vinSid", baseVehicle.getSid()); |
|
|
|
map.put("contractNo", finSelectedReceivablesDetailed.getContractNo()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
//无差额
|
|
|
|
|
|
|
|
} |
|
|
|
lllist.add(map); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return rb.success().setData(lllist); |
|
|
|
} |
|
|
|
} |
|
|
|