java110
2020-06-15 c48077a1b2e3f0c688191a0707a8f378bf611a4b
java110-bean/src/main/java/com/java110/vo/ResultVo.java
@@ -1,6 +1,7 @@
package com.java110.vo;
import com.alibaba.fastjson.JSONObject;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -25,6 +26,7 @@
    public static final int CODE_MACHINE_ERROR = -1; // 未知异常
    public static final int CODE_UNAUTHORIZED = 401; //认证失败
    public static final int CODE_WECHAT_UNAUTHORIZED = 1401; //认证失败
    public static final int ORDER_ERROR = 500; //订单调度异常
@@ -154,9 +156,10 @@
    /**
     * 创建ResponseEntity对象
     *
     * @param records 页数
     * @param total 总记录数
     * @param data 数据对象
     * @param total   总记录数
     * @param data    数据对象
     * @return
     */
    public static ResponseEntity<String> createResponseEntity(int records, int total, Object data) {
@@ -166,14 +169,41 @@
    }
    /**
     * 页面跳转
     * @param url
     * @return
     */
    public static ResponseEntity<String> redirectPage(String url) {
        HttpHeaders headers = new HttpHeaders();
        headers.add(HttpHeaders.LOCATION, url);
        ResponseEntity<String> responseEntity = new ResponseEntity<String>("", headers, HttpStatus.FOUND);
        return responseEntity;
    }
    /**
     * 创建ResponseEntity对象
     * @param records 页数
     * @param total 总记录数
     *
     * @param code 状态嘛
     * @param msg 返回信息
     * @param msg  返回信息
     * @param data 数据对象
     * @return
     */
    public static ResponseEntity<String> createResponseEntity(int code, String msg, Object data) {
        ResultVo resultVo = new ResultVo(code, msg, data);
        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
        return responseEntity;
    }
    /**
     * 创建ResponseEntity对象
     *
     * @param records 页数
     * @param total   总记录数
     * @param code    状态嘛
     * @param msg     返回信息
     * @param data    数据对象
     * @return
     */
    public static ResponseEntity<String> createResponseEntity(int records, int total, int code, String msg, Object data) {
        ResultVo resultVo = new ResultVo(records, total, code, msg, data);
        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);