From bc76e975aae3837eae625a2e3ffff7d02a5fc3f3 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Mon, 13 Sep 2021 17:27:24 +0800
Subject: [PATCH] 1.山洪

---
 src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml             |    5 
 src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java    |  183 ++++---
 src/main/java/org/springblade/modules/regionWeight/service/IRegionWeightService.java         |    2 
 src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java |    4 
 src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java    |  174 +++++++
 src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java                   |  981 ++++++++++++++++++++--------------------
 src/main/resources/application-dev.yml                                                       |    8 
 src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.java            |    2 
 src/main/java/org/springblade/modules/regionWeight/service/impl/RegionWeightServiceImpl.java |   10 
 src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.xml             |   47 +
 10 files changed, 840 insertions(+), 576 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 d829e5e..0297cf2 100644
--- a/src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java
+++ b/src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java
@@ -41,6 +41,7 @@
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import springfox.documentation.annotations.ApiIgnore;
+
 import javax.validation.Valid;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
@@ -49,7 +50,7 @@
 import java.util.*;
 
 /**
- *  控制器
+ * 控制器
  *
  * @author BladeX
  * @since 2020-02-27
@@ -384,69 +385,68 @@
 	 */
 	@ApiLog("查询洪水预警")
 	@GetMapping("/ss")
