From 49fbef2d678894fd6af78db73c2899491a9232e6 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Fri, 14 Jul 2023 17:11:59 +0800
Subject: [PATCH] feat:无人机走航(feature)

---
 screen-api/src/main/java/com/moral/api/controller/CruiserController.java |  198 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 194 insertions(+), 4 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 ee0ddcd..4e852a2 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,22 +1,34 @@
 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;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
 
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
+import com.moral.api.entity.Dustld;
+import com.moral.api.pojo.bo.ExcelBO;
+import com.moral.api.pojo.vo.excel.DailyVo;
+import com.moral.api.service.DustldService;
 import com.moral.api.service.SpecialDeviceService;
 import com.moral.constant.ResponseCodeEnum;
 import com.moral.constant.ResultMessage;
@@ -38,7 +50,25 @@
     @GetMapping("selectCruisers")
     @ApiOperation(value = "������������������������������������������", notes = "���������������")
     public ResultMessage getCarsInfo() {
-        List<Map<String, Object>> response = specialDeviceService.getCarsInfo();
+        List<Map<String, Object>> response = specialDeviceService.selectCruisers();
+        return ResultMessage.ok(response);
+    }
+
+    /**
+     * @param mac ������mac
+     * @return ������������������������������������
+     */
+    @GetMapping("getDates")
+    @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")
+    })
+    public ResultMessage getDates(String mac) {
+        if (ObjectUtils.isEmpty(mac)) {
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+        }
+        List<String> response = specialDeviceService.getDatesByMac(mac);
         return ResultMessage.ok(response);
     }
 
@@ -51,15 +81,175 @@
     @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 = "time", value = "���������2021-08-18", 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")
     })
     public ResultMessage carTrajectory(HttpServletRequest request) {
         Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
-        if (!params.containsKey("mac") || !params.containsKey("time")) {
+        if (!params.containsKey("mac") || !params.containsKey("time1")|| !params.containsKey("time2")) {
             return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
         }
-        List<Map<String, Object>> response = specialDeviceService.carTrajectory(params);
+        List<Map<String, Object>> response = specialDeviceService.carTrajectory(params,true);
         return ObjectUtils.isEmpty(response) ? ResultMessage.ok() : ResultMessage.ok(response);
     }
+    @GetMapping("carTrajectoryNewAvg")
+    @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 = "������������", required = true, paramType = "query", dataType = "String"),
+            @ApiImplicitParam(name = "range", value = "������", required = true, paramType = "query", dataType = "int")
+    })
+    public ResultMessage carTrajectoryNewAvg(HttpServletRequest request) {
+        Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
+        if (!params.containsKey("mac") || !params.containsKey("time1")||!params.containsKey("range")|| !params.containsKey("type")|| !params.containsKey("time2")) {
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+        }
+        List<HistorySecondCruiserResultDTO> response = specialDeviceService.carTrajectoryNewAvg(params);
+
+        //������������������
+
+        return ObjectUtils.isEmpty(response) ? ResultMessage.ok() : ResultMessage.ok(response);
+
+    }
+
+    /**
+     * ���������������
+     * @param request
+     * @return
+     */
+    @PostMapping("getDaily")
+    @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")
+    })
+    public  ResultMessage getDaily(HttpServletRequest request) throws ParseException {
+        Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
+        if (!params.containsKey("mac") || !params.containsKey("time1")|| !params.containsKey("time2")) {
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+        }
+        List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("files");
+        ExcelBO daily = specialDeviceService.getDaily(params, files);
+        if (daily==null){
+            return ResultMessage.fail(ResponseCodeEnum.TARGET_IS_NULL.getCode(), ResponseCodeEnum.TARGET_IS_NULL.getMsg());
+        }
+        return ObjectUtils.isEmpty(daily) ? ResultMessage.ok() : ResultMessage.ok(daily);
+    }
+
+    /**
+     * ���������������������
+     * @param id
+     * @return
+     */
+    @GetMapping("loadDaily")
+    public ResultMessage loadDaily(Integer id){
+
+        DailyVo dailyVo = specialDeviceService.loadDaily(id);
+        if (dailyVo==null){
+            return ResultMessage.fail(ResponseCodeEnum.TARGET_IS_NULL.getCode(), ResponseCodeEnum.TARGET_IS_NULL.getMsg());
+        }
+        return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),dailyVo);
+    }
+
+    /**
+     * ������������
+     * @param request
+     * @return
+     */
+    @GetMapping("selectDaily")
+    public ResultMessage selectDaily(HttpServletRequest request){
+        Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
+        if ( !params.containsKey("startTime")|| !params.containsKey("endTime")) {
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+        }
+        List<ExcelBO> excelBOS = specialDeviceService.selectDaily(params);
+        if (excelBOS==null){
+            return ResultMessage.fail(ResponseCodeEnum.TARGET_IS_NULL.getCode(), ResponseCodeEnum.TARGET_IS_NULL.getMsg());
+        }
+        return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),excelBOS);
+    }
+
+    @Autowired
+    private DustldService dustldService;
+
+    /**
+     * ���������������
+     * @param request
+     * @return
+     */
+    @PostMapping("getDailyDustld")
+    public  ResultMessage getDailyDustld(HttpServletRequest request) {
+        Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
+        if (!params.containsKey("mac") || !params.containsKey("road") || !params.containsKey("table")){
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+        }
+        MultipartFile file = ((MultipartHttpServletRequest) request).getFile("files");
+
+        Integer dailyDustld = null;
+        try {
+            dailyDustld = dustldService.getDailyDustld(params,file);
+        } catch (ParseException e) {
+            log.error("{������}"+e.getMessage());
+        }
+        if (ObjectUtils.isEmpty(dailyDustld)){
+            return ResultMessage.fail(ResponseCodeEnum.TARGET_IS_NULL.getCode(), ResponseCodeEnum.TARGET_IS_NULL.getMsg());
+        }
+        return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(),ResponseCodeEnum.SUCCESS.getMsg(),dailyDustld);
+    }
+
+    /**
+     * ���������������������
+     * @return
+     */
+    @PostMapping("dailyDustld")
+    public ResultMessage  dailyDustld(HttpServletRequest request,Integer id){
+        List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("files");
+
+        Map<String, Object> map = dustldService.dailyDustld(id,files);
+        if (ObjectUtils.isEmpty(map)){
+            return ResultMessage.fail(ResponseCodeEnum.TARGET_IS_NULL.getCode(), ResponseCodeEnum.TARGET_IS_NULL.getMsg());
+        }
+        return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(),ResponseCodeEnum.SUCCESS.getMsg(),map);
+    }
+
+    /**
+     * ������������������
+     * @param id
+     * @return
+     */
+    @GetMapping("selectDust")
+    public  ResultMessage selectDust(Integer id){
+        Map<String, Object> map = null;
+        try {
+            map = dustldService.selectDust(id);
+        } catch (Exception e) {
+            log.error("{������}"+e.getMessage());
+        }
+        return  new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(),ResponseCodeEnum.SUCCESS.getMsg(),map);
+    }
+
+    /**
+     * ���������������������������������
+     * @param request
+     * @return
+     */
+    @GetMapping("selectAll")
+    public  ResultMessage selectAll(HttpServletRequest request){
+        Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
+        List<Dustld> dustlds = null;
+        try {
+            dustlds = dustldService.selectAll(params);
+        } catch (Exception e) {
+           log.error("{������}"+e.getMessage());
+        }
+        return  new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(),ResponseCodeEnum.SUCCESS.getMsg(),dustlds);
+
+    }
+
 
 }

--
Gitblit v1.8.0