master
ljl 7 months ago
parent 902a34f36e
commit 863dc8a84f

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

Loading…
Cancel
Save