Authored by tanling

清理gw的ufo缓存

... ... @@ -40,16 +40,7 @@ public class BuyerOrderController {
private SellerFeeService sellerFeeService;
@RequestMapping(params = "method=ufo.buyer.orderNums")
@ResponseBody
@IgnoreSession
@IgnoreSignature
// @InnerApi
public BuyerOrderNums getBuyerOrderNums(@RequestParam("uid") int uid){
BuyerOrderNums buyerOrderNums = buyerOrderService.getBuyerOrderNums(uid);
return buyerOrderNums;
}
/**
* [购买]订单列表
... ...
package com.yohoufo.order.controller;
import com.yohobuy.ufo.model.order.resp.BuyerOrderNums;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.order.service.IBuyerOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/erpUfo")
public class ErpGWOrderController {
@Autowired
IBuyerOrderService buyerOrderService;
@RequestMapping(params = "method=ufo.buyer.orderNums")
@ResponseBody
@IgnoreSession
public BuyerOrderNums getBuyerOrderNums(@RequestParam("uid") int uid){
BuyerOrderNums buyerOrderNums = buyerOrderService.getBuyerOrderNums(uid);
return buyerOrderNums;
}
}
... ...
package com.yohoufo.order.event;
import com.yohoufo.common.alarm.Event;
public class ErpBuyerOrderEvent extends Event {
private int uid;
public ErpBuyerOrderEvent(int uid) {
this.uid = uid;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
}
... ...
... ... @@ -19,6 +19,7 @@ import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.event.DeliverNoticeEvent;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.event.SellerCancelDeliverEvent;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohoufo.order.model.request.PaymentRequest;
... ... @@ -114,6 +115,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderInfo.getOrderCode()),
CacheKeyBuilder.buyerOrderNums(uid)));
ErpBuyerOrderEvent erpEvent = new ErpBuyerOrderEvent(uid);
EventBusPublisher.publishEvent(erpEvent);
}
... ...
package com.yohoufo.order.service.handler;
import com.google.common.eventbus.Subscribe;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yoho.core.rest.client.ServiceCaller;
import com.yohoufo.common.alarm.IEventHandler;
import com.yohoufo.order.event.PayConfirmEvent;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.service.IPaymentService;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
public class CleanGWOrderNumsEventHandler implements IEventHandler<PayConfirmEvent> {
public class CleanGWOrderNumsEventHandler implements IEventHandler<ErpBuyerOrderEvent> {
final Logger logger = LoggerFactory.getLogger(getClass());
@Resource
ServiceCaller serviceCaller;
@Value("${yoho.gateway.url:http://service.yoho.yohoops.org}")
String yoho_gateway;
@Subscribe
@Override
public void handle(PayConfirmEvent event) {
public void handle(ErpBuyerOrderEvent event) {
if (event.getUid() < 0){
return;
}
logger.info("clean gw ufo order uid is {}", event.getUid());
serviceCaller.get("clean.buyerOrderNums", clearGWIndexUfo(event.getUid()), null, null, null);
}
private String clearGWIndexUfo(int uid){
StringBuilder sb = new StringBuilder(yoho_gateway);
sb.append("?");
sb.append("method=app.clean.ufoOrder");
sb.append("&client_type=h5");
sb.append("&uid=");
sb.append(uid);
return sb.toString();
}
}
\ No newline at end of file
... ...
... ... @@ -20,6 +20,7 @@ import com.yohoufo.order.constants.AlarmConfig;
import com.yohoufo.order.event.BillLogEvent;
import com.yohoufo.order.event.BuyerConfirmEvent;
import com.yohoufo.order.event.BuyerRefundCouponEvent;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.model.request.TransferMoneyRequest;
import com.yohoufo.order.model.response.AppraiseAddressResp;
... ... @@ -213,6 +214,9 @@ public class AppraiseService {
CacheKeyBuilder.orderDetailKey(buyerUid,TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
LOGGER.info("in appraiseSuccess, refund earnestMoney finish, seller {}, order code {}, skup {}, earnestMoney {}",
sellerUid, sellerOrderCode, skup, earnestMoney );
... ... @@ -360,6 +364,10 @@ public class AppraiseService {
CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
//将卖家的保证金分账给平台和买家
TransferCase transferCase = TransferCase.APPRAISE_FAIL;
TransferMoneyRequest tmReq = TransferMoneyRequest.builder().buyerOrderCode(orderCode)
... ...
... ... @@ -19,6 +19,7 @@ import com.yohoufo.order.common.TransferCase;
import com.yohoufo.order.event.BeforeDepotReceiveEvent;
import com.yohoufo.order.event.BeforeSellerDeliverEvent;
import com.yohoufo.order.event.BillLogEvent;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.model.PayRefundBo;
import com.yohoufo.order.model.bo.CouponBo;
import com.yohoufo.order.model.request.PaymentRequest;
... ... @@ -132,6 +133,10 @@ public class BuyerOrderCancelService {
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
logger.info("use one thread to execute buyer cancel BeforeSellerDeliver buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}",
buyerUid, orderCode, skup, compensate, transferCase);
}
... ... @@ -188,6 +193,10 @@ public class BuyerOrderCancelService {
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
logger.info("use one thread to execute buyer cancel BeforeDepotReceive buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}",
buyerUid, orderCode, skup, compensate, transferCase);
}
... ...
... ... @@ -31,6 +31,7 @@ import com.yohoufo.order.common.Payment;
import com.yohoufo.order.event.BeforeDepotReceiveEvent;
import com.yohoufo.order.event.BeforeSellerDeliverEvent;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.event.PayConfirmEvent;
import com.yohoufo.order.model.PayQueryBo;
import com.yohoufo.order.model.request.OrderListRequest;
... ... @@ -126,6 +127,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(uid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(uid);
EventBusPublisher.publishEvent(event);
} else {
throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE); // 更新失败,可能是因为订单状态已经被并发修改
}
... ... @@ -407,6 +411,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
}
... ... @@ -638,7 +645,11 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()),
CacheKeyBuilder.sellerOrderDetailKey(sellerOrderGoods),
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode)));
CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(uid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(uid);
EventBusPublisher.publishEvent(event);
}
}
... ...
... ... @@ -10,6 +10,7 @@ import com.yohobuy.ufo.model.order.common.OrderStatus;
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.alarm.EventBusPublisher;
import com.yohoufo.common.constant.EnumExpressSender;
import com.yohoufo.common.constant.ExpressInfoConstant;
import com.yohoufo.common.exception.UfoServiceException;
... ... @@ -19,6 +20,7 @@ import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.common.ExpressForMqSend;
import com.yohoufo.order.constants.MetaKey;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.model.response.AppraiseAddressResp;
import com.yohoufo.order.service.IExpressCompanyService;
import com.yohoufo.order.service.IExpressInfoService;
... ... @@ -159,6 +161,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(buyerUid,TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
}
LOGGER.info("deliverToDepot update buyer order status result {} ",updateBuyerCnt);
... ...
... ... @@ -443,6 +443,9 @@ public class SellerOrderCancelService {
CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), buyerOrderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
//update seller order
SellerOrderStatus targetSOStatus;
targetSOStatus = SellerOrderStatus.PLAY_BUYER;
... ...
... ... @@ -20,6 +20,7 @@ import com.yohoufo.order.charge.model.ChargeParam;
import com.yohoufo.order.charge.model.ChargeResult;
import com.yohoufo.order.charge.model.CouponMatchResult;
import com.yohoufo.order.event.BuyerCancelEvent;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.event.NotPaidNoticeEvent;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.order.model.bo.CouponBo;
... ... @@ -301,6 +302,10 @@ public class ShoppingServiceImpl implements IShoppingService {
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), sellerOrderCode),
CacheKeyBuilder.buyerOrderNums(shoppingRequest.getUid())
));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(uid);
EventBusPublisher.publishEvent(event);
NotPaidNoticeEvent notPaidNoticeEvent = NotPaidNoticeEvent.builder().actorType(TabType.BUY)
.uid(shoppingRequest.getUid()).orderCode(orderCode).build();
EventBusPublisher.publishEvent(notPaidNoticeEvent);
... ...
... ... @@ -58,25 +58,6 @@ public class CouponController {
/**
* 个人中心优惠券数量,给内部用接口
* @param uid
* @return
*/
@RequestMapping(params = "method=ufo.coupons.innerCnt")
@ResponseBody
@IgnoreSession
@IgnoreSignature
// @InnerApi
public ApiResponse queryCouponInnerCnt(@RequestParam(value = "uid") Integer uid) {
logger.info("query user coupons cnt, uid: {}", uid);
int couponCnt = couponService.queryCouponCnt(uid);
logger.info("query user coupons cnt uid: {}, v: {}", uid, couponCnt);
return new ApiResponse.ApiResponseBuilder().code(200).data(couponCnt).build();
}
/**
* 领券接口
* @param uid
* @return
... ...
package com.yohoufo.promotion.controller;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.promotion.service.ICouponService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/erpUfo")
public class ErpGWCouponController {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
ICouponService couponService;
/**
* 给gw使用
* @param uid
* @return
*/
@RequestMapping(params = "method=ufo.coupons.innerCnt")
@ResponseBody
@IgnoreSession
public ApiResponse queryCouponInnerCnt(@RequestParam(value = "uid") Integer uid) {
logger.info("query inner user coupons cnt, uid: {}", uid);
int couponCnt = couponService.queryCouponCnt(uid);
logger.info("query inner user coupons cnt uid: {}, v: {}", uid, couponCnt);
return new ApiResponse.ApiResponseBuilder().code(200).data(couponCnt).build();
}
}
... ...