httpResult

来源:互联网 发布:常见web前后端数据交互 编辑:程序博客网 时间:2024/06/05 03:03
import org.apache.commons.lang3.StringUtils;public class HttpResult {    // 响应状态码    private Integer code;    // 响应体    private String body;    public HttpResult() {    }    public HttpResult(Integer code, String body) {        super();        this.code = code;        if (StringUtils.isNotEmpty(body)) {            this.body = body;        }    }    public Integer getCode() {        return code;    }    public void setCode(Integer code) {        this.code = code;    }    public String getBody() {        return body;    }    public void setBody(String body) {        this.body = body;    }}public ResponseEntity<String> insertAppoint(Appointment appointment) {if (StringUtils.isEmpty(appointment.getLOAN_MONEY()) ||StringUtils.isEmpty(appointment.getUSER_NAME()) ||StringUtils.isEmpty(appointment.getUSER_PHONE())) {return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);}try {indexService.insertAppoint(appointment);} catch (Exception e) {return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);}return ResponseEntity.status(HttpStatus.OK).body(null);}

原创粉丝点击