diff --git a/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bussalesorder/BusSalesOrderService.java b/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bussalesorder/BusSalesOrderService.java index 352e78de0a..dc8c1d9f8e 100644 --- a/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bussalesorder/BusSalesOrderService.java +++ b/anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bussalesorder/BusSalesOrderService.java @@ -3543,7 +3543,6 @@ public class BusSalesOrderService extends MybatisBaseService solutionsDetailsVoResultBean = loanSolutionsFeign.selectDetails(bv.getBusinessSid()); + SolutionsDetailsVo solutionsDetailsVo = solutionsDetailsVoResultBean.getData(); + if (solutionsDetailsVo != null) { + if (StringUtils.isNotBlank(solutionsDetailsVo.getTypeKey())) { + //推送车款 + if ("2".equals(solutionsDetailsVo.getTypeKey())) { + //外部金融 + createFin(vo, busSalesOrder, solutionsDetailsVo); + } else { + //自营非担保 + createFinTwo(vo, busSalesOrder, solutionsDetailsVo); + } + } else {//担保贷款 + createFinTwo(vo, busSalesOrder, solutionsDetailsVo); + } + } else { + //推送车款 + createCarFin(vo, busSalesOrder); + } + } else { + //推送车款 + createCarFin(vo, busSalesOrder); + } + //-----------------推送车款款项结束 //推送采购渠道待选择 @@ -3735,6 +3760,114 @@ public class BusSalesOrderService extends MybatisBaseService commonContractResultBean = commonContractFeign.selectByNo(busSalesOrder.getContractNo()); + CommonContract commonContract = commonContractResultBean.getData(); + //单台成交价与单台订金相等 + if (new BigDecimal(singleFinalPrice).compareTo(new BigDecimal(deposit)) != 0) {//推送车款 + String money = new BigDecimal(singleFinalPrice).subtract(new BigDecimal(deposit)).subtract(new BigDecimal(solutionsDetailsVo.getFactoryDiscount())).toString(); + List vinList = appOrderModelInfoVo.getVinListsVos(); + for (int i = 0; i < vinList.size(); i++) { + UnCollectionDto unCollectionDto = new UnCollectionDto(); + //合同sid + unCollectionDto.setContractSid(commonContract.getSid()); + //合同编号 + unCollectionDto.setContractNo(commonContract.getContractNo()); + //客户名称 + unCollectionDto.setCustomerName(vo.getName()); + //客户sid + unCollectionDto.setCustomerSid(vo.getCustomerSid()); + //客户类型 + unCollectionDto.setCustomerClass(vo.getCustomerKey()); + //客户类型 + unCollectionDto.setCustomerClassKey(vo.getCustomerType()); + //客户头像 + unCollectionDto.setCustomerImage(vo.getCustomerImage()); + unCollectionDto.setReceivablesName("车款"); + unCollectionDto.setCustomerPhone(vo.getPhone()); + unCollectionDto.setUseOrgSid(vo.getUseOrgSid()); + unCollectionDto.setVinNo(vinList.get(i).getVinNo()); + unCollectionDto.setCurrentReceivableMoney(money); + unCollectionDto.setUserSid(busSalesOrder.getCreateBySid()); + unCollectionDto.setReveivableMoney(money); + unCollectionDto.setBusVinSid(vinList.get(i).getSid()); + unCollectionDto.setPayType(vo.getPayType()); + unCollectionDto.setPayTypeKey(vo.getPayTypeKey()); + unCollectionDto.setPurchaseSystemName(vo.getPurchaseSystemName()); + unCollectionDto.setPurchaseSystemSid(vo.getPurchaseSystemSid()); + finUncollectedDetailedFeign.saveUnCollection(unCollectionDto); + } + } + } + + public void createFinTwo(AppOrderDetailsVo vo, BusSalesOrder busSalesOrder, SolutionsDetailsVo solutionsDetailsVo) { + //推送款项车款===================================== + AppOrderModelInfoVo appOrderModelInfoVo = vo.getModelInfo(); + AppOrderPriceInfoVo priceInfo = vo.getPriceInfo(); + AppOrderDepositInfoVo depositInfo = vo.getDepositInfo(); + //查询销售订单的单台订金与单台成交价是否相等,若不相等,则推送车款为成交价减去订金的,推送订金的为单台订金的 + String singleFinalPrice = priceInfo.getSingleFinalPrice(); + String deposit = depositInfo.getDeposit(); + //查询台数 + String num = priceInfo.getNumber(); + //单台成交价 + String transactionPrice = priceInfo.getSingleFinalPrice(); + ResultBean commonContractResultBean = commonContractFeign.selectByNo(busSalesOrder.getContractNo()); + CommonContract commonContract = commonContractResultBean.getData(); + //单台成交价与单台订金相等 + if (new BigDecimal(singleFinalPrice).compareTo(new BigDecimal(deposit)) != 0) {//推送车款 + String money = new BigDecimal(solutionsDetailsVo.getRealTotal()).subtract(new BigDecimal(deposit)).toString(); + List vinList = appOrderModelInfoVo.getVinListsVos(); + for (int i = 0; i < vinList.size(); i++) { + UnCollectionDto unCollectionDto = new UnCollectionDto(); + //合同sid + unCollectionDto.setContractSid(commonContract.getSid()); + //合同编号 + unCollectionDto.setContractNo(commonContract.getContractNo()); + //客户名称 + unCollectionDto.setCustomerName(vo.getName()); + //客户sid + unCollectionDto.setCustomerSid(vo.getCustomerSid()); + //客户类型 + unCollectionDto.setCustomerClass(vo.getCustomerKey()); + //客户类型 + unCollectionDto.setCustomerClassKey(vo.getCustomerType()); + //客户头像 + unCollectionDto.setCustomerImage(vo.getCustomerImage()); + unCollectionDto.setReceivablesName("首付款"); + unCollectionDto.setCustomerPhone(vo.getPhone()); + unCollectionDto.setUseOrgSid(vo.getUseOrgSid()); + unCollectionDto.setVinNo(vinList.get(i).getVinNo()); + unCollectionDto.setCurrentReceivableMoney(money); + unCollectionDto.setUserSid(busSalesOrder.getCreateBySid()); + unCollectionDto.setReveivableMoney(money); + unCollectionDto.setBusVinSid(vinList.get(i).getSid()); + unCollectionDto.setPayType(vo.getPayType()); + unCollectionDto.setPayTypeKey(vo.getPayTypeKey()); + unCollectionDto.setPurchaseSystemName(vo.getPurchaseSystemName()); + unCollectionDto.setPurchaseSystemSid(vo.getPurchaseSystemSid()); + finUncollectedDetailedFeign.saveUnCollection(unCollectionDto); + } + } + } + public void createCarFin(AppOrderDetailsVo vo, BusSalesOrder busSalesOrder) { //推送款项车款===================================== AppOrderModelInfoVo appOrderModelInfoVo = vo.getModelInfo(); 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 400140d322..47896cf4f4 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 @@ -1272,15 +1272,17 @@ public class FinCollectionConfirmationService extends MybatisBaseService finSelectedReceivablesDetailedVos1 = finSelectedReceivablesDetailedService.fetchByAuditState1(sid, 1, "车款", "1"); + List finSelectedReceivablesDetailedVos1_1_1 = finSelectedReceivablesDetailedService.fetchByAuditState1(sid, 1, "首付款", "1"); //推送全款订金 List finSelectedReceivablesDetailedVos2 = finSelectedReceivablesDetailedService.fetchByAuditState1(sid, 1, "订金", "1"); - List voListv = finSelectedReceivablesDetailedService.selectDetailsList(sid, 1, "车款"); - //查询是否含有车架号 - List stringsVin = voListv.stream().filter(v -> StringUtils.isNotBlank(v.getVIN())).map(v -> v.getVIN()).collect(Collectors.toList()); - stringsVin.removeAll(Collections.singleton(null)); + int carSize = 0; //全款推送车款 if (finSelectedReceivablesDetailedVos1.size() > 0) { + List voListv = finSelectedReceivablesDetailedService.selectDetailsList(sid, 1, "车款"); + //查询是否含有车架号 + List stringsVin = voListv.stream().filter(v -> StringUtils.isNotBlank(v.getVIN())).map(v -> v.getVIN()).collect(Collectors.toList()); + stringsVin.removeAll(Collections.singleton(null)); if (!stringsVin.isEmpty()) { //查询根据客户名称和手机号有哪些客户 List customerList = finSelectedReceivablesDetailedService.selectCustomerList(sid, 1, "车款"); @@ -1338,7 +1340,6 @@ public class FinCollectionConfirmationService extends MybatisBaseService 0) { + List voListv = finSelectedReceivablesDetailedService.selectDetailsList(sid, 1, "首付款"); + //查询是否含有车架号 + List stringsVin = voListv.stream().filter(v -> StringUtils.isNotBlank(v.getVIN())).map(v -> v.getVIN()).collect(Collectors.toList()); + stringsVin.removeAll(Collections.singleton(null)); + if (!stringsVin.isEmpty()) { + //查询根据客户名称和手机号有哪些客户 + List customerList = finSelectedReceivablesDetailedService.selectCustomerList(sid, 1, "首付款"); + for (int i = 0; i < customerList.size(); i++) { + String customerName = customerList.get(i).getCustomerName(); + String customerMobile = customerList.get(i).getCustomerPhone(); + String customerSid = customerList.get(i).getCustomerSid(); + BdCustomer bdCustomer = createBdCustomer(confirmation.getUseOrgSid(), customerName, customerMobile, customerSid, sid); + //推送金蝶客户,修改目标组织为采购系统对应的金蝶分公司code + if (data != null) { + bdCustomer.setTOrgIds(data.getOrgCode()); + } + ResultBean resultBeanMiddle = bdCustomerService.draftBdCustomer(bdCustomer); + //往来单位 + arReceivebill.setFCONTACTUNIT(bdCustomer.getFNumber()); + fEntityList = new ArrayList<>(); + String uncollSid = ""; + //查询该客户的车架号不为空的情况 + List vinListVo = finSelectedReceivablesDetailedService.selectVinListVo(sid, 1, "首付款", customerName, customerMobile); + vinListVo.removeAll(Collections.singleton(null)); + if (!vinListVo.isEmpty()) { + for (FinSelectedReceivablesDetailedVo vvvv : vinListVo) { + freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); + //结算方式 + freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); + freceivebillentry.setFSETTLETYPEIDType("customerPayType"); + //收款金额 + freceivebillentry.setFRECTOTALAMOUNTFOR(vvvv.getSubscriptionMoney()); + //登记日期 + freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); + freceivebillentry.setF_PAEZ_Base1(vvvv.getVIN().substring(vvvv.getVIN().length() - 8)); + //收款用途 + freceivebillentry.setFPURPOSEIDKey("001"); + freceivebillentry.setFPURPOSEIDType("cw_skyt"); + freceivebillentry.setFACCOUNTID(confirmation.getCollectionBankNum()); + fEntityList.add(freceivebillentry); + uncollSid = vvvv.getReceivablesSid(); + } + } + //查询该客户的车架号为空的情况 + FinSelectedReceivablesDetailedVo vvVo = finSelectedReceivablesDetailedService.fetchByAuditStateV(sid, 1, "首付款", customerName, customerMobile); + if (vvVo != null) { + uncollSid = vvVo.getReceivablesSid(); + freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); + //结算方式 + freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); + freceivebillentry.setFSETTLETYPEIDType("customerPayType"); + //收款金额 + freceivebillentry.setFRECTOTALAMOUNTFOR(vvVo.getSumAll()); + //登记日期 + freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); + //收款用途 + freceivebillentry.setFPURPOSEIDKey("001"); + freceivebillentry.setFPURPOSEIDType("cw_skyt"); + freceivebillentry.setFACCOUNTID(confirmation.getCollectionBankNum()); + fEntityList.add(freceivebillentry); + } + //项目类别key、value + arReceivebill.setF_PAEZ_AssistantType("cw_sklb"); + FinUncollectedReceivablesDetailed finUncollectedReceivablesDetailed = finUncollectedReceivablesDetailedService.fetchBySid(uncollSid); + if ("1".equals(finUncollectedReceivablesDetailed.getPayTypeKey())) { + arReceivebill.setF_PAEZ_AssistantKey("001"); + } else if ("2".equals(finUncollectedReceivablesDetailed.getPayTypeKey())) { + arReceivebill.setF_PAEZ_AssistantKey("002"); + } + arReceivebill.setFRECEIVEBILLENTRY(fEntityList); + if (customerList.size() == 1 && finSelectedReceivablesDetailedVos2.size() == 0 && finSelectedReceivablesDetailedVos1.size() == 0) { + arReceivebill.setFBillNo(confirmation.getBillNo()); + } else { + carSize = i + 1; + arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); + } + ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); + } + + } else { + fEntityList = new ArrayList<>(); + freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); + finSelectedReceivablesDetailedVos1.removeAll(Collections.singleton(null)); + if (!finSelectedReceivablesDetailedVos1.isEmpty()) { + for (int i = 0; i < finSelectedReceivablesDetailedVos1.size(); i++) { + FinSelectedReceivablesDetailedVo finSelectedReceivablesDetailedVo = finSelectedReceivablesDetailedVos1.get(i); + //先推送客户 + BdCustomer bdCustomer = createBdCustomer(confirmation.getUseOrgSid(), finSelectedReceivablesDetailedVo.getCustomerName(), finSelectedReceivablesDetailedVo.getCustomerPhone(), finSelectedReceivablesDetailedVo.getCustomerSid(), sid); + //推送金蝶客户,修改目标组织为采购系统对应的金蝶分公司code + if (data != null) { + bdCustomer.setTOrgIds(data.getOrgCode()); + } + ResultBean resultBeanMiddle = bdCustomerService.draftBdCustomer(bdCustomer); + //往来单位 + arReceivebill.setFCONTACTUNIT(bdCustomer.getFNumber()); + //结算方式 + freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); + freceivebillentry.setFSETTLETYPEIDType("customerPayType"); + //收款金额 + freceivebillentry.setFRECTOTALAMOUNTFOR(finSelectedReceivablesDetailedVo.getSumAll()); + //登记日期 + freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); + //收款用途 + freceivebillentry.setFPURPOSEIDKey("001"); + freceivebillentry.setFPURPOSEIDType("cw_skyt"); + freceivebillentry.setFACCOUNTID(confirmation.getCollectionBankNum()); + fEntityList.add(freceivebillentry); + //项目类别key、value + arReceivebill.setF_PAEZ_AssistantType("cw_sklb"); + FinUncollectedReceivablesDetailed finUncollectedReceivablesDetailed = finUncollectedReceivablesDetailedService.fetchBySid(finSelectedReceivablesDetailedVos1.get(0).getReceivablesSid()); + if ("1".equals(finUncollectedReceivablesDetailed.getPayTypeKey())) { + arReceivebill.setF_PAEZ_AssistantKey("001"); + } else if ("2".equals(finUncollectedReceivablesDetailed.getPayTypeKey())) { + arReceivebill.setF_PAEZ_AssistantKey("002"); + } + arReceivebill.setFRECEIVEBILLENTRY(fEntityList); + if (finSelectedReceivablesDetailedVos1_1_1.size() > 1) { + int size = 0; + size = i + 1; + arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + size); + } else { + arReceivebill.setFBillNo(confirmation.getBillNo()); + } + + ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); + } + } + } + } //全款推送订金 if (finSelectedReceivablesDetailedVos2.size() > 0) { - voListv = finSelectedReceivablesDetailedService.selectDetailsList(sid, 1, "订金"); + List voListv = finSelectedReceivablesDetailedService.selectDetailsList(sid, 1, "订金"); //查询是否含有车架号 - stringsVin = voListv.stream().filter(v -> StringUtils.isNotBlank(v.getVIN())).map(v -> v.getVIN()).collect(Collectors.toList()); + List stringsVin = voListv.stream().filter(v -> StringUtils.isNotBlank(v.getVIN())).map(v -> v.getVIN()).collect(Collectors.toList()); stringsVin.removeAll(Collections.singleton(null)); if (!stringsVin.isEmpty()) { //查询根据客户名称和手机号有哪些客户 @@ -1475,7 +1608,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService finSelectedReceivablesDetailedVos1_1_2 = finSelectedReceivablesDetailedService.fetchByAuditState1_1(sid, 1, "首付款", "2"); + finSelectedReceivablesDetailedVos1_1_2.removeAll(Collections.singleton(null)); + if (finSelectedReceivablesDetailedVos1_1_2.size() > 0) { + for (int i = 0; i < finSelectedReceivablesDetailedVos1_1_2.size(); i++) { + FinSelectedReceivablesDetailedVo vvvv = finSelectedReceivablesDetailedVos1_1.get(i); + String contractNo = vvvv.getContractNo(); + String vinNo = vvvv.getVIN(); + BdCustomer bdCustomer = createBdCustomer1(confirmation.getUseOrgSid(), vvvv.getCustomerName(), contractNo, sid, vinNo); + //推送金蝶客户,修改目标组织为采购系统对应的金蝶分公司code + if (data != null) { + bdCustomer.setTOrgIds(data.getOrgCode()); + } + ResultBean resultBeanMiddle = bdCustomerService.draftBdCustomer(bdCustomer); + //往来单位 + arReceivebill.setFCONTACTUNIT(bdCustomer.getFNumber()); + fEntityList = new ArrayList<>(); + String uncollSid = ""; + freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); + //结算方式 + freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); + freceivebillentry.setFSETTLETYPEIDType("customerPayType"); + //收款金额 + freceivebillentry.setFRECTOTALAMOUNTFOR(vvvv.getSubscriptionMoney()); + //登记日期 + freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); + if (vvvv.getVIN().length() >= 8) { + freceivebillentry.setF_PAEZ_Base1(vvvv.getVIN().substring(vvvv.getVIN().length() - 8)); + } + //收款用途 + freceivebillentry.setFPURPOSEIDKey("001"); + freceivebillentry.setFPURPOSEIDType("cw_skyt"); + freceivebillentry.setFACCOUNTID(confirmation.getCollectionBankNum()); + fEntityList.add(freceivebillentry); + uncollSid = vvvv.getReceivablesSid(); + + //项目类别key、value + arReceivebill.setF_PAEZ_AssistantType("cw_sklb"); + FinUncollectedReceivablesDetailed finUncollectedReceivablesDetailed = finUncollectedReceivablesDetailedService.fetchBySid(uncollSid); + if ("1".equals(finUncollectedReceivablesDetailed.getPayTypeKey())) { + arReceivebill.setF_PAEZ_AssistantKey("001"); + } else if ("2".equals(finUncollectedReceivablesDetailed.getPayTypeKey())) { + arReceivebill.setF_PAEZ_AssistantKey("002"); + } + arReceivebill.setFRECEIVEBILLENTRY(fEntityList); + if (finSelectedReceivablesDetailedVos1_1_2.size() == 1 && finSelectedReceivablesDetailedVos1.size() == 0 && finSelectedReceivablesDetailedVos2.size() == 0 && finSelectedReceivablesDetailedVos1_1_1.size() == 0 && finSelectedReceivablesDetailedVos1_1.size() == 0) { + arReceivebill.setFBillNo(confirmation.getBillNo()); + } else { + //单据编号 + carSize = carSize + 1; + arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); + } + ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); + + } + } + + //==========================================贷款首付款结束 //简易订单-订金收取 - if (finSelectedReceivablesDetailedVos1.isEmpty() && finSelectedReceivablesDetailedVos2.isEmpty() && finSelectedReceivablesDetailedVos1_1.isEmpty() && finSelectedReceivablesDetailedVos2_1.isEmpty()) { + if (finSelectedReceivablesDetailedVos1.isEmpty() && + finSelectedReceivablesDetailedVos2.isEmpty() && + finSelectedReceivablesDetailedVos1_1.isEmpty() && + finSelectedReceivablesDetailedVos2_1.isEmpty() && + finSelectedReceivablesDetailedVos1_1_1.isEmpty() && + finSelectedReceivablesDetailedVos1_1_2.isEmpty()) { //先推送客户 AppBusDepositBuscenterDetailVo busDeposit = busDepositFeign.getDepositInfoDetails(confirmation.getBusSid()).getData(); BdCustomer bdCustomer = createBdCustomer(confirmation.getUseOrgSid(), busDeposit.getPayName(), busDeposit.getPhone(), "", sid); diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loansolutions/app/SolutionsDetailsVo.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loansolutions/app/SolutionsDetailsVo.java index b8ad5a1bde..c637bd8847 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loansolutions/app/SolutionsDetailsVo.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loansolutions/app/SolutionsDetailsVo.java @@ -16,8 +16,9 @@ public class SolutionsDetailsVo implements Vo { private static final long serialVersionUID = 2678358838559733044L; //金融方案主表 - + @ApiModelProperty("类型:1自营非担保,2外部金融") private String type; + @ApiModelProperty("类型:1自营非担保,2外部金融") private String typeKey; private Integer isPack; @ApiModelProperty("产品政策名称")