SearchCompareCtrl.java
2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package com.ui.ctrl;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
/**
* 对双云的搜索结果进行比较controller
* @author gemingdan
*
*/
@Controller
@RequestMapping("/searchCompare")
public class SearchCompareCtrl {
Logger log = LoggerFactory.getLogger(SearchCompareCtrl.class);
@Autowired
HttpRestClient httpRestClient;
@Value("${monitor.service.url}")
String MONITOR_SERVICE_URL;
/**
* 获取页面
* @return
*/
@RequestMapping("/getComparePage")
public ModelAndView getComparePage(){
ModelAndView mav = new ModelAndView();
mav.setViewName("searchCompare/list");
return mav;
}
@RequestMapping("/toStop")
@ResponseBody
public BaseResponse toStop(){
BaseResponse response = httpRestClient.get(MONITOR_SERVICE_URL+"/searchcompare/toStop", BaseResponse.class,null);
return response;
}
/**
* 获取比较结果
* @return
*/
@RequestMapping("/getlist")
@ResponseBody
public BaseResponse getlist(Integer currentPage){
//currentPage
Map<String,Object> param=new HashMap<String,Object>();
if(currentPage==null){
currentPage=1;
}
param.put("currentPage", currentPage);
BaseResponse awsResponse = httpRestClient.get(MONITOR_SERVICE_URL+"/searchcompare/getlist", BaseResponse.class,param);
Map<String,Object> data=(Map<String,Object>)awsResponse.getData();
Map<String,Object> pageList=(Map<String,Object>)data.get("pageList");
pageList.put("lastUpdateLine", data.get("lastUpdateLine"));
pageList.put("lastUpdateTime", data.get("lastUpdateTime"));
pageList.put("comparing", data.get("comparing"));
pageList.put("stopping", data.get("stopping"));
awsResponse.setData(pageList);
return awsResponse;
}
/**
* 刷新比较结果
* @return
*/
@RequestMapping("/refresh")
@ResponseBody
public BaseResponse refresh(Integer num){
Map<String,Object> param=new HashMap<String,Object>();
param.put("num", num);
BaseResponse awsResponse = httpRestClient.get(MONITOR_SERVICE_URL+"/searchcompare/refresh", BaseResponse.class,param);
return awsResponse;
}
}