DeployController.java
8.87 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
package com.objecteye.controller;
import com.alibaba.fastjson.JSONObject;
import com.objecteye.common.CommonResult;
import com.objecteye.entity.MonitorMainTableQueryInfo;
import com.objecteye.entity.PageResult;
import com.objecteye.entity.SyDeploy;
import com.objecteye.service.DeployService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* controller
*
* @author Administrator
*/
@RestController
@Api(tags = "DeployController", description = "布控管理")
@RequestMapping("/deploy")
@CrossOrigin
public class DeployController {
@Autowired
private DeployService deployService;
/**
* 布控任务- 主列表查询
*
* @return
*/
@ApiOperation("布控任务- 主列表查询")
@RequestMapping(value = "/monitorMainTableByPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult monitorMainTableByPage(@RequestBody MonitorMainTableQueryInfo info) {
PageResult pageResult = deployService.monitorMainTableByPage(info);
if (pageResult.getRow() == null || pageResult.getRow().size() == 0) {
return CommonResult.success(201, "无符合条件的数据", new PageResult<>());
}
return CommonResult.success(pageResult);
}
/**
* 返回全部列表
*
* @return
*/
@ApiOperation("查看全部的布控任务")
@RequestMapping(value = "/findAll", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult findAll() {
List<SyDeploy> all = deployService.findAll();
if (all == null) {
return CommonResult.success(201, "暂无布控任务", new ArrayList<>());
}
return CommonResult.success(all);
}
/**
* 查看布控任务详细信息
*
* @return
*/
@ApiOperation("查看布控任务详细信息")
@RequestMapping(value = "/findOne", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult findOne(@RequestBody Map<String, Integer> param) {
SyDeploy syDeploy = deployService.findOne(param.get("id"));
if (syDeploy == null) {
return CommonResult.success(201, "没有找到对应任务", new ArrayList<>());
}
return CommonResult.success(syDeploy);
}
/**
* 分页返回列表
*
* @return
*/
@ApiOperation("分页查看全部的布控任务")
@RequestMapping(value = "/findPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult findPage(@RequestParam Integer currentpage, @RequestParam Integer pagevolume, @RequestParam Integer deployType) {
SyDeploy syDeploy = new SyDeploy();
syDeploy.setDeployType(deployType);
PageResult page = deployService.findPage(syDeploy, currentpage, pagevolume);
if (page == null) {
return CommonResult.success(201, "无符合条件的数据", new PageResult<>());
}
return CommonResult.success(page);
}
/**
* 分页查看全部的布控任务内容
*
* @param pagevolume 页面容量
* @param currentpage 页码
* @param deployId 任务id
* @return 结果集
*/
@ApiOperation("分页查看全部的布控任务内容")
@RequestMapping(value = "/findMonitorTaskDetail", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult findMonitorTaskDetail(@RequestParam Integer currentpage, @RequestParam Integer pagevolume, @RequestParam Integer deployId) {
PageResult page = deployService.findMonitorTaskDetail(deployId, currentpage, pagevolume);
if (page.getRow().size() == 0) {
return CommonResult.success(201, "无符合条件的数据", new PageResult<>());
}
return CommonResult.success(page);
}
/**
* 增加
*
* @param deploy
* @return
*/
@ApiOperation("添加布控任务")
@RequestMapping(value = "/addDeployTask", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult addDeployTask(@RequestBody SyDeploy deploy) {
try {
deployService.add(deploy);
return CommonResult.success("操作成功");
} catch (Exception e) {
e.printStackTrace();
return CommonResult.failed();
}
}
/**
* 修改
*
* @param deploy
* @return
*/
@ApiOperation("修改布控任务")
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult update(@RequestBody SyDeploy deploy) {
try {
deployService.update(deploy);
return CommonResult.success("操作成功");
} catch (Exception e) {
e.printStackTrace();
return CommonResult.failed();
}
}
/**
* 批量删除
*
* @param map
* @return
*/
@ApiOperation("删除布控任务")
@RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult delete(@RequestBody Map<String, int[]> map) {
try {
int[] ids = map.get("ids");
deployService.delete(ids);
return CommonResult.success("操作成功");
} catch (Exception e) {
e.printStackTrace();
return CommonResult.failed();
}
}
/**
* 撤销- 布控任务撤销
*
* @param map 请求参数
* @return 操作状态
*/
@ApiOperation("撤销- 布控任务撤销")
@RequestMapping(value = "/changeTaskStatus", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult changeTaskStatus(@RequestBody Map<String, Integer> map) {
try {
Integer status = deployService.cancelOrReNewDeployTask(map.get("deployId"));
return CommonResult.success(status);
} catch (Exception e) {
e.printStackTrace();
return CommonResult.success(201, "布控时间已过期, 请更新布控时间后再操作", null);
}
}
/**
* 撤销- 车牌布控
*
* @param map 请求参数
* @return 操作状态
*/
@ApiOperation("撤销- 车牌布控")
@RequestMapping(value = "/changeStatusPlateNum", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult changeStatusPlateNum(@RequestBody Map<String, String> map) {
try {
Integer status = deployService.cancelOrReNewTaskByPlate(Integer.parseInt(map.get("deployId")), map.get("plateNumber"));
return CommonResult.success(status);
} catch (Exception e) {
e.printStackTrace();
return CommonResult.failed();
}
}
/**
* 撤销- 车辆布控
*
* @param map 请求参数
* @return 操作状态
*/
@ApiOperation("撤销- 车辆布控")
@RequestMapping(value = "/changeStatusVehicle", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult changeStatusVehicle(@RequestBody Map<String, String> map) {
try {
Integer status = deployService.cancelOrReNewTaskByVehicleId(Integer.parseInt(map.get("deployId")),
Integer.parseInt(map.get("featureId")), map.get("id"));
return CommonResult.success(status);
} catch (Exception e) {
e.printStackTrace();
return CommonResult.failed();
}
}
/**
* 撤销- 人像布控
*
* @param map 请求参数
* @return 操作状态
*/
@ApiOperation("撤销- 人像布控")
@RequestMapping(value = "/changeStatusPerson", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult changeStatusPerson(@RequestBody Map<String, String> map) {
try {
Integer status = deployService.cancelOrReNewTaskByPersonId(Integer.parseInt(map.get("deployId")),
Integer.parseInt(map.get("featureId")), Integer.parseInt(map.get("id")));
return CommonResult.success(status);
} catch (Exception e) {
e.printStackTrace();
return CommonResult.failed();
}
}
/**
* 获取底库的相关信息
*
* @param map 请求参数
* @return 操作状态
*/
@ApiOperation("获取底库的相关信息")
@RequestMapping(value = "/getLibMsgById", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JSONObject getLibMsgById(@RequestBody Map<String, String> map) {
return deployService.getLibMsgById(map.get("id"));
}
}