|
@@ -27,6 +27,7 @@ import com.sd.business.service.order.OrderPackageBomService;
|
|
|
import com.sd.business.service.order.OrderService;
|
|
|
import com.sd.business.service.order.OrderSkuBomService;
|
|
|
import com.sd.business.service.order.OrderSkuService;
|
|
|
+import com.sd.business.service.sku.SkuSpecService;
|
|
|
import com.sd.wln.context.OrderContext;
|
|
|
import com.sd.wln.service.WlnOrderService;
|
|
|
import com.sd.wln.util.WlnUtil;
|
|
@@ -70,13 +71,16 @@ public class WlnOrderServiceImpl implements WlnOrderService {
|
|
|
@Autowired
|
|
|
private InventoryService inventoryService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SkuSpecService skuSpecService;
|
|
|
+
|
|
|
@Override
|
|
|
public void syncOrder() {
|
|
|
|
|
|
LogicHolder.setLogicHolder(false);
|
|
|
|
|
|
List<DictCommonData> warehouseCodeList = dictCommonDataService.list(q -> q.eq(DictCommonData::getDictCode, "warehouse_code"));
|
|
|
- if (warehouseCodeList.size() == 0) {
|
|
|
+ if (warehouseCodeList.isEmpty()) {
|
|
|
log.error("订单同步失败,仓库字典:warehouse_code 为空");
|
|
|
return;
|
|
|
}
|
|
@@ -292,7 +296,7 @@ public class WlnOrderServiceImpl implements WlnOrderService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (orderSkuList.size() != 0) {
|
|
|
+ if (!orderSkuList.isEmpty()) {
|
|
|
addExceptionType(orderInfo, OrderExceptionTypeEnum.SKU_UPDATE);
|
|
|
}
|
|
|
}
|
|
@@ -567,19 +571,19 @@ public class WlnOrderServiceImpl implements WlnOrderService {
|
|
|
List<OrderSkuBom> saveOrderSkuBomList = context.getSaveOrderSkuBomList();
|
|
|
List<OrderPackageBom> orderPackageBomList = context.getOrderPackageBomList();
|
|
|
|
|
|
- if (saveOrderList.size() > 0) {
|
|
|
+ if (!saveOrderList.isEmpty()) {
|
|
|
orderService.saveBatch(saveOrderList);
|
|
|
}
|
|
|
- if (updateOrderList.size() > 0) {
|
|
|
+ if (!updateOrderList.isEmpty()) {
|
|
|
orderService.updateBatchById(updateOrderList);
|
|
|
}
|
|
|
- if (saveOrderSkuList.size() > 0) {
|
|
|
+ if (!saveOrderSkuList.isEmpty()) {
|
|
|
orderSkuService.saveBatch(saveOrderSkuList);
|
|
|
}
|
|
|
- if (saveOrderSkuBomList.size() > 0) {
|
|
|
+ if (!saveOrderSkuBomList.isEmpty()) {
|
|
|
orderSkuBomService.saveBatch(saveOrderSkuBomList);
|
|
|
}
|
|
|
- if (orderPackageBomList.size() > 0) {
|
|
|
+ if (!orderPackageBomList.isEmpty()) {
|
|
|
orderPackageBomService.saveBatch(orderPackageBomList);
|
|
|
}
|
|
|
|
|
@@ -633,7 +637,16 @@ public class WlnOrderServiceImpl implements WlnOrderService {
|
|
|
|
|
|
List<OrderSku> orderSkuList = existOrderSkuMap.get(orderInfo.getId())
|
|
|
.stream()
|
|
|
- .filter(item -> bomSpecBoMap.get(item.getBomSpecId()).getClassifyParentId().equals(1L))
|
|
|
+ .filter(item -> {
|
|
|
+ Long bomSpecId = item.getBomSpecId();
|
|
|
+ BomSpecBo bomSpecBo = bomSpecBoMap.get(bomSpecId);
|
|
|
+ if (bomSpecBo == null) {
|
|
|
+ Map<Long, BomSpecBo> tempMap = skuSpecService.getBomSpecBoByIdList(Collections.singletonList(bomSpecId));
|
|
|
+ bomSpecBo = tempMap.get(bomSpecId);
|
|
|
+ bomSpecBoMap.put(bomSpecId, bomSpecBo);
|
|
|
+ }
|
|
|
+ return Objects.equals(bomSpecBo.getClassifyParentId(), 1L);
|
|
|
+ })
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
inventoryService.unlockStorage(orderSkuList);
|