|
@@ -0,0 +1,93 @@
|
|
|
|
+package com.iden.bms.controller;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+import com.iden.bms.service.TraceService;
|
|
|
|
+import com.iden.common.annotation.Permission;
|
|
|
|
+import com.iden.common.exception.BDException;
|
|
|
|
+
|
|
|
|
+import com.iden.common.util.Result;
|
|
|
|
+import com.iden.common.util.WebPageUtils;
|
|
|
|
+import com.iden.common.vo.TraceVO;
|
|
|
|
+import com.iden.common.vo.UserLogindConvertVO;
|
|
|
|
+import io.swagger.annotations.*;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
+
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @Author: lilt
|
|
|
|
+ * @Date: 2021/5/26
|
|
|
|
+ * @Desc:
|
|
|
|
+ */
|
|
|
|
+@RestController
|
|
|
|
+@Api(value = "TraceController", tags = { "轨迹管理" })
|
|
|
|
+@Slf4j
|
|
|
|
+@RequestMapping("/bms/trace")
|
|
|
|
+@Permission
|
|
|
|
+public class TraceController {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private TraceService traceService;
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "图像上传")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "token", value = "放在请求头中的令牌",
|
|
|
|
+ dataType = "String", paramType = "header",
|
|
|
|
+ required = true)
|
|
|
|
+ })
|
|
|
|
+ @CrossOrigin
|
|
|
|
+ @PostMapping(value = "/uploadImage", headers="content-type=multipart/form-data",produces = "application/json;charset=UTF-8")
|
|
|
|
+ public Result<String> uploadImage( @ApiParam(value="图像",required=true) MultipartFile file,
|
|
|
|
+ @RequestHeader(name = "token") String token) {
|
|
|
|
+ try {
|
|
|
|
+ String imageCode = traceService.uploadImage(file);
|
|
|
|
+ return Result.success("上传成功!",imageCode);
|
|
|
|
+ } catch (BDException e) {
|
|
|
|
+ log.error("图像上传出现异常",e);
|
|
|
|
+ return Result.error(e.getMessage());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("轨迹管理: 图像上传出现异常",e);
|
|
|
|
+ return Result.error("图像上传失败!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @GetMapping("/listTrace")
|
|
|
|
+ @ApiOperation(value = "目标轨迹列表,地图打点划线 ")
|
|
|
|
+ @ApiImplicitParams(value = {
|
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "imageCodes", value = "图像编码,多个用逗号分割"),
|
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "beginTime", value = "开始时间(yyyy-MM-dd HH:mm:ss)"),
|
|
|
|
+ @ApiImplicitParam(paramType = "query", name = "endTime", value = "结束时间(yyyy-MM-dd HH:mm:ss)")
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ public Result<List<TraceVO>> listTrace(HttpServletRequest request, @RequestHeader(value = "token") String token,
|
|
|
|
+ @RequestParam(value = "imageCodes", required = true) String imageCodes,
|
|
|
|
+ @RequestParam(value = "beginTime", required = false) String beginTime,
|
|
|
|
+ @RequestParam(value = "endTime", required = false) String endTime){
|
|
|
|
+ try {
|
|
|
|
+ UserLogindConvertVO loginUser = WebPageUtils.getCurrentLoginedUser(request);
|
|
|
|
+ List<TraceVO> datas = this.traceService.listTrace(imageCodes,beginTime,endTime,loginUser);
|
|
|
|
+ return Result.success(datas);
|
|
|
|
+ }catch (Exception e) {
|
|
|
|
+ log.error("轨迹管理: 目标轨迹列表查询出现异常",e);
|
|
|
|
+ return Result.error( "获取列表失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// @GetMapping("/cameraPlay/{id}")
|
|
|
|
+// @ApiOperation(value = "摄像机播放")
|
|
|
|
+// public Result<TraceVO> cameraPlay(HttpServletRequest request, @RequestHeader("token") String token, @PathVariable("id") Long id){
|
|
|
|
+// TraceVO orderInfo = this.traceService.getTraceById(id);
|
|
|
|
+// return Result.success("查询成功!",orderInfo);
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|