From a98b1db4392c357304036e8b3cdd01646920300d Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Thu, 21 Jul 2022 15:41:23 +0800
Subject: [PATCH] 1.山洪

---
 src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java | 1206 +++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 824 insertions(+), 382 deletions(-)

diff --git a/src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java b/src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java
index b2cec61..330d99e 100644
--- a/src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java
+++ b/src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java
@@ -16,8 +16,6 @@
  */
 package org.springblade.modules.regionWeight.controller;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import io.reactivex.Observable;
 import io.swagger.annotations.*;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
@@ -26,6 +24,7 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.io.*;
+import java.sql.Timestamp;
 import java.text.SimpleDateFormat;
 import java.util.Map.Entry;
 
@@ -168,325 +167,325 @@
 		return R.data(tree);
 	}
 
-	/**
-	 * 面降雨量
-	 */
-	@GetMapping("/selectReM")
-	public R selectReM(String beginTime, String endTime) {
-		String substring = beginTime.substring(0, 10);
-		String r = beginTime.substring(11, 13);
-		//截取月日
-		String[] strs = substring.split("-");
-		//月
-		String year = strs[1].toString();
-		//日
-		String day = strs[2].toString();
-		String substrings = endTime.substring(0, 10);
-		String rs = endTime.substring(11, 13);
-		//截取月日
-		String[] strss = substrings.split("-");
-		//月
-		String years = strss[1].toString();
-		//日
-		String days = strss[2].toString();
-		String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时。";
-		//最新雨量值
-		List<Map<String, Object>> map = regionWeightService.selectReM(beginTime, endTime);
-		List<Map<String, Object>> mapAll = regionWeightService.selectAll();
-		//权重值
-		List<Map<String, Object>> list = regionWeightService.selectWeight();
-		Map map1 = new HashMap();
-		Map mapc = new HashMap();
-		List<Map<String, Object>> list1 = new ArrayList<Map<String, Object>>();
-		List<Map<String, Object>> lists = new ArrayList<Map<String, Object>>();
-		List<Map<String, Object>> listc = new ArrayList<Map<String, Object>>();
-		double v = 0;
-		//统计抚州市雨量
-		Double num = 0.0;
-		String region_code = null;
-		if (map.size() == 0) {
-			List<Map<String, Object>> l = new ArrayList<Map<String, Object>>();
-			List<Map<String, Object>> m = new ArrayList<Map<String, Object>>();
-			mapc.put("List", l);
-			mapc.put("Num", m);
-			mapc.put("text", yday + "暂无降雨信息。");
-			lists.add(mapc);
-		} else {
-			for (int i = 0; i < map.size(); i++) {
-				region_code = map.get(i).get("REGION_CODE").toString();
-				//获取行政区编码
-				if (i != 0) {
-					String region_code1 = map.get(i - 1).get("REGION_CODE").toString();
-					if (!region_code.equals(region_code1)) {
-						map1.put("id", region_code1);
-						map1.put("value", v);
-						list1.add(map1);
-						v = 0;
-						map1 = new HashMap();
-						for (int j = 0; j < list.size(); j++) {
-							if (region_code.equals(list.get(j).get("STATION_CODE").toString())) {
-								BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP");
-								double drp = bigDecimaldrp.floatValue();
-								String weight1 = map.get(i).get("WEIGHT").toString();
-								float weight = Float.parseFloat(weight1);
-								v += drp * weight;
-								break;
-							}
-						}
-					} else {
-						for (int j = 0; j < list.size(); j++) {
-							if (region_code.equals(list.get(j).get("STATION_CODE").toString())) {
-								BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP");
-								double drp = bigDecimaldrp.floatValue();
-								String weight1 = map.get(i).get("WEIGHT").toString();
-								float weight = Float.parseFloat(weight1);
-								System.out.println(Math.round(drp));
-								v += drp * weight;
-								break;
-							}
-						}
-					}
-				} else {
-					for (int j = 0; j < list.size(); j++) {
-						if (region_code.equals(list.get(j).get("STATION_CODE").toString())) {
-							BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP");
-							double drp = bigDecimaldrp.floatValue();
-							String weight1 = map.get(i).get("WEIGHT").toString();
-							float weight = Float.parseFloat(weight1);
-							System.out.println(Math.round(drp));
-							v += drp * weight;
-							break;
-						}
-					}
-				}
-			}
-			map1.put("id", region_code);
-			map1.put("value", v);
-			list1.add(map1);
-			Map<String, Object> result1 = new HashMap<String, Object>();
-			//县/区面雨量值
-			for (Map<String, Object> maps : list1) {
-				String id = maps.get("id").toString();
-				Double value = Double.parseDouble(maps.get("value").toString());
-				if (result1.containsKey(id)) {
-					Double temp = Double.parseDouble(result1.get(id).toString());
-					value += temp;
-				}
-				result1.put(id, value);
-			}
-			//计算市的面雨量
-			for (String k : result1.keySet()) {
-				for (int c = 0; c < list.size(); c++) {
-					if (k.equals(list.get(c).get("STATION_CODE").toString())) {
-						String s = result1.get(k).toString();
-						Double w = Double.parseDouble(s);
-						String weight = list.get(c).get("WEIGHT").toString();
-						Double weights = Double.parseDouble(weight);
-						double v1 = w * weights;
-						num += v1;
-					} else {
-						continue;
-					}
-
-				}
-			}
-			// 排序
-			List<Map.Entry<String, Object>> entryList2 = new ArrayList<Map.Entry<String, Object>>(result1.entrySet());
-			Collections.sort(entryList2, new Comparator<Map.Entry<String, Object>>() {
-				@Override
-				public int compare(Entry<String, Object> me1, Entry<String, Object> me2) {
-					return me2.getValue().toString().compareTo(me1.getValue().toString()); // 升序排序
-				}
-			});
-			//拼接前3位降雨最大的区域
-			double v3 = (double) Math.round(num * 10) / 10;
-			String text = "全市日平均降雨量:" + v3 + "(毫米)。 ";
-			String text1 = "县市区平均降雨量前3位为: ";
-			String tx = "";
-			for (int i = 0; i < entryList2.size(); i++) {
-				Map mapa = new HashMap();
-				String codes = entryList2.get(i).getKey();
-				String values = entryList2.get(i).getValue().toString();
-				Double a = Double.parseDouble(values);
-				double as = (double) Math.round(a * 10) / 10;
-				for (int j = 0; j < list.size(); j++) {
-					if (codes.equals(list.get(j).get("STATION_CODE").toString())) {
-						String station_name = list.get(j).get("STATION_NAME").toString();
-						mapa.put("region", station_name);
-						mapa.put("dyp", as);
-						listc.add(mapa);
-						if (i < 3) {
-							tx += station_name + "降雨量为:" + as + "(毫米),";
-						}
-					}
-
-				}
-			}
-			mapc.put("List", listc);
-			mapc.put("Num", mapAll);
-			mapc.put("text", yday + text);
-			lists.add(mapc);
-		}
-		return R.data(lists);
-	}
+//	/**
+//	 * 面降雨量
+//	 */
+//	@GetMapping("/selectReM")
+//	public R selectReM(String beginTime, String endTime) {
+//		String substring = beginTime.substring(0, 10);
+//		String r = beginTime.substring(11, 13);
+//		//截取月日
+//		String[] strs = substring.split("-");
+//		//月
+//		String year = strs[1].toString();
+//		//日
+//		String day = strs[2].toString();
+//		String substrings = endTime.substring(0, 10);
+//		String rs = endTime.substring(11, 13);
+//		//截取月日
+//		String[] strss = substrings.split("-");
+//		//月
+//		String years = strss[1].toString();
+//		//日
+//		String days = strss[2].toString();
+//		String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时";
+//		//最新雨量值
+//		List<Map<String, Object>> map = regionWeightService.selectReM(beginTime, endTime);
+//		List<Map<String, Object>> mapAll = regionWeightService.selectAll();
+//		//权重值
+//		List<Map<String, Object>> list = regionWeightService.selectWeight();
+//		Map map1 = new HashMap();
+//		Map mapc = new HashMap();
+//		List<Map<String, Object>> list1 = new ArrayList<Map<String, Object>>();
+//		List<Map<String, Object>> lists = new ArrayList<Map<String, Object>>();
+//		List<Map<String, Object>> listc = new ArrayList<Map<String, Object>>();
+//		double v = 0;
+//		//统计抚州市雨量
+//		Double num = 0.0;
+//		String region_code = null;
+//		if (map.size() == 0) {
+//			List<Map<String, Object>> l = new ArrayList<Map<String, Object>>();
+//			List<Map<String, Object>> m = new ArrayList<Map<String, Object>>();
+//			mapc.put("List", l);
+//			mapc.put("Num", m);
+//			mapc.put("text", yday + "暂无降雨信息。");
+//			lists.add(mapc);
+//		} else {
+//			for (int i = 0; i < map.size(); i++) {
+//				region_code = map.get(i).get("REGION_CODE").toString();
+//				//获取行政区编码
+//				if (i != 0) {
+//					String region_code1 = map.get(i - 1).get("REGION_CODE").toString();
+//					if (!region_code.equals(region_code1)) {
+//						map1.put("id", region_code1);
+//						map1.put("value", v);
+//						list1.add(map1);
+//						v = 0;
+//						map1 = new HashMap();
+//						for (int j = 0; j < list.size(); j++) {
+//							if (region_code.equals(list.get(j).get("STATION_CODE").toString())) {
+//								BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP");
+//								double drp = bigDecimaldrp.floatValue();
+//								String weight1 = map.get(i).get("WEIGHT").toString();
+//								float weight = Float.parseFloat(weight1);
+//								v += drp * weight;
+//								break;
+//							}
+//						}
+//					} else {
+//						for (int j = 0; j < list.size(); j++) {
+//							if (region_code.equals(list.get(j).get("STATION_CODE").toString())) {
+//								BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP");
+//								double drp = bigDecimaldrp.floatValue();
+//								String weight1 = map.get(i).get("WEIGHT").toString();
+//								float weight = Float.parseFloat(weight1);
+//								System.out.println(Math.round(drp));
+//								v += drp * weight;
+//								break;
+//							}
+//						}
+//					}
+//				} else {
+//					for (int j = 0; j < list.size(); j++) {
+//						if (region_code.equals(list.get(j).get("STATION_CODE").toString())) {
+//							BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP");
+//							double drp = bigDecimaldrp.floatValue();
+//							String weight1 = map.get(i).get("WEIGHT").toString();
+//							float weight = Float.parseFloat(weight1);
+//							System.out.println(Math.round(drp));
+//							v += drp * weight;
+//							break;
+//						}
+//					}
+//				}
+//			}
+//			map1.put("id", region_code);
+//			map1.put("value", v);
+//			list1.add(map1);
+//			Map<String, Object> result1 = new HashMap<String, Object>();
+//			//县/区面雨量值
+//			for (Map<String, Object> maps : list1) {
+//				String id = maps.get("id").toString();
+//				Double value = Double.parseDouble(maps.get("value").toString());
+//				if (result1.containsKey(id)) {
+//					Double temp = Double.parseDouble(result1.get(id).toString());
+//					value += temp;
+//				}
+//				result1.put(id, value);
+//			}
+//			//计算市的面雨量
+//			for (String k : result1.keySet()) {
+//				for (int c = 0; c < list.size(); c++) {
+//					if (k.equals(list.get(c).get("STATION_CODE").toString())) {
+//						String s = result1.get(k).toString();
+//						Double w = Double.parseDouble(s);
+//						String weight = list.get(c).get("WEIGHT").toString();
+//						Double weights = Double.parseDouble(weight);
+//						double v1 = w * weights;
+//						num += v1;
+//					} else {
+//						continue;
+//					}
+//
+//				}
+//			}
+//			// 排序
+//			List<Map.Entry<String, Object>> entryList2 = new ArrayList<Map.Entry<String, Object>>(result1.entrySet());
+//			Collections.sort(entryList2, new Comparator<Map.Entry<String, Object>>() {
+//				@Override
+//				public int compare(Entry<String, Object> me1, Entry<String, Object> me2) {
+//					return me2.getValue().toString().compareTo(me1.getValue().toString()); // 升序排序
+//				}
+//			});
+//			//拼接前3位降雨最大的区域
+//			double v3 = (double) Math.round(num * 10) / 10;
+//			String text = "全市日平均降雨量:" + v3 + "毫米。 ";
+//			String text1 = "县市区平均降雨量前3位为: ";
+//			String tx = "";
+//			for (int i = 0; i < entryList2.size(); i++) {
+//				Map mapa = new HashMap();
+//				String codes = entryList2.get(i).getKey();
+//				String values = entryList2.get(i).getValue().toString();
+//				Double a = Double.parseDouble(values);
+//				double as = (double) Math.round(a * 10) / 10;
+//				for (int j = 0; j < list.size(); j++) {
+//					if (codes.equals(list.get(j).get("STATION_CODE").toString())) {
+//						String station_name = list.get(j).get("STATION_NAME").toString();
+//						mapa.put("region", station_name);
+//						mapa.put("dyp", as);
+//						listc.add(mapa);
+//						if (i < 3) {
+//							tx += station_name + "降雨量为:" + as + "毫米,";
+//						}
+//					}
+//
+//				}
+//			}
+//			mapc.put("List", listc);
+//			mapc.put("Num", mapAll);
+//			mapc.put("text", yday + text);
+//			lists.add(mapc);
+//		}
+//		return R.data(lists);
+//	}
 
 
-	/**
-	 * 点降雨量(时段降雨,自定义降雨)
-	 *
-	 * @param beginTime
-	 * @param endTime
-	 * @return
-	 */
-	@GetMapping("/selectReD")
-	public R selectReD(String beginTime, String endTime) {
-		String substring = beginTime.substring(0, 10);
-		String r = beginTime.substring(11, 13);
-		//截取月日
-		String[] strs = substring.split("-");
-		//月
-		String year = strs[1].toString();
-		//日
-		String day = strs[2].toString();
-		String substrings = endTime.substring(0, 10);
-		String rs = endTime.substring(11, 13);
-		//截取月日
-		String[] strss = substrings.split("-");
-		//月
-		String years = strss[1].toString();
-		//日
-		String days = strss[2].toString();
-		List<Map<String, Object>> maps = regionWeightService.selectYjs(beginTime, endTime);
-		List<Map<String, Object>> lists = new ArrayList<>();
-		Map<String, Object> map = new HashMap<String, Object>();
-		String text = "";
-		String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时。";
-		//0-10降雨量范围
-		List lista = new ArrayList<>();
-		//10-25降雨量范围
-		List listb = new ArrayList<>();
-		//25-50降雨量范围
-		List listc = new ArrayList<>();
-		//50-100降雨量范围
-		List listd = new ArrayList<>();
-		//100-250降雨量范围
-		List liste = new ArrayList<>();
-		//250降雨量范围
-		List listf = new ArrayList<>();
-		for (int i = 0; i < maps.size(); i++) {
-			if (i < 3) {
-				String addvnm = maps.get(i).get("ADDVNM").toString();
-				String stnm = maps.get(i).get("STNM").toString();
-				BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量
-				double dyp = bigDecimaldyp.doubleValue();
-				if (dyp > 0 && dyp <= 10) {
-					lista.add(maps.get(i));
-				} else if (dyp > 10 && dyp <= 25) {
-					listb.add(maps.get(i));
-				} else if (dyp > 25 && dyp <= 50) {
-					listc.add(maps.get(i));
-				} else if (dyp > 50 && dyp <= 100) {
-					listd.add(maps.get(i));
-				} else if (dyp > 100 && dyp <= 250) {
-					liste.add(maps.get(i));
-				} else if (dyp > 250) {
-					listf.add(maps.get(i));
-				}
-				text += stnm + "站" + dyp + "毫米,";
-			} else {
-				BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量
-				double dyp = bigDecimaldyp.doubleValue();
-				if (dyp > 0 && dyp <= 10) {
-					lista.add(maps.get(i));
-				} else if (dyp > 10 && dyp <= 25) {
-					listb.add(maps.get(i));
-				} else if (dyp > 25 && dyp <= 50) {
-					listc.add(maps.get(i));
-				} else if (dyp > 50 && dyp <= 100) {
-					listd.add(maps.get(i));
-				} else if (dyp > 100 && dyp <= 250) {
-					liste.add(maps.get(i));
-				} else if (dyp > 250) {
-					listf.add(maps.get(i));
-				}
-			}
-		}
-		//0-10
-		map.put("one", lista);
-		//10-25
-		map.put("two", listb);
-		//25-50
-		map.put("three", listc);
-		//50-100
-		map.put("four", listd);
-		//100-250
-		map.put("five", liste);
-		//250
-		map.put("six", listf);
-		String a = "";
-		if (maps.size() == 0) {
-			a = yday + "暂无降雨信息。";
-		} else {
-			a = yday + "站点最大降雨量前3位为:" + text.substring(0, text.length() - 1) + "。";
-		}
-		map.put("text", a);
-		lists.add(map);
-		String fileName = "";
-		// 第一步,创建一个webbook,对应一个Excel文件
-		HSSFWorkbook wb = new HSSFWorkbook();
-		// 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
-		HSSFSheet sheet = wb.createSheet("雨量表");
-		// 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
-		HSSFRow row = sheet.createRow((int) 0);
-		// 第四步,创建单元格,并设置值表头 设置表头居中
-		HSSFCellStyle style = wb.createCellStyle();
-		//style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
-		HSSFCell cell = row.createCell((short) 0);
-		cell.setCellValue("lon");
-		cell = row.createCell((short) 1);
-		cell.setCellValue("lat");
-		cell = row.createCell((short) 2);
-		cell.setCellValue("rain");
-		for (int i = 0; i < maps.size(); i++) {
-			// 第四步,创建单元格,并设置值
-			row = sheet.createRow((int) i + 1);
-			HSSFCell celli = row.createCell((short) 0);
-			row.createCell((short) 0).setCellValue(maps.get(i).get("LGTD").toString());
-			row.createCell((short) 1).setCellValue(maps.get(i).get("LTTD").toString());
-			row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
-		}
-		// 第六步,将文件存到指定位置
-		try {
-			fileName = "D:/pptnd.xlsx";
-			FileOutputStream fout = new FileOutputStream(fileName);
-			wb.write(fout);
-			fout.close();
-			wb.close();
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		Process proc;
-		try {
-			proc = Runtime.getRuntime().exec("python D:\\fz\\fz.py");
-			BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
-			String line = null;
-			while ((line = in.readLine()) != null) {
-				System.out.println(line);
-			}
-			in.close();
-			proc.waitFor();
-		} catch (IOException e) {
-			e.printStackTrace();
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-		return R.data(lists);
-	}
-
+//	/**
+//	 * 点降雨量(时段降雨,自定义降雨)
+//	 *
+//	 * @param beginTime
+//	 * @param endTime
+//	 * @return
+//	 */
+//	@GetMapping("/selectReD")
+//	public R selectReD(String beginTime, String endTime) {
+//		String substring = beginTime.substring(0, 10);
+//		String r = beginTime.substring(11, 13);
+//		//截取月日
+//		String[] strs = substring.split("-");
+//		//月
+//		String year = strs[1].toString();
+//		//日
+//		String day = strs[2].toString();
+//		String substrings = endTime.substring(0, 10);
+//		String rs = endTime.substring(11, 13);
+//		//截取月日
+//		String[] strss = substrings.split("-");
+//		//月
+//		String years = strss[1].toString();
+//		//日
+//		String days = strss[2].toString();
+//		List<Map<String, Object>> maps = regionWeightService.selectYjs(beginTime, endTime);
+//		List<Map<String, Object>> lists = new ArrayList<>();
+//		Map<String, Object> map = new HashMap<String, Object>();
+//		String text = "";
+//		String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时。";
+//		//0-10降雨量范围
+//		List lista = new ArrayList<>();
+//		//10-25降雨量范围
+//		List listb = new ArrayList<>();
+//		//25-50降雨量范围
+//		List listc = new ArrayList<>();
+//		//50-100降雨量范围
+//		List listd = new ArrayList<>();
+//		//100-250降雨量范围
+//		List liste = new ArrayList<>();
+//		//250降雨量范围
+//		List listf = new ArrayList<>();
+//		for (int i = 0; i < maps.size(); i++) {
+//			if (i < 3) {
+//				String addvnm = maps.get(i).get("ADDVNM").toString();
+//				String stnm = maps.get(i).get("STNM").toString();
+//				BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量
+//				double dyp = bigDecimaldyp.doubleValue();
+//				if (dyp > 0 && dyp <= 10) {
+//					lista.add(maps.get(i));
+//				} else if (dyp > 10 && dyp <= 25) {
+//					listb.add(maps.get(i));
+//				} else if (dyp > 25 && dyp <= 50) {
+//					listc.add(maps.get(i));
+//				} else if (dyp > 50 && dyp <= 100) {
+//					listd.add(maps.get(i));
+//				} else if (dyp > 100 && dyp <= 250) {
+//					liste.add(maps.get(i));
+//				} else if (dyp > 250) {
+//					listf.add(maps.get(i));
+//				}
+//				text += stnm + "站" + dyp + "毫米,";
+//			} else {
+//				BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量
+//				double dyp = bigDecimaldyp.doubleValue();
+//				if (dyp > 0 && dyp <= 10) {
+//					lista.add(maps.get(i));
+//				} else if (dyp > 10 && dyp <= 25) {
+//					listb.add(maps.get(i));
+//				} else if (dyp > 25 && dyp <= 50) {
+//					listc.add(maps.get(i));
+//				} else if (dyp > 50 && dyp <= 100) {
+//					listd.add(maps.get(i));
+//				} else if (dyp > 100 && dyp <= 250) {
+//					liste.add(maps.get(i));
+//				} else if (dyp > 250) {
+//					listf.add(maps.get(i));
+//				}
+//			}
+//		}
+//		//0-10
+//		map.put("one", lista);
+//		//10-25
+//		map.put("two", listb);
+//		//25-50
+//		map.put("three", listc);
+//		//50-100
+//		map.put("four", listd);
+//		//100-250
+//		map.put("five", liste);
+//		//250
+//		map.put("six", listf);
+//		String a = "";
+//		if (maps.size() == 0) {
+//			a = yday + "暂无降雨信息。";
+//		} else {
+//			a = yday + "站点最大降雨量前3位为:" + text.substring(0, text.length() - 1) + "。";
+//		}
+//		map.put("text", a);
+//		lists.add(map);
+//		String fileName = "";
+//		// 第一步,创建一个webbook,对应一个Excel文件
+//		HSSFWorkbook wb = new HSSFWorkbook();
+//		// 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
+//		HSSFSheet sheet = wb.createSheet("雨量表");
+//		// 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
+//		HSSFRow row = sheet.createRow((int) 0);
+//		// 第四步,创建单元格,并设置值表头 设置表头居中
+//		HSSFCellStyle style = wb.createCellStyle();
+//		//style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
+//		HSSFCell cell = row.createCell((short) 0);
+//		cell.setCellValue("lon");
+//		cell = row.createCell((short) 1);
+//		cell.setCellValue("lat");
+//		cell = row.createCell((short) 2);
+//		cell.setCellValue("rain");
+//		for (int i = 0; i < maps.size(); i++) {
+//			// 第四步,创建单元格,并设置值
+//			row = sheet.createRow((int) i + 1);
+//			HSSFCell celli = row.createCell((short) 0);
+//			row.createCell((short) 0).setCellValue(maps.get(i).get("LGTD").toString());
+//			row.createCell((short) 1).setCellValue(maps.get(i).get("LTTD").toString());
+//			row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+//		}
+//		// 第六步,将文件存到指定位置
+//		try {
+//			fileName = "D:/pptnd.xlsx";
+//			FileOutputStream fout = new FileOutputStream(fileName);
+//			wb.write(fout);
+//			fout.close();
+//			wb.close();
+//		} catch (Exception e) {
+//			e.printStackTrace();
+//		}
+//		Process proc;
+//		try {
+//			proc = Runtime.getRuntime().exec("python D:\\fz\\fz.py");
+//			BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+//			String line = null;
+//			while ((line = in.readLine()) != null) {
+//				System.out.println(line);
+//			}
+//			in.close();
+//			proc.waitFor();
+//		} catch (IOException e) {
+//			e.printStackTrace();
+//		} catch (InterruptedException e) {
+//			e.printStackTrace();
+//		}
+//		return R.data(lists);
+//	}
+//
 
 	/**
 	 * 流域
-	 */
+	 *//*
 	@GetMapping("/selectReL")
 	public R selectReL(String beginTime, String endTime) {
 		String substring = beginTime.substring(0, 10);
@@ -632,7 +631,7 @@
 			});
 			for (int c = 0; c < listc.size(); c++) {
 				if (c < 3) {
-					text += listc.get(c).get("region").toString() + ":" + listc.get(c).get("dyp") + "(毫米),";
+					text += listc.get(c).get("region").toString() + ":" + listc.get(c).get("dyp") + "毫米,";
 				}
 			}
 			String a = "流域前三的为:" + text.substring(0, text.length() - 1) + "。";
@@ -642,7 +641,7 @@
 			lists.add(mapc);
 		}
 		return R.data(lists);
