...
|
...
|
@@ -2,16 +2,13 @@ package com.yohoufo.order.service.impl; |
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yohobuy.ufo.model.order.common.Payment;
|
|
|
import com.yohoufo.common.alarm.CommonAlarmEventPublisher;
|
|
|
import com.yohoufo.common.utils.BigDecimalHelper;
|
|
|
import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
|
|
|
import com.yohoufo.dal.order.SellerOrderMetaMapper;
|
|
|
import com.yohoufo.dal.order.TradeBillsMapper;
|
|
|
import com.yohoufo.dal.order.model.AppraiseOrderMeta;
|
|
|
import com.yohoufo.dal.order.model.SellerOrder;
|
|
|
import com.yohoufo.dal.order.model.SellerOrderMeta;
|
|
|
import com.yohoufo.dal.order.model.TradeBills;
|
|
|
import com.yohobuy.ufo.model.order.common.Payment;
|
|
|
import com.yohoufo.order.common.BillTradeStatus;
|
|
|
import com.yohoufo.order.constants.MetaKey;
|
|
|
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
|
...
|
...
|
@@ -41,8 +38,6 @@ public class TradeBillsService { |
|
|
@Autowired
|
|
|
private ServiceOrderProcessor serviceOrderProcessor;
|
|
|
|
|
|
@Autowired
|
|
|
private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
|
|
|
|
|
|
/**
|
|
|
* 退保证金流水记录
|
...
|
...
|
@@ -62,27 +57,31 @@ public class TradeBillsService { |
|
|
|
|
|
String computeResultVal = null;
|
|
|
|
|
|
BigDecimal earnestMoney = null;
|
|
|
BigDecimal systemAmount = null;
|
|
|
if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
|
|
|
AppraiseOrderMeta feeCondition = new AppraiseOrderMeta();
|
|
|
feeCondition.setOrderCode(orderCode);
|
|
|
feeCondition.setMetaKey(MetaKey.SELLER_FEE);
|
|
|
AppraiseOrderMeta feeMeta = appraiseOrderMetaMapper.selectByOrderCode(feeCondition);
|
|
|
computeResultVal = Objects.nonNull(feeMeta) ? feeMeta.getMetaValue() : null;
|
|
|
logger.info("in backPayEnsureRecord isGoodsServiceOrder orderCode {} computeResultVal {}", orderCode, computeResultVal);
|
|
|
ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.isAppraiseOrder(orderCode);
|
|
|
if(!existenceNode.isExisted()){
|
|
|
return;
|
|
|
}
|
|
|
earnestMoney = existenceNode.getAppraiseOrder().getAmount();
|
|
|
systemAmount = earnestMoney.negate();
|
|
|
logger.info("in backPayEnsureRecord isGoodsServiceOrder orderCode {} earnestMoney {}", orderCode, computeResultVal);
|
|
|
}else {
|
|
|
SellerOrderMeta meta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, MetaKey.SELLER_FEE);
|
|
|
computeResultVal = Objects.nonNull(meta) ? meta.getMetaValue() : null;
|
|
|
logger.info("in backPayEnsureRecord buyerorder orderCode {} computeResultVal {}", orderCode, computeResultVal);
|
|
|
SellerOrderComputeResult socr = JSONObject.parseObject(computeResultVal, SellerOrderComputeResult.class);
|
|
|
earnestMoney = socr.getEarnestMoney().getEarnestMoney();
|
|
|
systemAmount = calSystemAmountByComputeResult(socr);
|
|
|
}
|
|
|
|
|
|
if (Objects.isNull(computeResultVal)) {
|
|
|
logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, uid = {}, skup={}", uid, skup);
|
|
|
if (Objects.isNull(systemAmount) || Objects.isNull(systemAmount)) {
|
|
|
logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, uid = {}, orderCode {}", uid, orderCode);
|
|
|
return;
|
|
|
}
|
|
|
try{
|
|
|
SellerOrderComputeResult socr = JSONObject.parseObject(computeResultVal, SellerOrderComputeResult.class);
|
|
|
BigDecimal earnestMoney = socr.getEarnestMoney().getEarnestMoney();
|
|
|
BigDecimal systemAmount = calSystemAmountByComputeResult(socr);
|
|
|
|
|
|
backPayEnsureRecord0(uid, orderCode, payType, tradeStatus, earnestMoney, systemAmount);
|
|
|
|
|
|
}catch (Exception ex){
|
...
|
...
|
|