ソースを参照

Merge remote-tracking branch 'origin/ScrmStores' into ScrmStores

# Conflicts:
#	fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreProductScrmServiceImpl.java
yjwang 4 日 前
コミット
01ff659038

+ 102 - 50
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreProductScrmServiceImpl.java

@@ -33,6 +33,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;
@@ -105,6 +106,10 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     @Autowired
     private CloudHostProper cloudHostProper;
 
+
+    @Autowired
+    private IFsStoreProductCategoryScrmService fsStoreProductCategoryService;
+
     /**
      * 查询商品
      *
@@ -397,44 +402,12 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         product.setIsDrug(param.getIsDrug().toString());
         product.setInstructionManual(param.getInstructionManual());
 
-        List<String> businessExpire = param.getBusinessExpire();
-        if (businessExpire != null && businessExpire.size() >= 2) {
-            product.setBusinessStart(parseLocalDate(businessExpire.get(0)));
-            product.setBusinessEnd(parseLocalDate(businessExpire.get(1)));
-        }
-
-        List<String> licenseExpire = param.getLicenseExpire();
-        if (licenseExpire != null && licenseExpire.size() >= 2) {
-            product.setLicenseStart(parseLocalDate(licenseExpire.get(0)));
-            product.setLicenseEnd(parseLocalDate(licenseExpire.get(1)));
-        }
-
-        List<String> certificateExpire = param.getCertificateExpire();
-        if (certificateExpire != null && certificateExpire.size() >= 2) {
-            product.setCertificateStart(parseLocalDate(certificateExpire.get(0)));
-            product.setCertificateEnd(parseLocalDate(certificateExpire.get(1)));
-        }
-
-        List<String> voucherExpire = param.getVoucherExpire();
-        if (voucherExpire != null && voucherExpire.size() >= 2) {
-            product.setVoucherStart(parseLocalDate(voucherExpire.get(0)));
-            product.setVoucherEnd(parseLocalDate(voucherExpire.get(1)));
-        }
-
-        List<String> gmpAuthExpire = param.getGmpAuthExpire();
-        if (gmpAuthExpire != null && gmpAuthExpire.size() >= 2) {
-            product.setGmpAuthStart(parseLocalDate(gmpAuthExpire.get(0)));
-            product.setGmpAuthEnd(parseLocalDate(gmpAuthExpire.get(1)));
-        }
-
         //获取商品编码
         if(!param.getValues().isEmpty()){
             if(param.getValues().get(0).getBarCode() != null){
                 product.setBarCode(param.getValues().get(0).getBarCode());
             }
         }
-
-        product.setBusinessLink(param.getBusinessLink());
         //校验店铺资质信息
         //获取店铺
         FsStoreScrm store = fsStoreScrmService.selectFsStoreByStoreId(product.getStoreId());
@@ -540,6 +513,75 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         return R.ok();
     }
 
+    /**
+     * 校验店铺添加药品是否含有祥光资质
+     * @param businessScope
+     * @param productTypeName
+     * @return
+     */
+    public Boolean validateShopBusinessScope(String businessScope, String productTypeName) {
+        Set<String> judgmentSet = new HashSet<>();
+        Boolean res = Boolean.TRUE;
+        switch (productTypeName) {
+            case "中成药":
+                judgmentSet.add("中成药");
+                judgmentSet.add("中成药");
+                judgmentSet.add("药品零售");
+                break;
+            case "处方药":
+                judgmentSet.add("处方药/化学药制剂");
+                judgmentSet.add("处方药/化学药制剂");
+                judgmentSet.add("药品零售");
+                break;
+            case "中药饮片":
+                judgmentSet.add("中药饮片");
+                judgmentSet.add("中药饮片");
+                judgmentSet.add("药品零售");
+                break;
+            case "保健食品":
+                judgmentSet.add("保健食品销售");
+                judgmentSet.add("保健食品销售");
+                judgmentSet.add("保健食品销售");
+                break;
+            case "I类器械":
+                judgmentSet.add("第一类医疗器械销售");
+                judgmentSet.add("第一类医疗器械销售");
+                judgmentSet.add("第一类医疗器械备案凭证");
+                break;
+            case "II类器械":
+                judgmentSet.add("第二类医疗器械销售");
+                judgmentSet.add("第二类医疗器械销售");
+                judgmentSet.add("第二类医疗器械备案凭证");
+                break;
+            case "III类器械":
+                judgmentSet.add("第二类医疗器械经营");
+                judgmentSet.add("第二类医疗器械经营");
+                judgmentSet.add("第二类医疗器械注册证");
+                break;
+            case "甲类非处方":
+                judgmentSet.add("甲类非处方药/化学药制剂");
+                judgmentSet.add("甲类非处方药/化学药制剂");
+                judgmentSet.add("药品零售");
+                break;
+            case "乙类非处方":
+                judgmentSet.add("乙类非处方药/化学药制剂");
+                judgmentSet.add("乙类非处方药/化学药制剂");
+                judgmentSet.add("药品零售");
+                break;
+        }
+
+        if(null != judgmentSet && !judgmentSet.isEmpty()){
+           for(String item:judgmentSet){
+               res = res && businessScope.contains(item);
+               if(!res) break;
+           }
+        }
+        else{
+            res = false;
+        }
+        return res;
+    }
+
 
     private void addProductAttr(Long productId, List<ProductArrtDTO> items, List<FsStoreProductAttrValueScrm> values,Long storeId){
         //清空attr
@@ -1350,28 +1392,38 @@ 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 "";
+//        }
     }
 
     /**