-	public R selectcInfos(int type,String time,String dateEnds1,String dateEnds3,String dateEnds6,String dateEnds24,int k,String timei) {
-		if (type == 0 && k==13) {
+	public R selectcInfos(int type, String time, String dateEnds1, String dateEnds3, String dateEnds6, String dateEnds24, int k, String timei) {
+		if (type == 0 && k == 13) {
 			//当前时间
 			String times = time;
 
 			String dateEnd1 = dateEnds1;
 
-			String timess=timei;
+			String timess = timei;
 
 			//三个小时前的时间
-			String dateEnd3 =dateEnds3;
+			String dateEnd3 = dateEnds3;
 
 			//六个小时前的时间
-			String dateEnd6 =dateEnds6;
+			String dateEnd6 = dateEnds6;
 
 			//二十四个小时前的时间
-			String dateEnd24 =dateEnds24;
+			String dateEnd24 = dateEnds24;
 
 			//对应雨量站
-			long startTime=System.currentTimeMillis();
-			List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.selectcInfos(times, dateEnd24, dateEnd1, dateEnd3, dateEnd6,timess);
+			long startTime = System.currentTimeMillis();
+			List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.selectcInfos(times, dateEnd24, dateEnd1, dateEnd3, dateEnd6, timess);
 			List<Map<String, Object>> lists = new ArrayList<>();
 			for (int i = 0; i < mountainrainsCVOS.size(); i++) {
-				if (mountainrainsCVOS.get(i).getCenconding()==null){
+				if (mountainrainsCVOS.get(i).getCenconding() == null) {
 					continue;
 				}
 				Map<String, Object> map = new HashMap<String, Object>();
-					int Max =mountainrainService .Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(),
-						mountainrainsCVOS.get(i).getGohour(), mountainrainsCVOS.get(i).getGthour());
-					map.put("List", mountainrainsCVOS.get(i));
-					map.put("Max", Max);
-					lists.add(map);
+				int Max = mountainrainService.Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(),
+					mountainrainsCVOS.get(i).getGohour(), mountainrainsCVOS.get(i).getGthour());
+				map.put("List", mountainrainsCVOS.get(i));
+				map.put("Max", Max);
+				lists.add(map);
 			}
 			return R.data(lists);
 
-		}
-		else {
+		} else {
 			//当前时间
 			String times = time;
 
 			String dateEnd1 = dateEnds1;
 
-			String timess=timei;
+			String timess = timei;
 
 			//三个小时前的时间
-			String dateEnd3 =dateEnds3;
+			String dateEnd3 = dateEnds3;
 
 			//六个小时前的时间
-			String dateEnd6 =dateEnds6;
+			String dateEnd6 = dateEnds6;
 
 			//二十四个小时前的时间
-			String dateEnd24 =dateEnds24;
+			String dateEnd24 = dateEnds24;
 
 			//对应雨量站
-			List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.selectcInfo(times, dateEnd24, dateEnd1, dateEnd3, dateEnd6,timess);
+			List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.selectcInfo(times, dateEnd24, dateEnd1, dateEnd3, dateEnd6, timess);
 			List<Map<String, Object>> lists = new ArrayList<>();
 			for (int i = 0; i < mountainrainsCVOS.size(); i++) {
 				Map<String, Object> map = new HashMap<String, Object>();
-					int Max = mountainrainService.Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(),
-						mountainrainsCVOS.get(i).getGohour(), mountainrainsCVOS.get(i).getGthour());
-					map.put("List", mountainrainsCVOS.get(i));
-					map.put("Max", Max);
-					lists.add(map);
+				int Max = mountainrainService.Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(),
+					mountainrainsCVOS.get(i).getGohour(), mountainrainsCVOS.get(i).getGthour());
+				map.put("List", mountainrainsCVOS.get(i));
+				map.put("Max", Max);
+				lists.add(map);
 
 			}
 			return R.data(lists);
@@ -460,19 +460,19 @@
 	 */
 	@ApiLog("查询洪水预警")
 	@GetMapping("/sss")
-	public R selectcInfoss(int type,String time,String dateEnds1,String dateEnds2,String dateEnds3,int k) {
+	public R selectcInfoss(int type, String time, String dateEnds1, String dateEnds2, String dateEnds3) {
 		//第二种方式预警
-		if (type == 0 && k==13) {
+		if (type == 0) {
 			//当前时间
 			String times = time;
 
 			String dateEnd1 = dateEnds1;
 
 			//2个小时前的时间
-			String dateEnd2 =dateEnds2;
+			String dateEnd2 = dateEnds2;
 
 			//3个小时前的时间
-			String dateEnd3 =dateEnds3;
+			String dateEnd3 = dateEnds3;
 
 			//对应雨量站
 			String s = mountainrainService.selectCode();
@@ -482,22 +482,21 @@
 				strArrays += "'" + split[i] + "',";
 			}
 			String code = strArrays.substring(0, strArrays.length() - 1);
-			List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.Mountains(times, dateEnd1, dateEnd2, dateEnd3,code);
+			List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.Mountains(times, dateEnd1, dateEnd2, dateEnd3, code);
 			List<Map<String, Object>> lists = new ArrayList<>();
 			for (int i = 0; i < mountainrainsCVOS.size(); i++) {
-				if (mountainrainsCVOS.get(i).getCenconding()==null){
+				if (mountainrainsCVOS.get(i).getCenconding() == null) {
 					continue;
 				}
 				Map<String, Object> map = new HashMap<String, Object>();
-				if (mountainrainsCVOS.get(i).getSoilval()>30){
-					int Max =mountainrainService .Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(),
+				if (mountainrainsCVOS.get(i).getSoilval() > 30) {
+					int Max = mountainrainService.Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(),
 						mountainrainsCVOS.get(i).getGohours(), mountainrainsCVOS.get(i).getGthours());
 					map.put("List", mountainrainsCVOS.get(i));
 					map.put("Max", Max);
 					lists.add(map);
-				}
-				else {
-					int Max =mountainrainService .Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(),
+				} else {
+					int Max = mountainrainService.Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(),
 						mountainrainsCVOS.get(i).getGohour(), mountainrainsCVOS.get(i).getGthour());
 					map.put("List", mountainrainsCVOS.get(i));
 					map.put("Max", Max);
@@ -517,10 +516,10 @@
 			String dateEnd1 = dateEnds1;
 
 			//两个小时前的时间
-			String dateEnd2 =dateEnds2;
+			String dateEnd2 = dateEnds2;
 
 			//三个小时前的时间
-			String dateEnd3 =dateEnds3;
+			String dateEnd3 = dateEnds3;
 
 			String s = regionWeightService.selectCode();
 			String[] split = s.split(",");
@@ -530,73 +529,99 @@
 			}
 			String code = strArrays.substring(0, strArrays.length() - 1);
 			List<Map<String, Integer>> list = mountainrainService.selecMone(times, dateEnd1, dateEnd2, dateEnd3, code);
-		    List list1= new ArrayList();
-		    List list2= new ArrayList();
-		    List list3= new ArrayList();
-			for (int i=0;i<list.size();i++){
-				if (list.get(i).get("drp1")>=30){
-						list1.add(list.get(i));
+			List<Map<String, Object>> lists = new ArrayList<>();
+			Map<String, Object> map = new HashMap<String, Object>();
+			for (int i = 0; i < list.size(); i++) {
+				if (list.get(i).get("drp1") >= 30) {
+					map.put("List", list.get(i));
+					map.put("Max", 1);
 				}
-				if (list.get(i).get("drp2")>=50) {
-					list2.add(list.get(i));
+				if (list.get(i).get("drp2") >= 50) {
+					map.put("List", list.get(i));
+					map.put("Max", 2);
 				}
-				if (list.get(i).get("drp3")>=80) {
-					list3.add(list.get(i));
+				if (list.get(i).get("drp3") >= 80) {
+					map.put("List", list.get(i));
+					map.put("Max", 3);
 				}
 
 			}
-			Map map = new HashMap();
-			map.put("list1",list1);
-			map.put("list2",list2);
-			map.put("list2",list3);
-			return R.data(map);
+			lists.add(map);
+			return R.data(lists);
 		}
 
 	}
 
 	/**
 	 * 土壤湿度计算
+	 *
 	 * @return
 	 */
-	@Scheduled(cron = "0 0 8 * * ?")
+	//@Scheduled(cron = "0 0 8 * * ?")
 	@GetMapping("/soleval")
 	public R soleval() {
-		SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd 08:00:00" );
-		Date today = new Date();
-		String endDate = sdf .format( today ); //当前日期
-		//获取三十天前日期
-		Calendar theCa = Calendar. getInstance ();
-		theCa .setTime( today );
-		theCa .add( theCa . DATE , -30); //最后一个数字30可改,30天的意思
-		Date start = theCa .getTime();
-		String startDate = sdf .format( start ); //三十天之前日期
+		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 = "62310356,62310305";
 		String[] split = s.split(",");
 		String strArrays = "";
-		Integer num=60;
 		for (int i = 0; i < split.length; i++) {
 			strArrays += "'" + split[i] + "',";
 		}
 		String code = strArrays.substring(0, strArrays.length() - 1);
-		mountainrainService.soildel();
-		List<Map<String, Object>> list = mountainrainService.selectMtwo(startDate, endDate, code);
-		for (int i=0;i<list.size();i++){ ;
-			BigDecimal w = (BigDecimal) list.get(i).get("drp");
-			double drp = w.doubleValue();
-			String stcd = list.get(i).get("STCD").toString();
-			//计算湿度
-			double v = (num + drp) * 0.85;
-			if (v>60){
-				mountainrainService.soleInster(stcd,"60");
+		for (int i = 0; i < split.length; i++) {
+			Integer num = 30;
+			double v1 = 0;
+			String stcd = null;
+		for (int j = 0; j < passDaysList.size() - 1; j++) {
+			List<Map<String, Object>> map = mountainrainService.selectMtwo(passDaysList.get(j).toString(), passDaysList.get(j + 1).toString(), code);
+			if (map.size()==0){
+				continue;
 			}
-			else {
-				String a= String.valueOf(v);
-				mountainrainService.soleInster(stcd,a);
+			BigDecimal w = (BigDecimal) map.get(i).get("drp");
+			double drp = w.doubleValue();
+			stcd = map.get(i).get("STCD").toString();
+			//计算湿度
+			if (i == 0) {
+				v1 = formatDouble1((num + drp) * 0.85);
+			} else {
+				v1 += drp;
+				v1 = formatDouble1(v1 * 0.85);
 			}
 		}
+			if (v1 > 60) {
+				mountainrainService.soleInster(stcd, "60");
+			} else {
+				String a = String.valueOf(v1);
+				mountainrainService.soleInster(stcd, a);
+			}
+		}
+
 		return R.success("成功");
 	}
 
+	public static double formatDouble1(double d) {
+		return (double) Math.round(d * 10) / 10;
+	}
+
+	private static String getDays(int i, boolean b) {
+		Calendar calendar = Calendar.getInstance();
+		if (b) {
+			calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + i);
+		} else {
+			calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) - i);
+		}
+		Date today = calendar.getTime();
+		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 08:00:00");
+		String result = format.format(today);
+		return result;
+	}
 
 }
 
diff --git a/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml b/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml
index 12ec528..27d9636 100644
--- a/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml
+++ b/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml
@@ -257,8 +257,8 @@
 
     <select id="selectCode" resultType="java.lang.String">
         SELECT stuff((
-            SELECT ',' + CONVERT(VARCHAR (25), cenconding)
-            FROM dbo.blade_mountain FOR XML PATH ('')),
+            SELECT ',' + CONVERT(VARCHAR (25), m.cenconding)
+            FROM dbo.blade_mountain m INNER JOIN ST_STBPRP_B s ON  s.STCD=m.cenconding  GROUP BY m.cenconding   FOR XML PATH ('')),
 		1,
 		1,
 	''
@@ -410,7 +410,6 @@
         WHERE TM &gt; #{time3}
           AND TM &lt;= #{time}
           AND STCD IN (${code})
-          AND datename(HOUR,TM) = 8
         GROUP BY STCD
     </select>
 
diff --git a/src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java b/src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java
index f678c67..c715e17 100644
--- a/src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java
+++ b/src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java
@@ -373,7 +373,7 @@
 			return  1;//准备转移
 		}
 		else {
-			return  2;//立即转移
+			return  3;//立即转移
 		}
 	}
 
@@ -400,7 +400,7 @@
 			return  1;//准备转移
 		}
 		else {
-			return  2;//立即转移
+			return  3;//立即转移
 		}
 	}
 
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 966dc23..b2cec61 100644
--- a/src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java
+++ b/src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java
@@ -300,8 +300,8 @@
 			});
 			//拼接前3位降雨最大的区域
 			double v3 = (double) Math.round(num * 10) / 10;
-			String text = "抚州市降雨:" + v3 + "(毫米)。 ";
-			String text1 = "前三降雨量的是: ";
+			String text = "全市日平均降雨量:" + v3 + "(毫米)。 ";
+			String text1 = "县市区平均降雨量前3位为: ";
 			String tx = "";
 			for (int i = 0; i < entryList2.size(); i++) {
 				Map mapa = new HashMap();
@@ -427,7 +427,7 @@
 		if (maps.size() == 0) {
 			a = yday + "暂无降雨信息。";
 		} else {
-			a = yday + "点降雨量前三为:" + text.substring(0, text.length() - 1) + "。";
+			a = yday + "站点最大降雨量前3位为:" + text.substring(0, text.length() - 1) + "。";
 		}
 		map.put("text", a);
 		lists.add(map);
@@ -896,5 +896,173 @@
 		return R.data(lists);
 	}
 
+	/**
+	 * 面降雨量
+	 */
+	@GetMapping("/selectReMs")
+	public R selectReMs(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 + "时。";
+		String ss = regionWeightService.selectCodeM();
+		String[] split = ss.split(",");
+		String strArrays = "";
+		for (int i = 0; i < split.length; i++) {
+			strArrays += "'" + split[i] + "',";
+		}
+		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();
+		//权重值
+		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);
+	}
 
 }
