Authored by wujiexiang

Merge branch 'dev_bid' into test6.9.13

... ... @@ -41,7 +41,10 @@ public class OrderStatisticController {
OrderSummaryResp orderSummaryResp2 = ibuyerOrderService.selectOrderNumByUid(uid);
return new ApiResponse.ApiResponseBuilder().code(200).data(Lists.newArrayList(orderSummaryResp1, orderSummaryResp2)).message("查询成功").build();
//求购中
OrderSummaryResp orderSummaryResp3 = ibuyerOrderService.selectBidingOrderNumByUid(uid, "biding");
return new ApiResponse.ApiResponseBuilder().code(200).data(Lists.newArrayList(orderSummaryResp1, orderSummaryResp2, orderSummaryResp3)).message("查询成功").build();
}
@RequestMapping(params = "method=ufo.seller.orderSummary")
... ...
... ... @@ -62,7 +62,7 @@ public class BidAndSuggestPrice {
private void validateBidPriceConfig(BigDecimal prdPrice, BigDecimal minBidPrice) {
if (prdPrice.subtract(minBidPrice).doubleValue() < 0D) {
log.warn("BidPrice validate,prdPrice:{} < minBidPrice:{}", prdPrice, minBidPrice);
throw new UfoServiceException(501, "您的出价过低");
throw new UfoServiceException(501, "出价请大于等于" + minBidPrice.toPlainString());
}
}
... ... @@ -72,7 +72,7 @@ public class BidAndSuggestPrice {
* @param leastPrice 现货最低价
* @param suggestRate 建议比例
*/
public BigDecimal calculateSuggestPrice(BigDecimal leastPrice,double suggestRate) {
public BigDecimal calculateSuggestPrice(BigDecimal leastPrice, double suggestRate) {
log.info("in BidAndSuggestPrice, leastPrice:{}, suggestRate:{}", leastPrice, suggestRate);
String priceText = leastPrice.multiply(BigDecimal.valueOf(suggestRate)).setScale(0, BigDecimal.ROUND_DOWN).toPlainString();
String endNumber = "9";
... ...
... ... @@ -99,6 +99,7 @@ public abstract class AbstractBuyerOrderStateChanger<T extends RequestedStatusCh
afterChange(statusChangeBuyerOrder);
//清理缓存
cacheCleaner.cleanList(buyerOrder.getUid(), TabType.BUY.getValue());
cacheCleaner.cleanDetail(buyerOrder.getUid(), buyerOrder.getOrderCode(), TabType.BUY);
} else {
logger.warn("[{}] change order fail, order status has changed", buyerOrder.getOrderCode());
switch (operator) {
... ...
package com.yohoufo.order.service;
import com.yoho.core.dal.datasource.annotation.Database;
import com.yohobuy.ufo.model.order.common.OrderListType;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.req.SellerDeliverToDepotReq;
... ... @@ -61,6 +60,14 @@ public interface IBuyerOrderService {
*/
OrderSummaryResp selectOrderNumByUid(int uid);
/**
* 根据uid查询求购中的订单数量
*
* @param uid
* @return
*/
OrderSummaryResp selectBidingOrderNumByUid(int uid, String statKey);
boolean delete(int uid, long orderCode);
... ...
... ... @@ -51,6 +51,20 @@ public class OrderCacheService {
return cacheClient.hashGet(key, hashKey, Integer.class);
}
public void cacheStatOrderSummary(int uid, TabType actor, String statKey, Integer cnt) {
String key = CacheKeyBuilder.orderListKey(uid, actor.getValue()).getKey();
try {
cacheClient.hashPut(key, statKey, cnt, ExpiredTime.ORDER_LIST);
} catch (Exception ex) {
logger.warn("in cacheStatOrderSummary fail ,uid {} actor {} cnt {}", uid, actor, cnt);
}
}
public Integer getStatOrderSummary(int uid, TabType actor, String statKey) {
String key = CacheKeyBuilder.orderListKey(uid, actor.getValue()).getKey();
return cacheClient.hashGet(key, statKey, Integer.class);
}
public void cacheSellerSaleGoodsTabSummary(int uid,List<OrderSummaryResp> list){
TabType actor = TabType.SELL;
String key = CacheKeyBuilder.sellerSaleGoodsSummarykey(uid, actor.getValue()).getKey();
... ...
... ... @@ -786,6 +786,23 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
return null == num ? new OrderSummaryResp("buy", 0) : new OrderSummaryResp("buy", num);
}
/**
* 根据uid查询求购中的订单数量
*
* @param uid
* @return
*/
public OrderSummaryResp selectBidingOrderNumByUid(int uid, String statKey) {
Integer num = orderCacheService.getStatOrderSummary(uid, TabType.BUY, statKey);
if (num == null) {
num = buyerOrderMapper.selectCntByUidStatus(uid, Lists.newArrayList(OrderStatus.BIDING.getCode()));
}
if (num != null) {
orderCacheService.cacheStatOrderSummary(uid, TabType.BUY, statKey, num);
}
return null == num ? new OrderSummaryResp(statKey, 0) : new OrderSummaryResp(statKey, num);
}
... ...
... ... @@ -87,6 +87,7 @@ public class BuyerOrderWaitingPayCancelChanger extends AbstractBuyerOrderStateCh
List<Statement> statements = new ArrayList<>();
if (buyerOrder.isBidOrder()) {
statements.add(() -> bidOrderAfterStatement(buyerOrder));
statements.add(() -> cacheCleaner.cleanSellerAndBuyerOrderDetailAndList(buyerOrder.getSellerUid(), buyerOrder.getUid(), buyerOrder.getOrderCode()));
} else {
//nothing
}
... ... @@ -107,8 +108,8 @@ public class BuyerOrderWaitingPayCancelChanger extends AbstractBuyerOrderStateCh
int sellerUid = buyerOrder.getSellerUid();
logger.info("Transfer deposit to sellerUid:{} with depositAmount:{},because buyerOrder:{} is canceled", sellerUid, depositAmount, buyerOrderCode);
TransferMoneyRequest tmReq = buildTransferMoneyRequest4Seller(buyerUid, buyerOrderCode, sellerUid, BigDecimal.valueOf(depositAmount));
transferService.transfer(tmReq);
logger.info("Transfer deposit to sellerUid:{} with depositAmount:{} end ", sellerUid, depositAmount);
boolean result = transferService.transfer(tmReq);
logger.info("Transfer deposit to sellerUid:{} with depositAmount:{} end,result:{}", sellerUid, depositAmount, result);
}
/**
... ...