| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.jasper.compiler.JspUtil;
|
| | | import org.dom4j.Element;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.util.ObjectUtils;
|
| | |
| | | parameters.put("start", sdf.parse(time));
|
| | | parameters.put("end", sdf.parse(nextDay));
|
| | | MonitorPoint monitorPoint = monitorPointMapper.selectByPrimaryKey(Integer.valueOf(monitorPointId));
|
| | |
|
| | | //List<Map<String, Object>> forecastList = forecastWeatherMapper.getForecastHour(parameters);
|
| | |
|
| | | if (monitorPoint.getAreaCode() == null) {
|
| | | parameters.put("cityCode", monitorPoint.getCityCode());
|
| | | } else {
|
| | |
| | | parameters.put("typeFormat", "%Y-%m-%d %H:%i:%s");
|
| | | String cityName = parameters.get("city").toString();
|
| | | Area area = areaMapper.getAreaByName(cityName);
|
| | | MonitorPoint monitorPoint;
|
| | | Integer parentCode = 0;
|
| | | Integer code = 0;
|
| | | String name = "";
|
| | | if (area == null) {
|
| | |
| | | name = province.getProvinceName();
|
| | | } else {
|
| | | code = city.getCityCode();
|
| | | parentCode = city.getProvinceCode();
|
| | | name = city.getCityName();
|
| | | }
|
| | | } else {
|
| | | code = area.getAreaCode();
|
| | | parentCode = area.getCityCode();
|
| | | name = area.getAreaName();
|
| | | }
|
| | |
|
| | | parameters.put("cityCode", code);
|
| | | parameters.put("name", name);
|
| | | parameters.put("areaCode", code);
|
| | |
|
| | |
|
| | | String time = parameters.get("time").toString();
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | |
| | | String beforeDay = sdf.format(cal.getTime());
|
| | | parameters.put("start", selectTime);
|
| | | parameters.put("end", end);
|
| | | Integer fcode = 0;
|
| | | List<Map<String, Object>> forecastList = forecastWeatherMapper.getForecast(parameters);
|
| | | if (forecastList.size() == 0) {
|
| | | parameters.put("cityCode", parentCode);
|
| | | forecastList = forecastWeatherMapper.getForecast(parameters);
|
| | | if (forecastList.size() == 0) {
|
| | | List<Area> areaList = areaMapper.getAreaByCityCode(code);
|
| | | for (Area area1 : areaList) {
|
| | | List<Area> areaList = areaMapper.getAreaByCityCode(code);
|
| | | for (Area area1 : areaList) {
|
| | | if (area1 != null) {
|
| | | parameters.put("cityCode", area1.getAreaCode());
|
| | | fcode = area1.getAreaCode();
|
| | | forecastList = forecastWeatherMapper.getForecast(parameters);
|
| | | if (forecastList.size() != 0) {
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | } else {
|
| | | fcode = Integer.valueOf(parameters.get("cityCode").toString());
|
| | | }
|
| | |
|
| | | List<Map<String, Object>> foreList = new ArrayList<>();
|
| | |
| | | hashMap.put("TVOC", "");
|
| | | hashMap.put("altitude", "");
|
| | | hashMap.put("vegetation", "");
|
| | | hashMap.put("river", "");
|
| | | hashMap.put("AQI", "");
|
| | | hashMap.put("SO2C", "");
|
| | | hashMap.put("NO2C", "");
|
| | |
| | | hashMap.put("PM25C", "");
|
| | | hashMap.put("PM10C", "");
|
| | | hashMap.put("city", parameters.get("name").toString());
|
| | | hashMap.put("code", fcode);
|
| | | if (sdf.parse(time).getTime() <= now.getTime()) {
|
| | | hashMap.put("fxTime", (beforeDay + " 15:00").substring(5, 16));
|
| | | } else {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | String ac = parameters.get("cityCode").toString();
|
| | | List<Map<String, Object>> aqiList = hangzhouAqiMapper.getAqi(parameters);
|
| | | if (aqiList.size() == 0) {
|
| | | parameters.put("areaCode", parentCode);
|
| | | parameters.put("cityCode", code);//320500
|
| | | aqiList = hangzhouAqiMapper.getAqi(parameters);
|
| | | if (aqiList.size() == 0) {
|
| | | List<Area> areaList = areaMapper.getAreaByCityCode(code);
|
| | | for (Area area1 : areaList) {
|
| | | if (area1 != null) {
|
| | | parameters.put("cityCode", area1.getAreaCode());
|
| | | aqiList = hangzhouAqiMapper.getAqi(parameters);
|
| | | if (aqiList.size() != 0) {
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | List<Map<String, Object>> realAqilist = new ArrayList<>();
|
| | | for (Map<String, Object> aqiMap : aqiList) {
|
| | | Map<String, Object> hashMap = new HashMap<>();
|
| | |
| | | hashMap.put("city", parameters.get("name").toString());
|
| | | realAqilist.add(hashMap);
|
| | | }
|
| | |
|
| | | for (Map<String, Object> map : realAqilist) {
|
| | | Date endTime = sdf1.parse(map.get("time").toString());
|
| | | cal.setTime(endTime);
|
| | | cal.add(Calendar.HOUR, -8);
|
| | | Date startTime = cal.getTime();
|
| | | Map<String, Object> hashMap = new HashMap<>();
|
| | | hashMap.put("areaCode", Integer.valueOf(parameters.get("areaCode").toString()));
|
| | | hashMap.put("cityCode", Integer.valueOf(parameters.get("cityCode").toString()));
|
| | | hashMap.put("start", startTime);
|
| | | hashMap.put("end", endTime);
|
| | | Map<String, Object> O3Map = hangzhouAqiMapper.getAvgO3EightHours(hashMap);
|
| | | map.put("O3_8H", O3Map.get("O3_8H").toString());
|
| | | if (O3Map.get("O3C_8H") != null) {
|
| | | map.put("O3C_8H", O3Map.get("O3C_8H").toString());
|
| | | }
|
| | | map.put("O3C_8H", O3Map.get("O3C_8H").toString());
|
| | | }
|
| | |
|
| | | //光照
|
| | | String ac = parameters.get("areaCode").toString();
|
| | |
|
| | | Map<String, Object> params = new HashMap<>();
|
| | | if (ac.endsWith("00")) {
|
| | | params.put("cityCode", Integer.valueOf(ac));
|
| | |
| | | Integer pointId = point.getId();
|
| | | pointList.add(pointId);
|
| | | }
|
| | |
|
| | | List<Device> deviceList = deviceMapper.getDeviceListByMonitorPointIds(pointList);
|
| | | List<String> macList = new ArrayList<>();
|
| | | List<String> macList1 = new ArrayList<>();
|
| | | List<Map<String, Object>> beamList = new ArrayList<>();
|
| | | List<Map<String, Object>> tvocList=new ArrayList<>();
|
| | | if (deviceList.size() != 0) {
|
| | | for (Device device : deviceList) {
|
| | | String mac = device.getMac();
|
| | | macList.add(mac);
|
| | | macList.add(device.getMac());
|
| | | }
|
| | |
|
| | | parameters.put("macs", macList);
|
| | | beamList = historyHourlyMapper.getBeamByMacs(parameters);
|
| | | Map<String, Object> map = new HashMap<>();
|
| | | if (name.equals("沧州市")) {
|
| | | List<Integer> list=new ArrayList<>();
|
| | | list.add(48);
|
| | | List<Device> pointIds = deviceMapper.getDeviceListByMonitorPointIds(list);
|
| | | for (Device device : pointIds) {
|
| | | if (device.getId() != 1075) {
|
| | | macList1.add(device.getMac());
|
| | | }
|
| | | }
|
| | | }else {
|
| | | macList1=macList;
|
| | | }
|
| | | map.put("macs", macList1);
|
| | | map.put("start", parameters.get("start"));
|
| | | map.put("end", parameters.get("end"));
|
| | | tvocList = historyHourlyMapper.getTVOCByMacs(map);
|
| | | }
|
| | |
|
| | | List<Map<String, Object>> realList = realWeatherMapper.getRealWeather(parameters);
|
| | | List<Map<String, Object>> realWeatherList = new ArrayList<>();
|
| | | for (Map<String, Object> realMap : realList) {
|
| | |
| | | cal.add(Calendar.HOUR, -6);
|
| | | Date startTime = cal.getTime();
|
| | | Map<String, Object> hashMap = new HashMap<>();
|
| | | hashMap.put("cityCode", Integer.valueOf(parameters.get("areaCode").toString()));
|
| | | hashMap.put("cityCode", Integer.valueOf(parameters.get("cityCode").toString()));
|
| | | hashMap.put("start", startTime);
|
| | | hashMap.put("end", endTime);
|
| | |
|
| | |
| | | if (precip6HourMap != null) {
|
| | | realMap.put("precip6", precip6HourMap.get("precip6").toString());
|
| | | }
|
| | |
|
| | | for (Map<String, Object> tvocMap : tvocList) {
|
| | | String ttime = tvocMap.get("time").toString();
|
| | | if (ttime.equals(rtime)) {
|
| | | realMap.put("TVOC", tvocMap.get("TVOC").toString());
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | List<Map<String, Object>> list = new ArrayList<>();
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = list.size(); i < foreList.size(); i++) {
|
| | | Map<String, Object> map = foreList.get(i);
|
| | | resultList.add(map);
|
| | | Map<String, Object> hashMap = new HashMap<>();
|
| | | hashMap.put("time", map.get("time").toString());
|
| | | hashMap.put("type", "实测");
|
| | | hashMap.put("city", parameters.get("city").toString());
|
| | | hashMap.put("city", parameters.get("name").toString());
|
| | | resultList.add(hashMap);
|
| | | }
|
| | |
|
| | |
| | | map.put("precip6", "");
|
| | | }
|
| | | }
|
| | | if ((!map.containsKey("SO2C")) && map.containsKey("SO2")) {
|
| | | map.put("SO2C", map.get("SO2").toString());
|
| | | }
|
| | | if ((!map.containsKey("NO2C")) && map.containsKey("NO2")) {
|
| | | map.put("NO2C", map.get("NO2").toString());
|
| | | }
|
| | | if ((!map.containsKey("O3C")) && map.containsKey("O3")) {
|
| | | map.put("O3C", map.get("O3").toString());
|
| | | }
|
| | | if ((!map.containsKey("COC")) && map.containsKey("CO")) {
|
| | | map.put("COC", map.get("CO").toString());
|
| | | }
|
| | | if ((!map.containsKey("PM25C")) && map.containsKey("PM2_5")) {
|
| | | map.put("PM25C", map.get("PM2_5").toString());
|
| | | }
|
| | | if ((!map.containsKey("PM10C")) && map.containsKey("PM10")) {
|
| | | map.put("PM10C", map.get("PM10").toString());
|
| | | }
|
| | |
|
| | | }
|
| | | return resultList;
|
| | | }
|
| | |
| | | String time = map.get("time").toString() + ":00";
|
| | | Map<String, Object> hashMap = new HashMap<>();
|
| | | hashMap.put("time", time);
|
| | | String cityName = map.get("city").toString();
|
| | | Area area = areaMapper.getAreaByName(cityName);
|
| | | if (area == null) {
|
| | | City city = cityMapper.getCityByName(cityName);
|
| | | if (city == null) {
|
| | | Province province = provinceMapper.getProvinceByName(cityName);
|
| | | if (province == null) {
|
| | | return;
|
| | | } else {
|
| | | hashMap.put("cityCode", province.getProvinceCode());
|
| | | }
|
| | | } else {
|
| | | Integer cityCode = city.getCityCode();
|
| | | hashMap.put("cityCode", cityCode);
|
| | | }
|
| | | } else {
|
| | | Integer areaCode = area.getAreaCode();
|
| | | hashMap.put("cityCode", areaCode);
|
| | | }
|
| | |
|
| | | hashMap.put("cityCode", Integer.valueOf(map.get("code").toString()));
|
| | | Map<String, Object> jsonMap = new HashMap<>();
|
| | | for (String key : map.keySet()) {
|
| | | if (!key.equals("city") && !key.equals("time") && !key.equals("type") && !key.equals("fxTime")) {
|
| | | if (!key.equals("city") && !key.equals("time") && !key.equals("type") && !key.equals("fxTime") && !key.equals("code")) {
|
| | | String value = map.get(key).toString();
|
| | | jsonMap.put(key, value);
|
| | | }
|