| | |
| | | import com.moral.api.pojo.ext.wind.WindListExt; |
| | | import com.moral.api.pojo.form.device.MonitorPointQueryForm; |
| | | import com.moral.api.pojo.form.historyFiveMinutely.QueryDeviceAndFiveMinuteDataForm; |
| | | import com.moral.api.pojo.vo.historyFiveMinutely.QueryFiveDataByMacVO; |
| | | import com.moral.api.pojo.vo.user.QxUser; |
| | | import com.moral.api.service.DeviceService; |
| | | import com.moral.api.service.HistoryFiveMinutelyService; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | } |
| | | return getWindData(windData,params); |
| | | } |
| | | @Override |
| | | public List<Object> getAreaWindDataCenter(Map<String, Object> params) { |
| | | // String timeUnits = DateUtils.dateToDateString(new Date(), DateUtils.yyyyMM_EN); |
| | | // params.put("timeUnits", timeUnits); |
| | | // //风场数据 |
| | | // List<WindData> windData = historyFiveMinutelyMapper.getAreaWindData(params); |
| | | // return getWindData(windData); |
| | | |
| | | params.put("timeUnits","202311"); |
| | | params.put("time","2023-11-05 09:00"); |
| | | params.put("macs",Arrays.asList("p5dnd7a0245472","p5dnd7a0245400","p5dnd7a0245385","p5dnd7a0245374")); |
| | | List<WindData> windData = historyHourlyMapper.getArea(params); |
| | | params.put("perdlen",50); |
| | | return getWindData(windData,params); |
| | | } |
| | | |
| | | //获取五分钟弹窗数据 |
| | | @Override |
| | |
| | | result.put("dataTime", datas.get("dataTime")); |
| | | //排序 |
| | | return orderSixParam(result); |
| | | } |
| | | |
| | | @Override |
| | | public QueryFiveDataByMacVO queryFiveDataByMac(String mac, String chooseTime, String time) { |
| | | Map<String, Object> datas = null; |
| | | if (chooseTime.equals("true")) { |
| | | String timeUnits = DateUtils.stringToDateString(time, "yyyy-MM-dd HH:mm", DateUtils.yyyyMM_EN); |
| | | String dbDataStr = historyHourlyMapper.queryLastHourlyMac(mac, time, timeUnits); |
| | | if (dbDataStr == null) { |
| | | return null; |
| | | } |
| | | datas = JSON.parseObject(dbDataStr, HashMap.class); |
| | | datas.put("dataTime", time); |
| | | } else { |
| | | datas = queryLastDataByMac(mac); |
| | | if (ObjectUtils.isEmpty(datas)){ |
| | | return null; |
| | | } |
| | | } |
| | | //构建返回对象 |
| | | Map<String, Object> result = new HashMap<>(); |
| | | |
| | | //创建返回因子code集合 |
| | | List<String> sensorCodes = Arrays.asList("a34004", "a34002", "a21005", "a21004", "a21026", "a05024", "a99054", "a01008", "a01007"); |
| | | //获取设备信息 |
| | | Device device = deviceService.getDeviceUnitAlramInforByMac(mac); |
| | | //转换数据单位和名称 |
| | | for (Sensor sensor : device.getVersion().getSensors()) { |
| | | if (!sensorCodes.contains(sensor.getCode())) |
| | | continue; |
| | | Object dataO = datas.get(sensor.getCode()); |
| | | if (dataO != null) { |
| | | String data = String.valueOf(dataO); |
| | | result.put(sensor.getCode(), data); |
| | | } else { |
| | | if (sensor.getCode().equals("a01008") ||sensor.getCode().equals("a01007")){ |
| | | result.put(sensor.getCode(), "-"); |
| | | }else { |
| | | result.put(sensor.getCode(), "0"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | String str = new DecimalFormat("#.######").format(Double.parseDouble(result.get("a21005").toString())); |
| | | QueryFiveDataByMacVO queryFiveDataByMacVO = new QueryFiveDataByMacVO(); |
| | | queryFiveDataByMacVO.setName(device.getName()); |
| | | queryFiveDataByMacVO.setDataTime(datas.get("dataTime").toString()); |
| | | queryFiveDataByMacVO.setA34004(result.get("a34004").toString()); |
| | | queryFiveDataByMacVO.setA34002(result.get("a34002").toString()); |
| | | queryFiveDataByMacVO.setA21026(result.get("a21026").toString()); |
| | | queryFiveDataByMacVO.setA21004(result.get("a21004").toString()); |
| | | queryFiveDataByMacVO.setA21005(str); |
| | | queryFiveDataByMacVO.setA05024(result.get("a05024").toString()); |
| | | queryFiveDataByMacVO.setA01008(result.get("a01008").toString()); |
| | | queryFiveDataByMacVO.setA01007(result.get("a01007").toString()); |
| | | queryFiveDataByMacVO.setA99054(result.get("a99054").toString()); |
| | | |
| | | return queryFiveDataByMacVO; |
| | | } |
| | | |
| | | //对六参以及时间进行排序 |
| | |
| | | laLaMap.put("minLa", lami); |
| | | |
| | | |
| | | int perdlen = windDate(Objects.nonNull(params.get("monitorPointList"))?params.get("monitorPointList").toString():null); |
| | | int perdlen = Objects.nonNull(params.get("perdlen"))?Integer.parseInt(params.get("perdlen").toString()):windDate(Objects.nonNull(params.get("monitorPointList"))?params.get("monitorPointList").toString():null); |
| | | int length = perdlen*10; |
| | | |
| | | Double lo1 = lomi - length * 0.00001141; |