Authored by mali

Merge branch 'test6.9.8' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.8

... ... @@ -205,7 +205,7 @@
storage_id in
<foreach item="storageId" index="index" collection="skuList" open="(" separator="," close=")">
#{storageId, jdbcType=INTEGER}
</foreach> and status = 1 and is_hide = 0 and pre_sale_flag=3 and region=1
</foreach> and status = 1 and is_hide = 0 and pre_sale_flag=3 and region=0
group by storage_id
</select>
... ...
... ... @@ -37,6 +37,7 @@ import com.yohoufo.order.service.proxy.DeliveryMinutesService;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.OrderStatusFlowService;
import com.yohoufo.order.utils.BuyerOrderUtils;
import com.yohoufo.order.utils.SellerGoodsHelper;
import com.yohoufo.order.utils.TimeUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
... ... @@ -96,6 +97,17 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
@Autowired
private AppraiseService appraiseService;
private boolean isDepositWithQuickDeliverGoods(int uid, long orderCode, Integer oa){
BuyerOrderGoods pbog = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(pbog.getSkup());
Integer goodsAttr=null ;
boolean result = BuyerOrderUtils.isDeposit(oa)
&& SellerGoodsHelper.isQuickDeliver(SkupType.getSkupType(goodsAttr=psog.getAttributes()));
logger.info("after paid isDepositWithQuickDeliverGoods, uid {} ordercode {} orderAttr {} goodsAttr {}",
uid, orderCode, oa, goodsAttr);
return result;
}
/**
* 更新订单状态
* @param orderInfo
... ... @@ -108,12 +120,16 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
buyerOrder.setUid(uid);
OrderStatus targetOrderStatus = OrderStatus.HAS_PAYED;
boolean isQuickDeliver = false;
boolean isDepositWithQuickDeliverGoods = false;
//门店订单支付后直接完成
if(BuyerOrderUtils.isOffline(orderInfo) ) {
targetOrderStatus = OrderStatus.DONE;
}else if(isQuickDeliver=BuyerOrderUtils.isQuickDeliver(orderInfo.getAttributes())){
}else if((isQuickDeliver=BuyerOrderUtils.isQuickDeliver(orderInfo.getAttributes()))
|| (isDepositWithQuickDeliverGoods = isDepositWithQuickDeliverGoods(uid, orderCode, orderInfo.getAttributes()))){
targetOrderStatus = OrderStatus.WAITING_RECEIVE;
}
logger.info("after paid updateOrderStatusPaid uid {} orderCode {} isQuickDeliver {} isDepositWithQuickDeliverGoods {} ",
uid, orderCode, isQuickDeliver, isDepositWithQuickDeliverGoods);
int orderStatusCode = targetOrderStatus.getCode();
buyerOrder.setStatus(orderStatusCode);
... ... @@ -136,24 +152,36 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
return result;
}
private void processDepositOrder(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
//寄存订单 & 闪购商品
if (SkupType.QUICK_DELIVER.getCode() == sellerOrderGoods.getAttributes()){
Integer sellerUid = null;
Integer buyerUid = null;
Long orderCode = null;
Integer skup = null;
try {
depositService.changeOwner(sellerUid = buyerOrder.getSellerUid(), skup = sellerOrderGoods.getId(),
orderCode = buyerOrder.getOrderCode(), buyerUid = buyerOrder.getUid(), true);
}catch (Exception ex){
logger.warn("pay successful, processDepositOrder invoke depositService.changeOwner fail, sellerUid {}, buyerUid {},orderCode {},skup {}",
sellerUid, buyerUid, orderCode, skup);
}
private void processDepositOrderOfQuickDeliverGoods(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
Integer sellerUid = null;
Integer buyerUid = null;
Long orderCode = null;
Integer skup = null;
try {
depositService.changeOwner(sellerUid = buyerOrder.getSellerUid(), skup = sellerOrderGoods.getId(),
orderCode = buyerOrder.getOrderCode(), buyerUid = buyerOrder.getUid(), true);
}catch (Exception ex){
logger.warn("pay successful, processDepositOrder invoke depositService.changeOwner fail, sellerUid {}, buyerUid {},orderCode {},skup {}",
sellerUid, buyerUid, orderCode, skup);
}
}
private void processDepositOrderOfInstockGoods(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
processInStockOrder(buyerOrder, sellerOrderGoods);
}
private void processDepositOrder(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
SkupType skupType = SkupType.getSkupType(sellerOrderGoods.getAttributes());
//寄存订单 & 闪购商品
switch (skupType){
case QUICK_DELIVER:
processDepositOrderOfQuickDeliverGoods(buyerOrder, sellerOrderGoods);
break;
case IN_STOCK:
processDepositOrderOfInstockGoods(buyerOrder, sellerOrderGoods);
break;
}
}
private void processInStockOrder(BuyerOrder orderInfo, SellerOrderGoods sellerOrderGoods){
... ...
... ... @@ -226,7 +226,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
GoodsInfo goodsInfo = getGoodsInfo(sellerOrderGoods);
SkupType skupType = SkupType.getSkupType(sellerOrderGoods.getAttributes());
goodsInfo.setProductName(goodsInfo.getProductName());
goodsInfo.setTypeTag(SellerGoodsHelper.buildGoodsTypeTag(BuyerOrderUtils.convertSkupTypeIfNeed(buyerOrder.getAttributes(), skupType)));
goodsInfo.setTypeTag(buildOrderTypeTag(buyerOrder.getAttributes(), skupType));
if(isOffline) {
goodsInfo.setTypeTag("门店订单");
}
... ...
... ... @@ -7,6 +7,7 @@ import com.yohobuy.ufo.model.order.common.OrderAttributes;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.constants.RegionEnum;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohobuy.ufo.model.order.common.Payment;
import com.yohoufo.dal.order.model.BuyerOrderGoods;
... ... @@ -175,4 +176,6 @@ public abstract class AbsOrderViewService {
}
}
protected abstract String buildOrderTypeTag(Integer orderAttr, SkupType skupType);
}
... ...
... ... @@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.common.OrderAttributes;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.constants.OrderConstant;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.common.helper.ImageUrlAssist;
... ... @@ -23,7 +24,9 @@ import com.yohoufo.order.model.response.OrderDetailInfo;
import com.yohoufo.order.service.IOrderDetailService;
import com.yohoufo.order.service.cache.OrderCacheService;
import com.yohoufo.order.service.handler.BuyerOrderButtonsHandler;
import com.yohoufo.order.utils.BuyerOrderUtils;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.SellerGoodsHelper;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.helpers.MessageFormatter;
... ... @@ -231,6 +234,11 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO
return logger;
}
@Override
protected String buildOrderTypeTag(Integer orderAttr, SkupType skupType) {
return SellerGoodsHelper.buildGoodsTypeTag(BuyerOrderUtils.convertSkupTypeIfNeed(orderAttr, skupType));
}
/**
* 门店订单收货人设置
* @param userAddress
... ...
... ... @@ -8,6 +8,7 @@ import com.yohobuy.ufo.model.order.common.OrderAttributes;
import com.yohobuy.ufo.model.order.common.OrderListType;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.constants.OrderConstant;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
... ... @@ -23,7 +24,9 @@ import com.yohoufo.order.model.request.OrderListRequest;
import com.yohoufo.order.service.IBuyerOrderMetaService;
import com.yohoufo.order.service.IOrderListService;
import com.yohoufo.order.service.handler.BuyerOrderButtonsHandler;
import com.yohoufo.order.utils.BuyerOrderUtils;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.SellerGoodsHelper;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -170,6 +173,11 @@ public class BuyerOrderListServiceImpl extends AbsOrderListService implements IO
return logger;
}
@Override
protected String buildOrderTypeTag(Integer orderAttr, SkupType skupType) {
return SellerGoodsHelper.buildGoodsTypeTag(BuyerOrderUtils.convertSkupTypeIfNeed(orderAttr, skupType));
}
private AddressInfo getAddressInfo(int uid, long orderCode, Integer orderStauts){
if (!ActionStatusHold.buyerCanModifyAddress(orderStauts)){
return null;
... ...
... ... @@ -533,5 +533,10 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
return logger;
}
@Override
protected String buildOrderTypeTag(Integer orderAttr, SkupType skupType) {
return SellerGoodsHelper.buildGoodsTypeTag(skupType);
}
}
... ...
... ... @@ -380,4 +380,9 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
return log;
}
@Override
protected String buildOrderTypeTag(Integer orderAttr, SkupType skupType) {
return SellerGoodsHelper.buildGoodsTypeTag(skupType);
}
}
... ...
... ... @@ -497,6 +497,7 @@ public class ShoppingServiceImpl implements IShoppingService {
.activityBo(buildOrderActivityBo(chargeResult))
.amountDetailBo(buildOrderAmountDetailBo(chargeResult))
.tariffFee(chargeResult.getTariffFee())
.depositFee(buildDepositFee(chargeGoods))
.build();
BuyerOrderSubmitResult submitResult = ordeCreationService.doSubmitOrder(orderBuilder);
... ... @@ -545,6 +546,20 @@ public class ShoppingServiceImpl implements IShoppingService {
}
private SingleFeeDetail buildDepositFee(ChargeGoods chargeGoods){
BigDecimal qdsf = chargeGoods.getQuickDeliverServiceFee();
BigDecimal smf = chargeGoods.getStorageManagementFee();
double amount = 0D;
if (Objects.nonNull(qdsf)){
amount = qdsf.doubleValue();
}
if (Objects.nonNull(smf)){
amount = smf.doubleValue();
}
SingleFeeDetail sfd = SingleFeeDetail.builder().amount(amount).build();
return sfd;
}
public static final String KEY_AREA_STR = "区";
public static final String[] REPLACE_STR = {"鉴定中心", "UFO"};
... ...
... ... @@ -143,7 +143,7 @@ public class ProductProxyService extends AbsProxyService{
public Map<Integer, BigDecimal> getFlashLeastPrice(Integer productId) {
ProductDetailResp prdResp = null;
try {
Map<Integer, BigDecimal> result = ufoServiceCaller.call(FLASH_LEAST_PRICE, productId, null);
Map<Integer, BigDecimal> result = ufoServiceCaller.call(FLASH_LEAST_PRICE, Map.class, productId);
return result;
} catch (Exception ex) {
logger.warn("getFlashLeastPrice err");
... ...
... ... @@ -24,6 +24,7 @@ import com.yohoufo.order.service.seller.OrderComputeHandler;
import com.yohoufo.order.service.seller.OrderComputeProvider;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.OrderAssist;
import com.yohoufo.order.utils.SellerGoodsHelper;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -76,15 +77,17 @@ public abstract class AbsEntryChangePricePrepareProcessor<T extends SellerBaseCh
logger.warn("ChangePrice checkAndAcquire uid illegal , req {}", req);
throw new UfoServiceException(400, "参数[uid]错误");
}
if(!sellerOrderPrepareProcessor.checkIsEntry(uid)){
SkupType skupType = SkupType.getSkupType(req.getSkupType());
boolean isQuickDeliver = SellerGoodsHelper.isQuickDeliver(skupType);
//非闪购商品需要入驻身份 =》 非入驻 时抛异常
if(!isQuickDeliver && !sellerOrderPrepareProcessor.checkIsEntry(uid)){
logger.warn("ChangePrice checkAndAcquire uid is not entry shop , req {}", req);
throw new UfoServiceException(400, "您不是入驻商家");
}
//检查是否有买家下单,返回的是可售 待买家付款的skup
Map<Integer, SkupDto> skupOfSalingMap = checkExistWaitingBuyerPay(req);
SkupType skupType = SkupType.getSkupType(req.getSkupType());
BigDecimal salePrice = priceComputePrepareProcessor.checkAndAcquireSalePrice(req.getPrice(), skupType);
//若needChangePriceSkupList中有skup出现不存在于skupOfSalingMap keys中,说明该skup走到了其他状态中
Map<Integer, SkupDto> skupMap = checkNeedProcessSkups(getExpectedSkups(req), req.getOldPrice(), salePrice, skupOfSalingMap);
... ...
package com.yohoufo.order.service.seller.processor;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohobuy.ufo.model.order.constants.OrderDetailDesc;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.order.req.SellerBatchChangeReq;
import com.yohoufo.common.exception.UfoServiceException;
... ... @@ -56,8 +57,8 @@ public class SellerDownShelfPrepareProcessor {
logger.warn("batch off shelve checkAndAcquire num is illegal, req {}", req);
throw new UfoServiceException(400, "数量不合法");
}
if (!sellerOrderPrepareProcessor.checkIsEntry(uid)) {
boolean isQuickDeliver = SellerGoodsHelper.isQuickDeliver(skupType);
if (!isQuickDeliver && !sellerOrderPrepareProcessor.checkIsEntry(uid)) {
logger.warn("batch off shelve checkAndAcquire uid is not entry shop , req {}", req);
throw new UfoServiceException(400, "您不是入驻商家");
}
... ...