Browse Source

add 基础信息配置

GITZYY 7 months ago
parent
commit
30cef12ee0

+ 8 - 0
egress-gateway-service-domain/pom.xml

@@ -36,5 +36,13 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.alibaba.cola</groupId>
+            <artifactId>cola-component-domain-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.cola</groupId>
+            <artifactId>cola-component-exception</artifactId>
+        </dependency>
     </dependencies>
 </project>

+ 36 - 0
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/common/utils/BizPreconditions.java

@@ -0,0 +1,36 @@
+package com.hrsk.cloud.eg.domain.common.utils;
+
+
+import com.hrsk.pangu.tool.exception.BizException;
+/**
+ * @author: bianlanzhou
+ * @create: 2024-07-27 10:04
+ * @description: FROM GUAVA PRECONDITION,BIZ业务校验
+ **/
+public class BizPreconditions {
+    /**
+     * 验证参数
+     * @param expression 表达式
+     * @param errorMessage 错误信息
+     */
+    public static void checkArgument(boolean expression,  String errorMessage) {
+        if (!expression) {
+            throw new BizException(errorMessage);
+        }
+    }
+
+    /**
+     * 验证不为空
+     * @param reference 入参
+     * @param errorMessage 错误信息
+     * @return T
+     * @param <T> T
+     */
+    public static <T> T checkNotNull( T reference,  String errorMessage) {
+        if (reference == null) {
+            throw new BizException(errorMessage);
+        } else {
+            return reference;
+        }
+    }
+}