From f13e7797473d706cc6eba0958a8c7e25607cb366 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Fri, 08 Sep 2023 14:06:55 +0800
Subject: [PATCH] chore:测试提交
---
screen-api/src/main/java/com/moral/api/controller/CruiserController.java | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 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 40b248a..920bf4b 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
@@ -20,6 +20,7 @@
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@@ -242,17 +243,20 @@
* @return
*/
@PostMapping("dailyDustlds")
- public ResultMessage dailyDustlds(HttpServletRequest request) throws IOException {
-// List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("files");
- Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
+ public ResultMessage dailyDustlds(@RequestBody Map<String,Object> params, HttpServletResponse response) throws IOException {
+// Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
+ if (!params.containsKey("mac") || !params.containsKey("startTime") || !params.containsKey("endTime")){
+ return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+ }
Map<String, Object> map = dustldService.dailyDustlds(null,params);
- test(map);
+ test(map,response);
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);
+// return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(),ResponseCodeEnum.SUCCESS.getMsg(),map);
+ return ResultMessage.ok();
}
@@ -315,7 +319,7 @@
}
- public void test( Map<String, Object> params) throws IOException {
+ public void test( Map<String, Object> params,HttpServletResponse response) throws IOException {
// String path="D:\\���������������������.docx";
String path = getPath("���������������������.docx");
//���������������������������
@@ -351,10 +355,17 @@
map.put("data",params.get("data").toString());
map.put("time",params.get("time").toString());
+
compile.render(map);
-// compile.write(new FileOutptStream("���������������������"+paramsu.get("time").toString()+".docx"));
+// response.setCharacterEncoding("utf-8");
+// response.setContentType("multipart/form-data");
+// response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("���������������������" + params.get("time").toString() + ".docx", "utf-8"));
+// FileOutputStream fileOutputStream = new FileOutputStream("���������������������" + params.get("time").toString() + ".docx");
+// compile.write(fileOutputStream);
compile.writeToFile("G:\\home\\mon1\\" + "���������������������"+params.get("time").toString()+".docx");
+// compile.write();
compile.close();
+// return compile;
}
--
Gitblit v1.8.0