diff --git a/newadmin/admin/admin.jar b/newadmin/admin/admin.jar new file mode 100644 index 0000000..27aeb55 Binary files /dev/null and b/newadmin/admin/admin.jar differ diff --git a/newadmin/common-api/.gitignore b/newadmin/common-api/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/newadmin/common-api/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/config/MsgException.java b/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/config/MsgException.java new file mode 100644 index 0000000..71ff79a --- /dev/null +++ b/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/config/MsgException.java @@ -0,0 +1,101 @@ +package com.chaozhanggui.common.system.config; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import lombok.experimental.Accessors; +import org.apache.commons.lang3.StringUtils; + +import java.io.Serializable; +import java.util.List; + +/** + * 一般异常信息的异常,全局捕获会抛出异常信息给前端 + * @author Djh + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class MsgException extends RuntimeException { + + private final Serializable obj; + private final String code; + + public MsgException(String msg) { + this(msg, null); + } + + public MsgException(String msg, Serializable obj) { + this(RespBody.fail, msg, obj); + } + + public MsgException(String code, String msg, Serializable obj) { + super(msg); + this.code = code; + this.obj = obj; + } + + public static void throwException(String msg) throws MsgException { + throw new MsgException(msg); + } + + /** + * @param result + * @param errMsg + * + * @throws MsgException 为空的时候抛出异常 + */ + public static void check(boolean result, String errMsg) throws MsgException { + if (result) { + throw new MsgException(errMsg); + } + } + + /** + * @param obj1 + * @param errMsg + */ + public static void checkNull(Object obj1, String errMsg) throws MsgException { + if (obj1 == null) { + throw new MsgException(errMsg); + } + } + + public static void checkEquals(Object obj1, Object obj2, String errMsg) { + if (obj1.equals(obj2)) { + throw new MsgException(errMsg); + } + } + + public static void checkUnequals(Object obj1, Object obj2, String errMsg) { + if (!obj1.equals(obj2)) { + throw new MsgException(errMsg); + } + } + + public static void checkNonNull(Object obj1, String errMsg) throws MsgException { + if (obj1 != null) { + throw new MsgException(errMsg); + } + } + + public static void checkBlank(String field, String errMsg) throws MsgException { + if (StringUtils.isBlank(field)) { + throw new MsgException(errMsg); + } + } + + public static void checkBlank(List dataList, String errMsg) throws MsgException { + if (dataList == null || dataList.isEmpty()) { + throw new MsgException(errMsg); + } + } + + public static void checkNonBlank(List dataList, String errMsg) throws MsgException { + if (dataList != null && !dataList.isEmpty()) { + throw new MsgException(errMsg); + } + } +} + diff --git a/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/config/RespBody.java b/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/config/RespBody.java index 506d108..62ca198 100644 --- a/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/config/RespBody.java +++ b/newadmin/common-api/src/main/java/com/chaozhanggui/common/system/config/RespBody.java @@ -9,6 +9,7 @@ import java.util.Objects; //命名区别于ResponseBody注解 public class RespBody { + public static String fail="400"; private static Logger logger = LoggerFactory.getLogger(RespBody.class); private String code; private String message; diff --git a/newadmin/dao-api/.gitignore b/newadmin/dao-api/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/newadmin/dao-api/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/newadmin/merchant-service-api/.gitignore b/newadmin/merchant-service-api/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/newadmin/merchant-service-api/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file