From 39caebba35fc84824f5cd51d189fe322d5145803 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Tue, 09 Nov 2021 16:15:14 +0800
Subject: [PATCH] 1.山洪

---
 src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java | 1039 +++++++++++++++++++++++++++++++--------------------------
 1 files changed, 565 insertions(+), 474 deletions(-)

diff --git a/src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java b/src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java
index 07a9204..8179737 100644
--- a/src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java
+++ b/src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java
@@ -55,6 +55,7 @@
 import java.math.BigDecimal;
 import java.net.URLEncoder;
 import java.sql.Timestamp;
+import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -759,64 +760,71 @@
 
 	}
 
-//	/**
-//	 * 土壤湿度计算
-//	 *
-//	 * @return
-//	 */
-//	@GetMapping("/soleval")
-//	public R soleval() {
-//		mountainrainService.soildel();
-//		int intervals = 31;
-//		ArrayList passDaysList = new ArrayList<>();
-//		for (int i = 0; i < intervals; i++) {
-//			passDaysList.add(getDays(i, false));
-//		}
-//		Collections.sort(passDaysList);
-//		//String s = mountainrainService.selectCode();
-//		String s = regionWeightService.selectCode();
-//		String[] split = s.split(",");
-//		String strArrays = "";
-//		for (int i = 0; i < split.length; i++) {
-//			strArrays += "'" + split[i] + "',";
-//		}
-//		String code = strArrays.substring(0, strArrays.length() - 1);
-//		for (int i = 0; i < split.length; i++) {
-//			Integer num = 30;
-//			double v1 = 0;
-//			String stcd = null;
-//			for (int j = 0; j < passDaysList.size() - 2; j++) {
-//				List<Map<String, Object>> map = mountainrainService.selectMtwo(passDaysList.get(j).toString(), passDaysList.get(j + 1).toString(), code);
-//				if (map.size() == 0 || i > map.size() - 1) {
-//					break;
-//				}
-//				BigDecimal w = (BigDecimal) map.get(i).get("drp");
-//				double drp = w.doubleValue();
-//				stcd = map.get(i).get("STCD").toString();
-//				//计算湿度
-//				if (j == 0) {
-//					v1 = formatDouble1((num + drp) * 0.85);
-//					if (v1 > 60) {
-//						v1 = 60;
-//					}
-//				} else {
-//					v1 += drp;
-//					v1 = formatDouble1(v1 * 0.85);
-//					if (v1 > 60) {
-//						v1 = 60;
-//					}
-//				}
-//			}
-//			if (v1 > 60) {
-//				mountainrainService.soleInster(stcd, "60");
-//			} else {
-//				String a = String.valueOf(v1);
-//				mountainrainService.soleInster(stcd, a);
-//			}
-//		}
-//
-//		return R.success("成功");
-//	}
+	/**
+	 * 土壤湿度计算
+	 *
+	 * @return
+	 */
+	@GetMapping("/soleval")
+	public R soleval(String time, int b) {
+		//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		//String dateNow = sdf.format(new Date());
+		String dateNow = time;
+		//mountainrainService.soildel();
+		int intervals = 32 + b;
+		ArrayList passDaysList = new ArrayList<>();
+		for (int i = 1 + b; i < intervals; i++) {
+			passDaysList.add(getDays(i, false));
+		}
+		Collections.sort(passDaysList);
+		//String s = mountainrainService.selectCode();
+		String s = regionWeightService.selectCode();
+		String[] split = s.split(",");
+		String strArrays = "";
+		for (int i = 0; i < split.length; i++) {
+			strArrays += "'" + split[i] + "',";
+		}
+		String code = strArrays.substring(0, strArrays.length() - 1);
+		for (int i = 0; i < split.length; i++) {
+			Integer num = 30;
+			double v1 = 0;
+			String stcd = null;
+			for (int j = 0; j < passDaysList.size() - 2; j++) {
+				List<Map<String, Object>> map = mountainrainService.selectMtwo(passDaysList.get(j).toString(), passDaysList.get(j + 1).toString(), code);
+				if (map.size() == 0 || i > map.size() - 1) {
+					//stcd=split[i];
+					break;
+				}
+				BigDecimal w = (BigDecimal) map.get(i).get("drp");
+				double drp = w.doubleValue();
+				stcd = map.get(i).get("STCD").toString();
+				//计算湿度
+				if (j == 0) {
+					v1 = formatDouble1((num + drp) * 0.85);
+					if (v1 > 60) {
+						v1 = 60;
+					}
+				} else {
+					v1 += drp;
+					v1 = formatDouble1(v1 * 0.85);
+					if (v1 > 60) {
+						v1 = 60;
+					}
+				}
+			}
+			if (stcd != null) {
+				if (v1 > 60) {
+					mountainrainService.soleInster(stcd, "60", dateNow);
+				} else {
+					String a = String.valueOf(v1);
+					mountainrainService.soleInster(stcd, a, dateNow);
+				}
+			}
+
+		}
+
+		return R.success("成功");
+	}
 
 	public static double formatDouble1(double d) {
 		return (double) Math.round(d * 10) / 10;
@@ -973,7 +981,7 @@
 	 * @return
 	 */
 	@GetMapping("/selectsmriver")
-	public R selectsmriver(String time) {
+	public R selectsmriver(String time) throws ParseException {
 		Date date = null;
 		// 把Date按照格式转换成字符串
 		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -983,7 +991,13 @@
 			e.printStackTrace();
 		}
 		String dateEnd = sdf.format(date);
-		List<Map<String, Object>> selctsmriver = mountainrainService.selctsmriver(time, dateEnd);
+		DateFormat sdfc = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		Date datess = sdfc.parse(time);
+		String now = sdfc.format(datess);
+		//当前时间的前24小时
+		Date beforeHour1 = beforeHourToNowDate(now, 24);
+		String begintime24 = sdf.format(beforeHour1);
+		List<Map<String, Object>> selctsmriver = mountainrainService.selctsmriver(time, dateEnd, begintime24);
 		//预警数据
 		List listyj = new ArrayList();
 		//无预警数据
@@ -1016,7 +1030,7 @@
 	 * @return
 	 */
 	@GetMapping("/selectbgriver")
-	public R selectbgriver(String time) {
+	public R selectbgriver(String time) throws ParseException {
 		Date date = null;
 		// 把Date按照格式转换成字符串
 		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -1026,7 +1040,13 @@
 			e.printStackTrace();
 		}
 		String dateEnd = sdf.format(date);
-		List<Map<String, Object>> selctsmriver = mountainrainService.selctbgriver(time, dateEnd);
+		DateFormat sdfc = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		Date datess = sdfc.parse(time);
+		String now = sdfc.format(datess);
+		//当前时间的前24小时
+		Date beforeHour1 = beforeHourToNowDate(now, 24);
+		String begintime24 = sdf.format(beforeHour1);
+		List<Map<String, Object>> selctsmriver = mountainrainService.selctbgriver(time, dateEnd, begintime24);
 		//预警数据
 		List listyj = new ArrayList();
 		//无预警数据
@@ -1135,16 +1155,23 @@
 			String times = time;
 
 			String dateEnd1 = dateEnds1;
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+			Date date = null;
+			try {
+				date = sdf.parse(time);
+			} catch (ParseException e) {
+				e.printStackTrace();
+			}
+			String stime = sdf.format(date);
 			//对应雨量站
 			String s = mountainrainService.selectCode();
 			String[] split = s.split(",");
 			String strArrays = "";
 			for (int i = 0; i < split.length; i++) {
-				System.out.println(split.length);
 				strArrays += "'" + split[i] + "',";
 			}
 			String code = strArrays.substring(0, strArrays.length() - 1);
-			List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainYi(times, dateEnd1, code);
+			List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainYi(times, dateEnd1, code, stime);
 			List<Map<String, Object>> lists = new ArrayList<>();
 			for (int i = 0; i < mountainrainsCVOS.size(); i++) {
 				if (mountainrainsCVOS.get(i).getCenconding() == null) {
@@ -1156,9 +1183,9 @@
 					if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
 						int drp1 = mountainrainsCVOS.get(i).getDrp1();
 						Integer gohours = mountainrainsCVOS.get(i).getGohours();
-						float i1 = (float)drp1 - gohours;
+						float i1 = (float) drp1 - gohours;
 						float v = (float) (Math.round(i1 * 10)) / 10;
-						String a= String.valueOf(v);
+						String a = String.valueOf(v);
 						map.put("List", mountainrainsCVOS.get(i));
 						map.put("flage1", "true");
 						map.put("status", 2);
@@ -1175,9 +1202,9 @@
 					if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
 						int drp1 = mountainrainsCVOS.get(i).getDrp1();
 						Integer gohour = mountainrainsCVOS.get(i).getGohour();
-						float i1 = (float)drp1 - gohour;
+						float i1 = (float) drp1 - gohour;
 						float v = (float) (Math.round(i1 * 10)) / 10;
-						String a= String.valueOf(v);
+						String a = String.valueOf(v);
 						map.put("List", mountainrainsCVOS.get(i));
 						map.put("flage1", "true");
 						map.put("status", 1);
@@ -1192,81 +1219,87 @@
 				}
 
 			}
-			//色斑图
-			String file = "";
-			// 第一步,创建一个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 < mountainrainsCVOS.size(); i++) {
-				row = sheet.createRow((int) i + 1);
-				HSSFCell celli = row.createCell((short) 0);
-				row.createCell((short) 0).setCellValue(mountainrainsCVOS.get(i).getDj());
-				row.createCell((short) 1).setCellValue(mountainrainsCVOS.get(i).getBw());
-				if (mountainrainsCVOS.get(i).getCenconding() == null) {
-					continue;
-				}
-				if (mountainrainsCVOS.get(i).getSoilval() > 30) {
-					//0.8雨量湿度
-					if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
-						row.createCell((short) 2).setCellValue(2);
-						continue;
-					} else {
-						row.createCell((short) 2).setCellValue(1);
-						continue;
-					}
-				} else {
-					//0.5雨量湿度
-					if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
-						row.createCell((short) 2).setCellValue(2);
-						continue;
-					} else {
-						row.createCell((short) 2).setCellValue(1);
-						continue;
-					}
-				}
-			}
-			try {
-				file = "D:/mou.xlsx";
-				FileOutputStream fout = new FileOutputStream(file);
-				wb.write(fout);
-				fout.close();
-				wb.close();
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-			Process proc;
 			Timestamp timestamp = new Timestamp(System.currentTimeMillis());
 			long url = timestamp.getTime();
 			Map m = new HashMap();
 			m.put("url", url + ".png");
-			String[] args1 = new String[]{"python", "D:\\fz\\mou.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();
-			}
 			lists.add(m);
+			Thread thread = new Thread(new Runnable() {
+				@Override
+				public void run() {
+					//色斑图
+					String file = "";
+					// 第一步,创建一个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 < mountainrainsCVOS.size(); i++) {
+						row = sheet.createRow((int) i + 1);
+						HSSFCell celli = row.createCell((short) 0);
+						row.createCell((short) 0).setCellValue(mountainrainsCVOS.get(i).getDj());
+						row.createCell((short) 1).setCellValue(mountainrainsCVOS.get(i).getBw());
+						if (mountainrainsCVOS.get(i).getCenconding() == null) {
+							continue;
+						}
+						if (mountainrainsCVOS.get(i).getSoilval() > 30) {
+							//0.8雨量湿度
+							if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
+								row.createCell((short) 2).setCellValue(2);
+								continue;
+							} else {
+								row.createCell((short) 2).setCellValue(1);
+								continue;
+							}
+						} else {
+							//0.5雨量湿度
+							if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
+								row.createCell((short) 2).setCellValue(2);
+								continue;
+							} else {
+								row.createCell((short) 2).setCellValue(1);
+								continue;
+							}
+						}
+					}
+					try {
+						file = "D:/mou.xlsx";
+						FileOutputStream fout = new FileOutputStream(file);
+						wb.write(fout);
+						fout.close();
+						wb.close();
+					} catch (Exception e) {
+						e.printStackTrace();
+					}
+					Process proc;
+					String[] args1 = new String[]{"python", "D:\\fz\\mou.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();
+					}
+				}
+			});
+			thread.start();
 			return R.data(lists);
 
 		}
