You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.4 KiB
42 lines
1.4 KiB
package common.ecommerce.yqn.adapter; |
|
|
|
import common.ecommerce.yqn.dto.YqnWarehouseDtos; |
|
import common.ecommerce.warehouse.enums.WarehouseProvider; |
|
import common.ecommerce.warehouse.model.WarehouseInfo; |
|
|
|
import java.util.ArrayList; |
|
import java.util.List; |
|
|
|
/** |
|
* 运去哪仓库档案映射(API 134)。 |
|
*/ |
|
public final class YqnWarehouseMapper { |
|
|
|
private YqnWarehouseMapper() { |
|
} |
|
|
|
/** 响应 → 统一仓库档案。 */ |
|
public static List<WarehouseInfo> toWarehouses(List<YqnWarehouseDtos.WarehouseRow> rows) { |
|
if (rows == null || rows.isEmpty()) { |
|
return new ArrayList<WarehouseInfo>(); |
|
} |
|
List<WarehouseInfo> out = new ArrayList<WarehouseInfo>(rows.size()); |
|
for (YqnWarehouseDtos.WarehouseRow row : rows) { |
|
out.add(WarehouseInfo.builder() |
|
.sourceProvider(WarehouseProvider.YQN) |
|
.warehouseCode(row.warehouseCode) |
|
.name(row.name) |
|
.country(row.country) |
|
.state(row.state) |
|
.city(row.city) |
|
.address1(row.address1) |
|
.address2(row.address2) |
|
.postalCode(row.postal) |
|
.contactName(row.linkman) |
|
.mobilePhone(row.mobilePhone) |
|
.email(row.email) |
|
.build()); |
|
} |
|
return out; |
|
} |
|
}
|
|
|