Browse Source

热线接口修改返回格式

czt 1 month ago
parent
commit
5b4f09bc9e

+ 1 - 10
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java

@@ -16,15 +16,6 @@ public class RuoYiApplication
     {
         // System.setProperty("spring.devtools.restart.enabled", "false");
         SpringApplication.run(RuoYiApplication.class, args);
-        System.out.println("(♥◠‿◠)ノ゙  若依启动成功   ლ(´ڡ`ლ)゙  \n" +
-                " .-------.       ____     __        \n" +
-                " |  _ _   \\      \\   \\   /  /    \n" +
-                " | ( ' )  |       \\  _. /  '       \n" +
-                " |(_ o _) /        _( )_ .'         \n" +
-                " | (_,_).' __  ___(_ o _)'          \n" +
-                " |  |\\ \\  |  ||   |(_,_)'         \n" +
-                " |  | \\ `'   /|   `-'  /           \n" +
-                " |  |  \\    /  \\      /           \n" +
-                " ''-'   `'-'    `-..-'              ");
+        System.out.println("数据前置服务系统启动成功\n");
     }
 }

+ 6 - 22
ruoyi-admin/src/main/resources/banner.txt

@@ -1,24 +1,8 @@
 Application Version: ${ruoyi.version}
 Spring Boot Version: ${spring-boot.version}
-////////////////////////////////////////////////////////////////////
-//                          _ooOoo_                               //
-//                         o8888888o                              //
-//                         88" . "88                              //
-//                         (| ^_^ |)                              //
-//                         O\  =  /O                              //
-//                      ____/`---'\____                           //
-//                    .'  \\|     |//  `.                         //
-//                   /  \\|||  :  |||//  \                        //
-//                  /  _||||| -:- |||||-  \                       //
-//                  |   | \\\  -  /// |   |                       //
-//                  | \_|  ''\---/''  |   |                       //
-//                  \  .-\__  `-`  ___/-. /                       //
-//                ___`. .'  /--.--\  `. . ___                     //
-//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
-//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
-//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
-//      ========`-.____`-.___\_____/___.-`____.-'========         //
-//                           `=---='                              //
-//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
-//             佛祖保佑       永不宕机      永无BUG               //
-////////////////////////////////////////////////////////////////////
+                  __         __    ________ ________ ________
+__  _  ____  _  _|  | __    |__|  /  _____//  _____//  _____/
+\ \/ \/ /\ \/ \/ /  |/ /    |  | /   __  \/   __  \/   __  \
+ \     /  \     /|    <     |  | \  |__\  \  |__\  \  |__\  \
+  \/\_/    \/\_/ |__|_ \/\__|  |  \_____  /\_____  /\_____  /
+                      \/\______|        \/       \/       \/

+ 24 - 13
ruoyi-api/src/main/java/com/ruoyi/api/domain/dto/UnifiedApiRespDTO.java

@@ -1,4 +1,3 @@
-// UnifiedApiRespDTO.java
 package com.ruoyi.api.domain.dto;
 
 import java.util.HashMap;
@@ -8,16 +7,16 @@ import java.util.Map;
  * 统一API响应DTO
  */
 public class UnifiedApiRespDTO {
-    
+
     private Integer code;
     private String msg;
     private Boolean success;
     private Map<String, Object> data;
-    
+
     public UnifiedApiRespDTO() {
         this.data = new HashMap<>();
     }
-    
+
     public static UnifiedApiRespDTO success() {
         UnifiedApiRespDTO response = new UnifiedApiRespDTO();
         response.setCode(200);
@@ -25,7 +24,7 @@ public class UnifiedApiRespDTO {
         response.setSuccess(true);
         return response;
     }
-    
+
     public static UnifiedApiRespDTO success(String msg) {
         UnifiedApiRespDTO response = new UnifiedApiRespDTO();
         response.setCode(200);
@@ -33,7 +32,7 @@ public class UnifiedApiRespDTO {
         response.setSuccess(true);
         return response;
     }
-    
+
     public static UnifiedApiRespDTO success(String msg, Map<String, Object> data) {
         UnifiedApiRespDTO response = new UnifiedApiRespDTO();
         response.setCode(200);
@@ -42,7 +41,24 @@ public class UnifiedApiRespDTO {
         response.setData(data);
         return response;
     }
-    
+
+    // 新增:支持直接传入单个业务对象,自动封装到data中(替代原setResponseResult)
+    public static UnifiedApiRespDTO success(String msg, Object data) {
+        UnifiedApiRespDTO response = new UnifiedApiRespDTO();
+        response.setCode(200);
+        response.setMsg(msg);
+        response.setSuccess(true);
+        if (data != null) {
+            // 如果是Map类型,直接赋值;否则作为默认key的value(可根据业务调整默认key)
+            if (data instanceof Map) {
+                response.setData((Map<String, Object>) data);
+            } else {
+                response.addData("result", data);
+            }
+        }
+        return response;
+    }
+
     public static UnifiedApiRespDTO error(String msg) {
         UnifiedApiRespDTO response = new UnifiedApiRespDTO();
         response.setCode(500);
@@ -50,16 +66,11 @@ public class UnifiedApiRespDTO {
         response.setSuccess(false);
         return response;
     }
-    
+
     public UnifiedApiRespDTO addData(String key, Object value) {
         this.data.put(key, value);
         return this;
     }
-    
-    public UnifiedApiRespDTO setResponseResult(Object result) {
-        this.data.put("responseResult", result);
-        return this;
-    }
 
     public Integer getCode() {
         return code;

+ 6 - 10
ruoyi-api/src/main/java/com/ruoyi/api/service/impl/UnifiedApiServiceImpl.java

@@ -300,8 +300,7 @@ public class UnifiedApiServiceImpl implements IUnifiedApiService {
             // 违约金 - 默认否
             respDTO.setIsDamages("否");
 
-            return UnifiedApiRespDTO.success("查询成功")
-                    .setResponseResult(respDTO);
+            return UnifiedApiRespDTO.success("查询成功", respDTO);
 
         } catch (Exception e) {
             log.error("查询水费失败", e);
@@ -422,8 +421,7 @@ public class UnifiedApiServiceImpl implements IUnifiedApiService {
                 respDTO.setSwitchTableDate(sdf.format(switchTableHistory.getOperateDate()));
             }
 
-            return UnifiedApiRespDTO.success("查询成功")
-                    .setResponseResult(respDTO);
+            return UnifiedApiRespDTO.success("查询成功", respDTO);
 
         } catch (Exception e) {
             log.error("查询表卡信息失败", e);
@@ -652,11 +650,9 @@ public class UnifiedApiServiceImpl implements IUnifiedApiService {
      * 构建客户列表响应
      */
     private UnifiedApiRespDTO buildCustomerListResponse(List<CustomerListQueryRespDTO> list, Long total) {
-        Map<String, Object> responseResult = new HashMap<>();
-        responseResult.put("list", list);
-        responseResult.put("total", total);
-
-        return UnifiedApiRespDTO.success("查询成功")
-                .setResponseResult(responseResult);
+        Map<String, Object> dataMap = new HashMap<>();
+        dataMap.put("list", list);
+        dataMap.put("total", total);
+        return UnifiedApiRespDTO.success("查询成功", dataMap);
     }
 }

File diff suppressed because it is too large
+ 1 - 1
ruoyi-api/src/main/java/com/ruoyi/api/utils/Sm4Utils.java