@@ -1294,7 +1327,7 @@
 				if (drp1 > 30) {
 					double v = drp1 - 30;
 					double v1 = (double) Math.round(v * 100) / 100;
-					String a=String.valueOf(v1);
+					String a = String.valueOf(v1);
 					map.put("flage1", "true");
 					map.put("num", a);
 				} else {
@@ -1303,69 +1336,75 @@
 				map.put("List", list.get(i));
 				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(new HSSFRichTextString("lon"));
-			cell = row.createCell((short) 1);
-			cell.setCellValue(new HSSFRichTextString("lat"));
-			cell = row.createCell((short) 2);
-			cell.setCellValue(new HSSFRichTextString("rain"));
-			for (int i = 0; i < list.size(); i++) {
-				// 第四步,创建单元格,并设置值
-				row = sheet.createRow((int) i + 1);
-				HSSFCell celli = row.createCell((short) 0);
-				BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
-				double drp1 = w1.doubleValue();
-				row.createCell((short) 0).setCellValue(list.get(i).get("LGTD").toString());
-				row.createCell((short) 1).setCellValue(list.get(i).get("LTTD").toString());
-				if (drp1 > 30) {
-					row.createCell((short) 2).setCellValue(2);
-					continue;
-				} else {
-					row.createCell((short) 2).setCellValue(1);
-					continue;
-				}
-			}
-			// 第六步,将文件存到指定位置
-			try {
-				fileName = "D:/moup.xlsx";
-				FileOutputStream fout = new FileOutputStream(fileName);
-				wb.write(fout);
-				fout.close();
-				wb.close();
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-			Process proc;
 			Timestamp timestamp = new Timestamp(System.currentTimeMillis());
 			long url = timestamp.getTime();
 			Map m = new HashMap();
 			m.put("url", url + ".png");
-			String[] args1 = new String[]{"python", "D:\\fz\\moup.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();
-			}
 			lists.add(m);
+			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(new HSSFRichTextString("lon"));
+					cell = row.createCell((short) 1);
+					cell.setCellValue(new HSSFRichTextString("lat"));
+					cell = row.createCell((short) 2);
+					cell.setCellValue(new HSSFRichTextString("rain"));
+					for (int i = 0; i < list.size(); i++) {
+						// 第四步,创建单元格,并设置值
+						row = sheet.createRow((int) i + 1);
+						HSSFCell celli = row.createCell((short) 0);
+						BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
+						double drp1 = w1.doubleValue();
+						row.createCell((short) 0).setCellValue(list.get(i).get("LGTD").toString());
+						row.createCell((short) 1).setCellValue(list.get(i).get("LTTD").toString());
+						if (drp1 > 30) {
+							row.createCell((short) 2).setCellValue(2);
+							continue;
+						} else {
+							row.createCell((short) 2).setCellValue(1);
+							continue;
+						}
+					}
+					// 第六步,将文件存到指定位置
+					try {
+						fileName = "D:/moup.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\\moup.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();
+					}
+				}
+			});
+			thread.start();
 			return R.data(lists);
 		}
 
