From 7f97bda2cdd89decfad862b0117e6f14020c5362 Mon Sep 17 00:00:00 2001 From: dimengzhe Date: Fri, 14 Jul 2023 15:31:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusDeliveredApplyService.java | 3 + .../FinSelectedReceivablesDetailed.java | 2 + ...ppFinUncollectedReceivablesDetailedVo.java | 4 +- ...ilsOfReceivablesAndUncollectedItemsVo.java | 2 +- .../FinCollectionConfirmationService.java | 557 ++++++++++++++---- .../FinFundsCarriedForwardApplyService.java | 8 +- .../FinSelectedReceivablesDetailedMapper.java | 2 + .../FinSelectedReceivablesDetailedMapper.xml | 28 +- ...FinSelectedReceivablesDetailedService.java | 4 + ...UncollectedReceivablesDetailedService.java | 13 +- ...AppBusArrearsCarryVehicleApplyService.java | 1 - 11 files changed, 501 insertions(+), 123 deletions(-) diff --git a/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/busdeliveredapply/BusDeliveredApplyService.java b/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/busdeliveredapply/BusDeliveredApplyService.java index eb93b8417b..55553c48a5 100644 --- a/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/busdeliveredapply/BusDeliveredApplyService.java +++ b/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/busdeliveredapply/BusDeliveredApplyService.java @@ -802,6 +802,9 @@ public class BusDeliveredApplyService extends MybatisBaseService { pushHandoverPrepare(busDeliveredApply, detailsList, orderDetailsVoResultBean.getData(), userVoResultBean.getData()); }); + //推送合格证管理员站内信提醒有待移交的合格证,同时自动更改出库车辆的合格证移交状态为“待移交”。 + //ToDo:合格证管理员、随车资料管理员、发票管理员创建并查询该角色的用户推送消息有待移交的资料等等。 + } catch (Exception e) { e.printStackTrace(); log.error("推送数据失败=========================" + e.getMessage()); diff --git a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailed.java b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailed.java index ffb96cc136..ae38b152ce 100644 --- a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailed.java +++ b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailed.java @@ -98,4 +98,6 @@ public class FinSelectedReceivablesDetailed extends BaseEntity { private String balance; @ApiModelProperty("款项状态") private String kxState; + + private String selectSid; } diff --git a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/AppFinUncollectedReceivablesDetailedVo.java b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/AppFinUncollectedReceivablesDetailedVo.java index 1c7c8117f0..bf23b24c15 100644 --- a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/AppFinUncollectedReceivablesDetailedVo.java +++ b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/AppFinUncollectedReceivablesDetailedVo.java @@ -18,7 +18,7 @@ public class AppFinUncollectedReceivablesDetailedVo implements Vo { @ApiModelProperty("客户名称") private String name; - @ApiModelProperty("应收金额") + @ApiModelProperty("应收金额:动态") private String receivable; @ApiModelProperty("合同sid") @@ -58,4 +58,6 @@ public class AppFinUncollectedReceivablesDetailedVo implements Vo { @ApiModelProperty("采购系统sid") private String purchaseSystemSid; + @ApiModelProperty("应收金额:不变") + private String reveivableMoney; } diff --git a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/DetailsOfReceivablesAndUncollectedItemsVo.java b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/DetailsOfReceivablesAndUncollectedItemsVo.java index 28eb84faf1..eb44c594bb 100644 --- a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/DetailsOfReceivablesAndUncollectedItemsVo.java +++ b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/DetailsOfReceivablesAndUncollectedItemsVo.java @@ -69,7 +69,7 @@ public class DetailsOfReceivablesAndUncollectedItemsVo implements Vo { @ApiModelProperty("当前应收金额") private String currentReceivableMoney; // 当前应收金额 - @ApiModelProperty("剩余应收金额") + @ApiModelProperty("应收金额") private String reveivableMoney; @ApiModelProperty("业务车辆sid") private String busVinSid; diff --git a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/fincollectionconfirmation/FinCollectionConfirmationService.java b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/fincollectionconfirmation/FinCollectionConfirmationService.java index 171b7a3172..538f3b8e79 100644 --- a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/fincollectionconfirmation/FinCollectionConfirmationService.java +++ b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/fincollectionconfirmation/FinCollectionConfirmationService.java @@ -490,6 +490,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService v.getVin().contains(pagerQuery.getParams().getName())).collect(Collectors.toList()); @@ -1117,11 +1126,16 @@ public class FinCollectionConfirmationService extends MybatisBaseService v.getVin().contains(pagerQuery.getParams().getName())).collect(Collectors.toList()); -// List cll = collList.stream().filter(v -> v.getVin().contains(pagerQuery.getParams().getName())).collect(Collectors.toList()); -// collList = Stream.of(collList, cll).flatMap(Collection::stream).collect(Collectors.toList()); } } //将collList根据sid去重 @@ -1129,14 +1143,6 @@ public class FinCollectionConfirmationService extends MybatisBaseService new TreeSet<>(Comparator.comparing(AppFinUncollectedReceivablesDetailedVo::getSid))), ArrayList::new)); //根据合同编号倒序排序 collList = collList.stream().sorted(Comparator.comparing(AppFinUncollectedReceivablesDetailedVo::getContractId).reversed()).collect(Collectors.toList()); - /*//分页 - IPage page1 = new Page<>(); - page1.setRecords(collList); - page1.setTotal(collList.size()); - page1.setPages((collList.size() / pagerQuery.getSize()) + 1); - page1.setCurrent(pagerQuery.getCurrent()); - page1.setSize(pagerQuery.getSize()); - return page1;*/ //分页 IPage page1 = new Page<>(); page1.setTotal(collList.size()); @@ -1224,7 +1230,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService voList = finSelectedReceivablesDetailedService.selectListByVin(v.getContractNo(), finUncollectedReceivablesDetailed.getBusVinSid(), 3); - BigDecimal bigDecimalVinAll = voList.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add); - //查询该合同编号下的销售订单的单车成交价 - ResultBean commonContractResultBean = commonContractFeign.selectByNo(v.getContractNo()); - if (commonContractResultBean.getSuccess()) { - CommonContract commonContract = commonContractResultBean.getData(); - if (commonContract != null) { - ResultBean orderDetails = busSalesOrderFeign.getSaleOrderDetails(commonContract.getBusSid()); - AppOrderDetailsVo vo = orderDetails.getData(); - if (vo != null) { - AppOrderPriceInfoVo priceInfoVo = vo.getPriceInfo(); - AppOrderDepositInfoVo depositInfo = vo.getDepositInfo(); - if (depositInfo != null) { - if ("02".equals(depositInfo.getDepositTypeKey())) {//订金结转 - BigDecimal decimalDeposit = BigDecimal.ZERO; - if (StringUtils.isNotBlank(depositInfo.getDepositTotal())) { - decimalDeposit = new BigDecimal(depositInfo.getDepositTotal()); - } - if (StringUtils.isNotBlank(depositInfo.getMakeUpDeposit())) { - decimalDeposit = decimalDeposit.subtract(new BigDecimal(depositInfo.getMakeUpDeposit())); - } - decimalDeposit = decimalDeposit.divide(new BigDecimal(priceInfoVo.getNumber()), BigDecimal.ROUND_CEILING); - bigDecimalVinAll = bigDecimalVinAll.add(decimalDeposit); + List voList = finSelectedReceivablesDetailedService.selectListByVin(v.getContractNo(), finUncollectedReceivablesDetailed.getBusVinSid(), 3); + BigDecimal bigDecimalVinAll = voList.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add); + //查询该合同编号下的销售订单的单车成交价 + ResultBean commonContractResultBean = commonContractFeign.selectByNo(v.getContractNo()); + if (commonContractResultBean.getSuccess()) { + CommonContract commonContract = commonContractResultBean.getData(); + if (commonContract != null) { + ResultBean orderDetails = busSalesOrderFeign.getSaleOrderDetails(commonContract.getBusSid()); + AppOrderDetailsVo vo = orderDetails.getData(); + if (vo != null) { + AppOrderPriceInfoVo priceInfoVo = vo.getPriceInfo(); + AppOrderDepositInfoVo depositInfo = vo.getDepositInfo(); + if (depositInfo != null) { + if ("02".equals(depositInfo.getDepositTypeKey())) {//订金结转 + BigDecimal decimalDeposit = BigDecimal.ZERO; + if (StringUtils.isNotBlank(depositInfo.getDepositTotal())) { + decimalDeposit = new BigDecimal(depositInfo.getDepositTotal()); + } + if (StringUtils.isNotBlank(depositInfo.getMakeUpDeposit())) { + decimalDeposit = decimalDeposit.subtract(new BigDecimal(depositInfo.getMakeUpDeposit())); } + decimalDeposit = decimalDeposit.divide(new BigDecimal(priceInfoVo.getNumber()), BigDecimal.ROUND_CEILING); + bigDecimalVinAll = bigDecimalVinAll.add(decimalDeposit); } - //单台整体成交价 - BigDecimal singleFinalPrice = new BigDecimal(priceInfoVo.getSingleFinalPrice()); - BigDecimal leftAll = BigDecimal.ZERO; - BigDecimal rightAll = BigDecimal.ZERO; - if ("2".equals(vo.getFinancePlan()) || "2".equals(vo.getPayTypeKey())) { - //根据销售订单sid查询金融方案 - ResultBean solutionsDetailsVoResultBean = loanSolutionsFeign.selectDetailss(commonContract.getBusSid()); - SolutionsDetailsVo solutionsDetailsVo = solutionsDetailsVoResultBean.getData(); - if (solutionsDetailsVo != null) { - if (StringUtils.isNotBlank(solutionsDetailsVo.getTypeKey())) { - if ("02".equals(solutionsDetailsVo.getTypeKey())) { - //外部金融:成交价 = 订金+车款+厂家贴息-服务费 - leftAll = leftAll.add(singleFinalPrice); - if (StringUtils.isNotBlank(solutionsDetailsVo.getFactoryDiscount())) { - leftAll = leftAll.subtract(new BigDecimal(solutionsDetailsVo.getFactoryDiscount())); - } - if (StringUtils.isNotBlank(solutionsDetailsVo.getServiceAmount())) { - leftAll = leftAll.add(new BigDecimal(solutionsDetailsVo.getServiceAmount())); - } - rightAll = rightAll.add(bigDecimalVinAll); - } else { - //自营非担保: 实收订金 = 首付款及费用+订金 - if (StringUtils.isNotBlank(solutionsDetailsVo.getRealTotal())) { - leftAll = leftAll.add(new BigDecimal(solutionsDetailsVo.getRealTotal())); - } - rightAll = rightAll.add(bigDecimalVinAll); + } + //单台整体成交价 + BigDecimal singleFinalPrice = new BigDecimal(priceInfoVo.getSingleFinalPrice()); + BigDecimal leftAll = BigDecimal.ZERO; + BigDecimal rightAll = BigDecimal.ZERO; + if ("2".equals(vo.getFinancePlan()) || "2".equals(vo.getPayTypeKey())) { + //根据销售订单sid查询金融方案 + ResultBean solutionsDetailsVoResultBean = loanSolutionsFeign.selectDetailss(commonContract.getBusSid()); + SolutionsDetailsVo solutionsDetailsVo = solutionsDetailsVoResultBean.getData(); + if (solutionsDetailsVo != null) { + if (StringUtils.isNotBlank(solutionsDetailsVo.getTypeKey())) { + if ("02".equals(solutionsDetailsVo.getTypeKey())) { + //外部金融:成交价 = 订金+车款+厂家贴息-服务费 + leftAll = leftAll.add(singleFinalPrice); + if (StringUtils.isNotBlank(solutionsDetailsVo.getFactoryDiscount())) { + leftAll = leftAll.subtract(new BigDecimal(solutionsDetailsVo.getFactoryDiscount())); } - } else {//担保贷款: 实收订金 = 首付款及费用+订金 + if (StringUtils.isNotBlank(solutionsDetailsVo.getServiceAmount())) { + leftAll = leftAll.add(new BigDecimal(solutionsDetailsVo.getServiceAmount())); + } + rightAll = rightAll.add(bigDecimalVinAll); + } else { + //自营非担保: 实收订金 = 首付款及费用+订金 if (StringUtils.isNotBlank(solutionsDetailsVo.getRealTotal())) { leftAll = leftAll.add(new BigDecimal(solutionsDetailsVo.getRealTotal())); } rightAll = rightAll.add(bigDecimalVinAll); } - } else { - // 成交价 = 车款+订金 - leftAll = leftAll.add(singleFinalPrice); + } else {//担保贷款: 实收订金 = 首付款及费用+订金 + if (StringUtils.isNotBlank(solutionsDetailsVo.getRealTotal())) { + leftAll = leftAll.add(new BigDecimal(solutionsDetailsVo.getRealTotal())); + } rightAll = rightAll.add(bigDecimalVinAll); } } else { - // 成交价 = 车款+订金 + // 成交价 = 车款+订金 leftAll = leftAll.add(singleFinalPrice); rightAll = rightAll.add(bigDecimalVinAll); } - //根据busVinSid查询待出库中是否存在该数据 - ResultBean busDeliveredResultBean = busDeliveredFeign.selectByBusVinSid(finUncollectedReceivablesDetailed.getBusVinSid()); - if (busDeliveredResultBean.getData() == null) { - if (leftAll.compareTo(rightAll) <= 0) {//推送待出库 - BusDeliveredDto busDeliveredDto = new BusDeliveredDto(); - busDeliveredDto.setSubscriptionKey(VehicleStateTempOrLast.PaymentEnum.PAY_MODELS.getCode()); - busDeliveredDto.setSubscription(VehicleStateTempOrLast.PaymentEnum.PAY_MODELS.getRemarks()); - busDeliveredDto.setPaymentMethodKey(vo.getPayTypeKey()); - busDeliveredDto.setPaymentMethod(vo.getPayType()); - busDeliveredDto.setContractNo(v.getContractNo()); - busDeliveredDto.setName(v.getCustomerName()); - busDeliveredDto.setVinNo(v.getVIN()); - busDeliveredDto.setMobile(v.getCustomerPhone()); - busDeliveredDto.setPrice(priceInfoVo.getSingleFinalPrice()); - busDeliveredDto.setCreateBySid(confirmation.getStaffUserSid()); - SubmitVo intermediary1 = vo.getIntermediary1(); - if (intermediary1 != null) { - busDeliveredDto.setDistributorName(intermediary1.getIntermediaryName()); - busDeliveredDto.setDistributorPrice(intermediary1.getAgencyFee()); - } - SubmitVo intermediary2 = vo.getIntermediary2(); - if (intermediary2 != null) { - busDeliveredDto.setDistributorNameTwo(intermediary2.getIntermediaryName()); - busDeliveredDto.setDistributorPriceTwo(intermediary2.getAgencyFee()); - } - busDeliveredDto.setSingleCarDiscountPrice(priceInfoVo.getSingleCarDiscountPrice()); - //根据客户sid查询客户的身份证号 - AppOrderModelInfoVo appOrderModelInfoVo = vo.getModelInfo(); - busDeliveredDto.setModelName(appOrderModelInfoVo.getModelName()); - busDeliveredDto.setUseOrgSid(confirmation.getUseOrgSid()); - ResultBean sysOrganizationVoResultBean = sysOrganizationFeign.fetchBySid(confirmation.getUseOrgSid()); - if (sysOrganizationVoResultBean.getData() != null) { - busDeliveredDto.setUseOrgName(sysOrganizationVoResultBean.getData().getName()); - } - busDeliveredDto.setBusVinSid(finUncollectedReceivablesDetailed.getBusVinSid()); - ResultBean resultBean1 = busDeliveredFeign.save(busDeliveredDto); + } else { + // 成交价 = 车款+订金 + leftAll = leftAll.add(singleFinalPrice); + rightAll = rightAll.add(bigDecimalVinAll); + } + //根据busVinSid查询待出库中是否存在该数据 + ResultBean busDeliveredResultBean = busDeliveredFeign.selectByBusVinSid(finUncollectedReceivablesDetailed.getBusVinSid()); + if (busDeliveredResultBean.getData() == null) { + if (leftAll.compareTo(rightAll) <= 0) {//推送待出库 + BusDeliveredDto busDeliveredDto = new BusDeliveredDto(); + busDeliveredDto.setSubscriptionKey(VehicleStateTempOrLast.PaymentEnum.PAY_MODELS.getCode()); + busDeliveredDto.setSubscription(VehicleStateTempOrLast.PaymentEnum.PAY_MODELS.getRemarks()); + busDeliveredDto.setPaymentMethodKey(vo.getPayTypeKey()); + busDeliveredDto.setPaymentMethod(vo.getPayType()); + busDeliveredDto.setContractNo(v.getContractNo()); + busDeliveredDto.setName(v.getCustomerName()); + busDeliveredDto.setVinNo(v.getVIN()); + busDeliveredDto.setMobile(v.getCustomerPhone()); + busDeliveredDto.setPrice(priceInfoVo.getSingleFinalPrice()); + busDeliveredDto.setCreateBySid(confirmation.getStaffUserSid()); + SubmitVo intermediary1 = vo.getIntermediary1(); + if (intermediary1 != null) { + busDeliveredDto.setDistributorName(intermediary1.getIntermediaryName()); + busDeliveredDto.setDistributorPrice(intermediary1.getAgencyFee()); + } + SubmitVo intermediary2 = vo.getIntermediary2(); + if (intermediary2 != null) { + busDeliveredDto.setDistributorNameTwo(intermediary2.getIntermediaryName()); + busDeliveredDto.setDistributorPriceTwo(intermediary2.getAgencyFee()); + } + busDeliveredDto.setSingleCarDiscountPrice(priceInfoVo.getSingleCarDiscountPrice()); + //根据客户sid查询客户的身份证号 + AppOrderModelInfoVo appOrderModelInfoVo = vo.getModelInfo(); + busDeliveredDto.setModelName(appOrderModelInfoVo.getModelName()); + busDeliveredDto.setUseOrgSid(confirmation.getUseOrgSid()); + ResultBean sysOrganizationVoResultBean = sysOrganizationFeign.fetchBySid(confirmation.getUseOrgSid()); + if (sysOrganizationVoResultBean.getData() != null) { + busDeliveredDto.setUseOrgName(sysOrganizationVoResultBean.getData().getName()); } + busDeliveredDto.setBusVinSid(finUncollectedReceivablesDetailed.getBusVinSid()); + ResultBean resultBean1 = busDeliveredFeign.save(busDeliveredDto); } - } + } } } @@ -1571,6 +1575,351 @@ public class FinCollectionConfirmationService extends MybatisBaseService resultBean = sysOrganizationFeign.fetchBySid(confirmation.getUseOrgSid()); + BasePurchaseSystemDetailsVo data = basePurchaseSystemFeign.fetchDetailsByDeptSid(confirmation.getPurchaseSystemSid()).getData(); + String orgCode = ""; + if (data != null) { + arReceivebill.setFPAYORGID(data.getOrgCode()); + orgCode = data.getOrgCode(); + } else { + if (resultBean.getSuccess()) { + SysOrganizationVo vo = resultBean.getData(); + if (vo != null) { + arReceivebill.setFPAYORGID(vo.getOrgCode()); + orgCode = vo.getOrgCode(); + } + } + } + //销售部门 + if (StringUtils.isNotBlank(confirmation.getStaffDeptSid())) { + resultBean = sysOrganizationFeign.fetchBySid(confirmation.getStaffDeptSid()); + if (resultBean.getSuccess()) { + SysOrganizationVo vo = resultBean.getData(); + if (vo != null) { + arReceivebill.setFSALEDEPTID(vo.getOrgCode()); + } + } + } + arReceivebill.setFREMARK("付款人:" + confirmation.getPayerName()); + //物料列表 + List fEntityList = new ArrayList<>(); + ARReceivebill.FRECEIVEBILLENTRY freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); + //推送全款车款 + //根据合同编号分组-车款-待审核-全款-收款单明细 + List finSelectedReceivablesDetailedVos1 = finSelectedReceivablesDetailedService.fetchByAuditState1_1_1(sid, 1, "车款", "1"); + finSelectedReceivablesDetailedVos1.removeAll(Collections.singleton(null)); + //全款推送车款(应收未收中为首付款的) + List finSelectedReceivablesDetailedVos1_1_1 = finSelectedReceivablesDetailedService.fetchByAuditState1_1_1(sid, 1, "首付款及费用", "1"); + finSelectedReceivablesDetailedVos1_1_1.removeAll(Collections.singleton(null)); + //推送全款订金 + List finSelectedReceivablesDetailedVos2 = finSelectedReceivablesDetailedService.fetchByAuditState1_1_1(sid, 1, "订金", "1"); + finSelectedReceivablesDetailedVos2.removeAll(Collections.singleton(null)); + //贷款推送车款 + List finSelectedReceivablesDetailedVos1_1 = finSelectedReceivablesDetailedService.fetchByAuditState1_1(sid, 1, "车款", "2"); + finSelectedReceivablesDetailedVos1_1.removeAll(Collections.singleton(null)); + //贷款推送订金 + List finSelectedReceivablesDetailedVos2_1 = finSelectedReceivablesDetailedService.fetchByAuditState1_1(sid, 1, "订金", "2"); + finSelectedReceivablesDetailedVos2_1.removeAll(Collections.singleton(null)); + //贷款推送车款(应收未收中为首付款的) + List finSelectedReceivablesDetailedVos1_1_2 = finSelectedReceivablesDetailedService.fetchByAuditState1_1(sid, 1, "首付款及费用", "2"); + finSelectedReceivablesDetailedVos1_1_2.removeAll(Collections.singleton(null)); + int carSize = 0; + //全款推送车款 + if (finSelectedReceivablesDetailedVos1.size() > 0) { + boolean one = false; + if (finSelectedReceivablesDetailedVos1.size() == 1 && + finSelectedReceivablesDetailedVos1_1_1.size() == 0 && + finSelectedReceivablesDetailedVos2.size() == 0 && + finSelectedReceivablesDetailedVos1_1.size() == 0 && + finSelectedReceivablesDetailedVos2_1.size() == 0 && + finSelectedReceivablesDetailedVos1_1_2.size() == 0) { + one = true; + } + carSize = fullPaymentPushCar(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos1, freceivebillentry, one, orgCode); + } + //全款推送车款(首付款及费用) + if (finSelectedReceivablesDetailedVos1_1_1.size() > 0) { + boolean one = false; + if (finSelectedReceivablesDetailedVos1.size() == 0 && + finSelectedReceivablesDetailedVos1_1_1.size() == 1 && + finSelectedReceivablesDetailedVos2.size() == 0 && + finSelectedReceivablesDetailedVos1_1.size() == 0 && + finSelectedReceivablesDetailedVos2_1.size() == 0 && + finSelectedReceivablesDetailedVos1_1_2.size() == 0) { + one = true; + } + carSize = fullPaymentPushCarFirst(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos1_1_1, freceivebillentry, one, orgCode); + } + + //全款推送订金 + if (finSelectedReceivablesDetailedVos2.size() > 0) { + boolean one = false; + if (finSelectedReceivablesDetailedVos1.size() == 0 && + finSelectedReceivablesDetailedVos1_1_1.size() == 0 && + finSelectedReceivablesDetailedVos2.size() == 1 && + finSelectedReceivablesDetailedVos1_1.size() == 0 && + finSelectedReceivablesDetailedVos2_1.size() == 0 && + finSelectedReceivablesDetailedVos1_1_2.size() == 0) { + one = true; + } + carSize = fullPaymentPushDeposit(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos2, freceivebillentry, one, orgCode); + } + + //担保贷款推送车款 + if (finSelectedReceivablesDetailedVos1_1.size() > 0) { + boolean one = false; + if (finSelectedReceivablesDetailedVos1.size() == 0 && + finSelectedReceivablesDetailedVos1_1_1.size() == 0 && + finSelectedReceivablesDetailedVos2.size() == 0 && + finSelectedReceivablesDetailedVos1_1.size() == 1 && + finSelectedReceivablesDetailedVos2_1.size() == 0 && + finSelectedReceivablesDetailedVos1_1_2.size() == 0) { + one = true; + } + carSize = loanPushCar(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos1_1, freceivebillentry, one, orgCode); + } + //担保贷款推送车款(首付款及费用) + if (finSelectedReceivablesDetailedVos1_1_2.size() > 0) { + boolean one = false; + if (finSelectedReceivablesDetailedVos1.size() == 0 && + finSelectedReceivablesDetailedVos1_1_1.size() == 0 && + finSelectedReceivablesDetailedVos2.size() == 0 && + finSelectedReceivablesDetailedVos1_1.size() == 0 && + finSelectedReceivablesDetailedVos2_1.size() == 0 && + finSelectedReceivablesDetailedVos1_1_2.size() == 1) { + one = true; + } + carSize = loanPushCarFirst(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos1_1_2, freceivebillentry, one, orgCode); + } + //担保贷款推送订金 + if (finSelectedReceivablesDetailedVos2_1.size() > 0) { + boolean one = false; + if (finSelectedReceivablesDetailedVos1.size() == 0 && + finSelectedReceivablesDetailedVos1_1_1.size() == 0 && + finSelectedReceivablesDetailedVos2.size() == 0 && + finSelectedReceivablesDetailedVos1_1.size() == 0 && + finSelectedReceivablesDetailedVos2_1.size() == 1 && + finSelectedReceivablesDetailedVos1_1_2.size() == 0) { + one = true; + } + carSize = loanPushDeposit(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos2_1, freceivebillentry, one, orgCode); + } + + //简易订单-订金收取 + if (finSelectedReceivablesDetailedVos1.isEmpty() && + finSelectedReceivablesDetailedVos2.isEmpty() && + finSelectedReceivablesDetailedVos1_1.isEmpty() && + finSelectedReceivablesDetailedVos2_1.isEmpty() && + finSelectedReceivablesDetailedVos1_1_1.isEmpty() && + finSelectedReceivablesDetailedVos1_1_2.isEmpty() && confirmation.getPushMessgae() == 1) { + //先推送客户 + AppBusDepositBuscenterDetailVo busDeposit = busDepositFeign.getDepositInfoDetails(confirmation.getBusSid()).getData(); + BdCustomer bdCustomer = createBdCustomer(confirmation.getUseOrgSid(), busDeposit.getPayName(), busDeposit.getPhone(), "", sid); + //推送金蝶客户,修改目标组织为采购系统对应的金蝶分公司code + if (data != null) { + bdCustomer.setTOrgIds(data.getOrgCode()); + } + ResultBean resultBeanMiddle = bdCustomerService.draftBdCustomer(bdCustomer); + log.info("客户推送:" + resultBeanMiddle.getMsg()); + //往来单位 + arReceivebill.setFCONTACTUNIT(bdCustomer.getFNumber()); + fEntityList = new ArrayList<>(); + freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); + //结算方式 + freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); + freceivebillentry.setFSETTLETYPEIDType("customerPayType"); + BigDecimal bigAll = confirmation.getCollectionMoney(); + //收款金额 + freceivebillentry.setFRECTOTALAMOUNTFOR(bigAll.toString()); + //登记日期 + freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); + //收款用途:订金 + freceivebillentry.setFPURPOSEIDKey("002"); + freceivebillentry.setFPURPOSEIDType("cw_skyt"); + freceivebillentry.setFACCOUNTID(confirmation.getCollectionBankNum()); + fEntityList.add(freceivebillentry); + arReceivebill.setFRECEIVEBILLENTRY(fEntityList); + //项目类别key、value + arReceivebill.setF_PAEZ_AssistantType("cw_sklb"); + arReceivebill.setF_PAEZ_AssistantKey("006"); + arReceivebill.setFBillNo(confirmation.getBillNo()); + ResultBean resultBean2 = arReceivebillService.draftArReceivebill(arReceivebill); + log.info("收款单推送:" + resultBean2.getMsg()); + } + //=========================================== + //查询该申请下的所有待审核的款项明细 + BigDecimal subscriptionMoneyAll = new BigDecimal("0"); + List finSelectedReceivablesDetailedVos = finSelectedReceivablesDetailedService.fetchByAuditState(sid, 1); + if (finSelectedReceivablesDetailedVos.size() > 0) { + finSelectedReceivablesDetailedVos.stream().forEach(v -> { + //已选款项明细sid + String selectSid = v.getSid(); + //应收未收款项明细sid + String receivablesSid = v.getReceivablesSid(); + FinUncollectedReceivablesDetailed finUncollectedReceivablesDetailed = finUncollectedReceivablesDetailedService.fetchBySid(receivablesSid); + if (v.getSubscribedOf() == 0) { + //更新认款状态 + finUncollectedReceivablesDetailed.setSubscriptionState(finUncollectedReceivablesDetailed.getCurrentReceivableMoney().compareTo(BigDecimal.ZERO) == 0 ? 3 : 2); + finUncollectedReceivablesDetailedService.updateById(finUncollectedReceivablesDetailed); + } + FinSelectedReceivablesDetailed finSelectedReceivablesDetailed = finSelectedReceivablesDetailedService.fetchBySid(selectSid); + //更新已选款项明细的审核状态1待审核/2已驳回/3已审核 + finSelectedReceivablesDetailed.setAuditState(3); + //更新审核时间 + finSelectedReceivablesDetailed.setAuditDate(DateUtil.today()); + finSelectedReceivablesDetailedService.updateById(finSelectedReceivablesDetailed); + /*//ToDo:查询是否符合待出库的条件 + //该合同编号下的该车架号的所有认款金额 + List voList = finSelectedReceivablesDetailedService.selectListByVin(v.getContractNo(), finUncollectedReceivablesDetailed.getBusVinSid(), 3); + BigDecimal bigDecimalVinAll = voList.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add); + //查询该合同编号下的销售订单的单车成交价 + ResultBean commonContractResultBean = commonContractFeign.selectByNo(v.getContractNo()); + if (commonContractResultBean.getSuccess()) { + CommonContract commonContract = commonContractResultBean.getData(); + if (commonContract != null) { + ResultBean orderDetails = busSalesOrderFeign.getSaleOrderDetails(commonContract.getBusSid()); + AppOrderDetailsVo vo = orderDetails.getData(); + if (vo != null) { + AppOrderPriceInfoVo priceInfoVo = vo.getPriceInfo(); + AppOrderDepositInfoVo depositInfo = vo.getDepositInfo(); + if (depositInfo != null) { + if ("02".equals(depositInfo.getDepositTypeKey())) {//订金结转 + BigDecimal decimalDeposit = BigDecimal.ZERO; + if (StringUtils.isNotBlank(depositInfo.getDepositTotal())) { + decimalDeposit = new BigDecimal(depositInfo.getDepositTotal()); + } + if (StringUtils.isNotBlank(depositInfo.getMakeUpDeposit())) { + decimalDeposit = decimalDeposit.subtract(new BigDecimal(depositInfo.getMakeUpDeposit())); + } + decimalDeposit = decimalDeposit.divide(new BigDecimal(priceInfoVo.getNumber()), BigDecimal.ROUND_CEILING); + bigDecimalVinAll = bigDecimalVinAll.add(decimalDeposit); + } + } + //单台整体成交价 + BigDecimal singleFinalPrice = new BigDecimal(priceInfoVo.getSingleFinalPrice()); + BigDecimal leftAll = BigDecimal.ZERO; + BigDecimal rightAll = BigDecimal.ZERO; + if ("2".equals(vo.getFinancePlan()) || "2".equals(vo.getPayTypeKey())) { + //根据销售订单sid查询金融方案 + ResultBean solutionsDetailsVoResultBean = loanSolutionsFeign.selectDetailss(commonContract.getBusSid()); + SolutionsDetailsVo solutionsDetailsVo = solutionsDetailsVoResultBean.getData(); + if (solutionsDetailsVo != null) { + if (StringUtils.isNotBlank(solutionsDetailsVo.getTypeKey())) { + if ("02".equals(solutionsDetailsVo.getTypeKey())) { + //外部金融:成交价 = 订金+车款+厂家贴息-服务费 + leftAll = leftAll.add(singleFinalPrice); + if (StringUtils.isNotBlank(solutionsDetailsVo.getFactoryDiscount())) { + leftAll = leftAll.subtract(new BigDecimal(solutionsDetailsVo.getFactoryDiscount())); + } + if (StringUtils.isNotBlank(solutionsDetailsVo.getServiceAmount())) { + leftAll = leftAll.add(new BigDecimal(solutionsDetailsVo.getServiceAmount())); + } + rightAll = rightAll.add(bigDecimalVinAll); + } else { + //自营非担保: 实收订金 = 首付款及费用+订金 + if (StringUtils.isNotBlank(solutionsDetailsVo.getRealTotal())) { + leftAll = leftAll.add(new BigDecimal(solutionsDetailsVo.getRealTotal())); + } + rightAll = rightAll.add(bigDecimalVinAll); + } + } else {//担保贷款: 实收订金 = 首付款及费用+订金 + if (StringUtils.isNotBlank(solutionsDetailsVo.getRealTotal())) { + leftAll = leftAll.add(new BigDecimal(solutionsDetailsVo.getRealTotal())); + } + rightAll = rightAll.add(bigDecimalVinAll); + } + } else { + // 成交价 = 车款+订金 + leftAll = leftAll.add(singleFinalPrice); + rightAll = rightAll.add(bigDecimalVinAll); + } + } else { + // 成交价 = 车款+订金 + leftAll = leftAll.add(singleFinalPrice); + rightAll = rightAll.add(bigDecimalVinAll); + } + //根据busVinSid查询待出库中是否存在该数据 + ResultBean busDeliveredResultBean = busDeliveredFeign.selectByBusVinSid(finUncollectedReceivablesDetailed.getBusVinSid()); + if (busDeliveredResultBean.getData() == null) { + if (leftAll.compareTo(rightAll) <= 0) {//推送待出库 + BusDeliveredDto busDeliveredDto = new BusDeliveredDto(); + busDeliveredDto.setSubscriptionKey(VehicleStateTempOrLast.PaymentEnum.PAY_MODELS.getCode()); + busDeliveredDto.setSubscription(VehicleStateTempOrLast.PaymentEnum.PAY_MODELS.getRemarks()); + busDeliveredDto.setPaymentMethodKey(vo.getPayTypeKey()); + busDeliveredDto.setPaymentMethod(vo.getPayType()); + busDeliveredDto.setContractNo(v.getContractNo()); + busDeliveredDto.setName(v.getCustomerName()); + busDeliveredDto.setVinNo(v.getVIN()); + busDeliveredDto.setMobile(v.getCustomerPhone()); + busDeliveredDto.setPrice(priceInfoVo.getSingleFinalPrice()); + busDeliveredDto.setCreateBySid(confirmation.getStaffUserSid()); + SubmitVo intermediary1 = vo.getIntermediary1(); + if (intermediary1 != null) { + busDeliveredDto.setDistributorName(intermediary1.getIntermediaryName()); + busDeliveredDto.setDistributorPrice(intermediary1.getAgencyFee()); + } + SubmitVo intermediary2 = vo.getIntermediary2(); + if (intermediary2 != null) { + busDeliveredDto.setDistributorNameTwo(intermediary2.getIntermediaryName()); + busDeliveredDto.setDistributorPriceTwo(intermediary2.getAgencyFee()); + } + busDeliveredDto.setSingleCarDiscountPrice(priceInfoVo.getSingleCarDiscountPrice()); + //根据客户sid查询客户的身份证号 + AppOrderModelInfoVo appOrderModelInfoVo = vo.getModelInfo(); + busDeliveredDto.setModelName(appOrderModelInfoVo.getModelName()); + busDeliveredDto.setUseOrgSid(confirmation.getUseOrgSid()); + ResultBean sysOrganizationVoResultBean = sysOrganizationFeign.fetchBySid(confirmation.getUseOrgSid()); + if (sysOrganizationVoResultBean.getData() != null) { + busDeliveredDto.setUseOrgName(sysOrganizationVoResultBean.getData().getName()); + } + busDeliveredDto.setBusVinSid(finUncollectedReceivablesDetailed.getBusVinSid()); + ResultBean resultBean1 = busDeliveredFeign.save(busDeliveredDto); + } + } + + } + } + }*/ + + }); + //查询该申请已认款金额总数 + subscriptionMoneyAll = finSelectedReceivablesDetailedVos.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add); + } + //查询该申请所有的款项明细 + finSelectedReceivablesDetailedVos = finSelectedReceivablesDetailedService.fetchByAuditState(sid, 3); + //与收款金额作比较:更新认款状态 1未认款/2部分认款/3已认款 + confirmation.setPaymentState(confirmation.getCollectionMoney().compareTo(subscriptionMoneyAll) <= 0 ? 3 : subscriptionMoneyAll.compareTo(BigDecimal.ZERO) == 0 ? 1 : 2); + //更新收款申请的余额以及审核状态 + BigDecimal balanceBigDecimal = confirmation.getCollectionMoney().subtract(subscriptionMoneyAll); + confirmation.setBalance(balanceBigDecimal); + confirmation.setAuditState(3); + //查询当前登录人信息并更新审核人和审核时间 + ResultBean userVoResultBean = sysUserFeign.fetchBySid(userSid); + if (userVoResultBean.getData() != null) { + confirmation.setConfirmName(userVoResultBean.getData().getName()); + } + confirmation.setConfirmDate(DateUtil.today()); + confirmation.setConfirmNameSid(userSid); + baseMapper.updateById(confirmation); + //删除临时表的数据 + ResultBean deleteResult = baseVehicleTempstateFeign.delByBusSid(sid); + return rb.success().setMsg("款项确认成功"); + } //组装客户推送 private BdCustomer createBdCustomer(String useOrgSid, String name, String mobile, String customerSid, String collSid) { BdCustomer bdCustomer = new BdCustomer(); @@ -2370,6 +2719,6 @@ public class FinCollectionConfirmationService extends MybatisBaseService * File: FinFundsCarriedForwardApplyService.java
@@ -451,6 +449,9 @@ public class FinFundsCarriedForwardApplyService extends MybatisBaseService ${ew.sqlSegment} @@ -181,7 +182,7 @@ where collSid = #{sid} and auditState = #{state} and receivablesName = #{type} - and payTypeKey = #{payTypeKey} and subscribedOf = 0 + and payTypeKey = #{payTypeKey} group by contractNo @@ -192,7 +193,7 @@ where collSid = #{sid} and auditState = #{state} and receivablesName = #{type} - and payTypeKey = #{payTypeKey} and subscribedOf = 0 + and payTypeKey = #{payTypeKey} @@ -209,7 +210,7 @@ select * from fin_selected_receivables_detailed where collSid = #{sid} - and auditState = #{state} and subscribedOf = 0 + and auditState = #{state} and receivablesName = #{type} @@ -221,7 +222,7 @@ and auditState = #{state} and receivablesName = #{type} and customerName = #{customerName} - and customerPhone = #{customerPhone} and subscribedOf = 0 + and customerPhone = #{customerPhone} and length(VIN) > 0 @@ -232,7 +233,7 @@ where collSid = #{sid} and auditState = #{state} and receivablesName = #{type} - and contractNo = #{contractNo} and subscribedOf = 0 + and contractNo = #{contractNo} and length(VIN) > 0 @@ -243,7 +244,7 @@ where collSid = #{sid} and auditState = #{state} and receivablesName = #{type} - and contractNo = #{contractNo} and subscribedOf = 0 + and contractNo = #{contractNo} and length(VIN) = 0 @@ -255,16 +256,16 @@ and auditState = #{state} and receivablesName = #{type} and customerName = #{customerName} - and customerPhone = #{customerPhone} and subscribedOf = 0 + and customerPhone = #{customerPhone} and length(VIN) = 0 @@ -350,4 +351,9 @@ ${ew.sqlSegment} + + \ No newline at end of file diff --git a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedService.java b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedService.java index f46276677f..fbd13e495c 100644 --- a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedService.java +++ b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedService.java @@ -571,4 +571,8 @@ public class FinSelectedReceivablesDetailedService extends MybatisBaseService qw = new QueryWrapper<>(); AppFinUncollectedReceivablesDetailedQuery query = pq.getParams(); String orgPath = query.getOrgPath(); - if (StringUtils.isNotBlank(query.getMenuSid())){ + if (StringUtils.isNotBlank(query.getMenuSid())) { //授权 PrivilegeQuery privilegeQuery = new PrivilegeQuery(); privilegeQuery.setOrgPath(query.getOrgPath()); @@ -575,7 +582,7 @@ public class FinUncollectedReceivablesDetailedService extends MybatisBaseService PagerVo p = new PagerVo<>(); return p; } - }else { + } else { qw.eq("useOrgSid", query.getUseOrgSid()); } if (StringUtils.isNotBlank(query.getName())) { @@ -918,7 +925,7 @@ public class FinUncollectedReceivablesDetailedService extends MybatisBaseService for (int i = 0; i < receiveSeleteVoList.size(); i++) { ReceiveSeleteVo receiveSeleteVo = receiveSeleteVoList.get(i); BigDecimal subscriptionMoneyAll = BigDecimal.ZERO; - if(StringUtils.isNotBlank(receiveSeleteVo.getSubscriptionMoneyAll())){ + if (StringUtils.isNotBlank(receiveSeleteVo.getSubscriptionMoneyAll())) { subscriptionMoneyAll = new BigDecimal(receiveSeleteVo.getSubscriptionMoneyAll()); } BigDecimal notSubscriptionMoney = new BigDecimal(receiveSeleteVo.getReveivableMoney()).subtract(subscriptionMoneyAll); diff --git a/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/arrearsTakeCar/AppBusArrearsCarryVehicleApplyService.java b/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/arrearsTakeCar/AppBusArrearsCarryVehicleApplyService.java index ffb3a6e0dd..41612f594c 100644 --- a/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/arrearsTakeCar/AppBusArrearsCarryVehicleApplyService.java +++ b/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/arrearsTakeCar/AppBusArrearsCarryVehicleApplyService.java @@ -257,7 +257,6 @@ public class AppBusArrearsCarryVehicleApplyService { return rb.setMsg(resultBean.getMsg()); } BeanUtil.copyProperties(resultBean.getData(), advanceArrearsInfoVo); - advanceArrearsInfoVo.setModelOrgPath(advanceArrearsInfoVo.getOrgPath()); return rb.success().setData(advanceArrearsInfoVo); }