Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
老大叔也想要天天的爱情
DolphinScheduler
提交
30a63a05
DolphinScheduler
项目概览
老大叔也想要天天的爱情
/
DolphinScheduler
与 Fork 源项目一致
Fork自
apache / DolphinScheduler
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
30a63a05
编写于
4月 11, 2019
作者:
L
ligang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add verify queue_name
上级
a11418a5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
133 addition
and
110 deletion
+133
-110
escheduler-api/src/main/java/cn/escheduler/api/enums/Status.java
...ler-api/src/main/java/cn/escheduler/api/enums/Status.java
+2
-1
escheduler-api/src/main/java/cn/escheduler/api/service/QueueService.java
...src/main/java/cn/escheduler/api/service/QueueService.java
+131
-109
未找到文件。
escheduler-api/src/main/java/cn/escheduler/api/enums/Status.java
浏览文件 @
30a63a05
...
...
@@ -152,7 +152,8 @@ public enum Status {
CREATE_QUEUE_ERROR
(
10127
,
"create queue error"
),
QUEUE_NOT_EXIST
(
10128
,
"queue {0} not exists"
),
QUEUE_EXIST
(
10129
,
"queue already exists"
),
UPDATE_QUEUE_ERROR
(
10130
,
"update queue error"
),
QUEUE_NAME_EXIST
(
10130
,
"queue name already exists"
),
UPDATE_QUEUE_ERROR
(
10131
,
"update queue error"
),
UDF_FUNCTION_NOT_EXIST
(
20001
,
"UDF function not found"
),
...
...
escheduler-api/src/main/java/cn/escheduler/api/service/QueueService.java
浏览文件 @
30a63a05
...
...
@@ -35,129 +35,151 @@ import java.util.Map;
* queue service
*/
@Service
public
class
QueueService
extends
BaseService
{
@Autowired
private
QueueMapper
queueMapper
;
/**
* query queue list
*
* @param loginUser
* @return
*/
public
Map
<
String
,
Object
>
queryList
(
User
loginUser
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
5
);
if
(
checkAdmin
(
loginUser
,
result
))
{
return
result
;
}
List
<
Queue
>
queueList
=
queueMapper
.
queryAllQueue
();
result
.
put
(
Constants
.
DATA_LIST
,
queueList
);
putMsg
(
result
,
Status
.
SUCCESS
);
return
result
;
}
/**
* query queue list paging
* @param loginUser
* @param searchVal
* @param pageNo
* @param pageSize
* @return
*/
public
Map
<
String
,
Object
>
queryList
(
User
loginUser
,
String
searchVal
,
Integer
pageNo
,
Integer
pageSize
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
5
);
if
(
checkAdmin
(
loginUser
,
result
))
{
return
result
;
}
Integer
count
=
queueMapper
.
countQueuePaging
(
searchVal
);
public
class
QueueService
extends
BaseService
{
PageInfo
<
Queue
>
pageInfo
=
new
PageInfo
<>(
pageNo
,
pageSize
);
List
<
Queue
>
queueList
=
queueMapper
.
queryQueuePaging
(
searchVal
,
pageInfo
.
getStart
(),
pageSize
);
@Autowired
private
QueueMapper
queueMapper
;
pageInfo
.
setTotalCount
(
count
);
pageInfo
.
setLists
(
queueList
);
result
.
put
(
Constants
.
DATA_LIST
,
pageInfo
);
putMsg
(
result
,
Status
.
SUCCESS
);
/**
* query queue list
*
* @param loginUser
* @return
*/
public
Map
<
String
,
Object
>
queryList
(
User
loginUser
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
5
);
if
(
checkAdmin
(
loginUser
,
result
))
{
return
result
;
}
return
result
;
}
List
<
Queue
>
queueList
=
queueMapper
.
queryAllQueue
();
result
.
put
(
Constants
.
DATA_LIST
,
queueList
);
putMsg
(
result
,
Status
.
SUCCESS
);
public
Map
<
String
,
Object
>
createQueue
(
User
loginUser
,
String
queue
,
String
queueName
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
5
);
if
(
checkAdmin
(
loginUser
,
result
))
{
return
result
;
return
result
;
}
if
(
checkQueueExists
(
queue
)){
putMsg
(
result
,
Status
.
QUEUE_EXIST
,
queue
);
return
result
;
/**
* query queue list paging
*
* @param loginUser
* @param searchVal
* @param pageNo
* @param pageSize
* @return
*/
public
Map
<
String
,
Object
>
queryList
(
User
loginUser
,
String
searchVal
,
Integer
pageNo
,
Integer
pageSize
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
5
);
if
(
checkAdmin
(
loginUser
,
result
))
{
return
result
;
}
Integer
count
=
queueMapper
.
countQueuePaging
(
searchVal
);
PageInfo
<
Queue
>
pageInfo
=
new
PageInfo
<>(
pageNo
,
pageSize
);
List
<
Queue
>
queueList
=
queueMapper
.
queryQueuePaging
(
searchVal
,
pageInfo
.
getStart
(),
pageSize
);
pageInfo
.
setTotalCount
(
count
);
pageInfo
.
setLists
(
queueList
);
result
.
put
(
Constants
.
DATA_LIST
,
pageInfo
);
putMsg
(
result
,
Status
.
SUCCESS
);
return
result
;
}
Queue
queueObj
=
new
Queue
();
Date
now
=
new
Date
();
queueObj
.
setQueue
(
queue
);
queueObj
.
setQueueName
(
queueName
);
queueObj
.
setCreateTime
(
now
);
queueObj
.
setUpdateTime
(
now
);
queueMapper
.
insert
(
queueObj
);
putMsg
(
result
,
Status
.
SUCCESS
);
return
result
;
}
public
Map
<
String
,
Object
>
updateQueue
(
User
loginUser
,
int
id
,
String
queue
,
String
queueName
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
5
);
if
(
checkAdmin
(
loginUser
,
result
))
{
return
result
;
/**
* create queue
*
* @param loginUser
* @param queue
* @param queueName
* @return
*/
public
Map
<
String
,
Object
>
createQueue
(
User
loginUser
,
String
queue
,
String
queueName
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
5
);
if
(
checkAdmin
(
loginUser
,
result
))
{
return
result
;
}
if
(
checkQueueExists
(
queue
))
{
putMsg
(
result
,
Status
.
QUEUE_EXIST
,
queue
);
return
result
;
}
if
(
checkQueueExists
(
queueName
))
{
putMsg
(
result
,
Status
.
QUEUE_NAME_EXIST
,
queueName
);
return
result
;
}
Queue
queueObj
=
new
Queue
();
Date
now
=
new
Date
();
queueObj
.
setQueue
(
queue
);
queueObj
.
setQueueName
(
queueName
);
queueObj
.
setCreateTime
(
now
);
queueObj
.
setUpdateTime
(
now
);
queueMapper
.
insert
(
queueObj
);
putMsg
(
result
,
Status
.
SUCCESS
);
return
result
;
}
Queue
queueObj
=
queueMapper
.
queryById
(
id
);
if
(
queueObj
==
null
)
{
putMsg
(
result
,
Status
.
QUEUE_NOT_EXIST
,
id
);
return
result
;
/**
* update queue
*
* @param loginUser
* @param id
* @param queue
* @param queueName
* @return
*/
public
Map
<
String
,
Object
>
updateQueue
(
User
loginUser
,
int
id
,
String
queue
,
String
queueName
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
5
);
if
(
checkAdmin
(
loginUser
,
result
))
{
return
result
;
}
Queue
queueObj
=
queueMapper
.
queryById
(
id
);
if
(
queueObj
==
null
)
{
putMsg
(
result
,
Status
.
QUEUE_NOT_EXIST
,
id
);
return
result
;
}
//update queue
if
(
StringUtils
.
isNotEmpty
(
queue
))
{
if
(!
queue
.
equals
(
queueObj
.
getQueue
())
&&
checkQueueExists
(
queue
))
{
putMsg
(
result
,
Status
.
QUEUE_EXIST
,
queue
);
return
result
;
}
queueObj
.
setQueue
(
queue
);
}
if
(
StringUtils
.
isNotEmpty
(
queueName
))
{
queueObj
.
setQueueName
(
queueName
);
}
Date
now
=
new
Date
();
queueObj
.
setUpdateTime
(
now
);
queueMapper
.
update
(
queueObj
);
putMsg
(
result
,
Status
.
SUCCESS
);
return
result
;
}
//update queue
if
(
StringUtils
.
isNotEmpty
(
queue
))
{
if
(!
queue
.
equals
(
queueObj
.
getQueue
())
&&
checkQueueExists
(
queue
))
{
putMsg
(
result
,
Status
.
QUEUE_EXIST
,
queue
);
return
result
;
}
queueObj
.
setQueue
(
queue
);
/**
* check queue exists
*
* @param queue
* @return
*/
private
boolean
checkQueueExists
(
String
queue
)
{
return
queueMapper
.
queryByQueue
(
queue
)
==
null
?
false
:
true
;
}
if
(
StringUtils
.
isNotEmpty
(
queueName
))
{
queueObj
.
setQueueName
(
queueName
);
}
Date
now
=
new
Date
();
queueObj
.
setUpdateTime
(
now
);
queueMapper
.
update
(
queueObj
);
putMsg
(
result
,
Status
.
SUCCESS
);
return
result
;
}
/**
* check queue exists
*
* @param queue
* @return
*/
private
boolean
checkQueueExists
(
String
queue
)
{
return
queueMapper
.
queryByQueue
(
queue
)
==
null
?
false
:
true
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录