|  |  |  | 
|---|
|  |  |  | package com.moral.api.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.moral.api.pojo.dto.dataDisplay.MonitorPointDataDisplayDTO; | 
|---|
|  |  |  | import com.moral.api.pojo.dto.dataDisplay.SensorComparisonDisplayDTO; | 
|---|
|  |  |  | import com.moral.api.pojo.form.dataDisplay.MonitorPointDataDisplayForm; | 
|---|
|  |  |  | import com.moral.api.pojo.form.dataDisplay.SensorComparisonDisplayForm; | 
|---|
|  |  |  | import com.moral.api.service.DataDisplayService; | 
|---|
|  |  |  | import com.moral.constant.ResponseCodeEnum; | 
|---|
|  |  |  | import com.moral.constant.ResultMessage; | 
|---|
|  |  |  | import com.moral.util.DateUtils; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.CrossOrigin; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping("/dataDisplay") | 
|---|
|  |  |  | public class DataDisplayController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @GetMapping("monitorPointDataDisplay") | 
|---|
|  |  |  | public ResultMessage monitorPointDataDisplay(MonitorPointDataDisplayForm form){ | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | DataDisplayService dataDisplayService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("monitorPointDataDisplay") | 
|---|
|  |  |  | public ResultMessage monitorPointDataDisplay( @RequestBody MonitorPointDataDisplayForm form){ | 
|---|
|  |  |  | //判断是否缺少参数 | 
|---|
|  |  |  | if (form.getMacs()==null && form.getEndTime() ==null && form.getStartTime() ==null && form.getReportType()==null) | 
|---|
|  |  |  | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), | 
|---|
|  |  |  | ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<MonitorPointDataDisplayDTO> dtos = dataDisplayService.getMonitorPointDisplayData(form); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),dtos); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("sensorComparisonDisplay") | 
|---|
|  |  |  | public ResultMessage sensorComparisonDisplay(@RequestBody SensorComparisonDisplayForm form){ | 
|---|
|  |  |  | //判断是否缺少参数 | 
|---|
|  |  |  | if (!form.valid()) | 
|---|
|  |  |  | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), | 
|---|
|  |  |  | ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); | 
|---|
|  |  |  | List<SensorComparisonDisplayDTO> dtos = dataDisplayService.getSensorComparisonDisplayData(form); | 
|---|
|  |  |  | return  new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),dtos); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | MonitorPointDataDisplayDTO dto = new MonitorPointDataDisplayDTO(); | 
|---|
|  |  |  | MonitorPointDataDisplayDTO dto1 = new MonitorPointDataDisplayDTO(); | 
|---|
|  |  |  | MonitorPointDataDisplayDTO dto2 = new MonitorPointDataDisplayDTO(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dto.setDeviceName("模拟设备1"); | 
|---|
|  |  |  | dto1.setDeviceName("模拟设备2"); | 
|---|
|  |  |  | dto2.setDeviceName("模拟设备3"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dto.setTime("yyyy-MM-dd HH:mm:ss"); | 
|---|
|  |  |  | dto1.setTime("yyyy-MM-dd HH:mm:ss"); | 
|---|
|  |  |  | dto2.setTime("yyyy-MM-dd HH:mm:ss"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dto.setOrganizationName("模拟组织1"); | 
|---|
|  |  |  | dto1.setOrganizationName("模拟组织2"); | 
|---|
|  |  |  | dto2.setOrganizationName("模拟组织3"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dto.setA05024(1); | 
|---|
|  |  |  | dto1.setA05024(1); | 
|---|
|  |  |  | dto2.setA05024(1); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dto.setA21005(1d); | 
|---|
|  |  |  | dto1.setA21005(1d); | 
|---|
|  |  |  | dto2.setA21005(1d); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dto.setA21004(1); | 
|---|
|  |  |  | dto1.setA21004(1); | 
|---|
|  |  |  | dto2.setA21004(1); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dto.setA21026(1); | 
|---|
|  |  |  | dto1.setA21026(1); | 
|---|
|  |  |  | dto2.setA21026(1); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dto.setA34002(1); | 
|---|
|  |  |  | dto1.setA34002(1); | 
|---|
|  |  |  | dto2.setA34002(1); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dto.setA34004(1); | 
|---|
|  |  |  | dto1.setA34004(1); | 
|---|
|  |  |  | dto2.setA34004(1); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dto.setA99054(1d); | 
|---|
|  |  |  | dto1.setA99054(1d); | 
|---|
|  |  |  | dto2.setA99054(1d); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dto.setAQI(1); | 
|---|
|  |  |  | dto1.setAQI(1); | 
|---|
|  |  |  | dto2.setAQI(1); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<MonitorPointDataDisplayDTO> list = new ArrayList<>(); | 
|---|
|  |  |  | list.add(dto); | 
|---|
|  |  |  | list.add(dto1); | 
|---|
|  |  |  | list.add(dto2); | 
|---|
|  |  |  | return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),list); | 
|---|
|  |  |  | @PostMapping("sensorComparisonDisplayV2") | 
|---|
|  |  |  | public ResultMessage sensorComparisonDisplayV2(@RequestBody Map<String, Object> params){ | 
|---|
|  |  |  | //判断是否缺少参数 | 
|---|
|  |  |  | if (!params.containsKey("mac") || !params.containsKey("sensorCodes") || !params.containsKey("reportType") || !params.containsKey("times")) { | 
|---|
|  |  |  | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<SensorComparisonDisplayDTO> dtos = dataDisplayService.getSensorComparisonDisplayDataV2(params); | 
|---|
|  |  |  | return  new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),dtos); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|