Browse Source
- 新增 AmazonVcSubPlatform,注册 AMAZON_VC(platform_code 10035) - VcShopSource:/basicOpen/platformAuth/vcSeller/pageList, offset/length 内部翻页,只保留 status=1 的店铺 - VcOrderSource:/basicOpen/platformOrder/vcOrder/pageList, purchase_order_type=[0,1,2],search_field_time=3,窗口 ≤90 天 - 详情按类型分派:DF 用 vc_store_id + purchase_order_number, PO 用 local_po_number;DI 无详情,回退列表数据 - get() 先按订单编号搜索拿类型与 local_po_number,再调对应详情 - 新增 VC 店铺/订单 DTO 与冒烟用例 说明:purchase_order_date 文档未标时区,暂按北京时间解析,待真实报文核对feature/supplier-lingxing
13 changed files with 1204 additions and 2 deletions
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
package common.ecommerce.lingxing.platform.amazon; |
||||
|
||||
import common.ecommerce.http.HttpTransport; |
||||
import common.ecommerce.http.JacksonJsonCodec; |
||||
import common.ecommerce.lingxing.platform.LingxingSubPlatform; |
||||
import common.ecommerce.lingxing.platform.amazon.vc.order.VcOrderSource; |
||||
import common.ecommerce.lingxing.platform.amazon.vc.shop.VcShopSource; |
||||
import common.ecommerce.lingxing.platform.order.LingxingOrderSource; |
||||
import common.ecommerce.lingxing.platform.shop.LingxingShopSource; |
||||
import common.ecommerce.model.Platform; |
||||
|
||||
/** |
||||
* 领星 · 亚马逊 VC 子平台:店铺与订单,只做能力组合。 |
||||
* |
||||
* <p>VC 目前没有商品与结算接口;能力由 Source 是否装配决定, |
||||
* 未装配的能力不会被声明。</p> |
||||
*/ |
||||
public final class AmazonVcSubPlatform implements LingxingSubPlatform { |
||||
|
||||
private final LingxingOrderSource orders; |
||||
private final LingxingShopSource shops; |
||||
|
||||
public AmazonVcSubPlatform(HttpTransport transport, JacksonJsonCodec json) { |
||||
this.orders = new VcOrderSource(); |
||||
this.shops = new VcShopSource(); |
||||
} |
||||
|
||||
@Override |
||||
public Platform platform() { |
||||
return Platform.AMAZON_VC; |
||||
} |
||||
|
||||
@Override |
||||
public LingxingOrderSource orderSource() { |
||||
return orders; |
||||
} |
||||
|
||||
@Override |
||||
public LingxingShopSource shopSource() { |
||||
return shops; |
||||
} |
||||
} |
||||
@ -0,0 +1,102 @@
@@ -0,0 +1,102 @@
|
||||
package common.ecommerce.lingxing.platform.amazon.vc.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
||||
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
/** |
||||
* 领星 · 亚马逊 VC 订单详情的商品行(DF / PO 共用)。 |
||||
* |
||||
* <p>两套详情接口的字段高度重合,只有 {@code waiting_shipped_amount} 与 |
||||
* {@code to_ship_amount} 的区别,用同一个 DTO 接收,未知字段忽略。</p> |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@JsonIgnoreProperties(ignoreUnknown = true) |
||||
public class VcOrderDetailItemDto { |
||||
|
||||
@JsonProperty("sequence_number") |
||||
private String sequenceNumber; |
||||
|
||||
@JsonProperty("asin") |
||||
private String asin; |
||||
|
||||
@JsonProperty("asin_url") |
||||
private String asinUrl; |
||||
|
||||
/** 平台 MSKU。 */ |
||||
@JsonProperty("msku") |
||||
private String msku; |
||||
|
||||
@JsonProperty("item_name") |
||||
private String itemName; |
||||
|
||||
@JsonProperty("large_main_image_url") |
||||
private String largeMainImageUrl; |
||||
|
||||
@JsonProperty("medium_main_image_url") |
||||
private String mediumMainImageUrl; |
||||
|
||||
@JsonProperty("small_main_image_url") |
||||
private String smallMainImageUrl; |
||||
|
||||
@JsonProperty("pic_url") |
||||
private String picUrl; |
||||
|
||||
@JsonProperty("local_sku") |
||||
private String localSku; |
||||
|
||||
@JsonProperty("local_name") |
||||
private String localName; |
||||
|
||||
/** 采购量;文档类型是 string。 */ |
||||
@JsonProperty("purchase_amount") |
||||
private String purchaseAmount; |
||||
|
||||
@JsonProperty("shipped_amount") |
||||
private String shippedAmount; |
||||
|
||||
/** DF 的待发货量。 */ |
||||
@JsonProperty("waiting_shipped_amount") |
||||
private String waitingShippedAmount; |
||||
|
||||
/** PO 的待发货量。 */ |
||||
@JsonProperty("to_ship_amount") |
||||
private String toShipAmount; |
||||
|
||||
@JsonProperty("available_amount") |
||||
private Integer availableAmount; |
||||
|
||||
/** 单价。 */ |
||||
@JsonProperty("unit_price") |
||||
private String unitPrice; |
||||
|
||||
/** 成本价。 */ |
||||
@JsonProperty("net_price") |
||||
private String netPrice; |
||||
|
||||
@JsonProperty("net_price_currency_code") |
||||
private String netPriceCurrencyCode; |
||||
|
||||
@JsonProperty("tax_amount") |
||||
private String taxAmount; |
||||
|
||||
@JsonProperty("tax_amount_currency_code") |
||||
private String taxAmountCurrencyCode; |
||||
|
||||
@JsonProperty("tax_rate") |
||||
private String taxRate; |
||||
|
||||
@JsonProperty("tax_rate_percent") |
||||
private String taxRatePercent; |
||||
|
||||
@JsonProperty("deal_total_price") |
||||
private String dealTotalPrice; |
||||
|
||||
@JsonProperty("deal_unit_price") |
||||
private String dealUnitPrice; |
||||
|
||||
@JsonProperty("is_back_order_allowed") |
||||
private String isBackOrderAllowed; |
||||
} |
||||
@ -0,0 +1,102 @@
@@ -0,0 +1,102 @@
|
||||
package common.ecommerce.lingxing.platform.amazon.vc.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
||||
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 领星 · 亚马逊 VC 订单详情【DF】 |
||||
* ({@code /basicOpen/platformOrder/vcOrderDf/detail} 的 {@code data})。 |
||||
* |
||||
* <p>{@code data} 是对象,不是数组。</p> |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@JsonIgnoreProperties(ignoreUnknown = true) |
||||
public class VcOrderDfDetailDto { |
||||
|
||||
@JsonProperty("vc_store_id") |
||||
private String vcStoreId; |
||||
|
||||
@JsonProperty("seller_name") |
||||
private String sellerName; |
||||
|
||||
@JsonProperty("local_po_number") |
||||
private String localPoNumber; |
||||
|
||||
@JsonProperty("purchase_order_number") |
||||
private String purchaseOrderNumber; |
||||
|
||||
/** 下单时间。 */ |
||||
@JsonProperty("purchase_order_date") |
||||
private String purchaseOrderDate; |
||||
|
||||
/** New / SHIPPED / ACCEPTED / CANCELED。 */ |
||||
@JsonProperty("purchase_order_state") |
||||
private String purchaseOrderState; |
||||
|
||||
/** 0 DF、1 PO。 */ |
||||
@JsonProperty("purchase_order_type") |
||||
private String purchaseOrderType; |
||||
|
||||
@JsonProperty("bill_to_party_id") |
||||
private String billToPartyId; |
||||
|
||||
@JsonProperty("ship_from_party_id") |
||||
private String shipFromPartyId; |
||||
|
||||
@JsonProperty("related_warehouse_id") |
||||
private String relatedWarehouseId; |
||||
|
||||
@JsonProperty("related_warehouse_name") |
||||
private String relatedWarehouseName; |
||||
|
||||
@JsonProperty("ship_method") |
||||
private String shipMethod; |
||||
|
||||
/** 要求发货时间。 */ |
||||
@JsonProperty("ship_window_time") |
||||
private String shipWindowTime; |
||||
|
||||
/** 承诺送达时间。 */ |
||||
@JsonProperty("promised_delivery_date") |
||||
private String promisedDeliveryDate; |
||||
|
||||
@JsonProperty("is_pslip_required") |
||||
private String isPslipRequired; |
||||
|
||||
@JsonProperty("is_gift") |
||||
private String isGift; |
||||
|
||||
@JsonProperty("is_scheduled_delivery_shipment") |
||||
private String isScheduledDeliveryShipment; |
||||
|
||||
@JsonProperty("is_priority_shipment") |
||||
private String isPriorityShipment; |
||||
|
||||
@JsonProperty("message_to_customer") |
||||
private String messageToCustomer; |
||||
|
||||
@JsonProperty("total_price") |
||||
private String totalPrice; |
||||
|
||||
@JsonProperty("currency_code") |
||||
private String currencyCode; |
||||
|
||||
@JsonProperty("currency_icon") |
||||
private String currencyIcon; |
||||
|
||||
/** 货物数量;文档类型是 string。 */ |
||||
@JsonProperty("item_amount") |
||||
private String itemAmount; |
||||
|
||||
@JsonProperty("remark") |
||||
private String remark; |
||||
|
||||
@JsonProperty("items") |
||||
private List<VcOrderDetailItemDto> items = new ArrayList<VcOrderDetailItemDto>(); |
||||
} |
||||
@ -0,0 +1,120 @@
@@ -0,0 +1,120 @@
|
||||
package common.ecommerce.lingxing.platform.amazon.vc.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
||||
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 领星 · 亚马逊 VC 订单列表条目 |
||||
* ({@code /basicOpen/platformOrder/vcOrder/pageList} 的 {@code data[]})。 |
||||
* |
||||
* <p>列表已经带商品行与订单总额,可以直接映射成统一订单;详情接口补充 |
||||
* 发货窗口、仓库、收件方等信息。</p> |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@JsonIgnoreProperties(ignoreUnknown = true) |
||||
public class VcOrderDto { |
||||
|
||||
@JsonProperty("gmt_create") |
||||
private String gmtCreate; |
||||
|
||||
@JsonProperty("gmt_modified") |
||||
private String gmtModified; |
||||
|
||||
/** 领星订单 id。 */ |
||||
@JsonProperty("id") |
||||
private String id; |
||||
|
||||
/** 订单编号,平台单号,参与 canonicalKey。 */ |
||||
@JsonProperty("purchase_order_number") |
||||
private String purchaseOrderNumber; |
||||
|
||||
/** 客户订单号(DF 类型)。 */ |
||||
@JsonProperty("customer_order_number") |
||||
private String customerOrderNumber; |
||||
|
||||
/** VC 店铺 id。 */ |
||||
@JsonProperty("vc_store_id") |
||||
private String vcStoreId; |
||||
|
||||
@JsonProperty("seller_name") |
||||
private String sellerName; |
||||
|
||||
/** 订单类型:0 DF、1 PO、2 DI。 */ |
||||
@JsonProperty("purchase_order_type") |
||||
private Integer purchaseOrderType; |
||||
|
||||
/** DF:New / SHIPPED / ACCEPTED / CANCELLED;PO:Acknowledged / Closed。 */ |
||||
@JsonProperty("purchase_order_state") |
||||
private String purchaseOrderState; |
||||
|
||||
/** 订单流转状态:0 待处理、1 待发货、2 已完成、3 已取消。 */ |
||||
@JsonProperty("purchase_order_process_state") |
||||
private Integer purchaseOrderProcessState; |
||||
|
||||
/** 订单下单时间。 */ |
||||
@JsonProperty("purchase_order_date") |
||||
private String purchaseOrderDate; |
||||
|
||||
@JsonProperty("ack_status") |
||||
private Integer ackStatus; |
||||
|
||||
@JsonProperty("ack_status_desc") |
||||
private String ackStatusDesc; |
||||
|
||||
@JsonProperty("ack_update_time") |
||||
private String ackUpdateTime; |
||||
|
||||
/** DF 要求发货时间。 */ |
||||
@JsonProperty("ship_window_time") |
||||
private String shipWindowTime; |
||||
|
||||
/** PO 要求起始发货时间。 */ |
||||
@JsonProperty("ship_window_start") |
||||
private String shipWindowStart; |
||||
|
||||
/** PO 要求截止发货时间;文档字段名是 ship_windows_end。 */ |
||||
@JsonProperty("ship_windows_end") |
||||
private String shipWindowsEnd; |
||||
|
||||
@JsonProperty("total_price") |
||||
private String totalPrice; |
||||
|
||||
@JsonProperty("currency_code") |
||||
private String currencyCode; |
||||
|
||||
@JsonProperty("currency_icon") |
||||
private String currencyIcon; |
||||
|
||||
/** 货物总数量。 */ |
||||
@JsonProperty("item_amount") |
||||
private Integer itemAmount; |
||||
|
||||
/** 本地 PO 号,PO 详情接口的入参。 */ |
||||
@JsonProperty("local_po_number") |
||||
private String localPoNumber; |
||||
|
||||
@JsonProperty("ship_to_party_id") |
||||
private String shipToPartyId; |
||||
|
||||
@JsonProperty("remark") |
||||
private String remark; |
||||
|
||||
@JsonProperty("shipment_confirm_status") |
||||
private Integer shipmentConfirmStatus; |
||||
|
||||
@JsonProperty("shipment_label_status") |
||||
private Integer shipmentLabelStatus; |
||||
|
||||
@JsonProperty("print_num") |
||||
private Integer printNum; |
||||
|
||||
/** 商品行。 */ |
||||
@JsonProperty("purchase_order_sku_list") |
||||
private List<VcOrderItemDto> purchaseOrderSkuList = new ArrayList<VcOrderItemDto>(); |
||||
} |
||||
@ -0,0 +1,111 @@
@@ -0,0 +1,111 @@
|
||||
package common.ecommerce.lingxing.platform.amazon.vc.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
||||
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
/** |
||||
* 领星 · 亚马逊 VC 订单列表的商品行 |
||||
* ({@code data[].purchase_order_sku_list[]})。 |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@JsonIgnoreProperties(ignoreUnknown = true) |
||||
public class VcOrderItemDto { |
||||
|
||||
@JsonProperty("id") |
||||
private String id; |
||||
|
||||
@JsonProperty("vc_store_id") |
||||
private String vcStoreId; |
||||
|
||||
@JsonProperty("asin") |
||||
private String asin; |
||||
|
||||
@JsonProperty("parent_asin") |
||||
private String parentAsin; |
||||
|
||||
@JsonProperty("item_name") |
||||
private String itemName; |
||||
|
||||
/** 采购量。 */ |
||||
@JsonProperty("purchase_amount") |
||||
private Integer purchaseAmount; |
||||
|
||||
@JsonProperty("sequence_number") |
||||
private String sequenceNumber; |
||||
|
||||
/** 平台商品编码(Vendor SKU)。 */ |
||||
@JsonProperty("vendor_product_id") |
||||
private String vendorProductId; |
||||
|
||||
@JsonProperty("local_po_number") |
||||
private String localPoNumber; |
||||
|
||||
@JsonProperty("purchase_order_number") |
||||
private String purchaseOrderNumber; |
||||
|
||||
/** 单价。 */ |
||||
@JsonProperty("unit_price") |
||||
private String unitPrice; |
||||
|
||||
/** 成本价。 */ |
||||
@JsonProperty("net_price") |
||||
private String netPrice; |
||||
|
||||
@JsonProperty("net_price_currency_code") |
||||
private String netPriceCurrencyCode; |
||||
|
||||
/** 税额。 */ |
||||
@JsonProperty("tax_amount") |
||||
private String taxAmount; |
||||
|
||||
@JsonProperty("tax_amount_currency_code") |
||||
private String taxAmountCurrencyCode; |
||||
|
||||
@JsonProperty("tax_rate") |
||||
private String taxRate; |
||||
|
||||
@JsonProperty("tax_rate_percent") |
||||
private String taxRatePercent; |
||||
|
||||
@JsonProperty("deal_total_price") |
||||
private String dealTotalPrice; |
||||
|
||||
@JsonProperty("deal_unit_price") |
||||
private String dealUnitPrice; |
||||
|
||||
@JsonProperty("shipped_amount") |
||||
private Integer shippedAmount; |
||||
|
||||
@JsonProperty("to_ship_amount") |
||||
private Integer toShipAmount; |
||||
|
||||
@JsonProperty("local_name") |
||||
private String localName; |
||||
|
||||
@JsonProperty("local_sku") |
||||
private String localSku; |
||||
|
||||
@JsonProperty("product_id") |
||||
private String productId; |
||||
|
||||
@JsonProperty("available_amount") |
||||
private Integer availableAmount; |
||||
|
||||
@JsonProperty("asin_url") |
||||
private String asinUrl; |
||||
|
||||
@JsonProperty("pic_url") |
||||
private String picUrl; |
||||
|
||||
@JsonProperty("accepted_quantity") |
||||
private Integer acceptedQuantity; |
||||
|
||||
@JsonProperty("rejected_quantity") |
||||
private Integer rejectedQuantity; |
||||
|
||||
@JsonProperty("received_quantity") |
||||
private Integer receivedQuantity; |
||||
} |
||||
@ -0,0 +1,92 @@
@@ -0,0 +1,92 @@
|
||||
package common.ecommerce.lingxing.platform.amazon.vc.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
||||
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 领星 · 亚马逊 VC 订单详情【PO】 |
||||
* ({@code /basicOpen/platformOrder/vcOrderPo/detail} 的 {@code data})。 |
||||
* |
||||
* <p>PO 详情按 {@code local_po_number} 查询,不是按订单编号。</p> |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@JsonIgnoreProperties(ignoreUnknown = true) |
||||
public class VcOrderPoDetailDto { |
||||
|
||||
@JsonProperty("vc_store_id") |
||||
private String vcStoreId; |
||||
|
||||
@JsonProperty("seller_name") |
||||
private String sellerName; |
||||
|
||||
@JsonProperty("purchase_order_number") |
||||
private String purchaseOrderNumber; |
||||
|
||||
/** 本地 PO 号,PO 详情接口的入参。 */ |
||||
@JsonProperty("local_po_number") |
||||
private String localPoNumber; |
||||
|
||||
@JsonProperty("purchase_order_date") |
||||
private String purchaseOrderDate; |
||||
|
||||
/** Acknowledged / Closed。 */ |
||||
@JsonProperty("purchase_order_state") |
||||
private String purchaseOrderState; |
||||
|
||||
/** 0 待处理、1 确认中、2 确认成功、3 确认失败。 */ |
||||
@JsonProperty("purchase_order_process_state") |
||||
private String purchaseOrderProcessState; |
||||
|
||||
@JsonProperty("payment_method") |
||||
private String paymentMethod; |
||||
|
||||
/** 0 DF、1 PO。 */ |
||||
@JsonProperty("purchase_order_type") |
||||
private String purchaseOrderType; |
||||
|
||||
@JsonProperty("remark") |
||||
private String remark; |
||||
|
||||
@JsonProperty("related_warehouse_id") |
||||
private String relatedWarehouseId; |
||||
|
||||
@JsonProperty("related_warehouse_name") |
||||
private String relatedWarehouseName; |
||||
|
||||
@JsonProperty("ship_to_party_id") |
||||
private String shipToPartyId; |
||||
|
||||
@JsonProperty("total_price") |
||||
private String totalPrice; |
||||
|
||||
@JsonProperty("currency_code") |
||||
private String currencyCode; |
||||
|
||||
@JsonProperty("currency_icon") |
||||
private String currencyIcon; |
||||
|
||||
/** 货物数量;文档类型是 string。 */ |
||||
@JsonProperty("item_amount") |
||||
private String itemAmount; |
||||
|
||||
@JsonProperty("ship_window_start") |
||||
private String shipWindowStart; |
||||
|
||||
@JsonProperty("ship_window_end") |
||||
private String shipWindowEnd; |
||||
|
||||
@JsonProperty("delivery_window_start") |
||||
private String deliveryWindowStart; |
||||
|
||||
@JsonProperty("delivery_window_end") |
||||
private String deliveryWindowEnd; |
||||
|
||||
@JsonProperty("items") |
||||
private List<VcOrderDetailItemDto> items = new ArrayList<VcOrderDetailItemDto>(); |
||||
} |
||||
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
package common.ecommerce.lingxing.platform.amazon.vc.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
||||
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
/** |
||||
* 领星 · 亚马逊 VC 店铺({@code /basicOpen/platformAuth/vcSeller/pageList} 的 {@code data[]})。 |
||||
* |
||||
* <p>唯一键是 {@code vc_store_id},VC 订单接口与详情接口都用它指定店铺。</p> |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
@JsonIgnoreProperties(ignoreUnknown = true) |
||||
public class VcShopDto { |
||||
|
||||
/** 账号 id。 */ |
||||
@JsonProperty("account_id") |
||||
private Long accountId; |
||||
|
||||
/** SELLER_ID。 */ |
||||
@JsonProperty("seller_id") |
||||
private String sellerId; |
||||
|
||||
/** 账号名称。 */ |
||||
@JsonProperty("account_name") |
||||
private String accountName; |
||||
|
||||
/** 站点简称,如 na。 */ |
||||
@JsonProperty("region") |
||||
private String region; |
||||
|
||||
/** 站点名称,如 北美洲。 */ |
||||
@JsonProperty("region_name") |
||||
private String regionName; |
||||
|
||||
/** VC 店铺 id,唯一键。 */ |
||||
@JsonProperty("vc_store_id") |
||||
private String vcStoreId; |
||||
|
||||
/** 店铺名称。 */ |
||||
@JsonProperty("name") |
||||
private String name; |
||||
|
||||
/** |
||||
* 店铺授权服务状态: |
||||
* -1 删除、0 暂停同步、1 正常同步、2 授权异常。 |
||||
*/ |
||||
@JsonProperty("status") |
||||
private Integer status; |
||||
|
||||
/** 站点 id。 */ |
||||
@JsonProperty("mid") |
||||
private Integer mid; |
||||
} |
||||
@ -0,0 +1,411 @@
@@ -0,0 +1,411 @@
|
||||
package common.ecommerce.lingxing.platform.amazon.vc.order; |
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode; |
||||
|
||||
import common.ecommerce.error.ChannelException; |
||||
import common.ecommerce.error.ValidationException; |
||||
import common.ecommerce.http.HttpRequest; |
||||
import common.ecommerce.http.HttpResponse; |
||||
import common.ecommerce.lingxing.LingxingApi; |
||||
import common.ecommerce.lingxing.LingxingConstants; |
||||
import common.ecommerce.lingxing.http.LingxingEnvelope; |
||||
import common.ecommerce.lingxing.mapper.LingxingOrderMapper; |
||||
import common.ecommerce.lingxing.platform.LingxingCall; |
||||
import common.ecommerce.lingxing.platform.amazon.vc.dto.VcOrderDetailItemDto; |
||||
import common.ecommerce.lingxing.platform.amazon.vc.dto.VcOrderDfDetailDto; |
||||
import common.ecommerce.lingxing.platform.amazon.vc.dto.VcOrderDto; |
||||
import common.ecommerce.lingxing.platform.amazon.vc.dto.VcOrderItemDto; |
||||
import common.ecommerce.lingxing.platform.amazon.vc.dto.VcOrderPoDetailDto; |
||||
import common.ecommerce.lingxing.platform.order.LingxingOrderSource; |
||||
import common.ecommerce.model.ChannelProvider; |
||||
import common.ecommerce.model.account.ChannelAccount; |
||||
import common.ecommerce.model.order.OrderLine; |
||||
import common.ecommerce.model.order.SalesOrder; |
||||
import common.ecommerce.model.order.SalesOrderQuery; |
||||
import common.ecommerce.model.support.Money; |
||||
import common.ecommerce.model.support.Page; |
||||
import common.ecommerce.model.support.PlatformTime; |
||||
|
||||
import java.time.Instant; |
||||
import java.time.LocalDate; |
||||
import java.time.LocalDateTime; |
||||
import java.time.ZoneId; |
||||
import java.time.format.DateTimeFormatter; |
||||
import java.time.format.DateTimeParseException; |
||||
import java.time.temporal.ChronoUnit; |
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.Collections; |
||||
import java.util.LinkedHashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 领星 · 亚马逊 VC 订单。 |
||||
* |
||||
* <p>列表 {@link LingxingApi#ORDER_LIST_AMAZON_VC} 同时覆盖 DF / PO / DI, |
||||
* 并且已经返回商品行与订单总额。详情分两个接口:</p> |
||||
* <ul> |
||||
* <li>{@link LingxingApi#ORDER_DETAIL_DF_AMAZON_VC}:入参 {@code vc_store_id} + {@code purchase_order_number}</li> |
||||
* <li>{@link LingxingApi#ORDER_DETAIL_PO_AMAZON_VC}:入参 {@code local_po_number}</li> |
||||
* </ul> |
||||
* |
||||
* <p>{@link #order} 先用列表的 {@code search_field=purchase_order_number} 查出订单类型与 |
||||
* {@code local_po_number},再按类型走对应详情;DI 没有详情接口,直接用列表数据。</p> |
||||
* |
||||
* <p><b>时区待核对</b>:文档没有标注 {@code purchase_order_date} 的时区, |
||||
* 查询日期与时间解析都按领星系统时间(北京时间)处理。</p> |
||||
*/ |
||||
public final class VcOrderSource implements LingxingOrderSource { |
||||
|
||||
private static final DateTimeFormatter DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
private static final DateTimeFormatter DATE_TIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
||||
|
||||
/** 文档未注明时区,按 ERP 系统时间(北京时间)解释,待真实报文核对。 */ |
||||
private static final ZoneId SYSTEM_ZONE = PlatformTime.BEIJING_ZONE; |
||||
|
||||
private static final int TYPE_DF = 0; |
||||
private static final int TYPE_PO = 1; |
||||
private static final int TYPE_DI = 2; |
||||
|
||||
/** 查询时间类型:3 = 订单更新时间,与 updatedAfter/updatedBefore 对齐。 */ |
||||
private static final int SEARCH_FIELD_TIME_UPDATE = 3; |
||||
|
||||
private static final String OP_PULL = "salesOrders.pull.vc"; |
||||
private static final String OP_GET = "salesOrders.get.vc"; |
||||
|
||||
@Override |
||||
public Page<SalesOrder> orders(LingxingCall call, SalesOrderQuery query) { |
||||
ChannelAccount account = call.ctx().account(); |
||||
ZoneId zone = ZoneId.of(account.marketplaceZone()); |
||||
|
||||
Instant from = query.updatedAfter(); |
||||
Instant to = query.updatedBefore() != null ? query.updatedBefore() : Instant.now(call.ctx().clock()); |
||||
|
||||
LocalDate endDate = LocalDateTime.ofInstant(to, SYSTEM_ZONE).toLocalDate(); |
||||
// 文档:start_date 是开区间(按日期理解),多取一天避免漏掉起始日
|
||||
LocalDate startDate = LocalDateTime.ofInstant(from, SYSTEM_ZONE).toLocalDate().minusDays(1); |
||||
// 文档:查询区间最长 90 天
|
||||
if (ChronoUnit.DAYS.between(startDate, endDate) > LingxingConstants.VC_MAX_QUERY_DAYS) { |
||||
startDate = endDate.minusDays(LingxingConstants.VC_MAX_QUERY_DAYS); |
||||
} |
||||
|
||||
int length = Math.min(query.pageSize() <= 0 ? 20 : query.pageSize(), |
||||
LingxingConstants.VC_MAX_PAGE_SIZE); |
||||
int offset = query.cursor() == null ? 0 : Integer.parseInt(query.cursor()); |
||||
|
||||
Map<String, Object> body = new LinkedHashMap<String, Object>(); |
||||
body.put("purchase_order_type", Arrays.asList(TYPE_DF, TYPE_PO, TYPE_DI)); |
||||
body.put("offset", offset); |
||||
body.put("length", length); |
||||
body.put("search_field_time", SEARCH_FIELD_TIME_UPDATE); |
||||
body.put("start_date", DATE.format(startDate)); |
||||
body.put("end_date", DATE.format(endDate)); |
||||
if (trimToNull(account.externalStoreId()) != null) { |
||||
body.put("vc_store_ids", Collections.singletonList(account.externalStoreId().trim())); |
||||
} |
||||
|
||||
HttpRequest req = call.signed(LingxingApi.ORDER_LIST_AMAZON_VC, body, OP_PULL); |
||||
HttpResponse resp = call.execute(req); |
||||
LingxingEnvelope envelope = call.envelope(resp, OP_PULL); |
||||
|
||||
List<VcOrderDto> dtos = call.json().listAt(envelope.body(), "data", VcOrderDto.class); |
||||
List<SalesOrder> orders = new ArrayList<SalesOrder>(dtos.size()); |
||||
for (VcOrderDto dto : dtos) { |
||||
try { |
||||
orders.add(toSalesOrder(dto, account, zone)); |
||||
} catch (RuntimeException e) { |
||||
throw mappingFailure(e, envelope, call, OP_PULL); |
||||
} |
||||
} |
||||
|
||||
int nextOffset = offset + dtos.size(); |
||||
boolean hasMore = dtos.size() >= length |
||||
&& (envelope.total() < 0 || nextOffset < envelope.total()); |
||||
return Page.of(orders, hasMore ? String.valueOf(nextOffset) : null); |
||||
} |
||||
|
||||
@Override |
||||
public SalesOrder order(LingxingCall call, String channelOrderId) { |
||||
ChannelAccount account = call.ctx().account(); |
||||
ZoneId zone = ZoneId.of(account.marketplaceZone()); |
||||
|
||||
VcOrderDto summary = findOrder(call, channelOrderId); |
||||
if (summary == null) { |
||||
throw ChannelException.builder() |
||||
.message("lingxing vc order not found: " + channelOrderId) |
||||
.operation(OP_GET) |
||||
.provider(ChannelProvider.LINGXING.name()) |
||||
.omsStoreId(call.ctx().omsStoreId()) |
||||
.requestId(call.ctx().requestId()) |
||||
.platformCode(channelOrderId) |
||||
.retryable(false) |
||||
.build(); |
||||
} |
||||
|
||||
int type = summary.getPurchaseOrderType() == null ? -1 : summary.getPurchaseOrderType(); |
||||
if (type == TYPE_DF) { |
||||
VcOrderDfDetailDto detail = dfDetail(call, summary); |
||||
if (detail != null) { |
||||
return toSalesOrder(detail, account, zone); |
||||
} |
||||
} else if (type == TYPE_PO) { |
||||
String localPoNumber = trimToNull(summary.getLocalPoNumber()); |
||||
if (localPoNumber != null) { |
||||
VcOrderPoDetailDto detail = poDetail(call, localPoNumber); |
||||
if (detail != null) { |
||||
return toSalesOrder(detail, account, zone); |
||||
} |
||||
} |
||||
} |
||||
|
||||
// DI 没有详情接口;详情返回空时也退回列表数据(列表已带完整商品行)
|
||||
return toSalesOrder(summary, account, zone); |
||||
} |
||||
|
||||
// ---------------------------------------------------------------- requests
|
||||
|
||||
/** 用订单编号精确搜索,拿到订单类型与 local_po_number。 */ |
||||
private VcOrderDto findOrder(LingxingCall call, String channelOrderId) { |
||||
ChannelAccount account = call.ctx().account(); |
||||
Map<String, Object> body = new LinkedHashMap<String, Object>(); |
||||
body.put("purchase_order_type", Arrays.asList(TYPE_DF, TYPE_PO, TYPE_DI)); |
||||
body.put("offset", 0); |
||||
body.put("length", 20); |
||||
body.put("search_field", "purchase_order_number"); |
||||
body.put("search_value", Collections.singletonList(channelOrderId)); |
||||
if (trimToNull(account.externalStoreId()) != null) { |
||||
body.put("vc_store_ids", Collections.singletonList(account.externalStoreId().trim())); |
||||
} |
||||
|
||||
HttpRequest req = call.signed(LingxingApi.ORDER_LIST_AMAZON_VC, body, OP_GET); |
||||
HttpResponse resp = call.execute(req); |
||||
LingxingEnvelope envelope = call.envelope(resp, OP_GET); |
||||
|
||||
List<VcOrderDto> dtos = call.json().listAt(envelope.body(), "data", VcOrderDto.class); |
||||
return dtos.isEmpty() ? null : dtos.get(0); |
||||
} |
||||
|
||||
private VcOrderDfDetailDto dfDetail(LingxingCall call, VcOrderDto summary) { |
||||
Map<String, Object> body = new LinkedHashMap<String, Object>(); |
||||
body.put("vc_store_id", firstNonBlank(summary.getVcStoreId(), |
||||
call.ctx().account().externalStoreId())); |
||||
body.put("purchase_order_number", summary.getPurchaseOrderNumber()); |
||||
|
||||
HttpRequest req = call.signed(LingxingApi.ORDER_DETAIL_DF_AMAZON_VC, body, OP_GET); |
||||
HttpResponse resp = call.execute(req); |
||||
LingxingEnvelope envelope = call.envelope(resp, OP_GET); |
||||
|
||||
JsonNode data = call.json().nodeAt(envelope.body(), "data"); |
||||
if (data == null || data.isNull()) { |
||||
return null; |
||||
} |
||||
return call.json().mapper().convertValue(data, VcOrderDfDetailDto.class); |
||||
} |
||||
|
||||
private VcOrderPoDetailDto poDetail(LingxingCall call, String localPoNumber) { |
||||
Map<String, Object> body = new LinkedHashMap<String, Object>(); |
||||
body.put("local_po_number", localPoNumber); |
||||
|
||||
HttpRequest req = call.signed(LingxingApi.ORDER_DETAIL_PO_AMAZON_VC, body, OP_GET); |
||||
HttpResponse resp = call.execute(req); |
||||
LingxingEnvelope envelope = call.envelope(resp, OP_GET); |
||||
|
||||
JsonNode data = call.json().nodeAt(envelope.body(), "data"); |
||||
if (data == null || data.isNull()) { |
||||
return null; |
||||
} |
||||
return call.json().mapper().convertValue(data, VcOrderPoDetailDto.class); |
||||
} |
||||
|
||||
// ---------------------------------------------------------------- mapping
|
||||
|
||||
private SalesOrder toSalesOrder(VcOrderDto dto, ChannelAccount account, ZoneId zone) { |
||||
String orderId = firstNonBlank(dto.getPurchaseOrderNumber(), |
||||
dto.getCustomerOrderNumber(), dto.getId()); |
||||
if (orderId == null) { |
||||
throw new IllegalArgumentException("lingxing vc order has no purchase_order_number"); |
||||
} |
||||
String currency = trimToNull(dto.getCurrencyCode()); |
||||
|
||||
List<OrderLine> lines = new ArrayList<OrderLine>(); |
||||
List<VcOrderItemDto> items = safe(dto.getPurchaseOrderSkuList()); |
||||
for (int i = 0; i < items.size(); i++) { |
||||
VcOrderItemDto item = items.get(i); |
||||
String lineCurrency = firstNonBlank(item.getNetPriceCurrencyCode(), |
||||
item.getTaxAmountCurrencyCode(), currency); |
||||
String sku = firstNonBlank(item.getVendorProductId(), item.getLocalSku(), item.getAsin()); |
||||
lines.add(OrderLine.builder() |
||||
.lineId(firstNonBlank(item.getId(), item.getSequenceNumber(), |
||||
item.getVendorProductId(), "line-" + i)) |
||||
.platformSku(sku == null ? "" : sku) |
||||
.quantity(item.getPurchaseAmount() == null ? 0 : item.getPurchaseAmount()) |
||||
.unitPrice(moneyOrNull(item.getUnitPrice(), lineCurrency)) |
||||
.tax(moneyOrNull(item.getTaxAmount(), |
||||
firstNonBlank(item.getTaxAmountCurrencyCode(), currency))) |
||||
.build()); |
||||
} |
||||
|
||||
Instant occur = parseSystemTime(firstNonBlank(dto.getPurchaseOrderDate(), dto.getGmtCreate())); |
||||
|
||||
return SalesOrder.builder() |
||||
.omsStoreId(account.omsStoreId()) |
||||
.channelOrderId(orderId) |
||||
.status(dto.getPurchaseOrderState()) |
||||
.buyerName(null) |
||||
.shipToCountryCode(null) |
||||
.lines(lines) |
||||
.totalAmount(moneyOrNull(dto.getTotalPrice(), currency)) |
||||
.occurredAt(requireOccurredAt(occur, orderId, zone)) |
||||
.sourceProvider(ChannelProvider.LINGXING) |
||||
.sourceAccountId(trimToNull(dto.getVcStoreId())) |
||||
.build(); |
||||
} |
||||
|
||||
private SalesOrder toSalesOrder(VcOrderDfDetailDto dto, ChannelAccount account, ZoneId zone) { |
||||
String orderId = requireOrderId(dto.getPurchaseOrderNumber()); |
||||
String currency = trimToNull(dto.getCurrencyCode()); |
||||
|
||||
List<OrderLine> lines = new ArrayList<OrderLine>(); |
||||
List<VcOrderDetailItemDto> items = safe(dto.getItems()); |
||||
for (int i = 0; i < items.size(); i++) { |
||||
lines.add(toLine(items.get(i), currency, i)); |
||||
} |
||||
|
||||
return buildOrder(account, zone, orderId, dto.getPurchaseOrderState(), |
||||
dto.getVcStoreId(), dto.getTotalPrice(), currency, lines, |
||||
dto.getPurchaseOrderDate()); |
||||
} |
||||
|
||||
private SalesOrder toSalesOrder(VcOrderPoDetailDto dto, ChannelAccount account, ZoneId zone) { |
||||
String orderId = requireOrderId(dto.getPurchaseOrderNumber()); |
||||
String currency = trimToNull(dto.getCurrencyCode()); |
||||
|
||||
List<OrderLine> lines = new ArrayList<OrderLine>(); |
||||
List<VcOrderDetailItemDto> items = safe(dto.getItems()); |
||||
for (int i = 0; i < items.size(); i++) { |
||||
lines.add(toLine(items.get(i), currency, i)); |
||||
} |
||||
|
||||
return buildOrder(account, zone, orderId, dto.getPurchaseOrderState(), |
||||
dto.getVcStoreId(), dto.getTotalPrice(), currency, lines, |
||||
dto.getPurchaseOrderDate()); |
||||
} |
||||
|
||||
private static OrderLine toLine(VcOrderDetailItemDto item, String headerCurrency, int index) { |
||||
String lineCurrency = firstNonBlank(item.getNetPriceCurrencyCode(), |
||||
item.getTaxAmountCurrencyCode(), headerCurrency); |
||||
String sku = firstNonBlank(item.getMsku(), item.getLocalSku(), item.getAsin()); |
||||
return OrderLine.builder() |
||||
.lineId(firstNonBlank(item.getSequenceNumber(), item.getAsin(), |
||||
item.getMsku(), "line-" + index)) |
||||
.platformSku(sku == null ? "" : sku) |
||||
.quantity(parseInt(item.getPurchaseAmount())) |
||||
.unitPrice(moneyOrNull(item.getUnitPrice(), lineCurrency)) |
||||
.tax(moneyOrNull(item.getTaxAmount(), |
||||
firstNonBlank(item.getTaxAmountCurrencyCode(), headerCurrency))) |
||||
.build(); |
||||
} |
||||
|
||||
private static SalesOrder buildOrder(ChannelAccount account, ZoneId zone, String orderId, |
||||
String status, String vcStoreId, String totalPrice, |
||||
String currency, List<OrderLine> lines, String orderDate) { |
||||
Instant occur = parseSystemTime(orderDate); |
||||
return SalesOrder.builder() |
||||
.omsStoreId(account.omsStoreId()) |
||||
.channelOrderId(orderId) |
||||
.status(status) |
||||
.buyerName(null) |
||||
.shipToCountryCode(null) |
||||
.lines(lines) |
||||
.totalAmount(moneyOrNull(totalPrice, currency)) |
||||
.occurredAt(requireOccurredAt(occur, orderId, zone)) |
||||
.sourceProvider(ChannelProvider.LINGXING) |
||||
.sourceAccountId(trimToNull(vcStoreId)) |
||||
.build(); |
||||
} |
||||
|
||||
// ---------------------------------------------------------------- internals
|
||||
|
||||
private static String requireOrderId(String value) { |
||||
String orderId = trimToNull(value); |
||||
if (orderId == null) { |
||||
throw new IllegalArgumentException("lingxing vc order has no purchase_order_number"); |
||||
} |
||||
return orderId; |
||||
} |
||||
|
||||
/** 文档没写时区,按 {@link #SYSTEM_ZONE} 解释;缺失或格式不对返回 null。 */ |
||||
private static Instant parseSystemTime(String value) { |
||||
String text = trimToNull(value); |
||||
if (text == null) { |
||||
return null; |
||||
} |
||||
try { |
||||
return LocalDateTime.parse(text, DATE_TIME).atZone(SYSTEM_ZONE).toInstant(); |
||||
} catch (DateTimeParseException e) { |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
private static PlatformTime requireOccurredAt(Instant occur, String orderId, ZoneId zone) { |
||||
if (occur == null) { |
||||
throw new IllegalArgumentException( |
||||
"lingxing vc order has no parseable purchase_order_date: " + orderId); |
||||
} |
||||
return PlatformTime.of(occur, zone); |
||||
} |
||||
|
||||
private static ValidationException mappingFailure(RuntimeException e, LingxingEnvelope envelope, |
||||
LingxingCall call, String operation) { |
||||
return new ValidationException(ChannelException.builder() |
||||
.message("lingxing vc order mapping failed: " + e.getMessage()) |
||||
.operation(operation) |
||||
.provider(ChannelProvider.LINGXING.name()) |
||||
.omsStoreId(call.ctx().omsStoreId()) |
||||
.requestId(call.ctx().requestId()) |
||||
.rawResponse(envelope.body()), e); |
||||
} |
||||
|
||||
private static Money moneyOrNull(String value, String currency) { |
||||
String cleaned = LingxingOrderMapper.cleanAmount(value); |
||||
if (cleaned == null || trimToNull(currency) == null) { |
||||
return null; |
||||
} |
||||
return Money.of(cleaned, currency.trim().toUpperCase()); |
||||
} |
||||
|
||||
private static int parseInt(String value) { |
||||
String text = trimToNull(value); |
||||
if (text == null) { |
||||
return 0; |
||||
} |
||||
try { |
||||
return Integer.parseInt(text); |
||||
} catch (NumberFormatException e) { |
||||
return 0; |
||||
} |
||||
} |
||||
|
||||
private static <T> List<T> safe(List<T> in) { |
||||
return in == null ? Collections.<T>emptyList() : in; |
||||
} |
||||
|
||||
private static String firstNonBlank(String... values) { |
||||
for (String value : values) { |
||||
String trimmed = trimToNull(value); |
||||
if (trimmed != null) { |
||||
return trimmed; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
private static String trimToNull(String value) { |
||||
if (value == null) { |
||||
return null; |
||||
} |
||||
String trimmed = value.trim(); |
||||
return trimmed.isEmpty() ? null : trimmed; |
||||
} |
||||
} |
||||
@ -0,0 +1,74 @@
@@ -0,0 +1,74 @@
|
||||
package common.ecommerce.lingxing.platform.amazon.vc.shop; |
||||
|
||||
import common.ecommerce.capability.AggregatorCapable.SubChannel; |
||||
import common.ecommerce.http.HttpRequest; |
||||
import common.ecommerce.http.HttpResponse; |
||||
import common.ecommerce.lingxing.LingxingApi; |
||||
import common.ecommerce.lingxing.LingxingConstants; |
||||
import common.ecommerce.lingxing.http.LingxingEnvelope; |
||||
import common.ecommerce.lingxing.platform.LingxingCall; |
||||
import common.ecommerce.lingxing.platform.amazon.vc.dto.VcShopDto; |
||||
import common.ecommerce.lingxing.platform.shop.LingxingShopSource; |
||||
import common.ecommerce.model.Platform; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Collections; |
||||
import java.util.LinkedHashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 领星 · 亚马逊 VC 店铺列表。 |
||||
* |
||||
* <p>接口 {@code /basicOpen/platformAuth/vcSeller/pageList}:POST,{@code offset}/{@code length} |
||||
* 分页,length 默认 20、上限 200,令牌桶 1 req/s。</p> |
||||
* |
||||
* <p>{@link LingxingShopSource#shops(LingxingCall)} 要返回全量店铺,所以这里内部翻页, |
||||
* 直到返回不足一页或达到 {@code total}。</p> |
||||
*/ |
||||
public final class VcShopSource implements LingxingShopSource { |
||||
|
||||
/** 店铺授权服务状态:1 = 正常同步。 */ |
||||
private static final int STATUS_ACTIVE = 1; |
||||
|
||||
private static final String OP = "shops.list.vc"; |
||||
|
||||
@Override |
||||
public List<SubChannel> shops(LingxingCall call) { |
||||
int length = LingxingConstants.VC_MAX_PAGE_SIZE; |
||||
int offset = 0; |
||||
List<SubChannel> out = new ArrayList<SubChannel>(); |
||||
|
||||
while (true) { |
||||
Map<String, Object> body = new LinkedHashMap<String, Object>(); |
||||
body.put("offset", offset); |
||||
body.put("length", length); |
||||
|
||||
HttpRequest req = call.signed(LingxingApi.SHOP_LIST_AMAZON_VC, body, OP); |
||||
HttpResponse resp = call.execute(req); |
||||
LingxingEnvelope envelope = call.envelope(resp, OP); |
||||
|
||||
List<VcShopDto> shops = call.json().listAt(envelope.body(), "data", VcShopDto.class); |
||||
for (VcShopDto shop : shops) { |
||||
if (shop.getVcStoreId() == null |
||||
|| shop.getStatus() == null || shop.getStatus() != STATUS_ACTIVE) { |
||||
continue; |
||||
} |
||||
out.add(new SubChannel( |
||||
LingxingConstants.PLATFORM_CODE_AMAZON_VC, |
||||
shop.getVcStoreId(), |
||||
Platform.AMAZON_VC, |
||||
shop.getName() == null ? shop.getSellerId() : shop.getName())); |
||||
} |
||||
|
||||
offset += shops.size(); |
||||
boolean exhausted = shops.size() < length |
||||
|| (envelope.total() >= 0 && offset >= envelope.total()); |
||||
if (exhausted) { |
||||
break; |
||||
} |
||||
} |
||||
|
||||
return Collections.unmodifiableList(out); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue