JudgmentController.java
4.23 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
package cn.com.glsx.admin.modules.controller;
import cn.com.glsx.admin.modules.model.export.JudgmentExport;
import cn.com.glsx.admin.modules.model.param.JudgmentSearch;
import cn.com.glsx.admin.modules.service.JudgmentService;
import cn.com.glsx.admin.modules.utils.StringUtil;
import com.github.pagehelper.PageInfo;
import com.glsx.plat.core.web.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 大数据研判 controller
*
* @author yll
*/
@Slf4j
@RestController
@RequestMapping(value = "/judgment")
@Api(value = "大数据研判报表", tags = {"大数据研判报表"})
public class JudgmentController extends AbstractController {
@Autowired
private JudgmentService judgmentService;
@GetMapping("/search")
@ApiOperation(value = "查询大数据研判列表")
public R findJudgmentList(JudgmentSearch judgmentSearch) {
long t0 = System.currentTimeMillis();
boolean keywordsPresent = judgmentSearch != null && org.apache.commons.lang.StringUtils.isNotBlank(judgmentSearch.getKeywords());
log.info("judgment.search request: startTime={}, endTime={}, alarmType={}, alarmStatus={}, keywordsPresent={}",
judgmentSearch != null ? judgmentSearch.getStartTime() : null,
judgmentSearch != null ? judgmentSearch.getEndTime() : null,
judgmentSearch != null ? judgmentSearch.getAlarmType() : null,
judgmentSearch != null ? judgmentSearch.getAlarmStatus() : null,
keywordsPresent);
PageInfo pageInfo = judgmentService.findJudgmentList(judgmentSearch);
log.info("judgment.search response: totalRecords={}, costMs={}",
pageInfo != null ? pageInfo.getTotal() : 0,
(System.currentTimeMillis() - t0));
return R.ok().putPageData(pageInfo);
}
@GetMapping("/alarmVehicleList")
@ApiOperation(value = "查询警情车辆列表")
public R findAlarmVehicleList(JudgmentSearch judgmentSearch) {
long t0 = System.currentTimeMillis();
boolean keywordsPresent = judgmentSearch != null && org.apache.commons.lang.StringUtils.isNotBlank(judgmentSearch.getKeywords());
log.info("judgment.alarmVehicleList request: keywordsPresent={}",
keywordsPresent);
PageInfo pageInfo = judgmentService.findAlarmVehicleList(judgmentSearch);
log.info("judgment.alarmVehicleList response: totalRecords={}, costMs={}",
pageInfo != null ? pageInfo.getTotal() : 0,
(System.currentTimeMillis() - t0));
return R.ok().putPageData(pageInfo);
}
@GetMapping("/export")
@ApiOperation(value = "导出大数据研判报表")
public R<String> exportJudgmentList(JudgmentSearch judgmentSearch) {
long t0 = System.currentTimeMillis();
boolean keywordsPresent = judgmentSearch != null && org.apache.commons.lang.StringUtils.isNotBlank(judgmentSearch.getKeywords());
log.info("judgment.export request: startTime={}, endTime={}, alarmType={}, alarmStatus={}, keywordsPresent={}",
judgmentSearch != null ? judgmentSearch.getStartTime() : null,
judgmentSearch != null ? judgmentSearch.getEndTime() : null,
judgmentSearch != null ? judgmentSearch.getAlarmType() : null,
judgmentSearch != null ? judgmentSearch.getAlarmStatus() : null,
keywordsPresent);
String fileName = StringUtil.getFileName("大数据研判报表");
List<JudgmentExport> judgmentList = judgmentService.exportJudgmentList(judgmentSearch);
String url = super.uploadExcel(fileName, judgmentList, JudgmentExport.class);
log.info("judgment.export generated: fileName={}, rows={}, urlSize={}, costMs={}",
fileName,
judgmentList != null ? judgmentList.size() : 0,
url != null ? url.length() : 0,
(System.currentTimeMillis() - t0));
return R.ok().data(url);
}
}