...
|
...
|
@@ -8,6 +8,8 @@ import com.yohobuy.ufo.model.order.req.SellerOrderCancelReq; |
|
|
import com.yohobuy.ufo.model.order.req.SellerOrderComputeReq;
|
|
|
import com.yohobuy.ufo.model.order.req.SellerOrderSubmitReq;
|
|
|
import com.yohobuy.ufo.model.order.resp.PageResp;
|
|
|
import com.yohoufo.common.alarm.EventBusPublisher;
|
|
|
import com.yohoufo.common.alarm.SmsAlarmEvent;
|
|
|
import com.yohoufo.common.exception.GatewayException;
|
|
|
import com.yohoufo.common.utils.AddressUtil;
|
|
|
import com.yohoufo.common.utils.DateUtil;
|
...
|
...
|
@@ -176,7 +178,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
//step 2: generate skup ,action :set price status(unsaleable)
|
|
|
if (Objects.isNull(goodsInfo)){
|
|
|
log.warn("in computePublishPrd storageId not exist in prd , uid {}, storageId {}", uid, storageId);
|
|
|
throw new GatewayException(400, "商品不存在");
|
|
|
throw new ServiceException(ServiceError.ORDER_ORDERS_GOODS_IS_EMPTY);
|
|
|
}
|
|
|
context.setSoldProduct(goodsInfo);
|
|
|
checkPrice(storageId, goodsInfo.getPrice(), true);
|
...
|
...
|
@@ -191,18 +193,26 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
long orderCode = orderCodeGenerator.generate(OrderCodeType.SELLER_TYPE);
|
|
|
if (orderCode <= 0L){
|
|
|
log.warn("in publishPrd storageId not exist in prd , uid {}, storageId {}", uid, storageId);
|
|
|
throw new GatewayException(501, "保证金订单生成失败");
|
|
|
throw new ServiceException(ServiceError.EARNESTMONEY_ORDER_CREATE_FAIL);
|
|
|
}
|
|
|
context.setOrderCode(orderCode);
|
|
|
//submit all as atomic operation, use transaction of DB
|
|
|
//all include : 1. skup, 2. order , 3. 寄回地址
|
|
|
orderSubmitHandler.submit(context);
|
|
|
try{
|
|
|
orderSubmitHandler.submit(context);
|
|
|
}catch (Exception ex){
|
|
|
String content = "用户"+ uid + "发布商品"+storageId + "失败";
|
|
|
SmsAlarmEvent smsAlarmEvent = new SmsAlarmEvent("sellerOrder.create", "create", content);
|
|
|
EventBusPublisher.publishEvent(smsAlarmEvent);
|
|
|
log.warn("in publishPrd create order fail , uid {}, storageId {}", uid, storageId);
|
|
|
throw new ServiceException(ServiceError.EARNESTMONEY_ORDER_CREATE_FAIL);
|
|
|
}
|
|
|
|
|
|
boolean syncPrdFlag = productProxyService.syncSkup(context.getSellerOrderGoods(), SkupStatus.CAN_NOT_SELL);
|
|
|
log.info("publish finish, syncPrdFlag {}, req {}, orderCode {}", syncPrdFlag, req, orderCode);
|
|
|
//发布支付超时取消消息
|
|
|
pushAutoCancelEvent(context);
|
|
|
//TODO 发消息
|
|
|
// 发消息
|
|
|
OrderSubmitResp resp = OrderSubmitResp.builder().orderCode(orderCode).productId(goodsInfo.getProductId()).build();
|
|
|
return resp;
|
|
|
}
|
...
|
...
|
|