| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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.*; |
| | |
| | | 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) { |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | lists.add(m); |
| | | return R.data(lists); |
| | | |
| | | } |
| | |
| | | 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) { |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | lists.add(m); |
| | | return R.data(lists); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 土壤湿度计算 |
| | | * |
| | | * @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 = ""; |
| | | System.out.println("长度:"+split.length); |
| | | for (int i = 0; i < split.length; i++) { |
| | | strArrays += "'" + split[i] + "',"; |
| | | } |
| | | String code = strArrays.substring(0, strArrays.length() - 1); |
| | | // /** |
| | | // * 土壤湿度计算 |
| | | // * |
| | | // * @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; |
| | |
| | | // mountainrainService.soleInster(stcd, a); |
| | | // } |
| | | // } |
| | | |
| | | return R.success("成功"); |
| | | } |
| | | // |
| | | // return R.success("成功"); |
| | | // } |
| | | |
| | | public static double formatDouble1(double d) { |
| | | return (double) Math.round(d * 10) / 10; |
| | |
| | | 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); |
| | |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) { |
| | | int drp1 = mountainrainsCVOS.get(i).getDrp1(); |
| | | Integer gohours = mountainrainsCVOS.get(i).getGohours(); |
| | | int i1 = drp1 - gohours; |
| | | float i1 = (float)drp1 - gohours; |
| | | float v = (float) (Math.round(i1 * 10)) / 10; |
| | | String a= String.valueOf(v); |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "true"); |
| | | map.put("status", 2); |
| | | map.put("num", i1); |
| | | map.put("num", a); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) { |
| | | int drp1 = mountainrainsCVOS.get(i).getDrp1(); |
| | | Integer gohour = mountainrainsCVOS.get(i).getGohour(); |
| | | int i1 = drp1 - gohour; |
| | | float i1 = (float)drp1 - gohour; |
| | | float v = (float) (Math.round(i1 * 10)) / 10; |
| | | String a= String.valueOf(v); |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "true"); |
| | | map.put("status", 1); |
| | | map.put("num", i1); |
| | | map.put("num", a); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | |
| | | 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) { |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | lists.add(m); |
| | | return R.data(lists); |
| | | |
| | | } |
| | |
| | | double drp1 = w1.doubleValue(); |
| | | if (drp1 > 30) { |
| | | double v = drp1 - 30; |
| | | double v1 = (double) Math.round(v * 100) / 100; |
| | | String a=String.valueOf(v1); |
| | | map.put("flage1", "true"); |
| | | map.put("num", v); |
| | | map.put("num", a); |
| | | } else { |
| | | map.put("flage1", "false"); |
| | | } |
| | |
| | | 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) { |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | lists.add(m); |
| | | return R.data(lists); |
| | | } |
| | | |
| | |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) { |
| | | int drp1 = mountainrainsCVOS.get(i).getDrp1(); |
| | | Integer gohours = mountainrainsCVOS.get(i).getGohours(); |
| | | int i1 = drp1 - gohours; |
| | | float i1 = (float)drp1 - gohours; |
| | | float v = (float) (Math.round(i1 * 10)) / 10; |
| | | String a= String.valueOf(v); |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "true"); |
| | | map.put("flage3", "false"); |
| | | map.put("status", 2); |
| | | map.put("num", i1); |
| | | map.put("num", a); |
| | | lists.add(map); |
| | | } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthours()) { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) { |
| | | int drp1 = mountainrainsCVOS.get(i).getDrp1(); |
| | | Integer gohour = mountainrainsCVOS.get(i).getGohour(); |
| | | int i1 = drp1 - gohour; |
| | | float i1 = (float)drp1 - gohour; |
| | | float v = (float) (Math.round(i1 * 10)) / 10; |
| | | String a= String.valueOf(v); |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "true"); |
| | | map.put("flage3", "false"); |
| | | map.put("status", 1); |
| | | map.put("num", i1); |
| | | map.put("num", a); |
| | | lists.add(map); |
| | | } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthour()) { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | |
| | | 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) { |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | lists.add(m); |
| | | return R.data(lists); |
| | | |
| | | } |
| | |
| | | double drp1 = w1.doubleValue(); |
| | | if (drp1 > 50) { |
| | | double v = drp1 - 50; |
| | | double v1 = (double) Math.round(v * 10) / 10; |
| | | map.put("flage2", "true"); |
| | | map.put("num", v); |
| | | map.put("num", v1); |
| | | } else { |
| | | map.put("flage2", "false"); |
| | | } |
| | |
| | | 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; |
| | | } |
| | | if (drp1 > 50) { |
| | | row.createCell((short) 2).setCellValue(2); |
| | | continue; |
| | | } else { |
| | | row.createCell((short) 2).setCellValue(1); |
| | | continue; |
| | | } |
| | | } |
| | | // 第六步,将文件存到指定位置 |
| | | try { |
| | |
| | | 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) { |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | lists.add(m); |
| | | return R.data(lists); |
| | | } |
| | | |
| | |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthours()) { |
| | | int drp1 = mountainrainsCVOS.get(i).getDrp1(); |
| | | Integer gohours = mountainrainsCVOS.get(i).getGohours(); |
| | | int i1 = drp1 - gohours; |
| | | float i1 = (float)drp1 - gohours; |
| | | float v = (float) (Math.round(i1 * 10)) / 10; |
| | | String a= String.valueOf(v); |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage3", "true"); |
| | | map.put("status", 2); |
| | | map.put("num", i1); |
| | | map.put("num", a); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthour()) { |
| | | int drp1 = mountainrainsCVOS.get(i).getDrp1(); |
| | | Integer gohour = mountainrainsCVOS.get(i).getGohour(); |
| | | int i1 = drp1 - gohour; |
| | | float i1 = (float)drp1 - gohour; |
| | | float v = (float) (Math.round(i1 * 10)) / 10; |
| | | String a= String.valueOf(v); |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage3", "true"); |
| | | map.put("status", 1); |
| | | map.put("num", i1); |
| | | map.put("num", a); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | |
| | | 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) { |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | lists.add(m); |
| | | return R.data(lists); |
| | | |
| | | } |
| | |
| | | double drp1 = w1.doubleValue(); |
| | | if (drp1 > 80) { |
| | | double v = drp1 - 80; |
| | | double v1 = (double) Math.round(v * 10) / 10; |
| | | map.put("flage3", "true"); |
| | | map.put("num", v); |
| | | map.put("num", v1); |
| | | } else { |
| | | map.put("flage3", "false"); |
| | | } |
| | |
| | | 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) { |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | lists.add(m); |
| | | return R.data(lists); |
| | | } |
| | | |
| | |
| | | * 土壤色斑图 |
| | | */ |
| | | @GetMapping("/selectS") |
| | | public void selectS(){ |
| | | public R selectS(String time) { |
| | | List<Map<String, Object>> list = mountainrainService.selectS(); |
| | | String fileName = ""; |
| | | // 第一步,创建一个webbook,对应一个Excel文件 |
| | |
| | | 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()); |
| | |
| | | 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) { |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return R.data(m); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |