Prechádzať zdrojové kódy

产品删除停用过期提示语修改

Zhaops 6 rokov pred
rodič
commit
82eb55af9e

+ 22 - 5
diagbotman-service/src/main/java/com/diagbot/facade/ProductServiceFacade.java

@@ -61,17 +61,34 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
             userId = operatorId;
         }
         LantoneProduct lantoneProduct = lantoneProductFacade.getById(productServiceSaveVO.getProductId());
-        if (lantoneProduct == null || lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y.getKey()) || lantoneProduct.getServiceStatus().equals(StatusEnum.Disable.getKey())) {
+        if (lantoneProduct == null) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS,
-                    "产品异常,请刷新页面");
+                    "产品未找到");
+        } else if (lantoneProduct.getIsDeleted().equals(IsDeleteEnum.Y.getKey())) {
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "无法操作,该产品线已删除");
+        } else if (lantoneProduct.getServiceStatus().equals(StatusEnum.Disable.getKey())) {
+            throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                    "无法操作,该产品线已停用");
         }
         QueryWrapper<OpenedProducts> openedProductsQueryWrapper = new QueryWrapper<>();
-        openedProductsQueryWrapper.eq("product_id", lantoneProduct.getId()).eq("user_id", userId).eq("is_deleted", IsDeleteEnum.N.getKey());
+        openedProductsQueryWrapper.eq("product_id", lantoneProduct.getId()).eq("user_id", userId);
+        List<OpenedProducts> openedProductsList = openedProductsFacade.list(openedProductsQueryWrapper);
+        openedProductsQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
         OpenedProducts openedProducts = openedProductsFacade.getOne(openedProductsQueryWrapper);
         if (!productServiceSaveVO.getType().equals(TokenTypeEnum.Trial.getKey())) {
-            if (openedProducts == null || openedProducts.getServiceStatus().equals(StatusEnum.Disable.getKey()) || openedProducts.getEndTime().before(new Date())) {
+            if (openedProductsList.size() == 0) {
+                throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                        "无法操作,该产品未开通");
+            } else if (openedProducts == null) {
+                throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                        "无法操作,该产品已删除");
+            } else if (openedProducts.getServiceStatus().equals(StatusEnum.Disable.getKey())) {
+                throw new CommonException(CommonErrorCode.NOT_EXISTS,
+                        "无法操作,该产品已停用");
+            } else if (openedProducts.getEndTime().before(new Date())) {
                 throw new CommonException(CommonErrorCode.NOT_EXISTS,
-                        "产品异常,请刷新页面");
+                        "无法操作,该产品已到期");
             }
         }
         ServiceInfo serviceInfo = serviceInfoFacade.getById(productServiceSaveVO.getServiceId());