| | |
| | | package com.moral.api.controller; |
| | | |
| | | import com.moral.api.dto.MonitoringStationDTO; |
| | | import com.moral.api.dto.MonitoringStationDTOResult; |
| | | 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.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 io.swagger.annotations.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | 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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | List<MonitorPoint> monitorPoints = monitorPointService.queryByOrgIdAndRegionCode(form); |
| | | |
| | | //转换前端参数 |
| | | MonitorPointsVO vo = MonitorPointsVO.convert(monitorPoints); |
| | | MonitorPointsVO vo = MonitorPointsVO.convert(monitorPoints,false); |
| | | |
| | | return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(), vo); |
| | | } |
| | | |
| | | @GetMapping("queryMonitorPointsState") |
| | | public ResultMessage queryMonitorPointsState(MonitorPointQueryForm form) { |
| | | //判断是否缺少参数 |
| | | if (!form.valid()) |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), |
| | | ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | //处理查询业务 |
| | | List<MonitorPoint> monitorPoints = monitorPointService.queryByOrgIdAndRegionCode(form); |
| | | |
| | | //转换前端参数 |
| | | MonitorPointsVO vo = MonitorPointsVO.convert(monitorPoints,true); |
| | | |
| | | return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(), vo); |
| | | } |
| | |
| | | if (!params.containsKey("monitorPointIds")) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | String[] monitorPointIds = params.remove("monitorPointIds").toString().split(","); |
| | | String monitorPoint = params.remove("monitorPointIds").toString(); |
| | | /*if(monitorPoint.contains("")){ |
| | | |
| | | }*/ |
| | | params.put("monitorPointList", monitorPoint); |
| | | String[] monitorPointIds = monitorPoint.split(","); |
| | | if (monitorPointIds.length > 3) { |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | params.put("monitorPointIds", monitorPointIds); |
| | | List<Object> response = historyFiveMinutelyService.getAreaWindData(params); |
| | | return ResultMessage.ok(response); |
| | |
| | | } |
| | | |
| | | } |
| | | @PostMapping("listMonitoring") |
| | | public ResultMessage listMonitoring(@RequestBody Map<String, Object> params) { |
| | | |
| | | /*@RequestParam @ApiParam(value = "mac",name = "mac号") List<String> mac, |
| | | @RequestParam @ApiParam(value = "startTime",name = "开始时间") String startTime, |
| | | @RequestParam @ApiParam(value = "reportType",name = "type") int reportType, |
| | | @RequestParam @ApiParam(value = "endTime",name = "结束时间") String endTime*/ |
| | | List<MonitoringStationDTO> resList = monitorPointService.listMonitoringStationDTO(params,Integer.parseInt(params.get("reportType").toString()),params.get("startTime").toString(),params.get("endTime").toString()); |
| | | /*List<MonitoringStationDTOResult> list = new ArrayList<>(); |
| | | for(MonitoringStationDTO m : resList){ |
| | | MonitoringStationDTOResult result = new MonitoringStationDTOResult(); |
| | | result.setName(m.getName()); |
| | | result.setMac(m.getMac()); |
| | | result.setPM25(m.getPM25().compareTo(BigDecimal.ZERO)==0?"-":m.getPM25().toString()); |
| | | result.setPM25Num(m.getPM25Num()==0?"-":String.valueOf(m.getPM25Num())); |
| | | result.setO3(m.getO3().compareTo(BigDecimal.ZERO)==0?"-":m.getO3().toString()); |
| | | result.setO3Num(m.getO3Num()==0?"-":String.valueOf(m.getO3Num())); |
| | | result.setTovc(m.getTovc().compareTo(BigDecimal.ZERO)==0?"-":m.getTovc().toString()); |
| | | result.setTOVCNum(m.getTOVCNum()==0?"-":String.valueOf(m.getTOVCNum())); |
| | | result.setComposite(m.getComposite().compareTo(BigDecimal.ZERO)==0?"-":m.getComposite().toString()); |
| | | result.setCompositeNum(m.getCompositeNum()==0?"-":String.valueOf(m.getCompositeNum())); |
| | | result.setSO2(m.getSO2().compareTo(BigDecimal.ZERO)==0?"-":m.getSO2().toString()); |
| | | result.setSO2Num(m.getSO2Num()==0?"-":String.valueOf(m.getSO2Num())); |
| | | result.setNO2(m.getNO2().compareTo(BigDecimal.ZERO)==0?"-":m.getNO2().toString()); |
| | | result.setNO2Num(m.getNO2Num()==0?"-":String.valueOf(m.getNO2Num())); |
| | | result.setPM10(m.getPM10().compareTo(BigDecimal.ZERO)==0?"-":m.getPM10().toString()); |
| | | result.setPM10Num(m.getPM10Num()==0?"-":String.valueOf(m.getPM10Num())); |
| | | result.setCO(m.getCO().compareTo(BigDecimal.ZERO)==0?"-":m.getCO().toString()); |
| | | result.setCONum(m.getCONum()==0?"-":String.valueOf(m.getCONum())); |
| | | list.add(result); |
| | | }*/ |
| | | return ResultMessage.ok(resList); |
| | | } |
| | | } |