From 8883d654f52171657b62aaec85027f29ef0a4dd0 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期日, 26 二月 2023 22:30:39 +0800
Subject: [PATCH] 新增加用户端接口

---
 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/ResultUtil.java |   59 +++++++++++++++++++++++++++++------------------------------
 1 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/ResultUtil.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/ResultUtil.java
index e78e01f..8134c57 100644
--- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/ResultUtil.java
+++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/ResultUtil.java
@@ -1,6 +1,5 @@
 package com.supersavedriving.user.modular.system.util;
 
-import com.alibaba.fastjson.JSONObject;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -10,23 +9,23 @@
 @ApiModel(value = "统一返回结果集")
 public class ResultUtil<T> {
 
-    public static final Integer SUCCESS = 200;
+    public static final Integer SUCCESS = 10000;
 
-    public static final Integer PARAM_ERROR = 300;
+    public static final Integer PARAM_ERROR = 10010;
 
-    public static final Integer RUNTIME_ERROR = 400;
+    public static final Integer SYSTEM_INFO = 10020;
 
-    public static final Integer ERROR = 500;
+    public static final Integer TOKEN_ERROR = 10030;
 
-    public static final Integer TOKEN_ERROR = 600;
+    public static final Integer SIGN_ERROR = 10040;
 
-    public static final Integer SIGN_ERROR = 700;
+    public static final Integer RUNTIME_ERROR = 10050;
 
-    public static final String Token = "TOKEN_INVALID";
+    public static final String Token = "token无效";
 
-    public static final String SIGN = "SIGN_INVALID";
+    public static final String SIGN = "签名无效";
 
-    @ApiModelProperty(name = "code", value = "业务状态码 200:成功,300:参数错误,400:运行异常,500:其他异常, 600:token无效,需重新登录,700:签名无效")
+    @ApiModelProperty(name = "code", value = "业务状态码 10000:成功,10010:参数错误,10020:系统提示, 10030:身份校验异常,10040:签名不通过,10050:系统运行异常")
     private Integer code;//备用状态码
 
     @ApiModelProperty(name = "msg", value = "返回结果说明")
@@ -75,15 +74,15 @@
      * @return
      */
     public static ResultUtil error(String mag){
-        return ResultUtil.getResult(ResultUtil.ERROR, mag, new JSONObject());
+        return ResultUtil.getResult(ResultUtil.SYSTEM_INFO, mag, new Object());
     }
 
     /**
      * 错误信息
      * @return
      */
-    public static <T> ResultUtil<T> error(String mag, T obj){
-        return ResultUtil.getResult(ResultUtil.ERROR, mag, obj);
+    public static <T> ResultUtil <T> error(String mag, T obj){
+        return ResultUtil.getResult(ResultUtil.SYSTEM_INFO, mag, obj);
     }
 
     /**
@@ -91,7 +90,7 @@
      * @return
      */
     public static ResultUtil tokenErr(){
-        return ResultUtil.getResult(ResultUtil.TOKEN_ERROR, ResultUtil.Token, new JSONObject());
+        return ResultUtil.getResult(ResultUtil.TOKEN_ERROR, ResultUtil.Token, new Object());
     }
 
     /**
@@ -99,7 +98,15 @@
      * @return
      */
     public static ResultUtil tokenErr(String msg){
-        return ResultUtil.getResult(ResultUtil.TOKEN_ERROR, msg, new JSONObject());
+        return ResultUtil.getResult(ResultUtil.TOKEN_ERROR, msg, new Object());
+    }
+
+    /**
+     * 参数异常
+     * @return
+     */
+    public static  ResultUtil paranErr(String...ages){
+        return ResultUtil.getResult(ResultUtil.PARAM_ERROR, "【" + ages + "】参数异常", new Object());
     }
 
     /**
@@ -107,15 +114,7 @@
      * @return
      */
     public static ResultUtil paranErr(){
-        return ResultUtil.getResult(ResultUtil.PARAM_ERROR, "PARAM_ERROR", new JSONObject());
-    }
-
-    /**
-     * 参数异常
-     * @return
-     */
-    public static <T> ResultUtil<T> paranErr(T data){
-        return ResultUtil.getResult(ResultUtil.PARAM_ERROR, "SYSTEM_RUN_ERROR", data);
+        return ResultUtil.getResult(ResultUtil.PARAM_ERROR, "参数异常", new Object());
     }
 
     /**
@@ -123,7 +122,7 @@
      * @return
      */
     public static ResultUtil runErr(){
-        return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, "SYSTEM_RUN_ERROR", new JSONObject());
+        return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, "系统运行异常", new Object());
     }
 
 
@@ -131,15 +130,15 @@
      * 运行异常
      * @return
      */
-    public static <T> ResultUtil<T> runErr(T data){
-        return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, "SYSTEM_RUN_ERROR", data);
+    public static <T>ResultUtil<T> runErr(T data){
+        return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, "系统运行异常", data);
     }
 
     /**
      * 运行异常
      * @return
      */
-    public static <T> ResultUtil<T> runErr(T data, String msg){
+    public static <T>ResultUtil<T> runErr(T data, String msg){
         return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, msg, data);
     }
 
@@ -150,7 +149,7 @@
      * @return
      */
     public static ResultUtil success(){
-        return ResultUtil.getResult(ResultUtil.SUCCESS, "SUCCESS", new JSONObject());
+        return ResultUtil.getResult(ResultUtil.SUCCESS, "成功", new Object());
     }
 
 
@@ -161,7 +160,7 @@
      * @return
      */
     public static <T> ResultUtil<T> success(T data){
-        return ResultUtil.getResult(ResultUtil.SUCCESS, "SUCCESS", data);
+        return ResultUtil.getResult(ResultUtil.SUCCESS, "成功", data);
     }
 
     /**

--
Gitblit v1.7.1