|
@@ -9,6 +9,7 @@ import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.page.PageRes;
|
|
import com.sckw.core.model.page.PageRes;
|
|
|
import com.sckw.core.utils.IdWorker;
|
|
import com.sckw.core.utils.IdWorker;
|
|
|
|
|
+import com.sckw.core.utils.OrderUtils;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
@@ -69,6 +70,7 @@ public class KwpSettlementWalletService {
|
|
|
private final KwpSettlementLogisticsMapper kwpSettlementLogisticsMapper;
|
|
private final KwpSettlementLogisticsMapper kwpSettlementLogisticsMapper;
|
|
|
private final KwpLedgerTradeOrderService tradeOrderService;
|
|
private final KwpLedgerTradeOrderService tradeOrderService;
|
|
|
private final KwpSettlementLogisticsService kwpSettlementLogisticsService;
|
|
private final KwpSettlementLogisticsService kwpSettlementLogisticsService;
|
|
|
|
|
+ private final WalletBusinessService walletBusinessService;
|
|
|
@Resource
|
|
@Resource
|
|
|
private KwpSettlementTradeService kwpSettlementTradeService;
|
|
private KwpSettlementTradeService kwpSettlementTradeService;
|
|
|
private final PayCenterService payCenterService;
|
|
private final PayCenterService payCenterService;
|
|
@@ -165,7 +167,7 @@ public class KwpSettlementWalletService {
|
|
|
* <p>
|
|
* <p>
|
|
|
* Transactional// isolation:事务的隔离级别,此处使用后端数据库的默认隔离级别, propagation: 如果当前没有事务,就新建一个事务,如果已经存在一个事务中,加入到这个事务中(常见)。(rollbackFor = Exception.class, isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)
|
|
* Transactional// isolation:事务的隔离级别,此处使用后端数据库的默认隔离级别, propagation: 如果当前没有事务,就新建一个事务,如果已经存在一个事务中,加入到这个事务中(常见)。(rollbackFor = Exception.class, isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)
|
|
|
*/
|
|
*/
|
|
|
- @Transactional
|
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Integer confirmLogisticsPayment(OfflinePaymentReq offlinePaymentReq) {
|
|
public Integer confirmLogisticsPayment(OfflinePaymentReq offlinePaymentReq) {
|
|
|
Long id = offlinePaymentReq.getIdLong();
|
|
Long id = offlinePaymentReq.getIdLong();
|
|
|
BigDecimal price = offlinePaymentReq.getPrice();
|
|
BigDecimal price = offlinePaymentReq.getPrice();
|
|
@@ -175,7 +177,6 @@ public class KwpSettlementWalletService {
|
|
|
if (price == null || price.compareTo(BigDecimal.ZERO) == 0) {
|
|
if (price == null || price.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
throw new BusinessException("结算参数金额必填");
|
|
throw new BusinessException("结算参数金额必填");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
//先查询出结算单情况
|
|
//先查询出结算单情况
|
|
|
SettlementLogisticsDto settlementLogisticsDto = kwpSettlementLogisticsService.detailPayment(id);
|
|
SettlementLogisticsDto settlementLogisticsDto = kwpSettlementLogisticsService.detailPayment(id);
|
|
|
//检查结算单状态和所差金额
|
|
//检查结算单状态和所差金额
|
|
@@ -198,84 +199,107 @@ public class KwpSettlementWalletService {
|
|
|
log.error("本次结算输入金额比剩余付款金额大:ID:" + id + " 剩余金额:" + remainingReceivables + " 本次输入金额:" + price);
|
|
log.error("本次结算输入金额比剩余付款金额大:ID:" + id + " 剩余金额:" + remainingReceivables + " 本次输入金额:" + price);
|
|
|
throw new BusinessException("参数错误:输入金额过大 " + price + " 剩余金额最大值:" + remainingReceivables);
|
|
throw new BusinessException("参数错误:输入金额过大 " + price + " 剩余金额最大值:" + remainingReceivables);
|
|
|
}
|
|
}
|
|
|
- //累加入库结算单
|
|
|
|
|
- KwpSettlementLogistics settlementLogistics = new KwpSettlementLogistics();
|
|
|
|
|
- settlementLogistics.setId(settlementLogisticsDto.getId());
|
|
|
|
|
- settlementLogistics.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
- //全部结算
|
|
|
|
|
- if (remainingReceivables.compareTo(price) == 0) {
|
|
|
|
|
- settlementLogistics.setStatus(SettlementEnum.ALL_PAYMENT.getStatus());
|
|
|
|
|
- }
|
|
|
|
|
- //部分结算
|
|
|
|
|
- if (remainingReceivables.compareTo(price) > 0) {
|
|
|
|
|
- settlementLogistics.setStatus(SettlementEnum.PARTIAL_PAYMENT.getStatus());
|
|
|
|
|
- }
|
|
|
|
|
- BigDecimal actualPrice = settlementLogisticsDto.getActualPrice();
|
|
|
|
|
- settlementLogistics.setActualPrice((actualPrice == null) ? price : actualPrice.add(price));
|
|
|
|
|
- int upInt = kwpSettlementLogisticsMapper.updateById(settlementLogistics);
|
|
|
|
|
- if (upInt > 0) {
|
|
|
|
|
- //新增一条修改记录
|
|
|
|
|
- String remark = LoginUserHolder.getUserName() + "[" + LoginUserHolder.getUserId() + "]" + "结算[" + settlementLogistics.getId() + "]" + settlementLogistics.getActualPrice() + "(" + SettlementEnum.getStatusDesc(settlementLogistics.getStatus()) + ")";
|
|
|
|
|
- KwpSettlementLogisticsTrack kwpSettlementLogisticsTrack = new KwpSettlementLogisticsTrack();
|
|
|
|
|
- kwpSettlementLogisticsTrack.setId(new IdWorker(1).nextId());
|
|
|
|
|
- kwpSettlementLogisticsTrack.setLSettlementId(settlementLogistics.getId());
|
|
|
|
|
- kwpSettlementLogisticsTrack.setRemark(remark);
|
|
|
|
|
- kwpSettlementLogisticsTrack.setStatus(settlementLogistics.getStatus());
|
|
|
|
|
- kwpSettlementLogisticsTrack.setCreateBy(LoginUserHolder.getUserId());
|
|
|
|
|
- kwpSettlementLogisticsTrack.setCreateTime(LocalDateTime.now());
|
|
|
|
|
- kwpSettlementLogisticsTrack.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
|
|
- kwpSettlementLogisticsTrack.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
- kwpSettlementLogisticsTrack.setDelFlag(0);
|
|
|
|
|
- kwpSettlementLogisticsTrackMapper.insert(kwpSettlementLogisticsTrack);
|
|
|
|
|
-
|
|
|
|
|
- //新增一条电子钱包结算记录
|
|
|
|
|
- remainingReceivables = remainingReceivables.subtract(price);
|
|
|
|
|
- KwpSettlementWallet kwpSettlementWallet = new KwpSettlementWallet();
|
|
|
|
|
- kwpSettlementWallet.setId(new IdWorker(1).nextId());
|
|
|
|
|
- kwpSettlementWallet.setEntId(settlementLogisticsDto.getEntId());
|
|
|
|
|
- kwpSettlementWallet.setSettlementId(settlementLogisticsDto.getId());
|
|
|
|
|
- kwpSettlementWallet.setOrderType(SettlementOrderTypeEnum.LOGISTICS.getStatus());
|
|
|
|
|
- //先用数字默认定义为1
|
|
|
|
|
- kwpSettlementWallet.setChannel(WalletChannelEnum.getValue(settlementLogisticsDto.getTrading()));
|
|
|
|
|
- kwpSettlementWallet.setPayTime(LocalDateTime.now());
|
|
|
|
|
- kwpSettlementWallet.setPayPrice(price);
|
|
|
|
|
- kwpSettlementWallet.setTopayPrice(remainingReceivables);
|
|
|
|
|
- kwpSettlementWallet.setType(SettlementPayTypeEnum.CASH_ON_DELIVERY.getStatus());
|
|
|
|
|
- kwpSettlementWallet.setRemark(Global.EMPTY_STRING);
|
|
|
|
|
- kwpSettlementWallet.setStatus(1);
|
|
|
|
|
- kwpSettlementWallet.setCreateBy(LoginUserHolder.getUserId());
|
|
|
|
|
- kwpSettlementWallet.setCreateTime(LocalDateTime.now());
|
|
|
|
|
- kwpSettlementWallet.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
|
|
- kwpSettlementWallet.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
- kwpSettlementWallet.setDelFlag(0);
|
|
|
|
|
- Integer insertKwpSettlementWallet = settlementWalletMapper.insert(kwpSettlementWallet);
|
|
|
|
|
- log.info("新增一条电子钱包结算记录:" + insertKwpSettlementWallet);
|
|
|
|
|
- //需要将金额同步到对应的对账表中
|
|
|
|
|
- KwpLedgerLogistics kwpLedgerLogistics = new KwpLedgerLogistics();
|
|
|
|
|
- kwpLedgerLogistics.setId(settlementLogisticsDto.getLLedgerId());
|
|
|
|
|
- kwpLedgerLogistics.setActualPrice(settlementLogistics.getActualPrice());
|
|
|
|
|
- kwpLedgerLogisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
|
|
-
|
|
|
|
|
- //物流货到付款电子钱包逻辑
|
|
|
|
|
- //todo 待处理费电子钱包逻辑
|
|
|
|
|
-
|
|
|
|
|
- return insertKwpSettlementWallet;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
//托运方
|
|
//托运方
|
|
|
KwpLedgerLogisticsUnit logisticsUnit = logisticsUnitService.queryCustomerEnt(settlementLogisticsDto.getLLedgerId(), LogisticsUnitType.SHIPPER);
|
|
KwpLedgerLogisticsUnit logisticsUnit = logisticsUnitService.queryCustomerEnt(settlementLogisticsDto.getLLedgerId(), LogisticsUnitType.SHIPPER);
|
|
|
- //承运方
|
|
|
|
|
|
|
+ //承运方(对账发起方,收钱方)
|
|
|
KwpLedgerLogisticsUnit logisticsUnit2 = logisticsUnitService.queryCustomerEnt(settlementLogisticsDto.getLLedgerId(), LogisticsUnitType.CARRIER);
|
|
KwpLedgerLogisticsUnit logisticsUnit2 = logisticsUnitService.queryCustomerEnt(settlementLogisticsDto.getLLedgerId(), LogisticsUnitType.CARRIER);
|
|
|
-
|
|
|
|
|
- //推送双方系统管理员
|
|
|
|
|
- messageSender.sendManager(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
- put("company", logisticsUnit.getFirmName());
|
|
|
|
|
- put("number", settlementLogisticsDto.getSlOrderNo());
|
|
|
|
|
- }}, logisticsUnit2.getEntId(), MessageEnum.SETTLEMENT_START_CARRIER);
|
|
|
|
|
- messageSender.sendManager(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
- put("company", logisticsUnit2.getFirmName());
|
|
|
|
|
- put("number", settlementLogisticsDto.getSlOrderNo());
|
|
|
|
|
- }}, logisticsUnit.getEntId(), MessageEnum.SETTLEMENT_START_SHIPPER);
|
|
|
|
|
|
|
+ String uid = walletRelationService.getRelation(logisticsUnit.getTopEntId());
|
|
|
|
|
+ if (StringUtils.isBlank(uid)) {
|
|
|
|
|
+ throw new BusinessException("我方单位暂未开通电子钱包");
|
|
|
|
|
+ }
|
|
|
|
|
+ String filter = walletRelationService.getRelation(logisticsUnit2.getTopEntId());
|
|
|
|
|
+ if (StringUtils.isBlank(filter)) {
|
|
|
|
|
+ throw new BusinessException("客户单位暂未开通电子钱包");
|
|
|
|
|
+ }
|
|
|
|
|
+ String trading = settlementLogisticsDto.getTrading();
|
|
|
|
|
+ ChannelEnum channelEnum = ChannelEnum.getByTrading(trading);
|
|
|
|
|
+ if (Objects.isNull(channelEnum)) {
|
|
|
|
|
+ throw new BusinessException("交易方式异常");
|
|
|
|
|
+ }
|
|
|
|
|
+ //加锁
|
|
|
|
|
+ String key = String.format(RedisConstant.SETTLEMENT_KEY, offlinePaymentReq.getId());
|
|
|
|
|
+ if (redisLockUtil.tryLock(key)) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ //钱包余额校验
|
|
|
|
|
+ walletBusinessService.checkMoney(uid, filter, channelEnum, price);
|
|
|
|
|
+ //累加入库结算单
|
|
|
|
|
+ KwpSettlementLogistics settlementLogistics = new KwpSettlementLogistics();
|
|
|
|
|
+ settlementLogistics.setId(settlementLogisticsDto.getId());
|
|
|
|
|
+ settlementLogistics.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
+ //全部结算
|
|
|
|
|
+ if (remainingReceivables.compareTo(price) == 0) {
|
|
|
|
|
+ settlementLogistics.setStatus(SettlementEnum.ALL_PAYMENT.getStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ //部分结算
|
|
|
|
|
+ if (remainingReceivables.compareTo(price) > 0) {
|
|
|
|
|
+ settlementLogistics.setStatus(SettlementEnum.PARTIAL_PAYMENT.getStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ BigDecimal actualPrice = settlementLogisticsDto.getActualPrice();
|
|
|
|
|
+ settlementLogistics.setActualPrice((actualPrice == null) ? price : actualPrice.add(price));
|
|
|
|
|
+ int upInt = kwpSettlementLogisticsMapper.updateById(settlementLogistics);
|
|
|
|
|
+ if (upInt > 0) {
|
|
|
|
|
+ //新增一条修改记录
|
|
|
|
|
+ String remark = LoginUserHolder.getUserName() + "[" + LoginUserHolder.getUserId() + "]" + "结算[" + settlementLogistics.getId() + "]" + settlementLogistics.getActualPrice() + "(" + SettlementEnum.getStatusDesc(settlementLogistics.getStatus()) + ")";
|
|
|
|
|
+ KwpSettlementLogisticsTrack kwpSettlementLogisticsTrack = new KwpSettlementLogisticsTrack();
|
|
|
|
|
+ kwpSettlementLogisticsTrack.setId(new IdWorker(1).nextId());
|
|
|
|
|
+ kwpSettlementLogisticsTrack.setLSettlementId(settlementLogistics.getId());
|
|
|
|
|
+ kwpSettlementLogisticsTrack.setRemark(remark);
|
|
|
|
|
+ kwpSettlementLogisticsTrack.setStatus(settlementLogistics.getStatus());
|
|
|
|
|
+ kwpSettlementLogisticsTrack.setCreateBy(LoginUserHolder.getUserId());
|
|
|
|
|
+ kwpSettlementLogisticsTrack.setCreateTime(LocalDateTime.now());
|
|
|
|
|
+ kwpSettlementLogisticsTrack.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
|
|
+ kwpSettlementLogisticsTrack.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
+ kwpSettlementLogisticsTrack.setDelFlag(0);
|
|
|
|
|
+ kwpSettlementLogisticsTrackMapper.insert(kwpSettlementLogisticsTrack);
|
|
|
|
|
+
|
|
|
|
|
+ //新增一条电子钱包结算记录
|
|
|
|
|
+ String orderNo = OrderUtils.generateOrderNo("SL");
|
|
|
|
|
+ remainingReceivables = remainingReceivables.subtract(price);
|
|
|
|
|
+ KwpSettlementWallet kwpSettlementWallet = new KwpSettlementWallet();
|
|
|
|
|
+ kwpSettlementWallet.setId(new IdWorker(1).nextId());
|
|
|
|
|
+ kwpSettlementWallet.setEntId(settlementLogisticsDto.getEntId());
|
|
|
|
|
+ kwpSettlementWallet.setOrderNo(orderNo);
|
|
|
|
|
+ kwpSettlementWallet.setSettlementId(settlementLogisticsDto.getId());
|
|
|
|
|
+ kwpSettlementWallet.setOrderType(SettlementOrderTypeEnum.LOGISTICS.getStatus());
|
|
|
|
|
+ //先用数字默认定义为1
|
|
|
|
|
+ kwpSettlementWallet.setChannel(WalletChannelEnum.getValue(settlementLogisticsDto.getTrading()));
|
|
|
|
|
+ kwpSettlementWallet.setPayTime(LocalDateTime.now());
|
|
|
|
|
+ kwpSettlementWallet.setPayPrice(price);
|
|
|
|
|
+ kwpSettlementWallet.setTopayPrice(remainingReceivables);
|
|
|
|
|
+ kwpSettlementWallet.setType(SettlementPayTypeEnum.CASH_ON_DELIVERY.getStatus());
|
|
|
|
|
+ kwpSettlementWallet.setRemark(Global.EMPTY_STRING);
|
|
|
|
|
+ kwpSettlementWallet.setStatus(1);
|
|
|
|
|
+ kwpSettlementWallet.setCreateBy(LoginUserHolder.getUserId());
|
|
|
|
|
+ kwpSettlementWallet.setCreateTime(LocalDateTime.now());
|
|
|
|
|
+ kwpSettlementWallet.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
|
|
+ kwpSettlementWallet.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
+ kwpSettlementWallet.setDelFlag(0);
|
|
|
|
|
+ Integer insertKwpSettlementWallet = settlementWalletMapper.insert(kwpSettlementWallet);
|
|
|
|
|
+ log.info("新增一条电子钱包结算记录:" + insertKwpSettlementWallet);
|
|
|
|
|
+ //需要将金额同步到对应的对账表中
|
|
|
|
|
+ KwpLedgerLogistics kwpLedgerLogistics = new KwpLedgerLogistics();
|
|
|
|
|
+ kwpLedgerLogistics.setId(settlementLogisticsDto.getLLedgerId());
|
|
|
|
|
+ kwpLedgerLogistics.setActualPrice(settlementLogistics.getActualPrice());
|
|
|
|
|
+ kwpLedgerLogisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
|
|
+
|
|
|
|
|
+ // 调用电子钱包进行清分操作
|
|
|
|
|
+ walletBusinessService.splitMoney(orderNo, uid, filter, channelEnum, price, "2");
|
|
|
|
|
+
|
|
|
|
|
+ //推送双方系统管理员
|
|
|
|
|
+ messageSender.sendManager(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit.getFirmName());
|
|
|
|
|
+ put("number", settlementLogisticsDto.getSlOrderNo());
|
|
|
|
|
+ }}, logisticsUnit2.getEntId(), MessageEnum.SETTLEMENT_START_CARRIER);
|
|
|
|
|
+ messageSender.sendManager(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit2.getFirmName());
|
|
|
|
|
+ put("number", settlementLogisticsDto.getSlOrderNo());
|
|
|
|
|
+ }}, logisticsUnit.getEntId(), MessageEnum.SETTLEMENT_START_SHIPPER);
|
|
|
|
|
+ return insertKwpSettlementWallet;
|
|
|
|
|
+ }
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ redisLockUtil.unlock(key);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -393,8 +417,7 @@ public class KwpSettlementWalletService {
|
|
|
KwpSettlementTrade kwpSettlementTrade = new KwpSettlementTrade();
|
|
KwpSettlementTrade kwpSettlementTrade = new KwpSettlementTrade();
|
|
|
kwpSettlementTrade.setId(byId.getId());
|
|
kwpSettlementTrade.setId(byId.getId());
|
|
|
kwpSettlementTrade.setActualPrice(byId.getActualPrice().add(price));
|
|
kwpSettlementTrade.setActualPrice(byId.getActualPrice().add(price));
|
|
|
- int status = subtract.compareTo(new BigDecimal("0.0")) == NumberConstant.ZERO ? SettlementEnum.ALL_PAYMENT.getStatus()
|
|
|
|
|
- : SettlementEnum.PARTIAL_PAYMENT.getStatus();
|
|
|
|
|
|
|
+ int status = subtract.compareTo(new BigDecimal("0.0")) == NumberConstant.ZERO ? SettlementEnum.ALL_PAYMENT.getStatus() : SettlementEnum.PARTIAL_PAYMENT.getStatus();
|
|
|
kwpSettlementTrade.setStatus(status);
|
|
kwpSettlementTrade.setStatus(status);
|
|
|
kwpSettlementTrade.setUpdateBy(LoginUserHolder.getUserId());
|
|
kwpSettlementTrade.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
kwpSettlementTrade.setUpdateTime(LocalDateTime.now());
|
|
kwpSettlementTrade.setUpdateTime(LocalDateTime.now());
|
|
@@ -617,33 +640,38 @@ public class KwpSettlementWalletService {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 物流,货到付款(付钱方) 查询电子钱余额
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param id
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
public WalletDto getConfirmLogisticsPayment(Long id) {
|
|
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());
|
|
|
|
|
|
|
+// 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());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -705,7 +733,7 @@ public class KwpSettlementWalletService {
|
|
|
// return BigDecimal.valueOf(data.get(NumberConstant.ZERO).getMoney() / 100.0);
|
|
// return BigDecimal.valueOf(data.get(NumberConstant.ZERO).getMoney() / 100.0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private BigDecimal getWalletBalance(List<LedgerUnitDto> listById, String trading) {
|
|
|
|
|
|
|
+ private WalletDto 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) {
|
|
@@ -728,7 +756,8 @@ public class KwpSettlementWalletService {
|
|
|
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 data.get(0);
|
|
|
|
|
+// return BigDecimal.valueOf(data.get(NumberConstant.ZERO).getMoney() / 100.0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|