From 33b9d2c203a9998272088ecdf43a15dd53669967 Mon Sep 17 00:00:00 2001
From: cjl <909710561@qq.com>
Date: Thu, 28 Mar 2024 15:51:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into cjl
---
screen-api/src/main/java/com/moral/api/controller/HandDeviceController.java | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 112 insertions(+), 0 deletions(-)
diff --git a/screen-api/src/main/java/com/moral/api/controller/HandDeviceController.java b/screen-api/src/main/java/com/moral/api/controller/HandDeviceController.java
new file mode 100644
index 0000000..fd03a5d
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/controller/HandDeviceController.java
@@ -0,0 +1,112 @@
+package com.moral.api.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+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 java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.moral.api.entity.Device;
+import com.moral.api.entity.HandDevice;
+import com.moral.api.pojo.query.handdevice.HandDevicePageCond;
+import com.moral.api.service.HandDeviceService;
+import com.moral.api.utils.EasyExcelUtils;
+import com.moral.api.utils.NoModelWriteData;
+import com.moral.constant.PageResult;
+import com.moral.constant.ResultMessage;
+import com.moral.util.WebUtils;
+
+/**
+ * Description //todo
+ *
+ * @author swb
+ * @ClassName HandDeviceController
+ * @date 2024.02.27 10:21
+ */
+
+@Slf4j
+@Api(tags = {"������������"})
+@RestController
+@RequestMapping("/hand")
+public class HandDeviceController {
+
+ @Autowired
+ private HandDeviceService handDeviceService;
+
+ @PostMapping("/page")
+ @ApiOperation("������")
+ public ResultMessage page(@Valid @RequestBody HandDevicePageCond handDevicePageCond){
+ Page<HandDevice> page = handDeviceService.page(handDevicePageCond);
+ PageResult<HandDevice> rsList = new PageResult<>(page);
+ rsList.setList(page.getRecords());
+ return ResultMessage.ok(rsList);
+ }
+
+ @GetMapping("/check")
+ @ApiOperation("������������������")
+ public ResultMessage select(){
+ List<Device> check = handDeviceService.check();
+ return ResultMessage.ok(check);
+ }
+
+ @GetMapping("/id")
+ @ApiOperation("������mac������������")
+ public ResultMessage query(String mac){
+ HandDevice handDevice = handDeviceService.query(mac);
+ return ResultMessage.ok(handDevice);
+ }
+
+ @PostMapping("/update")
+ @ApiOperation("������������������")
+ public ResultMessage update(@RequestBody HandDevice handDevice){
+ HandDevice handDevice1 = handDeviceService.update(handDevice);
+ return ResultMessage.ok(handDevice1);
+ }
+
+ @GetMapping("/details")
+ @ApiOperation("������")
+ public ResultMessage details(String mac,String startTime,String endTime,String type){
+ List<Map<String, Object>> details = handDeviceService.details(mac, startTime, endTime,type);
+ return ResultMessage.ok(details);
+ }
+
+ @GetMapping("/unitExel")
+ @ApiOperation("������")
+ public void exel(HttpServletResponse response, HttpServletRequest request){
+ Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
+ List<Map<String, Object>> details = handDeviceService.detailsExecl(params);
+ if (CollectionUtils.isEmpty(details)) {
+ return;
+ }
+ Map<String, Object> map = details.get(0);
+ List<String> list = new ArrayList<>();
+ for (String key : map.keySet()) {
+ list.add(key);
+ }
+ String[] s2 = new String[list.size()];
+ list.toArray(s2);
+ NoModelWriteData d = new NoModelWriteData();
+ d.setFileName("������������");
+ d.setHeadMap(s2);
+ d.setDataStrMap(s2);
+ d.setDataList(details);
+ try {
+ EasyExcelUtils easyExcelUtils = new EasyExcelUtils();
+ easyExcelUtils.noModleWrite(d, response);
+ } catch (Exception e) {
+ int i = 0;
+ }
+ }
+
+}
--
Gitblit v1.8.0