@@ -1383,7 +1422,14 @@
 
 			//2个小时前的时间
 			String dateEnd2 = dateEnds2;
-
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+			Date date = null;
+			try {
+				date = sdf.parse(time);
+			} catch (ParseException e) {
+				e.printStackTrace();
+			}
+			String stime = sdf.format(date);
 			//对应雨量站
 			String s = mountainrainService.selectCode();
 			String[] split = s.split(",");
@@ -1392,7 +1438,7 @@
 				strArrays += "'" + split[i] + "',";
 			}
 			String code = strArrays.substring(0, strArrays.length() - 1);
-			List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainYi(times, dateEnd2, code);
+			List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainTw(times, dateEnd2, code, stime);
 			List<Map<String, Object>> lists = new ArrayList<>();
 			for (int i = 0; i < mountainrainsCVOS.size(); i++) {
 				if (mountainrainsCVOS.get(i).getCenconding() == null) {
@@ -1404,9 +1450,9 @@
 					if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
 						int drp1 = mountainrainsCVOS.get(i).getDrp1();
 						Integer gohours = mountainrainsCVOS.get(i).getGohours();
-						float i1 = (float)drp1 - gohours;
+						float i1 = (float) drp1 - gohours;
 						float v = (float) (Math.round(i1 * 10)) / 10;
-						String a= String.valueOf(v);
+						String a = String.valueOf(v);
 						map.put("List", mountainrainsCVOS.get(i));
 						map.put("flage1", "true");
 						map.put("flage3", "false");
@@ -1431,9 +1477,9 @@
 					if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
 						int drp1 = mountainrainsCVOS.get(i).getDrp1();
 						Integer gohour = mountainrainsCVOS.get(i).getGohour();
-						float i1 = (float)drp1 - gohour;
+						float i1 = (float) drp1 - gohour;
 						float v = (float) (Math.round(i1 * 10)) / 10;
-						String a= String.valueOf(v);
+						String a = String.valueOf(v);
 						map.put("List", mountainrainsCVOS.get(i));
 						map.put("flage1", "true");
 						map.put("flage3", "false");
@@ -1456,87 +1502,93 @@
 				}
 
 			}
