From a8ec3f0c200b7e3b038c6cc9fb34d99d68775708 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Fri, 04 Nov 2022 10:08:18 +0800
Subject: [PATCH] 上传走航车日报功能
---
screen-api/src/main/java/com/moral/api/controller/CruiserController.java | 67 +++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 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 cda4705..55caf5b 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
@@ -9,14 +9,20 @@
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.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
+import com.moral.api.pojo.bo.ExcelBO;
+import com.moral.api.pojo.vo.excel.DailyVo;
import com.moral.api.service.SpecialDeviceService;
import com.moral.constant.ResponseCodeEnum;
import com.moral.constant.ResultMessage;
@@ -80,4 +86,65 @@
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);
+ }
+
+
}
--
Gitblit v1.8.0