Authored by LUOXC

Merge branch 'hotfix-bid-seller-cache' into hotfix-20191028

package com.yohoufo.order.controller;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.order.constants.CouponConstants;
import com.yohoufo.order.model.request.OfflineShoppingRequest;
import com.yohoufo.order.model.response.ComputeResponse;
import com.yohoufo.order.model.response.OfflinePaymentResponse;
... ... @@ -31,11 +32,16 @@ public class OfflineShoppingController {
@RequestMapping(params = "method=ufo.order.offlinePayment")
public ApiResponse offlinePayment(@RequestParam(name = "uid") Integer uid,
@RequestParam(name = "skup") Integer skup,
@RequestParam(name = "store_id") Integer storeId){
@RequestParam(name = "store_id") Integer storeId,
@RequestParam(value = "business_client", required = false,defaultValue = "ufo") String businessClient,
@RequestParam(name = "api_version", required = false, defaultValue = "0") int apiVersion){
OfflineShoppingRequest req = new OfflineShoppingRequest();
req.setUid(uid);
req.setSkup(skup);
req.setStoreId(storeId);
req.setCouponCodes(CouponConstants.AUTO_RECOMMENDED_COUPON_CODES);
req.setBusinessClient(businessClient);
req.setApiVersion(apiVersion);
logger.info("in ufo.order.offlinePayment, req {}", req);
OfflinePaymentResponse paymentResponse = offlineShoppingService.offlinePayment(req);
return new ApiResponse.ApiResponseBuilder().code(200).data(paymentResponse).build();
... ... @@ -50,12 +56,16 @@ public class OfflineShoppingController {
@RequestMapping(params = "method=ufo.order.offlineCompute")
public ApiResponse offlineCompute(@RequestParam(name = "uid") Integer uid,
@RequestParam(name = "skup") Integer skup,
@RequestParam(name = "coupon_code",required = false) String couponCode) {
@RequestParam(name = "coupon_code",required = false) String couponCode,
@RequestParam(name="promotionId", required = false)Integer promotionId,
@RequestParam(value = "business_client", required = false,defaultValue = "ufo") String businessClient) {
OfflineShoppingRequest req = new OfflineShoppingRequest();
req.setUid(uid);
req.setSkup(skup);
req.setCouponCodes(CouponCodeUtils.asList(couponCode));
req.setPromotionId(promotionId);
req.setBusinessClient(businessClient);
logger.info("in ufo.order.offlineCompute, req {}", req);
ComputeResponse resp = offlineShoppingService.offlineCompute(req);
... ... @@ -70,11 +80,13 @@ public class OfflineShoppingController {
public ApiResponse offlineSubmit(@RequestParam(name = "uid") Integer uid,
@RequestParam(name = "skup") Integer skup,
@RequestParam(name = "coupon_code",required = false) String couponCode,
@RequestParam(name="promotionId", required = false)Integer promotionId,
@RequestParam(name = "channelNo", required = false) String channelNo,
@RequestParam(name = "store_id") Integer storeId,
@RequestParam(name = "user_longitude") Double userLongitude,
@RequestParam(name = "user_latitude") Double userLatitude,
@RequestParam(name = "client_type", required = false) String clientType){
@RequestParam(name = "client_type", required = false) String clientType,
@RequestParam(value = "business_client", required = false,defaultValue = "ufo") String businessClient){
if(StringUtils.isBlank(channelNo)){
channelNo = "2919";
}
... ... @@ -83,12 +95,14 @@ public class OfflineShoppingController {
request.setUid(uid);
request.setSkup(skup);
request.setCouponCodes(CouponCodeUtils.asList(couponCode));
request.setPromotionId(promotionId);
request.setChannelNo(channelNo);
request.setAddressId("0"); //门店自提,不需addressId
request.setStoreId(storeId);
request.setUserLongitude(userLongitude);
request.setUserLatitude(userLatitude);
request.setClientType(clientType);
request.setBusinessClient(businessClient);
logger.info("in ufo.order.offlineSubmit, req {}", request);
OrderSubmitResponse submitResponse = offlineShoppingService.offlineSubmit(request);
... ...
... ... @@ -18,6 +18,8 @@ public class OfflinePaymentResponse extends PaymentResponse {
offlinePaymentResponse.setPaymentWay(paymentResponse.getPaymentWay());
offlinePaymentResponse.setDeliveryWay(paymentResponse.getDeliveryWay());
offlinePaymentResponse.setPromotionFormulaList(paymentResponse.getPromotionFormulaList());
offlinePaymentResponse.setRecommendedCouponInfo(paymentResponse.getRecommendedCouponInfo());
offlinePaymentResponse.setCouponList(paymentResponse.getCouponList());
offlinePaymentResponse.setDamagesDesc("店内闪购:请确保您可到指定地点进行提货,并在支付前检查商品是否完好。店内购买商品若无质量问题不支持退换。");
return offlinePaymentResponse;
... ...
... ... @@ -441,11 +441,13 @@ public class SellerOrderCancelService {
}
try {
cacheCleaner.cleanList(uid, TabType.SELL.getValue());
SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
cacheCleaner.cleanSellerDetail(psog);
//数据库中的 uid= 0,status也发生变化了,为了删除原缓存,重新设置
psog.setUid(uid);
psog.setStatus(SkupStatus.CAN_NOT_SELL.getCode());
cacheCleaner.cleanSellerOrderDetailAndList(psog, null);
} catch (Exception ex) {
logger.warn("in seller cancel waiting pay and then clean cache of list and detail fail, uid {}, skup {}",
logger.warn("in seller cancel before Buy Action clean cache of list and detail fail, uid {}, skup {}",
uid, skup, ex);
}
return 1;
... ...
... ... @@ -8,6 +8,7 @@ import com.yohobuy.ufo.model.GoodsSize;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohobuy.ufo.model.order.common.BidSkupStatus;
import com.yohobuy.ufo.model.response.BidStoragePriceResp;
import com.yohoufo.common.cache.ControllerCacheAop;
import com.yohoufo.dal.product.BidStoragePriceMapper;
import com.yohoufo.dal.product.ProductMapper;
import com.yohoufo.dal.product.model.BidStoragePrice;
... ... @@ -15,6 +16,7 @@ import com.yohoufo.dal.product.model.Product;
import com.yohoufo.dal.product.model.StoragePrice;
import com.yohoufo.product.cache.UfoProductCacheKeyEnum;
import com.yohoufo.product.cache.UfoProductCacheService;
import com.yohoufo.product.controller.ProductController;
import com.yohoufo.product.event.BidStoragePriceUpdateEvent;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
... ... @@ -47,6 +49,9 @@ public class BidProductService {
@Autowired
private StoragePriceService storagePriceService;
@Autowired
private ControllerCacheAop cacheAop;
/**
* create new bid skup
... ... @@ -261,6 +266,12 @@ public class BidProductService {
BidStoragePriceUpdateEvent bidStoragePriceUpdateEvent = new BidStoragePriceUpdateEvent(this::reSetBidStoragePriceCache);
bidStoragePriceUpdateEvent.setProductId(productId);
EventBusPublisher.publishEvent(bidStoragePriceUpdateEvent);
try {
cacheAop.clearCache(ProductController.class.getMethod("queryProductDetailTabsById", new Class[]{Integer.class, String.class}), new Object[]{productId, null});
} catch (NoSuchMethodException e) {
logger.info("method clearCache queryProductDetailTabsById wrong in productId is 【{}】", productId);
}
}
public void publishBidPriceUpdateEventEx(Integer skup) {
... ... @@ -270,6 +281,12 @@ public class BidProductService {
return;
}
publishBidPriceUpdateEvent(bidStoragePrice.getProductId());
try {
cacheAop.clearCache(ProductController.class.getMethod("queryProductDetailTabsById", new Class[]{Integer.class, String.class}), new Object[]{bidStoragePrice.getProductId(), null});
} catch (NoSuchMethodException e) {
logger.info("method clearCache queryProductDetailTabsById wrong in productId is 【{}】", bidStoragePrice.getProductId());
}
}
/**
... ...