-			//色斑图
-			String file = "";
-			// 第一步,创建一个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 < mountainrainsCVOS.size(); i++) {
-				row = sheet.createRow((int) i + 1);
-				HSSFCell celli = row.createCell((short) 0);
-				row.createCell((short) 0).setCellValue(mountainrainsCVOS.get(i).getDj());
-				row.createCell((short) 1).setCellValue(mountainrainsCVOS.get(i).getBw());
-				if (mountainrainsCVOS.get(i).getCenconding() == null) {
-					continue;
-				}
-				if (mountainrainsCVOS.get(i).getSoilval() > 30) {
-					//0.8雨量湿度
-					if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
-						row.createCell((short) 2).setCellValue(2);
-						continue;
-					} else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthours()) {
-						row.createCell((short) 2).setCellValue(2);
-						continue;
-					} else {
-						row.createCell((short) 2).setCellValue(1);
-						continue;
-					}
-				} else {
-					//0.5雨量湿度
-					if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
-						row.createCell((short) 2).setCellValue(2);
-						continue;
-					} else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthour()) {
-						row.createCell((short) 2).setCellValue(2);
-						continue;
-					} else {
-						row.createCell((short) 2).setCellValue(1);
-						continue;
-					}
-				}
-			}
-			try {
-				file = "D:/mou.xlsx";
-				FileOutputStream fout = new FileOutputStream(file);
-				wb.write(fout);
-				fout.close();
-				wb.close();
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-			Process proc;
 			Timestamp timestamp = new Timestamp(System.currentTimeMillis());
 			long url = timestamp.getTime();
 			Map m = new HashMap();
 			m.put("url", url + ".png");
-			String[] args1 = new String[]{"python", "D:\\fz\\mou.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();
-			}
 			lists.add(m);
+			Thread thread = new Thread(new Runnable() {
+				@Override
+				public void run() {
+					//色斑图
+					String file = "";
+					// 第一步,创建一个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 < mountainrainsCVOS.size(); i++) {
+						row = sheet.createRow((int) i + 1);
+						HSSFCell celli = row.createCell((short) 0);
+						row.createCell((short) 0).setCellValue(mountainrainsCVOS.get(i).getDj());
+						row.createCell((short) 1).setCellValue(mountainrainsCVOS.get(i).getBw());
+						if (mountainrainsCVOS.get(i).getCenconding() == null) {
+							continue;
+						}
+						if (mountainrainsCVOS.get(i).getSoilval() > 30) {
+							//0.8雨量湿度
+							if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
+								row.createCell((short) 2).setCellValue(2);
+								continue;
+							} else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthours()) {
+								row.createCell((short) 2).setCellValue(2);
+								continue;
+							} else {
+								row.createCell((short) 2).setCellValue(1);
+								continue;
+							}
+						} else {
+							//0.5雨量湿度
+							if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
+								row.createCell((short) 2).setCellValue(2);
+								continue;
+							} else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthour()) {
+								row.createCell((short) 2).setCellValue(2);
+								continue;
+							} else {
+								row.createCell((short) 2).setCellValue(1);
+								continue;
+							}
+						}
+					}
+					try {
+						file = "D:/mou.xlsx";
+						FileOutputStream fout = new FileOutputStream(file);
+						wb.write(fout);
+						fout.close();
+						wb.close();
+					} catch (Exception e) {
+						e.printStackTrace();
+					}
+					Process proc;
+					String[] args1 = new String[]{"python", "D:\\fz\\mou.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();
+					}
+				}
+			});
+			thread.start();
 			return R.data(lists);
 
 		}
