mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.panzhihua.common.utlis;
 
import java.io.IOException;
 
import javax.servlet.http.HttpServletResponse;
 
import com.alibaba.fastjson.JSONObject;
 
import lombok.extern.slf4j.Slf4j;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 返回json
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2020-11-24 16:03
 **/
@Slf4j
public class ResultUtil {
 
    public static void responseJson(HttpServletResponse httpServletResponse, Object object) {
        try {
            httpServletResponse.setContentType("application/json;charset=utf-8");
            httpServletResponse.getWriter().write(JSONObject.toJSONString(object));
        } catch (IOException e) {
            e.printStackTrace();
            log.error("返回数据到前端失败");
        }
    }
}