| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | * @param request 请求信息 |
| | | * @return 返回请求成功后的对象信息 |
| | | */ |
| | | @GetMapping("getTrendChartData") |
| | | @PostMapping("getTrendChartData") |
| | | @ApiOperation(value = "多设备单监测因子趋势图", notes = "多设备单监测因子趋势图.") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), |
| | | @ApiImplicitParam(name = "macs", value = "设备mac,多个逗号隔开", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "sensorCode", value = "因子code", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "type", value = "数据类型,日(day),月(month),年(year)", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "times", value = "数据时间,日(2021-07-29),月(2021-07),年(2021),多个逗号隔开", required = true, paramType = "query", dataType = "String") |
| | | @ApiImplicitParam(name = "macs", value = "设备mac,多个逗号隔开", required = true, paramType = "body", dataType = "String"), |
| | | @ApiImplicitParam(name = "sensorCode", value = "因子code", required = true, paramType = "body", dataType = "String"), |
| | | @ApiImplicitParam(name = "type", value = "数据类型,日(day),月(month),年(year)", required = true, paramType = "body", dataType = "String"), |
| | | @ApiImplicitParam(name = "times", value = "数据时间,日(2021-07-29),月(2021-07),年(2021),多个逗号隔开", required = true, paramType = "body", dataType = "String") |
| | | }) |
| | | public ResultMessage getTrendChartData(HttpServletRequest request) { |
| | | Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); |
| | | public ResultMessage getTrendChartData(@RequestBody Map<String,Object> params) { |
| | | if (!params.containsKey("macs") || !params.containsKey("sensorCode") || !params.containsKey("type") || !params.containsKey("times")) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | |
| | | @Override |
| | | public List<Device> getDevicesByMonitorPointId(Integer monitorPointId) { |
| | | QueryWrapper<Device> wrapper = new QueryWrapper(); |
| | | wrapper.eq("monitor_point_id",monitorPointId); |
| | | wrapper.eq("monitor_point_id", monitorPointId); |
| | | wrapper.eq("is_delete", Constants.NOT_DELETE); |
| | | return deviceMapper.selectList(wrapper); |
| | | } |
| | |
| | | public List<Map<String, Object>> getTrendChartData(Map<String, Object> params) { |
| | | Object type = params.get("type"); |
| | | //设备mac |
| | | String[] macs = params.remove("macs").toString().split(","); |
| | | List<String> macs = (List<String>) params.remove("macs"); |
| | | //所选时间 |
| | | String[] times = params.remove("times").toString().split(","); |
| | | List<String> times = (List<String>) params.remove("times"); |
| | | //因子code |
| | | String sensorCode = params.get("sensorCode").toString(); |
| | | String end; |