Authored by jack.xue

fix sort list

@@ -97,6 +97,8 @@ public class RabbitmqService { @@ -97,6 +97,8 @@ public class RabbitmqService {
97 @RequestMapping(value = "/queue", method = RequestMethod.POST) 97 @RequestMapping(value = "/queue", method = RequestMethod.POST)
98 public BaseResponse queryQueue(@RequestBody QueryRequest request) { 98 public BaseResponse queryQueue(@RequestBody QueryRequest request) {
99 99
  100 + DEBUG.info("Query the queues of mo {}",request.getMoId());
  101 +
100 BaseResponse<PageResponse<QueueInfo>> baseResponse = new BaseResponse(); 102 BaseResponse<PageResponse<QueueInfo>> baseResponse = new BaseResponse();
101 103
102 QueueView oneView = InterVar.queueViewMaps.get(Integer.parseInt(request.getMoId())); 104 QueueView oneView = InterVar.queueViewMaps.get(Integer.parseInt(request.getMoId()));
@@ -105,8 +107,6 @@ public class RabbitmqService { @@ -105,8 +107,6 @@ public class RabbitmqService {
105 107
106 List<QueueInfo> queuesList = oneView.getQueueView(); 108 List<QueueInfo> queuesList = oneView.getQueueView();
107 109
108 - sortQueue(queuesList);  
109 -  
110 List<QueueInfo> selectedList = new ArrayList<>(); 110 List<QueueInfo> selectedList = new ArrayList<>();
111 111
112 int start = (request.getCurrentPage() - 1) * request.getPageSize(); 112 int start = (request.getCurrentPage() - 1) * request.getPageSize();
@@ -139,16 +139,6 @@ public class RabbitmqService { @@ -139,16 +139,6 @@ public class RabbitmqService {
139 } 139 }
140 140
141 141
142 - private void sortQueue(List<QueueInfo> queuesList) {  
143 - Collections.sort(queuesList, new Comparator<QueueInfo>() {  
144 - @Override  
145 - public int compare(QueueInfo o1, QueueInfo o2) {  
146 -  
147 - return o1.getMessages() > o2.getMessages() ? -1 : 1;  
148 - }  
149 - });  
150 - }  
151 -  
152 @RequestMapping(value = "/allRabbitMq") 142 @RequestMapping(value = "/allRabbitMq")
153 public BaseResponse queryAllRabbit(@RequestBody QueryRequest request) { 143 public BaseResponse queryAllRabbit(@RequestBody QueryRequest request) {
154 BaseResponse response = new BaseResponse(); 144 BaseResponse response = new BaseResponse();
@@ -24,9 +24,7 @@ import org.springframework.web.client.RestTemplate; @@ -24,9 +24,7 @@ import org.springframework.web.client.RestTemplate;
24 import javax.annotation.Resource; 24 import javax.annotation.Resource;
25 import java.io.IOException; 25 import java.io.IOException;
26 import java.text.MessageFormat; 26 import java.text.MessageFormat;
27 -import java.util.Arrays;  
28 -import java.util.HashMap;  
29 -import java.util.List; 27 +import java.util.*;
30 import java.util.concurrent.Callable; 28 import java.util.concurrent.Callable;
31 29
32 /** 30 /**
@@ -54,9 +52,9 @@ public class QueueViewJob implements Callable { @@ -54,9 +52,9 @@ public class QueueViewJob implements Callable {
54 52
55 this.rabbitAlertMapper = rabbitAlertMapper; 53 this.rabbitAlertMapper = rabbitAlertMapper;
56 54
57 - this.moService=imObjectInfoService; 55 + this.moService = imObjectInfoService;
58 56
59 - this.alarmMsgComp=alarmMsgComp; 57 + this.alarmMsgComp = alarmMsgComp;
60 } 58 }
61 59
62 public void doTask() { 60 public void doTask() {
@@ -76,6 +74,8 @@ public class QueueViewJob implements Callable { @@ -76,6 +74,8 @@ public class QueueViewJob implements Callable {
76 try { 74 try {
77 oneView.setQueueView(Arrays.asList(InterVar.JSONMAPPER.readValue(respJson, QueueInfo[].class))); 75 oneView.setQueueView(Arrays.asList(InterVar.JSONMAPPER.readValue(respJson, QueueInfo[].class)));
78 76
  77 + sortQueue(oneView.getQueueView());
  78 +
79 oneView.setMoId(moInfo.getMoId()); 79 oneView.setMoId(moInfo.getMoId());
80 80
81 //fire alarm 81 //fire alarm
@@ -120,7 +120,7 @@ public class QueueViewJob implements Callable { @@ -120,7 +120,7 @@ public class QueueViewJob implements Callable {
120 //alert 120 //alert
121 String msg = buildAlarmMsg(queueInfo); 121 String msg = buildAlarmMsg(queueInfo);
122 122
123 - alarmMsgComp.doAlarm(InterVar.ALARM_QUEUE,msg); 123 + alarmMsgComp.doAlarm(InterVar.ALARM_QUEUE, msg);
124 124
125 //ui alert 125 //ui alert
126 InterVar.overViewMaps.get(this.moId).setState(0); 126 InterVar.overViewMaps.get(this.moId).setState(0);
@@ -175,4 +175,15 @@ public class QueueViewJob implements Callable { @@ -175,4 +175,15 @@ public class QueueViewJob implements Callable {
175 175
176 return builder.toString(); 176 return builder.toString();
177 } 177 }
  178 +
  179 +
  180 + private void sortQueue(List<QueueInfo> queuesList) {
  181 + Collections.sort(queuesList, new Comparator<QueueInfo>() {
  182 + @Override
  183 + public int compare(QueueInfo o1, QueueInfo o2) {
  184 +
  185 + return o1.getMessages() > o2.getMessages() ? -1 : 1;
  186 + }
  187 + });
  188 + }
178 } 189 }