Jelajahi Sumber

修改商品、店铺重新审核,修改、新增商品判断资质

chenguo 1 Minggu lalu
induk
melakukan
e902d73236

+ 32 - 0
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreProductScrmServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fs.hisStore.service.impl;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -86,6 +87,8 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
 
     @Autowired
     private StoreAuditLogUtil storeAuditLogUtil;
+    @Autowired
+    private FsStoreScrmServiceImpl fsStoreScrmService;
 
     /**
      * 查询商品
@@ -319,6 +322,35 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         product.setStock(Long.parseLong(countDto.getStock().toString()));
         product.setCompanyIds(param.getCompanyIds());
         product.setVideo(param.getVideo());
+        //校验店铺资质信息
+        //获取店铺
+        FsStoreScrm store = fsStoreScrmService.selectFsStoreByStoreId(product.getStoreId());
+        if(store == null || 1 != store.getStatus()){
+            return R.error("店铺不存在或未启用");
+        }else{
+            //验证资质
+            switch (product.getProductType()){
+                case 1://非处方
+                    break;
+                case 2://处方
+                    if("".equals(store.getDrugLicense()) ||  LocalDate.now().isBefore(LocalDate.parse(store.getDrugLicenseExpiryEnd()))){
+                        return R.error("店铺药品资质为空或已过期,请完善后再添加");
+                    }
+                    break;
+                case 3://食品
+                    if("".equals(store.getFoodLicense()) ||  LocalDate.now().isBefore(LocalDate.parse(store.getFoodLicenseExpiryEnd()))){
+                        return R.error("店铺食品资质为空或已过期,请完善后再添加");
+                    }
+                    break;
+                case 4://器械
+                    if("".equals(store.getMedicalDevice3()) ||  LocalDate.now().isBefore(LocalDate.parse(store.getMedicalDevice3ExpiryEnd()))){
+                        return R.error("店铺器械资质为空或已过期,请完善后再添加");
+                    }
+                    break;
+                default:
+                    return R.error("商品类型错误");
+            }
+        }
         if(param.getProductId() != null){
             //对已上架的商品进行修改需要重新审核
             if(1 == product.getIsShow() && "1".equals(product.getIsAudit())){

+ 2 - 2
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreScrmServiceImpl.java

@@ -89,8 +89,8 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService
     {
         fsStore.setUpdateTime(DateUtils.getNowDate());
         storeAuditLogUtil.addOperLog(fsStore.getStoreId());
-        //更新,信息,时间等,后台重新审核
-        if(1 == fsStore.getIsAudit()){
+        //更新,信息,时间等,后台重新审核,驳回的店铺,重新审核
+        if(1 != fsStore.getIsAudit()){
             fsStore.setIsAudit(0);
         }
         return fsStoreMapper.updateFsStore(fsStore);