Authored by jack.xue

fix sort list

... ... @@ -97,6 +97,8 @@ public class RabbitmqService {
@RequestMapping(value = "/queue", method = RequestMethod.POST)
public BaseResponse queryQueue(@RequestBody QueryRequest request) {
DEBUG.info("Query the queues of mo {}",request.getMoId());
BaseResponse<PageResponse<QueueInfo>> baseResponse = new BaseResponse();
QueueView oneView = InterVar.queueViewMaps.get(Integer.parseInt(request.getMoId()));
... ... @@ -105,8 +107,6 @@ public class RabbitmqService {
List<QueueInfo> queuesList = oneView.getQueueView();
sortQueue(queuesList);
List<QueueInfo> selectedList = new ArrayList<>();
int start = (request.getCurrentPage() - 1) * request.getPageSize();
... ... @@ -139,16 +139,6 @@ public class RabbitmqService {
}
private void sortQueue(List<QueueInfo> queuesList) {
Collections.sort(queuesList, new Comparator<QueueInfo>() {
@Override
public int compare(QueueInfo o1, QueueInfo o2) {
return o1.getMessages() > o2.getMessages() ? -1 : 1;
}
});
}
@RequestMapping(value = "/allRabbitMq")
public BaseResponse queryAllRabbit(@RequestBody QueryRequest request) {
BaseResponse response = new BaseResponse();
... ...
... ... @@ -24,9 +24,7 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.*;
import java.util.concurrent.Callable;
/**
... ... @@ -54,9 +52,9 @@ public class QueueViewJob implements Callable {
this.rabbitAlertMapper = rabbitAlertMapper;
this.moService=imObjectInfoService;
this.moService = imObjectInfoService;
this.alarmMsgComp=alarmMsgComp;
this.alarmMsgComp = alarmMsgComp;
}
public void doTask() {
... ... @@ -76,6 +74,8 @@ public class QueueViewJob implements Callable {
try {
oneView.setQueueView(Arrays.asList(InterVar.JSONMAPPER.readValue(respJson, QueueInfo[].class)));
sortQueue(oneView.getQueueView());
oneView.setMoId(moInfo.getMoId());
//fire alarm
... ... @@ -120,7 +120,7 @@ public class QueueViewJob implements Callable {
//alert
String msg = buildAlarmMsg(queueInfo);
alarmMsgComp.doAlarm(InterVar.ALARM_QUEUE,msg);
alarmMsgComp.doAlarm(InterVar.ALARM_QUEUE, msg);
//ui alert
InterVar.overViewMaps.get(this.moId).setState(0);
... ... @@ -175,4 +175,15 @@ public class QueueViewJob implements Callable {
return builder.toString();
}
private void sortQueue(List<QueueInfo> queuesList) {
Collections.sort(queuesList, new Comparator<QueueInfo>() {
@Override
public int compare(QueueInfo o1, QueueInfo o2) {
return o1.getMessages() > o2.getMessages() ? -1 : 1;
}
});
}
}
... ...