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("返回数据到前端失败");
|
}
|
}
|
}
|