master
ljl 7 months ago
parent 902a34f36e
commit 863dc8a84f

@ -83,15 +83,13 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
}
boolean isRepurchase = false;
Map<String, PlatformPurchaseOrder> repurchasePlatformPurchaseOrderMap = new HashMap<>();
if (!platformPurchaseOrders.isEmpty()) {
for (PlatformPurchaseOrder platformPurchaseOrder: platformPurchaseOrders) {
log.info("platformPurchaseOrder[" + platformPurchaseOrder.getPurOrderId() + "]exist, purchaseStatus:" + platformPurchaseOrder.getPurchaseStatus());
if (platformPurchaseOrder.getPurchaseStatus().equals(StatusConst.cancel)) {
isRepurchase = true;
platformPurchaseOrder.setPurchaseStatus(PurchaseOrderConst.PURCHASE_ORDER_STATUS_WAIT_PAY);
platformPurchaseOrder.setStatus(StatusConst.normal);
platformPurchaseOrder.setGmtModified(new Date());
platformPurchaseOrderMapper.updateByPrimaryKeySelective(platformPurchaseOrder);
repurchasePlatformPurchaseOrderMap.put(platformPurchaseOrder.getPurOrderId(), platformPurchaseOrder);
}
}
}
@ -124,11 +122,19 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
purchaseOrderItems.addAll(items);
OrderResult orderResult = buildOrderResult(purchaseOrderDTO, orderIdAndPurOrderIdMap, skuIdAndPurSkuOrderIdMap);
orderResults.add(orderResult);
if (isRepurchase && repurchasePlatformPurchaseOrderMap.containsKey(purOrderId)) {
PlatformPurchaseOrder platformPurchaseOrder = repurchasePlatformPurchaseOrderMap.get(purOrderId);
platformPurchaseOrder.setPurchaseStatus(PurchaseOrderConst.PURCHASE_ORDER_STATUS_WAIT_PAY);
platformPurchaseOrder.setStatus(StatusConst.normal);
platformPurchaseOrder.setGmtModified(new Date());
platformPurchaseOrderMapper.updateByPrimaryKeySelective(platformPurchaseOrder);
}
}
}
data.setOrderResults(orderResults);
List<PurchaseOrder> currentPurchaseOrders = purchaseOrderMapper.getListByPurOrderId(purOrderIds.iterator().next());
if (currentPurchaseOrders.isEmpty()) {
if (currentPurchaseOrders.isEmpty() || isRepurchase) {
purchaseOrderMapper.insertBatch(purchaseOrders);
purchaseOrderItemMapper.insertBatch(purchaseOrderItems);
}

Loading…
Cancel
Save