@@ -1572,69 +1624,79 @@
 				map.put("List", list.get(i));
 				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(new HSSFRichTextString("lon"));
-			cell = row.createCell((short) 1);
-			cell.setCellValue(new HSSFRichTextString("lat"));
-			cell = row.createCell((short) 2);
-			cell.setCellValue(new HSSFRichTextString("rain"));
-			for (int i = 0; i < list.size(); i++) {
-				// 第四步,创建单元格,并设置值
-				row = sheet.createRow((int) i + 1);
-				HSSFCell celli = row.createCell((short) 0);
-				BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
-				double drp1 = w1.doubleValue();
-				row.createCell((short) 0).setCellValue(list.get(i).get("LGTD").toString());
-				row.createCell((short) 1).setCellValue(list.get(i).get("LTTD").toString());
-					if (drp1 > 50) {
-						row.createCell((short) 2).setCellValue(2);
-						continue;
-					} else {
-						row.createCell((short) 2).setCellValue(1);
-						continue;
-					}
-			}
-			// 第六步,将文件存到指定位置
-			try {
-				fileName = "D:/moup.xlsx";
-				FileOutputStream fout = new FileOutputStream(fileName);
-				wb.write(fout);
-				fout.close();
-				wb.close();
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-			Process proc;
 			Timestamp timestamp = new Timestamp(System.currentTimeMillis());
 			long url = timestamp.getTime();
 			Map m = new HashMap();
 			m.put("url", url + ".png");
-			String[] args1 = new String[]{"python", "D:\\fz\\moup.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();
-			}
 			lists.add(m);
+			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(new HSSFRichTextString("lon"));
+					cell = row.createCell((short) 1);
+					cell.setCellValue(new HSSFRichTextString("lat"));
+					cell = row.createCell((short) 2);
+					cell.setCellValue(new HSSFRichTextString("rain"));
+					for (int i = 0; i < list.size(); i++) {
+						// 第四步,创建单元格,并设置值
+						row = sheet.createRow((int) i + 1);
+						HSSFCell celli = row.createCell((short) 0);
+						BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
+						double drp1 = w1.doubleValue();
+						row.createCell((short) 0).setCellValue(list.get(i).get("LGTD").toString());
+						row.createCell((short) 1).setCellValue(list.get(i).get("LTTD").toString());
+						if (drp1 > 50) {
+							row.createCell((short) 2).setCellValue(2);
+							continue;
+						} else {
+							row.createCell((short) 2).setCellValue(1);
+							continue;
+						}
+					}
+					// 第六步,将文件存到指定位置
+					try {
+						fileName = "D:/moup.xlsx";
+						FileOutputStream fout = new FileOutputStream(fileName);
+						wb.write(fout);
+						fout.close();
+						wb.close();
+					} catch (Exception e) {
+						e.printStackTrace();
+					}
+					Process proc;
+					Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+					long url = timestamp.getTime();
+					Map m = new HashMap();
+					m.put("url", url + ".png");
+					String[] args1 = new String[]{"python", "D:\\fz\\moup.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();
+					}
+				}
+			});
+			thread.start();
 			return R.data(lists);
 		}
 
