|
|
package com.yohoufo.order.service.seller.deposit;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.error.ServiceError;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
|
|
|
import com.yohobuy.ufo.model.order.common.OrderAttributes;
|
|
|
import com.yohobuy.ufo.model.order.common.OrderCodeType;
|
|
|
import com.yohobuy.ufo.model.order.common.Payment;
|
|
|
import com.yohobuy.ufo.model.order.req.*;
|
|
|
import com.yohobuy.ufo.model.order.resp.DepositOrderInStorePrdListResp;
|
|
|
import com.yohobuy.ufo.model.order.resp.PageResp;
|
|
|
import com.yohobuy.ufo.model.order.resp.SellerDepositOrderComputeResp;
|
|
|
import com.yohobuy.ufo.model.order.resp.SellerDepositOrderSubmitResp;
|
|
|
import com.yohobuy.ufo.model.order.vo.AddressInfo;
|
|
|
import com.yohobuy.ufo.model.order.vo.GoodsVo;
|
|
|
import com.yohobuy.ufo.model.order.vo.ProductVo;
|
|
|
import com.yohoufo.common.alarm.EventBusPublisher;
|
|
|
import com.yohoufo.common.exception.UfoServiceException;
|
|
|
import com.yohoufo.common.utils.AddressUtil;
|
|
|
import com.yohoufo.common.utils.BigDecimalHelper;
|
|
|
import com.yohoufo.dal.order.AppraiseOrderGoodsMapper;
|
|
|
import com.yohoufo.dal.order.AppraiseOrderMapper;
|
|
|
import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
|
|
|
import com.yohoufo.dal.order.AppraiseOrderStorageMapper;
|
|
|
import com.yohoufo.dal.order.model.AppraiseOrder;
|
|
|
import com.yohoufo.dal.order.model.AppraiseOrderGoods;
|
|
|
import com.yohoufo.dal.order.model.AppraiseOrderStorage;
|
|
|
import com.yohoufo.dal.order.model.*;
|
|
|
import com.yohoufo.order.common.ClientType;
|
|
|
import com.yohoufo.order.convert.SellerOrderConvertor;
|
|
|
import com.yohoufo.order.common.DelStatus;
|
|
|
import com.yohoufo.order.constants.MetaKey;
|
|
|
import com.yohoufo.order.event.BuyerCancelEvent;
|
|
|
import com.yohoufo.order.event.OrderCancelEvent;
|
|
|
import com.yohoufo.order.event.PayConfirmEvent;
|
|
|
import com.yohoufo.order.event.SellerDepositOrderCancelAsyncEvent;
|
|
|
import com.yohoufo.order.model.PayQueryBo;
|
|
|
import com.yohoufo.order.model.dto.PlatformFeeDto;
|
|
|
import com.yohoufo.order.model.dto.SellerDepositOrderContext;
|
|
|
import com.yohoufo.order.model.dto.SellerDepositSubOrderContext;
|
|
|
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
|
|
|
import com.yohoufo.order.mq.DelayTime;
|
|
|
import com.yohoufo.order.mq.TopicConstants;
|
|
|
import com.yohoufo.order.mq.producer.TradeMqSender;
|
|
|
import com.yohoufo.order.service.DepositService;
|
|
|
import com.yohoufo.order.service.IGoodsService;
|
|
|
import com.yohoufo.order.service.impl.AbsGoodsServiceOrderService;
|
|
|
import com.yohoufo.order.service.impl.AppraiseAddressService;
|
|
|
import com.yohoufo.order.service.impl.AppraiseOrderCreateService;
|
|
|
import com.yohoufo.order.service.IPaymentService;
|
|
|
import com.yohoufo.order.service.handler.GoodsServiceRefundHandler;
|
|
|
import com.yohoufo.order.service.impl.*;
|
|
|
import com.yohoufo.order.service.pay.AbstractPayService;
|
|
|
import com.yohoufo.order.service.proxy.OrderStatusFlowService;
|
|
|
import com.yohoufo.order.service.proxy.UserProxyService;
|
|
|
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
import org.slf4j.Logger;
|
...
|
...
|
@@ -73,7 +94,14 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
@Autowired
|
|
|
private OrderStatusFlowService orderStatusFlowService;
|
|
|
|
|
|
@Autowired
|
|
|
private DepositService depositService;
|
|
|
|
|
|
@Autowired
|
|
|
private UserProxyService userProxyService;
|
|
|
|
|
|
@Autowired
|
|
|
private PayRefundService payRefundService;
|
|
|
|
|
|
|
|
|
|
...
|
...
|
@@ -84,7 +112,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
SellerDepositOrderSupport.SummaryNode summaryNode = sdos.buildList(dtNode,
|
|
|
SellerDepositOrderSupport.buildProductVoTypeRef(),
|
|
|
SellerDepositOrderSupport.buildgoodsVoTypeRef());
|
|
|
String earnestMoneystr = SellerOrderConvertor.formatFee(summaryNode.earnestMoney);
|
|
|
String earnestMoneystr = BigDecimalHelper.formatNumber(summaryNode.earnestMoney, BigDecimalHelper.FORMAT_TWOBITAFTERPOINT);
|
|
|
String tips = "温馨提示:早支付早发货早寄存早上架早出售";
|
|
|
SellerDepositOrderComputeResp resp = SellerDepositOrderComputeResp.builder()
|
|
|
.earnestMoney(earnestMoneystr)
|
...
|
...
|
@@ -100,7 +128,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
SellerDepositOrderPrepareService.DTNode dtNode = sellerDepositOrderPrepareService.checkAndAckquireBySku(req);
|
|
|
SellerOrderComputeResult socr = dtNode.getStorageIdSOCRMap().get(req.getStorageId());
|
|
|
BigDecimal total = socr.getEarnestMoney().getEarnestMoney().multiply(new BigDecimal(req.getNum()));
|
|
|
String earnestMoneystr = SellerOrderConvertor.formatFee(total);
|
|
|
String earnestMoneystr = BigDecimalHelper.formatNumber(total, BigDecimalHelper.FORMAT_TWOBITAFTERPOINT);
|
|
|
SellerDepositOrderComputeResp resp = SellerDepositOrderComputeResp.builder()
|
|
|
.earnestMoney(earnestMoneystr)
|
|
|
.build();
|
...
|
...
|
@@ -156,18 +184,106 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
return null;
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
private ServiceOrderProcessor serviceOrderProcessor;
|
|
|
|
|
|
@Autowired
|
|
|
IPaymentService paymentService;
|
|
|
|
|
|
public void cancel(SellerDepositOrderDetailReq req){
|
|
|
//TODO
|
|
|
long orderCode = req.getOrderCode();
|
|
|
if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
|
|
|
logger.warn("cancel AppraiseOrder not GoodsServiceOrder, orderCode {}", orderCode);
|
|
|
throw new UfoServiceException(400, "订单已迷路");
|
|
|
}
|
|
|
ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.isAppraiseOrder(orderCode);
|
|
|
|
|
|
if (!existenceNode.isExisted()){
|
|
|
logger.warn("cancel AppraiseOrder not exist, orderCode {}", orderCode);
|
|
|
throw new UfoServiceException(400, "订单已迷路");
|
|
|
}
|
|
|
AppraiseOrder pao = existenceNode.getAppraiseOrder();
|
|
|
|
|
|
OrderAttributes oa = OrderAttributes.getOrderAttributes(pao.getAttributes());
|
|
|
if (!OrderAttributes.DEPOSITE.equals(oa)){
|
|
|
logger.warn("cancel AppraiseOrder not deposit Order, orderCode {}", orderCode);
|
|
|
throw new UfoServiceException(400, "订单已迷路");
|
|
|
}
|
|
|
|
|
|
AppraiseOrderStatus appraiseOrderStatus = AppraiseOrderStatus.getByCode(pao.getStatus());
|
|
|
switch (appraiseOrderStatus){
|
|
|
case WAITING_PAY:
|
|
|
super.triggerStatusChange(orderCode, AppraiseOrderStatus.CANCEL_BEFORE_PAY, appraiseOrderStatus);
|
|
|
break;
|
|
|
case HAS_PAYED:
|
|
|
super.triggerStatusChange(orderCode, AppraiseOrderStatus.CANCEL_BEFORE_DELIVER, appraiseOrderStatus);
|
|
|
//refund amount
|
|
|
new GoodsServiceRefundHandler()
|
|
|
.loadLogger(logger)
|
|
|
.loadUser(pao.getUid())
|
|
|
.loadActionCase(SellerWalletDetail.Type.CANCEL_DELIVER)
|
|
|
.loadRefundAction(payRefundService::refund)
|
|
|
.loadOrder(orderCode, orderCode, pao.getPayment(), pao.getAmount())
|
|
|
.refund();
|
|
|
|
|
|
break;
|
|
|
default:
|
|
|
throw new UfoServiceException(400, "订单不支持取消");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public int cancelByTimeout(OrderCancelEvent orderCancelEvent){
|
|
|
Long orderCode = orderCancelEvent.getOrderCode();
|
|
|
int uid = orderCancelEvent.getUid();
|
|
|
if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
|
|
|
logger.warn("auto cancel AppraiseOrder not GoodsServiceOrder, orderCode {}", orderCode);
|
|
|
throw new UfoServiceException(400, "订单已迷路");
|
|
|
}
|
|
|
ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.isAppraiseOrder(orderCode);
|
|
|
|
|
|
if (!existenceNode.isExisted()){
|
|
|
logger.warn("auto cancel AppraiseOrder not exist, orderCode {}", orderCode);
|
|
|
throw new UfoServiceException(400, "订单已迷路");
|
|
|
}
|
|
|
AppraiseOrder pao = existenceNode.getAppraiseOrder();
|
|
|
|
|
|
OrderAttributes oa = OrderAttributes.getOrderAttributes(pao.getAttributes());
|
|
|
if (!OrderAttributes.DEPOSITE.equals(oa)){
|
|
|
logger.warn("auto cancel AppraiseOrder not deposit Order, orderCode {}", orderCode);
|
|
|
throw new UfoServiceException(400, "订单已迷路");
|
|
|
}
|
|
|
AppraiseOrderStatus appraiseOrderStatus = AppraiseOrderStatus.getByCode(pao.getStatus());
|
|
|
int rows = 0;
|
|
|
switch (appraiseOrderStatus){
|
|
|
case WAITING_PAY:
|
|
|
Payment payment = Payment.getPayment(pao.getPayment());
|
|
|
AbstractPayService payService = paymentService.getPayService(payment.getCode());
|
|
|
PayQueryBo payQueryBo = payService.payQuery(String.valueOf(orderCode), pao.getCreateTime());
|
|
|
|
|
|
if (payQueryBo != null && payQueryBo.isPayStatus()){
|
|
|
logger.info("seller deposit order auto cancel failed, confirm paid. uid is {}, orderCode is {}", uid, orderCode);
|
|
|
PayConfirmEvent event = new PayConfirmEvent(uid, orderCode, pao.getPayment());
|
|
|
EventBusPublisher.publishEvent(event);
|
|
|
}
|
|
|
// 如果近1分钟有预支付记录,则发送 自动取消延迟消息
|
|
|
if ( !orderCancelEvent.isFinalRetry()){
|
|
|
paymentService.checkPrePay(uid, orderCode);
|
|
|
}
|
|
|
rows = super.triggerStatusChange(orderCode, AppraiseOrderStatus.CANCEL_TIMEOUT, appraiseOrderStatus);
|
|
|
break;
|
|
|
default:
|
|
|
throw new UfoServiceException(400, "订单不支持取消");
|
|
|
}
|
|
|
|
|
|
return rows;
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public int deliver2Depot(DeliverToDepotReq req) {
|
|
|
//
|
|
|
|
|
|
int rows = super.deliver2Depot(req);
|
|
|
if (rows==0){
|
|
|
return rows;
|
...
|
...
|
@@ -205,31 +321,248 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple |
|
|
|
|
|
/**
|
|
|
* 鉴定通过
|
|
|
* @param orderCode
|
|
|
* @param pao
|
|
|
*/
|
|
|
@Override
|
|
|
public int appraisePass(long orderCode){
|
|
|
int rows = super.appraisePass(orderCode);
|
|
|
public int appraisePass(AppraiseOrder pao){
|
|
|
int rows = super.appraisePass(pao);
|
|
|
if (rows == 0){
|
|
|
return rows;
|
|
|
}
|
|
|
Long orderCode = pao.getOrderCode();
|
|
|
Long paidCode = pao.getParentOrderCode();
|
|
|
|
|
|
BigDecimal left = calLeftMoney(pao.getAmount(), orderCode);
|
|
|
if (left.compareTo(BigDecimal.ZERO)>0){
|
|
|
|
|
|
//refund amount
|
|
|
new GoodsServiceRefundHandler()
|
|
|
.loadLogger(logger)
|
|
|
.loadUser(pao.getUid())
|
|
|
.loadActionCase(SellerWalletDetail.Type.APPRAISE_OK)
|
|
|
.loadRefundAction(payRefundService::refund)
|
|
|
.loadOrder(orderCode, paidCode, pao.getPayment(), left)
|
|
|
.refund();
|
|
|
}
|
|
|
|
|
|
return rows;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 鉴别为假
|
|
|
* 完好正品 仓储费:10元/45天 鉴定费:15元 包装费:6元 剩余保证金退回
|
|
|
* @param amount
|
|
|
* @param orderCode
|
|
|
* @return
|
|
|
*/
|
|
|
private BigDecimal calLeftMoney(BigDecimal amount, Long orderCode){
|
|
|
AppraiseOrderMeta feeCondition = new AppraiseOrderMeta();
|
|
|
feeCondition.setOrderCode(orderCode);
|
|
|
feeCondition.setMetaKey(MetaKey.SELLER_FEE);
|
|
|
BigDecimal totalOfPlatform = new BigDecimal(35);
|
|
|
try {
|
|
|
AppraiseOrderMeta feeMeta = appraiseOrderMetaMapper.selectByOrderCode(feeCondition);
|
|
|
SellerOrderComputeResult socr = JSONObject.parseObject(feeMeta.getMetaValue(), SellerOrderComputeResult.class);
|
|
|
PlatformFeeDto platformFeeDto = socr.getPlatformFee();
|
|
|
totalOfPlatform = platformFeeDto.getTotal();
|
|
|
}catch (Exception ex){
|
|
|
logger.warn("calLeftMoney 4 seller deposit order fail use default totalOfPlatform {} orderCode {}", totalOfPlatform, orderCode, ex);
|
|
|
}
|
|
|
if (totalOfPlatform.compareTo(BigDecimal.ZERO)<0){
|
|
|
totalOfPlatform = BigDecimal.ZERO;
|
|
|
}
|
|
|
BigDecimal left = amount.subtract(totalOfPlatform);
|
|
|
if (left.compareTo(BigDecimal.ZERO) <= 0){
|
|
|
left = BigDecimal.ZERO;
|
|
|
}else {
|
|
|
//format
|
|
|
left = BigDecimalHelper.halfUp(left);
|
|
|
}
|
|
|
logger.info("calLeftMoney 4 seller deposit order,orderCode {} ,amount {}, totalOfPlatform {}, left {}",
|
|
|
orderCode, amount, totalOfPlatform, left);
|
|
|
return left;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 鉴别为假
|
|
|
* @param appraiseOrder
|
|
|
*/
|
|
|
@Override
|
|
|
public int appraiseFake(long orderCode){
|
|
|
int rows = super.appraiseFake(orderCode);
|
|
|
public int appraiseFake(AppraiseOrder appraiseOrder){
|
|
|
int rows = super.appraiseFake(appraiseOrder);
|
|
|
if (rows == 0){
|
|
|
return rows;
|
|
|
}
|
|
|
depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
|
|
|
return rows;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 无法鉴别
|
|
|
* @param orderCode
|
|
|
* @param appraiseOrder
|
|
|
*/
|
|
|
@Override
|
|
|
public int unsure(AppraiseOrder appraiseOrder){
|
|
|
int rows = super.unsure(appraiseOrder);
|
|
|
if (rows == 0){
|
|
|
return rows;
|
|
|
}
|
|
|
depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
|
|
|
return rows;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 确认收货环节发现少件,取消订单保证金原路退回
|
|
|
* @param appraiseOrder
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public int unsure(long orderCode){
|
|
|
int rows = super.unsure(orderCode);
|
|
|
public int shamDeliver(AppraiseOrder appraiseOrder){
|
|
|
int rows = super.shamDeliver(appraiseOrder);
|
|
|
if (rows == 0){
|
|
|
return rows;
|
|
|
}
|
|
|
//refund amount
|
|
|
new GoodsServiceRefundHandler()
|
|
|
.loadLogger(logger)
|
|
|
.loadUser(appraiseOrder.getUid())
|
|
|
.loadActionCase(SellerWalletDetail.Type.SELLER_SHAM_SEND_OUT)
|
|
|
.loadRefundAction(payRefundService::refund)
|
|
|
.loadOrder(appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode(), appraiseOrder.getPayment(), appraiseOrder.getAmount())
|
|
|
.refund();
|
|
|
depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
|
|
|
return rows;
|
|
|
}
|
|
|
|
|
|
|
|
|
public void addOrModifyAddress(int uid, Long orderCode, String addressIdstr) {
|
|
|
int addressId = AddressUtil.getDecryptStr(addressIdstr);
|
|
|
if (addressId < 0){
|
|
|
logger.warn("addOrModifyAddress addressId invalidate, uid {}, orderCode {}, addressId is {}",
|
|
|
uid, orderCode, addressIdstr);
|
|
|
throw new ServiceException(ServiceError.ORDER_ADDRESSID_INVALIDATE);
|
|
|
}
|
|
|
AppraiseOrder pbo = appraiseOrderMapper.selectByOrderCode(orderCode);
|
|
|
if (pbo == null ){
|
|
|
logger.warn("in addOrModifyAddress AppraiseOrder is null,uid {} orderCode {} addressIdstr {}",
|
|
|
uid, orderCode, addressIdstr);
|
|
|
return;
|
|
|
}
|
|
|
Integer oa;
|
|
|
if (OrderAttributes.DEPOSITE.getCode() != (oa=pbo.getAttributes())){
|
|
|
logger.warn("in addOrModifyAddress AppraiseOrder.Attributes is {},uid {} orderCode {} addressIdstr {}",
|
|
|
oa, uid, orderCode, addressIdstr);
|
|
|
return;
|
|
|
}
|
|
|
MetaAddressService.ActionCallBack<AppraiseOrderMeta> callBack = new MetaAddressService.ActionCallBack<AppraiseOrderMeta>() {
|
|
|
@Override
|
|
|
public List<AppraiseOrderMeta> selectByMetaKeys(int uid, long orderCode, List<String> metaKeys) {
|
|
|
List<AppraiseOrderMeta> pboms = appraiseOrderMetaMapper.selectByOrderCodeMetaKeys(orderCode, metaKeys);
|
|
|
return pboms;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void insertBatch(List<AppraiseOrderMeta> list) {
|
|
|
appraiseOrderMetaMapper.insertBatch(list);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void insert(AppraiseOrderMeta appraiseOrderMeta) {
|
|
|
appraiseOrderMetaMapper.insert(appraiseOrderMeta);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void updateMetaVal(AppraiseOrderMeta appraiseOrderMeta) {
|
|
|
appraiseOrderMetaMapper.updateMetaValueByOrderCodeAndMetaKey(appraiseOrderMeta);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public AddressInfo hiddenBackAddress(int uid, int addressId) {
|
|
|
return userProxyService.getHiddenAddressInfo(uid, addressId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public AddressInfo noHiddenBackAddress(int uid, int addressId) {
|
|
|
return userProxyService.getAddressInfoNotHidden(uid, addressId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public AppraiseOrderMeta buildnoHiddenAddressMeta(int uid, long orderCode, String key, AddressInfo noHiddenBackAddress) {
|
|
|
AppraiseOrderMeta noHiddenAddressMeta = new AppraiseOrderMeta();
|
|
|
noHiddenAddressMeta.setUid(uid);
|
|
|
noHiddenAddressMeta.setOrderCode(orderCode);
|
|
|
noHiddenAddressMeta.setMetaKey(key);
|
|
|
noHiddenAddressMeta.setMetaValue(JSONObject.toJSONString(noHiddenBackAddress));
|
|
|
return noHiddenAddressMeta;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public AppraiseOrderMeta buildHiddenAddressMeta(int uid, long orderCode, String hiddenKey, AddressInfo hiddenBackAddress) {
|
|
|
AppraiseOrderMeta hiddenAddressMeta=new AppraiseOrderMeta();
|
|
|
hiddenAddressMeta.setUid(uid);
|
|
|
hiddenAddressMeta.setOrderCode(orderCode);
|
|
|
hiddenAddressMeta.setMetaKey(hiddenKey);
|
|
|
hiddenAddressMeta.setMetaValue(JSONObject.toJSONString(hiddenBackAddress));
|
|
|
return hiddenAddressMeta;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean hitHidden(AppraiseOrderMeta appraiseOrderMeta, String hidden_key) {
|
|
|
return appraiseOrderMeta.getMetaKey().equals(hidden_key);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean hitNoHidden(AppraiseOrderMeta appraiseOrderMeta, String noHiddenKey) {
|
|
|
return appraiseOrderMeta.getMetaKey().equals(noHiddenKey);
|
|
|
}
|
|
|
};
|
|
|
new MetaAddressService().modifyAddressOfDepositOrder(uid, orderCode, addressIdstr, callBack);
|
|
|
|
|
|
}
|
|
|
|
|
|
public int deleteVisuable(int uid, long orderCode){
|
|
|
logger.info("in delete deposit order Visuable uid {} orderCode {}", uid, orderCode);
|
|
|
AppraiseOrder condition = new AppraiseOrder();
|
|
|
condition.setOrderCode(orderCode);
|
|
|
condition.setIsDel(DelStatus.IS_DEL.getCode());
|
|
|
int rows = appraiseOrderMapper.updateByOrderCode(condition);
|
|
|
logger.info("in delete deposit order Visuable uid {} orderCode {} rows {}", uid, orderCode, rows);
|
|
|
return rows;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 瑕疵
|
|
|
* 退回对应保证金至卖家账户
|
|
|
* @param appraiseOrder
|
|
|
* @return
|
|
|
*/
|
|
|
public int findFlaw(AppraiseOrder appraiseOrder){
|
|
|
int rows = super.findFlaw(appraiseOrder);
|
|
|
if (rows == 0){
|
|
|
return rows;
|
|
|
}
|
|
|
new GoodsServiceRefundHandler()
|
|
|
.loadLogger(logger)
|
|
|
.loadUser(appraiseOrder.getUid())
|
|
|
.loadActionCase(SellerWalletDetail.Type.FLAW)
|
|
|
.loadRefundAction(payRefundService::refund)
|
|
|
.loadOrder(appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode(), appraiseOrder.getPayment(), appraiseOrder.getAmount())
|
|
|
.refund();
|
|
|
depositService.insertFakeDeposit(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), appraiseOrder.getParentOrderCode());
|
|
|
return rows;
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
private TradeMqSender tradeMqSender;
|
|
|
|
|
|
public boolean handleOrderCancelAsyncEvent(SellerDepositOrderCancelAsyncEvent event) {
|
|
|
logger.info("Subscribe Buyer timeout cancel delay msg, event {}", event);
|
|
|
OrderCancelEvent orderCancelEvent = OrderCancelEvent.builder()
|
|
|
.uid(event.getUid())
|
|
|
.orderCode(event.getOrderCode())
|
|
|
.payExpire(DelayTime.SELLER_DEPOSIT_ORDER_PAY_TIME_LIMIT)
|
|
|
.build();
|
|
|
tradeMqSender.send(TopicConstants.SELLER_DEPOSIT_ORDER_AUTO_CANCEL, orderCancelEvent, DelayTime.SELLER_DEPOSIT_ORDER_PAY_TIME_LIMIT);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|