...
|
...
|
@@ -100,10 +100,9 @@ public class ImperfectGoodsPublishExcutor implements PublishExcutor<ImperfectOrd |
|
|
int uid = ctx.getUid();
|
|
|
int storageId = ctx.getStorageId();
|
|
|
BigDecimal salePrice = ctx.getSalePrice();
|
|
|
logger.info("in ImperfectGoodsPublishExcutor.publish by common entry, uid {} storageId {} salePrice {}");
|
|
|
logger.info("in ImperfectGoodsPublishExcutor.publish by common entry, uid {} storageId {} salePrice {}", uid, storageId, salePrice);
|
|
|
SellerOrderComputeResult computeResult = ctx.getSellerOrderComputeResult();
|
|
|
BigDecimal earestMoney = computeResult.getEarnestMoney().getEarnestMoney();
|
|
|
|
|
|
SellerWalletDetail.Type swdType = SellerWalletDetail.Type.PUBLISH;
|
|
|
MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(uid)
|
|
|
.storageId(storageId).earnestMoney(earestMoney)
|
...
|
...
|
@@ -115,10 +114,12 @@ public class ImperfectGoodsPublishExcutor implements PublishExcutor<ImperfectOrd |
|
|
uid, storageId, earestMoney);
|
|
|
throw new ServiceException(ServiceError.WALLET_EARNESTMONEY_PAY_FAIL);
|
|
|
}
|
|
|
logger.info("in ImperfectGoodsPublishExcutor.publish by common entry paid by waller, uid {} storageId {} salePrice {} paySuccess {}",
|
|
|
uid, storageId, salePrice, paySuccess);
|
|
|
//给入驻卖家发消息
|
|
|
inBoxFacade.sellerPaidEarnestMoney(uid, ctx.getSoldProduct().getProductName(),ctx.getSoldProduct().getSizeName(),ctx.getSoldProduct().getProductId());
|
|
|
//
|
|
|
OrderSubmitResp resp = doPublish(ctx);
|
|
|
|
|
|
return resp;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -128,21 +129,20 @@ public class ImperfectGoodsPublishExcutor implements PublishExcutor<ImperfectOrd |
|
|
BigDecimal salePrice = ctx.getSalePrice();
|
|
|
logger.info("in ImperfectGoodsPublishExcutor.publish by super, uid {} storageId {} salePrice {}",
|
|
|
uid, storageId, salePrice);
|
|
|
|
|
|
inBoxFacade.sellerPaidEarnestMoney(uid, ctx.getSoldProduct().getProductName(),ctx.getSoldProduct().getSizeName(),ctx.getSoldProduct().getProductId());
|
|
|
OrderSubmitResp resp = doPublish(ctx);
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
|
|
|
public OrderSubmitResp doPublish(ImperfectOrderContext context){
|
|
|
private OrderSubmitResp doPublish(ImperfectOrderContext context){
|
|
|
int storageId = context.getStorageId();
|
|
|
int uid = context.getUid();
|
|
|
BigDecimal salePrice = context.getSalePrice();
|
|
|
// step 2: create order, set status(not pay)
|
|
|
// generate a new real code
|
|
|
long orderCode = orderCodeGenerator.generate(OrderCodeType.SELLER_TYPE);
|
|
|
if (orderCode <= 0L){
|
|
|
logger.warn("in publish imperfect Prd generate fail , uid {}, storageId {}", uid, storageId);
|
|
|
logger.warn("in publish imperfect Prd generate fail , uid {}, storageId {} salePrice {}",
|
|
|
uid, storageId, salePrice);
|
|
|
throw new ServiceException(ServiceError.EARNESTMONEY_ORDER_CREATE_FAIL);
|
|
|
}
|
|
|
//允许入驻商家后,对于个体户而言,也需要批次号(1:1这种,直接使用订单号,若以后有变化 用skup_batch表自增)
|
...
|
...
|
@@ -152,6 +152,8 @@ public class ImperfectGoodsPublishExcutor implements PublishExcutor<ImperfectOrd |
|
|
//all include : 1. skup, 2. order , 3. 寄回地址
|
|
|
try{
|
|
|
orderSubmitHandler.submit(context);
|
|
|
logger.info("in ImperfectGoodsPublishExcutor.publish finish main local persistent, uid {} storageId {} salePrice {} orderCode {}",
|
|
|
uid, storageId, salePrice, orderCode);
|
|
|
}catch (Exception ex){
|
|
|
String content = "用户"+ uid + "发布瑕疵(或二手)商品"+storageId + "失败";
|
|
|
SmsAlarmEvent smsAlarmEvent = new SmsAlarmEvent("sellerOrder.create", "create", content);
|
...
|
...
|
@@ -159,23 +161,28 @@ public class ImperfectGoodsPublishExcutor implements PublishExcutor<ImperfectOrd |
|
|
logger.warn("in publish imperfect Prd create order fail , uid {}, storageId {}", uid, storageId);
|
|
|
throw new ServiceException(ServiceError.EARNESTMONEY_ORDER_CREATE_FAIL);
|
|
|
}
|
|
|
|
|
|
syncPrd(context);
|
|
|
SellerOrderGoods psog = context.getSellerOrderGoods();
|
|
|
int skup = psog.getId();
|
|
|
GoodsInfo goodsInfo = context.getSoldProduct();
|
|
|
OrderSubmitResp resp = OrderSubmitResp.builder()
|
|
|
.orderCode(orderCode)
|
|
|
.skup(skup)
|
|
|
.productId(goodsInfo.getProductId()).build();
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
private void syncPrd(ImperfectOrderContext context){
|
|
|
long orderCode = context.getOrderCode();
|
|
|
SellerOrderGoods psog = context.getSellerOrderGoods();
|
|
|
int skup = psog.getId();
|
|
|
ImperfectGoodsInfo imperfectGoodsInfo = context.getImperfectGoodsInfo();
|
|
|
GoodsInfo goodsInfo = context.getSoldProduct();
|
|
|
SecondhandInfoReqBo secondhandInfoReqBo = buildSecondhandInfo(psog, imperfectGoodsInfo);
|
|
|
SecondhandInfoReqBo secondhandInfoReqBo = buildSecondhandInfo(goodsInfo.getTargetSkupStatus(), psog, imperfectGoodsInfo);
|
|
|
boolean syncPrdFlag = productProxyService.createImperfectGoods(secondhandInfoReqBo);
|
|
|
logger.info("publish imperfect Prd finish, createImperfectGoods {}, skup {}, orderCode {}",
|
|
|
syncPrdFlag, skup, orderCode);
|
|
|
|
|
|
// TODO 给入驻卖家发消息
|
|
|
|
|
|
OrderSubmitResp resp = OrderSubmitResp.builder()
|
|
|
.orderCode(orderCode)
|
|
|
.skup(psog.getId())
|
|
|
.productId(goodsInfo.getProductId()).build();
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
private StoragePriceBo buildNewSkupReq(SellerOrderGoods goods,SkupStatus skupStatus){
|
...
|
...
|
@@ -187,14 +194,14 @@ public class ImperfectGoodsPublishExcutor implements PublishExcutor<ImperfectOrd |
|
|
skupReq.setStorageId(goods.getStorageId());
|
|
|
skupReq.setPrice(goods.getGoodsPrice());
|
|
|
skupReq.setSellerUid(goods.getUid());
|
|
|
//瑕疵和二手 prd & order 是一致
|
|
|
skupReq.setPreSaleFlag(goods.getAttributes());
|
|
|
return skupReq;
|
|
|
}
|
|
|
|
|
|
private SecondhandInfoReqBo buildSecondhandInfo(SellerOrderGoods goods, ImperfectGoodsInfo imperfectGoodsInfo){
|
|
|
private SecondhandInfoReqBo buildSecondhandInfo(SkupStatus skupStatus, SellerOrderGoods goods, ImperfectGoodsInfo imperfectGoodsInfo){
|
|
|
int skup = goods.getId();
|
|
|
final SkupStatus skupStatus = SkupStatus.CAN_NOT_SELL;
|
|
|
StoragePriceBo spb = buildNewSkupReq(goods, skupStatus);
|
|
|
|
|
|
SecondhandInfoReqBo sirb = new SecondhandInfoReqBo();
|
|
|
sirb.setSkupBo(spb);
|
|
|
sirb.setSkup(skup);
|
...
|
...
|
|