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 6c708e8970..ae8bf170c5 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 @@ -547,7 +547,7 @@ public class BusSalesOrderService extends MybatisBaseService 0) { pkgPrice = "-¥" + oneAll.toString(); } else { @@ -4779,7 +4779,7 @@ public class BusSalesOrderService extends MybatisBaseService vinList = appOrderModelInfoVo.getVinListsVos(); for (int i = 0; i < vinList.size(); i++) { UnCollectionDto unCollectionDto = new UnCollectionDto(); - //合同sid - unCollectionDto.setContractSid(commonContract.getSid()); - //合同编号 - unCollectionDto.setContractNo(commonContract.getContractNo()); + if (commonContract != null) { + //合同sid + unCollectionDto.setContractSid(commonContract.getSid()); + //合同编号 + unCollectionDto.setContractNo(commonContract.getContractNo()); + } //客户名称 unCollectionDto.setCustomerName(vo.getName()); //客户sid @@ -5727,7 +5729,7 @@ public class BusSalesOrderService extends MybatisBaseService discountList = appOrderDetailsVo.getDiscountList(); 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 af1004cd0f..f9c408c44e 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 @@ -1951,7 +1951,6 @@ 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(); } } } @@ -1981,592 +1983,111 @@ public class FinCollectionConfirmationService extends MybatisBaseService fEntityList = new ArrayList<>(); - ARReceivebill.FRECEIVEBILLENTRY freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); - //推送全款车款 - List finSelectedReceivablesDetailedVos1 = finSelectedReceivablesDetailedService.fetchByAuditState1(sid, 1, "车款", "1"); - List finSelectedReceivablesDetailedVos1_1_1 = finSelectedReceivablesDetailedService.fetchByAuditState1(sid, 1, "首付款", "1"); - //推送全款订金 - List finSelectedReceivablesDetailedVos2 = finSelectedReceivablesDetailedService.fetchByAuditState1(sid, 1, "订金", "1"); - - 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, "车款"); - 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()); - freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(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()); - freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(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) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } else { - carSize = i + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); - } - ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); - } - - } else { - finSelectedReceivablesDetailedVos1.removeAll(Collections.singleton(null)); - if (!finSelectedReceivablesDetailedVos1.isEmpty()) { - for (int i = 0; i < finSelectedReceivablesDetailedVos1.size(); i++) { - fEntityList = new ArrayList<>(); - freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); - 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()); - freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(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.size() > 1) { - int size = 0; - size = i + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + size); - } else { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } - - ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); - } - } - } - - } - //全款推送车款(应收未收中为首付款的) - if (finSelectedReceivablesDetailedVos1_1_1.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, "首付款及费用"); - 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()); - freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(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()); - freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(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 { - finSelectedReceivablesDetailedVos1.removeAll(Collections.singleton(null)); - if (!finSelectedReceivablesDetailedVos1.isEmpty()) { - for (int i = 0; i < finSelectedReceivablesDetailedVos1.size(); i++) { - fEntityList = new ArrayList<>(); - freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); - 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()); - freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(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) { - 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<>(); - //查询该客户的车架号不为空的情况 - 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("002"); - freceivebillentry.setFPURPOSEIDType("cw_skyt"); -// freceivebillentry.setFACCOUNTID(confirmation.getCollectionBankNum()); - freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(confirmation.getCollectionBankNum())); - - fEntityList.add(freceivebillentry); - } - } - - //查询该客户的车架号为空的情况 - FinSelectedReceivablesDetailedVo vvVo = finSelectedReceivablesDetailedService.fetchByAuditStateV(sid, 1, "订金", customerName, customerMobile); - if (vvVo != null) { - freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); - //结算方式 - freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); - freceivebillentry.setFSETTLETYPEIDType("customerPayType"); - //收款金额 - freceivebillentry.setFRECTOTALAMOUNTFOR(vvVo.getSumAll()); - //登记日期 - freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); - //收款用途 - freceivebillentry.setFPURPOSEIDKey("002"); - freceivebillentry.setFPURPOSEIDType("cw_skyt"); -// freceivebillentry.setFACCOUNTID(confirmation.getCollectionBankNum()); - freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(confirmation.getCollectionBankNum())); - - fEntityList.add(freceivebillentry); - } - //项目类别key、value - arReceivebill.setF_PAEZ_AssistantType("cw_sklb"); - arReceivebill.setF_PAEZ_AssistantKey("006"); - arReceivebill.setFRECEIVEBILLENTRY(fEntityList); - if (finSelectedReceivablesDetailedVos1.size() == 0 && customerList.size() == 1 && finSelectedReceivablesDetailedVos1_1_1.size() == 0) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - - } else { - //单据编号 - carSize = carSize + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); - } - ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); - - } - } else { - finSelectedReceivablesDetailedVos2.removeAll(Collections.singleton(null)); - if (!finSelectedReceivablesDetailedVos2.isEmpty()) { - for (int i = 0; i < finSelectedReceivablesDetailedVos2.size(); i++) { - fEntityList = new ArrayList<>(); - freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); - FinSelectedReceivablesDetailedVo finSelectedReceivablesDetailedVo = finSelectedReceivablesDetailedVos2.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("002"); - freceivebillentry.setFPURPOSEIDType("cw_skyt"); -// freceivebillentry.setFACCOUNTID(confirmation.getCollectionBankNum()); - freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(confirmation.getCollectionBankNum())); - fEntityList.add(freceivebillentry); - arReceivebill.setFRECEIVEBILLENTRY(fEntityList); - //项目类别key、value - arReceivebill.setF_PAEZ_AssistantType("cw_sklb"); - arReceivebill.setF_PAEZ_AssistantKey("006"); - if (finSelectedReceivablesDetailedVos2.size() > 1) { - int size = 0; - size = i + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + size); - } else { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } - ResultBean resultBean2 = arReceivebillService.draftArReceivebill(arReceivebill); - } - } - } - - } - - //贷款推送车款 - List finSelectedReceivablesDetailedVos1_1 = finSelectedReceivablesDetailedService.fetchByAuditState1_1(sid, 1, "车款", "2"); - finSelectedReceivablesDetailedVos1_1.removeAll(Collections.singleton(null)); - if (finSelectedReceivablesDetailedVos1_1.size() > 0) { - for (int i = 0; i < finSelectedReceivablesDetailedVos1_1.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(StringUtils.deleteWhitespace(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.size() == 1 && finSelectedReceivablesDetailedVos1.size() == 0 && finSelectedReceivablesDetailedVos2.size() == 0 && finSelectedReceivablesDetailedVos1_1_1.size() == 0) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } else { - //单据编号 - carSize = carSize + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); - } - ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); - - } - } - //贷款推送订金 - List finSelectedReceivablesDetailedVos2_1 = finSelectedReceivablesDetailedService.fetchByAuditState1_1(sid, 1, "订金", "2"); - finSelectedReceivablesDetailedVos2_1.removeAll(Collections.singleton(null)); - if (finSelectedReceivablesDetailedVos2_1.size() > 0) { - for (int i = 0; i < finSelectedReceivablesDetailedVos2_1.size(); i++) { - FinSelectedReceivablesDetailedVo vvvv = finSelectedReceivablesDetailedVos2_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<>(); - 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("002"); - freceivebillentry.setFPURPOSEIDType("cw_skyt"); -// freceivebillentry.setFACCOUNTID(confirmation.getCollectionBankNum()); - freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(confirmation.getCollectionBankNum())); - - fEntityList.add(freceivebillentry); - //项目类别key、value - arReceivebill.setF_PAEZ_AssistantType("cw_sklb"); - arReceivebill.setF_PAEZ_AssistantKey("006"); - arReceivebill.setFRECEIVEBILLENTRY(fEntityList); - if (finSelectedReceivablesDetailedVos1.size() == 0 && finSelectedReceivablesDetailedVos2_1.size() == 1 && - finSelectedReceivablesDetailedVos2.size() == 0 && finSelectedReceivablesDetailedVos1_1.size() == 0 - && finSelectedReceivablesDetailedVos1_1_1.size() == 0) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } else { - //单据编号 - carSize = carSize + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); - } - ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); - - } - - } - - //==========================================贷款-首付款开始 + 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)); - if (finSelectedReceivablesDetailedVos1_1_2.size() > 0) { - for (int i = 0; i < finSelectedReceivablesDetailedVos1_1_2.size(); i++) { - FinSelectedReceivablesDetailedVo vvvv = finSelectedReceivablesDetailedVos1_1_2.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()); - freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(confirmation.getCollectionBankNum())); - - - fEntityList.add(freceivebillentry); - uncollSid = vvvv.getReceivablesSid(); + 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; + } + 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; + } + fullPaymentPushCarFirst(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos1_1_1, freceivebillentry, one, orgCode); + } - //项目类别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 && - finSelectedReceivablesDetailedVos2_1.size() == 0) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } else { - //单据编号 - carSize = carSize + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); - } - ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); + //全款推送订金 + 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; + } + 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; } + 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; + } + 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; + } + loanPushDeposit(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos2_1, freceivebillentry, one, orgCode); + } + //简易订单-订金收取 if (finSelectedReceivablesDetailedVos1.isEmpty() && finSelectedReceivablesDetailedVos2.isEmpty() && @@ -2598,7 +2119,6 @@ public class FinCollectionConfirmationService extends MybatisBaseService finSelectedReceivablesDetailedVos1, + ARReceivebill.FRECEIVEBILLENTRY freceivebillentry, + boolean one, + String orgCode) { + String sid = confirmation.getSid(); + //推送全款车款 + //查询该收款单的所有已选明细:车款-待审核-全款 + List voListv = + finSelectedReceivablesDetailedService.selectDetailsList(sid, 1, "车款"); + finSelectedReceivablesDetailedVos1.removeAll(Collections.singleton(null)); + List fEntityList = new ArrayList<>(); + for (int i = 0; i < finSelectedReceivablesDetailedVos1.size(); i++) { + FinSelectedReceivablesDetailedVo v = finSelectedReceivablesDetailedVos1.get(i); + //推送客户 + String customerNo = createCustomerQuery(1, v, orgCode); + //往来单位 + arReceivebill.setFCONTACTUNIT(customerNo); + //查询该收款单已选款项中该合同号的所有车架号不为空的明细 + String contractNo = v.getContractNo(); + String uncollSid = ""; + List vinListVo = finSelectedReceivablesDetailedService.selectVinListVo_1(sid, 1, "车款", contractNo); + vinListVo.removeAll(Collections.singleton(null)); + if (!vinListVo.isEmpty()) { + for (FinSelectedReceivablesDetailedVo vv : vinListVo) { + freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); + //结算方式 + freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); + freceivebillentry.setFSETTLETYPEIDType("customerPayType"); + //收款金额 + freceivebillentry.setFRECTOTALAMOUNTFOR(vv.getSubscriptionMoney()); + //登记日期 + freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); + if (vv.getVIN().length() < 8) { + freceivebillentry.setF_PAEZ_Base1(vv.getVIN()); + } else { + freceivebillentry.setF_PAEZ_Base1(vv.getVIN().substring(vv.getVIN().length() - 8)); + } + //收款用途 + freceivebillentry.setFPURPOSEIDKey("001"); + freceivebillentry.setFPURPOSEIDType("cw_skyt"); + freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(confirmation.getCollectionBankNum())); + fEntityList.add(freceivebillentry); + uncollSid = vv.getReceivablesSid(); + } + } + //查询该合同编号的车架号为空的情况 + FinSelectedReceivablesDetailedVo vvVo = finSelectedReceivablesDetailedService.fetchByAuditStateV_1(sid, 1, "车款", contractNo); + 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(StringUtils.deleteWhitespace(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 (one) { + arReceivebill.setFBillNo(confirmation.getBillNo()); + } else { + carSize = i + 1; + arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); + } + ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); + } + } + + //全款推送车款(首付款) + public void fullPaymentPushCarFirst(FinCollectionConfirmation confirmation, + ARReceivebill arReceivebill, + int carSize, + List finSelectedReceivablesDetailedVos1_1_1, + ARReceivebill.FRECEIVEBILLENTRY freceivebillentry, + boolean one, + String orgCode) { + String sid = confirmation.getSid(); + //查询该收款单的所有已选明细:首付款及费用-待审核-全款 + List voListv = + finSelectedReceivablesDetailedService.selectDetailsList(sid, 1, "首付款及费用"); + finSelectedReceivablesDetailedVos1_1_1.removeAll(Collections.singleton(null)); + List fEntityList = new ArrayList<>(); + for (int i = 0; i < finSelectedReceivablesDetailedVos1_1_1.size(); i++) { + FinSelectedReceivablesDetailedVo v = finSelectedReceivablesDetailedVos1_1_1.get(i); + //推送客户 + String customerNo = createCustomerQuery(1, v, orgCode); + //往来单位 + arReceivebill.setFCONTACTUNIT(customerNo); + //查询该收款单已选款项中该合同号的所有车架号不为空的明细 + String contractNo = v.getContractNo(); + String uncollSid = ""; + List vinListVo = finSelectedReceivablesDetailedService.selectVinListVo_1(sid, 1, "首付款及费用", contractNo); + vinListVo.removeAll(Collections.singleton(null)); + if (!vinListVo.isEmpty()) { + for (FinSelectedReceivablesDetailedVo vv : vinListVo) { + freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); + //结算方式 + freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); + freceivebillentry.setFSETTLETYPEIDType("customerPayType"); + //收款金额 + freceivebillentry.setFRECTOTALAMOUNTFOR(vv.getSubscriptionMoney()); + //登记日期 + freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); + if (vv.getVIN().length() < 8) { + freceivebillentry.setF_PAEZ_Base1(vv.getVIN()); + } else { + freceivebillentry.setF_PAEZ_Base1(vv.getVIN().substring(vv.getVIN().length() - 8)); + } + //收款用途 + freceivebillentry.setFPURPOSEIDKey("001"); + freceivebillentry.setFPURPOSEIDType("cw_skyt"); + freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(confirmation.getCollectionBankNum())); + fEntityList.add(freceivebillentry); + uncollSid = vv.getReceivablesSid(); + } + } + //查询该合同编号的车架号为空的情况 + FinSelectedReceivablesDetailedVo vvVo = finSelectedReceivablesDetailedService.fetchByAuditStateV_1(sid, 1, "首付款及费用", contractNo); + 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(StringUtils.deleteWhitespace(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 (one) { + arReceivebill.setFBillNo(confirmation.getBillNo()); + } else { + carSize = i + 1; + arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); + } + ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); + } + + } + + //全款推送订金 + public void fullPaymentPushDeposit(FinCollectionConfirmation confirmation, + ARReceivebill arReceivebill, + int carSize, + List finSelectedReceivablesDetailedVos2, + ARReceivebill.FRECEIVEBILLENTRY freceivebillentry, + boolean one, + String orgCode) { + String sid = confirmation.getSid(); + //查询该收款单的所有已选明细:首付款及费用-待审核-全款 + List voListv = + finSelectedReceivablesDetailedService.selectDetailsList(sid, 1, "订金"); + finSelectedReceivablesDetailedVos2.removeAll(Collections.singleton(null)); + List fEntityList = new ArrayList<>(); + for (int i = 0; i < finSelectedReceivablesDetailedVos2.size(); i++) { + FinSelectedReceivablesDetailedVo v = finSelectedReceivablesDetailedVos2.get(i); + //推送客户 + String customerNo = createCustomerQuery(1, v, orgCode); + //往来单位 + arReceivebill.setFCONTACTUNIT(customerNo); + //查询该收款单已选款项中该合同号的所有车架号不为空的明细 + String contractNo = v.getContractNo(); + List vinListVo = finSelectedReceivablesDetailedService.selectVinListVo_1(sid, 1, "订金", contractNo); + vinListVo.removeAll(Collections.singleton(null)); + if (!vinListVo.isEmpty()) { + for (FinSelectedReceivablesDetailedVo vv : vinListVo) { + freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); + //结算方式 + freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); + freceivebillentry.setFSETTLETYPEIDType("customerPayType"); + //收款金额 + freceivebillentry.setFRECTOTALAMOUNTFOR(vv.getSubscriptionMoney()); + //登记日期 + freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); + if (vv.getVIN().length() < 8) { + freceivebillentry.setF_PAEZ_Base1(vv.getVIN()); + } else { + freceivebillentry.setF_PAEZ_Base1(vv.getVIN().substring(vv.getVIN().length() - 8)); + } + //收款用途 + freceivebillentry.setFPURPOSEIDKey("002"); + freceivebillentry.setFPURPOSEIDType("cw_skyt"); + freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(confirmation.getCollectionBankNum())); + fEntityList.add(freceivebillentry); + } + } + //查询该合同编号的车架号为空的情况 + FinSelectedReceivablesDetailedVo vvVo = finSelectedReceivablesDetailedService.fetchByAuditStateV_1(sid, 1, "订金", contractNo); + if (vvVo != null) { + freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); + //结算方式 + freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey()); + freceivebillentry.setFSETTLETYPEIDType("customerPayType"); + //收款金额 + freceivebillentry.setFRECTOTALAMOUNTFOR(vvVo.getSumAll()); + //登记日期 + freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate()); + //收款用途 + freceivebillentry.setFPURPOSEIDKey("002"); + freceivebillentry.setFPURPOSEIDType("cw_skyt"); + freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(confirmation.getCollectionBankNum())); + fEntityList.add(freceivebillentry); + } + //项目类别key、value + arReceivebill.setF_PAEZ_AssistantType("cw_sklb"); + arReceivebill.setF_PAEZ_AssistantKey("006"); + arReceivebill.setFRECEIVEBILLENTRY(fEntityList); + if (one) { + arReceivebill.setFBillNo(confirmation.getBillNo()); + } else { + carSize = i + 1; + arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); + } + ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); + } + } + + //担保贷款推送车款 + public void loanPushCar(FinCollectionConfirmation confirmation, + ARReceivebill arReceivebill, + int carSize, + List finSelectedReceivablesDetailedVos1_1, + ARReceivebill.FRECEIVEBILLENTRY freceivebillentry, + boolean one, + String orgCode) { + String sid = confirmation.getSid(); + List fEntityList = new ArrayList<>(); + for (int i = 0; i < finSelectedReceivablesDetailedVos1_1.size(); i++) { + FinSelectedReceivablesDetailedVo vvvv = finSelectedReceivablesDetailedVos1_1.get(i); + //推送客户 + String customerNo = createCustomerQuery(2, vvvv, orgCode); + //往来单位 + arReceivebill.setFCONTACTUNIT(customerNo); + 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(StringUtils.deleteWhitespace(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 (one) { + arReceivebill.setFBillNo(confirmation.getBillNo()); + } else { + //单据编号 + carSize = carSize + 1; + arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); + } + ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); + + } + } + + //担保贷款推送车款(首付款) + public void loanPushCarFirst(FinCollectionConfirmation confirmation, + ARReceivebill arReceivebill, + int carSize, + List finSelectedReceivablesDetailedVos1_1_2, + ARReceivebill.FRECEIVEBILLENTRY freceivebillentry, + boolean one, + String orgCode) { + String sid = confirmation.getSid(); + List fEntityList = new ArrayList<>(); + for (int i = 0; i < finSelectedReceivablesDetailedVos1_1_2.size(); i++) { + FinSelectedReceivablesDetailedVo vvvv = finSelectedReceivablesDetailedVos1_1_2.get(i); + //推送客户 + String customerNo = createCustomerQuery(2, vvvv, orgCode); + //往来单位 + arReceivebill.setFCONTACTUNIT(customerNo); + 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(StringUtils.deleteWhitespace(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 (one) { + arReceivebill.setFBillNo(confirmation.getBillNo()); + } else { + //单据编号 + carSize = carSize + 1; + arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); + } + ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); + + } + } + + //担保贷款推送订金 + public void loanPushDeposit(FinCollectionConfirmation confirmation, + ARReceivebill arReceivebill, + int carSize, + List finSelectedReceivablesDetailedVos2_1, + ARReceivebill.FRECEIVEBILLENTRY freceivebillentry, + boolean one, + String orgCode) { + String sid = confirmation.getSid(); + List fEntityList = new ArrayList<>(); + for (int i = 0; i < finSelectedReceivablesDetailedVos2_1.size(); i++) { + FinSelectedReceivablesDetailedVo vvvv = finSelectedReceivablesDetailedVos2_1.get(i); + //推送客户 + String customerNo = createCustomerQuery(2, vvvv, orgCode); + //往来单位 + arReceivebill.setFCONTACTUNIT(customerNo); + 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("002"); + freceivebillentry.setFPURPOSEIDType("cw_skyt"); + freceivebillentry.setFACCOUNTID(StringUtils.deleteWhitespace(confirmation.getCollectionBankNum())); + fEntityList.add(freceivebillentry); + uncollSid = vvvv.getReceivablesSid(); + //项目类别key、value + arReceivebill.setF_PAEZ_AssistantType("cw_sklb"); + arReceivebill.setF_PAEZ_AssistantKey("006"); + arReceivebill.setFRECEIVEBILLENTRY(fEntityList); + if (one) { + arReceivebill.setFBillNo(confirmation.getBillNo()); + } else { + //单据编号 + carSize = carSize + 1; + arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); + } + ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); + + } + } + private BdCustomer createBdCustomer1(String useOrgSid, String name, String contractNo, String collSid, String vinNo) { BdCustomer bdCustomer = new BdCustomer(); ResultBean resultBean = sysOrganizationFeign.fetchBySid(useOrgSid); diff --git a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedMapper.java b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedMapper.java index ba3afd0d40..37409c14ef 100644 --- a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedMapper.java +++ b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedMapper.java @@ -82,6 +82,7 @@ public interface FinSelectedReceivablesDetailedMapper extends BaseMapper getPaymentDetailsList(IPage page, @Param(Constants.WRAPPER) QueryWrapper qw, @Param("name") String name); + List getPaymentList(@Param(Constants.WRAPPER) QueryWrapper qw, @Param("name") String name); @@ -108,19 +109,34 @@ public interface FinSelectedReceivablesDetailedMapper extends BaseMapper getList(@Param("list") List sidsList); - List fetchByAuditState1(@Param("sid") String sid, @Param("state") int i, @Param("type") String type,@Param("payTypeKey")String payTypeKey); - List fetchByAuditState1_1(@Param("sid") String sid, @Param("state") int i, @Param("type") String type,@Param("payTypeKey")String payTypeKey); + List fetchByAuditState1(@Param("sid") String sid, @Param("state") int i, @Param("type") String type, @Param("payTypeKey") String payTypeKey); + + /** + * 根据合同编号分组查询客户 + * + * @param sid 收款单sid + * @param i 审核状态 + * @param type 应收项目名称 + * @param payTypeKey 销售类型 + * @return + */ + List fetchByAuditState1_1_1(@Param("sid") String sid, @Param("state") int i, @Param("type") String type, @Param("payTypeKey") String payTypeKey); + + List fetchByAuditState1_1(@Param("sid") String sid, @Param("state") int i, @Param("type") String type, @Param("payTypeKey") String payTypeKey); List selectCustomerList(@Param("sid") String sid, @Param("state") int i, @Param("type") String type); List selectDetailsList(@Param("sid") String sid, @Param("state") int i, @Param("type") String type); List selectVinListVo(@Param("sid") String sid, @Param("state") int i, @Param("type") String type, @Param("customerName") String customerName, @Param("customerPhone") String customerPhone); + List selectVinListVo_1(@Param("sid") String sid, @Param("state") int i, @Param("type") String type, @Param("contractNo") String contractNo); FinSelectedReceivablesDetailedVo fetchByAuditStateV(@Param("sid") String sid, @Param("state") int i, @Param("type") String type, @Param("customerName") String customerName, @Param("customerPhone") String customerPhone); + FinSelectedReceivablesDetailedVo fetchByAuditStateV_1(@Param("sid") String sid, @Param("state") int i, @Param("type") String type, @Param("contractNo") String contractNo); @Select("select * from fin_selected_receivables_detailed where contractNo = #{contractNo}") List fetchByContractNo(String contractNo); + @Select("select * from fin_selected_receivables_detailed where receivablesSid = #{receivablesSid} and auditState = 3") List fetchByReceivablesSid(String receivablesSid); diff --git a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedMapper.xml b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedMapper.xml index 8d7ea32564..0b54cc755b 100644 --- a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedMapper.xml +++ b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedMapper.xml @@ -31,11 +31,11 @@ customerName AS `name`, currentReceivableMoney AS receivable, contractSid, - - VIN AS vin, - furd.busVinSid, - furd.payType, - furd.payTypeKey + + VIN AS vin, + furd.busVinSid, + furd.payType, + furd.payTypeKey FROM fin_uncollected_receivables_detailed furd ${ew.sqlSegment} @@ -56,31 +56,31 @@ @@ -147,7 +147,7 @@ resultType="com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivablesDetailedVo"> select fd.* from fin_selected_receivables_detailed fd - left join fin_uncollected_receivables_detailed fud on fud.sid = fd.receivablesSid + left join fin_uncollected_receivables_detailed fud on fud.sid = fd.receivablesSid where fd.contractNo = #{contractNo} and fud.busVinSid = #{busVinSid} and fd.auditState = #{state} @@ -173,6 +173,17 @@ group by concat(customerName, customerPhone) + + + + + + \ 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 665f520afe..a70c366d32 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 @@ -227,12 +227,25 @@ public class FinSelectedReceivablesDetailedService extends MybatisBaseService fetchByAuditState1(String sid, int i, String type,String payTypeKey) { - return baseMapper.fetchByAuditState1(sid, i, type,payTypeKey); + public List fetchByAuditState1(String sid, int i, String type, String payTypeKey) { + return baseMapper.fetchByAuditState1(sid, i, type, payTypeKey); } - public List fetchByAuditState1_1(String sid, int i, String type,String payTypeKey) { - return baseMapper.fetchByAuditState1_1(sid, i, type,payTypeKey); + /** + * 根据合同编号分组查询客户 + * + * @param sid 收款单sid + * @param i 审核状态 + * @param type 应收项目名称 + * @param payTypeKey 销售类型 + * @return + */ + public List fetchByAuditState1_1_1(String sid, int i, String type, String payTypeKey) { + return baseMapper.fetchByAuditState1_1_1(sid, i, type, payTypeKey); + } + + public List fetchByAuditState1_1(String sid, int i, String type, String payTypeKey) { + return baseMapper.fetchByAuditState1_1(sid, i, type, payTypeKey); } public List selectCustomerList(String sid, int i, String type) { @@ -244,11 +257,28 @@ public class FinSelectedReceivablesDetailedService extends MybatisBaseService selectVinListVo(String sid, int i, String type, String customerName, String customerPhone) { - return baseMapper.selectVinListVo(sid, i, type,customerName,customerPhone); + return baseMapper.selectVinListVo(sid, i, type, customerName, customerPhone); + } + + /** + * 查询该收款单明细该合同编号下的车架号不为空的明细 + * + * @param sid 收款单sid + * @param i 销售类型 + * @param type 应收项目名称 + * @param contractNo 合同编号 + * @return + */ + public List selectVinListVo_1(String sid, int i, String type, String contractNo) { + return baseMapper.selectVinListVo_1(sid, i, type, contractNo); + } + + public FinSelectedReceivablesDetailedVo fetchByAuditStateV_1(String sid, int i, String type, String contractNo) { + return baseMapper.fetchByAuditStateV_1(sid, i, type, contractNo); } public FinSelectedReceivablesDetailedVo fetchByAuditStateV(String sid, int i, String type, String customerName, String customerPhone) { - return baseMapper.fetchByAuditStateV(sid, i, type,customerName,customerPhone); + return baseMapper.fetchByAuditStateV(sid, i, type, customerName, customerPhone); } public ResultBean> fetchByContractNo(String contractNo) {