diff --git a/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.java b/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.java
index ddc160d..7b41e11 100644
--- a/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.java
+++ b/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.java
@@ -55,6 +55,7 @@
 	List<RegionWeightVO> lazyTree(String code);
 	//最新面降雨量
 	List<Map<String, Object>>  selectReM(String beginTime,String endTime);
+	List<Map<String, Object>>  selectReMs(String beginTime,String endTime,String code);
 	List<Map<String, Object>>  selectReL(String beginTime,String endTime);
 	List<Map<String, Object>>  selectWeight();
 	List<Map<String, Object>>  selectWeights();
@@ -70,4 +71,5 @@
 	List<Map<String, Object>> selectppyj(String time, String dateBegin1,String dateBegin3,String dateBegin6,String times);
 
 	String selectCode();
+	String selectCodeM();
 }
diff --git a/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.xml b/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.xml
index 0433a29..1432311 100644
--- a/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.xml
+++ b/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.xml
@@ -103,7 +103,7 @@
                  SELECT STCD,
                         SUM(DRP) AS DRP
                  FROM dbo.ST_PPTN_R
-                 WHERE TM &gt;#{beginTime}
+                 WHERE TM &gt; #{beginTime}
                    AND TM &lt;= #{endTime}
                  GROUP BY STCD
              ) cs1
@@ -248,7 +248,8 @@
                  FROM dbo.ST_STBPRP_B st
                           INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD
                  WHERE st.STTP = 'PP'
-                    OR st.STTP = 'ZQ' OR st.STTP = 'ZZ'
+                    OR st.STTP = 'ZQ'
+                    OR st.STTP = 'ZZ'
              ) c
                  LEFT JOIN (
             SELECT SUM
@@ -303,6 +304,17 @@
 	) AS siteids
     </select>
 
+    <select id="selectCodeM" resultType="java.lang.String">
+        SELECT stuff((
+            SELECT ',' + CONVERT(VARCHAR (25), STATION_CODE)
+            FROM ZHSW_REGION_WEIGHT
+            WHERE SPARE1!=0 FOR XML PATH ('')),
+		1,
+		1,
+	''
+	) AS siteids
+    </select>
+
     <select id="ss" resultType="java.util.Map">
         SELECT c.STCD,
                c.STNM,
@@ -341,5 +353,36 @@
         ORDER BY
             csd.dyp DESC
     </select>
+
+    <!--最新面降雨量-->
+    <select id="selectReMs" resultType="java.util.HashMap">
+        SELECT cs1.STCD,
+               isnull(cs1.DRP, 0) as DRP,
+               s.STATION_NAME,
+               s.REGION_NAME,
+               s.WEIGHT,
+               s.REGION_CODE,
+               st.LGTD,
+               st.LTTD,
+               st.STTP
+        FROM (SELECT STCD, SUM(DRP) AS DRP
+              FROM dbo.ST_PPTN_R
+              WHERE TM &gt; #{beginTime}
+                AND TM &lt;= #{endTime} AND STCD IN (${code})
+              GROUP BY STCD) cs1
+                 INNER JOIN (SELECT STATION_CODE, STATION_NAME, REGION_NAME, WEIGHT, REGION_CODE
+                             FROM ZHSW_REGION_WEIGHT) s ON s.STATION_CODE = cs1.STCD
+                 INNER JOIN (SELECT STCD, LGTD, LTTD, STTP, ADDVCD FROM dbo.ST_STBPRP_B) st ON st.STCD = cs1.STCD
+                 INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD
+        GROUP BY cs1.STCD,
+                 cs1.DRP,
+                 s.STATION_NAME,
+                 s.REGION_NAME,
+                 s.WEIGHT,
+                 s.REGION_CODE,
+                 st.LGTD,
+                 st.LTTD,
+                 st.STTP
+    </select>
 </mapper>
 
diff --git a/src/main/java/org/springblade/modules/regionWeight/service/IRegionWeightService.java b/src/main/java/org/springblade/modules/regionWeight/service/IRegionWeightService.java
index 036cc51..2341247 100644
--- a/src/main/java/org/springblade/modules/regionWeight/service/IRegionWeightService.java
+++ b/src/main/java/org/springblade/modules/regionWeight/service/IRegionWeightService.java
@@ -59,5 +59,7 @@
 	List<Map<String, Object>> selectLNam();
 	List<Map<String, Object>> selectppyj(String time, String dateBegin1,String dateBegin3,String dateBegin6,String times);
 	String selectCode();
+	String selectCodeM();
 	List<Map<String, Object>> ss(String beginTime, String endTime, String code);
+	List<Map<String, Object>>  selectReMs(String beginTime,String endTime,String code);
 }
diff --git a/src/main/java/org/springblade/modules/regionWeight/service/impl/RegionWeightServiceImpl.java b/src/main/java/org/springblade/modules/regionWeight/service/impl/RegionWeightServiceImpl.java
index bd16523..ee9b440 100644
--- a/src/main/java/org/springblade/modules/regionWeight/service/impl/RegionWeightServiceImpl.java
+++ b/src/main/java/org/springblade/modules/regionWeight/service/impl/RegionWeightServiceImpl.java
@@ -110,7 +110,17 @@
 	}
 
 	@Override
+	public String selectCodeM() {
+		return baseMapper.selectCodeM();
+	}
+
+	@Override
 	public List<Map<String, Object>> ss(String beginTime, String endTime, String code) {
 		return baseMapper.ss(beginTime, endTime, code);
 	}
+
+	@Override
+	public List<Map<String, Object>> selectReMs(String beginTime, String endTime, String code) {
+		return baseMapper.selectReMs(beginTime, endTime, code);
+	}
 }
diff --git a/src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java b/src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java
index b7ae504..0dc7c56 100644
--- a/src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java
+++ b/src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java
@@ -441,315 +441,245 @@
 				SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 				Date sd1 = df.parse(maxTM);
 				Date sd2 = df.parse(minTM);
-				//如果最大时间大于最小时间就是涨幅
-				if (sd1.after(sd2)) {
-					//创建一个map集合保存涨幅数据
-					double v = maxZ.doubleValue();
-					double v1 = minZ.doubleValue();
-					//涨幅值
-					double v2 = v - v1;
-					double v3 = (double) Math.round(v2 * 100) / 100;
-					m1.put(v3, stnm.replaceAll(" ", "") + "站");
-					c.put(stcd, v3);
-				}
-				//跌幅
-				else {
-					//创建一个map集合保存跌幅数据
-					double v = maxZ.doubleValue();
-					double v1 = minZ.doubleValue();
-					//涨幅值
-					double v2 = v1 - v;
-					double v3 = (double) Math.round(v2 * 100) / 100;
-					m2.put(Math.abs(v3), stnm.replaceAll(" ", "") + "站");
-					c.put(stcd, v3);
-				}
-			}
-			if (m1.size()!=0) {
+				double v = maxZ.doubleValue();
+				double v1 = minZ.doubleValue();
+				//涨幅值
+				double v2 = v - v1;
+				double v3 = (double) Math.round(v2 * 100) / 100;
+				m1.put(v3, stnm.replaceAll(" ", "") + "站");
+				c.put(stcd, v3);
 				//获取涨幅最大的信息
-				Object maxKey = getMaxKey(m1);
-				String s1 = m1.get(maxKey).toString();
-				text += " 涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。";
+				if (m1.size()!=0) {
+					Object maxKey = getMaxKey(m1);
+					String s1 = m1.get(maxKey).toString();
+					text += " 涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。";
+				}
 			}
