|
@@ -2,16 +2,13 @@ package com.yohoufo.order.service.impl; |
|
@@ -2,16 +2,13 @@ package com.yohoufo.order.service.impl; |
2
|
|
2
|
|
3
|
import com.alibaba.fastjson.JSON;
|
3
|
import com.alibaba.fastjson.JSON;
|
4
|
import com.alibaba.fastjson.JSONObject;
|
4
|
import com.alibaba.fastjson.JSONObject;
|
|
|
5
|
+import com.yohobuy.ufo.model.order.common.Payment;
|
5
|
import com.yohoufo.common.alarm.CommonAlarmEventPublisher;
|
6
|
import com.yohoufo.common.alarm.CommonAlarmEventPublisher;
|
6
|
import com.yohoufo.common.utils.BigDecimalHelper;
|
7
|
import com.yohoufo.common.utils.BigDecimalHelper;
|
7
|
-import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
|
|
|
8
|
import com.yohoufo.dal.order.SellerOrderMetaMapper;
|
8
|
import com.yohoufo.dal.order.SellerOrderMetaMapper;
|
9
|
import com.yohoufo.dal.order.TradeBillsMapper;
|
9
|
import com.yohoufo.dal.order.TradeBillsMapper;
|
10
|
-import com.yohoufo.dal.order.model.AppraiseOrderMeta;
|
|
|
11
|
-import com.yohoufo.dal.order.model.SellerOrder;
|
|
|
12
|
import com.yohoufo.dal.order.model.SellerOrderMeta;
|
10
|
import com.yohoufo.dal.order.model.SellerOrderMeta;
|
13
|
import com.yohoufo.dal.order.model.TradeBills;
|
11
|
import com.yohoufo.dal.order.model.TradeBills;
|
14
|
-import com.yohobuy.ufo.model.order.common.Payment;
|
|
|
15
|
import com.yohoufo.order.common.BillTradeStatus;
|
12
|
import com.yohoufo.order.common.BillTradeStatus;
|
16
|
import com.yohoufo.order.constants.MetaKey;
|
13
|
import com.yohoufo.order.constants.MetaKey;
|
17
|
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
|
14
|
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
|
|
@@ -41,8 +38,6 @@ public class TradeBillsService { |
|
@@ -41,8 +38,6 @@ public class TradeBillsService { |
41
|
@Autowired
|
38
|
@Autowired
|
42
|
private ServiceOrderProcessor serviceOrderProcessor;
|
39
|
private ServiceOrderProcessor serviceOrderProcessor;
|
43
|
|
40
|
|
44
|
- @Autowired
|
|
|
45
|
- private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
|
|
|
46
|
|
41
|
|
47
|
/**
|
42
|
/**
|
48
|
* 退保证金流水记录
|
43
|
* 退保证金流水记录
|
|
@@ -62,27 +57,31 @@ public class TradeBillsService { |
|
@@ -62,27 +57,31 @@ public class TradeBillsService { |
62
|
|
57
|
|
63
|
String computeResultVal = null;
|
58
|
String computeResultVal = null;
|
64
|
|
59
|
|
|
|
60
|
+ BigDecimal earnestMoney = null;
|
|
|
61
|
+ BigDecimal systemAmount = null;
|
65
|
if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
|
62
|
if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
|
66
|
- AppraiseOrderMeta feeCondition = new AppraiseOrderMeta();
|
|
|
67
|
- feeCondition.setOrderCode(orderCode);
|
|
|
68
|
- feeCondition.setMetaKey(MetaKey.SELLER_FEE);
|
|
|
69
|
- AppraiseOrderMeta feeMeta = appraiseOrderMetaMapper.selectByOrderCode(feeCondition);
|
|
|
70
|
- computeResultVal = Objects.nonNull(feeMeta) ? feeMeta.getMetaValue() : null;
|
|
|
71
|
- logger.info("in backPayEnsureRecord isGoodsServiceOrder orderCode {} computeResultVal {}", orderCode, computeResultVal);
|
63
|
+ ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.isAppraiseOrder(orderCode);
|
|
|
64
|
+ if(!existenceNode.isExisted()){
|
|
|
65
|
+ return;
|
|
|
66
|
+ }
|
|
|
67
|
+ earnestMoney = existenceNode.getAppraiseOrder().getAmount();
|
|
|
68
|
+ systemAmount = earnestMoney.negate();
|
|
|
69
|
+ logger.info("in backPayEnsureRecord isGoodsServiceOrder orderCode {} earnestMoney {}", orderCode, computeResultVal);
|
72
|
}else {
|
70
|
}else {
|
73
|
SellerOrderMeta meta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, MetaKey.SELLER_FEE);
|
71
|
SellerOrderMeta meta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, MetaKey.SELLER_FEE);
|
74
|
computeResultVal = Objects.nonNull(meta) ? meta.getMetaValue() : null;
|
72
|
computeResultVal = Objects.nonNull(meta) ? meta.getMetaValue() : null;
|
75
|
logger.info("in backPayEnsureRecord buyerorder orderCode {} computeResultVal {}", orderCode, computeResultVal);
|
73
|
logger.info("in backPayEnsureRecord buyerorder orderCode {} computeResultVal {}", orderCode, computeResultVal);
|
|
|
74
|
+ SellerOrderComputeResult socr = JSONObject.parseObject(computeResultVal, SellerOrderComputeResult.class);
|
|
|
75
|
+ earnestMoney = socr.getEarnestMoney().getEarnestMoney();
|
|
|
76
|
+ systemAmount = calSystemAmountByComputeResult(socr);
|
76
|
}
|
77
|
}
|
77
|
|
78
|
|
78
|
- if (Objects.isNull(computeResultVal)) {
|
|
|
79
|
- logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, uid = {}, skup={}", uid, skup);
|
79
|
+ if (Objects.isNull(systemAmount) || Objects.isNull(systemAmount)) {
|
|
|
80
|
+ logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, uid = {}, orderCode {}", uid, orderCode);
|
80
|
return;
|
81
|
return;
|
81
|
}
|
82
|
}
|
82
|
try{
|
83
|
try{
|
83
|
- SellerOrderComputeResult socr = JSONObject.parseObject(computeResultVal, SellerOrderComputeResult.class);
|
|
|
84
|
- BigDecimal earnestMoney = socr.getEarnestMoney().getEarnestMoney();
|
|
|
85
|
- BigDecimal systemAmount = calSystemAmountByComputeResult(socr);
|
84
|
+
|
86
|
backPayEnsureRecord0(uid, orderCode, payType, tradeStatus, earnestMoney, systemAmount);
|
85
|
backPayEnsureRecord0(uid, orderCode, payType, tradeStatus, earnestMoney, systemAmount);
|
87
|
|
86
|
|
88
|
}catch (Exception ex){
|
87
|
}catch (Exception ex){
|