-	}
+	}*/
 
 	/**
 	 * @param type        类型 0:实时 1 历史
@@ -743,10 +742,24 @@
 
 	}
 
+
+	/**
+	 * 点降雨
+	 *
+	 * @param beginTime
+	 * @param endTime
+	 * @return
+	 */
 	@GetMapping("/selectReDc")
 	public R selectReDc(String beginTime, String endTime) {
 		String substring = beginTime.substring(0, 10);
-		String r = beginTime.substring(11, 13);
+		String t = beginTime.substring(11, 13);
+		String r;
+		if (t.substring(0, 1).equals("0")) {
+			r = beginTime.substring(12, 13);
+		} else {
+			r = beginTime.substring(11, 13);
+		}
 		//截取月日
 		String[] strs = substring.split("-");
 		//月
@@ -754,7 +767,13 @@
 		//日
 		String day = strs[2].toString();
 		String substrings = endTime.substring(0, 10);
-		String rs = endTime.substring(11, 13);
+		String ts = endTime.substring(11, 13);
+		String rs;
+		if (ts.substring(0, 1).equals("0")) {
+			rs = endTime.substring(12, 13);
+		} else {
+			rs = endTime.substring(11, 13);
+		}
 		//截取月日
 		String[] strss = substrings.split("-");
 		//月
@@ -769,11 +788,12 @@
 			strArrays += "'" + split[i] + "',";
 		}
 		String code = strArrays.substring(0, strArrays.length() - 1);
