Browse Source

优化

master
dimengzhe 2 years ago
parent
commit
7f97bda2cd
  1. 3
      anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/busdeliveredapply/BusDeliveredApplyService.java
  2. 2
      anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailed.java
  3. 4
      anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/AppFinUncollectedReceivablesDetailedVo.java
  4. 2
      anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/DetailsOfReceivablesAndUncollectedItemsVo.java
  5. 557
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/fincollectionconfirmation/FinCollectionConfirmationService.java
  6. 8
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finfundscarriedforwardapply/FinFundsCarriedForwardApplyService.java
  7. 2
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedMapper.java
  8. 28
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedMapper.xml
  9. 4
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedService.java
  10. 13
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedService.java
  11. 1
      anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/arrearsTakeCar/AppBusArrearsCarryVehicleApplyService.java

3
anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/busdeliveredapply/BusDeliveredApplyService.java

@ -802,6 +802,9 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp
Future future5 = pool.submit(() -> {
pushHandoverPrepare(busDeliveredApply, detailsList, orderDetailsVoResultBean.getData(), userVoResultBean.getData());
});
//推送合格证管理员站内信提醒有待移交的合格证,同时自动更改出库车辆的合格证移交状态为“待移交”。
//ToDo:合格证管理员、随车资料管理员、发票管理员创建并查询该角色的用户推送消息有待移交的资料等等。
} catch (Exception e) {
e.printStackTrace();
log.error("推送数据失败=========================" + e.getMessage());

2
anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finselectedreceivablesdetailed/FinSelectedReceivablesDetailed.java

@ -98,4 +98,6 @@ public class FinSelectedReceivablesDetailed extends BaseEntity {
private String balance;
@ApiModelProperty("款项状态")
private String kxState;
private String selectSid;
}

4
anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/AppFinUncollectedReceivablesDetailedVo.java

@ -18,7 +18,7 @@ public class AppFinUncollectedReceivablesDetailedVo implements Vo {
@ApiModelProperty("客户名称")
private String name;
@ApiModelProperty("应收金额")
@ApiModelProperty("应收金额:动态")
private String receivable;
@ApiModelProperty("合同sid")
@ -58,4 +58,6 @@ public class AppFinUncollectedReceivablesDetailedVo implements Vo {
@ApiModelProperty("采购系统sid")
private String purchaseSystemSid;
@ApiModelProperty("应收金额:不变")
private String reveivableMoney;
}

2
anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/DetailsOfReceivablesAndUncollectedItemsVo.java

@ -69,7 +69,7 @@ public class DetailsOfReceivablesAndUncollectedItemsVo implements Vo {
@ApiModelProperty("当前应收金额")
private String currentReceivableMoney; // 当前应收金额
@ApiModelProperty("剩余应收金额")
@ApiModelProperty("应收金额")
private String reveivableMoney;
@ApiModelProperty("业务车辆sid")
private String busVinSid;

557
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/fincollectionconfirmation/FinCollectionConfirmationService.java

@ -490,6 +490,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
finSelectedReceivablesDetailed.setCreateBySid(dto.getUserSid());
//认款日期默认为当天的日期
finSelectedReceivablesDetailed.setSubscriptionDate(DateUtil.today());
finSelectedReceivablesDetailed.setBalance(v.getSubscriptionMoney());
finSelectedReceivablesDetailedService.insert(finSelectedReceivablesDetailed);
if (v.getSubscribedOf() == 0) {
//应收未收减去相应的认款
@ -534,6 +535,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
finSelectedReceivablesDetailed.setAuditState(1);
finSelectedReceivablesDetailed.setCreateBySid(dto.getUserSid());
finSelectedReceivablesDetailed.setSubscriptionDate(DateUtil.today());
finSelectedReceivablesDetailed.setBalance(v.getSubscriptionMoney());
finSelectedReceivablesDetailedService.insert(finSelectedReceivablesDetailed);
if (v.getSubscribedOf() == 0) {
//应收未收减去相应的认款
@ -1004,6 +1006,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
finSelectedReceivablesDetailed.setUseOrgSid(paymentDetail.getUseOrgSid());
finSelectedReceivablesDetailed.setCustomerSid(paymentDetail.getCustomerSid());
finSelectedReceivablesDetailed.setSubscribedOf(paymentDetail.getSubscribedOf());
finSelectedReceivablesDetailed.setBalance(paymentDetail.getConfirmMoney().toString());
finSelectedReceivablesDetailedService.save(finSelectedReceivablesDetailed);
if (paymentDetail.getSubscribedOf() == 0) {
FinUncollectedReceivablesDetailed finUncollectedReceivablesDetailed = finUncollectedReceivablesDetailedService.fetchBySid(finSelectedReceivablesDetailed.getReceivablesSid());
@ -1090,6 +1093,12 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
}
}
}
//查询当前应收:应收金额-所有认款的余额=剩余应收金额
String receivablesSid = record.getReceivablesSid();
String balanceSum = finSelectedReceivablesDetailedService.selectBalanceByReceivedSid(receivablesSid);
String reveivableMoney = record.getReveivableMoney();
String currentReceivableMoney = new BigDecimal(reveivableMoney).subtract(new BigDecimal(balanceSum)).toString();
record.setReceivable(currentReceivableMoney);
}
if (StringUtils.isNotBlank(pagerQuery.getParams().getName())) {
collList = collList.stream().filter(v -> v.getVin().contains(pagerQuery.getParams().getName())).collect(Collectors.toList());
@ -1117,11 +1126,16 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
}
}
}
//查询当前应收:应收金额-所有认款的余额=剩余应收金额
String receivablesSid = record.getReceivablesSid();
String balanceSum = finSelectedReceivablesDetailedService.selectBalanceByReceivedSid(receivablesSid);
String reveivableMoney = record.getReveivableMoney();
String currentReceivableMoney = new BigDecimal(reveivableMoney).subtract(new BigDecimal(balanceSum)).toString();
record.setReceivable(currentReceivableMoney);
}
if (StringUtils.isNotBlank(pagerQuery.getParams().getName())) {
collList = collList.stream().filter(v -> v.getVin().contains(pagerQuery.getParams().getName())).collect(Collectors.toList());
// List<AppFinUncollectedReceivablesDetailedVo> cll = collList.stream().filter(v -> v.getVin().contains(pagerQuery.getParams().getName())).collect(Collectors.toList());
// collList = Stream.of(collList, cll).flatMap(Collection::stream).collect(Collectors.toList());
}
}
//将collList根据sid去重
@ -1129,14 +1143,6 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
-> new TreeSet<>(Comparator.comparing(AppFinUncollectedReceivablesDetailedVo::getSid))), ArrayList::new));
//根据合同编号倒序排序
collList = collList.stream().sorted(Comparator.comparing(AppFinUncollectedReceivablesDetailedVo::getContractId).reversed()).collect(Collectors.toList());
/*//分页
IPage<AppFinUncollectedReceivablesDetailedVo> page1 = new Page<>();
page1.setRecords(collList);
page1.setTotal(collList.size());
page1.setPages((collList.size() / pagerQuery.getSize()) + 1);
page1.setCurrent(pagerQuery.getCurrent());
page1.setSize(pagerQuery.getSize());
return page1;*/
//分页
IPage<AppFinUncollectedReceivablesDetailedVo> page1 = new Page<>();
page1.setTotal(collList.size());
@ -1224,7 +1230,7 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
* @param userSid
* @return
*/
public ResultBean cashierConfirm(String sid, String userSid) {
public ResultBean cashierConfirmOld(String sid, String userSid) {
ResultBean rb = ResultBean.fireFail();
FinCollectionConfirmation confirmation = fetchBySid(sid);
if (confirmation == null) {
@ -1433,115 +1439,113 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
finSelectedReceivablesDetailedService.updateById(finSelectedReceivablesDetailed);
//ToDo:查询是否符合待出库的条件
//该合同编号下的该车架号的所有认款金额
if (v.getSubscribedOf() == 0) {
List<FinSelectedReceivablesDetailedVo> voList = finSelectedReceivablesDetailedService.selectListByVin(v.getContractNo(), finUncollectedReceivablesDetailed.getBusVinSid(), 3);
BigDecimal bigDecimalVinAll = voList.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add);
//查询该合同编号下的销售订单的单车成交价
ResultBean<CommonContract> commonContractResultBean = commonContractFeign.selectByNo(v.getContractNo());
if (commonContractResultBean.getSuccess()) {
CommonContract commonContract = commonContractResultBean.getData();
if (commonContract != null) {
ResultBean<AppOrderDetailsVo> orderDetails = busSalesOrderFeign.getSaleOrderDetails(commonContract.getBusSid());
AppOrderDetailsVo vo = orderDetails.getData();
if (vo != null) {
AppOrderPriceInfoVo priceInfoVo = vo.getPriceInfo();
AppOrderDepositInfoVo depositInfo = vo.getDepositInfo();
if (depositInfo != null) {
if ("02".equals(depositInfo.getDepositTypeKey())) {//订金结转
BigDecimal decimalDeposit = BigDecimal.ZERO;
if (StringUtils.isNotBlank(depositInfo.getDepositTotal())) {
decimalDeposit = new BigDecimal(depositInfo.getDepositTotal());
}
if (StringUtils.isNotBlank(depositInfo.getMakeUpDeposit())) {
decimalDeposit = decimalDeposit.subtract(new BigDecimal(depositInfo.getMakeUpDeposit()));
}
decimalDeposit = decimalDeposit.divide(new BigDecimal(priceInfoVo.getNumber()), BigDecimal.ROUND_CEILING);
bigDecimalVinAll = bigDecimalVinAll.add(decimalDeposit);
List<FinSelectedReceivablesDetailedVo> voList = finSelectedReceivablesDetailedService.selectListByVin(v.getContractNo(), finUncollectedReceivablesDetailed.getBusVinSid(), 3);
BigDecimal bigDecimalVinAll = voList.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add);
//查询该合同编号下的销售订单的单车成交价
ResultBean<CommonContract> commonContractResultBean = commonContractFeign.selectByNo(v.getContractNo());
if (commonContractResultBean.getSuccess()) {
CommonContract commonContract = commonContractResultBean.getData();
if (commonContract != null) {
ResultBean<AppOrderDetailsVo> 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<SolutionsDetailsVo> solutionsDetailsVoResultBean = loanSolutionsFeign.selectDetailss(commonContract.getBusSid());
SolutionsDetailsVo solutionsDetailsVo = solutionsDetailsVoResultBean.getData();
if (solutionsDetailsVo != null) {
if (StringUtils.isNotBlank(solutionsDetailsVo.getTypeKey())) {
if ("02".equals(solutionsDetailsVo.getTypeKey())) {
//外部金融:成交价 = 订金+车款+厂家贴息-服务费
leftAll = leftAll.add(singleFinalPrice);
if (StringUtils.isNotBlank(solutionsDetailsVo.getFactoryDiscount())) {
leftAll = leftAll.subtract(new BigDecimal(solutionsDetailsVo.getFactoryDiscount()));
}
if (StringUtils.isNotBlank(solutionsDetailsVo.getServiceAmount())) {
leftAll = leftAll.add(new BigDecimal(solutionsDetailsVo.getServiceAmount()));
}
rightAll = rightAll.add(bigDecimalVinAll);
} else {
//自营非担保: 实收订金 = 首付款及费用+订金
if (StringUtils.isNotBlank(solutionsDetailsVo.getRealTotal())) {
leftAll = leftAll.add(new BigDecimal(solutionsDetailsVo.getRealTotal()));
}
rightAll = rightAll.add(bigDecimalVinAll);
}
//单台整体成交价
BigDecimal singleFinalPrice = new BigDecimal(priceInfoVo.getSingleFinalPrice());
BigDecimal leftAll = BigDecimal.ZERO;
BigDecimal rightAll = BigDecimal.ZERO;
if ("2".equals(vo.getFinancePlan()) || "2".equals(vo.getPayTypeKey())) {
//根据销售订单sid查询金融方案
ResultBean<SolutionsDetailsVo> solutionsDetailsVoResultBean = loanSolutionsFeign.selectDetailss(commonContract.getBusSid());
SolutionsDetailsVo solutionsDetailsVo = solutionsDetailsVoResultBean.getData();
if (solutionsDetailsVo != null) {
if (StringUtils.isNotBlank(solutionsDetailsVo.getTypeKey())) {
if ("02".equals(solutionsDetailsVo.getTypeKey())) {
//外部金融:成交价 = 订金+车款+厂家贴息-服务费
leftAll = leftAll.add(singleFinalPrice);
if (StringUtils.isNotBlank(solutionsDetailsVo.getFactoryDiscount())) {
leftAll = leftAll.subtract(new BigDecimal(solutionsDetailsVo.getFactoryDiscount()));
}
} else {//担保贷款: 实收订金 = 首付款及费用+订金
if (StringUtils.isNotBlank(solutionsDetailsVo.getServiceAmount())) {
leftAll = leftAll.add(new BigDecimal(solutionsDetailsVo.getServiceAmount()));
}
rightAll = rightAll.add(bigDecimalVinAll);
} else {
//自营非担保: 实收订金 = 首付款及费用+订金
if (StringUtils.isNotBlank(solutionsDetailsVo.getRealTotal())) {
leftAll = leftAll.add(new BigDecimal(solutionsDetailsVo.getRealTotal()));
}
rightAll = rightAll.add(bigDecimalVinAll);
}
} else {
// 成交价 = 车款+订金
leftAll = leftAll.add(singleFinalPrice);
} else {//担保贷款: 实收订金 = 首付款及费用+订金
if (StringUtils.isNotBlank(solutionsDetailsVo.getRealTotal())) {
leftAll = leftAll.add(new BigDecimal(solutionsDetailsVo.getRealTotal()));
}
rightAll = rightAll.add(bigDecimalVinAll);
}
} else {
// 成交价 = 车款+订金
// 成交价 = 车款+订金
leftAll = leftAll.add(singleFinalPrice);
rightAll = rightAll.add(bigDecimalVinAll);
}
//根据busVinSid查询待出库中是否存在该数据
ResultBean<BusDelivered> 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<SysOrganizationVo> sysOrganizationVoResultBean = sysOrganizationFeign.fetchBySid(confirmation.getUseOrgSid());
if (sysOrganizationVoResultBean.getData() != null) {
busDeliveredDto.setUseOrgName(sysOrganizationVoResultBean.getData().getName());
}
busDeliveredDto.setBusVinSid(finUncollectedReceivablesDetailed.getBusVinSid());
ResultBean resultBean1 = busDeliveredFeign.save(busDeliveredDto);
} else {
// 成交价 = 车款+订金
leftAll = leftAll.add(singleFinalPrice);
rightAll = rightAll.add(bigDecimalVinAll);
}
//根据busVinSid查询待出库中是否存在该数据
ResultBean<BusDelivered> 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<SysOrganizationVo> sysOrganizationVoResultBean = sysOrganizationFeign.fetchBySid(confirmation.getUseOrgSid());
if (sysOrganizationVoResultBean.getData() != null) {
busDeliveredDto.setUseOrgName(sysOrganizationVoResultBean.getData().getName());
}
busDeliveredDto.setBusVinSid(finUncollectedReceivablesDetailed.getBusVinSid());
ResultBean resultBean1 = busDeliveredFeign.save(busDeliveredDto);
}
}
}
}
}
@ -1571,6 +1575,351 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
return rb.success().setMsg("款项确认成功");
}
public ResultBean cashierConfirm(String sid, String userSid) {
ResultBean rb = ResultBean.fireFail();
FinCollectionConfirmation confirmation = fetchBySid(sid);
if (confirmation == null) {
return rb.setMsg("该申请不存在");
}
finSelectedReceivablesDetailedService.updateAuditStateBySid(1, sid);
//推送收款单
ARReceivebill arReceivebill = new ARReceivebill();
//业务日期
arReceivebill.setFDATE(DateUtil.today());
//收款日期
arReceivebill.setF_PAEZ_Date(confirmation.getCollectionDate());
//收款组织
ResultBean<SysOrganizationVo> 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<ARReceivebill.FRECEIVEBILLENTRY> fEntityList = new ArrayList<>();
ARReceivebill.FRECEIVEBILLENTRY freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY();
//推送全款车款
//根据合同编号分组-车款-待审核-全款-收款单明细
List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVos1 = finSelectedReceivablesDetailedService.fetchByAuditState1_1_1(sid, 1, "车款", "1");
finSelectedReceivablesDetailedVos1.removeAll(Collections.singleton(null));
//全款推送车款(应收未收中为首付款的)
List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVos1_1_1 = finSelectedReceivablesDetailedService.fetchByAuditState1_1_1(sid, 1, "首付款及费用", "1");
finSelectedReceivablesDetailedVos1_1_1.removeAll(Collections.singleton(null));
//推送全款订金
List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVos2 = finSelectedReceivablesDetailedService.fetchByAuditState1_1_1(sid, 1, "订金", "1");
finSelectedReceivablesDetailedVos2.removeAll(Collections.singleton(null));
//贷款推送车款
List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVos1_1 = finSelectedReceivablesDetailedService.fetchByAuditState1_1(sid, 1, "车款", "2");
finSelectedReceivablesDetailedVos1_1.removeAll(Collections.singleton(null));
//贷款推送订金
List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVos2_1 = finSelectedReceivablesDetailedService.fetchByAuditState1_1(sid, 1, "订金", "2");
finSelectedReceivablesDetailedVos2_1.removeAll(Collections.singleton(null));
//贷款推送车款(应收未收中为首付款的)
List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVos1_1_2 = finSelectedReceivablesDetailedService.fetchByAuditState1_1(sid, 1, "首付款及费用", "2");
finSelectedReceivablesDetailedVos1_1_2.removeAll(Collections.singleton(null));
int carSize = 0;
//全款推送车款
if (finSelectedReceivablesDetailedVos1.size() > 0) {
boolean one = false;
if (finSelectedReceivablesDetailedVos1.size() == 1 &&
finSelectedReceivablesDetailedVos1_1_1.size() == 0 &&
finSelectedReceivablesDetailedVos2.size() == 0 &&
finSelectedReceivablesDetailedVos1_1.size() == 0 &&
finSelectedReceivablesDetailedVos2_1.size() == 0 &&
finSelectedReceivablesDetailedVos1_1_2.size() == 0) {
one = true;
}
carSize = fullPaymentPushCar(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos1, freceivebillentry, one, orgCode);
}
//全款推送车款(首付款及费用)
if (finSelectedReceivablesDetailedVos1_1_1.size() > 0) {
boolean one = false;
if (finSelectedReceivablesDetailedVos1.size() == 0 &&
finSelectedReceivablesDetailedVos1_1_1.size() == 1 &&
finSelectedReceivablesDetailedVos2.size() == 0 &&
finSelectedReceivablesDetailedVos1_1.size() == 0 &&
finSelectedReceivablesDetailedVos2_1.size() == 0 &&
finSelectedReceivablesDetailedVos1_1_2.size() == 0) {
one = true;
}
carSize = fullPaymentPushCarFirst(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos1_1_1, freceivebillentry, one, orgCode);
}
//全款推送订金
if (finSelectedReceivablesDetailedVos2.size() > 0) {
boolean one = false;
if (finSelectedReceivablesDetailedVos1.size() == 0 &&
finSelectedReceivablesDetailedVos1_1_1.size() == 0 &&
finSelectedReceivablesDetailedVos2.size() == 1 &&
finSelectedReceivablesDetailedVos1_1.size() == 0 &&
finSelectedReceivablesDetailedVos2_1.size() == 0 &&
finSelectedReceivablesDetailedVos1_1_2.size() == 0) {
one = true;
}
carSize = fullPaymentPushDeposit(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos2, freceivebillentry, one, orgCode);
}
//担保贷款推送车款
if (finSelectedReceivablesDetailedVos1_1.size() > 0) {
boolean one = false;
if (finSelectedReceivablesDetailedVos1.size() == 0 &&
finSelectedReceivablesDetailedVos1_1_1.size() == 0 &&
finSelectedReceivablesDetailedVos2.size() == 0 &&
finSelectedReceivablesDetailedVos1_1.size() == 1 &&
finSelectedReceivablesDetailedVos2_1.size() == 0 &&
finSelectedReceivablesDetailedVos1_1_2.size() == 0) {
one = true;
}
carSize = loanPushCar(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos1_1, freceivebillentry, one, orgCode);
}
//担保贷款推送车款(首付款及费用)
if (finSelectedReceivablesDetailedVos1_1_2.size() > 0) {
boolean one = false;
if (finSelectedReceivablesDetailedVos1.size() == 0 &&
finSelectedReceivablesDetailedVos1_1_1.size() == 0 &&
finSelectedReceivablesDetailedVos2.size() == 0 &&
finSelectedReceivablesDetailedVos1_1.size() == 0 &&
finSelectedReceivablesDetailedVos2_1.size() == 0 &&
finSelectedReceivablesDetailedVos1_1_2.size() == 1) {
one = true;
}
carSize = loanPushCarFirst(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos1_1_2, freceivebillentry, one, orgCode);
}
//担保贷款推送订金
if (finSelectedReceivablesDetailedVos2_1.size() > 0) {
boolean one = false;
if (finSelectedReceivablesDetailedVos1.size() == 0 &&
finSelectedReceivablesDetailedVos1_1_1.size() == 0 &&
finSelectedReceivablesDetailedVos2.size() == 0 &&
finSelectedReceivablesDetailedVos1_1.size() == 0 &&
finSelectedReceivablesDetailedVos2_1.size() == 1 &&
finSelectedReceivablesDetailedVos1_1_2.size() == 0) {
one = true;
}
carSize = loanPushDeposit(confirmation, arReceivebill, carSize, finSelectedReceivablesDetailedVos2_1, freceivebillentry, one, orgCode);
}
//简易订单-订金收取
if (finSelectedReceivablesDetailedVos1.isEmpty() &&
finSelectedReceivablesDetailedVos2.isEmpty() &&
finSelectedReceivablesDetailedVos1_1.isEmpty() &&
finSelectedReceivablesDetailedVos2_1.isEmpty() &&
finSelectedReceivablesDetailedVos1_1_1.isEmpty() &&
finSelectedReceivablesDetailedVos1_1_2.isEmpty() && confirmation.getPushMessgae() == 1) {
//先推送客户
AppBusDepositBuscenterDetailVo busDeposit = busDepositFeign.getDepositInfoDetails(confirmation.getBusSid()).getData();
BdCustomer bdCustomer = createBdCustomer(confirmation.getUseOrgSid(), busDeposit.getPayName(), busDeposit.getPhone(), "", sid);
//推送金蝶客户,修改目标组织为采购系统对应的金蝶分公司code
if (data != null) {
bdCustomer.setTOrgIds(data.getOrgCode());
}
ResultBean resultBeanMiddle = bdCustomerService.draftBdCustomer(bdCustomer);
log.info("客户推送:" + resultBeanMiddle.getMsg());
//往来单位
arReceivebill.setFCONTACTUNIT(bdCustomer.getFNumber());
fEntityList = new ArrayList<>();
freceivebillentry = new ARReceivebill.FRECEIVEBILLENTRY();
//结算方式
freceivebillentry.setFSETTLETYPEIDKey(confirmation.getCollectionTypeKey());
freceivebillentry.setFSETTLETYPEIDType("customerPayType");
BigDecimal bigAll = confirmation.getCollectionMoney();
//收款金额
freceivebillentry.setFRECTOTALAMOUNTFOR(bigAll.toString());
//登记日期
freceivebillentry.setFPOSTDATE(confirmation.getCollectionDate());
//收款用途:订金
freceivebillentry.setFPURPOSEIDKey("002");
freceivebillentry.setFPURPOSEIDType("cw_skyt");
freceivebillentry.setFACCOUNTID(confirmation.getCollectionBankNum());
fEntityList.add(freceivebillentry);
arReceivebill.setFRECEIVEBILLENTRY(fEntityList);
//项目类别key、value
arReceivebill.setF_PAEZ_AssistantType("cw_sklb");
arReceivebill.setF_PAEZ_AssistantKey("006");
arReceivebill.setFBillNo(confirmation.getBillNo());
ResultBean resultBean2 = arReceivebillService.draftArReceivebill(arReceivebill);
log.info("收款单推送:" + resultBean2.getMsg());
}
//===========================================
//查询该申请下的所有待审核的款项明细
BigDecimal subscriptionMoneyAll = new BigDecimal("0");
List<FinSelectedReceivablesDetailedVo> finSelectedReceivablesDetailedVos = finSelectedReceivablesDetailedService.fetchByAuditState(sid, 1);
if (finSelectedReceivablesDetailedVos.size() > 0) {
finSelectedReceivablesDetailedVos.stream().forEach(v -> {
//已选款项明细sid
String selectSid = v.getSid();
//应收未收款项明细sid
String receivablesSid = v.getReceivablesSid();
FinUncollectedReceivablesDetailed finUncollectedReceivablesDetailed = finUncollectedReceivablesDetailedService.fetchBySid(receivablesSid);
if (v.getSubscribedOf() == 0) {
//更新认款状态
finUncollectedReceivablesDetailed.setSubscriptionState(finUncollectedReceivablesDetailed.getCurrentReceivableMoney().compareTo(BigDecimal.ZERO) == 0 ? 3 : 2);
finUncollectedReceivablesDetailedService.updateById(finUncollectedReceivablesDetailed);
}
FinSelectedReceivablesDetailed finSelectedReceivablesDetailed = finSelectedReceivablesDetailedService.fetchBySid(selectSid);
//更新已选款项明细的审核状态1待审核/2已驳回/3已审核
finSelectedReceivablesDetailed.setAuditState(3);
//更新审核时间
finSelectedReceivablesDetailed.setAuditDate(DateUtil.today());
finSelectedReceivablesDetailedService.updateById(finSelectedReceivablesDetailed);
/*//ToDo:查询是否符合待出库的条件
//该合同编号下的该车架号的所有认款金额
List<FinSelectedReceivablesDetailedVo> voList = finSelectedReceivablesDetailedService.selectListByVin(v.getContractNo(), finUncollectedReceivablesDetailed.getBusVinSid(), 3);
BigDecimal bigDecimalVinAll = voList.stream().map(FinSelectedReceivablesDetailedVo::getSubscriptionMoney).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add);
//查询该合同编号下的销售订单的单车成交价
ResultBean<CommonContract> commonContractResultBean = commonContractFeign.selectByNo(v.getContractNo());
if (commonContractResultBean.getSuccess()) {
CommonContract commonContract = commonContractResultBean.getData();
if (commonContract != null) {
ResultBean<AppOrderDetailsVo> 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<SolutionsDetailsVo> 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<BusDelivered> 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<SysOrganizationVo> 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<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(userSid);
if (userVoResultBean.getData() != null) {
confirmation.setConfirmName(userVoResultBean.getData().getName());
}
confirmation.setConfirmDate(DateUtil.today());
confirmation.setConfirmNameSid(userSid);
baseMapper.updateById(confirmation);
//删除临时表的数据
ResultBean deleteResult = baseVehicleTempstateFeign.delByBusSid(sid);
return rb.success().setMsg("款项确认成功");
}
//组装客户推送
private BdCustomer createBdCustomer(String useOrgSid, String name, String mobile, String customerSid, String collSid) {
BdCustomer bdCustomer = new BdCustomer();
@ -2370,6 +2719,6 @@ public class FinCollectionConfirmationService extends MybatisBaseService<FinColl
}
public void updateYeBySid(String balance, String busSid) {
baseMapper.updateYeBySid(balance,busSid);
baseMapper.updateYeBySid(balance, busSid);
}
}

8
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finfundscarriedforwardapply/FinFundsCarriedForwardApplyService.java

@ -83,8 +83,6 @@ import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import static java.util.Comparator.comparing;
/**
* Project: anrui-fin(款项结转申请) <br/>
* File: FinFundsCarriedForwardApplyService.java <br/>
@ -451,6 +449,9 @@ public class FinFundsCarriedForwardApplyService extends MybatisBaseService<FinFu
finSelectedReceivablesDetailed.setAuditState(3);
}
finSelectedReceivablesDetailed.setAuditDate(DateUtil.formatDate(new Date()));
if(finSelectedReceivablesDetailed.getSubscribedOf() == 1){
finSelectedReceivablesDetailed.setSelectSid(yxysFinFundsCarriedForwardYXYSKXVo.getSid());
}
finSelectedReceivablesDetailedService.save(finSelectedReceivablesDetailed);
}
return rb.success().setData(finFundsCarriedForwardApply.getSid());
@ -492,6 +493,9 @@ public class FinFundsCarriedForwardApplyService extends MybatisBaseService<FinFu
finSelectedReceivablesDetailed.setUseOrgSid(yxysFinFundsCarriedForwardYXYSKXVo.getUseOrgSid());
finSelectedReceivablesDetailed.setSubscribedOf(yxysFinFundsCarriedForwardYXYSKXVo.getSubscribedOf());
finSelectedReceivablesDetailed.setCollSid(dtoSid);
if(finSelectedReceivablesDetailed.getSubscribedOf() == 1){
finSelectedReceivablesDetailed.setSelectSid(yxysFinFundsCarriedForwardYXYSKXVo.getSid());
}
finSelectedReceivablesDetailedService.save(finSelectedReceivablesDetailed);
}
return rb.success().setData(dtoSid);

2
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedMapper.java

@ -155,4 +155,6 @@ public interface FinSelectedReceivablesDetailedMapper extends BaseMapper<FinSele
@Update("update fin_selected_receivables_detailed set balance = #{balance} where sid = #{busSid}")
void updateYeBySid(@Param("balance") String balance,@Param("busSid") String busSid);
String selectBalanceByReceivedSid(String receivablesSid);
}

28
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedMapper.xml

@ -67,7 +67,8 @@
furd.payType,
furd.payTypeKey,
furd.customerSid,
furd.useOrgSid
furd.useOrgSid,
furd.reveivableMoney
FROM fin_uncollected_receivables_detailed furd
<where>
${ew.sqlSegment}
@ -181,7 +182,7 @@
where collSid = #{sid}
and auditState = #{state}
and receivablesName = #{type}
and payTypeKey = #{payTypeKey} and subscribedOf = 0
and payTypeKey = #{payTypeKey}
group by contractNo
</select>
@ -192,7 +193,7 @@
where collSid = #{sid}
and auditState = #{state}
and receivablesName = #{type}
and payTypeKey = #{payTypeKey} and subscribedOf = 0
and payTypeKey = #{payTypeKey}
</select>
<select id="selectCustomerList" resultType="com.yxt.anrui.fin.api.finselectedreceivablesdetailed.SelectCustomerVo">
@ -200,7 +201,7 @@
from fin_selected_receivables_detailed
where collSid = #{sid}
and auditState = #{state}
and receivablesName = #{type} and subscribedOf = 0
and receivablesName = #{type}
group by concat(customerName, customerPhone)
</select>
@ -209,7 +210,7 @@
select *
from fin_selected_receivables_detailed
where collSid = #{sid}
and auditState = #{state} and subscribedOf = 0
and auditState = #{state}
and receivablesName = #{type}
</select>
@ -221,7 +222,7 @@
and auditState = #{state}
and receivablesName = #{type}
and customerName = #{customerName}
and customerPhone = #{customerPhone} and subscribedOf = 0
and customerPhone = #{customerPhone}
and length(VIN) > 0
</select>
@ -232,7 +233,7 @@
where collSid = #{sid}
and auditState = #{state}
and receivablesName = #{type}
and contractNo = #{contractNo} and subscribedOf = 0
and contractNo = #{contractNo}
and length(VIN) > 0
</select>
@ -243,7 +244,7 @@
where collSid = #{sid}
and auditState = #{state}
and receivablesName = #{type}
and contractNo = #{contractNo} and subscribedOf = 0
and contractNo = #{contractNo}
and length(VIN) = 0
</select>
@ -255,16 +256,16 @@
and auditState = #{state}
and receivablesName = #{type}
and customerName = #{customerName}
and customerPhone = #{customerPhone} and subscribedOf = 0
and customerPhone = #{customerPhone}
and length(VIN) = 0
</select>
<select id="selectByVinSid" resultType="java.lang.String">
select sum(fd.subscriptionMoney)
select sum(fd.balance)
from fin_selected_receivables_detailed fd
left join fin_uncollected_receivables_detailed ff on ff.sid = fd.receivablesSid
where ff.busVinSid = #{busVinSid}
and fd.auditState = 3 and subscribedOf = 0
and fd.auditState = 3
</select>
<update id="updateAuditStateBySid">
@ -350,4 +351,9 @@
${ew.sqlSegment}
</where>
</select>
<select id="selectBalanceByReceivedSid"
resultType="java.lang.String">
select ifnull(sum(balance),0) from fin_selected_receivables_detailed where receivablesSid = #{receivablesSid} and (auditState =1 or auditState = 3)
</select>
</mapper>

4
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finselectedreceivablesdetailed/FinSelectedReceivablesDetailedService.java

@ -571,4 +571,8 @@ public class FinSelectedReceivablesDetailedService extends MybatisBaseService<Fi
public void updateYeBySid(String balance, String busSid) {
baseMapper.updateYeBySid(balance,busSid);
}
public String selectBalanceByReceivedSid(String receivablesSid) {
return baseMapper.selectBalanceByReceivedSid(receivablesSid);
}
}

13
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedService.java

@ -218,6 +218,13 @@ public class FinUncollectedReceivablesDetailedService extends MybatisBaseService
}
}
}
//查询当前应收:应收金额-所有认款的余额=剩余应收金额
String receivablesSid = v.getReceivablesSid();
String balanceSum = finSelectedReceivablesDetailedService.selectBalanceByReceivedSid(receivablesSid);
String reveivableMoney = v.getReveivableMoney();
String currentReceivableMoney = new BigDecimal(reveivableMoney).subtract(new BigDecimal(balanceSum)).toString();
v.setCurrentReceivableMoney(currentReceivableMoney);
}
}
if (StringUtils.isNotBlank(query.getVinNo())) {
@ -538,7 +545,7 @@ public class FinUncollectedReceivablesDetailedService extends MybatisBaseService
QueryWrapper<FinUncollectedReceivablesDetailed> qw = new QueryWrapper<>();
AppFinUncollectedReceivablesDetailedQuery query = pq.getParams();
String orgPath = query.getOrgPath();
if (StringUtils.isNotBlank(query.getMenuSid())){
if (StringUtils.isNotBlank(query.getMenuSid())) {
//授权
PrivilegeQuery privilegeQuery = new PrivilegeQuery();
privilegeQuery.setOrgPath(query.getOrgPath());
@ -575,7 +582,7 @@ public class FinUncollectedReceivablesDetailedService extends MybatisBaseService
PagerVo<AppCustomerBillSummaryDetailsVo> p = new PagerVo<>();
return p;
}
}else {
} else {
qw.eq("useOrgSid", query.getUseOrgSid());
}
if (StringUtils.isNotBlank(query.getName())) {
@ -918,7 +925,7 @@ public class FinUncollectedReceivablesDetailedService extends MybatisBaseService
for (int i = 0; i < receiveSeleteVoList.size(); i++) {
ReceiveSeleteVo receiveSeleteVo = receiveSeleteVoList.get(i);
BigDecimal subscriptionMoneyAll = BigDecimal.ZERO;
if(StringUtils.isNotBlank(receiveSeleteVo.getSubscriptionMoneyAll())){
if (StringUtils.isNotBlank(receiveSeleteVo.getSubscriptionMoneyAll())) {
subscriptionMoneyAll = new BigDecimal(receiveSeleteVo.getSubscriptionMoneyAll());
}
BigDecimal notSubscriptionMoney = new BigDecimal(receiveSeleteVo.getReveivableMoney()).subtract(subscriptionMoneyAll);

1
anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/arrearsTakeCar/AppBusArrearsCarryVehicleApplyService.java

@ -257,7 +257,6 @@ public class AppBusArrearsCarryVehicleApplyService {
return rb.setMsg(resultBean.getMsg());
}
BeanUtil.copyProperties(resultBean.getData(), advanceArrearsInfoVo);
advanceArrearsInfoVo.setModelOrgPath(advanceArrearsInfoVo.getOrgPath());
return rb.success().setData(advanceArrearsInfoVo);
}

Loading…
Cancel
Save