@@ -1653,7 +1715,14 @@
 
 			//2个小时前的时间
 			String dateEnd3 = dateEnds3;
-
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+			Date date = null;
+			try {
+				date = sdf.parse(time);
+			} catch (ParseException e) {
+				e.printStackTrace();
+			}
+			String stime = sdf.format(date);
 			//对应雨量站
 			String s = mountainrainService.selectCode();
 			String[] split = s.split(",");
@@ -1662,7 +1731,7 @@
 				strArrays += "'" + split[i] + "',";
 			}
 			String code = strArrays.substring(0, strArrays.length() - 1);
-			List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainTr(times, dateEnd3, code);
+			List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainTr(times, dateEnd3, code, stime);
 			List<Map<String, Object>> lists = new ArrayList<>();
 			for (int i = 0; i < mountainrainsCVOS.size(); i++) {
 				if (mountainrainsCVOS.get(i).getCenconding() == null) {
@@ -1674,9 +1743,9 @@
 					if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthours()) {
 						int drp1 = mountainrainsCVOS.get(i).getDrp1();
 						Integer gohours = mountainrainsCVOS.get(i).getGohours();
-						float i1 = (float)drp1 - gohours;
+						float i1 = (float) drp1 - gohours;
 						float v = (float) (Math.round(i1 * 10)) / 10;
-						String a= String.valueOf(v);
+						String a = String.valueOf(v);
 						map.put("List", mountainrainsCVOS.get(i));
 						map.put("flage3", "true");
 						map.put("status", 2);
@@ -1693,9 +1762,9 @@
 					if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthour()) {
 						int drp1 = mountainrainsCVOS.get(i).getDrp1();
 						Integer gohour = mountainrainsCVOS.get(i).getGohour();
-						float i1 = (float)drp1 - gohour;
+						float i1 = (float) drp1 - gohour;
 						float v = (float) (Math.round(i1 * 10)) / 10;
-						String a= String.valueOf(v);
+						String a = String.valueOf(v);
 						map.put("List", mountainrainsCVOS.get(i));
 						map.put("flage3", "true");
 						map.put("status", 1);
@@ -1710,81 +1779,87 @@
 				}
 
 			}
