自动化立体仓库 - WCS系统
vincent
2020-05-26 47014719789d1bfd9e368f5233d3f752a1e2e262
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
30
31
package com.zy.common.utils;
 
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.core.common.R;
 
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
 
/**
 * Created by vincent on 2019-08-01
 */
public class Http {
 
    public static void response(HttpServletResponse response, String baseRes){
        response.setCharacterEncoding("utf-8");
        response.setContentType("application/json; charset=utf-8");
        try (PrintWriter out = response.getWriter()) {
            R r = R.parse(baseRes);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("total", "0");
            jsonObject.put("record", "");
            r.add(jsonObject);
            out.print(JSON.toJSONString(r));
            out.flush();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}