+		long cx = System.currentTimeMillis();//获取当前系统时间(毫秒)
 		List<Map<String, Object>> maps = regionWeightService.ss(beginTime, endTime, code);
 		List<Map<String, Object>> lists = new ArrayList<>();
 		Map<String, Object> map = new HashMap<String, Object>();
 		String text = "";
-		String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时。";
+		String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时";
 		//0-10降雨量范围
 		List lista = new ArrayList<>();
 		//10-25降雨量范围
@@ -791,7 +811,8 @@
 				String addvnm = maps.get(i).get("ADDVNM").toString();
 				String stnm = maps.get(i).get("STNM").toString();
 				BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量
-				double dyp = bigDecimaldyp.doubleValue();
+				double dyps = bigDecimaldyp.doubleValue();
+				double dyp = (double) Math.round(dyps * 10) / 10;
 				if (dyp > 0 && dyp <= 10) {
 					lista.add(maps.get(i));
 				} else if (dyp > 10 && dyp <= 25) {
@@ -805,10 +826,19 @@
 				} else if (dyp > 250) {
 					listf.add(maps.get(i));
 				}
-				text += stnm + "站" + dyp + "毫米,";
+				if (i == 0) {
+					text += addvnm + stnm + "站" + dyp + "毫米,";
+				}
+				if (i == 1) {
+					text += addvnm + stnm + "站" + dyp + "毫米次之,";
+				}
+				if (i == 2) {
+					text += addvnm + stnm + "站" + dyp + "毫米第三,";
+				}
 			} else {
 				BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量
-				double dyp = bigDecimaldyp.doubleValue();
+				double dyps = bigDecimaldyp.doubleValue();
+				double dyp = (double) Math.round(dyps * 10) / 10;
 				if (dyp > 0 && dyp <= 10) {
 					lista.add(maps.get(i));
 				} else if (dyp > 10 && dyp <= 25) {
@@ -840,59 +870,122 @@
 		if (maps.size() == 0) {
 			a = yday + "暂无降雨信息。";
 		} else {
-			a = yday + "点降雨量前三为:" + text.substring(0, text.length() - 1) + "。";
+			a = yday + "点最大降雨量为" + text.substring(0, text.length() - 1) + "。";
 		}
 		map.put("text", a);
 		lists.add(map);
-		String fileName = "";
-		// 第一步,创建一个webbook,对应一个Excel文件
-		HSSFWorkbook wb = new HSSFWorkbook();
-		// 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
-		HSSFSheet sheet = wb.createSheet("雨量表");
-		// 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
-		HSSFRow row = sheet.createRow((int) 0);
-		// 第四步,创建单元格,并设置值表头 设置表头居中
-		HSSFCellStyle style = wb.createCellStyle();
-		//style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
-		HSSFCell cell = row.createCell((short) 0);
-		cell.setCellValue("lon");
-		cell = row.createCell((short) 1);
-		cell.setCellValue("lat");
-		cell = row.createCell((short) 2);
-		cell.setCellValue("rain");
-		for (int i = 0; i < maps.size(); i++) {
-			// 第四步,创建单元格,并设置值
-			row = sheet.createRow((int) i + 1);
-			HSSFCell celli = row.createCell((short) 0);
-			row.createCell((short) 0).setCellValue(maps.get(i).get("LGTD").toString());
-			row.createCell((short) 1).setCellValue(maps.get(i).get("LTTD").toString());
-			row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
-		}
-		// 第六步,将文件存到指定位置
-		try {
-			fileName = "D:/pptnd.xlsx";
-			FileOutputStream fout = new FileOutputStream(fileName);
-			wb.write(fout);
-			fout.close();
-			wb.close();
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		Process proc;
-		try {
-			proc = Runtime.getRuntime().exec("python D:\\fz\\fz.py");
-			BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
-			String line = null;
-			while ((line = in.readLine()) != null) {
-				System.out.println(line);
+		Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+		long url = timestamp.getTime();
+		Map m = new HashMap();
+		m.put("url", url + ".png");
+		lists.add(m);
+		System.out.print("程序执行时间为1:");
+		System.out.println(System.currentTimeMillis() - cx + "毫秒");
+		long bx = System.currentTimeMillis();//获取当前系统时间(毫秒)
+		Thread thread = new Thread(new Runnable() {
+			@Override
+			public void run() {
+				String fileName = "";
+				// 第一步,创建一个webbook,对应一个Excel文件
+				HSSFWorkbook wb = new HSSFWorkbook();
+				// 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
+				HSSFSheet sheet = wb.createSheet("雨量表");
+				// 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
+				HSSFRow row = sheet.createRow((int) 0);
+				// 第四步,创建单元格,并设置值表头 设置表头居中
+				HSSFCellStyle style = wb.createCellStyle();
+				//style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
+				HSSFCell cell = row.createCell((short) 0);
+				cell.setCellValue("lon");
+				cell = row.createCell((short) 1);
+				cell.setCellValue("lat");
+				cell = row.createCell((short) 2);
+				cell.setCellValue("rain");
+				for (int i = 0; i < maps.size(); i++) {
+					String stcd = maps.get(i).get("STCD").toString();
+					// 第四步,创建单元格,并设置值
+					row = sheet.createRow((int) i + 1);
+					HSSFCell celli = row.createCell((short) 0);
+					row.createCell((short) 0).setCellValue(maps.get(i).get("LGTD").toString());
+					row.createCell((short) 1).setCellValue(maps.get(i).get("LTTD").toString());
+					row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+					if (stcd.equals("62455350")) {
+						row.createCell((short) 0).setCellValue("117.344876");
+						row.createCell((short) 1).setCellValue("27.827067");
+						row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+					}
+					if (stcd.equals("62334845")) {
+						row.createCell((short) 0).setCellValue("115.625720");
+						row.createCell((short) 1).setCellValue("27.152794");
+						row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+					}
+					if (stcd.equals("62433800")) {
+						row.createCell((short) 0).setCellValue("115.618546");
+						row.createCell((short) 1).setCellValue("27.683604");
+						row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+					}
+					if (stcd.equals("62436760")) {
+						row.createCell((short) 0).setCellValue("116.060889");
+						row.createCell((short) 1).setCellValue("28.216806");
+						row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+					}
+					if (stcd.equals("62437250")) {
+						row.createCell((short) 0).setCellValue("116.622783");
+						row.createCell((short) 1).setCellValue("28.489384");
+						row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+					}
+					if (stcd.equals("62433700")) {
+						row.createCell((short) 0).setCellValue("115.558771");
+						row.createCell((short) 1).setCellValue("27.518623");
+						row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+					}
+					if (stcd.equals("62425740")) {
+						row.createCell((short) 0).setCellValue("117.208587");
+						row.createCell((short) 1).setCellValue("27.298647");
+						row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+					}
+					if (stcd.equals("62437235")) {
+						row.createCell((short) 0).setCellValue("116.780591");
+						row.createCell((short) 1).setCellValue("28.391352");
+						row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+					}
+					if (stcd.equals("62437250")) {
+						row.createCell((short) 0).setCellValue("116.555834");
+						row.createCell((short) 1).setCellValue("28.518077");
+						row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+					}
+				}
+				// 第六步,将文件存到指定位置
+				try {
+					fileName = "D:/pptnd.xlsx";
+					FileOutputStream fout = new FileOutputStream(fileName);
+					wb.write(fout);
+					fout.close();
+					wb.close();
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+				Process proc;
+				String[] args1 = new String[]{"python", "D:\\fz\\fz.py", String.valueOf(url)};
+				try {
+					proc = Runtime.getRuntime().exec(args1);
+					BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+					String line = null;
+					while ((line = in.readLine()) != null) {
+						//System.out.println(line);
+					}
+					in.close();
+					proc.waitFor();
+				} catch (IOException e) {
+					e.printStackTrace();
+				} catch (InterruptedException e) {
+					e.printStackTrace();
+				}
 			}
-			in.close();
-			proc.waitFor();
-		} catch (IOException e) {
-			e.printStackTrace();
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
+		});
+		thread.start();
+		System.out.print("程序执行时间为2:");
+		System.out.println(System.currentTimeMillis() - bx + "毫秒");
 		return R.data(lists);
 	}
 
@@ -902,7 +995,13 @@
 	@GetMapping("/selectReMs")
 	public R selectReMs(String beginTime, String endTime) {
 		String substring = beginTime.substring(0, 10);
-		String r = beginTime.substring(11, 13);
+		String t = beginTime.substring(11, 13);
+		String r;
+		if (t.substring(0, 1).equals("0")) {
+			r = beginTime.substring(12, 13);
+		} else {
+			r = beginTime.substring(11, 13);
+		}
 		//截取月日
 		String[] strs = substring.split("-");
 		//月
@@ -910,14 +1009,20 @@
 		//日
 		String day = strs[2].toString();
 		String substrings = endTime.substring(0, 10);
-		String rs = endTime.substring(11, 13);
+		String ts = endTime.substring(11, 13);
+		String rs;
+		if (ts.substring(0, 1).equals("0")) {
+			rs = endTime.substring(12, 13);
+		} else {
+			rs = endTime.substring(11, 13);
+		}
 		//截取月日
 		String[] strss = substrings.split("-");
 		//月
 		String years = strss[1].toString();
 		//日
 		String days = strss[2].toString();
-		String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时。";
+		String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时";
 		String ss = regionWeightService.selectCodeM();
 		String[] split = ss.split(",");
 		String strArrays = "";
@@ -926,8 +1031,14 @@
 		}
 		String code = strArrays.substring(0, strArrays.length() - 1);
 		//List<Map<String, Object>> map = regionWeightService.selectReM(beginTime, endTime);
-		List<Map<String, Object>> map = regionWeightService.selectReMs(beginTime, endTime,code);
-		List<Map<String, Object>> mapAll = regionWeightService.selectAll();
+		long cx = System.currentTimeMillis();//获取当前系统时间(毫秒)
+		List<Map<String, Object>> map = regionWeightService.selectReMs(beginTime, endTime, code);
+		System.out.print("程序执行时间为1:");
+		System.out.println(System.currentTimeMillis() - cx + "毫秒");
+		long b = System.currentTimeMillis();//获取当前系统时间(毫秒)
+		List<Map<String, Object>> mapAll = regionWeightService.selectAll(beginTime, endTime, code);
+		System.out.print("程序执行时间为2:");
+		System.out.println(System.currentTimeMillis() - b + "毫秒");
 		//权重值
 		List<Map<String, Object>> list = regionWeightService.selectWeight();
 		Map map1 = new HashMap();
@@ -975,7 +1086,7 @@
 								double drp = bigDecimaldrp.floatValue();
 								String weight1 = map.get(i).get("WEIGHT").toString();
 								float weight = Float.parseFloat(weight1);
-								System.out.println(Math.round(drp));
+								//System.out.println(Math.round(drp));
 								v += drp * weight;
 								break;
 							}
@@ -988,7 +1099,6 @@
 							double drp = bigDecimaldrp.floatValue();
 							String weight1 = map.get(i).get("WEIGHT").toString();
 							float weight = Float.parseFloat(weight1);
-							System.out.println(Math.round(drp));
 							v += drp * weight;
 							break;
 						}
@@ -1035,7 +1145,7 @@
 			});
 			//拼接前3位降雨最大的区域
 			double v3 = (double) Math.round(num * 10) / 10;
-			String text = "全市日平均降雨量:" + v3 + "(毫米)。 ";
+			String text = "全市日平均降雨量:" + v3 + "毫米。 ";
 			String text1 = "县市区平均降雨量前3位为: ";
 			String tx = "";
 			for (int i = 0; i < entryList2.size(); i++) {
@@ -1051,7 +1161,7 @@
 						mapa.put("dyp", as);
 						listc.add(mapa);
 						if (i < 3) {
-							tx += station_name + "降雨量为:" + as + "(毫米),";
+							tx += station_name + "降雨量为:" + as + "毫米,";
 						}
 					}
 
@@ -1065,4 +1175,336 @@
 		return R.data(lists);
 	}
 
