|
|
|
@ -61,9 +61,6 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private OpOrderAmountDetailService opOrderAmountDetailService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private OpOrderRedpackInfoService opOrderRedpackInfoService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private PurchaseSettingService purchaseSettingService;
|
|
|
|
|
|
|
|
|
@ -321,19 +318,11 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkItems(List<PlatformOrderItemDTO> items) {
|
|
|
|
|
for (PlatformOrderItemDTO item: items) {
|
|
|
|
|
if (item.getSourceSkuId() == 0 || item.getItemTotal() == 0) {
|
|
|
|
|
throw new RuntimeException("items参数错误");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void rebuildPlatformOrderItems(List<PlatformOrderDTO> platformOrders) {
|
|
|
|
|
Stream<String> orderIdsStream = platformOrders.stream().map(PlatformOrderDTO::getPlatformOrderId);
|
|
|
|
|
List<String> orderIds = orderIdsStream.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<Integer> skuIds = new ArrayList<>();
|
|
|
|
|
List<Long> skuIds = new ArrayList<>();
|
|
|
|
|
for (PlatformOrderDTO platformOrder: platformOrders) {
|
|
|
|
|
for (PlatformOrderItemDTO item: platformOrder.getItems()) {
|
|
|
|
|
skuIds.add(item.getSourceSkuId());
|
|
|
|
@ -343,7 +332,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
HashMap<String, HashMap<Long, String>> orderIdAndSkuIdAndSkuSubNameMap = opOrderChildService.getOrderIdAndSkuIdAndSkuSubNameMap(orderIds, skuIds);
|
|
|
|
|
for (PlatformOrderDTO platformOrder: platformOrders) {
|
|
|
|
|
for (PlatformOrderItemDTO item: platformOrder.getItems()) {
|
|
|
|
|
item.setPlatformSkuSubName(orderIdAndSkuIdAndSkuSubNameMap.get(platformOrder.getPlatformOrderId()).get(Long.valueOf(item.getSourceSkuId())));
|
|
|
|
|
item.setPlatformSkuSubName(orderIdAndSkuIdAndSkuSubNameMap.get(platformOrder.getPlatformOrderId()).get(item.getSourceSkuId()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -482,7 +471,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
boolean hasMultiPackageOutstorage = opOrder.getOrderStatus().equals(OrderConst.ORDER_STATUS_PART_DELIVERY);
|
|
|
|
|
|
|
|
|
|
OrderPackageInfoDTO orderPackageInfoDTO = new OrderPackageInfoDTO();
|
|
|
|
|
orderPackageInfoDTO.setDeliveryInfo(deliveryInfo);;
|
|
|
|
|
orderPackageInfoDTO.setDeliveryInfo(deliveryInfo);
|
|
|
|
|
orderPackageInfoDTO.setPackageList(packageList);
|
|
|
|
|
orderPackageInfoDTO.setHasAfterSaleChildOrder(hasAfterSaleChildOrder);
|
|
|
|
|
orderPackageInfoDTO.setHasMultiPackageOutstorage(hasMultiPackageOutstorage);
|
|
|
|
@ -601,7 +590,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
return newSellerWords;
|
|
|
|
|
}
|
|
|
|
|
newSellerWords = newSellerWords.replaceAll(appChineseName, "0.0");
|
|
|
|
|
if (newSellerWords.equals(oldSellerWords) && shopRemarkFlag.equals(opOrder.getSellerRemarkStars())) {
|
|
|
|
|
if (newSellerWords.equals(oldSellerWords) && String.valueOf(shopRemarkFlag).equals(opOrder.getSellerRemarkStars())) {
|
|
|
|
|
return newSellerWords;
|
|
|
|
|
}
|
|
|
|
|
opOrderExtService.updateOpOrderShopNote(shopId, orderId, newSellerWords);
|
|
|
|
@ -808,9 +797,10 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
BigDecimal purchaseOrderPayment = new BigDecimal(purchaseOrderRequestDto.getPurchaseOrderPayment());
|
|
|
|
|
dbPurchaseOrder.setPurchaseOrderPayment(purchaseOrderPayment);
|
|
|
|
|
}
|
|
|
|
|
comparePurchaseOrderAndAddUpdateLog(purchaseOrderRequestDto, opOrder.getShopId(), PurchaseOrderConst.ACTION_RSYNC);
|
|
|
|
|
checkPurchaseOrderLogisticsChangeAndAddTag(purchaseOrderRequestDto, dbPurchaseOrder);
|
|
|
|
|
|
|
|
|
|
OpOrderExt orderExt = opOrderExtService.getByOrderId(dbPurchaseOrder.getOrderId());
|
|
|
|
|
|
|
|
|
|
if ("normal".equals(dbPurchaseOrder.getStatus()) && orderExt != null && orderExt.getFilterPurchaseStatus() != null) {
|
|
|
|
|
updateOpOrderFilterPurchaseStatus(opOrder.getOrderId(), orderExt);
|
|
|
|
|
}
|
|
|
|
@ -914,7 +904,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
|
|
|
|
|
List<PurchaseOrderItem> purchaseOrderItems = purchaseOrderItemService.getRelatedPurchaseOrderItems(opOrderDs.getShopId(), orderId);
|
|
|
|
|
List<String> purchaseWareIds;
|
|
|
|
|
List<Long> dsPurchaseSkuIds = new ArrayList<>();
|
|
|
|
|
List<String> dsPurchaseSkuIds = new ArrayList<>();
|
|
|
|
|
List<String> purchaseDsProductIds = new ArrayList<>();
|
|
|
|
|
if (!purchaseOrderItems.isEmpty()) {
|
|
|
|
|
Stream<String> wareIdsStream = purchaseOrderItems.stream().map(PurchaseOrderItem::getWareId);
|
|
|
|
@ -923,7 +913,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
if (purchaseOrderItem.getPurchasePlatform().equals(purchasePlatform)) {
|
|
|
|
|
purchaseDsProductIds.add(purchaseOrderItem.getWareId());
|
|
|
|
|
dsProductIds.add(purchaseOrderItem.getWareId());
|
|
|
|
|
dsPurchaseSkuIds.add(purchaseOrderItem.getSkuId());
|
|
|
|
|
dsPurchaseSkuIds.add(String.valueOf(purchaseOrderItem.getSkuId()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
@ -933,7 +923,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
List<String> noPurchaseDsProductIds = dsProductIds.stream().filter(i -> !purchaseWareIds.contains(i)).collect(Collectors.toList());
|
|
|
|
|
List<String> notPurchaseDsSkuIds = dsProductIds.stream().filter(i -> !dsPurchaseSkuIds.contains(i)).collect(Collectors.toList());
|
|
|
|
|
List<Long> notDsAndDsPurchaseSkuIds = skuIdList.stream().filter(i -> !dsOrderSkuIds.contains(i)).collect(Collectors.toList());
|
|
|
|
|
notDsAndDsPurchaseSkuIds = notDsAndDsPurchaseSkuIds.stream().filter(i -> !dsPurchaseSkuIds.contains(i)).collect(Collectors.toList());
|
|
|
|
|
notDsAndDsPurchaseSkuIds = notDsAndDsPurchaseSkuIds.stream().filter(i -> !dsPurchaseSkuIds.contains(String.valueOf(i))).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
if (orderPrintService.checkAndDeleteOpOrderDs(purchasePlatform, orderId, productToDsItemList, purchaseOrderItems)) {
|
|
|
|
|
return;
|
|
|
|
@ -1015,11 +1005,6 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
opOrderDsService.updateByPrimaryKeySelective(opOrderDs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void addPurchaseOrderRefundOrderTipMsg(Long shopId, String orderId, String purchaseOrderStatus, Long purchaseOrderId) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void savePurchaseOrderInfo(PurchaseOrderRequestDTO purchaseOrderRequestDto, OpOrder opOrder, HashMap<Long, OpOrderChild> skuIdAndOpOrderChildMap) {
|
|
|
|
|
purchaseAccountService.savePurchaseAccount(opOrder.getShopId(), purchaseOrderRequestDto.getPurchasePlatform(), purchaseOrderRequestDto.getPurchaseOrderBuyer());
|
|
|
|
|
PurchaseOrder dbPurchaseOrder = purchaseOrderService.getByPlatformAndPurchaseOrderSn(purchaseOrderRequestDto.getPurchasePlatform(), purchaseOrderRequestDto.getPurchaseOrderSn());
|
|
|
|
@ -1145,10 +1130,6 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
return log;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void savePurchaseOrderSetting(Long shopId) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private PurchaseOrder buildPurchaseOrderByDto(PurchaseOrderRequestDTO purchaseOrderRequestDto, PurchaseOrder oldPurchaseOrder, OpOrder opOrder) {
|
|
|
|
|
PurchaseOrder purchaseOrder = oldPurchaseOrder;
|
|
|
|
|
if (purchaseOrder == null) {
|
|
|
|
@ -1240,6 +1221,14 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
return isReapt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void getOrderPurchaseItemsOldPackageInfo(PurchaseOrder purchaseOrder) {
|
|
|
|
|
List<PurchaseOrderItem> purchaseOrderItems = purchaseOrderItemService.getRelatePurchaseOrderItemsByPurchaseOrderId(purchaseOrder.getPurchaseOrderId());
|
|
|
|
|
List<Long> skuIds = purchaseOrderItems.stream().map(PurchaseOrderItem::getSkuId).collect(Collectors.toList());
|
|
|
|
|
List<String> orderIds = new ArrayList<>();
|
|
|
|
|
orderIds.add(purchaseOrder.getOrderId());
|
|
|
|
|
opOrderChildService.getListByOrderIdsAndSkuIds(orderIds, skuIds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public GetPurchaseOrderItemsAndSourceItemsResponseDTO getSourceSkuInfos(Long shopId, List<OrderItemDTO> orderItems) {
|
|
|
|
|
Stream<String> orderIdsStream = orderItems.stream().map(OrderItemDTO::getOrderId);
|
|
|
|
|