linxk hai 1 mes
pai
achega
4894994564

+ 102 - 0
operating-service/src/main/java/com/txz/operating/core/Result.java

@@ -0,0 +1,102 @@
+package com.txz.operating.core;
+
+import com.alibaba.fastjson.JSON;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * 统一API响应结果封装
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class Result<T> implements Serializable {
+    private String code;
+    private String message;
+    private T data;
+
+
+    public static Result success() {
+        return Result.builder()
+                .code("200")
+                .message("操作成功")
+                .build();
+    }
+
+    public static Result success(Object data) {
+        return Result.builder()
+                .code("200")
+                .message("操作成功")
+                .data(data)
+                .build();
+    }
+
+    public static Result build(String code, String message) {
+        return Result.builder()
+                .code(code)
+                .message(message)
+                .build();
+    }
+
+    public static Result fail(String code, String message, Object data) {
+        return Result.builder()
+                .code(code)
+                .message(message)
+                .data(data)
+                .build();
+    }
+
+    public static Result fail(Object data) {
+        return Result.builder()
+                .code("400")
+                .message("操作失败")
+                .data(data)
+                .build();
+    }
+
+    public static Result fail(String code, String message) {
+        return Result.builder()
+                .code(code)
+                .message(message)
+                .build();
+    }
+
+
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public Result setCode(String code) {
+        this.code = code;
+        return this;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public Result setMessage(String message) {
+        this.message = message;
+        return this;
+    }
+
+    public T getData() {
+        return data;
+    }
+
+    public Result setData(T data) {
+        this.data = data;
+        return this;
+    }
+}

+ 0 - 161
operating-service/src/main/java/com/txz/operating/open/been/BdAdrressResult.java

@@ -1,161 +0,0 @@
-package com.txz.operating.open.been;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.util.List;
-
-@AllArgsConstructor
-@NoArgsConstructor
-@Data
-public class BdAdrressResult {
-    private  Integer          status;
-    private  String           message;
-    private  Integer          total;
-    private  List<BdAdrress>  results;
-
-
-
-    public class BdAdrress {
-        private String name;
-        private String address;
-        private String province;
-        private String city;
-        private String area;
-        private String telephone;
-        private String uid;
-        private String adcode;
-        private Double lat;
-        private Double lng;
-        private Location location;
-
-        public Double getLat() {
-            if (location != null){
-                return location.lat;
-            }
-            return lat;
-        }
-
-        public void setLat(Double lat) {
-            this.lat = lat;
-        }
-
-        public Double getLng() {
-            if (location != null){
-                return location.lng;
-            }
-            return lng;
-        }
-
-        public void setLng(Double lng) {
-            this.lng = lng;
-        }
-
-        public Location getLocation() {
-            return location;
-        }
-
-        public void setLocation(Location location) {
-            this.location = location;
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public String getAddress() {
-            return address;
-        }
-
-        public void setAddress(String address) {
-            this.address = address;
-        }
-
-        public String getProvince() {
-            return province;
-        }
-
-        public void setProvince(String province) {
-            this.province = province;
-        }
-
-        public String getCity() {
-            return city;
-        }
-
-        public void setCity(String city) {
-            this.city = city;
-        }
-
-        public String getArea() {
-            return area;
-        }
-
-        public void setArea(String area) {
-            this.area = area;
-        }
-
-        public String getTelephone() {
-            return telephone;
-        }
-
-        public void setTelephone(String telephone) {
-            this.telephone = telephone;
-        }
-
-        public String getUid() {
-            return uid;
-        }
-
-        public void setUid(String uid) {
-            this.uid = uid;
-        }
-
-        public String getAdcode() {
-            return adcode;
-        }
-
-        public void setAdcode(String adcode) {
-            this.adcode = adcode;
-        }
-    }
-
-    class Location {
-        private Double lat;
-        private Double lng;
-
-        public Double getLat() {
-            return lat;
-        }
-
-        public void setLat(Double lat) {
-            this.lat = lat;
-        }
-
-        public Double getLng() {
-            return lng;
-        }
-
-        public void setLng(Double lng) {
-            this.lng = lng;
-        }
-    }
-//        "name":"万志培训学校",
-//            "location":{
-//        "lat":30.297645,
-//                "lng":120.186011
-//    },
-//        "address":"江南巷1号兔狗创新大厦附楼二楼",
-//            "province":"浙江省",
-//            "city":"杭州市",
-//            "area":"下城区",
-//            "telephone":"13738018269",
-//            "detail":1,
-//            "uid":"c0007c5ae7a001a09c09f730"
-//    }
-}

+ 0 - 32
operating-service/src/main/java/com/txz/operating/open/been/JbsStation.java

@@ -1,32 +0,0 @@
-package com.txz.operating.open.been;
-
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class JbsStation {
-
-    private Integer errcode;
-
-    /**
-     * 范围
-     */
-    private Integer radius;
-
-    /**
-     * 纬度
-     */
-    private Double lat;
-
-    /**
-     * 经度
-     */
-    private Double lon;
-
-    /**
-     * 地址
-     */
-    private String address;
-
-}