-			//色斑图
-			String file = "";
-			// 第一步,创建一个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 < mountainrainsCVOS.size(); i++) {
-				row = sheet.createRow((int) i + 1);
-				HSSFCell celli = row.createCell((short) 0);
-				row.createCell((short) 0).setCellValue(mountainrainsCVOS.get(i).getDj());
-				row.createCell((short) 1).setCellValue(mountainrainsCVOS.get(i).getBw());
-				if (mountainrainsCVOS.get(i).getCenconding() == null) {
-					continue;
-				}
-				if (mountainrainsCVOS.get(i).getSoilval() > 30) {
-					//0.8雨量湿度
-					if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthours()) {
-						row.createCell((short) 2).setCellValue(2);
-						continue;
-					} else {
-						row.createCell((short) 2).setCellValue(1);
-						continue;
-					}
-				} else {
-					//0.5雨量湿度
-					if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthour()) {
-						row.createCell((short) 2).setCellValue(2);
-						continue;
-					} else {
-						row.createCell((short) 2).setCellValue(1);
-						continue;
-					}
-				}
-			}
-			try {
-				file = "D:/mou.xlsx";
-				FileOutputStream fout = new FileOutputStream(file);
-				wb.write(fout);
-				fout.close();
-				wb.close();
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-			Process proc;
 			Timestamp timestamp = new Timestamp(System.currentTimeMillis());
 			long url = timestamp.getTime();
 			Map m = new HashMap();
 			m.put("url", url + ".png");
-			String[] args1 = new String[]{"python", "D:\\fz\\mou.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();
-			}
 			lists.add(m);
+			Thread thread = new Thread(new Runnable() {
+				@Override
+				public void run() {
+					//色斑图
+					String file = "";
+					// 第一步,创建一个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 < mountainrainsCVOS.size(); i++) {
+						row = sheet.createRow((int) i + 1);
+						HSSFCell celli = row.createCell((short) 0);
+						row.createCell((short) 0).setCellValue(mountainrainsCVOS.get(i).getDj());
+						row.createCell((short) 1).setCellValue(mountainrainsCVOS.get(i).getBw());
+						if (mountainrainsCVOS.get(i).getCenconding() == null) {
+							continue;
+						}
+						if (mountainrainsCVOS.get(i).getSoilval() > 30) {
+							//0.8雨量湿度
+							if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthours()) {
+								row.createCell((short) 2).setCellValue(2);
+								continue;
+							} else {
+								row.createCell((short) 2).setCellValue(1);
+								continue;
+							}
+						} else {
+							//0.5雨量湿度
+							if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthour()) {
+								row.createCell((short) 2).setCellValue(2);
+								continue;
+							} else {
+								row.createCell((short) 2).setCellValue(1);
+								continue;
+							}
+						}
+					}
+					try {
+						file = "D:/mou.xlsx";
+						FileOutputStream fout = new FileOutputStream(file);
+						wb.write(fout);
+						fout.close();
+						wb.close();
+					} catch (Exception e) {
+						e.printStackTrace();
+					}
+					Process proc;
+					String[] args1 = new String[]{"python", "D:\\fz\\mou.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();
+					}
+				}
+			});
+			thread.start();
 			return R.data(lists);
 
 		}
