|
@@ -20,10 +20,7 @@ import com.sckw.payment.dao.KwpSettlementLogisticsTrackMapper;
|
|
|
import com.sckw.payment.dao.KwpSettlementWalletMapper;
|
|
import com.sckw.payment.dao.KwpSettlementWalletMapper;
|
|
|
import com.sckw.payment.model.*;
|
|
import com.sckw.payment.model.*;
|
|
|
import com.sckw.payment.model.constant.*;
|
|
import com.sckw.payment.model.constant.*;
|
|
|
-import com.sckw.payment.model.dto.LedgerUnitDto;
|
|
|
|
|
-import com.sckw.payment.model.dto.SettlementLogisticsDto;
|
|
|
|
|
-import com.sckw.payment.model.dto.SettlementTradeDto;
|
|
|
|
|
-import com.sckw.payment.model.dto.SettlementWalletDto;
|
|
|
|
|
|
|
+import com.sckw.payment.model.dto.*;
|
|
|
import com.sckw.payment.model.vo.req.OfflinePaymentReq;
|
|
import com.sckw.payment.model.vo.req.OfflinePaymentReq;
|
|
|
import com.sckw.payment.model.vo.req.SettlementWalletReq;
|
|
import com.sckw.payment.model.vo.req.SettlementWalletReq;
|
|
|
import com.sckw.payment.model.vo.req.WalletPayReq;
|
|
import com.sckw.payment.model.vo.req.WalletPayReq;
|
|
@@ -516,6 +513,22 @@ public class KwpSettlementWalletService {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public BigDecimal getConfirmLogisticsPayment(Long id) {
|
|
|
|
|
+ SettlementLogisticsDto byId = kwpSettlementLogisticsService.detail(id, LogisticsUnitType.CARRIER, LogisticsUnitType.SHIPPER);
|
|
|
|
|
+ if (Objects.isNull(byId)) {
|
|
|
|
|
+ throw new BusinessException("结算单不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotBlank(byId.getTrading()) && !byId.getTrading().startsWith(TradingEnum.RECEIVE_PAY.getValue())) {
|
|
|
|
|
+ throw new BusinessException("只支持货货到付款方式订单进行当前操作");
|
|
|
|
|
+ }
|
|
|
|
|
+ List<LedgerUnitDto> listById = kwpSettlementLogisticsService.getListById(id);
|
|
|
|
|
+ if (CollectionUtils.isEmpty(listById) || listById.size() != NumberConstant.TWO) {
|
|
|
|
|
+ throw new BusinessException("对账单交易企业双方不存在或缺少");
|
|
|
|
|
+ }
|
|
|
|
|
+ return getWalletBalance(listById, byId.getTrading());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 货到付款-查询钱包余额
|
|
* 货到付款-查询钱包余额
|
|
|
*
|
|
*
|
|
@@ -534,6 +547,35 @@ public class KwpSettlementWalletService {
|
|
|
if (CollectionUtils.isEmpty(listById) || listById.size() != NumberConstant.TWO) {
|
|
if (CollectionUtils.isEmpty(listById) || listById.size() != NumberConstant.TWO) {
|
|
|
throw new BusinessException("对账单交易企业双方不存在或缺少");
|
|
throw new BusinessException("对账单交易企业双方不存在或缺少");
|
|
|
}
|
|
}
|
|
|
|
|
+ return getWalletBalance(listById, byId.getTrading());
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// Long uid = null;
|
|
|
|
|
+// Long filter = null;
|
|
|
|
|
+// for (LedgerUnitDto ledgerUnitDto : listById) {
|
|
|
|
|
+// Integer unitType = ledgerUnitDto.getUnitType();
|
|
|
|
|
+// if (TradeUnitType.PURCHASE.equals(unitType)) {
|
|
|
|
|
+// uid = ledgerUnitDto.getTopEntId();
|
|
|
|
|
+// continue;
|
|
|
|
|
+// }
|
|
|
|
|
+// if (TradeUnitType.SELL.equals(unitType)) {
|
|
|
|
|
+// filter = ledgerUnitDto.getTopEntId();
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// String relation = walletRelationService.getRelation(uid);
|
|
|
|
|
+// String filterUser = walletRelationService.getRelation(filter);
|
|
|
|
|
+// if (StringUtils.isBlank(relation) || StringUtils.isBlank(filterUser)) {
|
|
|
|
|
+// throw new BusinessException("顶级企业未开通电子钱包");
|
|
|
|
|
+// }
|
|
|
|
|
+// R<List<WalletDto>> wallet = payCenterService.wallet(relation, ChannelEnum.getByCode(byId.getTrading()), filterUser);
|
|
|
|
|
+// if (CollectionUtils.isEmpty(wallet.getData())) {
|
|
|
|
|
+// throw new BusinessException("暂未开通电子钱包");
|
|
|
|
|
+// }
|
|
|
|
|
+// List<WalletDto> data = wallet.getData();
|
|
|
|
|
+// return BigDecimal.valueOf(data.get(NumberConstant.ZERO).getMoney() / 100.0);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private BigDecimal getWalletBalance(List<LedgerUnitDto> listById, String trading) {
|
|
|
Long uid = null;
|
|
Long uid = null;
|
|
|
Long filter = null;
|
|
Long filter = null;
|
|
|
for (LedgerUnitDto ledgerUnitDto : listById) {
|
|
for (LedgerUnitDto ledgerUnitDto : listById) {
|
|
@@ -551,12 +593,14 @@ public class KwpSettlementWalletService {
|
|
|
if (StringUtils.isBlank(relation) || StringUtils.isBlank(filterUser)) {
|
|
if (StringUtils.isBlank(relation) || StringUtils.isBlank(filterUser)) {
|
|
|
throw new BusinessException("顶级企业未开通电子钱包");
|
|
throw new BusinessException("顶级企业未开通电子钱包");
|
|
|
}
|
|
}
|
|
|
- R<List<WalletDto>> wallet = payCenterService.wallet(relation, ChannelEnum.getByCode(byId.getTrading()), filterUser);
|
|
|
|
|
|
|
+ R<List<WalletDto>> wallet = payCenterService.wallet(relation, ChannelEnum.getByCode(trading), filterUser);
|
|
|
if (CollectionUtils.isEmpty(wallet.getData())) {
|
|
if (CollectionUtils.isEmpty(wallet.getData())) {
|
|
|
throw new BusinessException("暂未开通电子钱包");
|
|
throw new BusinessException("暂未开通电子钱包");
|
|
|
}
|
|
}
|
|
|
List<WalletDto> data = wallet.getData();
|
|
List<WalletDto> data = wallet.getData();
|
|
|
return BigDecimal.valueOf(data.get(NumberConstant.ZERO).getMoney() / 100.0);
|
|
return BigDecimal.valueOf(data.get(NumberConstant.ZERO).getMoney() / 100.0);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|