Commit bf89d978 by 郑冰晶

优化BizRepspone、HttpclientUtils

parent c6ed8153
package com.secoo.mall.common.core.bean;
import com.secoo.mall.common.constant.CommonConstant;
......@@ -17,9 +18,31 @@ public class BizResponse<T> extends Response<T> {
super(code, msg);
}
public BizResponse(Integer code, String msg, T data) {
super(code, msg, data);
}
public boolean isSuccess() {
return getCode() != null && getCode() == CommonConstant.Success.CODE;
return getCode() != null && getCode().equals(CommonConstant.Success.CODE);
}
public static <T> BizResponse<T> success(Integer code, String msg,T data) {
return new BizResponse<>(code, msg, data);
}
public static <T> BizResponse<T> success(Integer code, String msg) {
return new BizResponse<>(code, msg);
}
public static <T> BizResponse<T> success(T data) {
return new BizResponse<>(CommonConstant.Success.CODE, CommonConstant.Success.MSG, data);
}
public static <T> BizResponse<T> fail(Integer code, String msg, T data) {
return new BizResponse<>(code, msg, data);
}
public static <T> BizResponse<T> fail(Integer code, String msg) {
return new BizResponse<>(code, msg);
}
}
\ No newline at end of file
package com.secoo.mall.common.core.bean;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
......@@ -10,8 +7,6 @@ import java.io.Serializable;
*
* @param <T>
*/
@Getter
@Setter
public class Response<T> implements Serializable {
private Integer code;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment