| | |
| | | package com.moral.service.impl;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.text.DecimalFormat;
|
| | | import java.text.ParseException;
|
| | | import java.text.SimpleDateFormat;
|
| | |
| | | import com.moral.mapper.MonitorPointMapper;
|
| | | import com.moral.mapper.ProvinceMapper;
|
| | | import com.moral.mapper.RealWeatherMapper;
|
| | | import com.moral.mapper.ShAreaMapper;
|
| | | import com.moral.service.OrganizationService;
|
| | | import com.moral.service.WeatherService;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private HistoryHourlyMapper historyHourlyMapper;
|
| | |
|
| | | @Resource
|
| | | private ShAreaMapper shAreaMapper;
|
| | |
|
| | | @Override
|
| | | public Map<String, Object> getWeatherDataByRegion(Map<String, Object> parameters) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | DecimalFormat df = new DecimalFormat(".####");
|
| | | List<Map<String, Object>> realAqilist = new ArrayList<>();
|
| | | for (Map<String, Object> aqiMap : aqiList) {
|
| | | Map<String, Object> hashMap = new HashMap<>();
|
| | | hashMap.put("time", aqiMap.get("time"));
|
| | | Map<String, Object> jsonMap = (Map<String, Object>) JSONObject.parse(aqiMap.get("json").toString());
|
| | | DecimalFormat df = new DecimalFormat(".####");
|
| | | if (jsonMap.get("longitude") != null) {
|
| | | double longitude = Double.valueOf(jsonMap.get("longitude").toString());
|
| | | jsonMap.put("longitude", df.format(longitude));
|
| | | }
|
| | | if (jsonMap.get("latitude") != null) {
|
| | | double longitude = Double.valueOf(jsonMap.get("latitude").toString());
|
| | | jsonMap.put("latitude", df.format(longitude));
|
| | | }
|
| | | hashMap.putAll(jsonMap);
|
| | | hashMap.put("city", parameters.get("name").toString());
|
| | | realAqilist.add(hashMap);
|
| | |
| | | for (Device device : deviceList) {
|
| | | macList.add(device.getMac());
|
| | | }
|
| | |
|
| | | parameters.put("macs", macList);
|
| | | beamList = historyHourlyMapper.getBeamByMacs(parameters);
|
| | | Map<String, Object> map = new HashMap<>();
|
| | |
| | | for (Map<String, Object> tvocMap : tvocList) {
|
| | | String ttime = tvocMap.get("time").toString();
|
| | | if (ttime.equals(rtime)) {
|
| | | realMap.put("TVOC", tvocMap.get("TVOC").toString());
|
| | | Double tvoc = Double.valueOf(tvocMap.get("TVOC").toString());
|
| | | BigDecimal bd = new BigDecimal(tvoc);
|
| | | tvoc = bd.setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue();
|
| | | realMap.put("TVOC", tvoc);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | hashMap.put("cityCode", Integer.valueOf(parameters.get("cityCode").toString()));
|
| | | hashMap.put("start", startTime);
|
| | | hashMap.put("end", endTime);
|
| | | if (rhour == 0) {
|
| | | rhour = 24;
|
| | | }
|
| | | if (rhour == nowHour) {
|
| | | Map<String, Object> sumO3Map = hangzhouAqiMapper.getSumO3(hashMap);
|
| | | double v = value - Double.valueOf(sumO3Map.get("O3Sum").toString());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | Map<String, Object> point = shAreaMapper.getLngAndLat(name);
|
| | | for (Map<String, Object> map : resultList) {
|
| | | if (map.get("type").equals("预测")) {
|
| | | if (resultList.get(1).get("longitude") != null) {
|
| | | String longitude = resultList.get(1).get("longitude").toString();
|
| | | map.put("longitude",longitude);
|
| | | }
|
| | | if (resultList.get(1).get("latitude") != null) {
|
| | | String latitude = resultList.get(1).get("latitude").toString();
|
| | | map.put("latitude",latitude);
|
| | | }
|
| | | }
|
| | | double longitude = Double.valueOf(point.get("lng").toString());
|
| | | double latitude = Double.valueOf(point.get("lat").toString());
|
| | | map.put("longitude",df.format(longitude));
|
| | | map.put("latitude",df.format(latitude));
|
| | | }
|
| | | return resultList;
|
| | | }
|