From eb41eab5ea3927b09c315bb02ec3154c2149add1 Mon Sep 17 00:00:00 2001 From: God <10745413@qq.com> Date: Wed, 28 Jun 2023 17:50:15 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusArrearsCarryVehicleDetailsFeign.java | 2 +- .../api/autoservice/advanceInvoice/AdvanceInvoiceInfoVo.java | 2 ++ .../advanceInvoice/AppBusAdvanceGinvoiceapplyService.java | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/busarrearscarryvehicledetails/BusArrearsCarryVehicleDetailsFeign.java b/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/busarrearscarryvehicledetails/BusArrearsCarryVehicleDetailsFeign.java index 287eb32eab..9f9cfa1887 100644 --- a/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/busarrearscarryvehicledetails/BusArrearsCarryVehicleDetailsFeign.java +++ b/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/busarrearscarryvehicledetails/BusArrearsCarryVehicleDetailsFeign.java @@ -65,5 +65,5 @@ public interface BusArrearsCarryVehicleDetailsFeign { @ApiOperation("根据车辆sid和已办结流程状态查询是否为欠款提车") @GetMapping("/selByVinSidAndYBJ/{vinSid}") - ResultBean selByVinSidAndYBJ(String vinSid); + ResultBean selByVinSidAndYBJ(@PathVariable("vinSid") String vinSid); } \ No newline at end of file diff --git a/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/autoservice/advanceInvoice/AdvanceInvoiceInfoVo.java b/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/autoservice/advanceInvoice/AdvanceInvoiceInfoVo.java index 9058784e4b..4c2bc28fe3 100644 --- a/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/autoservice/advanceInvoice/AdvanceInvoiceInfoVo.java +++ b/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/autoservice/advanceInvoice/AdvanceInvoiceInfoVo.java @@ -94,4 +94,6 @@ public class AdvanceInvoiceInfoVo implements Vo { private String reason; @ApiModelProperty("欠款开票单据编号(欠款领票使用)") private String qkkpBillNo; + @ApiModelProperty("销售订单sid") + private String saleSid; } diff --git a/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/autoservice/advanceInvoice/AppBusAdvanceGinvoiceapplyService.java b/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/autoservice/advanceInvoice/AppBusAdvanceGinvoiceapplyService.java index 690d85af99..dc72395782 100644 --- a/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/autoservice/advanceInvoice/AppBusAdvanceGinvoiceapplyService.java +++ b/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/autoservice/advanceInvoice/AppBusAdvanceGinvoiceapplyService.java @@ -336,6 +336,7 @@ public class AppBusAdvanceGinvoiceapplyService { } FinBillApplicationDetailsVo finBillApplicationDetailsVo = resultBean.getData(); BeanUtil.copyProperties(finBillApplicationDetailsVo, vo, "arrearsCollectionAppendxs"); + vo.setSaleSid(finBillApplicationDetailsVo.getBusSalesOrderSid()); vo.setReasonKey(finBillApplicationDetailsVo.getArrearsOpenYYKey()); vo.setReasonValue(finBillApplicationDetailsVo.getArrearsOpenYYValue()); vo.setCollectionDate(finBillApplicationDetailsVo.getReturnedMoneyDate()); @@ -869,6 +870,7 @@ public class AppBusAdvanceGinvoiceapplyService { } FinBillApplicationDetailsVo finBillApplicationDetailsVo = resultBean.getData(); BeanUtil.copyProperties(finBillApplicationDetailsVo, vo, "arrearsCollectionAppendxs"); + vo.setSaleSid(finBillApplicationDetailsVo.getBusSalesOrderSid()); vo.setReasonKey(finBillApplicationDetailsVo.getArrearsOpenYYKey()); vo.setReasonValue(finBillApplicationDetailsVo.getArrearsOpenYYValue()); vo.setCollectionDate(finBillApplicationDetailsVo.getReturnedMoneyDate()); From 8bf2933fee158bfd48d2adb6d6b1c7a3e8fc6cf8 Mon Sep 17 00:00:00 2001 From: God <10745413@qq.com> Date: Wed, 28 Jun 2023 18:01:58 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusArrearsCarryVehicleDetailsFeign.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/busarrearscarryvehicledetails/BusArrearsCarryVehicleDetailsFeign.java b/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/busarrearscarryvehicledetails/BusArrearsCarryVehicleDetailsFeign.java index 9f9cfa1887..0373ca1fda 100644 --- a/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/busarrearscarryvehicledetails/BusArrearsCarryVehicleDetailsFeign.java +++ b/anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/busarrearscarryvehicledetails/BusArrearsCarryVehicleDetailsFeign.java @@ -25,8 +25,8 @@ import java.util.List; */ @Api(tags = "欠款提车车辆信息表") @FeignClient( - contextId = "bus-BusArrearsCarryVehicleDetails", - name = "bus", + contextId = "anrui-buscenter-BusArrearsCarryVehicleDetails", + name = "anrui-buscenter", path = "v1/busarrearscarryvehicledetails", fallback = BusArrearsCarryVehicleDetailsFeignFallback.class) public interface BusArrearsCarryVehicleDetailsFeign { From 0df265786827ae04e615192b06e51f5f90346369 Mon Sep 17 00:00:00 2001 From: God <10745413@qq.com> Date: Wed, 28 Jun 2023 18:09:10 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/basevehicleoutapply/BaseVehicleOutApplyService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/basevehicleoutapply/BaseVehicleOutApplyService.java b/anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/basevehicleoutapply/BaseVehicleOutApplyService.java index 67135204d5..28bba7def6 100644 --- a/anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/basevehicleoutapply/BaseVehicleOutApplyService.java +++ b/anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/basevehicleoutapply/BaseVehicleOutApplyService.java @@ -214,7 +214,7 @@ public class BaseVehicleOutApplyService extends MybatisBaseService 0) { + if (i != null) { record.setCkType("欠款出库"); //欠款时长(天) String saleDate = record.getSaleDate(); From bc1bc25f7b447d2c5e5f32ea77b7de4172f4d018 Mon Sep 17 00:00:00 2001 From: dimengzhe Date: Thu, 29 Jun 2023 16:20:48 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=AC=BE=E9=A1=B9?= =?UTF-8?q?=E5=92=8C=E6=B5=81=E7=A8=8B=E8=BD=AC=E5=8A=9E=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppFinSelectedReceivablesDetailedDto.java | 2 + .../FinSelectReceivablesDetailedVo.java | 63 + .../FinSelectedReceivablesDetailed.java | 3 + .../FinSelectedReceivablesDetailedDto.java | 2 + .../FinSelectedReceivablesDetailedFeign.java | 6 + ...ectedReceivablesDetailedFeignFallback.java | 7 + ...electedReceivablesPaymentDetailsQuery.java | 34 + ...ppFinUncollectedReceivablesDetailedVo.java | 3 + ...ilsOfReceivablesAndUncollectedItemsVo.java | 3 + .../FinCollectionConfirmationService.java | 2390 ++--------------- .../FinSelectedReceivablesDetailedMapper.java | 5 + .../FinSelectedReceivablesDetailedMapper.xml | 24 + .../FinSelectedReceivablesDetailedRest.java | 16 +- ...FinSelectedReceivablesDetailedService.java | 111 +- ...UncollectedReceivablesDetailedService.java | 2 +- .../sysflowableconfig/SysFlowableConfig.java | 2 + .../SysFlowableConfigVo.java | 2 + .../SysFlowableConfigMapper.java | 2 + .../SysFlowableConfigMapper.xml | 10 +- .../SysFlowableConfigService.java | 1 + 20 files changed, 453 insertions(+), 2235 deletions(-) create mode 100644 anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectReceivablesDetailedVo.java create mode 100644 anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesPaymentDetailsQuery.java diff --git a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/AppFinSelectedReceivablesDetailedDto.java b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/AppFinSelectedReceivablesDetailedDto.java index 38df19ed89..ad2b8858e0 100644 --- a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/AppFinSelectedReceivablesDetailedDto.java +++ b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/AppFinSelectedReceivablesDetailedDto.java @@ -81,4 +81,6 @@ public class AppFinSelectedReceivablesDetailedDto implements Dto { private String customerSid; @ApiModelProperty("使用组织sid") private String useOrgSid; + + private int subscribedOf; } \ No newline at end of file diff --git a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectReceivablesDetailedVo.java b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectReceivablesDetailedVo.java new file mode 100644 index 0000000000..8b78aa1a4b --- /dev/null +++ b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectReceivablesDetailedVo.java @@ -0,0 +1,63 @@ +package com.yxt.anrui.fin.api.finselectedreceivablesdetailed; + +import com.yxt.common.core.vo.Vo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @description: 已认款项列表 + * @author: dimengzhe + * @date: 2023/6/29 + **/ +@Data +public class FinSelectReceivablesDetailedVo implements Vo { + private static final long serialVersionUID = -1672232048017802807L; + + @ApiModelProperty("合同编号") + private String contractId; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("联系电话") + private String mobile; + + @ApiModelProperty("客户名称") + private String name; + + @ApiModelProperty("应收金额") + private String receivable; + + @ApiModelProperty("合同sid") + private String contractSid; + + @ApiModelProperty("认款金额") + private String confirmMoney; + + @ApiModelProperty("车架号") + private String vin; + + @ApiModelProperty("认款时间") + private String confirmDate; + + @ApiModelProperty("认款状态") + private String state; + + @ApiModelProperty("sid") + private String sid; + + private String busVinSid; + + @ApiModelProperty("付款方式value") + private String payType; + @ApiModelProperty("付款方式key:1全款、2贷款") + private String payTypeKey; + @ApiModelProperty("客户sid") + private String customerSid; + @ApiModelProperty("分公司sid") + private String useOrgSid; + + private int subscribedOf; + + +} 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 692be89d9e..7d5519e1d0 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 @@ -90,4 +90,7 @@ public class FinSelectedReceivablesDetailed extends BaseEntity { private String payTypeKey; @ApiModelProperty("全款贷款") private String payType; + + @ApiModelProperty("是否是已认款中的数据选择过来的,0不是(应收未收),1是(已认款)") + private int subscribedOf; } diff --git a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedDto.java b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedDto.java index 2a8aa4bba0..71f282c3ed 100644 --- a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedDto.java +++ b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedDto.java @@ -89,4 +89,6 @@ public class FinSelectedReceivablesDetailedDto implements Dto { private String payTypeKey; @ApiModelProperty("全款贷款") private String payType; + + private int subscribedOf; } \ No newline at end of file diff --git a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedFeign.java b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedFeign.java index 186cb81ae1..a7229c6909 100644 --- a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedFeign.java +++ b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedFeign.java @@ -25,7 +25,9 @@ *********************************************************/ package com.yxt.anrui.fin.api.finselectedreceivablesdetailed; +import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.cloud.openfeign.FeignClient; @@ -77,4 +79,8 @@ public interface FinSelectedReceivablesDetailedFeign { @ApiOperation("根据应收未收sid查询最新一条") @PostMapping("/fetchByReceivablesSidLimt") public ResultBean fetchByReceivablesSidLimt(@RequestParam("ysSid") String ysSid); + + @ApiOperation("选择已认款项") + @PostMapping("/selectPageList") + ResultBean> selectPageList(@RequestBody PagerQuery pagerQuery); } \ No newline at end of file diff --git a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedFeignFallback.java b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedFeignFallback.java index 2a5449948d..7805be5827 100644 --- a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedFeignFallback.java +++ b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedFeignFallback.java @@ -25,7 +25,9 @@ *********************************************************/ package com.yxt.anrui.fin.api.finselectedreceivablesdetailed; +import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; import org.springframework.stereotype.Component; import java.util.List; @@ -76,4 +78,9 @@ public class FinSelectedReceivablesDetailedFeignFallback implements FinSelectedR return null; } + @Override + public ResultBean> selectPageList(PagerQuery pagerQuery) { + return null; + } + } \ No newline at end of file diff --git a/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesPaymentDetailsQuery.java b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesPaymentDetailsQuery.java new file mode 100644 index 0000000000..1f609be2bc --- /dev/null +++ b/anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesPaymentDetailsQuery.java @@ -0,0 +1,34 @@ +package com.yxt.anrui.fin.api.finselectedreceivablesdetailed; + +import com.yxt.common.core.query.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @description: 已认款查询 + * @author: dimengzhe + * @date: 2023/6/29 + **/ +@Data +public class FinSelectedReceivablesPaymentDetailsQuery implements Query { + private static final long serialVersionUID = -8017557386308627908L; + + @ApiModelProperty("合同编号") + private String contractNo; + @ApiModelProperty("客户名称") + private String customerName; + @ApiModelProperty("联系电话") + private String mobile; + @ApiModelProperty("车架号") + private String vinNo; + + @ApiModelProperty("采购系统") + private String purchaseSystemSid; + @ApiModelProperty("用户sid") + private String userSid; + @ApiModelProperty("机构sid") + private String orgPath; + + private String name; + +} 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 959456796a..e530b613c2 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 @@ -50,4 +50,7 @@ public class AppFinUncollectedReceivablesDetailedVo implements Vo { @ApiModelProperty("分公司sid") private String useOrgSid; + @ApiModelProperty("是否是从已认款列表选择的:0不是(应收未收),1已认款") + private int subscribedOf; + } 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 022dbeb3fc..567a53d681 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 @@ -78,4 +78,7 @@ public class DetailsOfReceivablesAndUncollectedItemsVo implements Vo { private String payTypeKey; @ApiModelProperty("全款贷款") private String payType; + + @ApiModelProperty("是否是已认款的选择:0不是(应收未收),1是(已认款)") + private int subscribedOf; } 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 91d7aa230d..88037d4850 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 @@ -372,9 +372,35 @@ public class FinCollectionConfirmationService extends MybatisBaseService finSelectedReceivablesDetailedDtos = dto.getFinSelectedReceivablesDetaileds(); + List dingList = finSelectedReceivablesDetailedDtos.stream() + .filter((FinSelectedReceivablesDetailedDto b) -> "订金".equals(b.getReceivablesName())) + .collect(Collectors.toList()); + dingList.removeAll(Collections.singleton(null)); + if(!dingList.isEmpty()){ + for (int i = 0; i 0){ + return rb.setMsg("订金不允许多收,请检查"); + } + + } + } + return rb.success(); + } + public ResultBean saveAllDto(FinCollectionConfirmationDto dto) { ResultBean rb = ResultBean.fireFail(); String sid = dto.getSid(); + ResultBean resultBean = getMsg(dto); + if(!resultBean.getSuccess()){ + return rb.setMsg(resultBean.getMsg()); + } if (StringUtils.isBlank(sid)) { //首次认款 List finSelectedReceivablesDetailedDtos = dto.getFinSelectedReceivablesDetaileds(); @@ -1054,6 +1080,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService resultBean = busSalesOrderVehicleFeign.details(busVinSid); @@ -1078,6 +1105,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService resultBean = busSalesOrderVehicleFeign.details(busVinSid); @@ -1190,13 +1218,12 @@ 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(); } } } @@ -1231,12 +1261,14 @@ public class FinCollectionConfirmationService extends MybatisBaseService fEntityList = new ArrayList<>(); ARReceivebill.FRECEIVEBILLENTRY freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); //推送全款车款 - List finSelectedReceivablesDetailedVos1 = finSelectedReceivablesDetailedService.fetchByAuditState1(sid, 1, "车款", "1"); + //根据合同编号分组-车款-待审核-全款-收款单明细 + List finSelectedReceivablesDetailedVos1 = finSelectedReceivablesDetailedService.fetchByAuditState1_1_1(sid, 1, "车款", "1"); finSelectedReceivablesDetailedVos1.removeAll(Collections.singleton(null)); - List finSelectedReceivablesDetailedVos1_1_1 = finSelectedReceivablesDetailedService.fetchByAuditState1(sid, 1, "首付款及费用", "1"); + //全款推送车款(应收未收中为首付款的) + List finSelectedReceivablesDetailedVos1_1_1 = finSelectedReceivablesDetailedService.fetchByAuditState1_1_1(sid, 1, "首付款及费用", "1"); finSelectedReceivablesDetailedVos1_1_1.removeAll(Collections.singleton(null)); //推送全款订金 - List finSelectedReceivablesDetailedVos2 = finSelectedReceivablesDetailedService.fetchByAuditState1(sid, 1, "订金", "1"); + List finSelectedReceivablesDetailedVos2 = finSelectedReceivablesDetailedService.fetchByAuditState1_1_1(sid, 1, "订金", "1"); finSelectedReceivablesDetailedVos2.removeAll(Collections.singleton(null)); //贷款推送车款 List finSelectedReceivablesDetailedVos1_1 = finSelectedReceivablesDetailedService.fetchByAuditState1_1(sid, 1, "车款", "2"); @@ -1250,575 +1282,85 @@ 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()); - 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(); - } - } - //查询该客户的车架号为空的情况 - 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_1_1.size() == 0 - && finSelectedReceivablesDetailedVos1_1.size() == 0 - && finSelectedReceivablesDetailedVos2_1.size() == 0 - && finSelectedReceivablesDetailedVos1_1_2.size() == 0) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } else { - carSize = carSize + 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()); - 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 && finSelectedReceivablesDetailedVos1_1_1.size() == 0 - && finSelectedReceivablesDetailedVos1_1.size() == 0 - && finSelectedReceivablesDetailedVos2_1.size() == 0 - && finSelectedReceivablesDetailedVos1_1_2.size() == 0 && finSelectedReceivablesDetailedVos2.size() == 0) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } else { - carSize = carSize + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); - } - ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); - } - } + 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) { - 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()); - 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(); - } - } - //查询该客户的车架号为空的情况 - 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 - && finSelectedReceivablesDetailedVos1_1.size() == 0 - && finSelectedReceivablesDetailedVos2_1.size() == 0 - && finSelectedReceivablesDetailedVos1_1_2.size() == 0) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } else { - carSize = carSize + 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()); - 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() == 0 && - finSelectedReceivablesDetailedVos1_1_1.size() == 1 - && finSelectedReceivablesDetailedVos2.size() == 0 - && finSelectedReceivablesDetailedVos1_1.size() == 0 - && finSelectedReceivablesDetailedVos2_1.size() == 0 - && finSelectedReceivablesDetailedVos1_1_2.size() == 0) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } else { - carSize = carSize + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); - } - ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); - } - } + 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) { - 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()); - 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()); - 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()); - 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 - && finSelectedReceivablesDetailedVos1_1.size() == 0 - && finSelectedReceivablesDetailedVos2_1.size() == 0 - && finSelectedReceivablesDetailedVos1_1_2.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()); - fEntityList.add(freceivebillentry); - arReceivebill.setFRECEIVEBILLENTRY(fEntityList); - //项目类别key、value - arReceivebill.setF_PAEZ_AssistantType("cw_sklb"); - arReceivebill.setF_PAEZ_AssistantKey("006"); - if (finSelectedReceivablesDetailedVos1.size() == 0 - && finSelectedReceivablesDetailedVos1_1_1.size() == 0 - && finSelectedReceivablesDetailedVos1_1.size() == 0 - && finSelectedReceivablesDetailedVos2_1.size() == 0 - && finSelectedReceivablesDetailedVos1_1_2.size() == 0 - && finSelectedReceivablesDetailedVos2.size() == 1) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } else { - carSize = carSize + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); - } - ResultBean resultBean2 = arReceivebillService.draftArReceivebill(arReceivebill); - } - } + 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) { - 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(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.size() == 0 && - finSelectedReceivablesDetailedVos1_1_1.size() == 0 - && finSelectedReceivablesDetailedVos2.size() == 0 - && finSelectedReceivablesDetailedVos1_1.size() == 1 - && finSelectedReceivablesDetailedVos2_1.size() == 0 - && finSelectedReceivablesDetailedVos1_1_2.size() == 0) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } else { - //单据编号 - carSize = carSize + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); - } - ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); + 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 (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()); - fEntityList.add(freceivebillentry); - //项目类别key、value - arReceivebill.setF_PAEZ_AssistantType("cw_sklb"); - arReceivebill.setF_PAEZ_AssistantKey("006"); - arReceivebill.setFRECEIVEBILLENTRY(fEntityList); - 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) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } else { - //单据编号 - carSize = carSize + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); - } - ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); + //担保贷款推送车款(首付款及费用) + 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 (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()); - 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 && - finSelectedReceivablesDetailedVos2_1.size() == 0) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - } else { - //单据编号 - carSize = carSize + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); - } - ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); + //担保贷款推送订金 + 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() && @@ -1893,6 +1435,20 @@ public class FinCollectionConfirmationService extends MybatisBaseService sysOrganizationVoResultBean = sysOrganizationFeign.fetchBySid(confirmation.getUseOrgSid()); - if (sysOrganizationVoResultBean.getData() != null) { - busDeliveredDto.setUseOrgName(sysOrganizationVoResultBean.getData().getName()); + //根据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); } - busDeliveredDto.setBusVinSid(finUncollectedReceivablesDetailed.getBusVinSid()); - ResultBean resultBean1 = busDeliveredFeign.save(busDeliveredDto); } + } } } @@ -1998,1151 +1559,15 @@ 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()) { - //先推送客户 - 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); - //更新认款状态 - 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("款项确认成功"); - } - - public ResultBean cashierConfirmOld(String sid, String userSid) { - ResultBean rb = ResultBean.fireFail(); - FinCollectionConfirmation confirmation = fetchBySid(sid); - if (confirmation == null) { - return rb.setMsg("该申请不存在"); - } - //=========================================== - //推送收款单 - ARReceivebill arReceivebill = new ARReceivebill(); - //业务日期 - arReceivebill.setFDATE(DateUtil.today()); - //收款日期 - arReceivebill.setF_PAEZ_Date(confirmation.getCollectionDate()); - //收款组织 - ResultBean resultBean = sysOrganizationFeign.fetchBySid(confirmation.getUseOrgSid()); - BasePurchaseSystemDetailsVo data = basePurchaseSystemFeign.fetchDetailsByDeptSid(confirmation.getPurchaseSystemSid()).getData(); - if (data != null) { - arReceivebill.setFPAYORGID(data.getOrgCode()); - } else { - if (resultBean.getSuccess()) { - SysOrganizationVo vo = resultBean.getData(); - if (vo != null) { - arReceivebill.setFPAYORGID(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(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()); - 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(); - } - } - //查询该客户的车架号为空的情况 - 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) { - 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()); - 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()); - 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(); - } - } - //查询该客户的车架号为空的情况 - 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 { - 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()); - 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()); - 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()); - 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()); - 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()); - 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(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()); - 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); - - } - - } - - //==========================================贷款-首付款开始 - //贷款推送车款(应收未收中为首付款的) - 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()); - 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 && - finSelectedReceivablesDetailedVos2_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() && - 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); - //推送金蝶客户,修改目标组织为采购系统对应的金蝶分公司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); - //更新认款状态 - 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(); - //单台整体成交价 - 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); - } - 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(); - ResultBean resultBean = sysOrganizationFeign.fetchBySid(useOrgSid); - if (resultBean.getSuccess()) { - SysOrganizationVo vo = resultBean.getData(); - if (vo != null) { - bdCustomer.setTOrgIds(vo.getOrgCode()); - } + //组装客户推送 + private BdCustomer createBdCustomer(String useOrgSid, String name, String mobile, String customerSid, String collSid) { + BdCustomer bdCustomer = new BdCustomer(); + ResultBean resultBean = sysOrganizationFeign.fetchBySid(useOrgSid); + if (resultBean.getSuccess()) { + SysOrganizationVo vo = resultBean.getData(); + if (vo != null) { + bdCustomer.setTOrgIds(vo.getOrgCode()); + } } String fname = name + mobile; bdCustomer.setFName(fname); @@ -3628,30 +2053,6 @@ public class FinCollectionConfirmationService extends MybatisBaseService resultBean = sysOrganizationFeign.fetchBySid(useOrgSid); - if (resultBean.getSuccess()) { - SysOrganizationVo vo = resultBean.getData(); - if (vo != null) { - bdCustomer.setTOrgIds(vo.getOrgCode()); - } - } - String customerNum = ""; - String code = ""; - if (vinNo.length() < 8) {//无车架号 - customerNum = contractNo + vinNo; - code = customerNum; - } else {//有车架号 - customerNum = vinNo; - code = HanZiConverterPinYin.getPinYinFirst(name) + customerNum; - } - String fname = name + customerNum; - bdCustomer.setFName(fname); - bdCustomer.setFNumber(code); - return bdCustomer; - } - public String getPrefix(String collSid, String name, String mobile) { String customerNoPrefix = ""; FinCollectionConfirmation finCollectionConfirmation = fetchBySid(collSid); @@ -3829,472 +2230,6 @@ public class FinCollectionConfirmationService extends MybatisBaseService resultBean = sysOrganizationFeign.fetchBySid(confirmation.getUseOrgSid()); - BasePurchaseSystemDetailsVo data = basePurchaseSystemFeign.fetchDetailsByDeptSid(confirmation.getPurchaseSystemSid()).getData(); - if (data != null) { - arReceivebill.setFPAYORGID(data.getOrgCode()); - } else { - if (resultBean.getSuccess()) { - SysOrganizationVo vo = resultBean.getData(); - if (vo != null) { - arReceivebill.setFPAYORGID(vo.getOrgCode()); - } - } - } - //销售部门 - if (StringUtils.isNotBlank(confirmation.getCreateDeptSid())) { - resultBean = sysOrganizationFeign.fetchBySid(confirmation.getCreateDeptSid()); - 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(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) { - 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()); - 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(); - } - } - //查询该客户的车架号为空的情况 - 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) { - 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.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, "订金"); - //查询是否含有车架号 - 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()); - 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()); - 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()); - 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) { - arReceivebill.setFBillNo(confirmation.getBillNo()); - - } else { - //单据编号 - carSize = carSize + 1; - arReceivebill.setFBillNo(confirmation.getBillNo() + "-" + carSize); - } - ResultBean resultBean1 = arReceivebillService.draftArReceivebill(arReceivebill); - - } - } else { - fEntityList = new ArrayList<>(); - freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY(); - finSelectedReceivablesDetailedVos2.removeAll(Collections.singleton(null)); - if (!finSelectedReceivablesDetailedVos2.isEmpty()) { - for (int i = 0; i < finSelectedReceivablesDetailedVos2.size(); i++) { - 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"); -// BigDecimal bigAll = finSelectedReceivablesDetailedVos2.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add); - //收款金额 - freceivebillentry.setFRECTOTALAMOUNTFOR(finSelectedReceivablesDetailedVo.getSumAll()); - //登记日期 - 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"); - 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 customerNum = ""; - if (vvvv.getVIN().length() < 8) { - customerNum = vvvv.getContractNo() + vvvv.getVIN(); - } else { - customerNum = vvvv.getVIN(); - }*/ - 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.size() == 1 && finSelectedReceivablesDetailedVos1.size() == 0 && finSelectedReceivablesDetailedVos2.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 customerNum = ""; - if (vvvv.getVIN().length() < 8) { - customerNum = vvvv.getContractNo() + vvvv.getVIN(); - } else { - customerNum = vvvv.getVIN(); - }*/ - 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()); - 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) { - 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()) { - //先推送客户 - 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()); - } - return rb.success(); - } - public ResultBean selectCollectionMoney(String contractNo) { ResultBean rb = ResultBean.fireFail(); String moneyAll = baseMapper.selectCollectionMoney(contractNo); @@ -4310,9 +2245,6 @@ public class FinCollectionConfirmationService extends MybatisBaseService finSelectedReceivablesDetailedVos = finSelectedReceivablesDetailedService.fetchByAuditState(sid, 1); finSelectedReceivablesDetailedVos.stream().forEach(v -> { String selectSid = v.getSid(); 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 90c90fd3b4..575771da64 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 @@ -33,6 +33,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants; import com.yxt.anrui.fin.api.fincollectionconfirmation.AppFinSelectedReceivablesPaymentDetailsQuery; import com.yxt.anrui.fin.api.fincollectionconfirmation.AppFinSelectedReceivablesPaymentDetailsVo; import com.yxt.anrui.fin.api.fincollectionconfirmation.app.AppBusArrearsCarryMoneyVo; +import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectReceivablesDetailedVo; import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivablesDetailed; import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivablesDetailedVo; import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.SelectCustomerVo; @@ -148,4 +149,8 @@ public interface FinSelectedReceivablesDetailedMapper extends BaseMapper selectUnSelectList(@Param("purchaseSystemSid") String purchaseSystemSid, @Param("userSid") String userSid, @Param("useOrgSid") String useOrgSid); + + List selectPageList(@Param(Constants.WRAPPER) QueryWrapper qw, @Param("name") String name); } \ No newline at end of file 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 bc7ce5b47f..241eb830fd 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 @@ -280,4 +280,28 @@ AND auditState = 3 ORDER BY createTime DESC LIMIT 1 + + + + \ No newline at end of file diff --git a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedRest.java b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedRest.java index 471a96a21a..374b5ef129 100644 --- a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedRest.java +++ b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedRest.java @@ -25,10 +25,12 @@ *********************************************************/ package com.yxt.anrui.fin.biz.finselectedreceivablesdetailed; -import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivablesDetailed; -import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivablesDetailedDto; -import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivablesDetailedFeign; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.*; +import com.yxt.common.base.utils.PagerUtil; +import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -95,4 +97,12 @@ public class FinSelectedReceivablesDetailedRest implements FinSelectedReceivable return finSelectedReceivablesDetailedService.fetchByReceivablesSidLimt(ysSid); } + @Override + public ResultBean> selectPageList(PagerQuery pagerQuery) { + PagerVo page = new PagerVo<>(); + IPage iPage = finSelectedReceivablesDetailedService.selectPageList(pagerQuery); + PagerVo pagerVo = PagerUtil.pageToVo(iPage, page); + return new ResultBean>().success().setData(pagerVo); + } + } 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 e5f9541fc6..b5ea933d2e 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 @@ -28,20 +28,27 @@ package com.yxt.anrui.fin.biz.finselectedreceivablesdetailed; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle; +import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicleFeign; import com.yxt.anrui.fin.api.fincollectionconfirmation.AppFinSelectedReceivablesPaymentDetailsQuery; import com.yxt.anrui.fin.api.fincollectionconfirmation.AppFinSelectedReceivablesPaymentDetailsVo; import com.yxt.anrui.fin.api.fincollectionconfirmation.app.AppBusArrearsCarryMoneyVo; import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.*; import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.AppFinUncollectedReceivablesDetailedVo; +import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; import com.yxt.common.base.service.MybatisBaseService; import com.yxt.common.base.utils.PagerUtil; import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; /** * Project: anrui-fin(销售相关)
@@ -58,6 +65,12 @@ import java.util.List; */ @Service public class FinSelectedReceivablesDetailedService extends MybatisBaseService { + + @Autowired + private SysStaffOrgFeign sysStaffOrgFeign; + @Autowired + private BusSalesOrderVehicleFeign busSalesOrderVehicleFeign; + public PagerVo listPage(PagerQuery pq) { FinSelectedReceivablesDetailedQuery query = pq.getParams(); QueryWrapper qw = createQueryWrapper(query); @@ -312,4 +325,100 @@ public class FinSelectedReceivablesDetailedService extends MybatisBaseService selectPageList(PagerQuery pagerQuery) { + IPage page = PagerUtil.queryToPage(pagerQuery); + FinSelectedReceivablesPaymentDetailsQuery params = pagerQuery.getParams(); + QueryWrapper qw = new QueryWrapper<>(); + if (StringUtils.isNotBlank(pagerQuery.getParams().getPurchaseSystemSid())) { + qw.eq("purchaseSystemSid", pagerQuery.getParams().getPurchaseSystemSid()); + } else { + qw.eq("purchaseSystemSid", "0"); + } + String useOrgSid = ""; + String orgPath = pagerQuery.getParams().getOrgPath(); + String userSid = pagerQuery.getParams().getUserSid(); + if (StringUtils.isNotBlank(orgPath)) { + useOrgSid = sysStaffOrgFeign.getOrgSidByPath(orgPath).getData(); + } else { + useOrgSid = sysStaffOrgFeign.getPathSidByUserSid(userSid).getData(); + } + if (StringUtils.isNotBlank(useOrgSid)) { + qw.eq("useOrgSid", useOrgSid); + } + if (StringUtils.isNotBlank(userSid)) { + qw.eq("createBySid", userSid); + } + //查询没有认完的车辆sid + List stringList = baseMapper.selectUnSelectList(pagerQuery.getParams().getPurchaseSystemSid(),userSid,useOrgSid); + stringList.removeAll(Collections.singleton(null)); + if(!stringList.isEmpty()){ + qw.notIn("receivablesSid",stringList); + } + List collList = baseMapper.selectPageList(qw,params.getName()); + if (collList.isEmpty()) { + collList = baseMapper.selectPageList(qw, ""); + for (FinSelectReceivablesDetailedVo record : collList) { + record.setSubscribedOf(1); + String busVinSid = record.getBusVinSid(); + ResultBean resultBean = busSalesOrderVehicleFeign.details(busVinSid); + if (resultBean.getData() != null) { + String vinNo = resultBean.getData().getLinkNo(); + String vinSid = resultBean.getData().getLinkSid(); + String temporaryNo = resultBean.getData().getTemporaryNo(); + record.setVin(vinNo); + if (StringUtils.isNotBlank(vinNo)) { + record.setVin(vinNo.substring(vinNo.length() - 8)); + } else { + if ("2".equals(record.getPayTypeKey())) { + record.setVin(temporaryNo.substring(temporaryNo.length() - 2)); + } else { + record.setVin(temporaryNo); + } + } + } + } + if (StringUtils.isNotBlank(pagerQuery.getParams().getName())) { + collList = collList.stream().filter(v -> v.getVin().contains(pagerQuery.getParams().getName())).collect(Collectors.toList()); + } + } else { + for (FinSelectReceivablesDetailedVo record : collList) { + record.setSubscribedOf(1); + String busVinSid = record.getBusVinSid(); + ResultBean resultBean = busSalesOrderVehicleFeign.details(busVinSid); + if (resultBean.getData() != null) { + String vinNo = resultBean.getData().getLinkNo(); + String vinSid = resultBean.getData().getLinkSid(); + String temporaryNo = resultBean.getData().getTemporaryNo(); + record.setVin(vinNo); + if (StringUtils.isNotBlank(vinNo)) { + record.setVin(vinNo.substring(vinNo.length() - 8)); + } else { + if ("2".equals(record.getPayTypeKey())) { + record.setVin(temporaryNo.substring(temporaryNo.length() - 2)); + } else { + record.setVin(temporaryNo); + } + } + } + } + if (StringUtils.isNotBlank(pagerQuery.getParams().getName())) { + 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去重 + collList = collList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() + -> new TreeSet<>(Comparator.comparing(FinSelectReceivablesDetailedVo::getSid))), ArrayList::new)); + //根据合同编号倒序排序 + collList = collList.stream().sorted(Comparator.comparing(FinSelectReceivablesDetailedVo::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; + } } \ No newline at end of file diff --git a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedService.java b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedService.java index 7a06468ead..0b3632d5c2 100644 --- a/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedService.java +++ b/anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedService.java @@ -29,7 +29,6 @@ import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.yxt.anrui.base.api.basevehicletempstate.BaseVehicleTempstateFeign; -import com.yxt.anrui.base.api.busvehicleapply.BusVehicleApplyVo; import com.yxt.anrui.base.api.commoncontract.CommonContractFeign; import com.yxt.anrui.base.api.commoncontract.CommonContractVo; import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderDetailsVo; @@ -200,6 +199,7 @@ public class FinUncollectedReceivablesDetailedService extends MybatisBaseService list.removeAll(Collections.singleton(null)); if (!list.isEmpty()) { for (DetailsOfReceivablesAndUncollectedItemsVo v : list) { + v.setSubscribedOf(0); String busVinSid = v.getBusVinSid(); ResultBean resultBean = busSalesOrderVehicleFeign.details(busVinSid); if (resultBean.getData() != null) { diff --git a/anrui-portal/anrui-portal-api/src/main/java/com/yxt/anrui/portal/api/sysflowableconfig/SysFlowableConfig.java b/anrui-portal/anrui-portal-api/src/main/java/com/yxt/anrui/portal/api/sysflowableconfig/SysFlowableConfig.java index 27331e445b..6e4a2d5836 100644 --- a/anrui-portal/anrui-portal-api/src/main/java/com/yxt/anrui/portal/api/sysflowableconfig/SysFlowableConfig.java +++ b/anrui-portal/anrui-portal-api/src/main/java/com/yxt/anrui/portal/api/sysflowableconfig/SysFlowableConfig.java @@ -23,4 +23,6 @@ public class SysFlowableConfig extends BaseEntity { private Date startDate; @ApiModelProperty("结束时间") private Date endDate; + + private String changeName; } diff --git a/anrui-portal/anrui-portal-api/src/main/java/com/yxt/anrui/portal/api/sysflowableconfig/SysFlowableConfigVo.java b/anrui-portal/anrui-portal-api/src/main/java/com/yxt/anrui/portal/api/sysflowableconfig/SysFlowableConfigVo.java index 556e5c4f49..6d8186fa4d 100644 --- a/anrui-portal/anrui-portal-api/src/main/java/com/yxt/anrui/portal/api/sysflowableconfig/SysFlowableConfigVo.java +++ b/anrui-portal/anrui-portal-api/src/main/java/com/yxt/anrui/portal/api/sysflowableconfig/SysFlowableConfigVo.java @@ -22,4 +22,6 @@ public class SysFlowableConfigVo implements Vo { @ApiModelProperty("结束时间") private String endDate; + private String changeName; + } diff --git a/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigMapper.java b/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigMapper.java index 69d5ad8ca9..385c6c978b 100644 --- a/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigMapper.java +++ b/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigMapper.java @@ -22,4 +22,6 @@ public interface SysFlowableConfigMapper extends BaseMapper { SysFlowableConfig selectByUserSids(String userSid); int deleteBySid(String userSid); + + String selectBySid(String changeUserSid); } diff --git a/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigMapper.xml b/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigMapper.xml index f6426eeaa9..5b2923e042 100644 --- a/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigMapper.xml +++ b/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigMapper.xml @@ -2,7 +2,9 @@ + select si.name from sys_user su + left join sys_staffinfo si on si.sid = su.staffSid + where su.sid = #{changeUserSid} + \ No newline at end of file diff --git a/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigService.java b/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigService.java index 0399086d7d..800cb8637a 100644 --- a/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigService.java +++ b/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigService.java @@ -41,6 +41,7 @@ public class SysFlowableConfigService extends MybatisBaseService Date: Thu, 29 Jun 2023 16:38:18 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E8=BD=AC=E5=8A=9E?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sysflowableconfig/SysFlowableConfigVo.java | 2 ++ .../sysflowableconfig/SysFlowableConfigMapper.xml | 7 ++++++- .../SysFlowableConfigService.java | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/anrui-portal/anrui-portal-api/src/main/java/com/yxt/anrui/portal/api/sysflowableconfig/SysFlowableConfigVo.java b/anrui-portal/anrui-portal-api/src/main/java/com/yxt/anrui/portal/api/sysflowableconfig/SysFlowableConfigVo.java index 6d8186fa4d..6c9e54189c 100644 --- a/anrui-portal/anrui-portal-api/src/main/java/com/yxt/anrui/portal/api/sysflowableconfig/SysFlowableConfigVo.java +++ b/anrui-portal/anrui-portal-api/src/main/java/com/yxt/anrui/portal/api/sysflowableconfig/SysFlowableConfigVo.java @@ -24,4 +24,6 @@ public class SysFlowableConfigVo implements Vo { private String changeName; + private long startDateLong; + } diff --git a/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigMapper.xml b/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigMapper.xml index 5b2923e042..1b8a8a42ab 100644 --- a/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigMapper.xml +++ b/anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowableconfig/SysFlowableConfigMapper.xml @@ -8,7 +8,12 @@