| | |
| | | import com.moral.api.service.HistoryFiveMinutelyService; |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import com.moral.constant.ResultMessage; |
| | | import com.moral.util.WebUtils; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * @ClassName HistoryFiveMinutely |
| | |
| | | @Autowired |
| | | HistoryFiveMinutelyService historyFiveMinutelyService; |
| | | |
| | | /** |
| | | * @Description: 查询组织区域对应的设备以及对应因子的五分钟数据 |
| | | * @Param: [form] |
| | | * @return: com.moral.constant.ResultMessage |
| | | * @Author: 陈凯裕 |
| | | * @Date: 2022/3/10 |
| | | */ |
| | | @GetMapping("queryDeviceAndData") |
| | | public ResultMessage queryDeviceAndData(QueryDeviceAndFiveMinuteDataForm form){ |
| | | //18 110100 |
| | | //判断是否缺少参数 |
| | | if (!form.valid()) |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), |
| | | ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | |
| | | //处理查询业务 |
| | | List<DeviceAndFiveMinuteDataDTO> dto = historyFiveMinutelyService.queryDeviceAndFiveMinuteData(form); |
| | | |
| | | List<Map<String, Object>> dto = historyFiveMinutelyService.queryDeviceAndFiveMinuteData(form); |
| | | Map<String,List<Map<String, Object>>> dtoResult = new HashMap<>(); |
| | | dtoResult.put("devices",dto); |
| | | //转换前端参数 |
| | | DeviceAndFiveMinuteDataVO vo = DeviceAndFiveMinuteDataVO.convert(dto); |
| | | //DeviceAndFiveMinuteDataVO vo = DeviceAndFiveMinuteDataVO.convert(dto); |
| | | |
| | | return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(), vo); |
| | | return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(), dtoResult); |
| | | } |
| | | |
| | | /** |
| | | * @Description: 查询弹窗五分钟数据接口 |
| | | * @Param: [mac] |
| | | * @return: com.moral.constant.ResultMessage |
| | | * @Author: 陈凯裕 |
| | | * @Date: 2022/3/10 |
| | | */ |
| | | @GetMapping("queryPopDataByMac") |
| | | public ResultMessage queryPopDataByMac(HttpServletRequest request){ |
| | | Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); |
| | | Map<String, Object> popDataByMac = historyFiveMinutelyService.getPopDataByMac(params); |
| | | if (popDataByMac==null){ |
| | | return ResultMessage.fail(ResponseCodeEnum.TARGET_IS_NULL.getCode(), ResponseCodeEnum.TARGET_IS_NULL.getMsg()); |
| | | } |
| | | return ResultMessage.ok(popDataByMac); |
| | | } |
| | | } |
| | | |