|
|
@@ -20,10 +20,7 @@ import com.sckw.payment.dao.KwpSettlementLogisticsTrackMapper;
|
|
|
import com.sckw.payment.dao.KwpSettlementWalletMapper;
|
|
|
import com.sckw.payment.model.*;
|
|
|
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.SettlementWalletReq;
|
|
|
import com.sckw.payment.model.vo.req.WalletPayReq;
|
|
|
@@ -516,24 +513,94 @@ public class KwpSettlementWalletService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public WalletDto getConfirmLogisticsPayment(Long id) {
|
|
|
+ //todo
|
|
|
+ WalletDto walletDto = new WalletDto();
|
|
|
+ walletDto.setName("测试钱宝");
|
|
|
+ walletDto.setMemberName("");
|
|
|
+ walletDto.setUid("kll_0001");
|
|
|
+ walletDto.setChannel("1");
|
|
|
+ walletDto.setCreateTime(LocalDateTime.now());
|
|
|
+ walletDto.setFilter("kll_0002");
|
|
|
+ walletDto.setFreeze(0L);
|
|
|
+ walletDto.setApMoney(0L);
|
|
|
+ walletDto.setTotalMoney(12000L);
|
|
|
+ walletDto.setMoney(1L);
|
|
|
+
|
|
|
+ return walletDto;
|
|
|
+// 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());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 货到付款-查询钱包余额
|
|
|
*
|
|
|
* @param id 结算单id
|
|
|
* @return
|
|
|
*/
|
|
|
- public BigDecimal getConfirmTradePayment(Long id) {
|
|
|
- SettlementTradeDto byId = kwpSettlementTradeService.getById(id, TradeUnitType.SELL);
|
|
|
- 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 = kwpSettlementTradeService.getListById(id);
|
|
|
- if (CollectionUtils.isEmpty(listById) || listById.size() != NumberConstant.TWO) {
|
|
|
- throw new BusinessException("对账单交易企业双方不存在或缺少");
|
|
|
- }
|
|
|
+ public WalletDto getConfirmTradePayment(Long id) {
|
|
|
+ //todo
|
|
|
+ WalletDto walletDto = new WalletDto();
|
|
|
+ walletDto.setName("测试钱宝");
|
|
|
+ walletDto.setMemberName("");
|
|
|
+ walletDto.setUid("kll_0001");
|
|
|
+ walletDto.setChannel("1");
|
|
|
+ walletDto.setCreateTime(LocalDateTime.now());
|
|
|
+ walletDto.setFilter("kll_0002");
|
|
|
+ walletDto.setFreeze(0L);
|
|
|
+ walletDto.setApMoney(0L);
|
|
|
+ walletDto.setTotalMoney(12000L);
|
|
|
+ walletDto.setMoney(1L);
|
|
|
+
|
|
|
+ return walletDto;
|
|
|
+// SettlementTradeDto byId = kwpSettlementTradeService.getById(id, TradeUnitType.SELL);
|
|
|
+// 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 = kwpSettlementTradeService.getListById(id);
|
|
|
+// if (CollectionUtils.isEmpty(listById) || listById.size() != NumberConstant.TWO) {
|
|
|
+// throw new BusinessException("对账单交易企业双方不存在或缺少");
|
|
|
+// }
|
|
|
+// 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 data.get(NumberConstant.ZERO);
|
|
|
+// return BigDecimal.valueOf(data.get(NumberConstant.ZERO).getMoney() / 100.0);
|
|
|
+ }
|
|
|
+ private BigDecimal getWalletBalance(List<LedgerUnitDto> listById, String trading) {
|
|
|
Long uid = null;
|
|
|
Long filter = null;
|
|
|
for (LedgerUnitDto ledgerUnitDto : listById) {
|
|
|
@@ -551,12 +618,14 @@ public class KwpSettlementWalletService {
|
|
|
if (StringUtils.isBlank(relation) || StringUtils.isBlank(filterUser)) {
|
|
|
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())) {
|
|
|
throw new BusinessException("暂未开通电子钱包");
|
|
|
}
|
|
|
List<WalletDto> data = wallet.getData();
|
|
|
return BigDecimal.valueOf(data.get(NumberConstant.ZERO).getMoney() / 100.0);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|