From 44cbfba860be1674d876a885d1b8b6cb24cc26e3 Mon Sep 17 00:00:00 2001 From: kaiyu <404897439@qq.com> Date: Tue, 20 Oct 2020 11:54:58 +0800 Subject: [PATCH] 增加时间字段获取 --- src/main/java/com/moral/controller/ScreenController.java | 36 +++++++++++++++++++++++++++++++++++- 1 files changed, 35 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java index ccdef87..40c2ba1 100644 --- a/src/main/java/com/moral/controller/ScreenController.java +++ b/src/main/java/com/moral/controller/ScreenController.java @@ -39,12 +39,14 @@ import com.rabbitmq.client.*; import com.rabbitmq.client.Channel; + import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import jdk.nashorn.internal.runtime.regexp.joni.Regex; import net.sf.json.JSONString; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.net.ftp.FTPClient; @@ -69,6 +71,7 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import org.xml.sax.InputSource; + import static com.moral.common.util.ResourceUtil.getValue; import static com.moral.common.util.WebUtils.getParametersStartingWith; import static java.util.Calendar.*; @@ -164,6 +167,7 @@ @Resource private ScreenVersionService screenVersionService; + /** * Screen login. ������������ * @@ -2257,10 +2261,40 @@ return new ResultBean<List<Map<String, Object>>>(list); } + /* + * ��������������������������������������������� + */ @GetMapping("screenVersion") - public Map<String, Object> getScreenVersion(HttpServletRequest request) { + public Map<String, Object> getScreenVersion(HttpServletRequest request) { Map<String, Object> parameters = getParametersStartingWith(request, null); String version = parameters.get("version").toString(); return screenVersionService.getScreenVersion(version); } + + @GetMapping("devices-sensors-excel") + @ApiOperation(value = "���������������������������������", notes = "���������������������������������") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "monitor_point_id", defaultValue = "5", value = "������������id", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "sensorKey", value = "���������key,������������������", required = true, paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "time", value = "������(���������2020-04-09)", required = true, paramType = "query", dataType = "String")}) + public ResultBean<List<Map<String, Object>>> getDevicesToExcel(HttpServletRequest request) throws Exception { + Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null); + ParameterUtils.getTimeType4Time(parameters); + /*String[] sensorKeys = parameters.get("sensorKey").toString().split(","); + parameters.put("sensorKeys", Arrays.asList(sensorKeys)); + List<String> macList = new ArrayList<>(); + List<MonitorPoint> monitorPoints = monitorPointService.getMonitorPointsAndDevicesByRegion(parameters); + for (MonitorPoint m : monitorPoints) { + for (Device d : m.getDevices()) { + macList.add(d.getMac()); + } + } + parameters.put("macs", macList); + List<Map<String, Object>> list = new ArrayList<>(); + if (!CollectionUtils.isEmpty(macList)) { + list = historyMinutelyService.getDevicesAvgDataToExcel(parameters); + }*/ + List<Map<String, Object>> list = historyMinutelyService.getDevicesSensorsToExcel(parameters); + return new ResultBean<List<Map<String, Object>>>(list); + } } -- Gitblit v1.8.0