Browse Source

update stauts and QueueService

pull/1/MERGE
ligang 6 years ago
parent
commit
68d0c974a7
  1. 4
      escheduler-api/src/main/java/cn/escheduler/api/enums/Status.java
  2. 32
      escheduler-api/src/main/java/cn/escheduler/api/service/QueueService.java

4
escheduler-api/src/main/java/cn/escheduler/api/enums/Status.java

@ -151,10 +151,10 @@ public enum Status {
SCHEDULE_CRON_REALEASE_NEED_NOT_CHANGE(10126, "schedule release is already {0}"),
CREATE_QUEUE_ERROR(10127, "create queue error"),
QUEUE_NOT_EXIST(10128, "queue {0} not exists"),
QUEUE_EXIST(10129, "queue {0} already exists"),
QUEUE_VALUE_EXIST(10129, "queue value {0} already exists"),
QUEUE_NAME_EXIST(10130, "queue name {0} already exists"),
UPDATE_QUEUE_ERROR(10131, "update queue error"),
NEED_NOT_UPDATE_QUEUE(10132, "need not update queue"),
NEED_NOT_UPDATE_QUEUE(10132, "no content changes, no updates are required"),
VERIFY_QUEUE_ERROR(10133,"verify queue error"),

32
escheduler-api/src/main/java/cn/escheduler/api/service/QueueService.java

@ -117,13 +117,13 @@ public class QueueService extends BaseService {
return result;
}
if (checkQueueExist(queue)) {
putMsg(result, Status.QUEUE_EXIST, queue);
if (checkQueueNameExist(queueName)) {
putMsg(result, Status.QUEUE_NAME_EXIST, queueName);
return result;
}
if (checkQueueNameExist(queueName)) {
putMsg(result, Status.QUEUE_NAME_EXIST, queueName);
if (checkQueueExist(queue)) {
putMsg(result, Status.QUEUE_VALUE_EXIST, queue);
return result;
}
@ -162,24 +162,24 @@ public class QueueService extends BaseService {
return result;
}
// whether queue and queueName is changed
// whether queue value or queueName is changed
if (queue.equals(queueObj.getQueue()) && queueName.equals(queueObj.getQueueName())) {
putMsg(result, Status.NEED_NOT_UPDATE_QUEUE);
return result;
}
// check queue is exist
if (!queue.equals(queueObj.getQueue())) {
if(checkQueueExist(queue)){
putMsg(result, Status.QUEUE_EXIST, queue);
// check queue name is exist
if (!queueName.equals(queueObj.getQueueName())) {
if(checkQueueNameExist(queueName)){
putMsg(result, Status.QUEUE_NAME_EXIST, queueName);
return result;
}
}
// check queueName is exist
if (!queueName.equals(queueObj.getQueueName())) {
if(checkQueueNameExist(queueName)){
putMsg(result, Status.QUEUE_NAME_EXIST, queueName);
// check queue value is exist
if (!queue.equals(queueObj.getQueue())) {
if(checkQueueExist(queue)){
putMsg(result, Status.QUEUE_VALUE_EXIST, queue);
return result;
}
}
@ -216,13 +216,13 @@ public class QueueService extends BaseService {
return result;
}
if(checkQueueExist(queue)){
logger.error("queue {} has exist, can't create again.", queue);
putMsg(result, Status.QUEUE_EXIST, queue);
logger.error("queue value {} has exist, can't create again.", queue);
putMsg(result, Status.QUEUE_VALUE_EXIST, queue);
return result;
}
if(checkQueueNameExist(queueName)){
logger.error("queueName {} has exist, can't create again.", queueName);
logger.error("queue name {} has exist, can't create again.", queueName);
putMsg(result, Status.QUEUE_NAME_EXIST, queueName);
return result;
}

Loading…
Cancel
Save