From 0fa45101a494897fe93b90d805b3ff0aedd36e17 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Wed, 15 Sep 2021 16:24:35 +0800
Subject: [PATCH] 1.山洪
---
src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java | 138 ++++++++++++++++++++++++++++++++++-----------
1 files changed, 103 insertions(+), 35 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 0297cf2..c870d42 100644
--- a/src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java
+++ b/src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java
@@ -490,17 +490,57 @@
}
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(),
- mountainrainsCVOS.get(i).getGohours(), mountainrainsCVOS.get(i).getGthours());
- 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).getGohours(), mountainrainsCVOS.get(i).getGthours());
+// map.put("List", mountainrainsCVOS.get(i));
+// map.put("Max", Max);
+// lists.add(map);
+ //0.8雨量湿度
+ if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
+ map.put("List", mountainrainsCVOS.get(i));
+ map.put("flage1", "true");
+ map.put("flage3", "false");
+ map.put("status", 2);
+ lists.add(map);
+ } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthours()) {
+ map.put("List", mountainrainsCVOS.get(i));
+ map.put("flage1", "false");
+ map.put("flage3", "true");
+ map.put("status", 2);
+ lists.add(map);
+ } else {
+ map.put("List", mountainrainsCVOS.get(i));
+ map.put("flage1", "false");
+ map.put("flage3", "false");
+ map.put("status", 2);
+ lists.add(map);
+ }
} else {
+ //0.5雨量湿度
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);
+// map.put("List", mountainrainsCVOS.get(i));
+// map.put("Max", Max);
+// lists.add(map);
+ if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
+ map.put("List", mountainrainsCVOS.get(i));
+ map.put("flage1", "true");
+ map.put("flage3", "false");
+ map.put("status", 1);
+ lists.add(map);
+ } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthour()) {
+ map.put("List", mountainrainsCVOS.get(i));
+ map.put("flage1", "false");
+ map.put("flage3", "true");
+ map.put("status", 1);
+ lists.add(map);
+ } else {
+ map.put("List", mountainrainsCVOS.get(i));
+ map.put("flage1", "false");
+ map.put("flage3", "false");
+ map.put("status", 1);
+ lists.add(map);
+ }
}
}
@@ -522,31 +562,55 @@
String dateEnd3 = dateEnds3;
String s = regionWeightService.selectCode();
+ //String s = "62334490";
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);
- List<Map<String, Integer>> list = mountainrainService.selecMone(times, dateEnd1, dateEnd2, dateEnd3, code);
+ List<Map<String, Object>> list = mountainrainService.selecMone(times, dateEnd1, dateEnd2, dateEnd3, code);
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) {
+ BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
+ double drp1 = w1.doubleValue();
+ BigDecimal w2 = (BigDecimal) list.get(i).get("drp2");
+ double drp2 = w2.doubleValue();
+ BigDecimal w3 = (BigDecimal) list.get(i).get("drp3");
+ double drp3 = w3.doubleValue();
+ if (drp1 > 30) {
+ Map<String, Object> map = new HashMap<String, Object>();
map.put("List", list.get(i));
- map.put("Max", 1);
+ map.put("flage1", "true");
+ map.put("flage2", "false");
+ map.put("flage3", "false");
+ lists.add(map);
}
- if (list.get(i).get("drp2") >= 50) {
+ if (drp2 > 50) {
+ Map<String, Object> map = new HashMap<String, Object>();
map.put("List", list.get(i));
- map.put("Max", 2);
+ map.put("flage1", "false");
+ map.put("flage2", "true");
+ map.put("flage3", "false");
+ lists.add(map);
}
- if (list.get(i).get("drp3") >= 80) {
+ if (drp3 > 80) {
+ Map<String, Object> map = new HashMap<String, Object>();
map.put("List", list.get(i));
- map.put("Max", 3);
+ map.put("flage1", "false");
+ map.put("flage2", "false");
+ map.put("flage3", "true");
+ lists.add(map);
+ } else {
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("List", list.get(i));
+ map.put("flage1", "false");
+ map.put("flage2", "false");
+ map.put("flage3", "false");
+ lists.add(map);
}
}
- lists.add(map);
return R.data(lists);
}
@@ -557,7 +621,7 @@
*
* @return
*/
- //@Scheduled(cron = "0 0 8 * * ?")
+ @Scheduled(cron = "0 0 8 * * ?")
@GetMapping("/soleval")
public R soleval() {
mountainrainService.soildel();
@@ -568,7 +632,6 @@
}
Collections.sort(passDaysList);
String s = mountainrainService.selectCode();
- //String s = "62310356,62310305";
String[] split = s.split(",");
String strArrays = "";
for (int i = 0; i < split.length; i++) {
@@ -579,22 +642,28 @@
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;
+ 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;
+ }
+ }
}
- 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 {
@@ -624,4 +693,3 @@
}
}
-
--
Gitblit v1.9.3