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
package common.controller;
import common.model.AppInfo;
import common.service.AppService;
import dic.OperateObjectTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import util.ResultModel;
import util.StringUtil;
import util.UserLogThread;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
/**
* Created by zxy on 2017/12/27.
*/
@Controller
@RequestMapping("applist")
public class AppController
{
@Autowired AppService appService;
///api/applist/find?reyun=&location=%E5%8C%97%E4%BA%AC&firstCate=&secondCate=&pageNum=0&pageSize=20&sortString=pkgName&isASC=1
@RequestMapping(value = "find", method = RequestMethod.GET)
@ResponseBody
public ResultModel findAll(@RequestParam Integer reyun, @RequestParam String location, @RequestParam String firstCate, @RequestParam String secondCate,
@RequestParam int pageNum, @RequestParam int pageSize, @RequestParam String sortString, @RequestParam Integer isASC, @RequestParam String searchString,
@RequestParam String startDate, @RequestParam String endDate) {
AppInfo app = new AppInfo();
app.setLocation(location);
app.setFirstCate(firstCate);
app.setSecondCate(secondCate);
app.setReyun(reyun);
Map result = new HashMap();
try {
result = appService.findAppList(app, pageNum, pageSize, sortString, isASC, searchString, startDate, endDate);
}
catch (ExecutionException e) {
e.printStackTrace();
}
catch (InterruptedException e) {
e.printStackTrace();
}
return ResultModel.OK(result);
}
///api/applist/category/1
@RequestMapping(value="category/{level}", method = RequestMethod.GET)
@ResponseBody
public ResultModel findCategory(@PathVariable int level) {
return ResultModel.OK(appService.findAllCategoryByLevel(level));
}
///api/applist/city
@RequestMapping(value = "city", method = RequestMethod.GET)
@ResponseBody
public ResultModel findCity() {
return ResultModel.OK(appService.findCity());
}
@RequestMapping(value = "data", method = RequestMethod.GET)
@ResponseBody
public ResultModel findDeviceData() {
return ResultModel.OK(appService.findAppDataList("2017-12-22", "2017-12-22", null, 0, 0, 20));
}
}