Authored by LUOXC

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

Showing 32 changed files with 347 additions and 64 deletions
... ... @@ -4,7 +4,8 @@
# path: /gateway/common/ok.jsp
############################################################
FROM ccr.ccs.tencentyun.com/yoho-base/tomcat:8.5.4
# FROM ccr.ccs.tencentyun.com/yoho-base/tomcat:8.5.4
FROM ccr.ccs.tencentyun.com/yoho-base/tomcat:8.5.42-jdk8-openjdk-slim-fix
MAINTAINER jimi <jimi.ji@yoho.cn>
... ...
... ... @@ -51,7 +51,7 @@ public interface StorageDepositMapper {
StorageDeposit selectByDepositCode(@Param("uid") int uid, @Param("depositCode")String depositCode, @Param("statusList")List<Integer> statusList);
List<StorageDeposit> getDepositOffs(@Param("uid") Integer uid, @Param("storageId") Integer storageId, @Param("count") Integer count);
int updateStorageStatus(@Param("depositCode")String depositCode, @Param("status")int status, @Param("orderStatus")int orderStatus);
int updateStorageStatus(@Param("depositCode")String depositCode, @Param("status")int status, @Param("orderStatus")int orderStatus,@Param("outType")Integer outType);
int getUserDepositCount(@Param("uid") Integer uid);
... ...
... ... @@ -347,6 +347,9 @@
<update id="updateStorageStatus">
update storage_deposit
set status = #{status,jdbcType=INTEGER} ,update_time = unix_timestamp(now())
<if test="outType != null" >
, out_type = #{outType}
</if>
where deposit_code = #{depositCode,jdbcType=VARCHAR} AND del_status = 0 AND order_status = #{orderStatus,jdbcType=INTEGER}
</update>
... ...
... ... @@ -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>
... ...
... ... @@ -131,4 +131,14 @@ public class DepositController {
depositService.clearCache(uid, productId, storageId);
return new ApiResponse(200, "缓存清除成功!", Boolean.TRUE);
}
@RequestMapping(params = "method=ufo.deposit.clearUserDeposit")
@IgnoreSignature
@IgnoreSession
public ApiResponse clearUserDeposit(@RequestParam("uid") Integer uid,
@RequestParam("depositCode") String depositCode) {
LOG.info("in clearUserDeposit uid={}, depositCode is {}", uid, depositCode);
depositService.clearCacheByDepositCode(uid, depositCode);
return new ApiResponse(200, "缓存清除成功!", Boolean.TRUE);
}
}
... ...
package com.yohoufo.order.controller;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
import com.yohobuy.ufo.model.order.common.SkupListType;
import com.yohobuy.ufo.model.order.req.SingleGoodsChangePriceReq;
import com.yohobuy.ufo.model.order.req.SellerGoodsRequest;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
... ... @@ -98,6 +99,7 @@ public class SellerGoodsController {
}
/**
* 入驻商家单个skn(skc)刷新
* @param productId
... ... @@ -107,10 +109,15 @@ public class SellerGoodsController {
@RequestMapping(params = "method=ufo.sellerGoods.refresh")
@ResponseBody
public ApiResponse refresh(@RequestParam("productId") int productId,
@RequestParam("uid") int uid) {
@RequestParam("uid") int uid,
@RequestParam(value = "skupListType", required = false,
defaultValue = "1") int skupListTypeCode
) {
SkupListType skupListType = SkupListType.getByType(skupListTypeCode);
SellerGoodsRequest orderRequest = SellerGoodsRequest.builder()
.uid(uid).productId(productId)
.skupListType(skupListType)
.skupListTypeCode(skupListTypeCode)
.build();
logger.info("in ufo.sellerGoods.refresh, req {}", orderRequest);
OrderListInfo orderListInfo = skupListService.getOrderListInfo(orderRequest);
... ...
... ... @@ -53,4 +53,5 @@ public class AmountDetailBo {
private double depositAmount;
private double quickDeliveServiceAmount;
}
... ...
... ... @@ -200,6 +200,14 @@ public class OrderDetailInfo {
* 实付金额
*/
String realPayPrice;
/**
* 仓储费
*/
String depositPrice;
/**
* 闪购服务费
*/
String quickDeliveServicePrice;
}
... ...
... ... @@ -44,7 +44,7 @@ public class DepositFinishDeliveryDelayMsgConsumer implements YhConsumer {
}
//更新寄存状态为已完成
storageDepositMapper.updateStorageStatus(deposit.getDepositCode(), StorageDepositStatusEnum.HAS_END.getCode(), OrderStatus.WAITING_PAY.getCode());
storageDepositMapper.updateStorageStatus(deposit.getDepositCode(), StorageDepositStatusEnum.HAS_END.getCode(), OrderStatus.WAITING_PAY.getCode(), null);
}
}
... ...
... ... @@ -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,19 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
buyerOrder.setUid(uid);
OrderStatus targetOrderStatus = OrderStatus.HAS_PAYED;
boolean isQuickDeliver = false;
boolean isDepositWithQuickDeliverGoods = false;
boolean isDerectPass = 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;
isDerectPass = true;
}
logger.info("after paid updateOrderStatusPaid uid {} orderCode {} isQuickDeliver {} isDepositWithQuickDeliverGoods {} ",
uid, orderCode, isQuickDeliver, isDepositWithQuickDeliverGoods);
int orderStatusCode = targetOrderStatus.getCode();
buyerOrder.setStatus(orderStatusCode);
... ... @@ -128,32 +147,45 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
logger.info("in updateOrderStatusPaid record status change, orderCode {}, status: {}",
orderCode, orderStatusCode);
orderStatusFlowService.addAsy(orderCode, orderStatusCode);
if (isQuickDeliver){
appraiseService.processQuickDeliverOrderAfterPaid(orderCode, uid);
if (isDerectPass){
boolean isDepositRequired = isDepositWithQuickDeliverGoods;
appraiseService.processQuickDeliverOrderAfterPaid(orderCode, uid, isDepositRequired);
}
}
orderInfo.setStatus(orderStatusCode);
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){
... ...
... ... @@ -53,4 +53,18 @@ public interface DepositService {
DepositDetailBo convert(StorageDeposit storageDeposit);
List<StorageDeposit> getStorageDeposit4Publish(Integer uid, Integer storageId, int num);
/**
* 通过库存码清理相关库存列表缓存
* @param uid
* @param depositCode
*/
void clearCacheByDepositCode(Integer uid, String depositCode);
/**
* 根据货号查询库存
* @param depositCode
* @return
*/
StorageDeposit selectStorageDeposit(Integer uid, String depositCode);
}
... ...
... ... @@ -104,6 +104,7 @@ public class BuyerPenaltyRuleSelector {
case COMMON_IN_STOCK:
case FLAW:
case SECOND_HAND:
case DEPOSITE:
stockCaseName = "goodsInStock";
break;
case ADVANCE_SALE:
... ...
... ... @@ -40,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
... ... @@ -225,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(skupType));
goodsInfo.setTypeTag(buildOrderTypeTag(buyerOrder.getAttributes(), skupType));
if(isOffline) {
goodsInfo.setTypeTag("门店订单");
}
... ... @@ -267,8 +268,19 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
.activityCutPrice(MathUtils.formatStr(amountDetailBo.getActivityCutAmount()))
.couponCutPrice(MathUtils.formatStr(amountDetailBo.getCouponCutAmount()))
.shippingCouponCutPrice(MathUtils.formatStr(amountDetailBo.getShippingCouponCutAmount()))
.realPayPrice(buyerOrder.getAmount() == null ? "0" : buyerOrder.getAmount().toPlainString())
.build();
OrderAttributes oa = OrderAttributes.getOrderAttributes(buyerOrder.getAttributes());
if (Objects.equals(OrderAttributes.QUICK_DELIVER, oa)){
priceInfo.setQuickDeliveServicePrice(MathUtils.formatStr(amountDetailBo.getDepositAmount()));
}
if (Objects.equals(OrderAttributes.DEPOSITE, oa)){
priceInfo.setDepositPrice(MathUtils.formatStr(amountDetailBo.getDepositAmount()));
}
SkupTypeCodeSupport.CodeNode codeNode = SkupTypeCodeSupport.explain(buyerOrder.getAttributes());
if (codeNode.getRegion() == RegionEnum.HONGKONG.getCode()){
//tariff
... ... @@ -281,6 +293,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
double cutShipPrice = amountDetailBo.getShippingActivityCutAmount();
priceInfo.setShippingActivityCutPrice(MathUtils.formatStr(cutShipPrice));
}
} else {
//priceInfo
priceInfo = OrderDetailInfo.PriceInfo.builder()
... ...
... ... @@ -364,11 +364,12 @@ public abstract class AbsOrderListService extends AbsOrderViewService implements
SkupType skupType = SkupType.getSkupType(sellerOrderGoods.getAttributes());
String goodsName = sellerOrderGoods.getProductName();
goodsInfo.setProductName(goodsName);
//
String typeTag;
if (isOffline){
typeTag = "门店订单";
}else{
typeTag = SellerGoodsHelper.buildGoodsTypeTag(skupType);
typeTag = SellerGoodsHelper.buildGoodsTypeTag(BuyerOrderUtils.convertSkupTypeIfNeed(buyerOrder.getAttributes(), skupType));
}
goodsInfo.setTypeTag(typeTag);
... ...
... ... @@ -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);
}
... ...
... ... @@ -15,6 +15,7 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import com.yohoufo.order.service.DepositService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
... ... @@ -266,7 +267,7 @@ public class AppraiseService {
return;
}
int num = storageDepositMapper.updateStorageStatus(deposit.getDepositCode(), StorageDepositStatusEnum.HAS_OUT.getCode(), OrderStatus.WAITING_PAY.getCode());
int num = storageDepositMapper.updateStorageStatus(deposit.getDepositCode(), StorageDepositStatusEnum.HAS_OUT.getCode(), OrderStatus.WAITING_PAY.getCode(), null);
if(num > 0) {
//发mq,延迟30天设置状态为已完成
LOGGER.info("start send storageDeposit mq,topic is {}, depositCode is {}", TopicConstants.DEPOSIT_FINISH_DELIVERY, deposit.getDepositCode());
... ... @@ -1565,8 +1566,9 @@ public class AppraiseService {
}
}
}
public void processQuickDeliverOrderAfterPaid(long orderCode,int uid){
@Autowired
private DepositService depositService;
public void processQuickDeliverOrderAfterPaid(long orderCode,int uid, boolean isDeposit){
BuyerOrderGoods pbog = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
BuyerOrder pbo = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
try {
... ... @@ -1575,6 +1577,6 @@ public class AppraiseService {
LOGGER.warn("in processQuickDeliverOrderAfterPaid transferGoodsMoneyWhenPass fail orderCode {} uid {}",
orderCode, uid, ex);
}
depositService.changeOwner(pbo.getSellerUid(), pbog.getSkup(), orderCode,uid, isDeposit);
}
}
... ...
... ... @@ -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;
... ...
... ... @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.common.*;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq;
import com.yohobuy.ufo.model.order.resp.BuyerOrderNums;
import com.yohobuy.ufo.model.order.resp.OrderCntResp;
... ... @@ -42,6 +43,7 @@ import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.service.proxy.UserProxyService;
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.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
... ... @@ -351,6 +353,23 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
orderStatusFlowService.addAsy(orderRequest.getOrderCode(),targetStatus.getCode());
}
/**
* protect hack action
* @param buyerOrder
* @param pbog
*/
private void checkCancelable(BuyerOrder buyerOrder, BuyerOrderGoods pbog){
boolean isDepositOrder = BuyerOrderUtils.isDeposit(buyerOrder);
SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(pbog.getSkup());
SkupType skupType = SkupType.getSkupType(psog.getAttributes());
boolean isQuickDeliverGoods = SellerGoodsHelper.isQuickDeliver(skupType);
if (isDepositOrder && isQuickDeliverGoods){
logger.warn("checkCancelable find illegal action, uid {} orderCode {}", buyerOrder.getUid(), buyerOrder.getOrderCode());
throw new UfoServiceException(400, "闪购商品订单不允许取消");
}
}
private void doCancel(OrderRequest orderRequest){
DataNode node = checkBase(orderRequest);
BuyerOrder buyerOrder = node.buyerOrderInDB;
... ... @@ -379,6 +398,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
case HAS_PAYED:
BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(orderRequest.getUid(),
orderRequest.getOrderCode());
checkCancelable(buyerOrder, bog);
int skup = bog.getSkup();
targetStatus = OrderStatus.BUYER_CANCEL_BEFORE_SELLER_DELIVER;
BeforeSellerDeliverEvent bsde = BeforeSellerDeliverEvent.builder()
... ...
... ... @@ -7,20 +7,25 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.model.DepositOrder;
import com.yohoufo.dal.order.model.EntrySellerRechargeOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.order.model.StorageDeposit;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.model.response.PrepayResponse;
import com.yohoufo.order.service.AbstractOrderPaymentService;
import com.yohoufo.order.service.DepositService;
import com.yohoufo.order.service.deposit.DepositOrderService;
import com.yohoufo.order.service.proxy.InBoxFacade;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.swing.text.html.Option;
import java.util.Objects;
import java.util.Optional;
@Service
public class DepositOrderPaymentService extends AbstractOrderPaymentService {
... ... @@ -32,6 +37,12 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
@Autowired
private DepositService depositService;
@Autowired
protected InBoxFacade inBoxFacade;
@Autowired
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Override
public boolean isTimeoutCancelStatus(OrderInfo orderInfo) {
return false;
... ... @@ -39,6 +50,8 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
@Override
public OrderInfo getOrderInfo(long orderCode, int uid) {
logger.info("【{}】DepositOrderPaymentService.getOrderInfo execute, uid is {}", orderCode, uid);
DepositOrder order = depositOrderService.selectByOrderCodeUid(orderCode, uid);
if (order == null){
... ... @@ -68,6 +81,8 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
@Override
public void checkOrderStatus(OrderInfo orderInfo) {
logger.info("【{}】DepositOrderPaymentService.checkOrderStatus execute, orderInfo is {}", orderInfo.getOrderCode(), orderInfo);
// 订单不是未付款的状态
if (orderInfo.getStatus() == null || orderInfo.getStatus().intValue() != OrderStatus.WAITING_PAY.getCode()){
logger.warn("payment status not allow {}, orderCode is {}, uid is {}", orderInfo.getStatus(),
... ... @@ -78,6 +93,8 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
@Override
public void updatePayment(OrderInfo orderInfo, int payment) {
logger.info("【{}】DepositOrderPaymentService.updatePayment execute, orderInfo is {}, payment is {}", orderInfo.getOrderCode(), orderInfo, payment);
DepositOrder order = DepositOrder.builder().orderCode(orderInfo.getOrderCode()).uid(orderInfo.getUid())
.payment(payment).updateTime(DateUtil.getCurrentTimeSecond()).build();
depositOrderService.updateByOrderCode(order);
... ... @@ -115,6 +132,8 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
@Override
public int updateOrderStatusPaid(OrderInfo orderInfo) {
logger.info("【{}】DepositOrderPaymentService.updateOrderStatusPaid execute, orderInfo is {}", orderInfo.getOrderCode(), orderInfo);
DepositOrder order = DepositOrder.builder().orderCode(orderInfo.getOrderCode()).initStatus(OrderStatus.WAITING_PAY.getCode())
.status(OrderStatus.HAS_PAYED.getCode()).updateTime(DateUtil.getCurrentTimeSecond()).build();
... ... @@ -129,6 +148,8 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
*/
@Override
public void processAfterPay(OrderInfo orderInfo) {
logger.info("【{}】DepositOrderPaymentService.processAfterPay execute, orderInfo is {}", orderInfo.getOrderCode(), orderInfo);
DepositOrder depositOrder = depositOrderService.selectByOrderCode(orderInfo.getOrderCode());
if (Objects.isNull(depositOrder)) {
... ... @@ -141,6 +162,19 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
if (result != 1) {
logger.error("depositService.changeStorageStatus find wrong, depositCode is {}, result is {}", depositOrder.getDepositCode(), result);
return;
} else {
try {
logger.info("depositService.notify begin, orderInfo is {}", orderInfo);
StorageDeposit deposit = depositService.selectStorageDeposit(depositOrder.getUid(), depositOrder.getDepositCode());
SellerOrderGoods psog = Optional.ofNullable(deposit).map(StorageDeposit::getSkup)
.map(sellerOrderGoodsMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.recallDepositnotify(deposit.getOwnerUid(), psog); // 更新待拣货状态成功后,发通知
} catch (Exception e) {
logger.error("depositService.notify find wrong, orderInfo is {}", orderInfo);
}
}
}
... ...
... ... @@ -5,6 +5,7 @@ import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
import com.yohobuy.ufo.model.order.bo.DepositProductBo;
import com.yohobuy.ufo.model.order.constants.DepositOrderStatusEnum;
import com.yohobuy.ufo.model.order.constants.DepositOutTypeEnum;
import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohoufo.common.ApiResponse;
... ... @@ -12,8 +13,10 @@ import com.yohoufo.common.cache.ControllerCacheAop;
import com.yohoufo.common.caller.UfoServiceCaller;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.helper.ImageUrlAssist;
import com.yohoufo.dal.order.BuyerOrderMapper;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.StorageDepositMapper;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.order.model.StorageDeposit;
import com.yohoufo.dal.order.model.StorageDepositCount;
... ... @@ -51,6 +54,9 @@ public class DepositServiceImpl implements DepositService {
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Autowired
private BuyerOrderMapper buyerOrderMapper;
@Autowired
private UfoServiceCaller ufoServiceCaller;
private static final int DEPOSIT_MAX_TIME = 45 * 24 * 60 * 60;
... ... @@ -85,7 +91,7 @@ public class DepositServiceImpl implements DepositService {
if (countInfo != null) {
bo.setSizeCount(countInfo.getStorageIdCount());
bo.setStorageCount(countInfo.getStorageCount());
bo.setShelfStatus(countInfo.getStorageIdCount() == 0 ? "全部已上架" : ("有" + countInfo.getStorageIdCount() + "件未上架"));
bo.setShelfStatus(countInfo.getUnShelfStorageCount() == 0 ? "全部已上架" : ("有" + countInfo.getUnShelfStorageCount() + "件未上架"));
}
result.add(bo);
}
... ... @@ -106,6 +112,8 @@ public class DepositServiceImpl implements DepositService {
}
// 召回或者到期退回的
List<StorageDeposit> depositList = storageDepositMapper.queryUserDopositBack(uid, (page - 1) * limit, limit);
List<BuyerOrder> buyerGoodsList = buyerOrderMapper.selectByOrderCodes(depositList.stream().map(StorageDeposit::getOrderCode).collect(Collectors.toList()), null);
Map<Long, BuyerOrder> buyerGoodsMap = buyerGoodsList.stream().map(Function.identity()).collect(Collectors.toMap(BuyerOrder::getOrderCode, Function.identity()));
List<Integer> skupList = depositList.stream().map(StorageDeposit::getSkup).collect(Collectors.toList());
List<SellerOrderGoods> goodsList = sellerOrderGoodsMapper.selectBySkups(skupList);
Map<Integer, SellerOrderGoods> goodsMap = goodsList.stream().map(Function.identity()).collect(Collectors.toMap(SellerOrderGoods::getId, Function.identity()));
... ... @@ -119,7 +127,10 @@ public class DepositServiceImpl implements DepositService {
bo.setColorName(goods.getColorName());
bo.setSizeName(goods.getSizeName());
bo.setPic(ImageUrlAssist.getAllProductPicUrl(goods.getImageUrl(), "goodsimg", "center", "d2hpdGU="));
bo.setPrice(goods.getGoodsPrice().toString());
BuyerOrder buyerOrder = buyerGoodsMap.get(buyerGoodsMap.get(depo.getOrderCode()));
if (buyerOrder != null) {
bo.setPrice(buyerOrder.getAmount().toString());
}
bo.setDepositStatusName(getBackStatusName(depo.getStatus()));
bo.setDepositCode(depo.getDepositCode());
}
... ... @@ -166,7 +177,11 @@ public class DepositServiceImpl implements DepositService {
bo.setFlashMinPrice(least == null ? "" : least.toString());
bo.setDepositCode(depo.getDepositCode());
}
bo.setButtons(Arrays.asList(ButtonShowBo.back(), /*ButtonShowBo.addDepositDays(),*/ depo.getOrderStatus() == 0 ? ButtonShowBo.grounding() : ButtonShowBo.detail("详情")));
if(depo.getOrderStatus() == 0) {
bo.setButtons(Arrays.asList(ButtonShowBo.back(), /*ButtonShowBo.addDepositDays(),*/ depo.getOrderStatus() == 0 ? ButtonShowBo.grounding() : ButtonShowBo.detail("详情")));
} else {
bo.setButtons(Arrays.asList(/*ButtonShowBo.addDepositDays(),*/ depo.getOrderStatus() == 0 ? ButtonShowBo.grounding() : ButtonShowBo.detail("详情")));
}
result.add(bo);
}
PageResp resp = new PageResp();
... ... @@ -312,11 +327,13 @@ public class DepositServiceImpl implements DepositService {
public int changeStorageStatus(String depositCode, int status, int orderStatus, int uid) {
try {
ufoServiceCaller.call("ufo.deposit.clearOrderCache", uid, depositCode); // 清理库存详情缓存
ufoServiceCaller.call("ufo.deposit.clearUserDeposit", uid, depositCode); // 清理库存列表缓存
} catch (Exception e) {
LOGGER.warn("clearOrderCache execute wrong, depositCode is {}", depositCode);
}
return storageDepositMapper.updateStorageStatus(depositCode, status, orderStatus);
return storageDepositMapper.updateStorageStatus(depositCode, status, orderStatus, DepositOutTypeEnum.OUTTYPE_FLASH_PURCHASE.getCode());
}
public void clearCache(Integer uid, Integer productId, Integer storageId) {
... ... @@ -347,6 +364,28 @@ public class DepositServiceImpl implements DepositService {
}
}
public void clearCacheByDepositCode(Integer uid, String depositCode) {
if (uid == null) {
return;
}
StorageDeposit storageDeposit = storageDepositMapper.queryByDepositCode(uid, depositCode);
if (null == storageDeposit) {
return;
}
clearCache(uid, storageDeposit.getProductId(), storageDeposit.getStorageId());
}
/**
* 根据货号查询库存
* @param depositCode
* @return
*/
public StorageDeposit selectStorageDeposit(Integer uid, String depositCode) {
return storageDepositMapper.queryByDepositCode(uid, depositCode);
}
/**
* Do 转 Vo
* @param storageDeposit
... ...
... ... @@ -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);
}
}
... ...
... ... @@ -283,7 +283,7 @@ public class ShoppingServiceImpl implements IShoppingService {
//急速商品 非寄存
if (!depositChoose && SkupType.QUICK_DELIVER.equals(skupType)){
FeeNRate feeNRate = feeNRateFunc.apply(skupType);
quickDeliverServiceFee = feeNRate.getStorageManagementFee();
quickDeliverServiceFee = feeNRate.getQuickDeliverServiceFee();
}
//现货 or 闪购 商品,且选择了寄存
... ... @@ -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"};
... ... @@ -680,6 +695,10 @@ public class ShoppingServiceImpl implements IShoppingService {
amountDetailBo.setDepositAmount(depositFee.getAmount());
}
SingleFeeDetail quickDeliveFee = chargeResult.getQuickDeliverServiceFee();
if (Objects.nonNull(quickDeliveFee)){
amountDetailBo.setQuickDeliveServiceAmount(quickDeliveFee.getAmount());
}
//活动券减免金额
chargeResult.getCouponPayResultList().getCouponPayResultByCouponType(CouponTypeEnum.ACTIVITY_COUPON.getCode()).
ifPresent(tempPayResult -> amountDetailBo.setCouponCutAmount(tempPayResult.getCouponAmount()));
... ...
... ... @@ -55,14 +55,6 @@ public class SkupListService {
private final Logger logger = LoggerUtils.getSellerOrderLogger();
final static List<Integer> NORMAL_SKUPTYPES = Lists.newArrayList(SkupType.IN_STOCK.prdAttributes().getCode(),
SkupType.ADVANCE.prdAttributes().getCode()),
ENTRY_SKUP_TYPES = Lists.newArrayList(SkupType.IN_STOCK.prdAttributes().getCode(),
SkupType.ADVANCE.prdAttributes().getCode(),SkupType.HK_IN_STOCK.prdAttributes().getCode())
;
final static List<Integer> IMPERFECT_SKUPTYPES = Lists.newArrayList(SkupType.FLAW.getCode(), SkupType.SECOND_HAND.getCode());
... ... @@ -156,11 +148,12 @@ public class SkupListService {
logger.warn("getEntryGoodsList user is not entry, req {}", request);
return respBuilder.build();
}
SkupListType skupListType = SkupListType.ENTIRELY_NEW;
int type;
if ((type=request.getType()) == SellerOrderListType.IN_SALE.getType()) {
SkupStatus viewableStatus = SkupStatus.CAN_SELL;
List<Integer> statusList = Arrays.asList(viewableStatus.getCode());
final List<Integer> skupTypeCodes = ENTRY_SKUP_TYPES;
final List<Integer> skupTypeCodes = skupListType.getSkupTypeCodes(isEntry);
int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSkc(uid, statusList, skupTypeCodes);
respBuilder.total(total)
.pagetotal((total % limit == 0) ? (total / limit) : (total / limit + 1));
... ... @@ -196,8 +189,9 @@ public class SkupListService {
.pageSize(limit);
int type;
if ((type=request.getType()) == SellerOrderListType.IN_SALE.getType()){
SkupListType skupListType = SkupListType.ENTIRELY_NEW;
List<Integer> statusList = sellerOrderListService.initOrderListRequest(request);
List<Integer> skupTypesCondition = NORMAL_SKUPTYPES;
List<Integer> skupTypesCondition = skupListType.getSkupTypeCodes(false);
int total = sellerOrderGoodsViewMapper.selectNotEntryCntByUidStatus(request.getUid(), statusList, skupTypesCondition);
respBuilder = PageResp.builder()
.page(request.getPage())
... ... @@ -243,13 +237,13 @@ public class SkupListService {
logger.warn("getQuickDeliverGoodsSizeList not entry seller, req {}", request);
return respBuilder.build();
}
final SkupListType skupListType = SkupListType.ENTIRELY_NEW;
Integer productId;
SellerOrderGoods sogCondition = new SellerOrderGoods();
sogCondition.setProductId(productId=request.getProductId());
sogCondition.setUid(uid);
sogCondition.setStatus(status);
final List<Integer> skupTypeCodes = ENTRY_SKUP_TYPES;
final List<Integer> skupTypeCodes = skupListType.getSkupTypeCodes(isEntry);
//
int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSku(sogCondition, skupTypeCodes, isEntry);
respBuilder.total(total);
... ... @@ -334,6 +328,7 @@ public class SkupListService {
private PrdOverPriceDTO getPrdOverPriceDTO(Integer uid,
Integer productId, SkupStatus skupStatus){
SkupListType skupListType = SkupListType.ENTIRELY_NEW;
PrdOverPriceDTO popDTO = new PrdOverPriceDTO();
popDTO.setProductId(productId);
Integer status = skupStatus.getCode();
... ... @@ -343,7 +338,7 @@ public class SkupListService {
sogCondition.setProductId(productId);
sogCondition.setUid(uid);
sogCondition.setStatus(status);
List<Integer> skupTypesCondition = NORMAL_SKUPTYPES;
List<Integer> skupTypesCondition = skupListType.getSkupTypeCodes(false);
//
int total = sellerOrderGoodsViewMapper.selectEntryCntByUidStatusGBSku(sogCondition, skupTypesCondition, true);
if (total == 0){
... ... @@ -490,7 +485,8 @@ public class SkupListService {
* @return
*/
public OrderListInfo getOrderListInfo(SellerGoodsRequest req){
List<Integer> skupTypeCodes = ENTRY_SKUP_TYPES;
SkupListType skupListType = SkupListType.ENTIRELY_NEW;
List<Integer> skupTypeCodes = skupListType.getSkupTypeCodes(true);
SkupStatus ss = SkupStatus.CAN_SELL;
Integer status = ss.getCode();
Integer uid = req.getUid();
... ...
... ... @@ -1789,6 +1789,41 @@ public class InBoxFacade {
}
}
// 召回的
public void recallDepositnotify(int uid, SellerOrderGoods sog) {
if (null == sog) {
logger.warn("InBoxFacade recallDepositnotify error SellerOrderGoods is null, uid {}", uid);
return;
}
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
executorService.execute(()->{
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_RECALL;
String paramsOfSeller = buildParams(prdName, sizeName,productCode);
InboxReqVO reqOfSeller = buildInboxReqVO(uid, paramsOfSeller, ibtOfSeller);
InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);
logger.info("record recallDepositnotify to seller inbox msg, uid {}, sog {} resp {}",
uid, sog, respOfSeller);
String phone = userProxyService.getMobile(uid);
if (StringUtils.isBlank(phone)){
logger.warn("in recallDepositnotify sms fail, uid {} sog {}", uid, sog);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content= getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFY_SELLER_DEPOSIT_RECALL.getContent(),prdName, sizeName, productCode);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record recallDepositnotify inbox sms msg, uid {}, sog {}", uid, sog);
});
} catch (Exception e) {
logger.warn("InBoxFacade recallDepositnotify error inbox msg, uid {}, sog {}", uid, sog, e);
}
}
public InboxReqVO buildInboxReqVO(int uid, String params, InboxBusinessTypeEnum ibt) {
InboxReqVO req = new InboxReqVO();
req.setType(ibt.getType());
... ...
... ... @@ -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");
... ... @@ -332,13 +332,13 @@ public class ProductProxyService extends AbsProxyService{
public static Integer buildPresaleFlag(Integer skupa){
Integer presaleFlag = null;
if(Objects.nonNull(skupa)) {
if (SkupType.ADVANCE.getCode() == skupa) {
presaleFlag = isAdvace;
}else{
presaleFlag = skupa;
}
if (Objects.isNull(skupa) || SkupType.IN_STOCK.getCode() == skupa){
return presaleFlag;
}
if (SkupType.ADVANCE.getCode() == skupa) {
presaleFlag = isAdvace;
}else{
presaleFlag = skupa;
}
return presaleFlag;
}
... ...
... ... @@ -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, "您不是入驻商家");
}
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.order.utils;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.common.OrderAttributes;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohoufo.dal.order.model.BuyerOrder;
import java.util.Objects;
... ... @@ -64,4 +65,10 @@ public class BuyerOrderUtils {
public static boolean isQuickDeliver(Integer orderAttrCode){
return Objects.nonNull(orderAttrCode) && Objects.equals(OrderAttributes.QUICK_DELIVER.getCode(), orderAttrCode);
}
public static SkupType convertSkupTypeIfNeed(Integer orderAttrCode, SkupType skupType){
boolean isDeposit = isDeposit(orderAttrCode);
return isDeposit ? SkupType.DEPOSIT : skupType;
}
}
... ...
... ... @@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
... ... @@ -451,6 +452,8 @@ public class ProductController {
cacheAop.clearCache(
ProductController.class.getMethod("queryProductDetailById", new Class[]{Integer.class}),
new Object[]{productId});
Method queryLeastFlashSalePrice = ProductController.class.getMethod("queryLeastFlashSalePrice", new Class[]{Integer.class});
cacheAop.clearCache(queryLeastFlashSalePrice, new Object[]{productId});
Integer storageId = sp.getStorageId();
// sku最低价
LOG.info("clearCache queryStorageLeastprice skup = {}, ", skup);
... ... @@ -506,6 +509,8 @@ public class ProductController {
cacheAop.clearCache(
ProductController.class.getMethod("queryProductInStockNewBriefById", new Class[]{Integer.class}),
new Object[]{productId});
Method queryLeastFlashSalePrice = ProductController.class.getMethod("queryLeastFlashSalePrice", new Class[]{Integer.class});
cacheAop.clearCache(queryLeastFlashSalePrice, new Object[]{productId});
} catch (Exception e) {
LOG.error("删除商品详情缓存失败!", e);
}
... ... @@ -528,6 +533,8 @@ public class ProductController {
cacheAop.clearCache(
ProductController.class.getMethod("queryProductInStockNewBriefById", new Class[]{Integer.class}),
new Object[]{productId});
Method queryLeastFlashSalePrice = ProductController.class.getMethod("queryLeastFlashSalePrice", new Class[]{Integer.class});
cacheAop.clearCache(queryLeastFlashSalePrice, new Object[]{productId});
}
}
if (CollectionUtils.isNotEmpty(storageIdList)) {
... ...
... ... @@ -787,7 +787,7 @@ public class ProductServiceImpl implements ProductService {
}
private void addStorageNum(Integer skup, Integer storageId, Integer num) {
LOGGER.info("修改库存:skup={}, storageId={}, num={}", skup, storageId, num);
/* LOGGER.info("修改库存:skup={}, storageId={}, num={}", skup, storageId, num);
if (storageId == null) {
StoragePrice sp = storagePriceMapper.selectBySkup(skup);
storageId = sp.getStorageId();
... ... @@ -801,7 +801,7 @@ public class ProductServiceImpl implements ProductService {
storageMapper.addStorageNum(storageId, num);
} catch (Exception e) {
LOGGER.error("修改库存出错: skup=" + skup + ", storageId=" + storageId + ", num=" + num + ", find storageId is null", e);
}
}*/
}
private StoragePrice checkSkupCanSale(Integer skup) {
... ...