From 123181df72f846957a5b05cf45b323f8762fe9b8 Mon Sep 17 00:00:00 2001
From: chen_xi <276999030@qq.com>
Date: Thu, 29 Jun 2023 13:31:41 +0800
Subject: [PATCH] 走航车添加百日均值接口
---
screen-api/src/main/java/com/moral/api/controller/CruiserController.java | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/screen-api/src/main/java/com/moral/api/controller/CruiserController.java b/screen-api/src/main/java/com/moral/api/controller/CruiserController.java
index 2001f2b..f909ef0 100644
--- a/screen-api/src/main/java/com/moral/api/controller/CruiserController.java
+++ b/screen-api/src/main/java/com/moral/api/controller/CruiserController.java
@@ -1,11 +1,13 @@
package com.moral.api.controller;
+import com.moral.api.pojo.dto.historySecondCruiser.HistorySecondCruiserResultDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
@@ -16,6 +18,7 @@
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.text.ParseException;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -89,21 +92,36 @@
return ObjectUtils.isEmpty(response) ? ResultMessage.ok() : ResultMessage.ok(response);
}
@GetMapping("carTrajectoryNewAvg")
- @ApiOperation(value = "���������������������", notes = "���������������������")
+ @ApiOperation(value = "���������������", notes = "���������������")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"),
@ApiImplicitParam(name = "mac", value = "������mac", required = true, paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "time1", value = "���������2021-08-18", required = true, paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "time2", value = "���������2021-08-18", required = true, paramType = "query", dataType = "String"),
- @ApiImplicitParam(name = "type", value = "type", required = true, paramType = "query", dataType = "String")
+ @ApiImplicitParam(name = "type", value = "������������", required = true, paramType = "query", dataType = "String")
})
public ResultMessage carTrajectoryNewAvg(HttpServletRequest request) {
+ long stime = System.currentTimeMillis();
Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
- if (!params.containsKey("mac") || !params.containsKey("time1")|| !params.containsKey("time2")|| !params.containsKey("type")) {
+ if (!params.containsKey("mac") || !params.containsKey("time1")|| !params.containsKey("type")|| !params.containsKey("time2")) {
return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
}
- List<Map<String, Object>> response = specialDeviceService.carTrajectory(params,false);
- return ObjectUtils.isEmpty(response) ? ResultMessage.ok() : ResultMessage.ok(response);
+ List<HistorySecondCruiserResultDTO> response = specialDeviceService.carTrajectoryNewAvg(params);
+ if(CollectionUtils.isEmpty(response)){
+ return ObjectUtils.isEmpty(response) ? ResultMessage.ok() : ResultMessage.ok(response);
+ }
+ long etime = System.currentTimeMillis();
+ Map<Integer,HistorySecondCruiserResultDTO> map = new HashMap<>();
+
+ for(int i = 0 ;i<response.size();i++){
+ map.put(i,response.get(i));
+ }
+ //������������������
+ System.out.printf("���������������%d ������.", (etime - stime));
+ return ResultMessage.ok(map);
+
+
+
}
/**
--
Gitblit v1.8.0