@@ -1820,70 +1895,76 @@
 				map.put("List", list.get(i));
 				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(new HSSFRichTextString("lon"));
-			cell = row.createCell((short) 1);
-			cell.setCellValue(new HSSFRichTextString("lat"));
-			cell = row.createCell((short) 2);
-			cell.setCellValue(new HSSFRichTextString("rain"));
-			for (int i = 0; i < list.size(); i++) {
-				// 第四步,创建单元格,并设置值
-				row = sheet.createRow((int) i + 1);
-				HSSFCell celli = row.createCell((short) 0);
-				BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
-				double drp1 = w1.doubleValue();
-				row.createCell((short) 0).setCellValue(list.get(i).get("LGTD").toString());
-				row.createCell((short) 1).setCellValue(list.get(i).get("LTTD").toString());
-				if (drp1 > 80) {
-					row.createCell((short) 2).setCellValue(2);
-					continue;
-
-				} else {
-					row.createCell((short) 2).setCellValue(1);
-					continue;
-				}
-			}
-			// 第六步,将文件存到指定位置
-			try {
-				fileName = "D:/moup.xlsx";
-				FileOutputStream fout = new FileOutputStream(fileName);
-				wb.write(fout);
-				fout.close();
-				wb.close();
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-			Process proc;
 			Timestamp timestamp = new Timestamp(System.currentTimeMillis());
 			long url = timestamp.getTime();
 			Map m = new HashMap();
 			m.put("url", url + ".png");
-			String[] args1 = new String[]{"python", "D:\\fz\\moup.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();
-			}
 			lists.add(m);
+			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(new HSSFRichTextString("lon"));
+					cell = row.createCell((short) 1);
+					cell.setCellValue(new HSSFRichTextString("lat"));
+					cell = row.createCell((short) 2);
+					cell.setCellValue(new HSSFRichTextString("rain"));
+					for (int i = 0; i < list.size(); i++) {
+						// 第四步,创建单元格,并设置值
+						row = sheet.createRow((int) i + 1);
+						HSSFCell celli = row.createCell((short) 0);
+						BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
+						double drp1 = w1.doubleValue();
+						row.createCell((short) 0).setCellValue(list.get(i).get("LGTD").toString());
+						row.createCell((short) 1).setCellValue(list.get(i).get("LTTD").toString());
+						if (drp1 > 80) {
+							row.createCell((short) 2).setCellValue(2);
+							continue;
+
+						} else {
+							row.createCell((short) 2).setCellValue(1);
+							continue;
+						}
+					}
+					// 第六步,将文件存到指定位置
+					try {
+						fileName = "D:/moup.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\\moup.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();
+					}
+				}
+			});
+			thread.start();
 			return R.data(lists);
 		}
 
@@ -1894,7 +1975,7 @@
 	 */
 	@GetMapping("/selectS")
 	public R selectS(String time) {
-		List<Map<String, Object>> list = mountainrainService.selectS();
+		List<Map<String, Object>> list = mountainrainService.selectS(time);
 		String fileName = "";
 		// 第一步,创建一个webbook,对应一个Excel文件
 		HSSFWorkbook wb = new HSSFWorkbook();
@@ -1998,6 +2079,16 @@
 		return R.data(m);
 	}
 
-
+	public static Date beforeHourToNowDate(String date, int hours) {
+		Calendar c = Calendar.getInstance();
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		try {
+			c.setTime(sdf.parse(date));
+			c.set(Calendar.HOUR_OF_DAY, c.get(Calendar.HOUR_OF_DAY) - hours);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return c.getTime();
+	}
 }
 

--
Gitblit v1.9.3