|
|
@@ -3,13 +3,17 @@ package com.sckw.freight.service.freight.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.sckw.freight.entity.freight.*;
|
|
|
+import com.sckw.freight.entity.freight.KwpLedgerLogistics;
|
|
|
+import com.sckw.freight.entity.freight.KwpLedgerLogisticsOrder;
|
|
|
+import com.sckw.freight.entity.freight.KwpLedgerLogisticsTrack;
|
|
|
+import com.sckw.freight.entity.freight.KwpSettlementLogistics;
|
|
|
import com.sckw.freight.entity.kll.KllOrder;
|
|
|
import com.sckw.freight.entity.kll.KllOrderTask;
|
|
|
+import com.sckw.freight.entity.saas.SaasCompany;
|
|
|
import com.sckw.freight.mapper.freight.KwpLedgerLogisticsMapper;
|
|
|
import com.sckw.freight.mapper.freight.KwpSettlementLogisticsMapper;
|
|
|
-import com.sckw.freight.mapper.freight.KwpWalletRelationMapper;
|
|
|
import com.sckw.freight.mapper.kll.KllOrderTaskMapper;
|
|
|
+import com.sckw.freight.mapper.saas.SaasCompanyMapper;
|
|
|
import com.sckw.freight.model.dto.PayIndex;
|
|
|
import com.sckw.freight.model.enums.*;
|
|
|
import com.sckw.freight.model.po.LedgerLogisticsStatistics;
|
|
|
@@ -61,8 +65,11 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
|
|
|
KwpLedgerLogisticsMapper kwpLedgerLogisticsMapper;
|
|
|
@Autowired
|
|
|
KllOrderTaskMapper kllOrderTaskMapper;
|
|
|
+ // @Autowired
|
|
|
+// KwpWalletRelationMapper kwpWalletRelationMapper;
|
|
|
@Autowired
|
|
|
- KwpWalletRelationMapper kwpWalletRelationMapper;
|
|
|
+ SaasCompanyMapper saasCompanyMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
PayCenterService payCenterService;
|
|
|
//@Lazy
|
|
|
@@ -121,7 +128,7 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
|
|
|
if (kwpSettlementLogistics == null) kwpSettlementLogistics = new ArrayList<>();
|
|
|
BigDecimal totalPrice = kwpSettlementLogistics.stream().map(KwpSettlementLogistics::getActualPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
newLedgerLogistics.setActualPrice(totalPrice);
|
|
|
- if (totalPrice.compareTo(BigDecimal.ZERO)==0)return;
|
|
|
+ if (totalPrice.compareTo(BigDecimal.ZERO) == 0) return;
|
|
|
KwpLedgerLogisticsStatusEnum status = KwpLedgerLogisticsStatusEnum.Unpaid;
|
|
|
if (totalPrice.compareTo(ledgerLogistics.getSettlePrice()) < 0) {
|
|
|
status = KwpLedgerLogisticsStatusEnum.PartialPaid;
|
|
|
@@ -493,24 +500,40 @@ public class KwpLedgerLogisticsServiceImpl extends ServiceImpl<KwpLedgerLogistic
|
|
|
if (money.compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
return R.failed("对账单已支付");
|
|
|
}
|
|
|
- //查询收款方(卖方) 账户信息
|
|
|
- LambdaQueryWrapper<KwpWalletRelation> walletRelationWrapperS = new LambdaQueryWrapper<>();
|
|
|
- walletRelationWrapperS.eq(KwpWalletRelation::getEntId, entId);
|
|
|
- KwpWalletRelation walletRelationS = kwpWalletRelationMapper.selectOne(walletRelationWrapperS);
|
|
|
- if (walletRelationS == null) {
|
|
|
- return R.failed("收款方【"+entId+"】账户不存在");
|
|
|
+ //查询收款方(卖方-收款方) 账户信息
|
|
|
+// LambdaQueryWrapper<KwpWalletRelation> walletRelationWrapperS = new LambdaQueryWrapper<>();
|
|
|
+// walletRelationWrapperS.eq(KwpWalletRelation::getEntId, entId);
|
|
|
+// KwpWalletRelation walletRelationS = kwpWalletRelationMapper.selectOne(walletRelationWrapperS);
|
|
|
+// if (walletRelationS == null) {
|
|
|
+// return R.failed("收款方【"+entId+"】账户不存在");
|
|
|
+// }
|
|
|
+ SaasCompany saasCompanyS = saasCompanyMapper.selectById(entId);
|
|
|
+ if (saasCompanyS == null) {
|
|
|
+ return R.failed("收款方【" + entId + "】账户不存在");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(saasCompanyS.getPayPlatformUid())) {
|
|
|
+ return R.failed("收款方【" + entId + "】钱包账户不存在");
|
|
|
}
|
|
|
- //查询付款方(买方) 账户信息
|
|
|
- LambdaQueryWrapper<KwpWalletRelation> walletRelationWrapperP = new LambdaQueryWrapper<>();
|
|
|
- walletRelationWrapperP.eq(KwpWalletRelation::getEntId, ledgerLogistics.getCompanyId());
|
|
|
- KwpWalletRelation walletRelationP = kwpWalletRelationMapper.selectOne(walletRelationWrapperP);
|
|
|
- if (walletRelationP == null) {
|
|
|
- return R.failed("付款方【"+ledgerLogistics.getCompanyId()+"】账户不存在");
|
|
|
+ //查询付款方(买方-付款方) 账户信息
|
|
|
+// LambdaQueryWrapper<KwpWalletRelation> walletRelationWrapperP = new LambdaQueryWrapper<>();
|
|
|
+// walletRelationWrapperP.eq(KwpWalletRelation::getEntId, ledgerLogistics.getCompanyId());
|
|
|
+// KwpWalletRelation walletRelationP = kwpWalletRelationMapper.selectOne(walletRelationWrapperP);
|
|
|
+// if (walletRelationP == null) {
|
|
|
+// return R.failed("付款方【"+ledgerLogistics.getCompanyId()+"】账户不存在");
|
|
|
+// }
|
|
|
+ SaasCompany saasCompanyP = saasCompanyMapper.selectById(ledgerLogistics.getCompanyId());
|
|
|
+ if (saasCompanyP == null) {
|
|
|
+ return R.failed("付款方【" + ledgerLogistics.getCompanyId() + "】账户不存在");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(saasCompanyP.getPayPlatformUid())) {
|
|
|
+ return R.failed("付款方【" + ledgerLogistics.getCompanyId() + "】钱包账户不存在");
|
|
|
}
|
|
|
//调用支付中台的【在线充值】接口
|
|
|
- R<PayIndex> payIndexR = payCenterService.payIndex(walletRelationP.getUid(), walletRelationS.getUid(), ChannelEnum.XW, money.multiply(BigDecimal.valueOf(100)).longValue());
|
|
|
+ //R<PayIndex> payIndexR = payCenterService.payIndex(walletRelationP.getUid(), walletRelationS.getUid(), ChannelEnum.XW, money.multiply(BigDecimal.valueOf(100)).longValue());
|
|
|
+ R<PayIndex> payIndexR = payCenterService.payIndex(saasCompanyP.getPayPlatformUid(), saasCompanyS.getPayPlatformUid(), ChannelEnum.XW, money.multiply(BigDecimal.valueOf(100)).longValue());
|
|
|
+
|
|
|
if (payIndexR == null || !payIndexR.getStatus() || payIndexR.getCode() != 200) {
|
|
|
- return R.failed("支付中台的【在线充值】接口失败,"+payIndexR.getMsg());
|
|
|
+ return R.failed("支付中台的【在线充值】接口失败," + payIndexR.getMsg());
|
|
|
}
|
|
|
PayIndex payIndex = payIndexR.getData();
|
|
|
//保存付款单信息
|