From 7722d9782d843c2f36c5a94d3a295251c025b37b Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Tue, 12 Oct 2021 10:08:44 +0800
Subject: [PATCH] 1.山洪
---
src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java | 180 +++++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 123 insertions(+), 57 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 3220316..6b0b962 100644
--- a/src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java
+++ b/src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java
@@ -23,6 +23,7 @@
import lombok.AllArgsConstructor;
import org.apache.poi.hssf.usermodel.*;
import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
@@ -33,10 +34,16 @@
import org.springblade.modules.mountain.vo.MountainVO;
import org.springblade.modules.mountainrain.entity.Mountainrain;
import org.springblade.modules.mountainrain.entity.Yucpptn;
+import org.springblade.modules.mountainrain.excel.BgrExcel;
+import org.springblade.modules.mountainrain.excel.BgrImporter;
+import org.springblade.modules.mountainrain.excel.MgrExcel;
+import org.springblade.modules.mountainrain.excel.MgrImporter;
import org.springblade.modules.mountainrain.service.IMountainrainService;
import org.springblade.modules.mountainrain.vo.*;
import org.springblade.modules.mountainrain.wrapper.MountainrainWrapper;
import org.springblade.modules.regionWeight.service.IRegionWeightService;
+import org.springblade.modules.system.excel.UserExcel;
+import org.springblade.modules.system.excel.UserImporter;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -47,6 +54,7 @@
import java.io.*;
import java.math.BigDecimal;
import java.net.URLEncoder;
+import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -598,8 +606,13 @@
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("python D:\\fz\\mou.py");
+ proc = Runtime.getRuntime().exec(args1);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
@@ -612,6 +625,7 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
+ lists.add(m);
return R.data(lists);
}
@@ -720,8 +734,13 @@
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("python D:\\fz\\moup.py");
+ proc = Runtime.getRuntime().exec(args1);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
@@ -734,6 +753,7 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
+ lists.add(m);
return R.data(lists);
}
@@ -757,44 +777,43 @@
String s = regionWeightService.selectCode();
String[] split = s.split(",");
String strArrays = "";
- System.out.println("长度:"+split.length);
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);
-// }
-// }
+ 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("成功");
}
@@ -1121,6 +1140,7 @@
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);
@@ -1223,8 +1243,13 @@
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("python D:\\fz\\mou.py");
+ proc = Runtime.getRuntime().exec(args1);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
@@ -1237,6 +1262,7 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
+ lists.add(m);
return R.data(lists);
}
@@ -1263,8 +1289,9 @@
double drp1 = w1.doubleValue();
if (drp1 > 30) {
double v = drp1 - 30;
+ double v1 = (double) Math.round(v * 100) / 100;
map.put("flage1", "true");
- map.put("num", v);
+ map.put("num", v1);
} else {
map.put("flage1", "false");
}
@@ -1314,8 +1341,13 @@
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("python D:\\fz\\moup.py");
+ proc = Runtime.getRuntime().exec(args1);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
@@ -1328,6 +1360,7 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
+ lists.add(m);
return R.data(lists);
}
@@ -1475,8 +1508,13 @@
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("python D:\\fz\\mou.py");
+ proc = Runtime.getRuntime().exec(args1);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
@@ -1489,6 +1527,7 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
+ lists.add(m);
return R.data(lists);
}
@@ -1515,8 +1554,9 @@
double drp1 = w1.doubleValue();
if (drp1 > 50) {
double v = drp1 - 50;
+ double v1 = (double) Math.round(v * 100) / 100;
map.put("flage2", "true");
- map.put("num", v);
+ map.put("num", v1);
} else {
map.put("flage2", "false");
}
@@ -1566,8 +1606,13 @@
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("python D:\\fz\\moup.py");
+ proc = Runtime.getRuntime().exec(args1);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
@@ -1580,6 +1625,7 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
+ lists.add(m);
return R.data(lists);
}
@@ -1706,8 +1752,13 @@
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("python D:\\fz\\mou.py");
+ proc = Runtime.getRuntime().exec(args1);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
@@ -1720,6 +1771,7 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
+ lists.add(m);
return R.data(lists);
}
@@ -1746,8 +1798,9 @@
double drp1 = w1.doubleValue();
if (drp1 > 80) {
double v = drp1 - 80;
+ double v1 = (double) Math.round(v * 100) / 100;
map.put("flage3", "true");
- map.put("num", v);
+ map.put("num", v1);
} else {
map.put("flage3", "false");
}
@@ -1798,8 +1851,13 @@
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("python D:\\fz\\moup.py");
+ proc = Runtime.getRuntime().exec(args1);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
@@ -1812,6 +1870,7 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
+ lists.add(m);
return R.data(lists);
}
@@ -1821,7 +1880,7 @@
* 土壤色斑图
*/
@GetMapping("/selectS")
- public void selectS(){
+ public R selectS() {
List<Map<String, Object>> list = mountainrainService.selectS();
String fileName = "";
// 第一步,创建一个webbook,对应一个Excel文件
@@ -1847,47 +1906,47 @@
row.createCell((short) 0).setCellValue(list.get(i).get("LGTD").toString());
row.createCell((short) 1).setCellValue(list.get(i).get("LTTD").toString());
row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString());
- if (stcd.equals("62455350")){
+ if (stcd.equals("62455350")) {
row.createCell((short) 0).setCellValue("117.344876");
row.createCell((short) 1).setCellValue("27.827067");
row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString());
}
- if (stcd.equals("62334845")){
+ if (stcd.equals("62334845")) {
row.createCell((short) 0).setCellValue("115.625720");
row.createCell((short) 1).setCellValue("27.152794");
row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString());
}
- if (stcd.equals("62433800")){
+ if (stcd.equals("62433800")) {
row.createCell((short) 0).setCellValue("115.618546");
row.createCell((short) 1).setCellValue("27.683604");
row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString());
}
- if (stcd.equals("62436760")){
+ if (stcd.equals("62436760")) {
row.createCell((short) 0).setCellValue("116.060889");
row.createCell((short) 1).setCellValue("28.216806");
row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString());
}
- if (stcd.equals("62437250")){
+ if (stcd.equals("62437250")) {
row.createCell((short) 0).setCellValue("116.622783");
row.createCell((short) 1).setCellValue("28.489384");
row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString());
}
- if (stcd.equals("62433700")){
+ if (stcd.equals("62433700")) {
row.createCell((short) 0).setCellValue("115.558771");
row.createCell((short) 1).setCellValue("27.518623");
row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString());
}
- if (stcd.equals("62425740")){
+ if (stcd.equals("62425740")) {
row.createCell((short) 0).setCellValue("117.208587");
row.createCell((short) 1).setCellValue("27.298647");
row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString());
}
- if (stcd.equals("62437235")){
+ if (stcd.equals("62437235")) {
row.createCell((short) 0).setCellValue("116.780591");
row.createCell((short) 1).setCellValue("28.391352");
row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString());
}
- if (stcd.equals("62437250")){
+ if (stcd.equals("62437250")) {
row.createCell((short) 0).setCellValue("116.555834");
row.createCell((short) 1).setCellValue("28.518077");
row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString());
@@ -1904,8 +1963,13 @@
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\\tur.py", String.valueOf(url)};
try {
- proc = Runtime.getRuntime().exec("python D:\\fz\\tur.py");
+ proc = Runtime.getRuntime().exec(args1);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
@@ -1918,7 +1982,9 @@
} catch (InterruptedException e) {
e.printStackTrace();
}
+ return R.data(m);
+ }
-}
+
}
--
Gitblit v1.9.3