| | |
| | | @PostMapping("/selectsk") |
| | | public R selectyjck(String beginTime, String endTime) throws ParseException { |
| | | String substring = beginTime.substring(0, 10); |
| | | String r = beginTime.substring(11, 13); |
| | | String t = beginTime.substring(11, 13); |
| | | String r; |
| | | if (t.substring(0, 1).equals("0")) { |
| | | r = beginTime.substring(12, 13); |
| | | } else { |
| | | r = beginTime.substring(11, 13); |
| | | } |
| | | //截取月日 |
| | | String[] strs = substring.split("-"); |
| | | //月 |
| | |
| | | //日 |
| | | String day = strs[2].toString(); |
| | | String substrings = endTime.substring(0, 10); |
| | | String rs = endTime.substring(11, 13); |
| | | String ts = endTime.substring(11, 13); |
| | | String rs; |
| | | if (ts.substring(0, 1).equals("0")) { |
| | | rs = endTime.substring(12, 13); |
| | | } else { |
| | | rs = endTime.substring(11, 13); |
| | | } |
| | | //截取月日 |
| | | String[] strss = substrings.split("-"); |
| | | //月 |
| | |
| | | Integer mou = Integer.parseInt(mouz); |
| | | String egmd = ""; |
| | | String edmd = ""; |
| | | int type; |
| | | List<Map<String, Object>> selectfx = rsvrRService.selectfx(); |
| | | String b = (String) selectfx.get(0).get("BGMD"); |
| | | String e = (String) selectfx.get(0).get("EDMD"); |
| | |
| | | edmd = e2; |
| | | } |
| | | } |
| | | String s = rsvrRService.selectCode(beginTime, endTime); |
| | | String s = rsvrRService.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); |
| | | //水库水情预警信息 |
| | | List<Map<String, Object>> map = rsvrRService.selectyjck(egmd, edmd, beginTime, endTime); |
| | | List<Map<String, Object>> map = null; |
| | | //判断时间是否相等 |
| | | if (beginTime.equals(endTime)) { |
| | | //相 |
| | | map = rsvrRService.selectyjcd(egmd, edmd, beginTime, endTime, code); |
| | | } else { |
| | | //水库水情预警信息 |
| | | long cx = System.currentTimeMillis();//获取当前系统时间(毫秒) |
| | | map = rsvrRService.selectyjck(egmd, edmd, beginTime, endTime, code); |
| | | System.out.print("程序执行时间为1:"); |
| | | System.out.println(System.currentTimeMillis() - cx + "毫秒"); |
| | | long cxx = System.currentTimeMillis();//获取当前系统时间(毫秒) |
| | | } |
| | | List<Map<String, Object>> sel = rsvrRService.sel(egmd, edmd, code); |
| | | map.addAll(sel); |
| | | //用来判断是否重复统计超警信息 |
| | | Map mnum = new HashMap(); |
| | | Map mnums = new HashMap(); |
| | | Map c = new HashMap(); |
| | | Map m1 = new HashMap(); |
| | | //定义list保存预警信息 |
| | | List ylist = new ArrayList(); |
| | | //定义list保存未预警信息 |
| | | List alist = new ArrayList(); |
| | | List list = new ArrayList(); |
| | | double count = 0.0; |
| | | double RZ = 0.0; |
| | | //查询数据为空 |
| | | if (map.size() == 0) { |
| | |
| | | list.add(m); |
| | | } else { |
| | | for (int i = 0; i < map.size(); i++) { |
| | | BigDecimal ws = (BigDecimal) map.get(i).get("W"); |
| | | //实时水库水位值 |
| | | BigDecimal rz = (BigDecimal) map.get(i).get("RZ"); |
| | | RZ = rz.doubleValue(); |
| | | String stcd = map.get(i).get("STCD").toString(); |
| | | //站点名称 |
| | | String stnms = map.get(i).get("STNM").toString(); |
| | | double v = 0.0; |
| | | double v1 = 0.0; |
| | | if ("".equals(map.get(i).get("maxZ")) || null == map.get(i).get("maxZ")) { |
| | | v = 0.0; |
| | | } else { |
| | | BigDecimal maxZ = (BigDecimal) map.get(i).get("maxZ"); |
| | | v = maxZ.doubleValue(); |
| | | } |
| | | if ("".equals(map.get(i).get("minZ")) || null == map.get(i).get("minZ")) { |
| | | v1 = 0.0; |
| | | } else { |
| | | BigDecimal minZ = (BigDecimal) map.get(i).get("minZ"); |
| | | v1 = minZ.doubleValue(); |
| | | } |
| | | //涨幅值 |
| | | double v2 = v - v1; |
| | | double v4 = (double) Math.round(v2 * 100) / 100; |
| | | m1.put(v4, stnms.replaceAll(" ", "") + "站"); |
| | | c.put(stcd, v4); |
| | | |
| | | if (mnums.containsKey(map.get(i).get("STCD").toString()) == true) { |
| | | } else { |
| | | count += ws.doubleValue(); |
| | | mnums.put(map.get(i).get("STCD").toString(), i); |
| | | if (map.get(i).get("FSLTDZ") == null || RZ == 0) { |
| | | String addvcd5 = map.get(i).get("ADDVNM").toString(); |
| | |
| | | } else { |
| | | BigDecimal inq = (BigDecimal) map.get(i).get("INQ"); |
| | | double INQ = inq.doubleValue(); |
| | | //DecimalFormat df = new DecimalFormat("#0.000"); |
| | | texta += "入库流量" + INQ + "立方米每秒、"; |
| | | double v3 = roundToSignificantFigures(INQ, 3); |
| | | String a = String.valueOf(v3); |
| | | String s1 = subZeroAndDot(a); |
| | | texta += "入库流量" + s1 + "立方米每秒、"; |
| | | } |
| | | if (map.get(i).get("W") == null) { |
| | | texta += "蓄水量暂无数据、"; |
| | | } else { |
| | | BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | double W = w.doubleValue(); |
| | | texta += "蓄水量" + W + "百万立方米、"; |
| | | DecimalFormat df = new DecimalFormat("#0.00"); |
| | | texta += "蓄水量" + df.format(W) + "百万立方米、"; |
| | | } |
| | | if (map.get(i).get("OTQ") == null) { |
| | | texta += "出库流量暂无数据;"; |
| | | } else { |
| | | BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | double OTQ = otq.doubleValue(); |
| | | //DecimalFormat df = new DecimalFormat("#0.000"); |
| | | texta += "出库流量" + OTQ + "立方米每秒;"; |
| | | double v3 = roundToSignificantFigures(OTQ, 3); |
| | | String a = String.valueOf(v3); |
| | | String s1 = subZeroAndDot(a); |
| | | texta += "出库流量" + s1 + "立方米每秒;"; |
| | | } |
| | | } |
| | | if (stnm.equals("廖坊")) { |
| | |
| | | } else { |
| | | BigDecimal inq = (BigDecimal) map.get(i).get("INQ"); |
| | | double INQ = inq.doubleValue(); |
| | | //DecimalFormat df = new DecimalFormat("#0.000"); |
| | | texth += "入库流量" + INQ + "立方米每秒、"; |
| | | double v3 = roundToSignificantFigures(INQ, 3); |
| | | String a = String.valueOf(v3); |
| | | String s1 = subZeroAndDot(a); |
| | | texth += "入库流量" + s1 + "立方米每秒、"; |
| | | } |
| | | if (map.get(i).get("W") == null) { |
| | | texth += "蓄水量暂无数据、"; |
| | | } else { |
| | | BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | double W = w.doubleValue(); |
| | | texth += "蓄水量" + W + "百万立方米、"; |
| | | DecimalFormat df = new DecimalFormat("#0.00"); |
| | | texth += "蓄水量" + df.format(W) + "百万立方米、"; |
| | | } |
| | | if (map.get(i).get("OTQ") == null) { |
| | | texth += "出库流量暂无数据。"; |
| | | } else { |
| | | BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | double OTQ = otq.doubleValue(); |
| | | //DecimalFormat df = new DecimalFormat("#0.000"); |
| | | texth += "出库流量" + OTQ + "立方米每秒。"; |
| | | double v3 = roundToSignificantFigures(OTQ, 3); |
| | | String a = String.valueOf(v3); |
| | | String s1 = subZeroAndDot(a); |
| | | texth += "出库流量" + s1 + "立方米每秒。"; |
| | | } |
| | | } |
| | | alist.add(map.get(i)); |
| | |
| | | } else { |
| | | BigDecimal inq = (BigDecimal) map.get(i).get("INQ"); |
| | | double INQ = inq.doubleValue(); |
| | | //DecimalFormat df = new DecimalFormat("#0.000"); |
| | | texta += "入库流量" + INQ + "立方米每秒、"; |
| | | double v3 = roundToSignificantFigures(INQ, 3); |
| | | String a = String.valueOf(v3); |
| | | String s1 = subZeroAndDot(a); |
| | | texta += "入库流量" + s1 + "立方米每秒、"; |
| | | } |
| | | if (map.get(i).get("W") == null) { |
| | | texta += "蓄水量暂无数据、"; |
| | | } else { |
| | | BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | double W = w.doubleValue(); |
| | | texta += "蓄水量" + W + "百万立方米、"; |
| | | DecimalFormat df = new DecimalFormat("#0.00"); |
| | | texta += "蓄水量" + df.format(W) + "百万立方米、"; |
| | | } |
| | | if (map.get(i).get("OTQ") == null) { |
| | | texta += "出库流量暂无数据;"; |
| | | } else { |
| | | BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | double OTQ = otq.doubleValue(); |
| | | //DecimalFormat df = new DecimalFormat("#0.000"); |
| | | texta += "出库流量" + OTQ + "立方米每秒;"; |
| | | double v3 = roundToSignificantFigures(OTQ, 3); |
| | | String a = String.valueOf(v3); |
| | | String s1 = subZeroAndDot(a); |
| | | texta += "出库流量" + s1 + "立方米每秒;"; |
| | | } |
| | | } |
| | | if (stnm.equals("廖坊")) { |
| | |
| | | } else { |
| | | BigDecimal inq = (BigDecimal) map.get(i).get("INQ"); |
| | | double INQ = inq.doubleValue(); |
| | | //DecimalFormat df = new DecimalFormat("#0.000"); |
| | | texth += "入库流量" + INQ + "立方米每秒、"; |
| | | double v3 = roundToSignificantFigures(INQ, 3); |
| | | String a = String.valueOf(v3); |
| | | String s1 = subZeroAndDot(a); |
| | | texth += "入库流量" + s1 + "立方米每秒、"; |
| | | } |
| | | if (map.get(i).get("W") == null) { |
| | | texth += "蓄水量暂无数据、"; |
| | | } else { |
| | | BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | double W = w.doubleValue(); |
| | | texth += "蓄水量" + W + "百万立方米、"; |
| | | DecimalFormat df = new DecimalFormat("#0.00"); |
| | | texth += "蓄水量" + df.format(W) + "百万立方米、"; |
| | | } |
| | | if (map.get(i).get("OTQ") == null) { |
| | | texth += "出库流量暂无数据。"; |
| | | } else { |
| | | BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | double OTQ = otq.doubleValue(); |
| | | //DecimalFormat df = new DecimalFormat("#0.000"); |
| | | texth += "出库流量" + OTQ + "立方米每秒。"; |
| | | double v3 = roundToSignificantFigures(OTQ, 3); |
| | | String a = String.valueOf(v3); |
| | | String s1 = subZeroAndDot(a); |
| | | texth += "出库流量" + s1 + "立方米每秒。"; |
| | | } |
| | | } |
| | | alist.add(map.get(i)); |
| | |
| | | //如果map集合保存了站点则不重复统计数量 |
| | | if (mnum.containsKey(map.get(i).get("STCD").toString()) == true) { |
| | | } else { |
| | | count += ws.doubleValue(); |
| | | ylist.add(map.get(i)); |
| | | mnum.put(map.get(i).get("STCD").toString(), i); |
| | | number++; |
| | |
| | | } else { |
| | | BigDecimal inq = (BigDecimal) map.get(i).get("INQ"); |
| | | double INQ = inq.doubleValue(); |
| | | //DecimalFormat df = new DecimalFormat("#0.000"); |
| | | texta += "入库流量" + INQ + "立方米每秒、"; |
| | | double v5 = roundToSignificantFigures(INQ, 3); |
| | | String a = String.valueOf(v5); |
| | | String s1 = subZeroAndDot(a); |
| | | texta += "入库流量" + s1 + "立方米每秒、"; |
| | | } |
| | | if (map.get(i).get("W") == null) { |
| | | texta += "蓄水量暂无数据、"; |
| | | } else { |
| | | BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | double W = w.doubleValue(); |
| | | texta += "蓄水量" + W + "百万立方米、"; |
| | | DecimalFormat df = new DecimalFormat("#0.00"); |
| | | texta += "蓄水量" + df.format(W) + "百万立方米、"; |
| | | } |
| | | if (map.get(i).get("OTQ") == null) { |
| | | texta += "出库流量暂无数据;"; |
| | | } else { |
| | | BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | double OTQ = otq.doubleValue(); |
| | | //DecimalFormat df = new DecimalFormat("#0.000"); |
| | | texta += "出库流量" + OTQ + "立方米每秒;"; |
| | | double v5 = roundToSignificantFigures(OTQ, 3); |
| | | String a = String.valueOf(v5); |
| | | String s1 = subZeroAndDot(a); |
| | | texta += "出库流量" + s1 + "立方米每秒;"; |
| | | } |
| | | } |
| | | if (stnm.equals("廖坊")) { |
| | |
| | | } else { |
| | | BigDecimal inq = (BigDecimal) map.get(i).get("INQ"); |
| | | double INQ = inq.doubleValue(); |
| | | //DecimalFormat df = new DecimalFormat("#0.000"); |
| | | texth += "入库流量" + INQ + "立方米每秒、"; |
| | | double v5 = roundToSignificantFigures(INQ, 3); |
| | | String a = String.valueOf(v5); |
| | | String s1 = subZeroAndDot(a); |
| | | texth += "入库流量" + s1 + "立方米每秒、"; |
| | | } |
| | | if (map.get(i).get("W") == null) { |
| | | texth += "蓄水量暂无数据、"; |
| | | } else { |
| | | BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | double W = w.doubleValue(); |
| | | texth += "蓄水量" + W + "百万立方米、"; |
| | | DecimalFormat df = new DecimalFormat("#0.00"); |
| | | texth += "蓄水量" + df.format(W) + "百万立方米、"; |
| | | } |
| | | if (map.get(i).get("OTQ") == null) { |
| | | texth += "出库流量暂无数据。"; |
| | | } else { |
| | | BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | double OTQ = otq.doubleValue(); |
| | | //DecimalFormat df = new DecimalFormat("#0"); |
| | | texth += "出库流量" + OTQ + "立方米每秒。"; |
| | | double v5 = roundToSignificantFigures(OTQ, 3); |
| | | String a = String.valueOf(v5); |
| | | String s1 = subZeroAndDot(a); |
| | | texth += "出库流量" + s1 + "立方米每秒。"; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | DecimalFormat df = new DecimalFormat("#0.00"); |
| | | text += "全市蓄水量" + df.format(count) + "百万立方米。"; |
| | | if (number == 0) { |
| | | text += texta + texth; |
| | | } else { |
| | |
| | | } |
| | | // //水库涨幅,跌幅信息 |
| | | //List<Map<String, Object>> selecthds = rsvrRService.selectsk(beginTime, endTime); |
| | | Map m1 = new HashMap(); |
| | | // Map m1 = new HashMap(); |
| | | Map m2 = new HashMap(); |
| | | Map m = new HashMap(); |
| | | // for (int j = 0; j < selecthds.size(); j++) { |
| | |
| | | // c.put(stcd, v3); |
| | | // //获取涨幅最大的信息 |
| | | // } |
| | | // if (m1.size() != 0) { |
| | | // Object maxKey = getMaxKey(m1); |
| | | // String s1 = m1.get(maxKey).toString(); |
| | | // text += " 涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。"; |
| | | // } |
| | | |
| | | if (beginTime.equals(endTime)) { |
| | | } |
| | | else { |
| | | if (m1.size() != 0) { |
| | | Object maxKey = getMaxKey(m1); |
| | | String s1 = m1.get(maxKey).toString(); |
| | | text += " 涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。"; |
| | | } |
| | | } |
| | | m.put("text", text); |
| | | m.put("number", number); |
| | | m.put("Yjlist", ylist); |
| | |
| | | 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()); |
| | | Date date = null; |
| | | // 把Date按照格式转换成字符串 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | try { |
| | | date = sdf.parse(time); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String dateEnd = sdf.format(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) { |
| | | egmd = b; |
| | | edmd = e; |
| | | } else if (m >= b2s && m <= e2s) { |
| | | egmd = b2; |
| | | edmd = e2; |
| | | } |
| | | } |
| | | //水库水情预警信息 |
| | | List<Map<String, Object>> map = rsvrRService.selectyjcks(egmd, edmd, timec, timez,time,dateEnd); |
| | | //用来判断是否重复统计超警信息 |
| | | 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; |
| | | } |
| | | 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 + "立方米每秒;"; |
| | | } |
| | | // 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)); |
| | | } 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; |
| | | } |
| | | } |
| | | 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); |
| | | } |
| | | // /** |
| | | // * 水库水情最新信息 |
| | | // */ |
| | | // @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()); |
| | | // Date date = null; |
| | | // // 把Date按照格式转换成字符串 |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // try { |
| | | // date = sdf.parse(time); |
| | | // } catch (ParseException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // String dateEnd = sdf.format(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) { |
| | | // egmd = b; |
| | | // edmd = e; |
| | | // } else if (m >= b2s && m <= e2s) { |
| | | // egmd = b2; |
| | | // edmd = e2; |
| | | // } |
| | | // } |
| | | // //水库水情预警信息 |
| | | // List<Map<String, Object>> map = rsvrRService.selectyjcks(egmd, edmd, timec, timez, time, dateEnd); |
| | | // //用来判断是否重复统计超警信息 |
| | | // Map mnum = new HashMap(); |
| | | // //定义list保存预警信息 |
| | | // List alist = new ArrayList(); |
| | | // List blist = new ArrayList(); |
| | | // double RZ = 0.0; |
| | | // double count = 0.0; |
| | | // double v = 0.0; |
| | | // //定义list保存未预警信息 |
| | | // //查询数据为空 |
| | | // if (map.size() == 0) { |
| | | // text += "暂无水库超汛限。$$$$$洪门水库&&&&&库水位暂无数据、入库流量暂无数据、蓄水量暂无数据、出库流量暂无数据;$$$$$廖坊水库&&&&&库水位暂无数据、入库流量暂无数据、蓄水量暂无数据、出库流量暂无数据。"; |
| | | // } else { |
| | | // for (int i = 0; i < map.size(); i++) { |
| | | // BigDecimal wss = (BigDecimal) map.get(i).get("W"); |
| | | // count += wss.doubleValue(); |
| | | // 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(); |
| | | // double v1 = roundToSignificantFigures(INQ, 3); |
| | | // String a = String.valueOf(v1); |
| | | // String s = subZeroAndDot(a); |
| | | // texta += "入库流量" + s + "立方米每秒、"; |
| | | // } |
| | | // if (map.get(i).get("W") == null) { |
| | | // texta += "蓄水量暂无数据、"; |
| | | // } else { |
| | | // BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | // double W = w.doubleValue(); |
| | | // if (W == 0.0) { |
| | | // texta += "蓄水量暂无数据、"; |
| | | // } else { |
| | | // DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | // texta += "蓄水量" + dfs.format(W) + "百万立方米、"; |
| | | // } |
| | | // } |
| | | // if (map.get(i).get("OTQ") == null) { |
| | | // texta += "出库流量暂无数据、"; |
| | | // } else { |
| | | // BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | // double OTQ = otq.doubleValue(); |
| | | // double v1 = roundToSignificantFigures(OTQ, 3); |
| | | // String a = String.valueOf(v1); |
| | | // String s = subZeroAndDot(a); |
| | | // texta += "出库流量" + s + "立方米每秒;"; |
| | | // } |
| | | //// 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(); |
| | | // double v1 = roundToSignificantFigures(INQ, 3); |
| | | // String a = String.valueOf(v1); |
| | | // String s = subZeroAndDot(a); |
| | | // texth += "入库流量" + s + "立方米每秒、"; |
| | | // } |
| | | // if (map.get(i).get("W") == null) { |
| | | // texth += "蓄水量暂无数据、"; |
| | | // } else { |
| | | // BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | // double W = w.doubleValue(); |
| | | // System.out.println("-----------:" + W); |
| | | // if (W == 0.0) { |
| | | // texth += "蓄水量暂无数据、"; |
| | | // } else { |
| | | // DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | // texth += "蓄水量" + dfs.format(W) + "百万立方米、"; |
| | | // } |
| | | // } |
| | | // if (map.get(i).get("OTQ") == null) { |
| | | // texth += "出库流量暂无数据、"; |
| | | // } else { |
| | | // BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | // double OTQ = otq.doubleValue(); |
| | | // double v1 = roundToSignificantFigures(OTQ, 3); |
| | | // String a = String.valueOf(v1); |
| | | // String s = subZeroAndDot(a); |
| | | // texth += "出库流量" + s + "立方米每秒。"; |
| | | // } |
| | | // } |
| | | // blist.add(map.get(i)); |
| | | // continue; |
| | | // } |
| | | // 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(); |
| | | // double v1 = roundToSignificantFigures(INQ, 3); |
| | | // String a = String.valueOf(v1); |
| | | // String s = subZeroAndDot(a); |
| | | // texta += "入库流量" + s + "立方米每秒、"; |
| | | // } |
| | | // if (map.get(i).get("W") == null) { |
| | | // texta += "蓄水量暂无数据、"; |
| | | // } else { |
| | | // BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | // double W = w.doubleValue(); |
| | | // DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | // texta += "蓄水量" + dfs.format(W) + "百万立方米、"; |
| | | // } |
| | | // if (map.get(i).get("OTQ") == null) { |
| | | // texta += "出库流量暂无数据;"; |
| | | // } else { |
| | | // BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | // double OTQ = otq.doubleValue(); |
| | | // double v1 = roundToSignificantFigures(OTQ, 3); |
| | | // String a = String.valueOf(v1); |
| | | // String s = subZeroAndDot(a); |
| | | // texta += "出库流量" + s + "立方米每秒;"; |
| | | // } |
| | | //// 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(); |
| | | // double v1 = roundToSignificantFigures(INQ, 3); |
| | | // String a = String.valueOf(v1); |
| | | // String s = subZeroAndDot(a); |
| | | // texth += "入库流量" + s + "立方米每秒、"; |
| | | // } |
| | | // if (map.get(i).get("W") == null) { |
| | | // texth += "蓄水量暂无数据、"; |
| | | // } else { |
| | | // BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | // double W = w.doubleValue(); |
| | | // DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | // texth += "蓄水量" + dfs.format(W) + "百万立方米、"; |
| | | // } |
| | | // if (map.get(i).get("OTQ") == null) { |
| | | // texth += "出库流量暂无数据。"; |
| | | // } else { |
| | | // BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | // double OTQ = otq.doubleValue(); |
| | | // double v1 = roundToSignificantFigures(OTQ, 3); |
| | | // String a = String.valueOf(v1); |
| | | // String s = subZeroAndDot(a); |
| | | // texth += "出库流量" + s + "立方米每秒。"; |
| | | // } |
| | | // } |
| | | // 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(); |
| | | // double v1 = roundToSignificantFigures(INQ, 3); |
| | | // String a = String.valueOf(v1); |
| | | // String s = subZeroAndDot(a); |
| | | // texta += "入库流量" + s + "立方米每秒、"; |
| | | // } |
| | | // if (map.get(i).get("W") == null) { |
| | | // texta += "蓄水量暂无数据、"; |
| | | // } else { |
| | | // BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | // double W = w.doubleValue(); |
| | | // if (W == 0.0) { |
| | | // texta += "蓄水量暂无数据、"; |
| | | // } else { |
| | | // DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | // texta += "蓄水量" + dfs.format(W) + "百万立方米、"; |
| | | // } |
| | | // } |
| | | // if (map.get(i).get("OTQ") == null) { |
| | | // texta += "出库流量暂无数据;"; |
| | | // } else { |
| | | // BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | // double OTQ = otq.doubleValue(); |
| | | // double v1 = roundToSignificantFigures(OTQ, 3); |
| | | // String a = String.valueOf(v1); |
| | | // String s = subZeroAndDot(a); |
| | | // texta += "出库流量" + s + "立方米每秒;"; |
| | | // } |
| | | //// 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(); |
| | | // double v1 = roundToSignificantFigures(INQ, 3); |
| | | // String a = String.valueOf(v1); |
| | | // String s = subZeroAndDot(a); |
| | | // texth += "入库流量" + s + "立方米每秒、"; |
| | | // } |
| | | // if (map.get(i).get("W") == null) { |
| | | // texth += "蓄水量暂无数据、"; |
| | | // } else { |
| | | // BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | // double W = w.doubleValue(); |
| | | // System.out.println("-----------:" + W); |
| | | // if (W == 0.0) { |
| | | // texth += "蓄水量暂无数据、"; |
| | | // } else { |
| | | // DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | // texth += "蓄水量" + dfs.format(W) + "百万立方米、"; |
| | | // } |
| | | // } |
| | | // if (map.get(i).get("OTQ") == null) { |
| | | // texth += "出库流量暂无数据。"; |
| | | // } else { |
| | | // BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | // double OTQ = otq.doubleValue(); |
| | | // double v1 = roundToSignificantFigures(OTQ, 3); |
| | | // String a = String.valueOf(v1); |
| | | // String s = subZeroAndDot(a); |
| | | // texth += "出库流量" + s + "立方米每秒。"; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | // text += "全市蓄水量" + dfs.format(count) + "百万立方米。"; |
| | | // 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); |
| | | // } |
| | | |
| | | /** |
| | | * 水库详情 |
| | |
| | | return R.data(lists); |
| | | } |
| | | |
| | | |
| | | public static double roundToSignificantFigures(double num, int n) { |
| | | |
| | | if (num == 0) { |
| | | |
| | | return 0; |
| | | |
| | | } |
| | | |
| | | final double d = Math.ceil(Math.log10(num < 0 ? -num : num)); |
| | | |
| | | final int power = n - (int) d; |
| | | |
| | | final double magnitude = Math.pow(10, power); |
| | | |
| | | final long shifted = Math.round(num * magnitude); |
| | | |
| | | return shifted / magnitude; |
| | | |
| | | } |
| | | |
| | | public static String subZeroAndDot(String s) { |
| | | if (s.indexOf(".") > 0) { |
| | | s = s.replaceAll("0+?$", "");//去掉多余的0 |
| | | s = s.replaceAll("[.]$", "");//如最后一位是.则去掉 |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | @PostMapping("/ss") |
| | | public void ss() { |
| | | String s = rsvrRService.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); |
| | | System.out.println(code); |
| | | System.out.println(split.length); |
| | | } |
| | | |
| | | /** |
| | | * 水库水情最新信息 |
| | | */ |
| | | @PostMapping("/selectyjcks") |
| | | public R selectyjcks() throws ParseException { |
| | | int ws = 1; |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd 08:00:00"); |
| | | String time = df.format(new Date()); |
| | | Date date = null; |
| | | // 把Date按照格式转换成字符串 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 08:00:00"); |
| | | try { |
| | | date = sdf.parse(time); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String dateEnd = sdf.format(date); |
| | | SimpleDateFormat dfz = new SimpleDateFormat("yyyy-MM-dd 08: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"; |
| | | SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd 08:00:00"); |
| | | Calendar now = Calendar.getInstance(); |
| | | now.setTime(new Date()); |
| | | now.add(Calendar.DAY_OF_MONTH, -1); |
| | | String timec = sdfs.format(now.getTime()); |
| | | //前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) { |
| | | egmd = b; |
| | | edmd = e; |
| | | } else if (m >= b2s && m <= e2s) { |
| | | egmd = b2; |
| | | edmd = e2; |
| | | } |
| | | } |
| | | String sc = rsvrRService.selectCode(); |
| | | String[] split = sc.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 = rsvrRService.selectskshi(egmd, edmd, timec, time,dateEnd,code); |
| | | //用来判断是否重复统计超警信息 |
| | | Map mnum = new HashMap(); |
| | | //定义list保存预警信息 |
| | | List alist = new ArrayList(); |
| | | List blist = new ArrayList(); |
| | | double RZ = 0.0; |
| | | double count = 0.0; |
| | | double v = 0.0; |
| | | //定义list保存未预警信息 |
| | | //查询数据为空 |
| | | if (map.size() == 0) { |
| | | text += "暂无水库超汛限。$$$$$洪门水库&&&&&库水位暂无数据、入库流量暂无数据、蓄水量暂无数据、出库流量暂无数据;$$$$$廖坊水库&&&&&库水位暂无数据、入库流量暂无数据、蓄水量暂无数据、出库流量暂无数据。"; |
| | | } else { |
| | | for (int i = 0; i < map.size(); i++) { |
| | | BigDecimal wss = (BigDecimal) map.get(i).get("W"); |
| | | count += wss.doubleValue(); |
| | | 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(); |
| | | double v1 = roundToSignificantFigures(INQ, 3); |
| | | String a = String.valueOf(v1); |
| | | String s = subZeroAndDot(a); |
| | | texta += "入库流量" + s + "立方米每秒、"; |
| | | } |
| | | if (map.get(i).get("W") == null) { |
| | | texta += "蓄水量暂无数据、"; |
| | | } else { |
| | | BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | double W = w.doubleValue(); |
| | | if (W == 0.0) { |
| | | texta += "蓄水量暂无数据、"; |
| | | } else { |
| | | DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | texta += "蓄水量" + dfs.format(W) + "百万立方米、"; |
| | | } |
| | | } |
| | | if (map.get(i).get("OTQ") == null) { |
| | | texta += "出库流量暂无数据、"; |
| | | } else { |
| | | BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | double OTQ = otq.doubleValue(); |
| | | double v1 = roundToSignificantFigures(OTQ, 3); |
| | | String a = String.valueOf(v1); |
| | | String s = subZeroAndDot(a); |
| | | texta += "出库流量" + s + "立方米每秒;"; |
| | | } |
| | | // 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(); |
| | | double v1 = roundToSignificantFigures(INQ, 3); |
| | | String a = String.valueOf(v1); |
| | | String s = subZeroAndDot(a); |
| | | texth += "入库流量" + s + "立方米每秒、"; |
| | | } |
| | | if (map.get(i).get("W") == null) { |
| | | texth += "蓄水量暂无数据、"; |
| | | } else { |
| | | BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | double W = w.doubleValue(); |
| | | System.out.println("-----------:" + W); |
| | | if (W == 0.0) { |
| | | texth += "蓄水量暂无数据、"; |
| | | } else { |
| | | DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | texth += "蓄水量" + dfs.format(W) + "百万立方米、"; |
| | | } |
| | | } |
| | | if (map.get(i).get("OTQ") == null) { |
| | | texth += "出库流量暂无数据、"; |
| | | } else { |
| | | BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | double OTQ = otq.doubleValue(); |
| | | double v1 = roundToSignificantFigures(OTQ, 3); |
| | | String a = String.valueOf(v1); |
| | | String s = subZeroAndDot(a); |
| | | texth += "出库流量" + s + "立方米每秒。"; |
| | | } |
| | | } |
| | | blist.add(map.get(i)); |
| | | continue; |
| | | } |
| | | 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(); |
| | | double v1 = roundToSignificantFigures(INQ, 3); |
| | | String a = String.valueOf(v1); |
| | | String s = subZeroAndDot(a); |
| | | texta += "入库流量" + s + "立方米每秒、"; |
| | | } |
| | | if (map.get(i).get("W") == null) { |
| | | texta += "蓄水量暂无数据、"; |
| | | } else { |
| | | BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | double W = w.doubleValue(); |
| | | DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | texta += "蓄水量" + dfs.format(W) + "百万立方米、"; |
| | | } |
| | | if (map.get(i).get("OTQ") == null) { |
| | | texta += "出库流量暂无数据;"; |
| | | } else { |
| | | BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | double OTQ = otq.doubleValue(); |
| | | double v1 = roundToSignificantFigures(OTQ, 3); |
| | | String a = String.valueOf(v1); |
| | | String s = subZeroAndDot(a); |
| | | texta += "出库流量" + s + "立方米每秒;"; |
| | | } |
| | | // 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(); |
| | | double v1 = roundToSignificantFigures(INQ, 3); |
| | | String a = String.valueOf(v1); |
| | | String s = subZeroAndDot(a); |
| | | texth += "入库流量" + s + "立方米每秒、"; |
| | | } |
| | | if (map.get(i).get("W") == null) { |
| | | texth += "蓄水量暂无数据、"; |
| | | } else { |
| | | BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | double W = w.doubleValue(); |
| | | DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | texth += "蓄水量" + dfs.format(W) + "百万立方米、"; |
| | | } |
| | | if (map.get(i).get("OTQ") == null) { |
| | | texth += "出库流量暂无数据。"; |
| | | } else { |
| | | BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | double OTQ = otq.doubleValue(); |
| | | double v1 = roundToSignificantFigures(OTQ, 3); |
| | | String a = String.valueOf(v1); |
| | | String s = subZeroAndDot(a); |
| | | texth += "出库流量" + s + "立方米每秒。"; |
| | | } |
| | | } |
| | | 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(); |
| | | double v1 = roundToSignificantFigures(INQ, 3); |
| | | String a = String.valueOf(v1); |
| | | String s = subZeroAndDot(a); |
| | | texta += "入库流量" + s + "立方米每秒、"; |
| | | } |
| | | if (map.get(i).get("W") == null) { |
| | | texta += "蓄水量暂无数据、"; |
| | | } else { |
| | | BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | double W = w.doubleValue(); |
| | | if (W == 0.0) { |
| | | texta += "蓄水量暂无数据、"; |
| | | } else { |
| | | DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | texta += "蓄水量" + dfs.format(W) + "百万立方米、"; |
| | | } |
| | | } |
| | | if (map.get(i).get("OTQ") == null) { |
| | | texta += "出库流量暂无数据;"; |
| | | } else { |
| | | BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | double OTQ = otq.doubleValue(); |
| | | double v1 = roundToSignificantFigures(OTQ, 3); |
| | | String a = String.valueOf(v1); |
| | | String s = subZeroAndDot(a); |
| | | texta += "出库流量" + s + "立方米每秒;"; |
| | | } |
| | | // 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(); |
| | | double v1 = roundToSignificantFigures(INQ, 3); |
| | | String a = String.valueOf(v1); |
| | | String s = subZeroAndDot(a); |
| | | texth += "入库流量" + s + "立方米每秒、"; |
| | | } |
| | | if (map.get(i).get("W") == null) { |
| | | texth += "蓄水量暂无数据、"; |
| | | } else { |
| | | BigDecimal w = (BigDecimal) map.get(i).get("W"); |
| | | double W = w.doubleValue(); |
| | | System.out.println("-----------:" + W); |
| | | if (W == 0.0) { |
| | | texth += "蓄水量暂无数据、"; |
| | | } else { |
| | | DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | texth += "蓄水量" + dfs.format(W) + "百万立方米、"; |
| | | } |
| | | } |
| | | if (map.get(i).get("OTQ") == null) { |
| | | texth += "出库流量暂无数据。"; |
| | | } else { |
| | | BigDecimal otq = (BigDecimal) map.get(i).get("OTQ"); |
| | | double OTQ = otq.doubleValue(); |
| | | double v1 = roundToSignificantFigures(OTQ, 3); |
| | | String a = String.valueOf(v1); |
| | | String s = subZeroAndDot(a); |
| | | texth += "出库流量" + s + "立方米每秒。"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | DecimalFormat dfs = new DecimalFormat("#0.00"); |
| | | text += "全市蓄水量" + dfs.format(count) + "百万立方米。"; |
| | | 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); |
| | | } |
| | | |
| | | |
| | | } |
| | | |