24282 2 năm trước cách đây
mục cha
commit
b5bdffe160

+ 1 - 10
hx-service-api/syringe-management-api/src/main/java/com/fjhx/entity/bom/Bom.java

@@ -1,12 +1,9 @@
 package com.fjhx.entity.bom;
 package com.fjhx.entity.bom;
 
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.Version;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.fjhx.base.BaseEntity;
 import com.fjhx.base.BaseEntity;
-import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
 
 
@@ -22,12 +19,6 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = true)
 @EqualsAndHashCode(callSuper = true)
 public class Bom extends BaseEntity {
 public class Bom extends BaseEntity {
 
 
-
-    /**
-     * 类型 1产品bom 2包装bom
-     */
-    private Integer type;
-
     /**
     /**
      * 产品id
      * 产品id
      */
      */

+ 4 - 0
hx-service/syringe-management/src/main/java/com/fjhx/service/bom/impl/BomServiceImpl.java

@@ -85,8 +85,12 @@ public class BomServiceImpl extends ServiceImpl<BomMapper, Bom> implements BomSe
         // 保证一个产品只有一个bom是启用状态
         // 保证一个产品只有一个bom是启用状态
         Boolean flag = redisLockClient.lockFair(IotManagementLockConstant.BOM_EDITION_LOCK + productId,
         Boolean flag = redisLockClient.lockFair(IotManagementLockConstant.BOM_EDITION_LOCK + productId,
                 () -> {
                 () -> {
+                    long editionCount = count(q -> q.eq(Bom::getProductId, productId).eq(Bom::getEdition, bomVo.getEdition()));
+                    Assert.eqZero(editionCount, "此版本已存在");
+
                     Long count = count(Bom::getProductId, productId);
                     Long count = count(Bom::getProductId, productId);
                     bomVo.setCurrentEdition(count == 0 ? StatusConstant.YES : StatusConstant.NO);
                     bomVo.setCurrentEdition(count == 0 ? StatusConstant.YES : StatusConstant.NO);
+
                     save(bomVo);
                     save(bomVo);
                     return true;
                     return true;
                 });
                 });

+ 12 - 18
hx-service/victoriatourist/src/main/java/com/fjhx/service/product/impl/ProductInfoServiceImpl.java

@@ -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());