|
@@ -107,13 +107,11 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
productInfoService.attributeAssign(stockVos, StockVo::getProductId, (item, productInfo) -> {
|
|
|
//赋值维多利亚扩展产品信息
|
|
|
String victoriatouristJson = item.getVictoriatouristJson();
|
|
|
- if (ObjectUtil.isNotEmpty(victoriatouristJson)) {
|
|
|
- JSONObject json = JSONObject.parseObject(victoriatouristJson);
|
|
|
- json.put("code", productInfo.getCode());
|
|
|
- json.put("spec", productInfo.getSpec());
|
|
|
- json.put("unit", productInfo.getUnit());
|
|
|
- item.setVictoriatouristJson(json.toJSONString());
|
|
|
- }
|
|
|
+ JSONObject json = ObjectUtil.isNotEmpty(victoriatouristJson) ? JSONObject.parseObject(victoriatouristJson) : new JSONObject();
|
|
|
+ json.put("code", productInfo.getCode());
|
|
|
+ json.put("spec", productInfo.getSpec());
|
|
|
+ json.put("unit", productInfo.getUnit());
|
|
|
+ item.setVictoriatouristJson(json.toJSONString());
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -135,12 +133,10 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
Map<Long, String> warehouseMap = warehouses.stream().collect(Collectors.toMap(Warehouse::getId, Warehouse::getName));
|
|
|
for (StockVo stockVo : stockVos) {
|
|
|
String victoriatouristJson = stockVo.getVictoriatouristJson();
|
|
|
- if (ObjectUtil.isNotEmpty(victoriatouristJson)) {
|
|
|
- JSONObject json = JSONObject.parseObject(victoriatouristJson);
|
|
|
- String warehouseName = warehouseMap.get(json.getLong("warehouseId"));
|
|
|
- json.put("warehouseName", warehouseName);
|
|
|
- stockVo.setVictoriatouristJson(json.toJSONString());
|
|
|
- }
|
|
|
+ JSONObject json = ObjectUtil.isNotEmpty(victoriatouristJson) ? JSONObject.parseObject(victoriatouristJson) : new JSONObject();
|
|
|
+ String warehouseName = warehouseMap.get(json.getLong("warehouseId"));
|
|
|
+ json.put("warehouseName", warehouseName);
|
|
|
+ stockVo.setVictoriatouristJson(json.toJSONString());
|
|
|
}
|
|
|
return page;
|
|
|
}
|
|
@@ -169,13 +165,11 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
|
|
|
//赋值维多利亚扩展产品信息
|
|
|
String victoriatouristJson = item.getVictoriatouristJson();
|
|
|
- if (ObjectUtil.isNotEmpty(victoriatouristJson)) {
|
|
|
- JSONObject json = JSONObject.parseObject(victoriatouristJson);
|
|
|
- json.put("code", productInfo.getCode());
|
|
|
- json.put("spec", productInfo.getSpec());
|
|
|
- json.put("unit", productInfo.getUnit());
|
|
|
- item.setVictoriatouristJson(json.toJSONString());
|
|
|
- }
|
|
|
+ JSONObject json = ObjectUtil.isNotEmpty(victoriatouristJson) ? JSONObject.parseObject(victoriatouristJson) : new JSONObject();
|
|
|
+ json.put("code", productInfo.getCode());
|
|
|
+ json.put("spec", productInfo.getSpec());
|
|
|
+ json.put("unit", productInfo.getUnit());
|
|
|
+ item.setVictoriatouristJson(json.toJSONString());
|
|
|
});
|
|
|
|
|
|
//赋值仓库名称
|
|
@@ -253,6 +247,10 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
Stock newStocks = new Stock();
|
|
|
newStocks.setWarehouseId(warehouseId);
|
|
|
newStocks.setProductId(stock.getProductId());
|
|
|
+ if(ObjectUtil.isEmpty(stock.getQuantity())){
|
|
|
+ //判断传操作的库存是否为空 空赋值0
|
|
|
+ stock.setQuantity(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
newStocks.setQuantity(stock.getQuantity());
|
|
|
|
|
|
//合并库存数量
|