一个orderReturn订单,可以得到List orderItemList订单明细,可以根据 遍历orderItemList.get(i).getCrossBorderType()查询是否跨境,orderItemList.get(i).getShopStorehouseId();查询是否不同库存里面,求解怎么进行拆单
这个得看你的业务要求了,肯定得根据 跨境选择,然后是仓库还有其他价格呀、跨境购的制度呀,等等
给点建议怎么写成代码,没思路/**
* 根据一张订单中的,店铺,跨境,运费模板,仓库进行拆分为几个订单
* @param platform
*/
public List getOrders(String orderId) {
List list1 = new ArrayList();
List list2 = new ArrayList();
Listlist3 = new ArrayList();
Listlist4 = new ArrayList();
Listtemp = new ArrayList();
if(!StringUtil.isEmpty(id)){
try {
orderReturn = orderService.getById(Long.valueOf(id.trim()));
} catch (Exception e) {
e.printStackTrace();
}
}
if(orderReturn == null)return null;
shop = shopService.getById(orderReturn.getShopId());
orderItemList = orderService.getOrderItems(orderReturn.getOrderSn());
for(int i=0; i<orderItemList.size(); i++) {
Short crossBorderType = orderItemList.get(i).getCrossBorderType();
if(crossBorderType==1) {
list3.add(orderItemList.get(i));
} else {
list4.add(orderItemList.get(i));
}
}
temp = list3;
for(int i=0; i<temp.size(); i++) {
Set<Long> houseIds = new HashSet<Long>();
Long shopStorehouseId = temp.get(i).getShopStorehouseId();
houseIds.add(shopStorehouseId);
if(houseIds.contains(shopStorehouseId)) {
list4.add(list3.get(i));
} else {
String name = "list"+i;
}
}
temp = list4;
for(int i=0; i<temp.size(); i++) {
Set<Long> houseIds = new HashSet<Long>();
Long shopStorehouseId = list4.get(i).getShopStorehouseId();
houseIds.add(shopStorehouseId);
if(houseIds.contains(shopStorehouseId)) {
list3.add(e)
} else {
}
}
for(int i=0; i<orderItemList.size(); i++) {
orderItemList.get(i).get
}
orderItemList.get(i).getShopStorehouseId();
}