Commit 1e722089 authored by 王飞's avatar 王飞

Merge branch 'wangfei' into 'dev'

Feat

See merge request !27
parents f317893c 917f40a7
package com.ruoyi;
import cn.hutool.json.JSONUtil;
import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.service.ReviewStandardService;
import org.junit.jupiter.api.Test;
......@@ -26,10 +27,21 @@ public class ReviewStandardTest {
}
@Test
public void findTreeTest() {
public void findTreeTestSystem() {
List<ReviewStandard> tree = reviewStandardService.findTree(1L, ReviewStandard.TYPE_SYSTEM);
System.out.println(JSONUtil.toJsonPrettyStr(tree));
}
@Test
public void findTreeTestCar() {
List<ReviewStandard> tree = reviewStandardService.findTree(1L, ReviewStandard.TYPE_CAR);
System.out.println(JSONUtil.toJsonPrettyStr(tree));
}
@Test
public void generateId() {
for(int i=0; i<38; i++)
System.out.println(SnowflakeUtil.generate());
}
}
......@@ -26,6 +26,8 @@ public final class ServiceException extends RuntimeException
*/
private String detailMessage;
private Object data;
/**
* 空构造方法,避免反序列化问题
*/
......@@ -44,6 +46,13 @@ public final class ServiceException extends RuntimeException
this.code = code;
}
public ServiceException(String message, Integer code, Object data)
{
this.message = message;
this.code = code;
this.data = data;
}
public String getDetailMessage()
{
return detailMessage;
......@@ -71,4 +80,16 @@ public final class ServiceException extends RuntimeException
this.detailMessage = detailMessage;
return this;
}
public void setCode(Integer code) {
this.code = code;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
\ No newline at end of file
......@@ -58,7 +58,9 @@ public class GlobalExceptionHandler
{
log.error(e.getMessage(), e);
Integer code = e.getCode();
return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage());
Object data = e.getData();
return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage(), data == null ? null : data);
}
/**
......
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