...
|
...
|
@@ -24,6 +24,7 @@ import com.yohoufo.order.model.dto.ChangePricePrepareDTO; |
|
|
import com.yohoufo.order.model.response.OrderSubmitResp;
|
|
|
import com.yohoufo.order.service.impl.SellerOrderCancelService;
|
|
|
import com.yohoufo.order.service.impl.visitor.UserCancelCase;
|
|
|
import com.yohoufo.order.service.proxy.ProductProxyService;
|
|
|
import com.yohoufo.order.service.seller.SellerChangePriceRecordService;
|
|
|
import com.yohoufo.order.service.seller.processor.NESChangePricePrepareProcessor;
|
|
|
import com.yohoufo.order.service.seller.processor.NESChangePricePublishPrepareProcessor;
|
...
|
...
|
@@ -82,10 +83,8 @@ public class NotEntrySellerChangePriceService { |
|
|
@Autowired
|
|
|
private SellerChangePriceRecordService sellerChangePriceRecordService;
|
|
|
|
|
|
public boolean isChangePriceOrder(int skup){
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
@Autowired
|
|
|
private ProductProxyService productProxyService;
|
|
|
|
|
|
|
|
|
public boolean isChangePriceOrder(long orderCode){
|
...
|
...
|
@@ -135,10 +134,10 @@ public class NotEntrySellerChangePriceService { |
|
|
if (CollectionUtils.isEmpty(scprList)){
|
|
|
logger.info("NotEntrySellerChangePriceService.changePrice there are not WAITING_DEAL or SUCCESS records, req {}", req);
|
|
|
//首次 或 全部失败
|
|
|
//todo 屏蔽商品
|
|
|
OrderSubmitResp osResp = nesChangePricePublishExcutor.publish(ctx);
|
|
|
|
|
|
sellerChangePriceRecordService.add(preOrderCode, preSkup,osResp.getOrderCode(), osResp.getSkup() );
|
|
|
//屏蔽商品
|
|
|
productProxyService.hiddenSkup(preSkup);
|
|
|
return osResp;
|
|
|
}
|
|
|
ChangePriceRecords cpr = splitChangePriceRecords(scprList);
|
...
|
...
|
@@ -155,6 +154,8 @@ public class NotEntrySellerChangePriceService { |
|
|
batchCancel(req.getUid(), cpr.waitingDealList);
|
|
|
OrderSubmitResp osResp = nesChangePricePublishExcutor.publish(ctx);
|
|
|
sellerChangePriceRecordService.add(preOrderCode, preSkup,osResp.getOrderCode(), osResp.getSkup() );
|
|
|
//屏蔽商品
|
|
|
productProxyService.hiddenSkup(preSkup);
|
|
|
return osResp;
|
|
|
}
|
|
|
return OrderSubmitResp.builder().tips("变价失败").build();
|
...
|
...
|
@@ -222,7 +223,22 @@ public class NotEntrySellerChangePriceService { |
|
|
}
|
|
|
|
|
|
long preOrderCode = scpr.getPreOrderCode();
|
|
|
sellerOrderCancelService.cancelSellerOrder(uid, preOrderCode);
|
|
|
Integer preSkup = scpr.getPreSkup();
|
|
|
try {
|
|
|
logger.info("in processAfterChangePriceOrderPaid cancel pre-SellerOrder , uid {} orderCode {} preOrderCode {}",
|
|
|
uid, orderCode, preOrderCode);
|
|
|
sellerOrderCancelService.cancelSellerOrder(uid, preOrderCode);
|
|
|
}catch (Exception ex){
|
|
|
logger.warn("in processAfterChangePriceOrderPaid cancelSellerOrder fail so need roll back, uid {} orderCode {} preOrderCode {}",
|
|
|
uid, orderCode, preOrderCode, ex);
|
|
|
rollBackWherPaidCallBackFail(uid, orderCode);
|
|
|
}finally {
|
|
|
productProxyService.cancelHiddenSkup(preSkup);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void rollBackWherPaidCallBackFail(int uid, long orderCode){
|
|
|
sellerOrderCancelService.cancelSellerOrder(uid, orderCode);
|
|
|
}
|
|
|
|
|
|
public void batchCancel(int uid, List<SellerChangePriceRecord> scprList){
|
...
|
...
|
@@ -280,25 +296,33 @@ public class NotEntrySellerChangePriceService { |
|
|
public int recordAutoCancelIfPresent(int uid, long orderCode){
|
|
|
ChangePriceStatus tcps = ChangePriceStatus.TIME_OUT,
|
|
|
scps = ChangePriceStatus.WAITING_DEAL;
|
|
|
return recordFailIfPresent(uid, orderCode, tcps, scps);
|
|
|
int num = recordFailIfPresent(uid, orderCode, tcps, scps);
|
|
|
|
|
|
return num;
|
|
|
}
|
|
|
|
|
|
|
|
|
private int recordFailIfPresent(int uid, long orderCode, ChangePriceStatus tcps, ChangePriceStatus sourceStatus){
|
|
|
logger.info("record Fail If Present SellerChangePriceRecord,uid {} orderCode {} target status {}",
|
|
|
uid, orderCode, tcps);
|
|
|
if (!isChangePriceOrder(orderCode)){
|
|
|
SellerChangePriceRecord scpr = sellerChangePriceRecordMapper.selectByOrderCode(orderCode);
|
|
|
if (Objects.isNull(scpr)){
|
|
|
logger.warn("record Fail If Present SellerChangePriceRecord find no record,uid {} orderCode {} target status {}",
|
|
|
uid, orderCode, tcps);
|
|
|
return 0;
|
|
|
}
|
|
|
Integer preskup = scpr.getPreSkup();
|
|
|
SellerChangePriceRecord scprc = new SellerChangePriceRecord();
|
|
|
scprc.setOrderCode(orderCode);
|
|
|
scprc.setStatus(tcps.getCode());
|
|
|
scprc.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
|
|
scprc.setRemark(tcps.getDesc());
|
|
|
scprc.setSourceStatus(sourceStatus.getCode());
|
|
|
return sellerChangePriceRecordMapper.updateByOrderCodeNStatus(scprc);
|
|
|
int num = sellerChangePriceRecordMapper.updateByOrderCodeNStatus(scprc);
|
|
|
if (num>0){
|
|
|
productProxyService.cancelHiddenSkup(preskup);
|
|
|
}
|
|
|
return num;
|
|
|
}
|
|
|
|
|
|
public int recordFail(long orderCode, ChangePriceStatus cps,ChangePriceStatus sourceStatus){
|
...
|
...
|
|