|
|
@@ -1,7 +1,10 @@
|
|
|
package com.sckw.payment.service.dubbo;
|
|
|
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
+import com.sckw.core.utils.OrderUtils;
|
|
|
+import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.payment.api.dubbo.PaymentDubboService;
|
|
|
+import com.sckw.payment.api.model.constant.ChannelEnum;
|
|
|
import com.sckw.payment.api.model.constant.OrderEnum;
|
|
|
import com.sckw.payment.api.model.dto.LedgerCount;
|
|
|
import com.sckw.payment.api.model.dto.SettlementMoney;
|
|
|
@@ -9,10 +12,7 @@ import com.sckw.payment.model.constant.LogisticsUnitType;
|
|
|
import com.sckw.payment.model.constant.TradeUnitType;
|
|
|
import com.sckw.payment.model.dto.LedgerSize;
|
|
|
import com.sckw.payment.model.dto.MoneyType;
|
|
|
-import com.sckw.payment.service.KwpLedgerLogisticsService;
|
|
|
-import com.sckw.payment.service.KwpLedgerTradeService;
|
|
|
-import com.sckw.payment.service.KwpSettlementLogisticsService;
|
|
|
-import com.sckw.payment.service.KwpSettlementTradeService;
|
|
|
+import com.sckw.payment.service.*;
|
|
|
import com.sckw.payment.utils.DateTimeUtil;
|
|
|
import com.sckw.payment.utils.DecimalUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
@@ -38,6 +38,8 @@ public class PaymentDubboServiceImpl implements PaymentDubboService {
|
|
|
private final KwpLedgerTradeService kwpLedgerTradeService;
|
|
|
private final KwpSettlementLogisticsService kwpSettlementLogisticsService;
|
|
|
private final KwpSettlementTradeService kwpSettlementTradeService;
|
|
|
+ private final WalletService walletService;
|
|
|
+ private final KwpTradeFreezeService kwpTradeFreezeService;
|
|
|
|
|
|
|
|
|
private SettlementMoney change(List<MoneyType> moneyType) {
|
|
|
@@ -56,6 +58,35 @@ public class PaymentDubboServiceImpl implements PaymentDubboService {
|
|
|
return new SettlementMoney(df.format(curMoney), df.format(preMoney), percent, flag);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpResult freezeMoney(Long payEntId, ChannelEnum channel, Long receiveEntId, BigDecimal money, Long tOrderId) {
|
|
|
+ if (Objects.isNull(payEntId)) {
|
|
|
+ return HttpResult.error("支付企业不能为空");
|
|
|
+ }
|
|
|
+ if (Objects.isNull(channel)) {
|
|
|
+ return HttpResult.error("支付企业不能为空");
|
|
|
+ }
|
|
|
+ if (Objects.isNull(receiveEntId)) {
|
|
|
+ return HttpResult.error("收款企业不能为空");
|
|
|
+ }
|
|
|
+ if (Objects.isNull(money)) {
|
|
|
+ return HttpResult.error("订单金额不能为空");
|
|
|
+ }
|
|
|
+ long m;
|
|
|
+ try {
|
|
|
+ m = money.multiply(new BigDecimal("100")).longValueExact();
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("金额转换异常:{}", e.getMessage(), e);
|
|
|
+ return HttpResult.error("金额异常");
|
|
|
+ }
|
|
|
+ //settlementTradeFreeze冻结订单编号规则
|
|
|
+ String orderNo = OrderUtils.generateOrderNo("STF");
|
|
|
+ HttpResult httpResult = walletService.freezeMoney(payEntId, channel, receiveEntId, m, orderNo);
|
|
|
+ //记录订单流水号
|
|
|
+ kwpTradeFreezeService.save(tOrderId, orderNo);
|
|
|
+ return httpResult;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Map<OrderEnum, List<String>> checkLedger(Long entId, Long entTarget) {
|
|
|
if (Objects.isNull(entId) || Objects.isNull(entTarget)) {
|