From 39caebba35fc84824f5cd51d189fe322d5145803 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Tue, 09 Nov 2021 16:15:14 +0800
Subject: [PATCH] 1.山洪
---
src/main/java/org/springblade/modules/mountainrain/entity/Yucsma.java | 6
src/main/java/org/springblade/modules/mountainrain/mapper/SmariverMapper.xml | 6
src/main/java/org/springblade/modules/regionWeight/service/IRegionWeightService.java | 7
src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java | 20
src/main/java/org/springblade/modules/rsvr/mapper/RsvrRMapper.java | 6
src/main/java/org/springblade/modules/river/controller/RiverRController.java | 346 +++
src/main/java/org/springblade/modules/mountainrain/entity/Yucbig.java | 48
src/main/java/org/springblade/modules/mountainrain/excel/temple.xls | 0
src/main/resources/application-dev.yml | 4
src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.java | 14
src/main/java/org/springblade/modules/river/service/impl/RiverRServiceImpl.java | 14
src/main/java/org/springblade/modules/mountainrain/controller/BigriverController.java | 259 +++
src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.xml | 149 +
src/main/java/org/springblade/modules/rsvr/service/IRsvrRService.java | 6
src/main/java/org/springblade/modules/river/mapper/RiverRMapper.xml | 44
src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java | 1039 +++++++------
src/main/java/org/springblade/modules/regionWeight/entity/PptnR.java | 56
src/main/java/org/springblade/modules/regionWeight/service/impl/RegionWeightServiceImpl.java | 81 +
src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.java | 10
src/main/java/org/springblade/modules/mountainrain/mapper/BigriverMapper.java | 2
src/main/java/org/springblade/modules/rsvr/mapper/RsvrRMapper.xml | 185 ++
src/main/resources/excelTemplate/temple.xls | 0
src/main/java/org/springblade/modules/mountainrain/mapper/BigriverMapper.xml | 22
src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml | 28
src/main/java/org/springblade/modules/mountainrain/service/impl/BigriverServiceImpl.java | 5
src/main/java/org/springblade/modules/mountainrain/controller/SmariverController.java | 99 +
src/main/java/org/springblade/modules/mountainrain/service/IMountainrainService.java | 10
src/main/java/org/springblade/modules/mountainrain/service/IBigriverService.java | 1
src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java | 378 +++-
src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java | 1485 +++++++++++++------
src/main/java/org/springblade/modules/Stbprp/mapper/StbprpBMapper.xml | 84
src/main/java/org/springblade/modules/mountainrain/controller/ss.java | 16
src/main/java/org/springblade/modules/river/mapper/RiverRMapper.java | 4
src/main/java/org/springblade/modules/river/service/IRiverRService.java | 4
src/main/java/org/springblade/modules/rsvr/service/impl/RsvrRServiceImpl.java | 18
src/main/resources/application.yml | 2
36 files changed, 3,160 insertions(+), 1,298 deletions(-)
diff --git a/src/main/java/org/springblade/modules/Stbprp/mapper/StbprpBMapper.xml b/src/main/java/org/springblade/modules/Stbprp/mapper/StbprpBMapper.xml
index b231405..3cec535 100644
--- a/src/main/java/org/springblade/modules/Stbprp/mapper/StbprpBMapper.xml
+++ b/src/main/java/org/springblade/modules/Stbprp/mapper/StbprpBMapper.xml
@@ -36,7 +36,7 @@
<resultMap id="stbprpBResultMaps" type="org.springblade.modules.Stbprp.entity.StbprpB">
- <result column="stnm" property="stnm"/>
+ <result column="stnm" property="stnm"/>
</resultMap>
<!--通过站点名称,返回基础站信息-->
@@ -55,11 +55,49 @@
select * from dbo.ST_STBPRP_B ORDER BY BGFRYM DESC LIMIT #{startIndex},#{pageSize}
</select>-->
- <!-- 模糊查询-->
+
+ <!--站点详情-->
+ <select id="selectInfo" resultMap="stbprpBResultMap">
+ select st.STCD,
+ st.STNM,
+ st.RVNM,
+ st.HNNM,
+ st.BSNM,
+ st.LGTD,
+ st.LTTD,
+ st.STLC,
+ st.ADDVCD,
+ ad.ADDVNM as ADDVCD5,
+ st.DTMNM,
+ st.DTMEL,
+ st.DTPR,
+ st.STTP,
+ st.FRGRD,
+ st.ESSTYM,
+ st.BGFRYM,
+ st.ATCUNIT,
+ st.ADMAUTH,
+ st.LOCALITY,
+ st.STBK,
+ st.STAZT,
+ st.DSTRVM,
+ st.DRNA,
+ st.PHCD,
+ st.USFL,
+ st.COMMENTS,
+ st.MODITIME
+ from dbo.ST_STBPRP_B st
+ INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD
+ where st.STCD = #{code}
+ ORDER BY st.MODITIME DESC
+ </select>
+
+
+ <!-- 模糊查询-->
<select id="selectList" resultMap="stbprpBResultMap">
- select * from dbo.ST_STBPRP_B where 1=1
+ select * from dbo.ST_STBPRP_B where 1=1
<if test="addvcd !=null and addvcd!=''">
- and ADDVCD=#{addvcd}
+ and ADDVCD=#{addvcd}
</if>
<if test="name !=null and name!=''">
@@ -70,28 +108,31 @@
<!--查询全部-->
<select id="selectAllList" resultMap="stbprpBResultMap">
- select * from dbo.ST_STBPRP_B ORDER BY MODITIME DESC
+ select *
+ from dbo.ST_STBPRP_B
+ ORDER BY MODITIME DESC
</select>
-
- <!--站点详情-->
- <select id="selectInfo" resultMap="stbprpBResultMap">
- select * from dbo.ST_STBPRP_B where STCD =#{code} ORDER BY MODITIME DESC
- </select>
<select id="selectInfos" resultType="java.util.Map">
- select LGTD,LTTD,STNM from dbo.ST_STBPRP_B where STCD =#{code}
- </select>
+ select LGTD, LTTD, STNM
+ from dbo.ST_STBPRP_B
+ where STCD = #{code}
+ </select>
<!--河道-->
<select id="selectRiverCode" resultType="java.lang.String">
- SELECT STCD from dbo.ST_STBPRP_B where STTP='ZZ'
+ SELECT STCD
+ from dbo.ST_STBPRP_B
+ where STTP = 'ZZ'
</select>
<!--水库-->
<select id="selectRsvrCode" resultType="java.lang.String">
- SELECT STCD from dbo.ST_STBPRP_B where STTP='RR'
+ SELECT STCD
+ from dbo.ST_STBPRP_B
+ where STTP = 'RR'
</select>
<select id="selectInfoCode" resultType="java.util.HashMap">
@@ -107,7 +148,10 @@
<!--降水-->
<select id="selectPptnCode" resultType="java.util.HashMap">
- select STCD from dbo.ST_STBPRP_B WHERE STTP='PP' ORDER BY ADDVCD5
+ select STCD
+ from dbo.ST_STBPRP_B
+ WHERE STTP = 'PP'
+ ORDER BY ADDVCD5
</select>
<!--东江源数据查询-->
@@ -120,16 +164,20 @@
<!--查询全部站点名称-->
<select id="selectSname" resultType="java.util.HashMap">
- select STNM from dbo.ST_STBPRP_B
+ select STNM
+ from dbo.ST_STBPRP_B
</select>
<select id="selectSnameInfo" resultMap="stbprpBNameResultMap">
- select STCD,STNM as siteName,LGTD,LTTD,STTP,ADDVCD as city,STLC as county from dbo.ST_STBPRP_B where STNM=#{STNM}
+ select STCD, STNM as siteName, LGTD, LTTD, STTP, ADDVCD as city, STLC as county
+ from dbo.ST_STBPRP_B
+ where STNM = #{STNM}
</select>
<select id="selectSnames" resultType="java.util.HashMap">
- select STNM,STCD as pid from dbo.ST_STBPRP_B
+ select STNM, STCD as pid
+ from dbo.ST_STBPRP_B
</select>
</mapper>
diff --git a/src/main/java/org/springblade/modules/mountainrain/controller/BigriverController.java b/src/main/java/org/springblade/modules/mountainrain/controller/BigriverController.java
index c13ac6e..53acc7c 100644
--- a/src/main/java/org/springblade/modules/mountainrain/controller/BigriverController.java
+++ b/src/main/java/org/springblade/modules/mountainrain/controller/BigriverController.java
@@ -15,31 +15,44 @@
*/
package org.springblade.modules.mountainrain.controller;
-import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import jodd.io.PathUtil;
import lombok.AllArgsConstructor;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.ss.usermodel.CellType;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
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.tool.api.R;
import org.springblade.modules.mountainrain.entity.Yucbig;
-import org.springblade.modules.mountainrain.excel.BgrExcel;
-import org.springblade.modules.mountainrain.excel.BgrImporter;
import org.springblade.modules.mountainrain.service.IBigriverService;
import org.springblade.modules.mountainrain.wrapper.BigriverWrapper;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import java.security.MessageDigest;
import java.util.*;
/**
- * 控制器
+ * 控制器
*
* @author Blade
* @since 2019-11-07
@@ -53,11 +66,11 @@
private IBigriverService iBigriverService;
/**
- * 详情
- */
+ * 详情
+ */
@ApiLog("详情")
@GetMapping("/detail")
- @ApiOperationSupport(order = 1)
+ @ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "site")
public R<Yucbig> detail(Yucbig yucbig) {
Yucbig detail = iBigriverService.getOne(Condition.getQueryWrapper(yucbig));
@@ -66,37 +79,37 @@
/**
- * 新增
- */
+ * 新增
+ */
@ApiLog("新增")
@PostMapping("/save")
- @ApiOperationSupport(order = 4)
+ @ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入site")
public R save(@Valid @RequestBody Yucbig yucbig) {
return R.status(iBigriverService.save(yucbig));
}
/**
- * 修改
- */
+ * 修改
+ */
@ApiLog("修改")
@PostMapping("/update")
- @ApiOperationSupport(order = 5)
+ @ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入site")
public R update(@Valid @RequestBody Yucbig yucbig) {
return R.status(iBigriverService.updateById(yucbig));
}
- /**
- * 大江大河预报数据导入
- */
- @PostMapping("import-bgr")
- public R importbgr(MultipartFile file) {
- BgrImporter bgrImporter = new BgrImporter(iBigriverService, false);
- ExcelUtil.save(file, bgrImporter, BgrExcel.class);
- return R.success("导入成功");
- }
+// /**
+// * 大江大河预报数据导入
+// */
+// @PostMapping("import-bgr")
+// public R importbgr(MultipartFile file) {
+// BgrImporter bgrImporter = new BgrImporter(iBigriverService, false);
+// ExcelUtil.save(file, bgrImporter, BgrExcel.class);
+// return R.success("导入成功");
+// }
/**
* 大江大河预警
@@ -131,4 +144,200 @@
return R.data(list);
}
+
+ @PostMapping("import-bgr")
+ public void importbgr(MultipartFile file) throws IOException, InvalidFormatException {
+ InputStream is = file.getInputStream();
+ HSSFWorkbook workbook = new HSSFWorkbook(is);
+ //确定版本
+ boolean isExcel2003 = file.getOriginalFilename().endsWith("xls") ? true : false;
+ List<Map<String, Object>> returnMap;//返回execlClass类见下
+ if (isExcel2003) { //判断版本
+ HSSFSheet sheet = workbook.getSheetAt(1);
+ sheet.getRow(4).getCell(12).setCellType(CellType.STRING);
+ sheet.getRow(4).getCell(13).setCellType(CellType.STRING);
+ sheet.getRow(4).getCell(14).setCellType(CellType.STRING);
+ sheet.getRow(4).getCell(15).setCellType(CellType.STRING);
+ sheet.getRow(4).getCell(3).setCellType(CellType.STRING);
+ sheet.getRow(4).getCell(8).setCellType(CellType.STRING);
+ sheet.getRow(4).getCell(9).setCellType(CellType.STRING);
+ sheet.getRow(4).getCell(10).setCellType(CellType.STRING);
+ sheet.getRow(4).getCell(11).setCellType(CellType.STRING);
+ //发布时间
+ String ftimes = sheet.getRow(1).getCell(11).getStringCellValue();
+ String substring = ftimes.substring(5, ftimes.length());
+ String year = substring.substring(0, substring.lastIndexOf("年"));
+ String yues = substring.substring(substring.indexOf("年")+1, substring.lastIndexOf("月"));
+ String yue;
+ if (yues.length()==1){
+ yue=0+yues;
+ }
+ else {
+ yue=yues;
+ }
+ String r = substring.substring(substring.indexOf("月")+1, substring.lastIndexOf("日"));
+ String ms = substring.substring(substring.indexOf("日")+1, substring.lastIndexOf("时"));
+ String ftime=year+"-"+yue+"-"+r+" "+ms+":00:00";
+ //河名
+ String river = sheet.getRow(4).getCell(0).getStringCellValue();
+ //站点名称
+ String stnames = sheet.getRow(4).getCell(1).getStringCellValue();
+ String stcd = iBigriverService.selectINfo(stnames);
+ //降雨量
+ String drp = sheet.getRow(4).getCell(3).getStringCellValue();
+ //降雨起止时间
+ String drptime = sheet.getRow(4).getCell(4).getStringCellValue();
+ //起涨时间
+ String qztime = sheet.getRow(4).getCell(7).getStringCellValue();
+ //起涨流量
+ String qzll = sheet.getRow(4).getCell(9).getStringCellValue();
+ //发布水位
+ String fbsw = sheet.getRow(4).getCell(10).getStringCellValue();
+ //发布流量
+ String fbll = sheet.getRow(4).getCell(11).getStringCellValue();
+ //预报时间
+ String ytimes = sheet.getRow(4).getCell(12).getStringCellValue();
+ String[] split = ytimes.split(",");
+ String a;
+ if (split[0].length()==1){
+ a=0+yues;
+ }
+ else {
+ a=yues;
+ }
+ String ytime=year+"-"+a+"-"+split[1]+" "+split[2]+":00:00";
+ //预测水位
+ String yuz = sheet.getRow(4).getCell(13).getStringCellValue();
+ //预警流量
+ String yq = sheet.getRow(4).getCell(14).getStringCellValue();
+ //预警水位
+ String yjsw = sheet.getRow(4).getCell(15).getStringCellValue();
+ //预报水位与警戒水位比较
+ String dbi = sheet.getRow(4).getCell(16).getStringCellValue();
+ //起涨水位
+ String qzsw = sheet.getRow(4).getCell(8).getStringCellValue();
+ Yucbig yucbig=new Yucbig();
+ yucbig.setStcd(stcd);
+ yucbig.setStname(stnames);
+ yucbig.setRiver(river);
+ yucbig.setFtime(ftime);
+ yucbig.setYjsw(yjsw);
+ yucbig.setYtime(ytime);
+ yucbig.setYuz(yuz);
+ yucbig.setYq(yq);
+ yucbig.setQzsw(qzsw);
+ yucbig.setDrp(drp);
+ yucbig.setDrptime(drptime);
+ yucbig.setQztime(qztime);
+ yucbig.setQzsw(qzsw);
+ yucbig.setQzll(qzll);
+ yucbig.setFbsw(fbsw);
+ yucbig.setFbll(fbll);
+ yucbig.setDbi(dbi);
+ iBigriverService.save(yucbig);
+ } else {
+ //有多少个sheet
+ int sheets = workbook.getNumberOfSheets();
+ System.out.println("其他:" + sheets);
+ }
+ }
+
+
+ /**
+ * 主要河流导出预警模板
+ * @param emp01
+ * @throws IOException
+ * @throws InvalidFormatException
+ */
+ @PostMapping("createEmpExcel")
+ public void createEmpExcel(@RequestBody Map<String, Object> emp01) throws IOException, InvalidFormatException {
+ // import為需要導入的EXCEL模板,exportFilePath為生成的員工EXCEL文件
+ String importFilePath = "D://excel//temple.xls";
+ //String exportFilePath = "D:\\Excel";
+
+ File fi = new File(importFilePath);
+ InputStream in = new FileInputStream(fi);
+ Workbook wb = WorkbookFactory.create(in);
+ Sheet sheet = wb.getSheetAt(1); //示意访问sheet
+// //读取excel模板
+// XSSFWorkbook wb = new XSSFWorkbook(in);
+// //读取了模板内所有sheet内容
+// XSSFSheet sheet = wb.getSheetAt(0);
+ //如果这行没有了,整个公式都不会有自动计算的效果的
+ sheet.setForceFormulaRecalculation(true);
+ //河名
+ sheet.getRow(4).getCell(0).setCellValue(emp01.get("river").toString());
+ //站名
+ sheet.getRow(4).getCell(1).setCellValue(emp01.get("stname").toString());
+ //pa
+ sheet.getRow(4).getCell(2).setCellValue(emp01.get("pa").toString());
+ //降雨量
+ sheet.getRow(4).getCell(3).setCellValue(emp01.get("drp").toString());
+ //降雨起止时间
+ sheet.getRow(4).getCell(4).setCellValue(emp01.get("drptime").toString());
+ CellRangeAddress region = new CellRangeAddress(4, 4, 4, 6);
+ sheet.addMergedRegion(region);
+ //起涨时间
+ sheet.getRow(4).getCell(7).setCellValue(emp01.get("qztime").toString());
+ //起涨水位
+ sheet.getRow(4).getCell(8).setCellValue(emp01.get("qzsw").toString());
+ //起涨流量
+ sheet.getRow(4).getCell(9).setCellValue(emp01.get("qzll").toString());
+ //发布时间水位
+ sheet.getRow(4).getCell(10).setCellValue(emp01.get("fbsw").toString());
+ //发布时间流量
+ sheet.getRow(4).getCell(11).setCellValue(emp01.get("fbll").toString());
+ //预报时间
+ sheet.getRow(4).getCell(12).setCellValue(emp01.get("ytime").toString());
+ //预报水位
+ sheet.getRow(4).getCell(13).setCellValue(emp01.get("Z").toString());
+ //预报流量
+ sheet.getRow(4).getCell(14).setCellValue(emp01.get("yq").toString());
+ //警戒水位
+ sheet.getRow(4).getCell(15).setCellValue(emp01.get("yjsw").toString());
+ //预报水位与警戒水位比较
+ sheet.getRow(4).getCell(16).setCellValue(emp01.get("dbi").toString());
+ //防洪对象
+ sheet.getRow(5).getCell(3).setCellValue(emp01.get("fh").toString());
+ CellRangeAddress regions = new CellRangeAddress(5, 6, 3, 16);
+ sheet.addMergedRegion(regions);
+ //发布时间
+ sheet.getRow(1).getCell(11).setCellValue("发布时间:"+emp01.get("ftime").toString());
+ CellRangeAddress regionf = new CellRangeAddress(1, 1, 11, 16);
+ sheet.addMergedRegion(regionf);
+ FileOutputStream out = new FileOutputStream( "D://Software//nginx-1.20.0//dist//fzswz//excel//主要河流预警.xls");
+ wb.write(out);
+ out.close();
+ }
+
+ /***
+ * MD5加码 生成32位md5码
+ */
+ public static String string2MD5(String inStr) {
+ MessageDigest md5 = null;
+ try {
+ md5 = MessageDigest.getInstance("MD5");
+ } catch (Exception e) {
+ System.out.println(e.toString());
+ e.printStackTrace();
+ return "";
+ }
+ char[] charArray = inStr.toCharArray();
+ byte[] byteArray = new byte[charArray.length];
+
+ for (int i = 0; i < charArray.length; i++)
+ byteArray[i] = (byte) charArray[i];
+ byte[] md5Bytes = md5.digest(byteArray);
+ StringBuffer hexValue = new StringBuffer();
+ for (int i = 0; i < md5Bytes.length; i++) {
+ int val = ((int) md5Bytes[i]) & 0xff;
+ if (val < 16)
+ hexValue.append("0");
+ hexValue.append(Integer.toHexString(val));
+ }
+ return hexValue.toString();
+
+ }
+
+
}
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 07a9204..8179737 100644
--- a/src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java
+++ b/src/main/java/org/springblade/modules/mountainrain/controller/MountainrainController.java
@@ -55,6 +55,7 @@
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.sql.Timestamp;
+import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -759,64 +760,71 @@
}
-// /**
-// * 土壤湿度计算
-// *
-// * @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;
-// 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("成功");
-// }
+ /**
+ * 土壤湿度计算
+ *
+ * @return
+ */
+ @GetMapping("/soleval")
+ public R soleval(String time, int b) {
+ //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ //String dateNow = sdf.format(new Date());
+ String dateNow = time;
+ //mountainrainService.soildel();
+ int intervals = 32 + b;
+ ArrayList passDaysList = new ArrayList<>();
+ for (int i = 1 + b; 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;
+ 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) {
+ //stcd=split[i];
+ 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 (stcd != null) {
+ if (v1 > 60) {
+ mountainrainService.soleInster(stcd, "60", dateNow);
+ } else {
+ String a = String.valueOf(v1);
+ mountainrainService.soleInster(stcd, a, dateNow);
+ }
+ }
+
+ }
+
+ return R.success("成功");
+ }
public static double formatDouble1(double d) {
return (double) Math.round(d * 10) / 10;
@@ -973,7 +981,7 @@
* @return
*/
@GetMapping("/selectsmriver")
- public R selectsmriver(String time) {
+ public R selectsmriver(String time) throws ParseException {
Date date = null;
// 把Date按照格式转换成字符串
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -983,7 +991,13 @@
e.printStackTrace();
}
String dateEnd = sdf.format(date);
- List<Map<String, Object>> selctsmriver = mountainrainService.selctsmriver(time, dateEnd);
+ DateFormat sdfc = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ Date datess = sdfc.parse(time);
+ String now = sdfc.format(datess);
+ //当前时间的前24小时
+ Date beforeHour1 = beforeHourToNowDate(now, 24);
+ String begintime24 = sdf.format(beforeHour1);
+ List<Map<String, Object>> selctsmriver = mountainrainService.selctsmriver(time, dateEnd, begintime24);
//预警数据
List listyj = new ArrayList();
//无预警数据
@@ -1016,7 +1030,7 @@
* @return
*/
@GetMapping("/selectbgriver")
- public R selectbgriver(String time) {
+ public R selectbgriver(String time) throws ParseException {
Date date = null;
// 把Date按照格式转换成字符串
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -1026,7 +1040,13 @@
e.printStackTrace();
}
String dateEnd = sdf.format(date);
- List<Map<String, Object>> selctsmriver = mountainrainService.selctbgriver(time, dateEnd);
+ DateFormat sdfc = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ Date datess = sdfc.parse(time);
+ String now = sdfc.format(datess);
+ //当前时间的前24小时
+ Date beforeHour1 = beforeHourToNowDate(now, 24);
+ String begintime24 = sdf.format(beforeHour1);
+ List<Map<String, Object>> selctsmriver = mountainrainService.selctbgriver(time, dateEnd, begintime24);
//预警数据
List listyj = new ArrayList();
//无预警数据
@@ -1135,16 +1155,23 @@
String times = time;
String dateEnd1 = dateEnds1;
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ Date date = null;
+ try {
+ date = sdf.parse(time);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ String stime = sdf.format(date);
//对应雨量站
String s = mountainrainService.selectCode();
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);
- List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainYi(times, dateEnd1, code);
+ List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainYi(times, dateEnd1, code, stime);
List<Map<String, Object>> lists = new ArrayList<>();
for (int i = 0; i < mountainrainsCVOS.size(); i++) {
if (mountainrainsCVOS.get(i).getCenconding() == null) {
@@ -1156,9 +1183,9 @@
if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
int drp1 = mountainrainsCVOS.get(i).getDrp1();
Integer gohours = mountainrainsCVOS.get(i).getGohours();
- float i1 = (float)drp1 - gohours;
+ float i1 = (float) drp1 - gohours;
float v = (float) (Math.round(i1 * 10)) / 10;
- String a= String.valueOf(v);
+ String a = String.valueOf(v);
map.put("List", mountainrainsCVOS.get(i));
map.put("flage1", "true");
map.put("status", 2);
@@ -1175,9 +1202,9 @@
if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
int drp1 = mountainrainsCVOS.get(i).getDrp1();
Integer gohour = mountainrainsCVOS.get(i).getGohour();
- float i1 = (float)drp1 - gohour;
+ float i1 = (float) drp1 - gohour;
float v = (float) (Math.round(i1 * 10)) / 10;
- String a= String.valueOf(v);
+ String a = String.valueOf(v);
map.put("List", mountainrainsCVOS.get(i));
map.put("flage1", "true");
map.put("status", 1);
@@ -1192,81 +1219,87 @@
}
}
- //色斑图
- String file = "";
- // 第一步,创建一个webbook,对应一个Excel文件
- HSSFWorkbook wb = new HSSFWorkbook();
- // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
- HSSFSheet sheet = wb.createSheet("山洪预警表");
- // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
- HSSFRow row = sheet.createRow((int) 0);
- // 第四步,创建单元格,并设置值表头 设置表头居中
- HSSFCellStyle style = wb.createCellStyle();
- //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
- HSSFCell cell = row.createCell((short) 0);
- cell.setCellValue("lon");
- cell = row.createCell((short) 1);
- cell.setCellValue("lat");
- cell = row.createCell((short) 2);
- cell.setCellValue("rain");
- for (int i = 0; i < mountainrainsCVOS.size(); i++) {
- row = sheet.createRow((int) i + 1);
- HSSFCell celli = row.createCell((short) 0);
- row.createCell((short) 0).setCellValue(mountainrainsCVOS.get(i).getDj());
- row.createCell((short) 1).setCellValue(mountainrainsCVOS.get(i).getBw());
- if (mountainrainsCVOS.get(i).getCenconding() == null) {
- continue;
- }
- if (mountainrainsCVOS.get(i).getSoilval() > 30) {
- //0.8雨量湿度
- if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
- row.createCell((short) 2).setCellValue(2);
- continue;
- } else {
- row.createCell((short) 2).setCellValue(1);
- continue;
- }
- } else {
- //0.5雨量湿度
- if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
- row.createCell((short) 2).setCellValue(2);
- continue;
- } else {
- row.createCell((short) 2).setCellValue(1);
- continue;
- }
- }
- }
- try {
- file = "D:/mou.xlsx";
- FileOutputStream fout = new FileOutputStream(file);
- wb.write(fout);
- fout.close();
- wb.close();
- } catch (Exception e) {
- 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(args1);
- BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
- String line = null;
- while ((line = in.readLine()) != null) {
- System.out.println(line);
- }
- in.close();
- proc.waitFor();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
lists.add(m);
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ //色斑图
+ String file = "";
+ // 第一步,创建一个webbook,对应一个Excel文件
+ HSSFWorkbook wb = new HSSFWorkbook();
+ // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
+ HSSFSheet sheet = wb.createSheet("山洪预警表");
+ // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
+ HSSFRow row = sheet.createRow((int) 0);
+ // 第四步,创建单元格,并设置值表头 设置表头居中
+ HSSFCellStyle style = wb.createCellStyle();
+ //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
+ HSSFCell cell = row.createCell((short) 0);
+ cell.setCellValue("lon");
+ cell = row.createCell((short) 1);
+ cell.setCellValue("lat");
+ cell = row.createCell((short) 2);
+ cell.setCellValue("rain");
+ for (int i = 0; i < mountainrainsCVOS.size(); i++) {
+ row = sheet.createRow((int) i + 1);
+ HSSFCell celli = row.createCell((short) 0);
+ row.createCell((short) 0).setCellValue(mountainrainsCVOS.get(i).getDj());
+ row.createCell((short) 1).setCellValue(mountainrainsCVOS.get(i).getBw());
+ if (mountainrainsCVOS.get(i).getCenconding() == null) {
+ continue;
+ }
+ if (mountainrainsCVOS.get(i).getSoilval() > 30) {
+ //0.8雨量湿度
+ if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
+ row.createCell((short) 2).setCellValue(2);
+ continue;
+ } else {
+ row.createCell((short) 2).setCellValue(1);
+ continue;
+ }
+ } else {
+ //0.5雨量湿度
+ if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
+ row.createCell((short) 2).setCellValue(2);
+ continue;
+ } else {
+ row.createCell((short) 2).setCellValue(1);
+ continue;
+ }
+ }
+ }
+ try {
+ file = "D:/mou.xlsx";
+ FileOutputStream fout = new FileOutputStream(file);
+ wb.write(fout);
+ fout.close();
+ wb.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ Process proc;
+ String[] args1 = new String[]{"python", "D:\\fz\\mou.py", String.valueOf(url)};
+ try {
+ proc = Runtime.getRuntime().exec(args1);
+ BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ String line = null;
+ while ((line = in.readLine()) != null) {
+ System.out.println(line);
+ }
+ in.close();
+ proc.waitFor();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
return R.data(lists);
}
@@ -1294,7 +1327,7 @@
if (drp1 > 30) {
double v = drp1 - 30;
double v1 = (double) Math.round(v * 100) / 100;
- String a=String.valueOf(v1);
+ String a = String.valueOf(v1);
map.put("flage1", "true");
map.put("num", a);
} else {
@@ -1303,69 +1336,75 @@
map.put("List", list.get(i));
lists.add(map);
}
- String fileName = "";
- // 第一步,创建一个webbook,对应一个Excel文件
- HSSFWorkbook wb = new HSSFWorkbook();
- // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
- HSSFSheet sheet = wb.createSheet("山洪雨量表");
- // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
- HSSFRow row = sheet.createRow((int) 0);
- // 第四步,创建单元格,并设置值表头 设置表头居中
- HSSFCellStyle style = wb.createCellStyle();
- //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
- HSSFCell cell = row.createCell((short) 0);
- cell.setCellValue(new HSSFRichTextString("lon"));
- cell = row.createCell((short) 1);
- cell.setCellValue(new HSSFRichTextString("lat"));
- cell = row.createCell((short) 2);
- cell.setCellValue(new HSSFRichTextString("rain"));
- for (int i = 0; i < list.size(); i++) {
- // 第四步,创建单元格,并设置值
- row = sheet.createRow((int) i + 1);
- HSSFCell celli = row.createCell((short) 0);
- BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
- 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 > 30) {
- row.createCell((short) 2).setCellValue(2);
- continue;
- } else {
- row.createCell((short) 2).setCellValue(1);
- continue;
- }
- }
- // 第六步,将文件存到指定位置
- try {
- fileName = "D:/moup.xlsx";
- FileOutputStream fout = new FileOutputStream(fileName);
- wb.write(fout);
- fout.close();
- wb.close();
- } catch (Exception e) {
- 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(args1);
- BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
- String line = null;
- while ((line = in.readLine()) != null) {
- System.out.println(line);
- }
- in.close();
- proc.waitFor();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
lists.add(m);
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ String fileName = "";
+ // 第一步,创建一个webbook,对应一个Excel文件
+ HSSFWorkbook wb = new HSSFWorkbook();
+ // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
+ HSSFSheet sheet = wb.createSheet("山洪雨量表");
+ // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
+ HSSFRow row = sheet.createRow((int) 0);
+ // 第四步,创建单元格,并设置值表头 设置表头居中
+ HSSFCellStyle style = wb.createCellStyle();
+ //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
+ HSSFCell cell = row.createCell((short) 0);
+ cell.setCellValue(new HSSFRichTextString("lon"));
+ cell = row.createCell((short) 1);
+ cell.setCellValue(new HSSFRichTextString("lat"));
+ cell = row.createCell((short) 2);
+ cell.setCellValue(new HSSFRichTextString("rain"));
+ for (int i = 0; i < list.size(); i++) {
+ // 第四步,创建单元格,并设置值
+ row = sheet.createRow((int) i + 1);
+ HSSFCell celli = row.createCell((short) 0);
+ BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
+ 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 > 30) {
+ row.createCell((short) 2).setCellValue(2);
+ continue;
+ } else {
+ row.createCell((short) 2).setCellValue(1);
+ continue;
+ }
+ }
+ // 第六步,将文件存到指定位置
+ try {
+ fileName = "D:/moup.xlsx";
+ FileOutputStream fout = new FileOutputStream(fileName);
+ wb.write(fout);
+ fout.close();
+ wb.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ Process proc;
+ String[] args1 = new String[]{"python", "D:\\fz\\moup.py", String.valueOf(url)};
+ try {
+ proc = Runtime.getRuntime().exec(args1);
+ BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ String line = null;
+ while ((line = in.readLine()) != null) {
+ System.out.println(line);
+ }
+ in.close();
+ proc.waitFor();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
return R.data(lists);
}
@@ -1383,7 +1422,14 @@
//2个小时前的时间
String dateEnd2 = dateEnds2;
-
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ Date date = null;
+ try {
+ date = sdf.parse(time);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ String stime = sdf.format(date);
//对应雨量站
String s = mountainrainService.selectCode();
String[] split = s.split(",");
@@ -1392,7 +1438,7 @@
strArrays += "'" + split[i] + "',";
}
String code = strArrays.substring(0, strArrays.length() - 1);
- List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainYi(times, dateEnd2, code);
+ List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainTw(times, dateEnd2, code, stime);
List<Map<String, Object>> lists = new ArrayList<>();
for (int i = 0; i < mountainrainsCVOS.size(); i++) {
if (mountainrainsCVOS.get(i).getCenconding() == null) {
@@ -1404,9 +1450,9 @@
if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
int drp1 = mountainrainsCVOS.get(i).getDrp1();
Integer gohours = mountainrainsCVOS.get(i).getGohours();
- float i1 = (float)drp1 - gohours;
+ float i1 = (float) drp1 - gohours;
float v = (float) (Math.round(i1 * 10)) / 10;
- String a= String.valueOf(v);
+ String a = String.valueOf(v);
map.put("List", mountainrainsCVOS.get(i));
map.put("flage1", "true");
map.put("flage3", "false");
@@ -1431,9 +1477,9 @@
if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
int drp1 = mountainrainsCVOS.get(i).getDrp1();
Integer gohour = mountainrainsCVOS.get(i).getGohour();
- float i1 = (float)drp1 - gohour;
+ float i1 = (float) drp1 - gohour;
float v = (float) (Math.round(i1 * 10)) / 10;
- String a= String.valueOf(v);
+ String a = String.valueOf(v);
map.put("List", mountainrainsCVOS.get(i));
map.put("flage1", "true");
map.put("flage3", "false");
@@ -1456,87 +1502,93 @@
}
}
- //色斑图
- String file = "";
- // 第一步,创建一个webbook,对应一个Excel文件
- HSSFWorkbook wb = new HSSFWorkbook();
- // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
- HSSFSheet sheet = wb.createSheet("山洪预警表");
- // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
- HSSFRow row = sheet.createRow((int) 0);
- // 第四步,创建单元格,并设置值表头 设置表头居中
- HSSFCellStyle style = wb.createCellStyle();
- //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
- HSSFCell cell = row.createCell((short) 0);
- cell.setCellValue("lon");
- cell = row.createCell((short) 1);
- cell.setCellValue("lat");
- cell = row.createCell((short) 2);
- cell.setCellValue("rain");
- for (int i = 0; i < mountainrainsCVOS.size(); i++) {
- row = sheet.createRow((int) i + 1);
- HSSFCell celli = row.createCell((short) 0);
- row.createCell((short) 0).setCellValue(mountainrainsCVOS.get(i).getDj());
- row.createCell((short) 1).setCellValue(mountainrainsCVOS.get(i).getBw());
- if (mountainrainsCVOS.get(i).getCenconding() == null) {
- continue;
- }
- if (mountainrainsCVOS.get(i).getSoilval() > 30) {
- //0.8雨量湿度
- if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
- row.createCell((short) 2).setCellValue(2);
- continue;
- } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthours()) {
- row.createCell((short) 2).setCellValue(2);
- continue;
- } else {
- row.createCell((short) 2).setCellValue(1);
- continue;
- }
- } else {
- //0.5雨量湿度
- if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
- row.createCell((short) 2).setCellValue(2);
- continue;
- } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthour()) {
- row.createCell((short) 2).setCellValue(2);
- continue;
- } else {
- row.createCell((short) 2).setCellValue(1);
- continue;
- }
- }
- }
- try {
- file = "D:/mou.xlsx";
- FileOutputStream fout = new FileOutputStream(file);
- wb.write(fout);
- fout.close();
- wb.close();
- } catch (Exception e) {
- 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(args1);
- BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
- String line = null;
- while ((line = in.readLine()) != null) {
- System.out.println(line);
- }
- in.close();
- proc.waitFor();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
lists.add(m);
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ //色斑图
+ String file = "";
+ // 第一步,创建一个webbook,对应一个Excel文件
+ HSSFWorkbook wb = new HSSFWorkbook();
+ // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
+ HSSFSheet sheet = wb.createSheet("山洪预警表");
+ // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
+ HSSFRow row = sheet.createRow((int) 0);
+ // 第四步,创建单元格,并设置值表头 设置表头居中
+ HSSFCellStyle style = wb.createCellStyle();
+ //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
+ HSSFCell cell = row.createCell((short) 0);
+ cell.setCellValue("lon");
+ cell = row.createCell((short) 1);
+ cell.setCellValue("lat");
+ cell = row.createCell((short) 2);
+ cell.setCellValue("rain");
+ for (int i = 0; i < mountainrainsCVOS.size(); i++) {
+ row = sheet.createRow((int) i + 1);
+ HSSFCell celli = row.createCell((short) 0);
+ row.createCell((short) 0).setCellValue(mountainrainsCVOS.get(i).getDj());
+ row.createCell((short) 1).setCellValue(mountainrainsCVOS.get(i).getBw());
+ if (mountainrainsCVOS.get(i).getCenconding() == null) {
+ continue;
+ }
+ if (mountainrainsCVOS.get(i).getSoilval() > 30) {
+ //0.8雨量湿度
+ if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) {
+ row.createCell((short) 2).setCellValue(2);
+ continue;
+ } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthours()) {
+ row.createCell((short) 2).setCellValue(2);
+ continue;
+ } else {
+ row.createCell((short) 2).setCellValue(1);
+ continue;
+ }
+ } else {
+ //0.5雨量湿度
+ if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) {
+ row.createCell((short) 2).setCellValue(2);
+ continue;
+ } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthour()) {
+ row.createCell((short) 2).setCellValue(2);
+ continue;
+ } else {
+ row.createCell((short) 2).setCellValue(1);
+ continue;
+ }
+ }
+ }
+ try {
+ file = "D:/mou.xlsx";
+ FileOutputStream fout = new FileOutputStream(file);
+ wb.write(fout);
+ fout.close();
+ wb.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ Process proc;
+ String[] args1 = new String[]{"python", "D:\\fz\\mou.py", String.valueOf(url)};
+ try {
+ proc = Runtime.getRuntime().exec(args1);
+ BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ String line = null;
+ while ((line = in.readLine()) != null) {
+ System.out.println(line);
+ }
+ in.close();
+ proc.waitFor();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
return R.data(lists);
}
@@ -1572,69 +1624,79 @@
map.put("List", list.get(i));
lists.add(map);
}
- String fileName = "";
- // 第一步,创建一个webbook,对应一个Excel文件
- HSSFWorkbook wb = new HSSFWorkbook();
- // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
- HSSFSheet sheet = wb.createSheet("山洪雨量表");
- // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
- HSSFRow row = sheet.createRow((int) 0);
- // 第四步,创建单元格,并设置值表头 设置表头居中
- HSSFCellStyle style = wb.createCellStyle();
- //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
- HSSFCell cell = row.createCell((short) 0);
- cell.setCellValue(new HSSFRichTextString("lon"));
- cell = row.createCell((short) 1);
- cell.setCellValue(new HSSFRichTextString("lat"));
- cell = row.createCell((short) 2);
- cell.setCellValue(new HSSFRichTextString("rain"));
- for (int i = 0; i < list.size(); i++) {
- // 第四步,创建单元格,并设置值
- row = sheet.createRow((int) i + 1);
- HSSFCell celli = row.createCell((short) 0);
- BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
- 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;
- }
- }
- // 第六步,将文件存到指定位置
- try {
- fileName = "D:/moup.xlsx";
- FileOutputStream fout = new FileOutputStream(fileName);
- wb.write(fout);
- fout.close();
- wb.close();
- } catch (Exception e) {
- 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(args1);
- BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
- String line = null;
- while ((line = in.readLine()) != null) {
- System.out.println(line);
- }
- in.close();
- proc.waitFor();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
lists.add(m);
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ String fileName = "";
+ // 第一步,创建一个webbook,对应一个Excel文件
+ HSSFWorkbook wb = new HSSFWorkbook();
+ // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
+ HSSFSheet sheet = wb.createSheet("山洪雨量表");
+ // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
+ HSSFRow row = sheet.createRow((int) 0);
+ // 第四步,创建单元格,并设置值表头 设置表头居中
+ HSSFCellStyle style = wb.createCellStyle();
+ //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
+ HSSFCell cell = row.createCell((short) 0);
+ cell.setCellValue(new HSSFRichTextString("lon"));
+ cell = row.createCell((short) 1);
+ cell.setCellValue(new HSSFRichTextString("lat"));
+ cell = row.createCell((short) 2);
+ cell.setCellValue(new HSSFRichTextString("rain"));
+ for (int i = 0; i < list.size(); i++) {
+ // 第四步,创建单元格,并设置值
+ row = sheet.createRow((int) i + 1);
+ HSSFCell celli = row.createCell((short) 0);
+ BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
+ 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;
+ }
+ }
+ // 第六步,将文件存到指定位置
+ try {
+ fileName = "D:/moup.xlsx";
+ FileOutputStream fout = new FileOutputStream(fileName);
+ wb.write(fout);
+ fout.close();
+ wb.close();
+ } catch (Exception e) {
+ 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(args1);
+ BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ String line = null;
+ while ((line = in.readLine()) != null) {
+ System.out.println(line);
+ }
+ in.close();
+ proc.waitFor();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
return R.data(lists);
}
@@ -1653,7 +1715,14 @@
//2个小时前的时间
String dateEnd3 = dateEnds3;
-
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ Date date = null;
+ try {
+ date = sdf.parse(time);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ String stime = sdf.format(date);
//对应雨量站
String s = mountainrainService.selectCode();
String[] split = s.split(",");
@@ -1662,7 +1731,7 @@
strArrays += "'" + split[i] + "',";
}
String code = strArrays.substring(0, strArrays.length() - 1);
- List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainTr(times, dateEnd3, code);
+ List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainTr(times, dateEnd3, code, stime);
List<Map<String, Object>> lists = new ArrayList<>();
for (int i = 0; i < mountainrainsCVOS.size(); i++) {
if (mountainrainsCVOS.get(i).getCenconding() == null) {
@@ -1674,9 +1743,9 @@
if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthours()) {
int drp1 = mountainrainsCVOS.get(i).getDrp1();
Integer gohours = mountainrainsCVOS.get(i).getGohours();
- float i1 = (float)drp1 - gohours;
+ float i1 = (float) drp1 - gohours;
float v = (float) (Math.round(i1 * 10)) / 10;
- String a= String.valueOf(v);
+ String a = String.valueOf(v);
map.put("List", mountainrainsCVOS.get(i));
map.put("flage3", "true");
map.put("status", 2);
@@ -1693,9 +1762,9 @@
if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthour()) {
int drp1 = mountainrainsCVOS.get(i).getDrp1();
Integer gohour = mountainrainsCVOS.get(i).getGohour();
- float i1 = (float)drp1 - gohour;
+ float i1 = (float) drp1 - gohour;
float v = (float) (Math.round(i1 * 10)) / 10;
- String a= String.valueOf(v);
+ String a = String.valueOf(v);
map.put("List", mountainrainsCVOS.get(i));
map.put("flage3", "true");
map.put("status", 1);
@@ -1710,81 +1779,87 @@
}
}
- //色斑图
- String file = "";
- // 第一步,创建一个webbook,对应一个Excel文件
- HSSFWorkbook wb = new HSSFWorkbook();
- // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
- HSSFSheet sheet = wb.createSheet("山洪预警表");
- // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
- HSSFRow row = sheet.createRow((int) 0);
- // 第四步,创建单元格,并设置值表头 设置表头居中
- HSSFCellStyle style = wb.createCellStyle();
- //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
- HSSFCell cell = row.createCell((short) 0);
- cell.setCellValue("lon");
- cell = row.createCell((short) 1);
- cell.setCellValue("lat");
- cell = row.createCell((short) 2);
- cell.setCellValue("rain");
- for (int i = 0; i < mountainrainsCVOS.size(); i++) {
- row = sheet.createRow((int) i + 1);
- HSSFCell celli = row.createCell((short) 0);
- row.createCell((short) 0).setCellValue(mountainrainsCVOS.get(i).getDj());
- row.createCell((short) 1).setCellValue(mountainrainsCVOS.get(i).getBw());
- if (mountainrainsCVOS.get(i).getCenconding() == null) {
- continue;
- }
- if (mountainrainsCVOS.get(i).getSoilval() > 30) {
- //0.8雨量湿度
- if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthours()) {
- row.createCell((short) 2).setCellValue(2);
- continue;
- } else {
- row.createCell((short) 2).setCellValue(1);
- continue;
- }
- } else {
- //0.5雨量湿度
- if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthour()) {
- row.createCell((short) 2).setCellValue(2);
- continue;
- } else {
- row.createCell((short) 2).setCellValue(1);
- continue;
- }
- }
- }
- try {
- file = "D:/mou.xlsx";
- FileOutputStream fout = new FileOutputStream(file);
- wb.write(fout);
- fout.close();
- wb.close();
- } catch (Exception e) {
- 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(args1);
- BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
- String line = null;
- while ((line = in.readLine()) != null) {
- System.out.println(line);
- }
- in.close();
- proc.waitFor();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
lists.add(m);
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ //色斑图
+ String file = "";
+ // 第一步,创建一个webbook,对应一个Excel文件
+ HSSFWorkbook wb = new HSSFWorkbook();
+ // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
+ HSSFSheet sheet = wb.createSheet("山洪预警表");
+ // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
+ HSSFRow row = sheet.createRow((int) 0);
+ // 第四步,创建单元格,并设置值表头 设置表头居中
+ HSSFCellStyle style = wb.createCellStyle();
+ //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
+ HSSFCell cell = row.createCell((short) 0);
+ cell.setCellValue("lon");
+ cell = row.createCell((short) 1);
+ cell.setCellValue("lat");
+ cell = row.createCell((short) 2);
+ cell.setCellValue("rain");
+ for (int i = 0; i < mountainrainsCVOS.size(); i++) {
+ row = sheet.createRow((int) i + 1);
+ HSSFCell celli = row.createCell((short) 0);
+ row.createCell((short) 0).setCellValue(mountainrainsCVOS.get(i).getDj());
+ row.createCell((short) 1).setCellValue(mountainrainsCVOS.get(i).getBw());
+ if (mountainrainsCVOS.get(i).getCenconding() == null) {
+ continue;
+ }
+ if (mountainrainsCVOS.get(i).getSoilval() > 30) {
+ //0.8雨量湿度
+ if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthours()) {
+ row.createCell((short) 2).setCellValue(2);
+ continue;
+ } else {
+ row.createCell((short) 2).setCellValue(1);
+ continue;
+ }
+ } else {
+ //0.5雨量湿度
+ if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthour()) {
+ row.createCell((short) 2).setCellValue(2);
+ continue;
+ } else {
+ row.createCell((short) 2).setCellValue(1);
+ continue;
+ }
+ }
+ }
+ try {
+ file = "D:/mou.xlsx";
+ FileOutputStream fout = new FileOutputStream(file);
+ wb.write(fout);
+ fout.close();
+ wb.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ Process proc;
+ String[] args1 = new String[]{"python", "D:\\fz\\mou.py", String.valueOf(url)};
+ try {
+ proc = Runtime.getRuntime().exec(args1);
+ BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ String line = null;
+ while ((line = in.readLine()) != null) {
+ System.out.println(line);
+ }
+ in.close();
+ proc.waitFor();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
return R.data(lists);
}
@@ -1820,70 +1895,76 @@
map.put("List", list.get(i));
lists.add(map);
}
- String fileName = "";
- // 第一步,创建一个webbook,对应一个Excel文件
- HSSFWorkbook wb = new HSSFWorkbook();
- // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
- HSSFSheet sheet = wb.createSheet("山洪雨量表");
- // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
- HSSFRow row = sheet.createRow((int) 0);
- // 第四步,创建单元格,并设置值表头 设置表头居中
- HSSFCellStyle style = wb.createCellStyle();
- //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
- HSSFCell cell = row.createCell((short) 0);
- cell.setCellValue(new HSSFRichTextString("lon"));
- cell = row.createCell((short) 1);
- cell.setCellValue(new HSSFRichTextString("lat"));
- cell = row.createCell((short) 2);
- cell.setCellValue(new HSSFRichTextString("rain"));
- for (int i = 0; i < list.size(); i++) {
- // 第四步,创建单元格,并设置值
- row = sheet.createRow((int) i + 1);
- HSSFCell celli = row.createCell((short) 0);
- BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
- 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 > 80) {
- row.createCell((short) 2).setCellValue(2);
- continue;
-
- } else {
- row.createCell((short) 2).setCellValue(1);
- continue;
- }
- }
- // 第六步,将文件存到指定位置
- try {
- fileName = "D:/moup.xlsx";
- FileOutputStream fout = new FileOutputStream(fileName);
- wb.write(fout);
- fout.close();
- wb.close();
- } catch (Exception e) {
- 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(args1);
- BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
- String line = null;
- while ((line = in.readLine()) != null) {
- System.out.println(line);
- }
- in.close();
- proc.waitFor();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
lists.add(m);
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ String fileName = "";
+ // 第一步,创建一个webbook,对应一个Excel文件
+ HSSFWorkbook wb = new HSSFWorkbook();
+ // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
+ HSSFSheet sheet = wb.createSheet("山洪雨量表");
+ // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
+ HSSFRow row = sheet.createRow((int) 0);
+ // 第四步,创建单元格,并设置值表头 设置表头居中
+ HSSFCellStyle style = wb.createCellStyle();
+ //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
+ HSSFCell cell = row.createCell((short) 0);
+ cell.setCellValue(new HSSFRichTextString("lon"));
+ cell = row.createCell((short) 1);
+ cell.setCellValue(new HSSFRichTextString("lat"));
+ cell = row.createCell((short) 2);
+ cell.setCellValue(new HSSFRichTextString("rain"));
+ for (int i = 0; i < list.size(); i++) {
+ // 第四步,创建单元格,并设置值
+ row = sheet.createRow((int) i + 1);
+ HSSFCell celli = row.createCell((short) 0);
+ BigDecimal w1 = (BigDecimal) list.get(i).get("drp1");
+ 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 > 80) {
+ row.createCell((short) 2).setCellValue(2);
+ continue;
+
+ } else {
+ row.createCell((short) 2).setCellValue(1);
+ continue;
+ }
+ }
+ // 第六步,将文件存到指定位置
+ try {
+ fileName = "D:/moup.xlsx";
+ FileOutputStream fout = new FileOutputStream(fileName);
+ wb.write(fout);
+ fout.close();
+ wb.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ Process proc;
+ String[] args1 = new String[]{"python", "D:\\fz\\moup.py", String.valueOf(url)};
+ try {
+ proc = Runtime.getRuntime().exec(args1);
+ BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ String line = null;
+ while ((line = in.readLine()) != null) {
+ System.out.println(line);
+ }
+ in.close();
+ proc.waitFor();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
return R.data(lists);
}
@@ -1894,7 +1975,7 @@
*/
@GetMapping("/selectS")
public R selectS(String time) {
- List<Map<String, Object>> list = mountainrainService.selectS();
+ List<Map<String, Object>> list = mountainrainService.selectS(time);
String fileName = "";
// 第一步,创建一个webbook,对应一个Excel文件
HSSFWorkbook wb = new HSSFWorkbook();
@@ -1998,6 +2079,16 @@
return R.data(m);
}
-
+ public static Date beforeHourToNowDate(String date, int hours) {
+ Calendar c = Calendar.getInstance();
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ try {
+ c.setTime(sdf.parse(date));
+ c.set(Calendar.HOUR_OF_DAY, c.get(Calendar.HOUR_OF_DAY) - hours);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return c.getTime();
+ }
}
diff --git a/src/main/java/org/springblade/modules/mountainrain/controller/SmariverController.java b/src/main/java/org/springblade/modules/mountainrain/controller/SmariverController.java
index 7a2de0e..b3da702 100644
--- a/src/main/java/org/springblade/modules/mountainrain/controller/SmariverController.java
+++ b/src/main/java/org/springblade/modules/mountainrain/controller/SmariverController.java
@@ -19,20 +19,28 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.ss.usermodel.CellType;
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.tool.api.R;
+import org.springblade.modules.mountainrain.entity.Yucbig;
import org.springblade.modules.mountainrain.entity.Yucsma;
import org.springblade.modules.mountainrain.excel.MgrExcel;
import org.springblade.modules.mountainrain.excel.MgrImporter;
+import org.springblade.modules.mountainrain.service.IBigriverService;
import org.springblade.modules.mountainrain.service.ISmariverService;
import org.springblade.modules.mountainrain.wrapper.SmariverWrapper;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
+import java.io.IOException;
+import java.io.InputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -50,7 +58,7 @@
public class SmariverController extends BladeController {
private ISmariverService iSmariverService;
-
+ private IBigriverService iBigriverService;
/**
* 详情
*/
@@ -86,15 +94,15 @@
return R.status(iSmariverService.updateById(yucsma));
}
- /**
- * 中小河流预报数据导入
- */
- @PostMapping("import-mgr")
- public R importmgr(MultipartFile file) {
- MgrImporter mgrImporter = new MgrImporter(iSmariverService, false);
- ExcelUtil.save(file, mgrImporter, MgrExcel.class);
- return R.success("操作成功");
- }
+// /**
+// * 中小河流预报数据导入
+// */
+// @PostMapping("import-mgr")
+// public R importmgr(MultipartFile file) {
+// MgrImporter mgrImporter = new MgrImporter(iSmariverService, false);
+// ExcelUtil.save(file, mgrImporter, MgrExcel.class);
+// return R.success("操作成功");
+// }
/**
* 中小河流预警
@@ -129,4 +137,75 @@
return R.data(list);
}
+
+
+ @PostMapping("import-mgr")
+ public void importmgr(MultipartFile file) throws IOException, InvalidFormatException {
+ InputStream is = file.getInputStream();
+ HSSFWorkbook workbook = new HSSFWorkbook(is);
+ //确定版本
+ boolean isExcel2003 = file.getOriginalFilename().endsWith("xls") ? true : false;
+ List<Map<String, Object>> returnMap;//返回execlClass类见下
+ if (isExcel2003) { //判断版本
+ HSSFSheet sheet = workbook.getSheetAt(1);
+ sheet.getRow(4).getCell(12).setCellType(CellType.STRING);
+ sheet.getRow(4).getCell(13).setCellType(CellType.STRING);
+ sheet.getRow(4).getCell(14).setCellType(CellType.STRING);
+ sheet.getRow(4).getCell(15).setCellType(CellType.STRING);
+ sheet.getRow(4).getCell(8).setCellType(CellType.STRING);
+ //发布时间
+ String ftimes = sheet.getRow(1).getCell(11).getStringCellValue();
+ String substring = ftimes.substring(5, ftimes.length());
+ String year = substring.substring(0, substring.lastIndexOf("年"));
+ String yues = substring.substring(substring.indexOf("年")+1, substring.lastIndexOf("月"));
+ String yue;
+ if (yues.length()==1){
+ yue=0+yues;
+ }
+ else {
+ yue=yues;
+ }
+ String r = substring.substring(substring.indexOf("月")+1, substring.lastIndexOf("日"));
+ String ms = substring.substring(substring.indexOf("日")+1, substring.lastIndexOf("时"));
+ String ftime=year+"-"+yue+"-"+r+" "+ms+":00:00";
+ //河名
+ String river = sheet.getRow(4).getCell(0).getStringCellValue();
+ //站点名称
+ String stnames = sheet.getRow(4).getCell(1).getStringCellValue();
+ String stcd = iBigriverService.selectINfo(stnames);
+ //预报时间
+ String ytimes = sheet.getRow(4).getCell(12).getStringCellValue();
+ String[] split = ytimes.split(",");
+ String a;
+ if (split[0].length()==1){
+ a=0+yues;
+ }
+ else {
+ a=yues;
+ }
+ String ytime=year+"-"+a+"-"+split[1]+" "+split[2]+":00:00";
+ //预测水位
+ String yuz = sheet.getRow(4).getCell(13).getStringCellValue();
+ //预警流量
+ String yq = sheet.getRow(4).getCell(14).getStringCellValue();
+ //预警水位
+ String yjsw = sheet.getRow(4).getCell(15).getStringCellValue();
+ String qzsw = sheet.getRow(4).getCell(8).getStringCellValue();
+ Yucsma yucsma=new Yucsma();
+ yucsma.setStcd(stcd);
+ yucsma.setStname(stnames);
+ yucsma.setRiver(river);
+ yucsma.setFtime(ftime);
+ yucsma.setYjsw(yjsw);
+ yucsma.setYtime(ytime);
+ yucsma.setYuz(yuz);
+ yucsma.setYq(yq);
+ yucsma.setQzsw(qzsw);
+ iSmariverService.save(yucsma);
+ } else {
+ //有多少个sheet
+ int sheets = workbook.getNumberOfSheets();
+ System.out.println("其他:" + sheets);
+ }
+ }
}
diff --git a/src/main/java/org/springblade/modules/mountainrain/controller/ss.java b/src/main/java/org/springblade/modules/mountainrain/controller/ss.java
index 1996e3c..483f070 100644
--- a/src/main/java/org/springblade/modules/mountainrain/controller/ss.java
+++ b/src/main/java/org/springblade/modules/mountainrain/controller/ss.java
@@ -16,7 +16,7 @@
@Component
public class ss {
@Autowired
- private IRegionWeightService regionWeightService;
+ private IRegionWeightService regionWeightService;
@Autowired
private IMountainrainService mountainrainService;
@@ -67,14 +67,16 @@
}
}
}
- if (v1 > 60) {
- mountainrainService.soleInster(stcd, "60",dateNow);
- } else {
- String a = String.valueOf(v1);
- mountainrainService.soleInster(stcd, a,dateNow);
+ if (stcd!=null) {
+ if (v1 > 60) {
+ mountainrainService.soleInster(stcd, "60", dateNow);
+ } else {
+ String a = String.valueOf(v1);
+ mountainrainService.soleInster(stcd, a, dateNow);
+ }
}
- }
+ }
return R.success("成功");
}
diff --git a/src/main/java/org/springblade/modules/mountainrain/entity/Yucbig.java b/src/main/java/org/springblade/modules/mountainrain/entity/Yucbig.java
index ff87ce8..f343f2e 100644
--- a/src/main/java/org/springblade/modules/mountainrain/entity/Yucbig.java
+++ b/src/main/java/org/springblade/modules/mountainrain/entity/Yucbig.java
@@ -58,4 +58,52 @@
*/
@ApiModelProperty(value = "预警流量")
private String yq;
+
+ /**
+ * 起涨水位
+ */
+ @ApiModelProperty(value = "起涨水位")
+ private String qzsw;
+
+ /**
+ * 降雨量
+ */
+ @ApiModelProperty(value = "降雨量")
+ private String drp;
+
+ /**
+ * 降雨起止时间
+ */
+ @ApiModelProperty(value = "降雨起止时间")
+ private String drptime;
+
+ /**
+ * 起涨时间
+ */
+ @ApiModelProperty(value = "起涨时间")
+ private String qztime;
+
+ /**
+ * 起涨流量
+ */
+ @ApiModelProperty(value = "起涨流量")
+ private String qzll;
+
+ /**
+ * 发布水位
+ */
+ @ApiModelProperty(value = "发布水位")
+ private String fbsw;
+
+ /**
+ * 发布流量
+ */
+ @ApiModelProperty(value = "发布流量")
+ private String fbll;
+
+ /**
+ * 预报水位与警戒水位比较
+ */
+ @ApiModelProperty(value = "预报水位与警戒水位比较")
+ private String dbi;
}
diff --git a/src/main/java/org/springblade/modules/mountainrain/entity/Yucsma.java b/src/main/java/org/springblade/modules/mountainrain/entity/Yucsma.java
index 7e8a6d3..583e556 100644
--- a/src/main/java/org/springblade/modules/mountainrain/entity/Yucsma.java
+++ b/src/main/java/org/springblade/modules/mountainrain/entity/Yucsma.java
@@ -58,4 +58,10 @@
*/
@ApiModelProperty(value = "预警流量")
private String yq;
+
+ /**
+ * 起涨水位
+ */
+ @ApiModelProperty(value = "起涨水位")
+ private String qzsw;
}
diff --git a/src/main/java/org/springblade/modules/mountainrain/excel/temple.xls b/src/main/java/org/springblade/modules/mountainrain/excel/temple.xls
new file mode 100644
index 0000000..30e363f
--- /dev/null
+++ b/src/main/java/org/springblade/modules/mountainrain/excel/temple.xls
Binary files differ
diff --git a/src/main/java/org/springblade/modules/mountainrain/mapper/BigriverMapper.java b/src/main/java/org/springblade/modules/mountainrain/mapper/BigriverMapper.java
index 057b1ed..cf43934 100644
--- a/src/main/java/org/springblade/modules/mountainrain/mapper/BigriverMapper.java
+++ b/src/main/java/org/springblade/modules/mountainrain/mapper/BigriverMapper.java
@@ -35,4 +35,6 @@
*/
public interface BigriverMapper extends BaseMapper<Yucbig> {
List<Map<String, Object>> selctbgriver();
+
+ String selectINfo(String stnm);
}
diff --git a/src/main/java/org/springblade/modules/mountainrain/mapper/BigriverMapper.xml b/src/main/java/org/springblade/modules/mountainrain/mapper/BigriverMapper.xml
index 524ff99..e266341 100644
--- a/src/main/java/org/springblade/modules/mountainrain/mapper/BigriverMapper.xml
+++ b/src/main/java/org/springblade/modules/mountainrain/mapper/BigriverMapper.xml
@@ -10,19 +10,35 @@
cs1.yuz as Z,
cs1.yjsw,
cs1.stname,
+ cs1.qzsw,
+ cs1.yq,
+ cs1.drptime,
+ cs1.qztime,
+ cs1.drp,
+ cs1.qzll,
+ cs1. fbsw,
+ cs1.fbll,
+ cs1.dbi,
ad.ADDVNM as addvnm,
cs1.river,
st.LGTD,
- st.LTTD
+ st.LTTD,
+ st.HNNM
FROM (
SELECT A.stcd,
MAX(A.ftime) as ftime
FROM (SELECT stcd, ftime FROM sys_Yucbig) AS A
GROUP BY A.stcd
) cs
- INNER JOIN (SELECT stcd, stname, ftime, ytime, yuz, yjsw, river FROM sys_Yucbig) cs1
+ INNER JOIN (SELECT stcd, stname, ftime, ytime, yuz, yjsw, river,qzsw,yq,drptime,qztime,drp,qzll,fbsw,fbll,dbi FROM sys_Yucbig) cs1
ON cs.stcd = cs1.stcd and cs.ftime=cs1.ftime
- INNER JOIN (SELECT LGTD, LTTD, STCD,ADDVCD FROM ST_STBPRP_B) st ON st.STCD = cs1.stcd
+ INNER JOIN (SELECT LGTD, LTTD, STCD,ADDVCD,HNNM FROM ST_STBPRP_B) st ON st.STCD = cs1.stcd
INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD
</select>
+
+ <select id="selectINfo" resultType="java.lang.String">
+ SELECT STCD
+ from dbo.ST_STBPRP_B
+ where STNM =#{stnm}
+ </select>
</mapper>
diff --git a/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.java b/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.java
index 2c9fe70..1dd5923 100644
--- a/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.java
+++ b/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.java
@@ -62,9 +62,9 @@
List<MountainrainsCVO> selectcInfos(String times, String dateEnd24, String dateEnd1, String dateEnd3, String dateEnd6, String timess);
List<MountainrainsCVO> Mountains(String times, String dateEnd1, String dateEnd2, String dateEnd3, String code);
- List<MountainrainsCVO> MountainYi(String times, String dateEnd1,String code);
- List<MountainrainsCVO> MountainTw(String times, String dateEnd2,String code);
- List<MountainrainsCVO> MountainTr(String times, String dateEnd3,String code);
+ List<MountainrainsCVO> MountainYi(String times, String dateEnd1,String code,String stime);
+ List<MountainrainsCVO> MountainTw(String times, String dateEnd2,String code,String stime);
+ List<MountainrainsCVO> MountainTr(String times, String dateEnd3,String code,String stime);
List<MountainrainsCVO> selectcInfosdx(String times, String dateEnd24, String dateEnd1, String dateEnd3, String dateEnd6, String addvnm);
@@ -148,8 +148,8 @@
List<Map<String, Object>> selectAddvcd(String addvcd);
List<Map<String, Object>> selectYup();
- List<Map<String, Object>> selctsmriver(String time,String dateEnd);
- List<Map<String, Object>> selctbgriver(String time,String dateEnd);
+ List<Map<String, Object>> selctsmriver(String time,String dateEnd,String begintime24);
+ List<Map<String, Object>> selctbgriver(String time,String dateEnd,String begintime24);
List<Map<String, Object>> selectTu();
List<Map<String, Object>> selectS(String stime);
List<MountainrainsCVO> selectYum();
diff --git a/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml b/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml
index 0c6ae3c..1fcb5e0 100644
--- a/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml
+++ b/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml
@@ -562,7 +562,9 @@
sm.river,
sm.addvnm,
st.LGTD,
- st.LTTD
+ st.LTTD,
+ st.HNNM,
+ cs2.minz
FROM (
SELECT A.STCD,
MAX(A.TM) TM
@@ -575,7 +577,11 @@
INNER JOIN (SELECT stcd, yjsw, stname, river, addvnm
FROM sys_smallriver
GROUP BY stcd, yjsw, stname, river, addvnm) sm ON sm.stcd = cs1.STCD
- INNER JOIN (SELECT LGTD, LTTD, STCD FROM ST_STBPRP_B) st ON st.STCD = cs1.STCD
+ INNER JOIN (SELECT LGTD, LTTD, STCD,HNNM FROM ST_STBPRP_B) st ON st.STCD = cs1.STCD
+ INNER JOIN (SELECT MIN(Z) AS minz, STCD
+ FROM dbo.ST_RIVER_R
+ where TM > #{begintime24} AND TM <= #{time}
+ GROUP BY STCD) cs2 ON cs.STCD = cs2.STCD
</select>
<!--大江大河-->
<select id="selctbgriver" resultType="java.util.Map">
@@ -587,7 +593,9 @@
sm.river,
sm.addvnm,
st.LGTD,
- st.LTTD
+ st.LTTD,
+ st.HNNM,
+ cs2.minz
FROM (
SELECT A.STCD,
MAX(A.TM) TM
@@ -600,7 +608,11 @@
INNER JOIN (SELECT stcd, yjsw, stname, river, addvnm
FROM sys_bigriver
GROUP BY stcd, yjsw, stname, river, addvnm) sm ON sm.stcd = cs1.STCD
- INNER JOIN (SELECT LGTD, LTTD, STCD FROM ST_STBPRP_B) st ON st.STCD = cs1.STCD
+ INNER JOIN (SELECT LGTD, LTTD, STCD, HNNM FROM ST_STBPRP_B) st ON st.STCD = cs1.STCD
+ INNER JOIN (SELECT MIN(Z) AS minz, STCD
+ FROM dbo.ST_RIVER_R
+ where TM > #{begintime24} AND TM <= #{time}
+ GROUP BY STCD) cs2 ON cs.STCD = cs2.STCD
</select>
@@ -676,7 +688,7 @@
) cs ON cs.cenconding = a.STCD
LEFT JOIN (
SELECT stcd, soilval
- FROM sys_soleval
+ FROM sys_soleval where datediff(day,stime, #{stime}) = 0
) so ON so.stcd = a.STCD
</select>
<!--山洪2小时预警-->
@@ -737,7 +749,7 @@
) cs ON cs.cenconding = a.STCD
LEFT JOIN (
SELECT stcd, soilval
- FROM sys_soleval
+ FROM sys_soleval where datediff(day,stime, #{stime}) = 0
) so ON so.stcd = a.STCD
</select>
<select id="MountainTr" resultMap="mountainrainResultMapcInfo">
@@ -797,7 +809,7 @@
) cs ON cs.cenconding = a.STCD
LEFT JOIN (
SELECT stcd, soilval
- FROM sys_soleval
+ FROM sys_soleval where datediff(day,stime, #{stime}) = 0
) so ON so.stcd = a.STCD
</select>
@@ -912,6 +924,6 @@
st.LTTD
FROM sys_soleval so
INNER JOIN dbo.ST_STBPRP_B st ON so.stcd = st.STCD
- where datediff(day, #{stime}, getdate()) = 0
+ where datediff(day,stime, #{stime}) = 0
</select>
</mapper>
diff --git a/src/main/java/org/springblade/modules/mountainrain/mapper/SmariverMapper.xml b/src/main/java/org/springblade/modules/mountainrain/mapper/SmariverMapper.xml
index 9a6066c..cfca0d5 100644
--- a/src/main/java/org/springblade/modules/mountainrain/mapper/SmariverMapper.xml
+++ b/src/main/java/org/springblade/modules/mountainrain/mapper/SmariverMapper.xml
@@ -10,17 +10,19 @@
cs1.yuz as Z,
cs1.yjsw,
cs1.stname,
+ cs1.qzsw as minz,
ad.ADDVNM as addvnm,
cs1.river,
st.LGTD,
- st.LTTD
+ st.LTTD,
+ st.HNNM
FROM (
SELECT A.stcd,
MAX(A.ftime) as ftime
FROM (SELECT stcd, ftime FROM sys_Yucsma) AS A
GROUP BY A.stcd
) cs
- INNER JOIN (SELECT stcd, stname, ftime, ytime, yuz, yjsw, river FROM sys_Yucsma) cs1
+ INNER JOIN (SELECT stcd, stname, ftime, ytime, yuz, yjsw, river,qzsw FROM sys_Yucsma) cs1
ON cs.stcd = cs1.stcd and cs.ftime = cs1.ftime
INNER JOIN (SELECT LGTD, LTTD, STCD, ADDVCD FROM ST_STBPRP_B) st ON st.STCD = cs1.stcd
INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD
diff --git a/src/main/java/org/springblade/modules/mountainrain/service/IBigriverService.java b/src/main/java/org/springblade/modules/mountainrain/service/IBigriverService.java
index a3f9150..9cce2ca 100644
--- a/src/main/java/org/springblade/modules/mountainrain/service/IBigriverService.java
+++ b/src/main/java/org/springblade/modules/mountainrain/service/IBigriverService.java
@@ -46,4 +46,5 @@
*/
void importBgr(List<BgrExcel> data, Boolean isCovered);
List<Map<String, Object>> selctbgriver();
+ String selectINfo(String stnm);
}
diff --git a/src/main/java/org/springblade/modules/mountainrain/service/IMountainrainService.java b/src/main/java/org/springblade/modules/mountainrain/service/IMountainrainService.java
index 5e6f014..c3e0dd2 100644
--- a/src/main/java/org/springblade/modules/mountainrain/service/IMountainrainService.java
+++ b/src/main/java/org/springblade/modules/mountainrain/service/IMountainrainService.java
@@ -143,11 +143,11 @@
int insertYuc(List<Yucpptn> yucpptnList);
List<Map<String, Object>> selectYup();
List<MountainrainsCVO> selectYum();
- List<Map<String, Object>> selctsmriver(String time,String dateEnd);
- List<Map<String, Object>> selctbgriver(String time,String dateEnd);
- List<MountainrainsCVO> MountainYi(String times, String dateEnd1,String code);
- List<MountainrainsCVO> MountainTw(String times, String dateEnd2,String code);
- List<MountainrainsCVO> MountainTr(String times, String dateEnd3,String code);
+ List<Map<String, Object>> selctsmriver(String time,String dateEnd,String begintime24);
+ List<Map<String, Object>> selctbgriver(String time,String dateEnd,String begintime24);
+ List<MountainrainsCVO> MountainYi(String times, String dateEnd1,String code,String stime);
+ List<MountainrainsCVO> MountainTw(String times, String dateEnd2,String code,String stime);
+ List<MountainrainsCVO> MountainTr(String times, String dateEnd3,String code,String stime);
List<Map<String, Object>> selecMoneYi(String times, String dateEnd1, String code);
List<Map<String, Object>> selecMoneTw(String times, String dateEnd2, String code);
List<Map<String, Object>> selecMoneTr(String times, String dateEnd3, String code);
diff --git a/src/main/java/org/springblade/modules/mountainrain/service/impl/BigriverServiceImpl.java b/src/main/java/org/springblade/modules/mountainrain/service/impl/BigriverServiceImpl.java
index ab4f5f6..d59f9c5 100644
--- a/src/main/java/org/springblade/modules/mountainrain/service/impl/BigriverServiceImpl.java
+++ b/src/main/java/org/springblade/modules/mountainrain/service/impl/BigriverServiceImpl.java
@@ -78,4 +78,9 @@
public List<Map<String, Object>> selctbgriver() {
return baseMapper.selctbgriver();
}
+
+ @Override
+ public String selectINfo(String stnm) {
+ return baseMapper.selectINfo(stnm);
+ }
}
diff --git a/src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java b/src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java
index daa4bd6..1b39501 100644
--- a/src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java
+++ b/src/main/java/org/springblade/modules/mountainrain/service/impl/MountainrainServiceImpl.java
@@ -458,28 +458,28 @@
}
@Override
- public List<Map<String, Object>> selctsmriver(String time,String dateEnd) {
- return baseMapper.selctsmriver(time, dateEnd);
+ public List<Map<String, Object>> selctsmriver(String time,String dateEnd,String begintime24) {
+ return baseMapper.selctsmriver(time, dateEnd,begintime24);
}
@Override
- public List<Map<String, Object>> selctbgriver(String time,String dateEnd) {
- return baseMapper.selctbgriver(time, dateEnd);
+ public List<Map<String, Object>> selctbgriver(String time,String dateEnd,String begintime24) {
+ return baseMapper.selctbgriver(time, dateEnd,begintime24);
}
@Override
- public List<MountainrainsCVO> MountainYi(String times, String dateEnd1, String code) {
- return baseMapper.MountainYi(times, dateEnd1, code);
+ public List<MountainrainsCVO> MountainYi(String times, String dateEnd1, String code,String stime) {
+ return baseMapper.MountainYi(times, dateEnd1, code,stime);
}
@Override
- public List<MountainrainsCVO> MountainTw(String times, String dateEnd2, String code) {
- return baseMapper.MountainTw(times, dateEnd2, code);
+ public List<MountainrainsCVO> MountainTw(String times, String dateEnd2, String code,String stime) {
+ return baseMapper.MountainTw(times, dateEnd2, code,stime);
}
@Override
- public List<MountainrainsCVO> MountainTr(String times, String dateEnd3, String code) {
- return baseMapper.MountainTr(times, dateEnd3, code);
+ public List<MountainrainsCVO> MountainTr(String times, String dateEnd3, String code,String stime) {
+ return baseMapper.MountainTr(times, dateEnd3, code,stime);
}
@Override
diff --git a/src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java b/src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java
index 1695556..330d99e 100644
--- a/src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java
+++ b/src/main/java/org/springblade/modules/regionWeight/controller/RegionWeightController.java
@@ -16,8 +16,6 @@
*/
package org.springblade.modules.regionWeight.controller;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import io.reactivex.Observable;
import io.swagger.annotations.*;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
@@ -747,6 +745,7 @@
/**
* 点降雨
+ *
* @param beginTime
* @param endTime
* @return
@@ -756,11 +755,10 @@
String substring = beginTime.substring(0, 10);
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);
+ if (t.substring(0, 1).equals("0")) {
+ r = beginTime.substring(12, 13);
+ } else {
+ r = beginTime.substring(11, 13);
}
//截取月日
String[] strs = substring.split("-");
@@ -771,11 +769,10 @@
String substrings = endTime.substring(0, 10);
String ts = endTime.substring(11, 13);
String rs;
- if(ts.substring(0,1).equals("0")){
- rs=beginTime.substring(12,13);
- }
- else {
- rs=beginTime.substring(11,13);
+ if (ts.substring(0, 1).equals("0")) {
+ rs = endTime.substring(12, 13);
+ } else {
+ rs = endTime.substring(11, 13);
}
//截取月日
String[] strss = substrings.split("-");
@@ -791,6 +788,7 @@
strArrays += "'" + split[i] + "',";
}
String code = strArrays.substring(0, strArrays.length() - 1);
+ long cx = System.currentTimeMillis();//获取当前系统时间(毫秒)
List<Map<String, Object>> maps = regionWeightService.ss(beginTime, endTime, code);
List<Map<String, Object>> lists = new ArrayList<>();
Map<String, Object> map = new HashMap<String, Object>();
@@ -876,107 +874,118 @@
}
map.put("text", a);
lists.add(map);
- String fileName = "";
- // 第一步,创建一个webbook,对应一个Excel文件
- HSSFWorkbook wb = new HSSFWorkbook();
- // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
- HSSFSheet sheet = wb.createSheet("雨量表");
- // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
- HSSFRow row = sheet.createRow((int) 0);
- // 第四步,创建单元格,并设置值表头 设置表头居中
- HSSFCellStyle style = wb.createCellStyle();
- //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
- HSSFCell cell = row.createCell((short) 0);
- cell.setCellValue("lon");
- cell = row.createCell((short) 1);
- cell.setCellValue("lat");
- cell = row.createCell((short) 2);
- cell.setCellValue("rain");
- for (int i = 0; i < maps.size(); i++) {
- String stcd = maps.get(i).get("STCD").toString();
- // 第四步,创建单元格,并设置值
- row = sheet.createRow((int) i + 1);
- HSSFCell celli = row.createCell((short) 0);
- row.createCell((short) 0).setCellValue(maps.get(i).get("LGTD").toString());
- row.createCell((short) 1).setCellValue(maps.get(i).get("LTTD").toString());
- row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
- if (stcd.equals("62455350")){
- row.createCell((short) 0).setCellValue("117.344876");
- row.createCell((short) 1).setCellValue("27.827067");
- row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
- }
- if (stcd.equals("62334845")){
- row.createCell((short) 0).setCellValue("115.625720");
- row.createCell((short) 1).setCellValue("27.152794");
- row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
- }
- if (stcd.equals("62433800")){
- row.createCell((short) 0).setCellValue("115.618546");
- row.createCell((short) 1).setCellValue("27.683604");
- row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
- }
- if (stcd.equals("62436760")){
- row.createCell((short) 0).setCellValue("116.060889");
- row.createCell((short) 1).setCellValue("28.216806");
- row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
- }
- if (stcd.equals("62437250")){
- row.createCell((short) 0).setCellValue("116.622783");
- row.createCell((short) 1).setCellValue("28.489384");
- row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
- }
- if (stcd.equals("62433700")){
- row.createCell((short) 0).setCellValue("115.558771");
- row.createCell((short) 1).setCellValue("27.518623");
- row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
- }
- if (stcd.equals("62425740")){
- row.createCell((short) 0).setCellValue("117.208587");
- row.createCell((short) 1).setCellValue("27.298647");
- row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
- }
- if (stcd.equals("62437235")){
- row.createCell((short) 0).setCellValue("116.780591");
- row.createCell((short) 1).setCellValue("28.391352");
- row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
- }
- if (stcd.equals("62437250")){
- row.createCell((short) 0).setCellValue("116.555834");
- row.createCell((short) 1).setCellValue("28.518077");
- row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
- }
- }
- // 第六步,将文件存到指定位置
- try {
- fileName = "D:/pptnd.xlsx";
- FileOutputStream fout = new FileOutputStream(fileName);
- wb.write(fout);
- fout.close();
- wb.close();
- } catch (Exception e) {
- 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\\fz.py", String.valueOf(url)};
- try {
- proc = Runtime.getRuntime().exec(args1);
- BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
- String line = null;
- while ((line = in.readLine()) != null) {
- //System.out.println(line);
- }
- in.close();
- proc.waitFor();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ long url = timestamp.getTime();
+ Map m = new HashMap();
+ m.put("url", url + ".png");
lists.add(m);
+ System.out.print("程序执行时间为1:");
+ System.out.println(System.currentTimeMillis() - cx + "毫秒");
+ long bx = System.currentTimeMillis();//获取当前系统时间(毫秒)
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ String fileName = "";
+ // 第一步,创建一个webbook,对应一个Excel文件
+ HSSFWorkbook wb = new HSSFWorkbook();
+ // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
+ HSSFSheet sheet = wb.createSheet("雨量表");
+ // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
+ HSSFRow row = sheet.createRow((int) 0);
+ // 第四步,创建单元格,并设置值表头 设置表头居中
+ HSSFCellStyle style = wb.createCellStyle();
+ //style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式
+ HSSFCell cell = row.createCell((short) 0);
+ cell.setCellValue("lon");
+ cell = row.createCell((short) 1);
+ cell.setCellValue("lat");
+ cell = row.createCell((short) 2);
+ cell.setCellValue("rain");
+ for (int i = 0; i < maps.size(); i++) {
+ String stcd = maps.get(i).get("STCD").toString();
+ // 第四步,创建单元格,并设置值
+ row = sheet.createRow((int) i + 1);
+ HSSFCell celli = row.createCell((short) 0);
+ row.createCell((short) 0).setCellValue(maps.get(i).get("LGTD").toString());
+ row.createCell((short) 1).setCellValue(maps.get(i).get("LTTD").toString());
+ row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+ if (stcd.equals("62455350")) {
+ row.createCell((short) 0).setCellValue("117.344876");
+ row.createCell((short) 1).setCellValue("27.827067");
+ row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+ }
+ if (stcd.equals("62334845")) {
+ row.createCell((short) 0).setCellValue("115.625720");
+ row.createCell((short) 1).setCellValue("27.152794");
+ row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+ }
+ if (stcd.equals("62433800")) {
+ row.createCell((short) 0).setCellValue("115.618546");
+ row.createCell((short) 1).setCellValue("27.683604");
+ row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+ }
+ if (stcd.equals("62436760")) {
+ row.createCell((short) 0).setCellValue("116.060889");
+ row.createCell((short) 1).setCellValue("28.216806");
+ row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+ }
+ if (stcd.equals("62437250")) {
+ row.createCell((short) 0).setCellValue("116.622783");
+ row.createCell((short) 1).setCellValue("28.489384");
+ row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+ }
+ if (stcd.equals("62433700")) {
+ row.createCell((short) 0).setCellValue("115.558771");
+ row.createCell((short) 1).setCellValue("27.518623");
+ row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+ }
+ if (stcd.equals("62425740")) {
+ row.createCell((short) 0).setCellValue("117.208587");
+ row.createCell((short) 1).setCellValue("27.298647");
+ row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+ }
+ if (stcd.equals("62437235")) {
+ row.createCell((short) 0).setCellValue("116.780591");
+ row.createCell((short) 1).setCellValue("28.391352");
+ row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+ }
+ if (stcd.equals("62437250")) {
+ row.createCell((short) 0).setCellValue("116.555834");
+ row.createCell((short) 1).setCellValue("28.518077");
+ row.createCell((short) 2).setCellValue(maps.get(i).get("dyp").toString());
+ }
+ }
+ // 第六步,将文件存到指定位置
+ try {
+ fileName = "D:/pptnd.xlsx";
+ FileOutputStream fout = new FileOutputStream(fileName);
+ wb.write(fout);
+ fout.close();
+ wb.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ Process proc;
+ String[] args1 = new String[]{"python", "D:\\fz\\fz.py", String.valueOf(url)};
+ try {
+ proc = Runtime.getRuntime().exec(args1);
+ BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ String line = null;
+ while ((line = in.readLine()) != null) {
+ //System.out.println(line);
+ }
+ in.close();
+ proc.waitFor();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
+ System.out.print("程序执行时间为2:");
+ System.out.println(System.currentTimeMillis() - bx + "毫秒");
return R.data(lists);
}
@@ -988,11 +997,10 @@
String substring = beginTime.substring(0, 10);
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);
+ if (t.substring(0, 1).equals("0")) {
+ r = beginTime.substring(12, 13);
+ } else {
+ r = beginTime.substring(11, 13);
}
//截取月日
String[] strs = substring.split("-");
@@ -1003,11 +1011,10 @@
String substrings = endTime.substring(0, 10);
String ts = endTime.substring(11, 13);
String rs;
- if(ts.substring(0,1).equals("0")){
- rs=beginTime.substring(12,13);
- }
- else {
- rs=beginTime.substring(11,13);
+ if (ts.substring(0, 1).equals("0")) {
+ rs = endTime.substring(12, 13);
+ } else {
+ rs = endTime.substring(11, 13);
}
//截取月日
String[] strss = substrings.split("-");
@@ -1024,8 +1031,14 @@
}
String code = strArrays.substring(0, strArrays.length() - 1);
//List<Map<String, Object>> map = regionWeightService.selectReM(beginTime, endTime);
+ long cx = System.currentTimeMillis();//获取当前系统时间(毫秒)
List<Map<String, Object>> map = regionWeightService.selectReMs(beginTime, endTime, code);
- List<Map<String, Object>> mapAll = regionWeightService.selectAll(beginTime, endTime,code);
+ System.out.print("程序执行时间为1:");
+ System.out.println(System.currentTimeMillis() - cx + "毫秒");
+ long b = System.currentTimeMillis();//获取当前系统时间(毫秒)
+ List<Map<String, Object>> mapAll = regionWeightService.selectAll(beginTime, endTime, code);
+ System.out.print("程序执行时间为2:");
+ System.out.println(System.currentTimeMillis() - b + "毫秒");
//权重值
List<Map<String, Object>> list = regionWeightService.selectWeight();
Map map1 = new HashMap();
@@ -1170,11 +1183,10 @@
String substring = beginTime.substring(0, 10);
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);
+ if (t.substring(0, 1).equals("0")) {
+ r = beginTime.substring(12, 13);
+ } else {
+ r = beginTime.substring(11, 13);
}
//截取月日
String[] strs = substring.split("-");
@@ -1185,11 +1197,10 @@
String substrings = endTime.substring(0, 10);
String ts = endTime.substring(11, 13);
String rs;
- if(t.substring(0,1).equals("0")){
- rs=beginTime.substring(12,13);
- }
- else {
- rs=beginTime.substring(11,13);
+ if (t.substring(0, 1).equals("0")) {
+ rs = endTime.substring(12, 13);
+ } else {
+ rs = endTime.substring(11, 13);
}
//截取月日
String[] strss = substrings.split("-");
@@ -1199,7 +1210,7 @@
String days = strss[2].toString();
String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时。";
String text = "";
- String ss = regionWeightService.selectCodeM();
+ String ss = regionWeightService.selectCodeL();
String[] split = ss.split(",");
String strArrays = "";
for (int i = 0; i < split.length; i++) {
@@ -1262,6 +1273,7 @@
List<Map<String, Object>> list = regionWeightService.selectWeights();
List<Map<String, Object>> list2 = regionWeightService.selectLALL();
List<Map<String, Object>> list3 = regionWeightService.selectLNam();
+ List<Map<String, Object>> list4 = regionWeightService.selectLy(beginTime, endTime, codel);
Map mc = new HashMap();
for (int a = 0; a < list2.size(); a++) {
for (int b = 0; b < list3.size(); b++) {
@@ -1387,12 +1399,112 @@
String a = "流域前三的为:" + text.substring(0, text.length() - 1) + "。";
mapc.put("List", listc);
mapc.put("Num", mc);
+ mapc.put("NumALL", list4);
mapc.put("text", yday + a);
lists.add(mapc);
}
return R.data(lists);
}
+ /**
+ * 时段降雨
+ */
+ @ApiLog("详情")
+ @PostMapping("/selectDayStation")
+ @ApiOperationSupport(order = 8)
+ @ApiOperation(value = "时段降雨", notes = "传入code,dateBegin,dateEnd")
+ public R selectDayStation(String code, String dateBegin, String dateEnd, String sd) {
+ return R.data(regionWeightService.selectDayStation(code, dateBegin, dateEnd, sd));
+ }
+
+ /**
+ * 逐日雨量
+ */
+ @ApiLog("详情")
+ @PostMapping("/selectStation")
+ @ApiOperationSupport(order = 7)
+ @ApiOperation(value = "逐日雨量", notes = "传入code,dateBegin,dateEnd")
+ public R selectStation(String code, String dateBegin, String dateEnd) {
+ return R.data(regionWeightService.selectStation(code, dateBegin, dateEnd));
+ }
+
+ /**
+ * 特征雨量
+ */
+ @ApiLog("详情")
+ @PostMapping("/selectPptnTz")
+ @ApiOperationSupport(order = 11)
+ @ApiOperation(value = "特征雨量", notes = "")
+ public R selectPptnTz(String code) {
+ List<Map<String, String>> lists = new ArrayList<>();
+ Map<String, String> map = new HashMap<>(16);
+ //当前时间
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
+ String time = df.format(new Date());
+
+ //查询前一小时数据
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - 1);
+ String dateEnd1 = df.format(calendar.getTime());
+ String map1 = regionWeightService.selectPptnTz(code, dateEnd1, time);
+ map.put("drp1", map1);
+
+ //查询前2小时数据
+ Calendar calendar2 = Calendar.getInstance();
+ calendar2.set(Calendar.HOUR_OF_DAY, calendar2.get(Calendar.HOUR_OF_DAY) - 2);
+ String dateEnd2 = df.format(calendar2.getTime());
+ String map2 = regionWeightService.selectPptnTz(code, dateEnd2, time);
+ map.put("drp2", map2);
+
+ //三个小时前的时间
+ Calendar calendar3 = Calendar.getInstance();
+ calendar3.set(Calendar.HOUR_OF_DAY, calendar3.get(Calendar.HOUR_OF_DAY) - 3);
+ String dateEnd3 = df.format(calendar3.getTime());
+ String map3 = regionWeightService.selectPptnTz(code, dateEnd3, time);
+ map.put("drp3", map3);
+
+ //六个小时前的时间
+ Calendar calendar6 = Calendar.getInstance();
+ calendar6.set(Calendar.HOUR_OF_DAY, calendar6.get(Calendar.HOUR_OF_DAY) - 6);
+ String dateEnd6 = df.format(calendar6.getTime());
+ String map6 = regionWeightService.selectPptnTz(code, dateEnd6, time);
+ map.put("drp6", map6);
+
+ //十二个小时前的时间
+ Calendar calendar12 = Calendar.getInstance();
+ calendar12.set(Calendar.HOUR_OF_DAY, calendar12.get(Calendar.HOUR_OF_DAY) - 12);
+ String dateEnd12 = df.format(calendar12.getTime());
+ String map12 = regionWeightService.selectPptnTz(code, dateEnd12, time);
+ map.put("drp12", map12);
+
+ //二十四个小时前的时间
+ Calendar calendar24 = Calendar.getInstance();
+ calendar24.set(Calendar.HOUR_OF_DAY, calendar24.get(Calendar.HOUR_OF_DAY) - 24);
+ String dateEnd24 = df.format(calendar24.getTime());
+ String map24 = regionWeightService.selectPptnTz(code, dateEnd24, time);
+ map.put("drp24", map24);
+
+ //四十八个小时前的时间
+ Calendar calendar48 = Calendar.getInstance();
+ calendar48.set(Calendar.HOUR_OF_DAY, calendar48.get(Calendar.HOUR_OF_DAY) - 48);
+ String dateEnd48 = df.format(calendar48.getTime());
+ String map48 = regionWeightService.selectPptnTz(code, dateEnd48, time);
+ map.put("drp48", map48);
+
+ //七十二个小时前的时间
+ Calendar calendar72 = Calendar.getInstance();
+ calendar72.set(Calendar.HOUR_OF_DAY, calendar72.get(Calendar.HOUR_OF_DAY) - 72);
+ String dateEnd72 = df.format(calendar72.getTime());
+ String map72 = regionWeightService.selectPptnTz(code, dateEnd72, time);
+ map.put("drp72", map72);
+
+ map.put("time", time);
+ lists.add(map);
+
+ return R.data(lists);
+ }
+
+
}
diff --git a/src/main/java/org/springblade/modules/regionWeight/entity/PptnR.java b/src/main/java/org/springblade/modules/regionWeight/entity/PptnR.java
new file mode 100644
index 0000000..5120e2a
--- /dev/null
+++ b/src/main/java/org/springblade/modules/regionWeight/entity/PptnR.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springblade.modules.regionWeight.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 实体类
+ *
+ * @author Blade
+ * @since 2019-11-07
+ */
+@Data
+@TableName("st_pptn_r")
+@ApiModel(value = "PptnR对象", description = "PptnR对象")
+public class PptnR {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableField("STCD")
+ private String stcd;
+ @TableField("TM")
+ private String tm;
+ @TableField("DRP")
+ private BigDecimal drp;
+ @TableField("INTV")
+ private BigDecimal intv;
+ @TableField("PDR")
+ private BigDecimal pdr;
+ @TableField("DYP")
+ private BigDecimal dyp;
+ @TableField("WTH")
+ private String wth;
+ @TableField("MDTM")
+ private String mdtm;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.java b/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.java
index 3f60979..6c19781 100644
--- a/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.java
+++ b/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.java
@@ -16,16 +16,12 @@
*/
package org.springblade.modules.regionWeight.mapper;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import liquibase.pro.packaged.S;
-import org.apache.ibatis.annotations.Param;
+import org.springblade.modules.regionWeight.entity.PptnR;
import org.springblade.modules.regionWeight.entity.RegionWeight;
import org.springblade.modules.regionWeight.excel.regionExcel;
import org.springblade.modules.regionWeight.vo.RegionWeightVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.springblade.modules.system.entity.User;
-import org.springblade.modules.system.excel.UserExcel;
import java.util.List;
import java.util.Map;
@@ -63,6 +59,7 @@
List<Map<String, Object>> selectYjs(String beginTime,String endTime);
List<Map<String, Object>> ss(String beginTime, String endTime, String code);
List<Map<String, Object>> selectAll(String beginTime, String endTime, String code);
+ List<Map<String, Object>> selectLy(String beginTime, String endTime, String code);
List<Map<String, Object>> selectLALL();
List<Map<String, Object>> selectLNam();
/**
@@ -74,4 +71,11 @@
String selectCode();
String selectCodeM();
String selectCodeL();
+ /**
+ * 时段降雨
+ */
+ List selectDayStation(String code, String dateBegin, String dateEnd, List<Map<String, Object>> list);
+ List selectDayStations(String code, String dateBegin, String dateEnd);
+ List selectStation(String code, String dateBegin, String dateEnd, List<Map<String, Object>> list);
+ String selectPptnTz(String code, String dateBegin, String dateEnd);
}
diff --git a/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.xml b/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.xml
index 2678883..8824b8f 100644
--- a/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.xml
+++ b/src/main/java/org/springblade/modules/regionWeight/mapper/RegionWeightMapper.xml
@@ -176,9 +176,9 @@
order by csd.dyp desc
</select>
<select id="selectAll" resultType="java.util.HashMap">
- SELECT r.STATION_CODE AS STCD,
- r.STATION_NAME AS STNM,
- r.REGION_NAME AS ADDVNM,
+ SELECT r.STATION_CODE AS STCD,
+ r.STATION_NAME AS STNM,
+ r.REGION_NAME AS ADDVNM,
s.STNM,
s.STLC,
s.LTTD,
@@ -187,18 +187,39 @@
FROM ZHSW_REGION_WEIGHT r
INNER JOIN ST_STBPRP_B s ON r.STATION_CODE = s.STCD
LEFT JOIN (
- SELECT
- STCD,
- SUM ( DRP ) AS DRP
- FROM
- ST_PPTN_R
- WHERE
- TM > #{beginTime}
- AND TM<= #{endTime} AND STCD IN (${code})
- GROUP BY
- STCD
- ) cs1 ON cs1.STCD= r.STATION_CODE
+ SELECT STCD,
+ SUM(DRP) AS DRP
+ FROM ST_PPTN_R
+ WHERE TM > #{beginTime}
+ AND TM <= #{endTime}
+ AND STCD IN (${code})
+ GROUP BY STCD
+ ) cs1 ON cs1.STCD = r.STATION_CODE
WHERE r.SPARE1 != 0
+ </select>
+ <select id="selectLy" resultType="java.util.HashMap">
+ SELECT r.STATION_CODE AS STCD,
+ r.STATION_NAME AS STNM,
+ z.STATION_NAME AS ADDVNM,
+ s.STLC,
+ s.LTTD,
+ s.LGTD,
+ isnull(cs1.DRP, 0) as DRP
+ FROM ZHSW_BASIN_STATION r
+ INNER JOIN ST_STBPRP_B s ON r.STATION_CODE = s.STCD
+ INNER JOIN (SELECT STATION_NAME, BASIN_CODE, STATION_CODE
+ FROM ZHSW_BASIN_STATION
+ WHERE BASIN_CODE = 00) z ON z.STATION_CODE = r.BASIN_CODE
+ LEFT JOIN (
+ SELECT STCD,
+ SUM(DRP) AS DRP
+ FROM ST_PPTN_R
+ WHERE TM > #{ beginTime }
+ AND TM <= #{ endTime }
+ AND STCD IN (${ code })
+ GROUP BY STCD
+ ) cs1 ON cs1.STCD = r.STATION_CODE
+ WHERE r.BASIN_CODE != 0
</select>
<select id="selectLALL" resultType="java.util.HashMap">
@@ -272,7 +293,7 @@
</select>
- <select id="selectCode" resultType="java.lang.String">
+ <select id="selectCode" resultType="java.lang.String">
SELECT stuff((
SELECT ',' + CONVERT(VARCHAR (25), STCD)
FROM dbo.ST_STBPRP_B st
@@ -339,14 +360,42 @@
ad.ADDVNM
FROM dbo.ST_STBPRP_B st
INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD
+ WHERE ADDVNM != '井冈山市' AND ADDVNM != '吉水县'
) c ON c.STCD = csd.STCD
- WHERE c.ADDVNM != '井冈山市'
- AND c.ADDVNM != '吉水县'
- ORDER BY
- csd.dyp DESC
+ ORDER BY csd.dyp DESC
</select>
<!--最新面降雨量-->
+ <!-- <select id="selectReMs" resultType="java.util.HashMap">-->
+ <!-- SELECT cs1.STCD,-->
+ <!-- isnull(cs1.DRP, 0) as DRP,-->
+ <!-- s.STATION_NAME,-->
+ <!-- s.REGION_NAME,-->
+ <!-- s.WEIGHT,-->
+ <!-- s.REGION_CODE,-->
+ <!-- st.LGTD,-->
+ <!-- st.LTTD,-->
+ <!-- st.STTP-->
+ <!-- FROM (SELECT STCD, SUM(DRP) AS DRP-->
+ <!-- FROM dbo.ST_PPTN_R-->
+ <!-- WHERE TM > #{beginTime}-->
+ <!-- AND TM <= #{endTime}-->
+ <!-- AND STCD IN (${code})-->
+ <!-- GROUP BY STCD) cs1-->
+ <!-- INNER JOIN (SELECT STATION_CODE, STATION_NAME, REGION_NAME, WEIGHT, REGION_CODE-->
+ <!-- FROM ZHSW_REGION_WEIGHT) s ON s.STATION_CODE = cs1.STCD-->
+ <!-- INNER JOIN (SELECT STCD, LGTD, LTTD, STTP, ADDVCD FROM dbo.ST_STBPRP_B) st ON st.STCD = cs1.STCD-->
+ <!-- INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD-->
+ <!-- GROUP BY cs1.STCD,-->
+ <!-- cs1.DRP,-->
+ <!-- s.STATION_NAME,-->
+ <!-- s.REGION_NAME,-->
+ <!-- s.WEIGHT,-->
+ <!-- s.REGION_CODE,-->
+ <!-- st.LGTD,-->
+ <!-- st.LTTD,-->
+ <!-- st.STTP-->
+ <!-- </select>-->
<select id="selectReMs" resultType="java.util.HashMap">
SELECT cs1.STCD,
isnull(cs1.DRP, 0) as DRP,
@@ -365,17 +414,7 @@
GROUP BY STCD) cs1
INNER JOIN (SELECT STATION_CODE, STATION_NAME, REGION_NAME, WEIGHT, REGION_CODE
FROM ZHSW_REGION_WEIGHT) s ON s.STATION_CODE = cs1.STCD
- INNER JOIN (SELECT STCD, LGTD, LTTD, STTP, ADDVCD FROM dbo.ST_STBPRP_B) st ON st.STCD = cs1.STCD
- INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD
- GROUP BY cs1.STCD,
- cs1.DRP,
- s.STATION_NAME,
- s.REGION_NAME,
- s.WEIGHT,
- s.REGION_CODE,
- st.LGTD,
- st.LTTD,
- st.STTP
+ left JOIN (SELECT STCD, LGTD, LTTD, STTP, ADDVCD FROM dbo.ST_STBPRP_B) st ON st.STCD = cs1.STCD
</select>
<!--流域-->
<select id="selectReL" resultType="java.util.HashMap">
@@ -383,7 +422,7 @@
isnull(cs1.DRP, 0) AS DRP,
s.STATION_NAME,
s.WEIGHT,
- s.BASIN_CODE as REGION_CODE,
+ s.BASIN_CODE as REGION_CODE,
st.LGTD,
st.LTTD,
st.STTP
@@ -409,5 +448,53 @@
st.LTTD,
st.STTP
</select>
+ <!--时段雨量-->
+ <select id="selectDayStation" resultType="java.util.Map">
+ <foreach collection="list" item="item" open="" close="" separator="union ALL" index="index">
+ select
+ STCD,
+ #{item.tm} AS "tm",
+ SUM (CASE WHEN TM > #{item.day} AND TM <=#{item.nextday} THEN DRP ELSE 0 END) AS "DRP"
+ from dbo.ST_PPTN_R
+ where STCD =#{code}
+ GROUP BY
+ STCD
+ </foreach>
+ </select>
+
+ <!--时段雨量-->
+ <select id="selectDayStations" resultType="java.util.Map">
+ select
+ STCD,TM AS "tm",DRP
+ from dbo.ST_PPTN_R where STCD =#{code}
+ <if test="dateBegin !=null and dateBegin!=''">
+ and TM > #{dateBegin}
+ </if>
+ <if test="dateEnd !=null and dateEnd!=''">
+ and TM <= #{dateEnd}
+ </if>
+ </select>
+
+ <!--逐日雨量-->
+ <select id="selectStation" resultType="java.util.Map">
+ <foreach collection="list" item="item" open="" close="" separator="union ALL" index="index">
+ select
+ STCD,
+ #{item.tm} AS "tm",
+ SUM (CASE WHEN TM > #{item.day} AND TM <= #{item.nextday} THEN DRP ELSE 0 END) AS "DRP"
+ from dbo.ST_PPTN_R
+ where STCD =#{code}
+ GROUP BY
+ STCD
+ </foreach>
+ </select>
+ <select id="selectPptnTz" resultType="java.lang.String">
+ SELECT SUM(str.DRP) as drp
+ FROM dbo.ST_PPTN_R str
+ WHERE str.STCD = #{code}
+ AND TM > #{dateBegin}
+ AND TM <= #{dateEnd}
+ </select>
+
</mapper>
diff --git a/src/main/java/org/springblade/modules/regionWeight/service/IRegionWeightService.java b/src/main/java/org/springblade/modules/regionWeight/service/IRegionWeightService.java
index 03f92da..ed52ffe 100644
--- a/src/main/java/org/springblade/modules/regionWeight/service/IRegionWeightService.java
+++ b/src/main/java/org/springblade/modules/regionWeight/service/IRegionWeightService.java
@@ -16,6 +16,7 @@
*/
package org.springblade.modules.regionWeight.service;
+import org.springblade.modules.regionWeight.entity.PptnR;
import org.springblade.modules.regionWeight.entity.RegionWeight;
import org.springblade.modules.regionWeight.excel.regionExcel;
import org.springblade.modules.regionWeight.vo.RegionWeightVO;
@@ -64,4 +65,10 @@
String selectCodeL();
List<Map<String, Object>> ss(String beginTime, String endTime, String code);
List<Map<String, Object>> selectReMs(String beginTime,String endTime,String code);
+ //时段降雨
+ List<PptnR> selectDayStation(String code, String dateBegin, String dateEnd, String sd);
+ //逐日雨量
+ List<PptnR> selectStation(String code, String dateBegin, String dateEnd);
+ String selectPptnTz(String code, String dateBegin, String dateEnd);
+ List<Map<String, Object>> selectLy(String beginTime, String endTime, String code);
}
diff --git a/src/main/java/org/springblade/modules/regionWeight/service/impl/RegionWeightServiceImpl.java b/src/main/java/org/springblade/modules/regionWeight/service/impl/RegionWeightServiceImpl.java
index f85079e..a6bcbda 100644
--- a/src/main/java/org/springblade/modules/regionWeight/service/impl/RegionWeightServiceImpl.java
+++ b/src/main/java/org/springblade/modules/regionWeight/service/impl/RegionWeightServiceImpl.java
@@ -18,6 +18,7 @@
import com.baomidou.dynamic.datasource.annotation.DS;
import org.springblade.core.tool.node.ForestNodeMerger;
+import org.springblade.modules.regionWeight.entity.PptnR;
import org.springblade.modules.regionWeight.entity.RegionWeight;
import org.springblade.modules.regionWeight.excel.regionExcel;
import org.springblade.modules.regionWeight.vo.RegionWeightVO;
@@ -27,8 +28,9 @@
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import java.util.List;
-import java.util.Map;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
/**
* 服务实现类
@@ -128,4 +130,79 @@
public List<Map<String, Object>> selectReMs(String beginTime, String endTime, String code) {
return baseMapper.selectReMs(beginTime, endTime, code);
}
+
+ @Override
+ public List<PptnR> selectDayStation(String code, String dateBegin, String dateEnd, String sd) {
+ List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+ List<PptnR> returnD = null;
+ if (!sd.equals("1")){
+ try {
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ long to = 0;
+ to = df.parse(dateEnd).getTime();
+ long from = df.parse(dateBegin).getTime();
+ int sds = Integer.parseInt(sd);
+ long jg = (long) Math.ceil((to - from) / (1000 * 60 * 60)/sds) + 1;
+
+ for (int i = 0; i < jg; i++) {
+ Map<String, Object> map = new HashMap<String, Object>();
+ long q = from + (long)(60*60*1000)*(i*sds);
+ String qzsj = df.format(new Date(q)); // 时间戳转换成时间
+ long z = from + (long)(60*60*1000)*((i+1)*sds);
+ String zzsj = df.format(new Date(z)); // 时间戳转换成时间
+ map.put("day", qzsj);
+ map.put("nextday", zzsj);
+ map.put("tm",df.format(new Date(z)));
+ list.add(map);
+ }
+
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ returnD = baseMapper.selectDayStation(code, dateBegin, dateEnd, list);
+ }else{
+ returnD = baseMapper.selectDayStations(code, dateBegin, dateEnd);
+ }
+ return returnD;
+ }
+
+ @Override
+ public List<PptnR> selectStation(String code, String dateBegin, String dateEnd) {
+ List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+ try {
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+ long to = 0;
+ to = df.parse(dateEnd).getTime();
+ long from = df.parse(dateBegin).getTime();
+ long jg = (to - from) / (1000 * 60 * 60 * 24) + 1;
+
+ for (int i = 0; i < jg; i++) {
+ Map<String, Object> map = new HashMap<String, Object>();
+ long q = from + (long)(60*60*24*1000)*i;
+ String qzsj = df.format(new Date(q)); // 时间戳转换成时间
+ long z = from + (long)(60*60*24*1000)*(i+1);
+ String zzsj = df.format(new Date(z)); // 时间戳转换成时间
+ map.put("day", qzsj);
+ map.put("nextday", zzsj);
+ map.put("tm",df.format(new Date(q)));
+ list.add(map);
+ }
+
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return baseMapper.selectStation(code,dateBegin,dateEnd,list);
+ }
+
+ @Override
+ public String selectPptnTz(String code, String dateBegin, String dateEnd) {
+ return baseMapper.selectPptnTz(code, dateBegin, dateEnd);
+ }
+
+ @Override
+ public List<Map<String, Object>> selectLy(String beginTime, String endTime, String code) {
+ return baseMapper.selectLy(beginTime, endTime, code);
+ }
+
+
}
diff --git a/src/main/java/org/springblade/modules/river/controller/RiverRController.java b/src/main/java/org/springblade/modules/river/controller/RiverRController.java
index 058efb4..dc064fe 100644
--- a/src/main/java/org/springblade/modules/river/controller/RiverRController.java
+++ b/src/main/java/org/springblade/modules/river/controller/RiverRController.java
@@ -19,7 +19,6 @@
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import liquibase.pro.packaged.S;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
@@ -32,15 +31,12 @@
import org.springblade.modules.river.wrapper.RiverRWrapper;
import org.springframework.web.bind.annotation.*;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
-import java.util.stream.Collectors;
/**
@@ -311,7 +307,12 @@
String hss = time.substring(11, 13);
int hs = Integer.parseInt(hss);
//前一天的8时
- String timec = years + "-" + months + "-" + da + " 08:00:00";
+ //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);
@@ -333,7 +334,7 @@
//定义List保存未警戒信息
List blist = new ArrayList();
//河道超警信息
- List<Map<String, Object>> selecthd = riverRService.selecthdt(dateBegin24, time);
+ List<Map<String, Object>> selecthd = riverRService.selecthdt(dateBegin24, time, timec);
//Map<String, Object> sel = riverRService.sel();
//selecthd.add(sel);
List<Map<String, Object>> list1 = riverRService.selectP();
@@ -399,7 +400,10 @@
texta += "流量暂无数据;";
} else {
//DecimalFormat dfl = new DecimalFormat("#0.000");
- texta += "流量" + Q + "立方米每秒;";
+ double v5 = roundToSignificantFigures(Q, 3);
+ String a = String.valueOf(v5);
+ String s1 = subZeroAndDot(a);
+ texta += "流量" + s1 + "立方米每秒;";
}
}
blist.add(selecthd.get(i));
@@ -437,8 +441,10 @@
} else {
//DecimalFormat dfl = new DecimalFormat("#0.000");
//texta += "流量" + Q + "立方米每秒;";
- String vc = formatSignificantDigit(Q);
- texta += "流量" + vc + "立方米每秒;";
+ double v5 = roundToSignificantFigures(Q, 3);
+ String a = String.valueOf(v5);
+ String s1 = subZeroAndDot(a);
+ texta += "流量" + s1 + "立方米每秒;";
}
}
}
@@ -548,6 +554,224 @@
}
+ 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 = riverRService.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);
+// }
+
+// /**
+// * 河道自定义时间查询
+// *
+// * @param beginTime
+// * @param endTime
+// * @return
+// * @throws ParseException
+// */
+// @PostMapping("/selecthd")
+// public R selecthd(String beginTime, String endTime) throws ParseException {
+// String substring = beginTime.substring(0, 10);
+// String substrings = endTime.substring(0, 10);
+// String t = beginTime.substring(11, 13);
+// String hs;
+// if (t.substring(0, 1).equals("0")) {
+// hs = beginTime.substring(12, 13);
+// } else {
+// hs = beginTime.substring(11, 13);
+// }
+// String ts = endTime.substring(11, 13);
+// String hss;
+// if (ts.substring(0, 1).equals("0")) {
+// hss = beginTime.substring(12, 13);
+// } else {
+// hss = beginTime.substring(11, 13);
+// }
+// //截取月日
+// String[] strs = substring.split("-");
+// //月
+// String year = strs[1].toString();
+// //日
+// String day = strs[2].toString();
+// //截取月日
+// String[] strss = substrings.split("-");
+// //月
+// String years = strss[1].toString();
+// //日
+// String days = strss[2].toString();
+// //定义短信内容头
+// String text = year + "月" + day + "日" + hs + "时" + "-" + years + "月" + days + "日" + hss + "时";
+// String texta = "";
+// //定义统计数量
+// int number = 0;
+// //河道超警信息
+// List<Map<String, Object>> selecthd = riverRService.selecthdcs(beginTime, endTime);
+// //Map<String, Object> sel = riverRService.sel();
+// //selecthd.add(sel);
+// //基本站信息
+// List<Map<String, Object>> list1 = riverRService.selectP();
+// //用来判断是否重复统计超警信息
+// Map mnum = new HashMap();
+// Map mnums = new HashMap();
+// //定义list保存预警信息
+// List ylist = new ArrayList();
+// //定义list保存未预警信息
+// List alist = new ArrayList();
+// Map m1 = new HashMap();
+// Map m2 = new HashMap();
+// Map czf = new HashMap();
+// Map m = new HashMap();
+// List list = new ArrayList();
+// //查询数据为空
+// if (selecthd.size() == 0) {
+// text += "暂无河道超警信息。廖家湾水位暂无数据,流量暂无数据;娄家村水位暂无数据,流量暂无数据;";
+// }
+// //不为空遍历数据计算是否超出预警值
+// else {
+// int c = 0;
+// for (int i = 0; i < selecthd.size(); i++) {
+// //实时河道水位值
+// BigDecimal z = (BigDecimal) selecthd.get(i).get("Z");
+// double Z = z.doubleValue();
+// String stcd = selecthd.get(i).get("STCD").toString();
+// //站点名称
+// String stnms = selecthd.get(i).get("STNM").toString();
+// //最大值
+// BigDecimal maxZ = (BigDecimal) selecthd.get(i).get("maxZ");
+// //最小值
+// BigDecimal minZ = (BigDecimal) selecthd.get(i).get("minZ");
+// double v = maxZ.doubleValue();
+// double v1 = minZ.doubleValue();
+// //涨幅值
+// double v2 = v - v1;
+// double v4 = (double) Math.round(v2 * 100) / 100;
+// m1.put(v4, stnms.replaceAll(" ", "") + "站");
+// czf.put(stcd, v4);
+// //超警戒水位值
+// if (mnum.containsKey(selecthd.get(i).get("STCD").toString()) == true) {
+// } else {
+// if (selecthd.get(i).get("WRZ") == null || selecthd.get(i).get("Q") == null) {
+// String stnm = selecthd.get(i).get("STNM").toString();
+// mnum.put(selecthd.get(i).get("STCD").toString(), i);
+// if (stnm.equals("廖家湾") || stnm.equals("娄家村")) {
+// DecimalFormat df = new DecimalFormat("#0.00");
+// texta += stnm.replaceAll(" ", "") + "水位" + df.format(Z) + "米,";
+// if (selecthd.get(i).get("Q") == null) {
+// texta += "流量暂无数据";
+// }
+// }
+// alist.add(selecthd.get(i));
+// continue;
+// }
+// BigDecimal wrz = (BigDecimal) selecthd.get(i).get("WRZ");
+// double WRZ = wrz.doubleValue();
+// BigDecimal q = (BigDecimal) selecthd.get(i).get("Q");
+// double Q = q.doubleValue();
+// if (Z <= WRZ) {
+// if (mnum.containsKey(selecthd.get(i).get("STCD").toString()) == true) {
+// } else {
+// String stnm = selecthd.get(i).get("STNM").toString();
+// mnum.put(selecthd.get(i).get("STCD").toString(), i);
+// if (stnm.equals("廖家湾") || stnm.equals("娄家村")) {
+// DecimalFormat df = new DecimalFormat("#0.00");
+// texta += stnm.replaceAll(" ", "") + "水位" + df.format(Z) + "米,";
+// if (selecthd.get(i).get("Q") == null) {
+// texta += "流量暂无数据";
+// } else {
+// double v5 = roundToSignificantFigures(Q, 3);
+// String a = String.valueOf(v5);
+// String s1 = subZeroAndDot(a);
+// texta += "流量" + s1 + "立方米每秒;";
+// }
+// }
+// }
+// alist.add(selecthd.get(i));
+// } else {
+// //如果map集合保存了站点则不重复统计数量
+// if (mnum.containsKey(selecthd.get(i).get("STCD").toString()) == true) {
+// } else {
+// ylist.add(selecthd.get(i));
+// mnum.put(selecthd.get(i).get("STCD").toString(), i);
+// number++;
+// //超出警戒水位多少
+// Double num = Z - WRZ;
+// double v3 = (double) Math.round(num * 100) / 100;
+// //县,市
+// String addvcd5 = selecthd.get(i).get("ADDVNM").toString();
+// //站点名称
+// String stnm = selecthd.get(i).get("STNM").toString();
+// if (stnm.equals("廖家湾") || stnm.equals("娄家村")) {
+// DecimalFormat df = new DecimalFormat("#0.00");
+// texta += stnm.replaceAll(" ", "") + "站超出警戒水位" + df.format(v3) + "米," + "水位" + df.format(Z) + "米,";
+// if (selecthd.get(i).get("Q") == null) {
+// texta += "流量暂无数据;";
+// } else {
+// //DecimalFormat dfs = new DecimalFormat("#0.000");
+// double v5 = roundToSignificantFigures(Q, 3);
+// String a = String.valueOf(v5);
+// String s1 = subZeroAndDot(a);
+// texta += "流量" + s1 + "立方米每秒;";
+// }
+// }
+// }
+// }
+// }
+//
+// }
+// }
+// if (number == 0) {
+// text += "暂无河道超警戒信息。" + texta;
+// } else {
+// text += "有" + number + "个河道站超警戒。" + texta;
+// }
+// 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);
+// m.put("list", alist);
+// m.put("list1", list1);
+// m.put("clist", czf);
+// list.add(m);
+// return R.data(list);
+//
+// }
/**
* 河道自定义时间查询
@@ -561,8 +785,20 @@
public R selecthd(String beginTime, String endTime) throws ParseException {
String substring = beginTime.substring(0, 10);
String substrings = endTime.substring(0, 10);
- String hs = beginTime.substring(11, 13);
- String hss = endTime.substring(11, 13);
+ String t = beginTime.substring(11, 13);
+ String hs;
+ if (t.substring(0, 1).equals("0")) {
+ hs = beginTime.substring(12, 13);
+ } else {
+ hs = beginTime.substring(11, 13);
+ }
+ String ts = endTime.substring(11, 13);
+ String hss;
+ if (ts.substring(0, 1).equals("0")) {
+ hss = beginTime.substring(12, 13);
+ } else {
+ hss = beginTime.substring(11, 13);
+ }
//截取月日
String[] strs = substring.split("-");
//月
@@ -580,10 +816,22 @@
String texta = "";
//定义统计数量
int number = 0;
+ String s = riverRService.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>> selecthd = riverRService.selecthdcs(beginTime, endTime);
- //Map<String, Object> sel = riverRService.sel();
- //selecthd.add(sel);
+ List<Map<String, Object>> selecthd = riverRService.selecthdcss(beginTime, endTime,code);
+ Collections.sort(selecthd, new Comparator<Map<String, Object>>() {
+ public int compare(Map<String, Object> o1, Map<String, Object> o2) {
+ Double name1 = Double.valueOf(o1.get("Z").toString()) ;//name1是从你list里面拿出来的一个
+ Double name2 = Double.valueOf(o2.get("Z").toString()) ; //name1是从你list里面拿出来的第二个name
+ return name2.compareTo(name1);
+ }
+ });
//基本站信息
List<Map<String, Object>> list1 = riverRService.selectP();
//用来判断是否重复统计超警信息
@@ -654,8 +902,10 @@
if (selecthd.get(i).get("Q") == null) {
texta += "流量暂无数据";
} else {
- String vc = formatSignificantDigit(Q);
- texta += "流量" + vc + "立方米每秒;";
+ double v5 = roundToSignificantFigures(Q, 3);
+ String a = String.valueOf(v5);
+ String s1 = subZeroAndDot(a);
+ texta += "流量" + s1 + "立方米每秒;";
}
}
}
@@ -681,8 +931,10 @@
texta += "流量暂无数据;";
} else {
//DecimalFormat dfs = new DecimalFormat("#0.000");
- String vc = formatSignificantDigit(Q);
- texta += "流量" + vc + "立方米每秒;";
+ double v5 = roundToSignificantFigures(Q, 3);
+ String a = String.valueOf(v5);
+ String s1 = subZeroAndDot(a);
+ texta += "流量" + s1 + "立方米每秒;";
}
}
}
@@ -711,39 +963,27 @@
return R.data(list);
}
- public static int magnitude(Double price){
- if (price == 0.0) {return 0;}
- int fac;
- Long i;
- Long k = 10L;
- if (price > 1) {
- i = price.longValue();
- fac = 0;
- while (i / k != 0L) {
- fac++;
- k *= 10;
- }
- } else {
- fac = -1;
- while (price * k < 1) {
- fac--;
- k *= 10;
- }
- }
- return fac;
- }
- /**
- * 数字格式化 - 最少保留{num}位有效数字 - 保留 {min}~{max} 为小数 - format02
- */
- public static String formatSignificantDigit(Double price) {
- int min = 2;
- int max= 8;
- int num = 3;
- boolean sign = false;
- Double rate = 1.0;
- Double value = price * rate;
- int level = magnitude(Math.abs(value));
- int count = Math.max(min, Math.min(max, num - level - 1));
- return String.format("%"+(sign?"+": "")+"."+count + "f", value);
- }
+
+
+
+
+// @PostMapping("/ss")
+// public R ss(String beginTime, String endTime) {
+// String s = riverRService.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>> list = riverRService.selecthdcss(beginTime, endTime, code);
+// Collections.sort(list, new Comparator<Map<String, Object>>() {
+// public int compare(Map<String, Object> o1, Map<String, Object> o2) {
+// Double name1 = Double.valueOf(o1.get("Z").toString()) ;//name1是从你list里面拿出来的一个
+// Double name2 = Double.valueOf(o2.get("Z").toString()) ; //name1是从你list里面拿出来的第二个name
+// return name2.compareTo(name1);
+// }
+// });
+// return R.data(list);
+// }
}
diff --git a/src/main/java/org/springblade/modules/river/mapper/RiverRMapper.java b/src/main/java/org/springblade/modules/river/mapper/RiverRMapper.java
index 78e72b0..e6fa99c 100644
--- a/src/main/java/org/springblade/modules/river/mapper/RiverRMapper.java
+++ b/src/main/java/org/springblade/modules/river/mapper/RiverRMapper.java
@@ -31,12 +31,14 @@
//河道超警信息(通过结束时间查询)
List<Map<String, Object>> selecthd(String beginTime,String endTime);
List<Map<String, Object>> selecthdcs(String beginTime,String endTime);
+ List<Map<String, Object>> selecthdcss(String beginTime,String endTime,String code);
//河道最新超警信息
- List<Map<String, Object>> selecthdt(String dateBegin24,String time);
+ List<Map<String, Object>> selecthdt(String dateBegin24,String time,String timec);
Map<String, Object> sel();
//河道涨幅,跌幅信息
List<Map<String, Object>> selecthds(String beginTime,String endTime);
List<Map<String, Object>> selectP();
Map<String, Object> selectZ(String stcd,String ti);
List<Map<String, Object>> selecthdyj(String times,String dateEnd);
+ String selectCode();
}
diff --git a/src/main/java/org/springblade/modules/river/mapper/RiverRMapper.xml b/src/main/java/org/springblade/modules/river/mapper/RiverRMapper.xml
index c128e8c..992f204 100644
--- a/src/main/java/org/springblade/modules/river/mapper/RiverRMapper.xml
+++ b/src/main/java/org/springblade/modules/river/mapper/RiverRMapper.xml
@@ -149,7 +149,34 @@
cs1.Q,
rv.WRZ,
cs3.maxZ,
- cs4.minZ ORDER BY cs1.Z desc
+ cs4.minZ
+ ORDER BY cs1.Z desc
+ </select>
+ <select id="selecthdcss" resultType="java.util.HashMap">
+ SELECT
+ A.STCD,
+ A.TM,
+ A.Z,
+ A.Q,
+ cs2.STNM,
+ cs2.LGTD,
+ cs2.LTTD,
+ ad.ADDVNM,
+ rv.WRZ,
+ cs3.maxZ,
+ cs4.minZ
+ FROM
+ dbo.ST_RIVER_R A
+ LEFT JOIN ( SELECT STCD, WRZ FROM dbo.ST_RVFCCH_B ) rv ON rv.STCD = A.STCD
+ LEFT JOIN ( SELECT STCD, STNM, LTTD, LGTD, ADDVCD, STTP FROM dbo.ST_STBPRP_B WHERE STTP = 'ZZ' OR STTP = 'ZQ')
+ cs2 ON cs2.STCD = A.STCD
+ LEFT JOIN ( SELECT ADDVCD, ADDVNM FROM dbo.ST_ADDVCD_D ) ad ON ad.ADDVCD = cs2.ADDVCD
+ LEFT JOIN ( SELECT STCD, MAX ( Z ) AS maxZ FROM dbo.ST_RIVER_R WHERE TM >#{beginTime}
+ AND TM <= #{endTime} GROUP BY STCD ) cs3 ON cs3.STCD = A.STCD
+ LEFT JOIN ( SELECT STCD, MIN ( Z ) AS minZ FROM dbo.ST_RIVER_R WHERE TM >#{beginTime}
+ AND TM <= #{endTime} GROUP BY STCD ) cs4 ON cs4.STCD = A.STCD
+ WHERE A.TM > #{beginTime}
+ AND A.TM <= #{endTime} AND A.STCD in(${code})
</select>
<!--河道最新超警信息-->
@@ -189,7 +216,7 @@
or STTP = 'ZQ') cs2 ON cs.STCD = cs2.STCD
LEFT JOIN (SELECT STCD, WRZ FROM dbo.ST_RVFCCH_B) rv ON rv.STCD = cs.STCD
INNER JOIN (SELECT ADDVCD, ADDVNM FROM dbo.ST_ADDVCD_D) ad ON ad.ADDVCD = cs.ADDVCD
- INNER JOIN ( SELECT Z,STCD FROM ST_RIVER_R WHERE TM = '2021-09-11 08:00:00' ) z ON z.STCD= cs.STCD
+ INNER JOIN (SELECT Z, STCD FROM ST_RIVER_R WHERE TM = #{timec}) z ON z.STCD = cs.STCD
GROUP BY cs.STCD,
cs.TM,
cs1.Z,
@@ -341,4 +368,17 @@
INNER JOIN (SELECT ADDVCD, ADDVNM FROM dbo.ST_ADDVCD_D) ad ON ad.ADDVCD = cs.ADDVCD
LEFT JOIN (SELECT stcd, fy, oy, ty, toy FROM swz_chazhi WHERE ty IS NOT NULL) cs4 ON cs.STCD = cs4.stcd
</select>
+
+
+ <select id="selectCode" resultType="java.lang.String">
+ SELECT stuff((
+ SELECT ',' + CONVERT(VARCHAR (25), STCD)
+ FROM dbo.ST_STBPRP_B st
+ WHERE st.STTP = 'ZQ'
+ OR st.STTP = 'ZZ' FOR XML PATH ('')),
+ 1,
+ 1,
+ ''
+ ) AS siteids
+ </select>
</mapper>
diff --git a/src/main/java/org/springblade/modules/river/service/IRiverRService.java b/src/main/java/org/springblade/modules/river/service/IRiverRService.java
index db3bda1..ec34623 100644
--- a/src/main/java/org/springblade/modules/river/service/IRiverRService.java
+++ b/src/main/java/org/springblade/modules/river/service/IRiverRService.java
@@ -31,12 +31,14 @@
//河道超警信息(通过结束时间查询)
List<Map<String, Object>> selecthd(String beginTime,String endTime);
List<Map<String, Object>> selecthdcs(String beginTime,String endTime);
+ List<Map<String, Object>> selecthdcss(String beginTime,String endTime,String code);
//河道最新超警信息
- List<Map<String, Object>> selecthdt(String dateBegin24,String time);
+ List<Map<String, Object>> selecthdt(String dateBegin24,String time,String timec);
//河道涨幅,跌幅信息
List<Map<String, Object>> selecthds(String beginTime,String endTime);
Map<String, Object> selectZ(String stcd,String ti);
List<Map<String, Object>> selectP();
List<Map<String, Object>> selecthdyj(String times,String dateEnd);
Map<String, Object> sel();
+ String selectCode();
}
diff --git a/src/main/java/org/springblade/modules/river/service/impl/RiverRServiceImpl.java b/src/main/java/org/springblade/modules/river/service/impl/RiverRServiceImpl.java
index 32de2f4..bc16fde 100644
--- a/src/main/java/org/springblade/modules/river/service/impl/RiverRServiceImpl.java
+++ b/src/main/java/org/springblade/modules/river/service/impl/RiverRServiceImpl.java
@@ -45,8 +45,13 @@
}
@Override
- public List<Map<String, Object>> selecthdt(String dateBegin24,String time) {
- return baseMapper.selecthdt(dateBegin24, time);
+ public List<Map<String, Object>> selecthdcss(String beginTime, String endTime, String code) {
+ return baseMapper.selecthdcss(beginTime, endTime, code);
+ }
+
+ @Override
+ public List<Map<String, Object>> selecthdt(String dateBegin24,String time,String timec) {
+ return baseMapper.selecthdt(dateBegin24, time,timec);
}
@Override
@@ -73,4 +78,9 @@
public Map<String, Object> sel() {
return baseMapper.sel();
}
+
+ @Override
+ public String selectCode() {
+ return baseMapper.selectCode();
+ }
}
diff --git a/src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java b/src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java
index 6c4a99d..ffe42b5 100644
--- a/src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java
+++ b/src/main/java/org/springblade/modules/rsvr/controller/RsvrRController.java
@@ -121,7 +121,13 @@
@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("-");
//月
@@ -129,7 +135,13 @@
//日
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("-");
//月
@@ -146,6 +158,7 @@
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");
@@ -172,26 +185,39 @@
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) {
@@ -204,11 +230,36 @@
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();
@@ -227,25 +278,28 @@
} else {
BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
double INQ = inq.doubleValue();
- //DecimalFormat df = new DecimalFormat("#0.000");
- String vc = formatSignificantDigit(INQ);
- texta += "入库流量" + vc + "立方米每秒、";
+ 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");
- String vc = formatSignificantDigit(OTQ);
- texta += "出库流量" + vc + "立方米每秒;";
+ double v3 = roundToSignificantFigures(OTQ, 3);
+ String a = String.valueOf(v3);
+ String s1 = subZeroAndDot(a);
+ texta += "出库流量" + s1 + "立方米每秒;";
}
}
if (stnm.equals("廖坊")) {
@@ -261,25 +315,28 @@
} else {
BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
double INQ = inq.doubleValue();
- //DecimalFormat df = new DecimalFormat("#0.000");
- String vc = formatSignificantDigit(INQ);
- texth += "入库流量" + vc + "立方米每秒、";
+ 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");
- String vc = formatSignificantDigit(OTQ);
- texth += "出库流量" + vc + "立方米每秒。";
+ double v3 = roundToSignificantFigures(OTQ, 3);
+ String a = String.valueOf(v3);
+ String s1 = subZeroAndDot(a);
+ texth += "出库流量" + s1 + "立方米每秒。";
}
}
alist.add(map.get(i));
@@ -298,25 +355,28 @@
} else {
BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
double INQ = inq.doubleValue();
- //DecimalFormat df = new DecimalFormat("#0.000");
- String vc = formatSignificantDigit(INQ);
- texta += "入库流量" + vc + "立方米每秒、";
+ 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");
- String vc = formatSignificantDigit(OTQ);
- texta += "出库流量" + vc + "立方米每秒;";
+ double v3 = roundToSignificantFigures(OTQ, 3);
+ String a = String.valueOf(v3);
+ String s1 = subZeroAndDot(a);
+ texta += "出库流量" + s1 + "立方米每秒;";
}
}
if (stnm.equals("廖坊")) {
@@ -326,25 +386,28 @@
} else {
BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
double INQ = inq.doubleValue();
- //DecimalFormat df = new DecimalFormat("#0.000");
- String vc = formatSignificantDigit(INQ);
- texth += "入库流量" + vc + "立方米每秒、";
+ 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");
- String vc = formatSignificantDigit(OTQ);
- texth += "出库流量" + vc + "立方米每秒。";
+ double v3 = roundToSignificantFigures(OTQ, 3);
+ String a = String.valueOf(v3);
+ String s1 = subZeroAndDot(a);
+ texth += "出库流量" + s1 + "立方米每秒。";
}
}
alist.add(map.get(i));
@@ -352,6 +415,7 @@
//如果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++;
@@ -369,25 +433,28 @@
} else {
BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
double INQ = inq.doubleValue();
- //DecimalFormat df = new DecimalFormat("#0.000");
- String vc = formatSignificantDigit(INQ);
- texta += "入库流量" + vc + "立方米每秒、";
+ 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");
- String vc = formatSignificantDigit(OTQ);
- texta += "出库流量" + vc + "立方米每秒;";
+ double v5 = roundToSignificantFigures(OTQ, 3);
+ String a = String.valueOf(v5);
+ String s1 = subZeroAndDot(a);
+ texta += "出库流量" + s1 + "立方米每秒;";
}
}
if (stnm.equals("廖坊")) {
@@ -397,25 +464,28 @@
} else {
BigDecimal inq = (BigDecimal) map.get(i).get("INQ");
double INQ = inq.doubleValue();
- //DecimalFormat df = new DecimalFormat("#0.000");
- String vc = formatSignificantDigit(INQ);
- texth += "入库流量" + vc + "立方米每秒、";
+ 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");
- String vc = formatSignificantDigit(OTQ);
- texth += "出库流量" + vc + "立方米每秒。";
+ double v5 = roundToSignificantFigures(OTQ, 3);
+ String a = String.valueOf(v5);
+ String s1 = subZeroAndDot(a);
+ texth += "出库流量" + s1 + "立方米每秒。";
}
}
}
@@ -423,6 +493,8 @@
}
}
+ DecimalFormat df = new DecimalFormat("#0.00");
+ text += "全市蓄水量" + df.format(count) + "百万立方米。";
if (number == 0) {
text += texta + texth;
} else {
@@ -430,7 +502,7 @@
}
// //水库涨幅,跌幅信息
//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++) {
@@ -462,12 +534,15 @@
// 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);
@@ -478,377 +553,430 @@
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();
- String vc = formatSignificantDigit(INQ);
- texta += "入库流量" + vc + "立方米每秒、";
- }
- 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();
- String vc = formatSignificantDigit(OTQ);
- texta += "出库流量" + vc + "立方米每秒;";
- }
-// 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();
- String vc = formatSignificantDigit(INQ);
- texth += "入库流量" + vc + "立方米每秒、";
- }
- 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();
- String vc = formatSignificantDigit(OTQ);
- texth += "出库流量" + vc + "立方米每秒。";
- }
- }
- 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();
- String vc = formatSignificantDigit(INQ);
- texta += "入库流量" + vc + "立方米每秒、";
- }
- 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();
- String vc = formatSignificantDigit(OTQ);
- texta += "出库流量" + vc + "立方米每秒;";
- }
-// 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();
- String vc = formatSignificantDigit(INQ);
- texth += "入库流量" + vc + "立方米每秒、";
- }
- 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();
- String vc = formatSignificantDigit(OTQ);
- texth += "出库流量" + vc + "立方米每秒。";
- }
- }
- 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();
- String vc = formatSignificantDigit(INQ);
- texta += "入库流量" + vc + "立方米每秒、";
- }
- 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();
- String vc = formatSignificantDigit(OTQ);
- texta += "出库流量" + vc + "立方米每秒;";
- }
-// 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();
- String vc = formatSignificantDigit(INQ);
- texth += "入库流量" + vc + "立方米每秒、";
- }
- 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();
- String vc = formatSignificantDigit(OTQ);
- texth += "出库流量" + vc + "立方米每秒。";
- }
- }
- }
- }
- }
- 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);
+// }
/**
* 水库详情
@@ -1044,41 +1172,486 @@
return R.data(lists);
}
- public static int magnitude(Double price){
- if (price == 0.0) {return 0;}
- int fac;
- Long i;
- Long k = 10L;
- if (price > 1) {
- i = price.longValue();
- fac = 0;
- while (i / k != 0L) {
- fac++;
- k *= 10;
- }
+
+ 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 {
- fac = -1;
- while (price * k < 1) {
- fac--;
- k *= 10;
+ 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;
}
}
- return fac;
+ 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);
}
- /**
- * 数字格式化 - 最少保留{num}位有效数字 - 保留 {min}~{max} 为小数 - format02
- */
- public static String formatSignificantDigit(Double price) {
- int min = 2;
- int max= 8;
- int num = 3;
- boolean sign = false;
- Double rate = 1.0;
- Double value = price * rate;
- int level = magnitude(Math.abs(value));
- int count = Math.max(min, Math.min(max, num - level - 1));
- return String.format("%"+(sign?"+": "")+"."+count + "f", value);
- }
+
}
diff --git a/src/main/java/org/springblade/modules/rsvr/mapper/RsvrRMapper.java b/src/main/java/org/springblade/modules/rsvr/mapper/RsvrRMapper.java
index 1b3e642..d9a81ac 100644
--- a/src/main/java/org/springblade/modules/rsvr/mapper/RsvrRMapper.java
+++ b/src/main/java/org/springblade/modules/rsvr/mapper/RsvrRMapper.java
@@ -32,9 +32,11 @@
*/
public interface RsvrRMapper extends BaseMapper<RsvrR> {
List<Map<String, Object>> selectfx();
- List<Map<String, Object>> selectyjck(String egmd,String edmd,String beginTime,String endTime);
+ List<Map<String, Object>> selectyjck(String egmd,String edmd,String beginTime,String endTime,String code);
+ List<Map<String, Object>> selectyjcd(String egmd,String edmd,String beginTime,String endTime,String code);
List<Map<String, Object>> sel(String egmd,String edmd,String code);
List<Map<String, Object>> selectyjcks(String egmd,String edmd,String tm,String timez,String time,String dateEnd);
+ List<Map<String, Object>> selectskshi(String egmd,String edmd,String tm,String beginTime,String endTime,String code);
List<Map<String, Object>> selectsk(String beginTime,String endTime);
Map<String, Object> selectRZ(String stcd,String ti);
Map<String, Object> selectInfo(String stcd);
@@ -45,6 +47,6 @@
//水库站水位流量过程接口
List<Map<String, Object>> selectRsvrList(String code, String dateBegin, String dateEnd);
List<Map<String, Object>> selectRsvrLists(String code, String dateBegin, String dateEnd);
- String selectCode(String beginTime,String endTime);
+ String selectCode();
List<Map<String, Object>> selectyj(String egmd,String edmd,String times,String dateEnd);
}
diff --git a/src/main/java/org/springblade/modules/rsvr/mapper/RsvrRMapper.xml b/src/main/java/org/springblade/modules/rsvr/mapper/RsvrRMapper.xml
index bbf9a4b..4f35d87 100644
--- a/src/main/java/org/springblade/modules/rsvr/mapper/RsvrRMapper.xml
+++ b/src/main/java/org/springblade/modules/rsvr/mapper/RsvrRMapper.xml
@@ -58,22 +58,65 @@
rsv.FSLTDZ,
st.STNM,
st.LGTD,
+ st.FDL,
rs.INQ,
- rs.W,
+ isnull(rs.W, 0) as W,
rs.OTQ,
st.LTTD,
- st.ADDVNM
+ st.ADDVNM,
+ cs3.maxZ,
+ cs4.minZ
FROM dbo.ST_RSVR_R rs
+ INNER JOIN sys_rsvr st ON st.STCD = rs.STCD
LEFT JOIN (SELECT FSLTDZ, STCD
FROM dbo.ST_RSVRFSR_B
WHERE BGMD = #{egmd}
AND EDMD = #{edmd}
and FSLTDZ is not null) rsv ON rsv.STCD = rs.STCD
- INNER JOIN sys_rsvr st ON st.STCD = rs.STCD
- INNER JOIN dbo.ST_RSVRFCCH_B rst ON rst.STCD = rs.STCD
+ LEFT JOIN dbo.ST_RSVRFCCH_B rst ON rst.STCD = rs.STCD
+ LEFT JOIN (SELECT STCD, MAX(RZ) AS maxZ
+ FROM dbo.ST_RSVR_R
+ WHERE TM > #{beginTime}
+ AND TM <= #{endTime}
+ AND STCD IN (${code})
+ GROUP BY STCD) cs3 ON cs3.STCD = rs.STCD
+ LEFT JOIN (SELECT STCD, MIN(RZ) AS minZ
+ FROM dbo.ST_RSVR_R
+ WHERE TM > #{beginTime}
+ AND TM <= #{endTime}
+ AND STCD IN (${code})
+ GROUP BY STCD) cs4 ON cs4.STCD = rs.STCD
WHERE rs.TM > #{beginTime}
AND rs.TM <= #{endTime}
ORDER BY rs.TM DESC
+ </select>
+
+ <select id="selectyjcd" resultType="java.util.HashMap">
+ SELECT rs.STCD,
+ rs.TM,
+ isnull(rs.RZ, 0) as RZ,
+ rsv.FSLTDZ,
+ st.STNM,
+ st.LGTD,
+ st.FDL,
+ rs.INQ,
+ isnull(rs.W, 0) as W,
+ rs.OTQ,
+ st.LTTD,
+ st.ADDVNM,
+ rs.RZ as maxZ,
+ rs.RZ as minZ
+ FROM dbo.ST_RSVR_R rs
+ INNER JOIN sys_rsvr st ON st.STCD = rs.STCD
+ LEFT JOIN (SELECT FSLTDZ, STCD
+ FROM dbo.ST_RSVRFSR_B
+ WHERE BGMD = #{egmd}
+ AND EDMD = #{edmd}
+ and FSLTDZ is not null) rsv ON rsv.STCD = rs.STCD
+ LEFT JOIN dbo.ST_RSVRFCCH_B rst ON rst.STCD = rs.STCD
+ WHERE rs.TM >= #{beginTime}
+ AND rs.TM <= #{endTime}
+ AND rs.STCD IN (${code})
</select>
<!--水库最新信息-->
@@ -128,17 +171,18 @@
isnull(rsvr.RZS, 0) AS RZS,
cs2.STNM,
cs3.INQ,
- cs1.W,
+ isnull(cs1.W, 0) as W,
cs3.OTQ,
cs2.LGTD,
cs2.LTTD,
cs2.ADDVNM,
+ cs2.FDL,
rsv.FSLTDZ
FROM (
SELECT A.STCD,
MAX(A.TM) TM
FROM (SELECT STCD, TM, RZ, INQ, W, OTQ FROM dbo.ST_RSVR_R) AS A
- INNER JOIN (SELECT STCD, STNM, ADDVNM, LTTD, LGTD FROM sys_rsvr) s ON A.STCD = s.STCD
+ INNER JOIN (SELECT STCD, STNM, ADDVNM, LTTD, LGTD, FDL FROM sys_rsvr) s ON A.STCD = s.STCD
LEFT JOIN (SELECT FSLTDZ, STCD
FROM dbo.ST_RSVRFSR_B
WHERE BGMD = #{egmd}
@@ -153,7 +197,7 @@
INNER JOIN (SELECT STCD, TM, RZ, INQ, W, OTQ FROM dbo.ST_RSVR_R) cs1
ON cs.STCD = cs1.STCD
AND cs.TM = cs1.TM
- INNER JOIN (SELECT STCD, STNM, ADDVNM, LTTD, LGTD FROM sys_rsvr) cs2 ON cs.STCD = cs2.STCD
+ INNER JOIN (SELECT STCD, STNM, ADDVNM, LTTD, LGTD, FDL FROM sys_rsvr) cs2 ON cs.STCD = cs2.STCD
LEFT JOIN (SELECT FSLTDZ, STCD
FROM dbo.ST_RSVRFSR_B
WHERE BGMD = #{egmd}
@@ -173,6 +217,7 @@
cs2.ADDVNM,
cs2.LGTD,
cs2.LTTD,
+ cs2.FDL,
rsv.FSLTDZ
</select>
@@ -281,14 +326,8 @@
<select id="selectCode" resultType="java.lang.String">
- SELECT stuff((SELECT ',' + CONVERT(VARCHAR (25), rs.STCD)
- FROM ST_RSVR_R r
- INNER JOIN sys_rsvr rs ON
- rs.STCD = r.STCD
- WHERE r.TM >= #{beginTime}
- AND r.TM <= #{endTime}
- GROUP BY rs.STCD
- FOR XML PATH ('')),
+ SELECT stuff((SELECT ',' + CONVERT(VARCHAR (25), STCD)
+ FROM sys_rsvr FOR XML PATH ('')),
1,
1,
''
@@ -303,46 +342,74 @@
<!-- ''-->
<!-- ) AS stcd-->
<!-- </select>-->
+ <!-- <select id="sel" resultType="java.util.HashMap">-->
+ <!-- SELECT cs.STCD,-->
+ <!-- cs.TM,-->
+ <!-- isnull(cs1.RZ, 0) as RZ,-->
+ <!-- cs2.STNM,-->
+ <!-- cs1.INQ,-->
+ <!-- isnull(cs1.W, 0) as W,-->
+ <!-- cs1.OTQ,-->
+ <!-- cs2.LGTD,-->
+ <!-- cs2.LTTD,-->
+ <!-- cs2.ADDVNM,-->
+ <!-- rsv.FSLTDZ-->
+ <!-- FROM (-->
+ <!-- SELECT A.STCD,-->
+ <!-- MAX(A.TM) TM-->
+ <!-- FROM (SELECT STCD, TM, RZ, INQ, W, OTQ FROM dbo.ST_RSVR_R) AS A-->
+ <!-- INNER JOIN (SELECT STCD, STNM, ADDVNM, LTTD, LGTD FROM sys_rsvr WHERE STCD not IN (${code})) s-->
+ <!-- ON A.STCD = s.STCD-->
+ <!-- GROUP BY A.STCD-->
+ <!-- ) cs-->
+ <!-- INNER JOIN (SELECT STCD, TM, RZ, INQ, W, OTQ FROM dbo.ST_RSVR_R) cs1 ON cs.STCD = cs1.STCD-->
+ <!-- AND cs.TM = cs1.TM-->
+ <!-- INNER JOIN (SELECT STCD, STNM, ADDVNM, LTTD, LGTD FROM sys_rsvr WHERE STCD not IN (${code})) cs2-->
+ <!-- ON cs.STCD = cs2.STCD-->
+ <!-- LEFT JOIN (SELECT FSLTDZ, STCD-->
+ <!-- FROM dbo.ST_RSVRFSR_B-->
+ <!-- WHERE BGMD = #{egmd}-->
+ <!-- AND EDMD = #{edmd}-->
+ <!-- AND FSLTDZ IS NOT NULL) rsv ON rsv.STCD = cs.STCD-->
+ <!-- GROUP BY cs.STCD,-->
+ <!-- cs.TM,-->
+ <!-- cs1.RZ,-->
+ <!-- cs1.INQ,-->
+ <!-- cs1.W,-->
+ <!-- cs1.OTQ,-->
+ <!-- cs2.STNM,-->
+ <!-- cs2.ADDVNM,-->
+ <!-- cs2.LGTD,-->
+ <!-- cs2.LTTD,-->
+ <!-- rsv.FSLTDZ-->
+ <!-- </select> -->
<select id="sel" resultType="java.util.HashMap">
SELECT cs.STCD,
cs.TM,
- isnull(cs1.RZ, 0) as RZ,
+ isnull(cs1.RZ, 0) AS RZ,
cs2.STNM,
- cs1.INQ,
- cs1.W,
- cs1.OTQ,
+ isnull(cs1.W, 0) AS W,
cs2.LGTD,
cs2.LTTD,
cs2.ADDVNM,
+ cs2.FDL,
rsv.FSLTDZ
FROM (
SELECT A.STCD,
MAX(A.TM) TM
FROM (SELECT STCD, TM, RZ, INQ, W, OTQ FROM dbo.ST_RSVR_R) AS A
- INNER JOIN (SELECT STCD, STNM, ADDVNM, LTTD, LGTD FROM sys_rsvr WHERE STCD not IN (${code})) s
+ INNER JOIN (SELECT STCD, STNM, ADDVNM, LTTD, LGTD, FDL FROM sys_rsvr) s
ON A.STCD = s.STCD
GROUP BY A.STCD
) cs
- INNER JOIN (SELECT STCD, TM, RZ, INQ, W, OTQ FROM dbo.ST_RSVR_R) cs1 ON cs.STCD = cs1.STCD
+ LEFT JOIN (SELECT STCD, TM, RZ, INQ, W, OTQ FROM dbo.ST_RSVR_R) cs1 ON cs.STCD = cs1.STCD
AND cs.TM = cs1.TM
- INNER JOIN (SELECT STCD, STNM, ADDVNM, LTTD, LGTD FROM sys_rsvr WHERE STCD not IN (${code})) cs2
- ON cs.STCD = cs2.STCD
+ LEFT JOIN (SELECT STCD, STNM, ADDVNM, LTTD, LGTD, FDL FROM sys_rsvr) cs2 ON cs.STCD = cs2.STCD
LEFT JOIN (SELECT FSLTDZ, STCD
FROM dbo.ST_RSVRFSR_B
WHERE BGMD = #{egmd}
AND EDMD = #{edmd}
AND FSLTDZ IS NOT NULL) rsv ON rsv.STCD = cs.STCD
- GROUP BY cs.STCD,
- cs.TM,
- cs1.RZ,
- cs1.INQ,
- cs1.W,
- cs1.OTQ,
- cs2.STNM,
- cs2.ADDVNM,
- cs2.LGTD,
- cs2.LTTD,
- rsv.FSLTDZ
</select>
<!--水库实时预警-->
@@ -379,4 +446,54 @@
LEFT JOIN (SELECT STCD, NORMZ, DSFLZ FROM ST_RSVRFCCH_B WHERE NORMZ IS NOT NULL) cs4
ON cs.STCD = cs4.STCD
</select>
+
+
+ <select id="selectskshi" resultType="java.util.HashMap">
+ SELECT D.*,
+ isnull(rsvr.RZS, 0) AS RZS
+ FROM (
+ SELECT cs.STCD,
+ cs.TM,
+ isnull(cs.RZ, 0) AS RZ,
+ cs.INQ,
+ cs.OTQ,
+ cs2.STNM,
+ isnull(cs.W, 0) AS W,
+ cs2.LGTD,
+ cs2.LTTD,
+ cs2.ADDVNM,
+ cs2.FDL,
+ rsv.FSLTDZ
+ FROM (
+ SELECT
+ STCD,
+ TM,
+ RZ,
+ INQ,
+ W,
+ OTQ
+ FROM
+ dbo.ST_RSVR_R
+ WHERE
+ TM >=#{beginTime}
+ AND TM<=#{endTime}
+ AND STCD IN (${code})
+ ) cs
+ LEFT JOIN (SELECT STCD, TM, RZ, INQ, W, OTQ FROM dbo.ST_RSVR_R) cs1 ON cs.STCD = cs1.STCD
+ AND cs.TM = cs1.TM
+ LEFT JOIN (SELECT STCD, STNM, ADDVNM, LTTD, LGTD, FDL FROM sys_rsvr) cs2 ON cs.STCD = cs2.STCD
+ LEFT JOIN (SELECT FSLTDZ, STCD
+ FROM dbo.ST_RSVRFSR_B
+ WHERE BGMD = #{egmd}
+ AND EDMD = #{edmd}
+ AND FSLTDZ IS NOT NULL) rsv ON rsv.STCD = cs.STCD
+ ) D
+ LEFT JOIN (
+ SELECT isnull(RZ, 0) AS RZS,
+ STCD
+ FROM ST_RSVR_R
+ WHERE TM = #{tm}
+ AND STCD IN (${code})
+ ) rsvr ON rsvr.STCD = D.STCD
+ </select>
</mapper>
diff --git a/src/main/java/org/springblade/modules/rsvr/service/IRsvrRService.java b/src/main/java/org/springblade/modules/rsvr/service/IRsvrRService.java
index 9f8152b..c9325d2 100644
--- a/src/main/java/org/springblade/modules/rsvr/service/IRsvrRService.java
+++ b/src/main/java/org/springblade/modules/rsvr/service/IRsvrRService.java
@@ -31,7 +31,8 @@
*/
public interface IRsvrRService extends IService<RsvrR> {
List<Map<String, Object>> selectfx();
- List<Map<String, Object>> selectyjck(String egmd,String edmd,String beginTime,String endTime);
+ List<Map<String, Object>> selectyjck(String egmd,String edmd,String beginTime,String endTime,String code);
+ List<Map<String, Object>> selectyjcd(String egmd,String edmd,String beginTime,String endTime,String code);
List<Map<String, Object>> selectsk(String beginTime,String endTime);
List<Map<String, Object>> selectyjcks(String egmd,String edmd,String tm,String timez,String time,String dateEnd);
Map<String, Object> selectRZ(String stcd,String ti);
@@ -40,8 +41,9 @@
List<Map<String, Object>> selList(String stcd);
List<Map<String, Object>> selLists(String stcd);
List<Map<String, Object>> selectRsvrList(String code, String dateBegin, String dateEnd);
- String selectCode(String beginTime,String endTime);
+ String selectCode();
List<Map<String, Object>> sel(String egmd,String edmd,String code);
List<Map<String, Object>> selectyj(String egmd,String edmd,String times,String dateEnd);
List<Map<String, Object>> selectRsvrLists(String code, String dateBegin, String dateEnd);
+ List<Map<String, Object>> selectskshi(String egmd,String edmd,String tm,String beginTime,String endTime,String code);
}
diff --git a/src/main/java/org/springblade/modules/rsvr/service/impl/RsvrRServiceImpl.java b/src/main/java/org/springblade/modules/rsvr/service/impl/RsvrRServiceImpl.java
index 51ab075..0701f23 100644
--- a/src/main/java/org/springblade/modules/rsvr/service/impl/RsvrRServiceImpl.java
+++ b/src/main/java/org/springblade/modules/rsvr/service/impl/RsvrRServiceImpl.java
@@ -44,8 +44,13 @@
}
@Override
- public List<Map<String, Object>> selectyjck(String egmd, String edmd,String beginTime, String endTime) {
- return baseMapper.selectyjck(egmd, edmd,beginTime, endTime);
+ public List<Map<String, Object>> selectyjck(String egmd, String edmd,String beginTime, String endTime,String code) {
+ return baseMapper.selectyjck(egmd, edmd,beginTime, endTime,code);
+ }
+
+ @Override
+ public List<Map<String, Object>> selectyjcd(String egmd, String edmd, String beginTime, String endTime, String code) {
+ return baseMapper.selectyjcd(egmd, edmd, beginTime, endTime, code);
}
@Override
@@ -89,8 +94,8 @@
}
@Override
- public String selectCode(String beginTime,String endTime) {
- return baseMapper.selectCode(beginTime, endTime);
+ public String selectCode() {
+ return baseMapper.selectCode();
}
@Override
@@ -108,4 +113,9 @@
return baseMapper.selectRsvrLists(code, dateBegin, dateEnd);
}
+ @Override
+ public List<Map<String, Object>> selectskshi(String egmd, String edmd, String tm,String beginTime,String endTime ,String code) {
+ return baseMapper.selectskshi(egmd, edmd, tm, beginTime,endTime, code);
+ }
+
}
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index 730da54..f0a0728 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -16,11 +16,11 @@
primary: master
datasource:
master:
- url: jdbc:sqlserver://10.36.98.39:1433;DatabaseName=fzsw
+ url: jdbc:sqlserver://localhost:1433;DatabaseName=fzsw
username: sa
password: fzsw@2021
slaves:
- url: jdbc:sqlserver://10.36.98.39:1433;DatabaseName=fzswS
+ url: jdbc:sqlserver://localhost:1433;DatabaseName=fzswS
username: sa
password: fzsw@2021
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 304b86d..a42f100 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,6 +1,6 @@
#服务器配置
server:
- port: 82
+ port: 85
undertow:
# 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程
io-threads: 16
diff --git a/src/main/resources/excelTemplate/temple.xls b/src/main/resources/excelTemplate/temple.xls
new file mode 100644
index 0000000..310f545
--- /dev/null
+++ b/src/main/resources/excelTemplate/temple.xls
Binary files differ
--
Gitblit v1.9.3