lmx 5 days ago
parent
commit
ab48c3fef9

+ 35 - 20
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreProductScrmServiceImpl.java

@@ -32,6 +32,7 @@ import com.fs.hisStore.config.MedicalMallConfig;
 import com.fs.hisStore.domain.*;
 import com.fs.hisStore.mapper.*;
 import com.fs.hisStore.param.FsStoreCartCountParam;
+import com.fs.hisStore.service.IFsStoreProductCategoryScrmService;
 import com.fs.hisStore.utils.StoreAuditLogUtil;
 import com.fs.hisStore.util.BusinessScopeProductTypeUtil;
 import com.fs.statis.dto.ModifyMoreDTO;
@@ -104,6 +105,10 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     @Autowired
     private CloudHostProper cloudHostProper;
 
+
+    @Autowired
+    private IFsStoreProductCategoryScrmService fsStoreProductCategoryService;
+
     /**
      * 查询商品
      *
@@ -430,10 +435,10 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
                 default:
                     return R.error("商品类型错误");
             }
-            
+
             // 根据经营范围校验商品类型
             if (com.fs.common.utils.StringUtils.isNotEmpty(store.getSelectableProductTypes())) {
-                String productTypeName = getProductTypeName(product.getProductType());
+                String productTypeName = getProductTypeName(product.getCateId());
                 if (com.fs.common.utils.StringUtils.isNotEmpty(productTypeName)) {
                     // 直接使用工具类方法校验
                     boolean isAllowed = BusinessScopeProductTypeUtil.isProductTypeAllowed(
@@ -1317,27 +1322,37 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     public void updateFsStoreProductIsShowBatch(Long[] productIds) {
         fsStoreProductMapper.updateFsStoreProductIsShowBatch(productIds);
     }
-    
+
     /**
      * 将商品类型ID转换为商品类型名称
-     * @param productType 商品类型ID:1=非处方 2=处方 3=食品 4=器械
-     * @return 商品类型名称
+     *
      */
-    private String getProductTypeName(Integer productType) {
-        if (productType == null) {
-            return "";
-        }
-        switch (productType) {
-            case 1:
-                return "乙类非处方药";
-            case 2:
-                return "处方药";
-            case 3:
-                return "保健食品";
-            case 4:
-                return "III类医疗器械";
-            default:
-                return "";
+    private String getProductTypeName(Long productType) {
+        String productTypeName = "";
+        FsStoreProductCategoryScrm fsStoreProductCategory = new FsStoreProductCategoryScrm();
+        fsStoreProductCategory.setIsShow(1);
+        fsStoreProductCategory.setIsDel(0);
+        List<FsStoreProductCategoryScrm> list = fsStoreProductCategoryService.selectFsStoreProductCategoryList(fsStoreProductCategory);
+        for (FsStoreProductCategoryScrm item : list) {
+            if (item.getCateId().equals(productType)) {
+                productTypeName = item.getCateName();
+            }
         }
+        return productTypeName;
+//        if (productType == null) {
+//            return "";
+//        }
+//        switch (productType) {
+//            case 1:
+//                return "乙类非处方药";
+//            case 2:
+//                return "处方药";
+//            case 3:
+//                return "保健食品";
+//            case 4:
+//                return "III类医疗器械";
+//            default:
+//                return "";
+//        }
     }
 }