...
|
...
|
@@ -15,10 +15,7 @@ import com.yohoufo.dal.order.SellerOrderMapper; |
|
|
import com.yohoufo.dal.order.model.*;
|
|
|
import com.yohoufo.order.common.*;
|
|
|
import com.yohoufo.order.constants.AlarmConfig;
|
|
|
import com.yohoufo.order.event.BillLogEvent;
|
|
|
import com.yohoufo.order.event.ErpCancelSellerOrderEvent;
|
|
|
import com.yohoufo.order.event.OrderCancelEvent;
|
|
|
import com.yohoufo.order.event.PayConfirmEvent;
|
|
|
import com.yohoufo.order.event.*;
|
|
|
import com.yohoufo.order.model.PayQueryBo;
|
|
|
import com.yohoufo.order.model.PayRefundBo;
|
|
|
import com.yohoufo.order.model.request.OrderRequest;
|
...
|
...
|
@@ -411,24 +408,33 @@ public class SellerOrderCancelService { |
|
|
* 根据codeType判断即可
|
|
|
*/
|
|
|
if (OrderCodeType.getSellerTypes().contains(codeType)){
|
|
|
logger.warn("cancelAfterPayExistBuyAction canceling order buyer operated, seller [uid:{} orderCode:{}],buyer [uid:{} orderCode:{}] codeType {} buyerOrderStatus {}",
|
|
|
logger.warn("cancelAfterPayExistBuyAction seller cancel self-order_code , seller [uid:{} orderCode:{}],buyer [uid:{} orderCode:{}] codeType {} buyerOrderStatus {}",
|
|
|
sellerUid, sellerOrderCode, buyerUid, buyerOrderCode, codeType, buyerOrderStatus);
|
|
|
String errorMsg = "您的商品已经被购买,不能下架该商品!";
|
|
|
throw new UfoServiceException(501, errorMsg);
|
|
|
}
|
|
|
|
|
|
if (!Objects.equals(buyerOrderStatus, OrderStatus.HAS_PAYED.getCode())){
|
|
|
logger.warn("cancelAfterPayExistBuyAction canceling buyer order status not normal, seller [uid:{} orderCode:{}],buyer [uid:{} orderCode:{}] codeType {} buyerOrderStatus {}",
|
|
|
sellerUid, sellerOrderCode, buyerUid, buyerOrderCode, codeType, buyerOrderStatus);
|
|
|
String errorMsg = "买家订单不可取消";
|
|
|
throw new UfoServiceException(501, errorMsg);
|
|
|
}
|
|
|
|
|
|
|
|
|
int result = 0;
|
|
|
//actions of buyer order and related
|
|
|
//update buyer Order
|
|
|
//target Buyer Order Status
|
|
|
Integer targetBOStatus;
|
|
|
targetBOStatus = OrderStatus.SELLER_CANCEL_AFTER_PAY.getCode();
|
|
|
BuyerOrder tbo = new BuyerOrder();
|
|
|
tbo.setUid(buyerUid);
|
|
|
tbo.setOrderCode(buyerOrderCode);
|
|
|
tbo.setStatus(targetBOStatus);
|
|
|
tbo.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
|
|
result += buyerOrderMapper.updateByOrderCode(tbo);
|
|
|
OrderStatus targetBOStatus = OrderStatus.SELLER_CANCEL_AFTER_PAY;
|
|
|
int currentDT = DateUtil.getCurrentTimeSecond();
|
|
|
result += buyerOrderMapper.updateStatusByOrderCode(buyerOrderCode, buyerUid, buyerOrderStatus,
|
|
|
targetBOStatus.getCode(), currentDT);
|
|
|
if(result > 0) {
|
|
|
BuyerRefundCouponEvent brce = BuyerRefundCouponEvent.builder().bizCase(BuyerRefundCouponEvent.BizCase.SELLER_PLAY_BUYER)
|
|
|
.uid(buyerUid).orderCode(buyerOrderCode).build();
|
|
|
EventBusPublisher.publishEvent(brce);
|
|
|
|
|
|
SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(sellerOrder.getSkup());
|
|
|
cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()),
|
|
|
CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()),
|
...
|
...
|
|