Authored by sailing-PC\sailing

clean cache

... ... @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
import com.yohoufo.dal.order.BuyerOrderMapper;
... ... @@ -23,6 +24,8 @@ import com.yohoufo.order.model.AddressInfo;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.model.response.PrepayResponse;
import com.yohoufo.order.service.cache.CacheCleaner;
import com.yohoufo.order.service.cache.CacheKeyBuilder;
import com.yohoufo.order.service.impl.SellerAddressService;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.utils.SmsHelper;
... ... @@ -59,6 +62,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
@Autowired
private SellerAddressService sellerAddressService;
@Autowired
private CacheCleaner cacheCleaner;
/**
* 更新订单状态
* @param orderInfo
... ... @@ -98,6 +104,11 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
inBoxFacade.buyerFinishPaid(orderInfo.getUid(), orderInfo.getOrderCode());
cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()),
CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()),
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderInfo.getOrderCode()),
CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderInfo.getOrderCode())));
}
... ...
... ... @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.SellerOrderMapper;
import com.yohoufo.dal.order.SellerOrderMetaMapper;
... ... @@ -18,6 +19,8 @@ import com.yohoufo.order.constants.MetaKey;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.model.response.PrepayResponse;
import com.yohoufo.order.service.cache.CacheCleaner;
import com.yohoufo.order.service.cache.CacheKeyBuilder;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.ProductProxyService;
import org.apache.commons.lang3.StringUtils;
... ... @@ -26,6 +29,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Objects;
... ... @@ -50,6 +54,8 @@ public class SellerOrderPaymentService extends AbstractOrderPaymentService {
@Autowired
private InBoxFacade inBoxFacade;
@Autowired
private CacheCleaner cacheCleaner;
/**
* 更新订单状态
* @param orderInfo
... ... @@ -84,12 +90,17 @@ public class SellerOrderPaymentService extends AbstractOrderPaymentService {
public void processAfterPay(OrderInfo orderInfo) {
logger.info("method com.yohoufo.order.service.SellerOrderPaymentService.processAfterPay in, orderInfo is {}", orderInfo);
String prdName = null;
int sellerUid;
SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCode(orderInfo.getOrderCode());
if (Objects.nonNull(sellerOrder)){
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(sellerOrder.getSkup());
prdName = sellerOrderGoods.getProductName();
}
inBoxFacade.sellerPaidEarnestMoney(orderInfo.getUid(), prdName);
inBoxFacade.sellerPaidEarnestMoney(sellerUid=orderInfo.getUid(), prdName);
cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()),
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderInfo.getOrderCode())
));
}
... ...
... ... @@ -86,13 +86,17 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
DataNode node = checkStatusAndRequest(orderRequest, expectStatus);
int uid;
long orderCode;
int sellerUid = node.buyerOrderInDB.getSellerUid();
// TODO 更新状态为已收货、SKUP的状态应该还是已出售
if (1 == buyerOrderMapper.updateStatusByOrderCode(orderCode=orderRequest.getOrderCode(), uid=orderRequest.getUid(),
expectStatus.getCode(),
OrderStatus.DONE.getCode(),
DateUtil.getCurrentTimeSecond())) {
cacheCleaner.cleanDetail(uid, orderCode, TabType.BUY);
cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()),
CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()),
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode)));
} else {
throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE); // 更新失败,可能是因为订单状态已经被并发修改
}
... ...
... ... @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.core.rabbitmq.YhProducer;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo;
import com.yohoufo.common.constant.ExpressInfoConstant;
... ... @@ -18,6 +19,8 @@ import com.yohoufo.order.model.AddressInfo;
import com.yohoufo.order.model.response.AppraiseAddressResp;
import com.yohoufo.order.service.IExpressCompanyService;
import com.yohoufo.order.service.IExpressInfoService;
import com.yohoufo.order.service.cache.CacheCleaner;
import com.yohoufo.order.service.cache.CacheKeyBuilder;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.ProductProxyService;
import org.apache.commons.collections.CollectionUtils;
... ... @@ -74,6 +77,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
@Autowired
InBoxFacade inBoxFacade;
@Autowired
private CacheCleaner cacheCleaner;
//private static String EXPRESS_MQ_SEND = "logistics.logistics_data";
private static String EXPRESS_MQ_SEND = "order.updateChangeRefundOrderExpressInfo";
... ... @@ -101,9 +107,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
LOGGER.warn("deliverToDepot getOrderInfo order not exist, orderCode is {}", orderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
}
int buyerUid;
//获取skup
BuyerOrderGoods buyerOrderGoods= buyerOrderGoodsMapper.selectByOrderCode(buyerOrder.getUid(),orderCode);
BuyerOrderGoods buyerOrderGoods= buyerOrderGoodsMapper.selectByOrderCode(buyerUid=buyerOrder.getUid(),orderCode);
if(buyerOrderGoods==null){
LOGGER.warn("deliverToDepot buyerOrderGoods order not exist, orderCode is {}", orderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
... ... @@ -132,9 +138,10 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
//
SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()),
CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()),
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(buyerUid,TabType.BUY.getValue(), orderCode)));
}
@Override
... ...
... ... @@ -6,6 +6,9 @@ import com.yoho.core.dal.datasource.annotation.Database;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yoho.tools.common.beans.ApiResponse;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.constants.OrderConstant;
import com.yohobuy.ufo.model.order.req.ManualDealRequest;
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
import com.yohoufo.common.alarm.CommonAlarmEventPublisher;
... ... @@ -13,11 +16,8 @@ import com.yohoufo.common.caller.UfoServiceCaller;
import com.yohoufo.common.utils.TimeUtils;
import com.yohoufo.dal.order.*;
import com.yohoufo.dal.order.model.*;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohoufo.order.common.Payment;
import com.yohobuy.ufo.model.order.constants.OrderConstant;
import com.yohoufo.order.constants.RefundContant;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohoufo.order.model.PayQueryBo;
import com.yohoufo.order.model.PayRefundBo;
import com.yohoufo.order.model.PaymentData;
... ... @@ -101,6 +101,7 @@ public class PaymentServiceImpl implements IPaymentService {
@Autowired
TradeBillsMapper tradeBillsMapper;
/**
* 获取主场的订单service
* @param codeMeta
... ...