-			if (m2.size()!=0) {
-				//获取跌幅最大的信息
-				Object maxKey2 = getMaxKey(m2);
-				String s2 = m2.get(maxKey2).toString();
-				text += " 跌幅最大的是:" + s2 + "(跌" + maxKey2 + "米)。";
+//				//如果最大时间大于最小时间就是涨幅
+//				if (sd1.after(sd2)) {
+//					//创建一个map集合保存涨幅数据
+//					double v = maxZ.doubleValue();
+//					double v1 = minZ.doubleValue();
+//					//涨幅值
+//					double v2 = v - v1;
+//					double v3 = (double) Math.round(v2 * 100) / 100;
+//					m1.put(v3, stnm.replaceAll(" ", "") + "站");
+//					c.put(stcd, v3);
+//				}
+//				//跌幅
+//				else {
+//					//创建一个map集合保存跌幅数据
+//					double v = maxZ.doubleValue();
+//					double v1 = minZ.doubleValue();
+//					//涨幅值
+//					double v2 = v1 - v;
+//					double v3 = (double) Math.round(v2 * 100) / 100;
+//					m2.put(Math.abs(v3), stnm.replaceAll(" ", "") + "站");
+//					c.put(stcd, v3);
+//				}
+//			}
+//			if (m1.size()!=0) {
+//				//获取涨幅最大的信息
+//				Object maxKey = getMaxKey(m1);
+//				String s1 = m1.get(maxKey).toString();
+//				text += " 涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。";
+//			}
+//			if (m2.size()!=0) {
+//				//获取跌幅最大的信息
+//				Object maxKey2 = getMaxKey(m2);
+//				String s2 = m2.get(maxKey2).toString();
+//				text += " 跌幅最大的是:" + s2 + "(跌" + maxKey2 + "米)。";
+//			}
+				m.put("text", text);
+				m.put("number", number);
+				m.put("Yjlist", ylist);
+				m.put("list", alist);
+				m.put("clist", c);
+				list.add(m);
 			}
-			m.put("text", text);
-			m.put("number", number);
-			m.put("Yjlist", ylist);
-			m.put("list", alist);
-			m.put("clist", c);
-			list.add(m);
+			return R.data(list);
 		}
-		return R.data(list);
-	}
 