+	/**
+	 * 流域
+	 */
+	@GetMapping("/selectReL")
+	public R selectReL(String beginTime, String endTime) {
+		String substring = beginTime.substring(0, 10);
+		String t = beginTime.substring(11, 13);
+		String r;
+		if (t.substring(0, 1).equals("0")) {
+			r = beginTime.substring(12, 13);
+		} else {
+			r = beginTime.substring(11, 13);
+		}
+		//截取月日
+		String[] strs = substring.split("-");
+		//月
+		String year = strs[1].toString();
+		//日
+		String day = strs[2].toString();
+		String substrings = endTime.substring(0, 10);
+		String ts = endTime.substring(11, 13);
+		String rs;
+		if (t.substring(0, 1).equals("0")) {
+			rs = endTime.substring(12, 13);
+		} else {
+			rs = endTime.substring(11, 13);
+		}
+		//截取月日
+		String[] strss = substrings.split("-");
+		//月
+		String years = strss[1].toString();
+		//日
+		String days = strss[2].toString();
+		String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时。";
+		String text = "";
+		String ss = regionWeightService.selectCodeL();
+		String[] split = ss.split(",");
+		String strArrays = "";
+		for (int i = 0; i < split.length; i++) {
+			strArrays += "'" + split[i] + "',";
+		}
+		String codel = strArrays.substring(0, strArrays.length() - 1);
+		//最新雨量值
+		List<Map<String, Object>> map = regionWeightService.selectReL(beginTime, endTime, codel);
+//		//色斑图
+//		String fileName = "";
+//		// 第一步,创建一个webbook,对应一个Excel文件
+//		HSSFWorkbook wb = new HSSFWorkbook();
+//		// 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
+//		HSSFSheet sheet = wb.createSheet("土壤湿度表");
+//		// 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
+//		HSSFRow row = sheet.createRow((int) 0);
+//		// 第四步,创建单元格,并设置值表头 设置表头居中
+//		HSSFCellStyle style = wb.createCellStyle();
+//		//style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
+//		HSSFCell cell = row.createCell((short) 0);
+//		cell.setCellValue("lon");
+//		cell = row.createCell((short) 1);
+//		cell.setCellValue("lat");
+//		cell = row.createCell((short) 2);
+//		cell.setCellValue("rain");
+//		for (int i = 0; i < map.size(); i++) {
+//			// 第四步,创建单元格,并设置值
+//			row = sheet.createRow((int) i + 1);
+//			HSSFCell celli = row.createCell((short) 0);
+//			row.createCell((short) 0).setCellValue(map.get(i).get("LGTD").toString());
+//			row.createCell((short) 1).setCellValue(map.get(i).get("LTTD").toString());
+//			row.createCell((short) 2).setCellValue(map.get(i).get("DRP").toString());
+//		}
+//		// 第六步,将文件存到指定位置
+//		try {
+//			fileName = "D:/myl.xlsx";
+//			FileOutputStream fout = new FileOutputStream(fileName);
+//			wb.write(fout);
+//			fout.close();
+//			wb.close();
+//		} catch (Exception e) {
+//			e.printStackTrace();
+//		}
+//		Process proc;
+//		try {
+//			proc = Runtime.getRuntime().exec("python D:\\fz\\myl.py");
+//			BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+//			String line = null;
+//			while ((line = in.readLine()) != null) {
+//				System.out.println(line);
+//			}
+//			in.close();
+//			proc.waitFor();
+//		} catch (IOException e) {
+//			e.printStackTrace();
+//		} catch (InterruptedException e) {
+//			e.printStackTrace();
+//		}
+		//权重值
+		List<Map<String, Object>> list = regionWeightService.selectWeights();
+		List<Map<String, Object>> list2 = regionWeightService.selectLALL();
+		List<Map<String, Object>> list3 = regionWeightService.selectLNam();
+		List<Map<String, Object>> list4 = regionWeightService.selectLy(beginTime, endTime, codel);
+		Map mc = new HashMap();
+		for (int a = 0; a < list2.size(); a++) {
+			for (int b = 0; b < list3.size(); b++) {
+				String code = list2.get(a).get("code").toString();
+				String num = list2.get(a).get("num").toString();
+				String code1 = list3.get(b).get("code").toString();
+				if (code.equals(code1)) {
+					mc.put(list3.get(b).get("cname").toString(), num);
+				}
+			}
+		}
+		Map map1 = new HashMap();
+		Map mapc = new HashMap();
+		List<Map<String, Object>> list1 = new ArrayList<Map<String, Object>>();
+		List<Map<String, Object>> lists = new ArrayList<Map<String, Object>>();
+		List<Map<String, Object>> listc = new ArrayList<Map<String, Object>>();
+		double v = 0;
+		//统计抚州市雨量
+		Double num = 0.0;
+		String region_code = null;
+		if (map.size() == 0) {
+			List<Map<String, Object>> l = new ArrayList<Map<String, Object>>();
+			List<Map<String, Object>> m = new ArrayList<Map<String, Object>>();
+			mapc.put("List", l);
+			mapc.put("Num", m);
+			mapc.put("text", yday + "暂无流域信息。");
+			lists.add(mapc);
+		} else {
+			for (int i = 0; i < map.size(); i++) {
+				region_code = map.get(i).get("REGION_CODE").toString();
+				//获取行政区编码
+				if (i != 0) {
+					String region_code1 = map.get(i - 1).get("REGION_CODE").toString();
+					if (!region_code.equals(region_code1)) {
+						map1.put("id", region_code1);
+						map1.put("value", v);
+						list1.add(map1);
+						v = 0;
+						map1 = new HashMap();
+						for (int j = 0; j < list.size(); j++) {
+							if (region_code.equals(list.get(j).get("STATION_CODE").toString())) {
+								BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP");
+								double drp = bigDecimaldrp.floatValue();
+								String weight1 = map.get(i).get("WEIGHT").toString();
+								float weight = Float.parseFloat(weight1);
+								v += drp * weight;
+								break;
+							}
+						}
+					} else {
+						for (int j = 0; j < list.size(); j++) {
+							if (region_code.equals(list.get(j).get("STATION_CODE").toString())) {
+								BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP");
+								double drp = bigDecimaldrp.floatValue();
+								String weight1 = map.get(i).get("WEIGHT").toString();
+								float weight = Float.parseFloat(weight1);
+								v += drp * weight;
+								break;
+							}
+						}
+					}
+				} else {
+					for (int j = 0; j < list.size(); j++) {
+						if (region_code.equals(list.get(j).get("STATION_CODE").toString())) {
+							BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP");
+							double drp = bigDecimaldrp.floatValue();
+							String weight1 = map.get(i).get("WEIGHT").toString();
+							float weight = Float.parseFloat(weight1);
+							v += drp * weight;
+							break;
+						}
+					}
+				}
+			}
+			map1.put("id", region_code);
+			map1.put("value", v);
+			list1.add(map1);
+			Map<String, Object> result1 = new HashMap<String, Object>();
+			//县/区面雨量值
+			for (Map<String, Object> maps : list1) {
+				String id = maps.get("id").toString();
+				Double value = Double.parseDouble(maps.get("value").toString());
+				if (result1.containsKey(id)) {
+					Double temp = Double.parseDouble(result1.get(id).toString());
+					value += temp;
+				}
+				result1.put(id, value);
+			}
+			// 排序
+			List<Map.Entry<String, Object>> entryList2 = new ArrayList<Map.Entry<String, Object>>(result1.entrySet());
+			Collections.sort(entryList2, new Comparator<Map.Entry<String, Object>>() {
+				@Override
+				public int compare(Entry<String, Object> me1, Entry<String, Object> me2) {
+					return me2.getValue().toString().compareTo(me1.getValue().toString()); // 升序排序
+				}
+			});
+			for (int i = 0; i < entryList2.size(); i++) {
+				Map mapa = new HashMap();
+				String codes = entryList2.get(i).getKey();
+				String values = entryList2.get(i).getValue().toString();
+				Double a = Double.parseDouble(values);
+				double as = (double) Math.round(a * 10) / 10;
+				for (int j = 0; j < list.size(); j++) {
+					if (codes.equals(list.get(j).get("STATION_CODE").toString())) {
+						String station_name = list.get(j).get("STATION_NAME").toString();
+						mapa.put("region", station_name);
+						mapa.put("dyp", as);
+						listc.add(mapa);
+					}
+
+				}
+			}
+			Collections.sort(listc, new Comparator<Map<String, Object>>() {
+				public int compare(Map<String, Object> o1, Map<String, Object> o2) {
+					return (Double) o1.get("dyp") < (Double) o2.get("dyp") ? 1 : ((Double) o1.get("dyp") == (Double) o2.get("dyp") ? 0 : -1);
+				}
+			});
+			for (int c = 0; c < listc.size(); c++) {
+				if (c < 3) {
+					text += listc.get(c).get("region").toString() + ":" + listc.get(c).get("dyp") + "毫米,";
+				}
+			}
+			String a = "流域前三的为:" + text.substring(0, text.length() - 1) + "。";
+			mapc.put("List", listc);
+			mapc.put("Num", mc);
+			mapc.put("NumALL", list4);
+			mapc.put("text", yday + a);
+			lists.add(mapc);
+		}
+		return R.data(lists);
+	}
+
+	/**
+	 * 时段降雨
+	 */
+	@ApiLog("详情")
+	@PostMapping("/selectDayStation")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "时段降雨", notes = "传入code,dateBegin,dateEnd")
+	public R selectDayStation(String code, String dateBegin, String dateEnd, String sd) {
+		return R.data(regionWeightService.selectDayStation(code, dateBegin, dateEnd, sd));
+	}
+
+	/**
+	 * 逐日雨量
+	 */
+	@ApiLog("详情")
+	@PostMapping("/selectStation")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逐日雨量", notes = "传入code,dateBegin,dateEnd")
+	public R selectStation(String code, String dateBegin, String dateEnd) {
+		return R.data(regionWeightService.selectStation(code, dateBegin, dateEnd));
+	}
+
+	/**
+	 * 特征雨量
+	 */
+	@ApiLog("详情")
+	@PostMapping("/selectPptnTz")
+	@ApiOperationSupport(order = 11)
+	@ApiOperation(value = "特征雨量", notes = "")
+	public R selectPptnTz(String code) {
+		List<Map<String, String>> lists = new ArrayList<>();
+		Map<String, String> map = new HashMap<>(16);
+		//当前时间
+		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
+		String time = df.format(new Date());
+
+		//查询前一小时数据
+		Calendar calendar = Calendar.getInstance();
+		calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - 1);
+		String dateEnd1 = df.format(calendar.getTime());
+		String map1 = regionWeightService.selectPptnTz(code, dateEnd1, time);
+		map.put("drp1", map1);
+
+		//查询前2小时数据
+		Calendar calendar2 = Calendar.getInstance();
+		calendar2.set(Calendar.HOUR_OF_DAY, calendar2.get(Calendar.HOUR_OF_DAY) - 2);
+		String dateEnd2 = df.format(calendar2.getTime());
+		String map2 = regionWeightService.selectPptnTz(code, dateEnd2, time);
+		map.put("drp2", map2);
+
+		//三个小时前的时间
+		Calendar calendar3 = Calendar.getInstance();
+		calendar3.set(Calendar.HOUR_OF_DAY, calendar3.get(Calendar.HOUR_OF_DAY) - 3);
+		String dateEnd3 = df.format(calendar3.getTime());
+		String map3 = regionWeightService.selectPptnTz(code, dateEnd3, time);
+		map.put("drp3", map3);
+
+		//六个小时前的时间
+		Calendar calendar6 = Calendar.getInstance();
+		calendar6.set(Calendar.HOUR_OF_DAY, calendar6.get(Calendar.HOUR_OF_DAY) - 6);
+		String dateEnd6 = df.format(calendar6.getTime());
+		String map6 = regionWeightService.selectPptnTz(code, dateEnd6, time);
+		map.put("drp6", map6);
+
+		//十二个小时前的时间
+		Calendar calendar12 = Calendar.getInstance();
+		calendar12.set(Calendar.HOUR_OF_DAY, calendar12.get(Calendar.HOUR_OF_DAY) - 12);
+		String dateEnd12 = df.format(calendar12.getTime());
+		String map12 = regionWeightService.selectPptnTz(code, dateEnd12, time);
+		map.put("drp12", map12);
+
+		//二十四个小时前的时间
+		Calendar calendar24 = Calendar.getInstance();
+		calendar24.set(Calendar.HOUR_OF_DAY, calendar24.get(Calendar.HOUR_OF_DAY) - 24);
+		String dateEnd24 = df.format(calendar24.getTime());
+		String map24 = regionWeightService.selectPptnTz(code, dateEnd24, time);
+		map.put("drp24", map24);
+
+		//四十八个小时前的时间
+		Calendar calendar48 = Calendar.getInstance();
+		calendar48.set(Calendar.HOUR_OF_DAY, calendar48.get(Calendar.HOUR_OF_DAY) - 48);
+		String dateEnd48 = df.format(calendar48.getTime());
+		String map48 = regionWeightService.selectPptnTz(code, dateEnd48, time);
+		map.put("drp48", map48);
+
+		//七十二个小时前的时间
+		Calendar calendar72 = Calendar.getInstance();
+		calendar72.set(Calendar.HOUR_OF_DAY, calendar72.get(Calendar.HOUR_OF_DAY) - 72);
+		String dateEnd72 = df.format(calendar72.getTime());
+		String map72 = regionWeightService.selectPptnTz(code, dateEnd72, time);
+		map.put("drp72", map72);
+
+		map.put("time", time);
+		lists.add(map);
+
+		return R.data(lists);
+	}
+
+
 }
+
+

--
Gitblit v1.9.3