Commit 72a97eb9 authored by W_Y's avatar W_Y

Merge branch 'dev' of http://gitlab.91isoft.com:90/wangfei/vehicle-quality-review into wangdingyi

parents d18f8281 29e4eee9
......@@ -2,7 +2,7 @@ package com.ruoyi.web;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.bean.BeanUtils;
......@@ -36,13 +36,13 @@ public class ReviewSceneChangeTaskController extends BaseController {
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "场景变更任务", businessType = BusinessType.INSERT)
@RequestMapping(method = RequestMethod.POST, value = "/create")
public AjaxResult create(@Validated @RequestBody ReviewSceneChangeTaskCreateRequest request) {
public R<String> create(@Validated @RequestBody ReviewSceneChangeTaskCreateRequest request) {
ReviewSceneChangeTask reviewSceneChangeTask = new ReviewSceneChangeTask();
BeanUtils.copyBeanProp(reviewSceneChangeTask, request);
reviewSceneChangeTaskService.create(reviewSceneChangeTask);
return success();
return R.ok();
}
@ApiOperation("审核通过任务")
......@@ -50,11 +50,11 @@ public class ReviewSceneChangeTaskController extends BaseController {
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "审核通过任务", businessType = BusinessType.UPDATE)
@RequestMapping(method = RequestMethod.POST, value = "/pass")
public AjaxResult pass(@Validated @RequestBody ReviewSceneChangeTaskPassRequest request) {
public R<String> pass(@Validated @RequestBody ReviewSceneChangeTaskPassRequest request) {
reviewSceneChangeTaskService.pass(request.getTaskId(),request.getComment());
return success();
return R.ok();
}
@ApiOperation("审核驳回任务")
......@@ -62,11 +62,11 @@ public class ReviewSceneChangeTaskController extends BaseController {
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "审核驳回任务", businessType = BusinessType.UPDATE)
@RequestMapping(method = RequestMethod.POST, value = "/reject")
public AjaxResult reject(@Validated @RequestBody ReviewSceneChangeTaskPassRequest request) {
public R<String> reject(@Validated @RequestBody ReviewSceneChangeTaskPassRequest request) {
reviewSceneChangeTaskService.reject(request.getTaskId(),request.getComment());
return success();
return R.ok();
}
/**
......
package com.ruoyi.common.core.domain;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Objects;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.utils.StringUtils;
/**
* 操作消息提醒
*
*
* @author ruoyi
*/
public class AjaxResult<T> implements Serializable
public class AjaxResult extends HashMap<String, Object>
{
private static final long serialVersionUID = 1L;
/** 数据对象 */
public static final String DATA_TAG = "data";
/** 状态码 */
public static final String CODE_TAG = "code";
/**
* 是否成功 true or false
*/
private boolean success;
/** 返回内容 */
public static final String MSG_TAG = "msg";
/**
* 状态码
*/
private int code;
/**
* 返回内容
*/
private String msg;
/**
* 数据对象
*/
private T data;
/** 数据对象 */
public static final String DATA_TAG = "data";
/**
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
......@@ -47,38 +33,29 @@ public class AjaxResult<T> implements Serializable
/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param code 错误
* @param code 状态
* @param msg 返回内容
* @param data 数据对象
*/
public AjaxResult(int code, String msg, T data) {
this.code = code;
this.msg = msg;
if (StringUtils.isNotNull(data)) {
this.data = data;
}
if (code == HttpStatus.SUCCESS) {
this.success = Boolean.TRUE;
} else {
this.success = Boolean.FALSE;
}
public AjaxResult(int code, String msg)
{
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
}
/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param code 错误
* @param code 状态
* @param msg 返回内容
* @param data 数据对象
*/
public AjaxResult(int code, String msg) {
this.code = code;
this.msg = msg;
if (code == HttpStatus.SUCCESS) {
this.success = Boolean.TRUE;
} else {
this.success = Boolean.FALSE;
public AjaxResult(int code, String msg, Object data)
{
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
if (StringUtils.isNotNull(data))
{
super.put(DATA_TAG, data);
}
}
......@@ -97,7 +74,7 @@ public class AjaxResult<T> implements Serializable
*
* @return 成功消息
*/
public static <U> AjaxResult<U> success(U data)
public static AjaxResult success(Object data)
{
return AjaxResult.success("操作成功", data);
}
......@@ -120,7 +97,7 @@ public class AjaxResult<T> implements Serializable
* @param data 数据对象
* @return 成功消息
*/
public static <U> AjaxResult<U> success(String msg, U data)
public static AjaxResult success(String msg, Object data)
{
return new AjaxResult(HttpStatus.SUCCESS, msg, data);
}
......@@ -143,7 +120,7 @@ public class AjaxResult<T> implements Serializable
* @param data 数据对象
* @return 警告消息
*/
public static <U> AjaxResult<U> warn(String msg, U data)
public static AjaxResult warn(String msg, Object data)
{
return new AjaxResult(HttpStatus.WARN, msg, data);
}
......@@ -151,7 +128,7 @@ public class AjaxResult<T> implements Serializable
/**
* 返回错误消息
*
* @return
* @return 错误消息
*/
public static AjaxResult error()
{
......@@ -162,7 +139,7 @@ public class AjaxResult<T> implements Serializable
* 返回错误消息
*
* @param msg 返回内容
* @return 警告消息
* @return 错误消息
*/
public static AjaxResult error(String msg)
{
......@@ -174,9 +151,9 @@ public class AjaxResult<T> implements Serializable
*
* @param msg 返回内容
* @param data 数据对象
* @return 警告消息
* @return 错误消息
*/
public static <U> AjaxResult<U> error(String msg, U data)
public static AjaxResult error(String msg, Object data)
{
return new AjaxResult(HttpStatus.ERROR, msg, data);
}
......@@ -184,43 +161,57 @@ public class AjaxResult<T> implements Serializable
/**
* 返回错误消息
*
* @param code 响应
* @param msg 响应消息
* @return 警告消息
* @param code 状态
* @param msg 返回内容
* @return 错误消息
*/
public static <U> AjaxResult<U> error(int code, String msg)
public static AjaxResult error(int code, String msg)
{
return new AjaxResult(code, msg);
return new AjaxResult(code, msg, null);
}
/**
* 方便链式调用
* 是否为成功消息
*
* @param key 键
* @param value 值
* @return 数据对象
* @return 结果
*/
@Deprecated
public AjaxResult put(String key, Object value) {
//super.put(key, value);
return this;
public boolean isSuccess()
{
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
}
/**
* 是否为成功消息
* 是否为警告消息
*
* @return 结果
*/
public boolean isSuccess() {
return success;
public boolean isWarn()
{
return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
}
public String getMsg() {
return msg;
/**
* 是否为错误消息
*
* @return 结果
*/
public boolean isError()
{
return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
}
public Integer getCode() {
return code;
/**
* 方便链式调用
*
* @param key 键
* @param value 值
* @return 数据对象
*/
@Override
public AjaxResult put(String key, Object value)
{
super.put(key, value);
return this;
}
}
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