fgd пре 1 година
родитељ
комит
7215ca4a7c

+ 14 - 3
sd-business/src/main/java/com/sd/business/service/bom/impl/BomSpecServiceImpl.java

@@ -160,6 +160,9 @@ public class BomSpecServiceImpl extends ServiceImpl<BomSpecMapper, BomSpec> impl
 
     @Override
     public BigDecimal getPriceByParam(BomSpecPriceComputeDto dto) {
+        if (dto.getLength() == null || dto.getWidth() == null  || dto.getHeight() == null) {
+            return BigDecimal.ZERO;
+        }
         Long bomClassifyId = dto.getBomClassifyId();
         if (!Objects.equals(bomClassifyId, BomClassifyConstant.YOGA_MAT) &&
                 !Objects.equals(bomClassifyId, BomClassifyConstant.SKIP_MAT)) {
@@ -178,10 +181,10 @@ public class BomSpecServiceImpl extends ServiceImpl<BomSpecMapper, BomSpec> impl
                                 DictCommonData::getDictKey,
                                 DictCommonData::getDictValue)
                 ));
-        String sellingPriceSystem = dictMap.getOrDefault("bom_sellingPriceSystem", Collections.emptyMap()).get(dto.getSellingPriceSystem());
+        String level = dictMap.getOrDefault("bom_level", Collections.emptyMap()).get(dto.getLevel());
         String chromatophore = dictMap.getOrDefault("bom_chromatophore", Collections.emptyMap()).get(dto.getChromatophore());
         String embossingProcess = dictMap.getOrDefault("bom_embossingProcess", Collections.emptyMap()).get(dto.getEmbossingProcess());
-        if (StrUtil.isBlank(sellingPriceSystem) || StrUtil.isBlank(chromatophore) || StrUtil.isBlank(embossingProcess)) {
+        if (StrUtil.isBlank(level) || StrUtil.isBlank(chromatophore) || StrUtil.isBlank(embossingProcess)) {
             return BigDecimal.ZERO;
         }
 
@@ -192,10 +195,17 @@ public class BomSpecServiceImpl extends ServiceImpl<BomSpecMapper, BomSpec> impl
         // 计算bom每平方价格
         BigDecimal price = BigDecimal.ZERO;
         // 等级
+        // 获取售价体系,10为体系一,20为体系二
+        int bomType;
+        if (Objects.equals(dto.getSellingPriceSystem(), "10")) {
+            bomType = 0;
+        } else {
+            bomType = 1;
+        }
         List<BomSpecPriceConfig> bomSpecMaterialConfigList = configCodeMap
                 .getOrDefault(BomSpecPriceConfigCodeEnum.BASE_MATERIAL_PRICE.getKey(), Collections.emptyList());
         BomSpecPriceConfig levelDetail = bomSpecMaterialConfigList.stream()
-                .filter(item -> item.getName().contains(sellingPriceSystem))
+                .filter(item -> item.getType() == bomType && item.getName().contains(level))
                 .findAny().orElse(null);
         if (levelDetail == null) {
             return BigDecimal.ZERO;
@@ -335,6 +345,7 @@ public class BomSpecServiceImpl extends ServiceImpl<BomSpecMapper, BomSpec> impl
         dto.setBomClassifyId(bom.getBomClassifyId());
         dto.setChromatophore(bom.getChromatophore());
         dto.setSellingPriceSystem(bom.getSellingPriceSystem());
+        dto.setLevel(bom.getLevel());
         dto.setEmbossingProcess(bom.getEmbossingProcess());
         dto.setColour(bomSpec.getColour());
         dto.setLength(bomSpec.getLength());

+ 1 - 0
sd-business/src/main/resources/mapper/bom/BomMapper.xml

@@ -18,6 +18,7 @@
                b.unit,
                b.logo,
                b.chromatophore,
+               b.level,
                b.selling_price_system,
                b.angle,
                b.formula,