|
@@ -111,6 +111,13 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
json.put("code", productInfo.getCode());
|
|
|
json.put("spec", productInfo.getSpec());
|
|
|
json.put("unit", productInfo.getUnit());
|
|
|
+
|
|
|
+ BigDecimal frozenQuantity = json.getBigDecimal("frozenQuantity");
|
|
|
+ frozenQuantity = ObjectUtil.isEmpty(frozenQuantity)?BigDecimal.ZERO:frozenQuantity;
|
|
|
+ json.put("frozenQuantity",frozenQuantity);
|
|
|
+ BigDecimal defectiveQuantity = json.getBigDecimal("defectiveQuantity");
|
|
|
+ defectiveQuantity = ObjectUtil.isEmpty(defectiveQuantity)?BigDecimal.ZERO:defectiveQuantity;
|
|
|
+ json.put("defectiveQuantity",defectiveQuantity);
|
|
|
item.setVictoriatouristJson(json.toJSONString());
|
|
|
});
|
|
|
}
|
|
@@ -148,7 +155,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
wrapper.eq(Stock::getWarehouseId, dto.getId());
|
|
|
wrapper.like(Stock::getQuantity, dto.getKeyword());
|
|
|
wrapper.eq("pi.definition", dto.getDefinition());
|
|
|
-
|
|
|
+ wrapper.groupBy("s.product_id");
|
|
|
Page<StockVo> page = this.baseMapper.pageByProduct(dto.getPage(), wrapper);
|
|
|
List<StockVo> stockVos = page.getRecords();
|
|
|
|
|
@@ -169,6 +176,63 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
json.put("code", productInfo.getCode());
|
|
|
json.put("spec", productInfo.getSpec());
|
|
|
json.put("unit", productInfo.getUnit());
|
|
|
+
|
|
|
+ BigDecimal frozenQuantity = json.getBigDecimal("frozenQuantity");
|
|
|
+ frozenQuantity = ObjectUtil.isEmpty(frozenQuantity)?BigDecimal.ZERO:frozenQuantity;
|
|
|
+ json.put("frozenQuantity",frozenQuantity);
|
|
|
+ BigDecimal defectiveQuantity = json.getBigDecimal("defectiveQuantity");
|
|
|
+ defectiveQuantity = ObjectUtil.isEmpty(defectiveQuantity)?BigDecimal.ZERO:defectiveQuantity;
|
|
|
+ json.put("defectiveQuantity",defectiveQuantity);
|
|
|
+ item.setVictoriatouristJson(json.toJSONString());
|
|
|
+ });
|
|
|
+
|
|
|
+ //赋值仓库名称
|
|
|
+ warehouseService.attributeAssign(stockVos, StockVo::getWarehouseId, (item, warehouse) -> {
|
|
|
+ item.setWarehouseName(warehouse.getName());
|
|
|
+ });
|
|
|
+
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<StockVo> pageByProductSpu(StockSelectDto dto) {
|
|
|
+ IWrapper<Stock> wrapper = getWrapper();
|
|
|
+ wrapper.orderByDesc("s", Stock::getId);
|
|
|
+ wrapper.eq(Stock::getWarehouseId, dto.getId());
|
|
|
+ wrapper.like(Stock::getQuantity, dto.getKeyword());
|
|
|
+ wrapper.eq("pi.definition", dto.getDefinition());
|
|
|
+ wrapper.isNotNull("pi.product_spu_id");
|
|
|
+ wrapper.groupBy("pi.product_spu_id");
|
|
|
+
|
|
|
+ Page<StockVo> page = this.baseMapper.pageByProductSpu(dto.getPage(), wrapper);
|
|
|
+ List<StockVo> stockVos = page.getRecords();
|
|
|
+
|
|
|
+ //赋值产品名称
|
|
|
+ productInfoService.attributeAssign(stockVos, StockVo::getProductId, (item, productInfo) -> {
|
|
|
+ item.setType(productInfo.getType());
|
|
|
+ item.setProductName(productInfo.getName());
|
|
|
+ item.setProductCode(productInfo.getCode());
|
|
|
+ item.setProductUnit(productInfo.getUnit());
|
|
|
+ item.setProductType(productInfo.getType());
|
|
|
+ item.setProductSpec(productInfo.getSpec());
|
|
|
+ item.setProductClassifyId(productInfo.getProductClassifyId());
|
|
|
+ item.setProductDefinition(productInfo.getDefinition());
|
|
|
+
|
|
|
+ //赋值维多利亚扩展产品信息
|
|
|
+ String victoriatouristJson = item.getVictoriatouristJson();
|
|
|
+ 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());
|
|
|
+ json.put("productSpuName", item.getProductSpuName());
|
|
|
+
|
|
|
+
|
|
|
+ BigDecimal frozenQuantity = json.getBigDecimal("frozenQuantity");
|
|
|
+ frozenQuantity = ObjectUtil.isEmpty(frozenQuantity)?BigDecimal.ZERO:frozenQuantity;
|
|
|
+ json.put("frozenQuantity",frozenQuantity);
|
|
|
+ BigDecimal defectiveQuantity = json.getBigDecimal("defectiveQuantity");
|
|
|
+ defectiveQuantity = ObjectUtil.isEmpty(defectiveQuantity)?BigDecimal.ZERO:defectiveQuantity;
|
|
|
+ json.put("defectiveQuantity",defectiveQuantity);
|
|
|
item.setVictoriatouristJson(json.toJSONString());
|
|
|
});
|
|
|
|