-	/**
-	 * 水库水情最新信息
-	 */
-	@PostMapping("/selectyjcks")
-	public R selectyjcks() throws ParseException {
-		int ws = 1;
-		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-		String time = df.format(new Date());
-		SimpleDateFormat dfz = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
-		String timez = dfz.format(new Date());
-		String yearc = time.substring(0, 4);
-		int years = Integer.parseInt(yearc);
-		String monthc = time.substring(5, 7);
-		int months = Integer.parseInt(monthc);
-		String dayc = time.substring(8, 10);
-		int days = Integer.parseInt(dayc);
-		int da = days - ws;
-		String hss = time.substring(11, 13);
-		int hs = Integer.parseInt(hss);
-		//前一天8时
-		String timec = years + "-" + months + "-" + da + " 08:00:00";
-		//前24小时
-		Calendar calendar6 = Calendar.getInstance();
-		calendar6.set(Calendar.HOUR_OF_DAY, calendar6.get(Calendar.HOUR_OF_DAY) - 24);
-		String dateBegin24 = df.format(calendar6.getTime());
+		/**
+		 * 水库水情最新信息
+		 */
+		@PostMapping("/selectyjcks")
+		public R selectyjcks () throws ParseException {
+			int ws = 1;
+			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+			String time = df.format(new Date());
+			SimpleDateFormat dfz = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
+			String timez = dfz.format(new Date());
+			String yearc = time.substring(0, 4);
+			int years = Integer.parseInt(yearc);
+			String monthc = time.substring(5, 7);
+			int months = Integer.parseInt(monthc);
+			String dayc = time.substring(8, 10);
+			int days = Integer.parseInt(dayc);
+			int da = days - ws;
+			String hss = time.substring(11, 13);
+			int hs = Integer.parseInt(hss);
+			//前一天8时
+			String timec = years + "-" + months + "-" + da + " 08:00:00";
+			//前24小时
+			Calendar calendar6 = Calendar.getInstance();
+			calendar6.set(Calendar.HOUR_OF_DAY, calendar6.get(Calendar.HOUR_OF_DAY) - 24);
+			String dateBegin24 = df.format(calendar6.getTime());
 
-		String substring = time.substring(0, 10);
-		//截取月日
-		String[] strs = substring.split("-");
-		//月
-		String year = strs[1].toString();
-		//日
-		String day = strs[2].toString();
-		//定义短信内容头
-		String text = year + "月" + day + "日" + hs + "时";
-		String texta = "";
-		String texth = "";
-		//定义统计数量
-		int number = 0;
-		String mouz = year + day;
-		Integer mou = Integer.parseInt(mouz);
-		String egmd = "";
-		String edmd = "";
-		List<Map<String, Object>> selectfx = rsvrRService.selectfx();
-		String b = (String) selectfx.get(0).get("BGMD");
-		String e = (String) selectfx.get(0).get("EDMD");
-		String b2 = (String) selectfx.get(1).get("BGMD");
-		String e2 = (String) selectfx.get(1).get("EDMD");
-		int bs = Integer.parseInt(b.trim());
-		int es = Integer.parseInt(e.trim());
-		int b2s = Integer.parseInt(b2.trim());
-		int e2s = Integer.parseInt(e2.trim());
-		if (mou >= bs && mou <= es) {
-			egmd = b;
-			edmd = e;
-		} else if (mou >= b2s && mou <= e2s) {
-			egmd = b2;
-			edmd = e2;
-		} else {
-			String mous = "0901";
-			int m = Integer.parseInt(mous);
-			if (m >= bs && m <= es) {
+			String substring = time.substring(0, 10);
+			//截取月日
+			String[] strs = substring.split("-");
+			//月
+			String year = strs[1].toString();
+			//日
+			String day = strs[2].toString();
+			//定义短信内容头
+			String text = year + "月" + day + "日" + hs + "时";
+			String texta = "";
+			String texth = "";
+			//定义统计数量
+			int number = 0;
+			String mouz = year + day;
+			Integer mou = Integer.parseInt(mouz);
+			String egmd = "";
+			String edmd = "";
+			List<Map<String, Object>> selectfx = rsvrRService.selectfx();
+			String b = (String) selectfx.get(0).get("BGMD");
+			String e = (String) selectfx.get(0).get("EDMD");
+			String b2 = (String) selectfx.get(1).get("BGMD");
+			String e2 = (String) selectfx.get(1).get("EDMD");
+			int bs = Integer.parseInt(b.trim());
+			int es = Integer.parseInt(e.trim());
+			int b2s = Integer.parseInt(b2.trim());
+			int e2s = Integer.parseInt(e2.trim());
+			if (mou >= bs && mou <= es) {
 				egmd = b;
 				edmd = e;
-			} else if (m >= b2s && m <= e2s) {
+			} else if (mou >= b2s && mou <= e2s) {
 				egmd = b2;
 				edmd = e2;
-			}
-		}
-		//水库水情预警信息
-		List<Map<String, Object>> map = rsvrRService.selectyjcks(egmd, edmd, timec, timez);
-		//用来判断是否重复统计超警信息
-		Map mnum = new HashMap();
-		//定义list保存预警信息
-		List alist = new ArrayList();
-		List blist = new ArrayList();
-		double RZ = 0.0;
-		double v = 0.0;
-		//定义list保存未预警信息
-		//查询数据为空
-		if (map.size() == 0) {
-			text += "暂无水库超汛限。$$$$$洪门水库&&&&&库水位暂无数据、入库流量暂无数据、蓄水量暂无数据、出库流量暂无数据;$$$$$廖坊水库&&&&&库水位暂无数据、入库流量暂无数据、蓄水量暂无数据、出库流量暂无数据。";
-		} else {
-			for (int i = 0; i < map.size(); i++) {
-				BigDecimal rz = (BigDecimal) map.get(i).get("RZ");
-				RZ = rz.doubleValue();
-				String stcd = map.get(i).get("STCD").toString();
-				String ti = map.get(i).get("TM").toString();
-				Map<String, Object> stringObjectMap = rsvrRService.selectRZ(stcd, timec);
-				//BigDecimal zc = (BigDecimal) stringObjectMap.get("RZ");
-				BigDecimal zc = (BigDecimal) map.get(i).get("RZS");
-				double ZC = zc.doubleValue();
-				Double vs = RZ - ZC;
-				DecimalFormat dfc = new DecimalFormat("#0.00");
-				String format = dfc.format(vs);
-				v = Double.parseDouble(format);
-				if (map.get(i).get("FSLTDZ") == null || RZ == 0) {
-					String addvcd5 = map.get(i).get("ADDVNM").toString();
-					//站点名称
-					String stnm = map.get(i).get("STNM").toString();
-					//实时水库水位值
-					if (stnm.equals("洪门")) {
-						texta += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
-						if (RZ == 0) {
-							texta += "库水位暂无数据、";
-						} else {
-							texta += "库水位" + RZ + "米、";
-						}
-						if (v < 0) {
-							texta += "比昨日8时下降" + Math.abs(v) + "米、";
-						} else {
-							texta += "比昨日8时上涨" + Math.abs(v) + "米、";
-						}
-						if (map.get(i).get("INQ") == null) {
-							texta += "入库流量暂无数据、";
-						} else {
-							BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
-							double INQ = inq.doubleValue();
-							texta += "入库流量" + INQ + "立方米每秒、";
-						}
-						if (map.get(i).get("W") == null) {
-							texta += "蓄水量暂无数据、";
-						} else {
-							BigDecimal w = (BigDecimal) map.get(i).get("W");
-							double W = w.doubleValue();
-							texta += "蓄水量" + W + "百万立方米、";
-						}
-						if (map.get(i).get("OTQ") == null) {
-							texta += "出库流量暂无数据、";
-						} else {
-							BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
-							double OTQ = otq.doubleValue();
-							texta += "出库流量" + OTQ + "立方米每秒;";
-						}
-//						texta += "汛限水位暂无数据;";
-					} else if (stnm.equals("廖坊")) {
-						texth += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
-						if (RZ == 0) {
-							texth += "库水位暂无数据、";
-						} else {
-							texth += "库水位" + RZ + "米、";
-						}
-						if (v < 0) {
-							texth += "比昨日8时下降" + Math.abs(v) + "米、";
-						} else {
-							texth += "比昨日8时上涨" + Math.abs(v) + "米、";
-						}
-						if (map.get(i).get("INQ") == null) {
-							texth += "入库流量暂无数据、";
-						} else {
-							BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
-							double INQ = inq.doubleValue();
-							texth += "入库流量" + INQ + "立方米每秒、";
-						}
-						if (map.get(i).get("W") == null) {
-							texth += "蓄水量暂无数据、";
-						} else {
-							BigDecimal w = (BigDecimal) map.get(i).get("W");
-							double W = w.doubleValue();
-							texth += "蓄水量" + W + "百万立方米、";
-						}
-						if (map.get(i).get("OTQ") == null) {
-							texth += "出库流量暂无数据、";
-						} else {
-							BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
-							double OTQ = otq.doubleValue();
-							texth += "出库流量" + OTQ + "立方米每秒。";
-						}
-					}
-					blist.add(map.get(i));
-					continue;
+			} else {
+				String mous = "0901";
+				int m = Integer.parseInt(mous);
+				if (m >= bs && m <= es) {
+					egmd = b;
+					edmd = e;
+				} else if (m >= b2s && m <= e2s) {
+					egmd = b2;
+					edmd = e2;
 				}
-				BigDecimal fsltdz = (BigDecimal) map.get(i).get("FSLTDZ");
-				double FSLTDZ = fsltdz.doubleValue();
-				if (RZ <= FSLTDZ) {
-					//县,市
-					String addvcd5 = map.get(i).get("ADDVNM").toString();
-					//站点名称
-					String stnm = map.get(i).get("STNM").toString();
-					//站点名称
-					if (stnm.equals("洪门")) {
-						texta += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
-						if (RZ == 0) {
-							texta += "库水位暂无数据、";
-						} else {
-							texta += "库水位" + RZ + "米、";
-						}
-						if (v < 0) {
-							texta += "比昨日8时下降" + Math.abs(v) + "米、";
-						} else {
-							texta += "比昨日8时上涨" + Math.abs(v) + "米、";
-						}
-						if (map.get(i).get("INQ") == null) {
-							texta += "入库流量暂无数据、";
-						} else {
-							BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
-							double INQ = inq.doubleValue();
-							texta += "入库流量" + INQ + "立方米每秒、";
-						}
-						if (map.get(i).get("W") == null) {
-							texta += "蓄水量暂无数据、";
-						} else {
-							BigDecimal w = (BigDecimal) map.get(i).get("W");
-							double W = w.doubleValue();
-							texta += "蓄水量" + W + "百万立方米、";
-						}
-						if (map.get(i).get("OTQ") == null) {
-							texta += "出库流量暂无数据;";
-						} else {
-							BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
-							double OTQ = otq.doubleValue();
-							texta += "出库流量" + OTQ + "立方米每秒;";
-						}
+			}
+			//水库水情预警信息
+			List<Map<String, Object>> map = rsvrRService.selectyjcks(egmd, edmd, timec, timez);
+			//用来判断是否重复统计超警信息
+			Map mnum = new HashMap();
+			//定义list保存预警信息
+			List alist = new ArrayList();
+			List blist = new ArrayList();
+			double RZ = 0.0;
+			double v = 0.0;
+			//定义list保存未预警信息
+			//查询数据为空
+			if (map.size() == 0) {
+				text += "暂无水库超汛限。$$$$$洪门水库&&&&&库水位暂无数据、入库流量暂无数据、蓄水量暂无数据、出库流量暂无数据;$$$$$廖坊水库&&&&&库水位暂无数据、入库流量暂无数据、蓄水量暂无数据、出库流量暂无数据。";
+			} else {
+				for (int i = 0; i < map.size(); i++) {
+					BigDecimal rz = (BigDecimal) map.get(i).get("RZ");
+					RZ = rz.doubleValue();
+					String stcd = map.get(i).get("STCD").toString();
+					String ti = map.get(i).get("TM").toString();
+					Map<String, Object> stringObjectMap = rsvrRService.selectRZ(stcd, timec);
+					//BigDecimal zc = (BigDecimal) stringObjectMap.get("RZ");
+					BigDecimal zc = (BigDecimal) map.get(i).get("RZS");
+					double ZC = zc.doubleValue();
+					Double vs = RZ - ZC;
+					DecimalFormat dfc = new DecimalFormat("#0.00");
+					String format = dfc.format(vs);
+					v = Double.parseDouble(format);
+					if (map.get(i).get("FSLTDZ") == null || RZ == 0) {
+						String addvcd5 = map.get(i).get("ADDVNM").toString();
+						//站点名称
+						String stnm = map.get(i).get("STNM").toString();
+						//实时水库水位值
+						if (stnm.equals("洪门")) {
+							texta += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
+							if (RZ == 0) {
+								texta += "库水位暂无数据、";
+							} else {
+								texta += "库水位" + RZ + "米、";
+							}
+							if (v < 0) {
+								texta += "比昨日8时下降" + Math.abs(v) + "米、";
+							} else {
+								texta += "比昨日8时上涨" + Math.abs(v) + "米、";
+							}
+							if (map.get(i).get("INQ") == null) {
+								texta += "入库流量暂无数据、";
+							} else {
+								BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
+								double INQ = inq.doubleValue();
+								texta += "入库流量" + INQ + "立方米每秒、";
+							}
+							if (map.get(i).get("W") == null) {
+								texta += "蓄水量暂无数据、";
+							} else {
+								BigDecimal w = (BigDecimal) map.get(i).get("W");
+								double W = w.doubleValue();
+								texta += "蓄水量" + W + "百万立方米、";
+							}
+							if (map.get(i).get("OTQ") == null) {
+								texta += "出库流量暂无数据、";
+							} else {
+								BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
+								double OTQ = otq.doubleValue();
+								texta += "出库流量" + OTQ + "立方米每秒;";
+							}
 //						texta += "汛限水位暂无数据;";
-					} else if (stnm.equals("廖坊")) {
-						texth += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
-						if (RZ == 0) {
-							texth += "库水位暂无数据、";
-						} else {
-							texth += "库水位" + RZ + "米、";
+						} else if (stnm.equals("廖坊")) {
+							texth += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
+							if (RZ == 0) {
+								texth += "库水位暂无数据、";
+							} else {
+								texth += "库水位" + RZ + "米、";
+							}
+							if (v < 0) {
+								texth += "比昨日8时下降" + Math.abs(v) + "米、";
+							} else {
+								texth += "比昨日8时上涨" + Math.abs(v) + "米、";
+							}
+							if (map.get(i).get("INQ") == null) {
+								texth += "入库流量暂无数据、";
+							} else {
+								BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
+								double INQ = inq.doubleValue();
+								texth += "入库流量" + INQ + "立方米每秒、";
+							}
+							if (map.get(i).get("W") == null) {
+								texth += "蓄水量暂无数据、";
+							} else {
+								BigDecimal w = (BigDecimal) map.get(i).get("W");
+								double W = w.doubleValue();
+								texth += "蓄水量" + W + "百万立方米、";
+							}
+							if (map.get(i).get("OTQ") == null) {
+								texth += "出库流量暂无数据、";
+							} else {
+								BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
+								double OTQ = otq.doubleValue();
+								texth += "出库流量" + OTQ + "立方米每秒。";
+							}
 						}
-						if (v < 0) {
-							texth += "比昨日8时下降" + Math.abs(v) + "米、";
-						} else {
-							texth += "比昨日8时上涨" + Math.abs(v) + "米、";
-						}
-						if (map.get(i).get("INQ") == null) {
-							texth += "入库流量暂无数据、";
-						} else {
-							BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
-							double INQ = inq.doubleValue();
-							texth += "入库流量" + INQ + "立方米每秒、";
-						}
-						if (map.get(i).get("W") == null) {
-							texth += "蓄水量暂无数据、";
-						} else {
-							BigDecimal w = (BigDecimal) map.get(i).get("W");
-							double W = w.doubleValue();
-							texth += "蓄水量" + W + "百万立方米、";
-						}
-						if (map.get(i).get("OTQ") == null) {
-							texth += "出库流量暂无数据。";
-						} else {
-							BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
-							double OTQ = otq.doubleValue();
-							texth += "出库流量" + OTQ + "立方米每秒。";
-						}
+						blist.add(map.get(i));
+						continue;
 					}
-					blist.add(map.get(i));
-				} else {
-					//如果map集合保存了站点则不重复统计数量
-					//如果map集合保存了站点则不重复统计数量
-					if (mnum.containsKey(map.get(i).get("STCD").toString()) == true) {
-					} else {
-						alist.add(map.get(i));
-						mnum.put(map.get(i).get("STCD").toString(), i);
-						number++;
-						//超出警戒水位多少
-						Double num = RZ - FSLTDZ;
-						double v3 = (double) Math.round(num * 100) / 100;
+					BigDecimal fsltdz = (BigDecimal) map.get(i).get("FSLTDZ");
+					double FSLTDZ = fsltdz.doubleValue();
+					if (RZ <= FSLTDZ) {
 						//县,市
 						String addvcd5 = map.get(i).get("ADDVNM").toString();
 						//站点名称
 						String stnm = map.get(i).get("STNM").toString();
+						//站点名称
 						if (stnm.equals("洪门")) {
 							texta += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
 							if (RZ == 0) {
@@ -818,217 +748,302 @@
 								texth += "出库流量" + OTQ + "立方米每秒。";
 							}
 						}
+						blist.add(map.get(i));
+					} else {
+						//如果map集合保存了站点则不重复统计数量
+						//如果map集合保存了站点则不重复统计数量
+						if (mnum.containsKey(map.get(i).get("STCD").toString()) == true) {
+						} else {
+							alist.add(map.get(i));
+							mnum.put(map.get(i).get("STCD").toString(), i);
+							number++;
+							//超出警戒水位多少
+							Double num = RZ - FSLTDZ;
+							double v3 = (double) Math.round(num * 100) / 100;
+							//县,市
+							String addvcd5 = map.get(i).get("ADDVNM").toString();
+							//站点名称
+							String stnm = map.get(i).get("STNM").toString();
+							if (stnm.equals("洪门")) {
+								texta += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
+								if (RZ == 0) {
+									texta += "库水位暂无数据、";
+								} else {
+									texta += "库水位" + RZ + "米、";
+								}
+								if (v < 0) {
+									texta += "比昨日8时下降" + Math.abs(v) + "米、";
+								} else {
+									texta += "比昨日8时上涨" + Math.abs(v) + "米、";
+								}
+								if (map.get(i).get("INQ") == null) {
+									texta += "入库流量暂无数据、";
+								} else {
+									BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
+									double INQ = inq.doubleValue();
+									texta += "入库流量" + INQ + "立方米每秒、";
+								}
+								if (map.get(i).get("W") == null) {
+									texta += "蓄水量暂无数据、";
+								} else {
+									BigDecimal w = (BigDecimal) map.get(i).get("W");
+									double W = w.doubleValue();
+									texta += "蓄水量" + W + "百万立方米、";
+								}
+								if (map.get(i).get("OTQ") == null) {
+									texta += "出库流量暂无数据;";
+								} else {
+									BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
+									double OTQ = otq.doubleValue();
+									texta += "出库流量" + OTQ + "立方米每秒;";
+								}
+//						texta += "汛限水位暂无数据;";
+							} else if (stnm.equals("廖坊")) {
+								texth += "$$$$$" + stnm.replaceAll(" ", "") + "水库&&&&&";
+								if (RZ == 0) {
+									texth += "库水位暂无数据、";
+								} else {
+									texth += "库水位" + RZ + "米、";
+								}
+								if (v < 0) {
+									texth += "比昨日8时下降" + Math.abs(v) + "米、";
+								} else {
+									texth += "比昨日8时上涨" + Math.abs(v) + "米、";
+								}
+								if (map.get(i).get("INQ") == null) {
+									texth += "入库流量暂无数据、";
+								} else {
+									BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
+									double INQ = inq.doubleValue();
+									texth += "入库流量" + INQ + "立方米每秒、";
+								}
+								if (map.get(i).get("W") == null) {
+									texth += "蓄水量暂无数据、";
+								} else {
+									BigDecimal w = (BigDecimal) map.get(i).get("W");
+									double W = w.doubleValue();
+									texth += "蓄水量" + W + "百万立方米、";
+								}
+								if (map.get(i).get("OTQ") == null) {
+									texth += "出库流量暂无数据。";
+								} else {
+									BigDecimal otq = (BigDecimal) map.get(i).get("OTQ");
+									double OTQ = otq.doubleValue();
+									texth += "出库流量" + OTQ + "立方米每秒。";
+								}
+							}
+						}
 					}
 				}
+				if (number == 0) {
+					text += texta + texth;
+				} else {
+					text += "有" + number + "个水库站超汛限;" + texta + texth;
+				}
 			}
-			if (number == 0) {
-				text += texta + texth;
-			} else {
-				text += "有" + number + "个水库站超汛限;" + texta + texth;
+			Map m = new HashMap();
+			List list = new ArrayList();
+			m.put("text", text);
+			m.put("number", number);
+			m.put("Yjlist", alist);
+			m.put("list", blist);
+			list.add(m);
+			return R.data(list);
+		}
+
+		/**
+		 * 水库详情
+		 *
+		 * @param stcd
+		 * @return
+		 */
+		@PostMapping("/selectInfo")
+		public R selectInfo (String stcd){
+			return R.data(rsvrRService.selectInfo(stcd));
+		}
+
+
+		@PostMapping("/selectTinfo")
+		public R selectTinfo (String stcd){
+			Calendar cal = Calendar.getInstance();
+			int mnth = cal.get(Calendar.MONTH) + 1;
+			return R.data(rsvrRService.selectTinfo(mnth, stcd));
+		}
+
+		/**
+		 * 求Map<K,V>中Key(键)的最大值
+		 *
+		 * @param map
+		 * @return
+		 */
+		public static Object getMaxKey (Map < Double, Integer > map){
+			if (map == null) return null;
+			Set<Double> set = map.keySet();
+			Object[] obj = set.toArray();
+			Arrays.sort(obj);
+			return obj[obj.length - 1];
+		}
+
+		/**
+		 * 求Map<K,V>中Value(值)的最大值
+		 *
+		 * @param map
+		 * @return
+		 */
+		public static Object getMaxValue (Map < Integer, Integer > map){
+			if (map == null) return null;
+			Collection<Integer> c = map.values();
+			Object[] obj = c.toArray();
+			Arrays.sort(obj);
+			return obj[obj.length - 1];
+		}
+
+
+		/**
+		 * 水位流量曲线
+		 *
+		 * @param stcd
+		 * @return
+		 */
+		@PostMapping("/selList")
+		public R selList (String stcd){
+			List<Map<String, Object>> newList = rsvrRService.selList(stcd);
+			Map<String, List<Map>> mm = new HashMap();
+			for (Map temp : newList) {
+				if (mm.containsKey(temp.get("LNNM")))
+					mm.get(temp.get("LNNM")).add(temp);
+				else {
+					List<Map> ll = new ArrayList<>();
+					ll.add(temp);
+					mm.put((String) temp.get("LNNM"), ll);
+				}
 			}
-		}
-		Map m = new HashMap();
-		List list = new ArrayList();
-		m.put("text", text);
-		m.put("number", number);
-		m.put("Yjlist", alist);
-		m.put("list", blist);
-		list.add(m);
-		return R.data(list);
-	}
-
-	/**
-	 * 水库详情
-	 *
-	 * @param stcd
-	 * @return
-	 */
-	@PostMapping("/selectInfo")
-	public R selectInfo(String stcd) {
-		return R.data(rsvrRService.selectInfo(stcd));
-	}
-
-
-	@PostMapping("/selectTinfo")
-	public R selectTinfo(String stcd) {
-		Calendar cal = Calendar.getInstance();
-		int mnth = cal.get(Calendar.MONTH) + 1;
-		return R.data(rsvrRService.selectTinfo(mnth, stcd));
-	}
-
-	/**
-	 * 求Map<K,V>中Key(键)的最大值
-	 *
-	 * @param map
-	 * @return
-	 */
-	public static Object getMaxKey(Map<Double, Integer> map) {
-		if (map == null) return null;
-		Set<Double> set = map.keySet();
-		Object[] obj = set.toArray();
-		Arrays.sort(obj);
-		return obj[obj.length - 1];
-	}
-
-	/**
-	 * 求Map<K,V>中Value(值)的最大值
-	 *
-	 * @param map
-	 * @return
-	 */
-	public static Object getMaxValue(Map<Integer, Integer> map) {
-		if (map == null) return null;
-		Collection<Integer> c = map.values();
-		Object[] obj = c.toArray();
-		Arrays.sort(obj);
-		return obj[obj.length - 1];
-	}
-
-
-	/**
-	 * 水位流量曲线
-	 *
-	 * @param stcd
-	 * @return
-	 */
-	@PostMapping("/selList")
-	public R selList(String stcd) {
-		List<Map<String, Object>> newList = rsvrRService.selList(stcd);
-		Map<String, List<Map>> mm = new HashMap();
-		for (Map temp : newList) {
-			if (mm.containsKey(temp.get("LNNM")))
-				mm.get(temp.get("LNNM")).add(temp);
-			else {
-				List<Map> ll = new ArrayList<>();
-				ll.add(temp);
-				mm.put((String) temp.get("LNNM"), ll);
+			List<List<Map>> res = new ArrayList();
+			for (Map.Entry<String, List<Map>> et : mm.entrySet()) {
+				res.add(et.getValue());
 			}
+			return R.data(res);
 		}
-		List<List<Map>> res = new ArrayList();
-		for (Map.Entry<String, List<Map>> et : mm.entrySet()) {
-			res.add(et.getValue());
+
+		/**
+		 * 库容曲线
+		 *
+		 * @param stcd
+		 * @return
+		 */
+		@PostMapping("/selLists")
+		public R selLists (String stcd){
+			return R.data(rsvrRService.selLists(stcd));
 		}
-		return R.data(res);
-	}
-
-	/**
-	 * 库容曲线
-	 *
-	 * @param stcd
-	 * @return
-	 */
-	@PostMapping("/selLists")
-	public R selLists(String stcd) {
-		return R.data(rsvrRService.selLists(stcd));
-	}
 
 
-	/**
-	 * 水库站水位流量过程接口
-	 */
-	@PostMapping("/selectRsvrList")
-	@ApiOperation(value = "水库站水位过程接口", notes = "code,dateBegin,dateEnd")
-	public R selectRsvrList(String code, String dateBegin, String dateEnd) {
-		List<Map<String, Object>> list = rsvrRService.selectRsvrList(code, dateBegin, dateEnd);
-		return R.data(list);
-	}
-
-	/**
-	 * 河道水位流量过程接口
-	 */
-	@PostMapping("/selectRiverList")
-	@ApiOperation(value = "水库站水位过程接口", notes = "code,dateBegin,dateEnd")
-	public R selectRiverList(String code, String dateBegin, String dateEnd) {
-		List<Map<String, Object>> list = rsvrRService.selectRsvrLists(code, dateBegin, dateEnd);
-		return R.data(list);
-	}
-
-	/**
-	 * 水库实时预警
-	 */
-	@ApiLog("水库实时预警")
-	@PostMapping("/selectyj")
-	@ApiOperation(value = "水库实时预警", notes = "")
-	public R selectyj(String times, int mou, int k) {
-		Date date = null;
-		// 把Date按照格式转换成字符串
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-		try {
-			date = sdf.parse(times);
-		} catch (ParseException e) {
-			e.printStackTrace();
+		/**
+		 * 水库站水位流量过程接口
+		 */
+		@PostMapping("/selectRsvrList")
+		@ApiOperation(value = "水库站水位过程接口", notes = "code,dateBegin,dateEnd")
+		public R selectRsvrList (String code, String dateBegin, String dateEnd){
+			List<Map<String, Object>> list = rsvrRService.selectRsvrList(code, dateBegin, dateEnd);
+			return R.data(list);
 		}
-		String dateEnd = sdf.format(date);
 
-		String egmd = "";
-		String edmd = "";
-		List<Map<String, Object>> selectfx = rsvrRService.selectfx();
-		String b = (String) selectfx.get(0).get("BGMD");
-		String e = (String) selectfx.get(0).get("EDMD");
-		String b2 = (String) selectfx.get(1).get("BGMD");
-		String e2 = (String) selectfx.get(1).get("EDMD");
-		int bs = Integer.parseInt(b.trim());
-		int es = Integer.parseInt(e.trim());
-		int b2s = Integer.parseInt(b2.trim());
-		int e2s = Integer.parseInt(e2.trim());
-		if (mou >= bs && mou <= es) {
-			egmd = b;
-			edmd = e;
-		} else if (mou >= b2s && mou <= e2s) {
-			egmd = b2;
-			edmd = e2;
-		} else {
-			String mous = "0901";
-			int m = Integer.parseInt(mous);
-			if (m >= bs && m <= es) {
+		/**
+		 * 河道水位流量过程接口
+		 */
+		@PostMapping("/selectRiverList")
+		@ApiOperation(value = "水库站水位过程接口", notes = "code,dateBegin,dateEnd")
+		public R selectRiverList (String code, String dateBegin, String dateEnd){
+			List<Map<String, Object>> list = rsvrRService.selectRsvrLists(code, dateBegin, dateEnd);
+			return R.data(list);
+		}
+
+		/**
+		 * 水库实时预警
+		 */
+		@ApiLog("水库实时预警")
+		@PostMapping("/selectyj")
+		@ApiOperation(value = "水库实时预警", notes = "")
+		public R selectyj (String times,int mou, int k){
+			Date date = null;
+			// 把Date按照格式转换成字符串
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+			try {
+				date = sdf.parse(times);
+			} catch (ParseException e) {
+				e.printStackTrace();
+			}
+			String dateEnd = sdf.format(date);
+
+			String egmd = "";
+			String edmd = "";
+			List<Map<String, Object>> selectfx = rsvrRService.selectfx();
+			String b = (String) selectfx.get(0).get("BGMD");
+			String e = (String) selectfx.get(0).get("EDMD");
+			String b2 = (String) selectfx.get(1).get("BGMD");
+			String e2 = (String) selectfx.get(1).get("EDMD");
+			int bs = Integer.parseInt(b.trim());
+			int es = Integer.parseInt(e.trim());
+			int b2s = Integer.parseInt(b2.trim());
+			int e2s = Integer.parseInt(e2.trim());
+			if (mou >= bs && mou <= es) {
 				egmd = b;
 				edmd = e;
-			} else if (m >= b2s && m <= e2s) {
+			} else if (mou >= b2s && mou <= e2s) {
 				egmd = b2;
 				edmd = e2;
-			}
-		}
-		List<Map<String, Object>> map;
-		if (k == 13) {
-			map = rsvrRService.selectyj(egmd, edmd, times, dateEnd);
-		} else {
-			map = rsvrRService.selectyj(egmd, edmd, times, dateEnd);
-		}
-		List<Map<String, Object>> lists = new ArrayList<>();
-		for (int i = 0; i < map.size(); i++) {
-			Map<String, Object> maps = new HashMap<String, Object>();
-			BigDecimal bigDecimaldz = (BigDecimal) map.get(i).get("FSLTDZ");//汛限水位
-			BigDecimal bigDecimalrz = (BigDecimal) map.get(i).get("RZ");//当前水位
-			BigDecimal bigDecimallz = (BigDecimal) map.get(i).get("DSFLZ");//设计水位
-			BigDecimal bigDecimalmz = (BigDecimal) map.get(i).get("NORMZ");//防洪高水位
-			double dz = bigDecimaldz.doubleValue();
-			double rz = bigDecimalrz.doubleValue();
-			double lz = bigDecimallz.doubleValue();
-			double mz = bigDecimalmz.doubleValue();
-			double num = 0.5;
-			double s = dz - num;
-			if (dz == 0) {
-				map.get(i).put("yj", "无预警");
-				maps.put("YjList", map.get(i));
-				lists.add(maps);
 			} else {
-				if (rz > 0 && rz < s) {
-					map.get(i).put("yj", "无预警");
-				} else if (rz >= s && rz < dz) {
-					map.get(i).put("yj", "蓝色预警");
-				} else if (rz >= dz && rz < mz) {
-					map.get(i).put("yj", "黄色预警");
-				} else if (rz >= mz && rz < lz) {
-					map.get(i).put("yj", "橙色预警");
-				} else {
-					map.get(i).put("yj", "红色预警");
+				String mous = "0901";
+				int m = Integer.parseInt(mous);
+				if (m >= bs && m <= es) {
+					egmd = b;
+					edmd = e;
+				} else if (m >= b2s && m <= e2s) {
+					egmd = b2;
+					edmd = e2;
 				}
-				maps.put("YjList", map.get(i));
-				lists.add(maps);
 			}
+			List<Map<String, Object>> map;
+			if (k == 13) {
+				map = rsvrRService.selectyj(egmd, edmd, times, dateEnd);
+			} else {
+				map = rsvrRService.selectyj(egmd, edmd, times, dateEnd);
+			}
+			List<Map<String, Object>> lists = new ArrayList<>();
+			for (int i = 0; i < map.size(); i++) {
+				Map<String, Object> maps = new HashMap<String, Object>();
+				BigDecimal bigDecimaldz = (BigDecimal) map.get(i).get("FSLTDZ");//汛限水位
+				BigDecimal bigDecimalrz = (BigDecimal) map.get(i).get("RZ");//当前水位
+				BigDecimal bigDecimallz = (BigDecimal) map.get(i).get("DSFLZ");//设计水位
+				BigDecimal bigDecimalmz = (BigDecimal) map.get(i).get("NORMZ");//防洪高水位
+				double dz = bigDecimaldz.doubleValue();
+				double rz = bigDecimalrz.doubleValue();
+				double lz = bigDecimallz.doubleValue();
+				double mz = bigDecimalmz.doubleValue();
+				double num = 0.5;
+				double s = dz - num;
+				if (dz == 0) {
+					map.get(i).put("yj", "无预警");
+					maps.put("YjList", map.get(i));
+					lists.add(maps);
+				} else {
+					if (rz > 0 && rz < s) {
+						map.get(i).put("yj", "无预警");
+					} else if (rz >= s && rz < dz) {
+						map.get(i).put("yj", "蓝色预警");
+					} else if (rz >= dz && rz < mz) {
+						map.get(i).put("yj", "黄色预警");
+					} else if (rz >= mz && rz < lz) {
+						map.get(i).put("yj", "橙色预警");
+					} else {
+						map.get(i).put("yj", "红色预警");
+					}
+					maps.put("YjList", map.get(i));
+					lists.add(maps);
+				}
+			}
+
+			return R.data(lists);
 		}
 
-		return R.data(lists);
 	}
 
-}
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index 1f248d3..730da54 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -16,13 +16,13 @@
       primary: master
       datasource:
         master:
-          url: jdbc:sqlserver://47.110.245.84:1433;DatabaseName=fzsw
+          url: jdbc:sqlserver://10.36.98.39:1433;DatabaseName=fzsw
           username: sa
-          password: jxpskj2018
+          password: fzsw@2021
         slaves:
-            url: jdbc:sqlserver://47.110.245.84:1433;DatabaseName=fzswS
+            url: jdbc:sqlserver://10.36.98.39:1433;DatabaseName=fzswS
             username: sa
-            password: jxpskj2018
+            password: fzsw@2021
 
 
 #第三方登陆

--
Gitblit v1.9.3