|
@@ -60,6 +60,9 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
.keyword(new KeywordData(ProductInfo::getName), new KeywordData(ProductInfo::getCode))
|
|
.keyword(new KeywordData(ProductInfo::getName), new KeywordData(ProductInfo::getCode))
|
|
.eq(ProductInfo::getDeptId)
|
|
.eq(ProductInfo::getDeptId)
|
|
.eq(ProductInfo::getType)
|
|
.eq(ProductInfo::getType)
|
|
|
|
+ .eq(ProductInfo::getClassifyId)
|
|
|
|
+ .eq(ProductInfo::getCombination)
|
|
|
|
+ .eq(ProductInfo::getProductSpuId)
|
|
.like(ProductInfo::getName)
|
|
.like(ProductInfo::getName)
|
|
.like(ProductInfo::getCode)
|
|
.like(ProductInfo::getCode)
|
|
.ge(ProductInfo::getPurchasePrice, condition.get("purchasePriceMin"))
|
|
.ge(ProductInfo::getPurchasePrice, condition.get("purchasePriceMin"))
|
|
@@ -68,25 +71,15 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
.le(ProductInfo::getSellingPrice, condition.get("sellingPriceMax"))
|
|
.le(ProductInfo::getSellingPrice, condition.get("sellingPriceMax"))
|
|
.ge(ProductInfo::getJdPurchasePrice, condition.get("jdPurchasePriceMin"))
|
|
.ge(ProductInfo::getJdPurchasePrice, condition.get("jdPurchasePriceMin"))
|
|
.le(ProductInfo::getJdPurchasePrice, condition.get("jdPurchasePriceMax"))
|
|
.le(ProductInfo::getJdPurchasePrice, condition.get("jdPurchasePriceMax"))
|
|
- .eq(ProductInfo::getCombination)
|
|
|
|
- .eq(ProductInfo::getProductSpuId)
|
|
|
|
.ne(ProductInfo::getProductSpuId, condition.get("excludeProductSpuId"))
|
|
.ne(ProductInfo::getProductSpuId, condition.get("excludeProductSpuId"))
|
|
|
|
+ .eq(ObjectUtil.isNotEmpty(condition.get("lifeCycle")),
|
|
|
|
+ "(CASE " +
|
|
|
|
+ "WHEN datediff(now(), computing_time) < new_products_day THEN 1 " +
|
|
|
|
+ "WHEN datediff(now(), computing_time) < (new_products_day + grow_up_day) THEN 2 " +
|
|
|
|
+ "ELSE 3 " +
|
|
|
|
+ "END)",
|
|
|
|
+ condition.get("lifeCycle"))
|
|
.periodTime(ProductInfo::getClearancePeriod)
|
|
.periodTime(ProductInfo::getClearancePeriod)
|
|
- .func(ObjectUtil.isNotEmpty(condition.get("lifeCycle")), q -> {
|
|
|
|
- Integer lifeCycle = Convert.toInt(condition.get("lifeCycle"));
|
|
|
|
- // 新品
|
|
|
|
- if (ObjectUtil.equals(lifeCycle, 1)) {
|
|
|
|
- q.gt("new_products_day - datediff(now(), computing_time)", 0);
|
|
|
|
- }
|
|
|
|
- // 成长
|
|
|
|
- else if (ObjectUtil.equals(lifeCycle, 2)) {
|
|
|
|
- q.gt("(new_products_day + grow_up_day) - datediff(now(), computing_time)", 0);
|
|
|
|
- }
|
|
|
|
- // 成熟
|
|
|
|
- else {
|
|
|
|
- q.le("(new_products_day + grow_up_day) - datediff(now(), computing_time)", 0);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
.orderByDesc(ProductInfo::getCode);
|
|
.orderByDesc(ProductInfo::getCode);
|
|
|
|
|
|
Page<Map<String, Object>> page = baseMapper.getPage(createPage(condition), wrapper);
|
|
Page<Map<String, Object>> page = baseMapper.getPage(createPage(condition), wrapper);
|
|
@@ -103,7 +96,8 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
//查询产品库存
|
|
//查询产品库存
|
|
Map<Long, Stock> stockMap = new HashMap<>();
|
|
Map<Long, Stock> stockMap = new HashMap<>();
|
|
- //查询库存量
|
|
|
|
|
|
+
|
|
|
|
+ // 查询库存量
|
|
if (Func.isNotEmpty(condition.get("warehouseId"))) {
|
|
if (Func.isNotEmpty(condition.get("warehouseId"))) {
|
|
//产品ID集合
|
|
//产品ID集合
|
|
List<Long> ids = page.getRecords().stream().map(item -> Convert.toLong(item.get("id"))).distinct().collect(Collectors.toList());
|
|
List<Long> ids = page.getRecords().stream().map(item -> Convert.toLong(item.get("id"))).distinct().collect(Collectors.toList());
|