From dc7924a24a630ef9b0ca7cfeaf1249e52736cc4f Mon Sep 17 00:00:00 2001 From: jpy <812110275@qq.com> Date: Sat, 27 May 2023 16:45:58 +0800 Subject: [PATCH] test --- screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java | 87 +++++++++++++++++++++++++++++++++++++++---- 1 files changed, 78 insertions(+), 9 deletions(-) diff --git a/screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java b/screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java index ce0faaa..2b59ee7 100644 --- a/screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java +++ b/screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java @@ -3,20 +3,29 @@ import com.moral.api.entity.MonitorPoint; import com.moral.api.pojo.form.device.MonitorPointQueryForm; import com.moral.api.pojo.vo.monitorPoint.MonitorPointsVO; -import com.moral.api.pojo.vo.monitorPoint.StateControllerStationVO; +import com.moral.api.service.HistoryFiveMinutelyService; import com.moral.api.service.MonitorPointService; -import com.moral.api.service.OrganizationService; import com.moral.constant.ResponseCodeEnum; import com.moral.constant.ResultMessage; +import com.moral.util.WebUtils; + 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.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 java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; /** * @ClassName DeviceController @@ -35,8 +44,11 @@ @Autowired MonitorPointService monitorPointService; + @Autowired + private HistoryFiveMinutelyService historyFiveMinutelyService; + @GetMapping("queryMonitorPoints") - public ResultMessage queryMonitorPointsAndDevices(MonitorPointQueryForm form){ + public ResultMessage queryMonitorPointsAndDevices(MonitorPointQueryForm form) { //������������������������ if (!form.valid()) return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), @@ -50,15 +62,72 @@ return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(), vo); } - @GetMapping("queryStateControlStation") - public ResultMessage queryStateControlStation(Integer regionCode){ + /** + * @Description: ������������������������������id������name + * @Param: [organizationId] + * @return: com.moral.constant.ResultMessage + * @Author: ��������� + * @Date: 2021/9/26 + */ + @GetMapping("queryAllMonitorPoints") + public ResultMessage queryAllMonitorPoints(Integer organizationId){ + //������������������ + List<MonitorPoint> monitorPoints = monitorPointService.queryAllMonitorPoints(organizationId); + //������������ + return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(), monitorPoints); + } - List<MonitorPoint> monitorPoints = monitorPointService.queryStateControlStationByRegionCode(regionCode); - //������������������������ - StateControllerStationVO vo = StateControllerStationVO.convert(monitorPoints); + /** + * @param request ������������ + * @return ������������������������������������ + */ + @GetMapping("getWindData") + @ApiOperation(value = "������������������", notes = "������������������") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), + @ApiImplicitParam(name = "monitorPointIds", value = "������id", required = true, paramType = "query", dataType = "String") + }) + public ResultMessage getWindData(HttpServletRequest request) { + Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); + if (!params.containsKey("monitorPointIds")) { + return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); + } + String[] monitorPointIds = params.remove("monitorPointIds").toString().split(","); + params.put("monitorPointIds", monitorPointIds); + List<Object> response = historyFiveMinutelyService.getAreaWindData(params); + return ResultMessage.ok(response); + } - return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),vo); + /** + *@Description: ������������������������������ + *@Param: [request] + *@return: com.moral.constant.ResultMessage + *@Author: lizijie + *@Date: 2022-10-10 14:00 + **/ + @GetMapping("getHourlyDataByMonitorPoint") + public ResultMessage getHourlyDataByMonitorPoint(HttpServletRequest request) { + Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); + if (!params.containsKey("monitorPointId") || !params.containsKey("sensors") || !params.containsKey("startTime") || !params.containsKey("endTime")) { + return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); + } + List<Map<String, Object>> resultList = monitorPointService.getHourlyDataByMonitorPoint(params); + return ResultMessage.ok(resultList); + } + + /** + * ������������������������ + * @param params + * @return + */ + @PostMapping("getHourlyDataExcel") + public ResultMessage getHourlyDataExcel(@RequestBody Map<String, Object> params){ + if (!params.containsKey("macs") || !params.containsKey("sensors") || !params.containsKey("startTime") || !params.containsKey("endTime")) { + return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); + } + List<Map<String, Object>> resList = monitorPointService.getHourlyDataDataV3(params); + return ResultMessage.ok(resList); } -- Gitblit v1.8.0