|
|
|
@ -171,7 +171,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
throw new RuntimeException(dsResponse.getReason());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (DsSuccessRetDTO successRet: dsResponse.getSuccessList()) {
|
|
|
|
|
List<DsSuccessRetDTO> successList = dsResponse.getSuccessList();
|
|
|
|
|
if (successList == null) {
|
|
|
|
|
successList = new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (DsSuccessRetDTO successRet: successList) {
|
|
|
|
|
List<PurchaseOrderRequestDTO> relatePurchaseOrderInfos = successRet.getRelatePurchaseOrderInfos();
|
|
|
|
|
boolean isUseManualConsignee = useManualConsigneeOrderIds.contains(successRet.getPlatformOrderId());
|
|
|
|
|
|
|
|
|
@ -365,7 +370,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
PurchaseOrderDsEncrypt log = new PurchaseOrderDsEncrypt();
|
|
|
|
|
log.setShopId();
|
|
|
|
|
// log.setShopId();
|
|
|
|
|
log.setOrderId(errorItem.getPlatformOrderId());
|
|
|
|
|
log.setIsEncryptOrder(errorItem.getIsEncryptOrder());
|
|
|
|
|
log.setIsSupportEncryptOrder(errorItem.getIsSupportEncryptOrder());
|
|
|
|
@ -632,7 +637,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
StringBuffer newShopNoteBuffer = new StringBuffer(oldSellerWords.length());
|
|
|
|
|
while (m.find()) {
|
|
|
|
|
hasMatch = true;
|
|
|
|
|
m.appendReplacement(newShopNoteBuffer, purchaseOrderRemark);
|
|
|
|
|
// m.appendReplacement(newShopNoteBuffer, purchaseOrderRemark);
|
|
|
|
|
}
|
|
|
|
|
m.appendTail(newShopNoteBuffer);
|
|
|
|
|
newSellerWords = newShopNoteBuffer.toString();
|
|
|
|
@ -674,7 +679,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
StringBuffer newShopNoteBuffer = new StringBuffer(oldShopNote.length());
|
|
|
|
|
while (m.find()) {
|
|
|
|
|
hasMatch = true;
|
|
|
|
|
m.appendReplacement(newShopNoteBuffer, purchaseOrderRemark);
|
|
|
|
|
// m.appendReplacement(newShopNoteBuffer, purchaseOrderRemark);
|
|
|
|
|
}
|
|
|
|
|
m.appendTail(newShopNoteBuffer);
|
|
|
|
|
newShopNote = newShopNoteBuffer.toString();
|
|
|
|
@ -693,6 +698,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String buildPurchaseOrderRemark(Long shopId, String appendRemarkTpl, List<PurchaseOrder> purchaseOrders) {
|
|
|
|
|
if (purchaseOrders.isEmpty()) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
appendRemarkTpl = buildRemarkTplHtml(appendRemarkTpl);
|
|
|
|
|
Shop shop = shopService.getDetailById(shopId);
|
|
|
|
|
List<String> purchaseOrderRemarks = new ArrayList<>();
|
|
|
|
@ -1383,8 +1391,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
PurchaseOrder purchaseOrder = purchaseOrders.iterator().next();
|
|
|
|
|
|
|
|
|
|
// TODO 加事务
|
|
|
|
|
purchaseOrderService.updateStatusByOrderId(shopId, orderId, StatusConst.normal);
|
|
|
|
|
purchaseOrderItemService.updateStatusByOrderId(shopId, orderId, StatusConst.normal);
|
|
|
|
|
purchaseOrderService.updateStatusByOrderId(shopId, orderId, StatusConst.cancel);
|
|
|
|
|
purchaseOrderItemService.updateStatusByOrderId(shopId, orderId, StatusConst.cancel);
|
|
|
|
|
opOrderExtService.updateFieldByOrderId(shopId, orderId, "filter_purchase_status", PurchaseOrderConst.FILTER_PURCHASE_STATUS_WAIT_PURCHASE);
|
|
|
|
|
if (opOrderDs != null) {
|
|
|
|
|
opOrderDsService.updateDsStatusByOrderId(shopId, orderId, DsOrderConst.DS_PURCHASE_STATUS_WAIT_PURCHASE, null);
|
|
|
|
@ -1418,7 +1426,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
for (PurchaseOrder purchaseOrder: purchaseOrders) {
|
|
|
|
|
int cancelPurchaseOrderItemCount = 0;
|
|
|
|
|
for (PurchaseOrderItem item: purchaseOrder.getItems()) {
|
|
|
|
|
if (Objects.equals(item.getStatus(), StatusConst.normal)) {
|
|
|
|
|
if (Objects.equals(item.getStatus(), StatusConst.cancel)) {
|
|
|
|
|
cancelPurchaseOrderItemCount ++;
|
|
|
|
|
}
|
|
|
|
|
if (!skuIds.contains(item.getSkuId())) {
|
|
|
|
@ -1447,11 +1455,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
|
|
|
|
|
if (needCancelPurchaseOrderItemIds.isEmpty()) {
|
|
|
|
|
throw new RuntimeException("该商品没有关联外部订单");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO 加事务
|
|
|
|
|
if (!needCancelPurchaseOrderIds.isEmpty()) {
|
|
|
|
|
purchaseOrderService.updateStatusByOrderId(shopId, orderId, StatusConst.normal);
|
|
|
|
|
purchaseOrderService.updateStatusByOrderId(shopId, orderId, StatusConst.cancel);
|
|
|
|
|
}
|
|
|
|
|
purchaseOrderItemService.updateStatusByOrderId(shopId, orderId, StatusConst.normal);
|
|
|
|
|
purchaseOrderItemService.updateStatusByOrderId(shopId, orderId, StatusConst.cancel);
|
|
|
|
|
updateOpOrderFilterPurchaseStatus(orderId, null);
|
|
|
|
|
for (PurchaseOrderCancelLog log: logs) {
|
|
|
|
|
purchaseOrderCancelLogService.insertSelective(log);
|
|
|
|
|