22 files modified
20 files added
| | |
| | | secureRegistry.excludePathPatterns("/riverway/**"); |
| | | secureRegistry.excludePathPatterns("/site/**"); |
| | | secureRegistry.excludePathPatterns("/stbprpb/**"); |
| | | secureRegistry.excludePathPatterns("/bigriver/**"); |
| | | secureRegistry.excludePathPatterns("/smariver/**"); |
| | | return secureRegistry; |
| | | } |
| | | |
| New file |
| | |
| | | /** |
| | | * 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.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 lombok.AllArgsConstructor; |
| | | 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.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author Blade |
| | | * @since 2019-11-07 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/bigriver") |
| | | @Api(value = "", tags = "接口") |
| | | public class BigriverController extends BladeController { |
| | | |
| | | private IBigriverService iBigriverService; |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @ApiLog("详情") |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "site") |
| | | public R<Yucbig> detail(Yucbig yucbig) { |
| | | Yucbig detail = iBigriverService.getOne(Condition.getQueryWrapper(yucbig)); |
| | | return R.data(BigriverWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @ApiLog("新增") |
| | | @PostMapping("/save") |
| | | @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) |
| | | @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("导入成功"); |
| | | } |
| | | |
| | | /** |
| | | * 大江大河预警 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/selectbgriver") |
| | | public R selectbgriver() { |
| | | List<Map<String, Object>> selctsmriver = iBigriverService.selctbgriver(); |
| | | //预警数据 |
| | | List listyj = new ArrayList(); |
| | | //无预警数据 |
| | | List listzc = new ArrayList(); |
| | | for (int i = 0; i < selctsmriver.size(); i++) { |
| | | //警戒水位 |
| | | String yjsw = selctsmriver.get(i).get("yjsw").toString(); |
| | | Double yjz = Double.parseDouble(yjsw); |
| | | //水位 |
| | | String zs = selctsmriver.get(i).get("yuz").toString(); |
| | | Double z = Double.parseDouble(zs); |
| | | if (z > yjz) { |
| | | listyj.add(selctsmriver.get(i)); |
| | | } else { |
| | | listzc.add(selctsmriver.get(i)); |
| | | } |
| | | } |
| | | Map map = new HashMap(); |
| | | map.put("yj", listyj); |
| | | map.put("zc", listzc); |
| | | List list = new ArrayList(); |
| | | list.add(map); |
| | | return R.data(list); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import liquibase.pro.packaged.M; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.poi.hssf.usermodel.*; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.log.annotation.ApiLog; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | |
| | | import org.springblade.modules.mountain.vo.MountainVO; |
| | | import org.springblade.modules.mountainrain.entity.Mountainrain; |
| | | import org.springblade.modules.mountainrain.entity.Yucpptn; |
| | | import org.springblade.modules.mountainrain.excel.BgrExcel; |
| | | import org.springblade.modules.mountainrain.excel.BgrImporter; |
| | | import org.springblade.modules.mountainrain.excel.MgrExcel; |
| | | import org.springblade.modules.mountainrain.excel.MgrImporter; |
| | | import org.springblade.modules.mountainrain.service.IMountainrainService; |
| | | import org.springblade.modules.mountainrain.vo.*; |
| | | import org.springblade.modules.mountainrain.wrapper.MountainrainWrapper; |
| | | import org.springblade.modules.regionWeight.service.IRegionWeightService; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | | import org.springblade.modules.system.excel.UserImporter; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.net.URLEncoder; |
| | | import java.sql.Timestamp; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | } |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | if (mountainrainsCVOS.get(i).getSoilval() > 30) { |
| | | // int Max = mountainrainService.Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(), |
| | | // mountainrainsCVOS.get(i).getGohours(), mountainrainsCVOS.get(i).getGthours()); |
| | | // map.put("List", mountainrainsCVOS.get(i)); |
| | | // map.put("Max", Max); |
| | | // lists.add(map); |
| | | //0.8雨量湿度 |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | |
| | | } |
| | | } else { |
| | | //0.5雨量湿度 |
| | | int Max = mountainrainService.Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(), |
| | | mountainrainsCVOS.get(i).getGohour(), mountainrainsCVOS.get(i).getGthour()); |
| | | // map.put("List", mountainrainsCVOS.get(i)); |
| | | // map.put("Max", Max); |
| | | // lists.add(map); |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "true"); |
| | |
| | | } |
| | | |
| | | } |
| | | //色斑图 |
| | | 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); |
| | | return R.data(lists); |
| | | |
| | | } |
| | |
| | | String dateEnd3 = dateEnds3; |
| | | |
| | | String s = regionWeightService.selectCode(); |
| | | //String s = "62334490"; |
| | | String[] split = s.split(","); |
| | | String strArrays = ""; |
| | | for (int i = 0; i < split.length; i++) { |
| | |
| | | double drp3 = w3.doubleValue(); |
| | | if (drp1 > 30) { |
| | | map.put("flage1", "true"); |
| | | } else { |
| | | map.put("flage1", "false"); |
| | | } |
| | | if (drp2 > 50) { |
| | | map.put("flage2", "true"); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("flage2", "false"); |
| | | } |
| | | if (drp3 > 80) { |
| | | map.put("flage3", "true"); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("flage1", "false"); |
| | | map.put("flage2", "false"); |
| | | map.put("flage3", "false"); |
| | | lists.add(map); |
| | | } |
| | | 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(); |
| | | BigDecimal w2 = (BigDecimal) list.get(i).get("drp2"); |
| | | double drp2 = w2.doubleValue(); |
| | | BigDecimal w3 = (BigDecimal) list.get(i).get("drp3"); |
| | | double drp3 = w3.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; |
| | | } |
| | | if (drp2 > 50) { |
| | | row.createCell((short) 2).setCellValue(2); |
| | | continue; |
| | | } |
| | | if (drp3 > 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); |
| | | return R.data(lists); |
| | | } |
| | | |
| | |
| | | passDaysList.add(getDays(i, false)); |
| | | } |
| | | Collections.sort(passDaysList); |
| | | String s = mountainrainService.selectCode(); |
| | | //String s = mountainrainService.selectCode(); |
| | | String s = regionWeightService.selectCode(); |
| | | String[] split = s.split(","); |
| | | String strArrays = ""; |
| | | for (int i = 0; i < split.length; i++) { |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/yuc") |
| | | public R yuc(String addvcd, String time, String intv,String drp) throws ParseException { |
| | | public R yuc(String addvcd, String time, String intv, String drp, int type) throws ParseException { |
| | | mountainrainService.del(); |
| | | List yucpptnList = new ArrayList<>(); |
| | | //通过行政区查询站点编码 |
| | | List<Map<String, Object>> list = mountainrainService.selectAddvcd(addvcd); |
| | |
| | | } |
| | | //预警信息添加 |
| | | mountainrainService.insertYuc(yucpptnList); |
| | | return R.data(""); |
| | | //第二种预警 |
| | | if (type == 0) { |
| | | List<MountainrainsCVO> mountainrainsCVOS = mountainrainService.selectYum(); |
| | | List<Map<String, Object>> lists = new ArrayList<>(); |
| | | for (int i = 0; i < mountainrainsCVOS.size(); i++) { |
| | | if (mountainrainsCVOS.get(i).getCenconding() == null) { |
| | | continue; |
| | | } |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | if (mountainrainsCVOS.get(i).getSoilval() > 30) { |
| | | //0.8雨量湿度 |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "true"); |
| | | map.put("flage3", "false"); |
| | | map.put("status", 2); |
| | | lists.add(map); |
| | | } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthours()) { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "false"); |
| | | map.put("flage3", "true"); |
| | | map.put("status", 2); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "false"); |
| | | map.put("flage3", "false"); |
| | | map.put("status", 2); |
| | | lists.add(map); |
| | | } |
| | | } else { |
| | | //0.5雨量湿度 |
| | | int Max = mountainrainService.Max(mountainrainsCVOS.get(i).getDrp1(), mountainrainsCVOS.get(i).getDrp3(), |
| | | mountainrainsCVOS.get(i).getGohour(), mountainrainsCVOS.get(i).getGthour()); |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "true"); |
| | | map.put("flage3", "false"); |
| | | map.put("status", 1); |
| | | lists.add(map); |
| | | } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthour()) { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "false"); |
| | | map.put("flage3", "true"); |
| | | map.put("status", 1); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "false"); |
| | | map.put("flage3", "false"); |
| | | map.put("status", 1); |
| | | lists.add(map); |
| | | } |
| | | } |
| | | |
| | | } |
| | | return R.data(lists); |
| | | } else { |
| | | //第一种方式预警(雨量表) |
| | | List<Map<String, Object>> list1 = mountainrainService.selectYup(); |
| | | List<Map<String, Object>> listyp = new ArrayList<>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | String w1 = list1.get(i).get("drp").toString(); |
| | | double drp1 = Double.parseDouble(w1); |
| | | String intv1 = list1.get(i).get("INTV").toString(); |
| | | //一小时预警 |
| | | if (intv1.equals("1")) { |
| | | if (drp1 > 30) { |
| | | map.put("flage1", "true"); |
| | | map.put("flage2", "false"); |
| | | map.put("flage3", "false"); |
| | | } else { |
| | | map.put("flage1", "false"); |
| | | map.put("flage2", "false"); |
| | | map.put("flage3", "false"); |
| | | } |
| | | } else if (intv1.equals("2")) { |
| | | if (drp1 > 50) { |
| | | map.put("flage2", "true"); |
| | | map.put("flage1", "false"); |
| | | map.put("flage3", "false"); |
| | | } else { |
| | | map.put("flage1", "false"); |
| | | map.put("flage2", "false"); |
| | | map.put("flage3", "false"); |
| | | } |
| | | } else { |
| | | if (drp1 > 80) { |
| | | map.put("flage3", "true"); |
| | | map.put("flage1", "false"); |
| | | map.put("flage2", "false"); |
| | | } else { |
| | | map.put("flage1", "false"); |
| | | map.put("flage2", "false"); |
| | | map.put("flage3", "false"); |
| | | } |
| | | } |
| | | map.put("List", list1.get(i)); |
| | | listyp.add(map); |
| | | } |
| | | return R.data(listyp); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 中小河流预警 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/selectsmriver") |
| | | public R selectsmriver(String time) { |
| | | 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); |
| | | List<Map<String, Object>> selctsmriver = mountainrainService.selctsmriver(time, dateEnd); |
| | | //预警数据 |
| | | List listyj = new ArrayList(); |
| | | //无预警数据 |
| | | List listzc = new ArrayList(); |
| | | for (int i = 0; i < selctsmriver.size(); i++) { |
| | | //警戒水位 |
| | | String yjsw = selctsmriver.get(i).get("yjsw").toString(); |
| | | Double yjz = Double.parseDouble(yjsw); |
| | | //水位 |
| | | String zs = selctsmriver.get(i).get("Z").toString(); |
| | | Double z = Double.parseDouble(zs); |
| | | if (z > yjz) { |
| | | listyj.add(selctsmriver.get(i)); |
| | | } else { |
| | | listzc.add(selctsmriver.get(i)); |
| | | } |
| | | } |
| | | Map map = new HashMap(); |
| | | map.put("yj", listyj); |
| | | map.put("zc", listzc); |
| | | List list = new ArrayList(); |
| | | list.add(map); |
| | | return R.data(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 大江大河预警 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/selectbgriver") |
| | | public R selectbgriver(String time) { |
| | | 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); |
| | | List<Map<String, Object>> selctsmriver = mountainrainService.selctbgriver(time, dateEnd); |
| | | //预警数据 |
| | | List listyj = new ArrayList(); |
| | | //无预警数据 |
| | | List listzc = new ArrayList(); |
| | | for (int i = 0; i < selctsmriver.size(); i++) { |
| | | //警戒水位 |
| | | String yjsw = selctsmriver.get(i).get("yjsw").toString(); |
| | | Double yjz = Double.parseDouble(yjsw); |
| | | //水位 |
| | | String zs = selctsmriver.get(i).get("Z").toString(); |
| | | Double z = Double.parseDouble(zs); |
| | | if (z > yjz) { |
| | | listyj.add(selctsmriver.get(i)); |
| | | } else { |
| | | listzc.add(selctsmriver.get(i)); |
| | | } |
| | | } |
| | | Map map = new HashMap(); |
| | | map.put("yj", listyj); |
| | | map.put("zc", listzc); |
| | | List list = new ArrayList(); |
| | | list.add(map); |
| | | return R.data(list); |
| | | } |
| | | |
| | | /** |
| | | * 土壤 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/selectTu") |
| | | public R selectTu() { |
| | | List<Map<String, Object>> maps = mountainrainService.selectTu(); |
| | | List<Map<Object, Object>> list = new ArrayList(); |
| | | //镇 |
| | | List<Map<Object, Object>> listz = new ArrayList(); |
| | | //乡 |
| | | List<Map<Object, Object>> listx = new ArrayList(); |
| | | Map mapZ = new HashMap(); |
| | | for (int i = 0; i < maps.size(); i++) { |
| | | Map map = new HashMap(); |
| | | String village = maps.get(i).get("village").toString(); |
| | | String soilval = maps.get(i).get("soilval").toString(); |
| | | String county = maps.get(i).get("county").toString(); |
| | | String cenconding = maps.get(i).get("cenconding").toString(); |
| | | //土壤湿度 |
| | | Double soilv = Double.parseDouble(soilval); |
| | | boolean status = village.contains("镇"); |
| | | if (status) { |
| | | String str1 = village.substring(0, village.indexOf("镇") + 1); |
| | | map.put("name", str1); |
| | | map.put("soilv", soilv); |
| | | map.put("addvnm", county); |
| | | map.put("cenconding", cenconding); |
| | | listz.add(map); |
| | | } else { |
| | | String str2 = village.substring(0, village.indexOf("乡") + 1); |
| | | map.put("name", str2); |
| | | map.put("soilv", soilv); |
| | | map.put("addvnm", county); |
| | | map.put("cenconding", cenconding); |
| | | listx.add(map); |
| | | } |
| | | } |
| | | System.out.println("镇" + listz.size()); |
| | | System.out.println("乡" + listx.size()); |
| | | Map<String, List<Map<Object, Object>>> mapMap = new HashMap<>(); |
| | | for (Map<Object, Object> newMap : listz) { |
| | | List<Map<Object, Object>> newl = new ArrayList<>(); |
| | | // map是否包含此key,若已经包含则添加一个新的数字到对应value集合中 |
| | | if (mapMap.containsKey(newMap.get("name").toString())) { |
| | | //mapList.add(Integer.valueOf(newMap.get("C").toString()),newMap); |
| | | mapMap.get(newMap.get("name").toString()).add(newMap); |
| | | } else { |
| | | newl.add(newMap); |
| | | mapMap.put(newMap.get("name").toString(), newl); |
| | | } |
| | | } |
| | | mapZ.put("listz", mapMap); |
| | | //乡 |
| | | Map<String, List<Map<Object, Object>>> mapMapx = new HashMap<>(); |
| | | for (Map<Object, Object> newMap : listx) { |
| | | List<Map<Object, Object>> newl = new ArrayList<>(); |
| | | // map是否包含此key,若已经包含则添加一个新的数字到对应value集合中 |
| | | if (mapMapx.containsKey(newMap.get("name").toString())) { |
| | | //mapList.add(Integer.valueOf(newMap.get("C").toString()),newMap); |
| | | mapMapx.get(newMap.get("name").toString()).add(newMap); |
| | | } else { |
| | | newl.add(newMap); |
| | | mapMapx.put(newMap.get("name").toString(), newl); |
| | | } |
| | | } |
| | | mapZ.put("listx", mapMapx); |
| | | list.add(mapZ); |
| | | return R.data(list); |
| | | } |
| | | |
| | | /** |
| | | * 查询预警1小时 |
| | | */ |
| | | @GetMapping("/Yi") |
| | | public R Yi(int type, String time, String dateEnds1) { |
| | | //第二种方式预警 |
| | | if (type == 0) { |
| | | //当前时间 |
| | | String times = time; |
| | | |
| | | String dateEnd1 = dateEnds1; |
| | | //对应雨量站 |
| | | 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<Map<String, Object>> lists = new ArrayList<>(); |
| | | for (int i = 0; i < mountainrainsCVOS.size(); i++) { |
| | | if (mountainrainsCVOS.get(i).getCenconding() == null) { |
| | | continue; |
| | | } |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | if (mountainrainsCVOS.get(i).getSoilval() > 30) { |
| | | //0.8雨量湿度 |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) { |
| | | int drp1 = mountainrainsCVOS.get(i).getDrp1(); |
| | | Integer gohours = mountainrainsCVOS.get(i).getGohours(); |
| | | int i1 = drp1 - gohours; |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "true"); |
| | | map.put("status", 2); |
| | | map.put("num", i1); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "false"); |
| | | map.put("status", 2); |
| | | lists.add(map); |
| | | } |
| | | } else { |
| | | //0.5雨量湿度 |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) { |
| | | int drp1 = mountainrainsCVOS.get(i).getDrp1(); |
| | | Integer gohour = mountainrainsCVOS.get(i).getGohour(); |
| | | int i1 = drp1 - gohour; |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "true"); |
| | | map.put("status", 1); |
| | | map.put("num", i1); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "false"); |
| | | map.put("status", 1); |
| | | lists.add(map); |
| | | } |
| | | } |
| | | |
| | | } |
| | | //色斑图 |
| | | 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); |
| | | return R.data(lists); |
| | | |
| | | } |
| | | //第一种方式预警(雨量表数据) |
| | | else { |
| | | //当前时间 |
| | | String times = time; |
| | | |
| | | //一个小时前的时间 |
| | | String dateEnd1 = dateEnds1; |
| | | |
| | | 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); |
| | | List<Map<String, Object>> list = mountainrainService.selecMoneYi(times, dateEnd1, code); |
| | | List<Map<String, Object>> lists = new ArrayList<>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | BigDecimal w1 = (BigDecimal) list.get(i).get("drp1"); |
| | | double drp1 = w1.doubleValue(); |
| | | if (drp1 > 30) { |
| | | double v = drp1 - 30; |
| | | double v1 = (double) Math.round(v * 100) / 100; |
| | | map.put("flage1", "true"); |
| | | map.put("num", v1); |
| | | } else { |
| | | map.put("flage1", "false"); |
| | | } |
| | | 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); |
| | | return R.data(lists); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 查询预警2小时 |
| | | */ |
| | | @GetMapping("/Tw") |
| | | public R Tw(int type, String time, String dateEnds2) { |
| | | //第二种方式预警 |
| | | if (type == 0) { |
| | | //当前时间 |
| | | String times = time; |
| | | |
| | | //2个小时前的时间 |
| | | String dateEnd2 = dateEnds2; |
| | | |
| | | //对应雨量站 |
| | | String s = mountainrainService.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<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainYi(times, dateEnd2, code); |
| | | List<Map<String, Object>> lists = new ArrayList<>(); |
| | | for (int i = 0; i < mountainrainsCVOS.size(); i++) { |
| | | if (mountainrainsCVOS.get(i).getCenconding() == null) { |
| | | continue; |
| | | } |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | if (mountainrainsCVOS.get(i).getSoilval() > 30) { |
| | | //0.8雨量湿度 |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohours()) { |
| | | int drp1 = mountainrainsCVOS.get(i).getDrp1(); |
| | | Integer gohours = mountainrainsCVOS.get(i).getGohours(); |
| | | int i1 = drp1 - gohours; |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "true"); |
| | | map.put("flage3", "false"); |
| | | map.put("status", 2); |
| | | map.put("num", i1); |
| | | lists.add(map); |
| | | } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthours()) { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "false"); |
| | | map.put("flage3", "true"); |
| | | map.put("status", 2); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "false"); |
| | | map.put("flage3", "false"); |
| | | map.put("status", 2); |
| | | lists.add(map); |
| | | } |
| | | } else { |
| | | //0.5雨量湿度 |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGohour()) { |
| | | int drp1 = mountainrainsCVOS.get(i).getDrp1(); |
| | | Integer gohour = mountainrainsCVOS.get(i).getGohour(); |
| | | int i1 = drp1 - gohour; |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "true"); |
| | | map.put("flage3", "false"); |
| | | map.put("status", 1); |
| | | map.put("num", i1); |
| | | lists.add(map); |
| | | } else if (mountainrainsCVOS.get(i).getDrp3() > mountainrainsCVOS.get(i).getGthour()) { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "false"); |
| | | map.put("flage3", "true"); |
| | | map.put("status", 1); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage1", "false"); |
| | | map.put("flage3", "false"); |
| | | map.put("status", 1); |
| | | lists.add(map); |
| | | } |
| | | } |
| | | |
| | | } |
| | | //色斑图 |
| | | 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); |
| | | return R.data(lists); |
| | | |
| | | } |
| | | //第一种方式预警(雨量表数据) |
| | | else { |
| | | //当前时间 |
| | | String times = time; |
| | | |
| | | //两个小时前的时间 |
| | | String dateEnd2 = dateEnds2; |
| | | |
| | | 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); |
| | | List<Map<String, Object>> list = mountainrainService.selecMoneYi(times, dateEnd2, code); |
| | | List<Map<String, Object>> lists = new ArrayList<>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | BigDecimal w1 = (BigDecimal) list.get(i).get("drp1"); |
| | | double drp1 = w1.doubleValue(); |
| | | if (drp1 > 50) { |
| | | double v = drp1 - 50; |
| | | double v1 = (double) Math.round(v * 100) / 100; |
| | | map.put("flage2", "true"); |
| | | map.put("num", v1); |
| | | } else { |
| | | map.put("flage2", "false"); |
| | | } |
| | | 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); |
| | | return R.data(lists); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询预警3小时 |
| | | */ |
| | | @GetMapping("/Tr") |
| | | public R Tr(int type, String time, String dateEnds3) { |
| | | //第二种方式预警 |
| | | if (type == 0) { |
| | | //当前时间 |
| | | String times = time; |
| | | |
| | | //2个小时前的时间 |
| | | String dateEnd3 = dateEnds3; |
| | | |
| | | //对应雨量站 |
| | | String s = mountainrainService.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<MountainrainsCVO> mountainrainsCVOS = mountainrainService.MountainTr(times, dateEnd3, code); |
| | | List<Map<String, Object>> lists = new ArrayList<>(); |
| | | for (int i = 0; i < mountainrainsCVOS.size(); i++) { |
| | | if (mountainrainsCVOS.get(i).getCenconding() == null) { |
| | | continue; |
| | | } |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | if (mountainrainsCVOS.get(i).getSoilval() > 30) { |
| | | //0.8雨量湿度 |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthours()) { |
| | | int drp1 = mountainrainsCVOS.get(i).getDrp1(); |
| | | Integer gohours = mountainrainsCVOS.get(i).getGohours(); |
| | | int i1 = drp1 - gohours; |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage3", "true"); |
| | | map.put("status", 2); |
| | | map.put("num", i1); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage3", "false"); |
| | | map.put("status", 2); |
| | | lists.add(map); |
| | | } |
| | | } else { |
| | | //0.5雨量湿度 |
| | | if (mountainrainsCVOS.get(i).getDrp1() > mountainrainsCVOS.get(i).getGthour()) { |
| | | int drp1 = mountainrainsCVOS.get(i).getDrp1(); |
| | | Integer gohour = mountainrainsCVOS.get(i).getGohour(); |
| | | int i1 = drp1 - gohour; |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage3", "true"); |
| | | map.put("status", 1); |
| | | map.put("num", i1); |
| | | lists.add(map); |
| | | } else { |
| | | map.put("List", mountainrainsCVOS.get(i)); |
| | | map.put("flage3", "false"); |
| | | map.put("status", 1); |
| | | lists.add(map); |
| | | } |
| | | } |
| | | |
| | | } |
| | | //色斑图 |
| | | 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); |
| | | return R.data(lists); |
| | | |
| | | } |
| | | //第一种方式预警(雨量表数据) |
| | | else { |
| | | //当前时间 |
| | | String times = time; |
| | | |
| | | //两个小时前的时间 |
| | | String dateEnd3 = dateEnds3; |
| | | |
| | | 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); |
| | | List<Map<String, Object>> list = mountainrainService.selecMoneYi(times, dateEnd3, code); |
| | | List<Map<String, Object>> lists = new ArrayList<>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | BigDecimal w1 = (BigDecimal) list.get(i).get("drp1"); |
| | | double drp1 = w1.doubleValue(); |
| | | if (drp1 > 80) { |
| | | double v = drp1 - 80; |
| | | double v1 = (double) Math.round(v * 100) / 100; |
| | | map.put("flage3", "true"); |
| | | map.put("num", v1); |
| | | } else { |
| | | map.put("flage3", "false"); |
| | | } |
| | | 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); |
| | | return R.data(lists); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 土壤色斑图 |
| | | */ |
| | | @GetMapping("/selectS") |
| | | public R selectS() { |
| | | List<Map<String, Object>> list = mountainrainService.selectS(); |
| | | 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++) { |
| | | String stcd = list.get(i).get("stcd").toString(); |
| | | // 第四步,创建单元格,并设置值 |
| | | row = sheet.createRow((int) i + 1); |
| | | HSSFCell celli = row.createCell((short) 0); |
| | | row.createCell((short) 0).setCellValue(list.get(i).get("LGTD").toString()); |
| | | row.createCell((short) 1).setCellValue(list.get(i).get("LTTD").toString()); |
| | | row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString()); |
| | | if (stcd.equals("62455350")) { |
| | | row.createCell((short) 0).setCellValue("117.344876"); |
| | | row.createCell((short) 1).setCellValue("27.827067"); |
| | | row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString()); |
| | | } |
| | | if (stcd.equals("62334845")) { |
| | | row.createCell((short) 0).setCellValue("115.625720"); |
| | | row.createCell((short) 1).setCellValue("27.152794"); |
| | | row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString()); |
| | | } |
| | | if (stcd.equals("62433800")) { |
| | | row.createCell((short) 0).setCellValue("115.618546"); |
| | | row.createCell((short) 1).setCellValue("27.683604"); |
| | | row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString()); |
| | | } |
| | | if (stcd.equals("62436760")) { |
| | | row.createCell((short) 0).setCellValue("116.060889"); |
| | | row.createCell((short) 1).setCellValue("28.216806"); |
| | | row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString()); |
| | | } |
| | | if (stcd.equals("62437250")) { |
| | | row.createCell((short) 0).setCellValue("116.622783"); |
| | | row.createCell((short) 1).setCellValue("28.489384"); |
| | | row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString()); |
| | | } |
| | | if (stcd.equals("62433700")) { |
| | | row.createCell((short) 0).setCellValue("115.558771"); |
| | | row.createCell((short) 1).setCellValue("27.518623"); |
| | | row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString()); |
| | | } |
| | | if (stcd.equals("62425740")) { |
| | | row.createCell((short) 0).setCellValue("117.208587"); |
| | | row.createCell((short) 1).setCellValue("27.298647"); |
| | | row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString()); |
| | | } |
| | | if (stcd.equals("62437235")) { |
| | | row.createCell((short) 0).setCellValue("116.780591"); |
| | | row.createCell((short) 1).setCellValue("28.391352"); |
| | | row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString()); |
| | | } |
| | | if (stcd.equals("62437250")) { |
| | | row.createCell((short) 0).setCellValue("116.555834"); |
| | | row.createCell((short) 1).setCellValue("28.518077"); |
| | | row.createCell((short) 2).setCellValue(list.get(i).get("soilval").toString()); |
| | | } |
| | | } |
| | | // 第六步,将文件存到指定位置 |
| | | try { |
| | | fileName = "D:/tur.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\\tur.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(); |
| | | } |
| | | return R.data(m); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | /** |
| | | * 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.mountainrain.controller; |
| | | |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | 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.BgrExcel; |
| | | import org.springblade.modules.mountainrain.excel.BgrImporter; |
| | | import org.springblade.modules.mountainrain.excel.MgrExcel; |
| | | import org.springblade.modules.mountainrain.excel.MgrImporter; |
| | | import org.springblade.modules.mountainrain.service.ISmariverService; |
| | | import org.springblade.modules.mountainrain.wrapper.BigriverWrapper; |
| | | 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.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author Blade |
| | | * @since 2019-11-07 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/smariver") |
| | | @Api(value = "", tags = "接口") |
| | | public class SmariverController extends BladeController { |
| | | |
| | | private ISmariverService iSmariverService; |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @ApiLog("详情") |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "site") |
| | | public R<Yucsma> detail(Yucsma yucsma) { |
| | | Yucsma detail = iSmariverService.getOne(Condition.getQueryWrapper(yucsma)); |
| | | return R.data(SmariverWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @ApiLog("新增") |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入site") |
| | | public R save(@Valid @RequestBody Yucsma yucsma) { |
| | | return R.status(iSmariverService.save(yucsma)); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @ApiLog("修改") |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入site") |
| | | public R update(@Valid @RequestBody Yucsma yucsma) { |
| | | 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("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * 中小河流预警 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/selectsmriver") |
| | | public R selectsmriver() { |
| | | List<Map<String, Object>> selctsmriver = iSmariverService.selctsmriver(); |
| | | //预警数据 |
| | | List listyj = new ArrayList(); |
| | | //无预警数据 |
| | | List listzc = new ArrayList(); |
| | | for (int i = 0; i < selctsmriver.size(); i++) { |
| | | //警戒水位 |
| | | String yjsw = selctsmriver.get(i).get("yjsw").toString(); |
| | | Double yjz = Double.parseDouble(yjsw); |
| | | //水位 |
| | | String zs = selctsmriver.get(i).get("yuz").toString(); |
| | | Double z = Double.parseDouble(zs); |
| | | if (z > yjz) { |
| | | listyj.add(selctsmriver.get(i)); |
| | | } else { |
| | | listzc.add(selctsmriver.get(i)); |
| | | } |
| | | } |
| | | Map map = new HashMap(); |
| | | map.put("yj", listyj); |
| | | map.put("zc", listzc); |
| | | List list = new ArrayList(); |
| | | list.add(map); |
| | | return R.data(list); |
| | | } |
| | | |
| | | } |
| | |
| | | @Component |
| | | public class ss { |
| | | @Autowired |
| | | private IRegionWeightService regionWeightService; |
| | | |
| | | @Autowired |
| | | private IMountainrainService mountainrainService; |
| | | |
| | | @Scheduled(cron = "0 0 8 * * ?") |
| | |
| | | passDaysList.add(getDays(i, false)); |
| | | } |
| | | Collections.sort(passDaysList); |
| | | String s = mountainrainService.selectCode(); |
| | | //String s = mountainrainService.selectCode(); |
| | | String s = regionWeightService.selectCode(); |
| | | String[] split = s.split(","); |
| | | String strArrays = ""; |
| | | for (int i = 0; i < split.length; i++) { |
| New file |
| | |
| | | package org.springblade.modules.mountainrain.entity; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName("sys_Yucbig") |
| | | @ApiModel(value = "Yucbig对象", description = "Yucbig对象") |
| | | public class Yucbig { |
| | | |
| | | /** |
| | | * 站码 |
| | | */ |
| | | @ApiModelProperty(value = "站码") |
| | | private String stcd; |
| | | |
| | | /** |
| | | * 站名 |
| | | */ |
| | | @ApiModelProperty(value = "站名") |
| | | private String stname; |
| | | |
| | | /** |
| | | * 河名 |
| | | */ |
| | | @ApiModelProperty(value = "河名") |
| | | private String river; |
| | | |
| | | /** |
| | | * 发布时间 |
| | | */ |
| | | @ApiModelProperty(value = "发布时间") |
| | | private String ftime; |
| | | |
| | | /** |
| | | * 预测时间 |
| | | */ |
| | | @ApiModelProperty(value = "预测时间") |
| | | private String ytime; |
| | | |
| | | /** |
| | | * 预报水位 |
| | | */ |
| | | @ApiModelProperty(value = "预报水位") |
| | | private String yuz; |
| | | |
| | | /** |
| | | * 预警水位 |
| | | */ |
| | | @ApiModelProperty(value = "预警水位") |
| | | private String yjsw; |
| | | |
| | | /** |
| | | * 预警流量 |
| | | */ |
| | | @ApiModelProperty(value = "预警流量") |
| | | private String yq; |
| | | } |
| New file |
| | |
| | | package org.springblade.modules.mountainrain.entity; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName("sys_Yucsma") |
| | | @ApiModel(value = "Yucsma对象", description = "Yucsma对象") |
| | | public class Yucsma { |
| | | |
| | | /** |
| | | * 站码 |
| | | */ |
| | | @ApiModelProperty(value = "站码") |
| | | private String stcd; |
| | | |
| | | /** |
| | | * 站名 |
| | | */ |
| | | @ApiModelProperty(value = "站名") |
| | | private String stname; |
| | | |
| | | /** |
| | | * 河名 |
| | | */ |
| | | @ApiModelProperty(value = "河名") |
| | | private String river; |
| | | |
| | | /** |
| | | * 发布时间 |
| | | */ |
| | | @ApiModelProperty(value = "发布时间") |
| | | private String ftime; |
| | | |
| | | /** |
| | | * 预测时间 |
| | | */ |
| | | @ApiModelProperty(value = "预测时间") |
| | | private String ytime; |
| | | |
| | | /** |
| | | * 预报水位 |
| | | */ |
| | | @ApiModelProperty(value = "预报水位") |
| | | private String yuz; |
| | | |
| | | /** |
| | | * 预警水位 |
| | | */ |
| | | @ApiModelProperty(value = "预警水位") |
| | | private String yjsw; |
| | | |
| | | /** |
| | | * 预警流量 |
| | | */ |
| | | @ApiModelProperty(value = "预警流量") |
| | | private String yq; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.mountainrain.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnore; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
| | | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * UserExcel |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Data |
| | | @ColumnWidth(25) |
| | | @HeadRowHeight(20) |
| | | @ContentRowHeight(18) |
| | | public class BgrExcel implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("河名") |
| | | private String river; |
| | | |
| | | @ExcelProperty("站名") |
| | | private String stname; |
| | | |
| | | @ColumnWidth(20) |
| | | @ExcelProperty("站码") |
| | | private String stcd; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("发布时间") |
| | | private String ftime; |
| | | |
| | | @ColumnWidth(10) |
| | | @ExcelProperty("预测时间") |
| | | private String ytime; |
| | | |
| | | @ColumnWidth(10) |
| | | @ExcelProperty("预测水位") |
| | | private String yuz; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("预测流量") |
| | | private String yq; |
| | | |
| | | @ExcelProperty("预警水位") |
| | | private String yjsw; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.mountainrain.excel; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springblade.core.excel.support.ExcelImporter; |
| | | import org.springblade.modules.mountainrain.service.IBigriverService; |
| | | import org.springblade.modules.mountainrain.service.IMountainrainService; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户数据导入类 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @RequiredArgsConstructor |
| | | public class BgrImporter implements ExcelImporter<BgrExcel> { |
| | | |
| | | private final IBigriverService service; |
| | | private final Boolean isCovered; |
| | | |
| | | @Override |
| | | public void save(List<BgrExcel> data) { |
| | | service.importBgr(data, isCovered); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.mountainrain.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnore; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
| | | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * UserExcel |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Data |
| | | @ColumnWidth(25) |
| | | @HeadRowHeight(20) |
| | | @ContentRowHeight(18) |
| | | public class MgrExcel implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("河名") |
| | | private String river; |
| | | |
| | | @ExcelProperty("站名") |
| | | private String stname; |
| | | |
| | | @ColumnWidth(20) |
| | | @ExcelProperty("站码") |
| | | private String stcd; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("发布时间") |
| | | private String ftime; |
| | | |
| | | @ColumnWidth(10) |
| | | @ExcelProperty("预测时间") |
| | | private String ytime; |
| | | |
| | | @ColumnWidth(10) |
| | | @ExcelProperty("预测水位") |
| | | private String yuz; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("预测流量") |
| | | private String yq; |
| | | |
| | | @ExcelProperty("预警水位") |
| | | private String yjsw; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.mountainrain.excel; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springblade.core.excel.support.ExcelImporter; |
| | | import org.springblade.modules.mountainrain.service.IMountainrainService; |
| | | import org.springblade.modules.mountainrain.service.ISmariverService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户数据导入类 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @RequiredArgsConstructor |
| | | public class MgrImporter implements ExcelImporter<MgrExcel> { |
| | | |
| | | private final ISmariverService service; |
| | | private final Boolean isCovered; |
| | | |
| | | @Override |
| | | public void save(List<MgrExcel> data) { |
| | | service.importMgr(data, isCovered); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.mountainrain.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springblade.modules.mountainrain.entity.Mountainrain; |
| | | import org.springblade.modules.mountainrain.entity.Yucbig; |
| | | import org.springblade.modules.mountainrain.entity.Yucpptn; |
| | | import org.springblade.modules.mountainrain.vo.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Mapper 接口 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-02-27 |
| | | */ |
| | | public interface BigriverMapper extends BaseMapper<Yucbig> { |
| | | List<Map<String, Object>> selctbgriver(); |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.springblade.modules.mountainrain.mapper.BigriverMapper"> |
| | | |
| | | <!--大江大河--> |
| | | <select id="selctbgriver" resultType="java.util.Map"> |
| | | SELECT cs1.stcd, |
| | | cs1.ftime, |
| | | cs1.ytime, |
| | | cs1.yuz, |
| | | cs1.yjsw, |
| | | cs1.stname, |
| | | cs1.river, |
| | | st.LGTD, |
| | | st.LTTD |
| | | FROM ( |
| | | SELECT A.stcd, |
| | | MAX(A.ftime) TM |
| | | 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 |
| | | ON cs.stcd = cs1.stcd |
| | | INNER JOIN (SELECT LGTD, LTTD, STCD FROM ST_STBPRP_B) st ON st.STCD = cs1.stcd |
| | | </select> |
| | | </mapper> |
| | |
| | | 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> selectcInfosdx(String times, String dateEnd24, String dateEnd1, String dateEnd3, String dateEnd6, String addvnm); |
| | | |
| | |
| | | String selectCode(); |
| | | |
| | | List<Map<String, Object>> selecMone(String times, String dateEnd1, String dateEnd2, String dateEnd3, String code); |
| | | 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); |
| | | |
| | | List<Map<String, Object>> selectMtwo(String time3, String time, String code); |
| | | |
| | | 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>> selectTu(); |
| | | List<Map<String, Object>> selectS(); |
| | | List<MountainrainsCVO> selectYum(); |
| | | |
| | | void soleInster(String stcd, String soilval); |
| | | |
| | |
| | | |
| | | //预报信息新增 |
| | | int insertYuc(@Param("list") List<Yucpptn> list); |
| | | void del(); |
| | | } |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="selectCode" resultType="java.lang.String"> |
| | | SELECT stuff(( |
| | | SELECT ',' + CONVERT(VARCHAR (25), m.cenconding) |
| | | FROM dbo.blade_mountain m |
| | | INNER JOIN ST_STBPRP_B s ON s.STCD = m.cenconding |
| | | GROUP BY m.cenconding FOR XML PATH ('')), |
| | | 1, |
| | | 1, |
| | | '' |
| | | ) AS siteids |
| | | </select> |
| | | <select id="selectCode" resultType="java.lang.String"> |
| | | SELECT stuff(( |
| | | SELECT ',' + CONVERT(VARCHAR (25), m.cenconding) |
| | | FROM dbo.blade_mountain m |
| | | INNER JOIN ST_STBPRP_B s ON s.STCD = m.cenconding |
| | | GROUP BY m.cenconding FOR XML PATH ('')), |
| | | 1, |
| | | 1, |
| | | '' |
| | | ) AS siteids |
| | | </select> |
| | | |
| | | <!-- <select id="selectCode" resultType="java.lang.String">--> |
| | | <!-- SELECT stuff((--> |
| | | <!-- SELECT ',' + CONVERT(VARCHAR (25), cenconding)--> |
| | | <!-- FROM dbo.blade_mountain FOR XML PATH ('')),--> |
| | | <!-- 1,--> |
| | | <!-- 1,--> |
| | | <!-- ''--> |
| | | <!-- ) AS siteids--> |
| | | <!-- </select>--> |
| | | |
| | | <select id="Mountains" resultMap="mountainrainResultMapcInfo"> |
| | | SELECT cs.id, |
| | |
| | | gthours |
| | | FROM blade_mountain |
| | | ) cs ON cs.cenconding = a.STCD |
| | | LEFT JOIN ( |
| | | inner JOIN ( |
| | | SELECT stcd, soilval |
| | | FROM sys_soleval |
| | | ) so ON so.stcd = a.STCD |
| | |
| | | AND strs.STCD IN (${code}) |
| | | GROUP BY STCD |
| | | ) c ON a.STCD = c.STCD |
| | | LEFT JOIN ( |
| | | INNER JOIN ( |
| | | SELECT STCD, |
| | | st.STNM, |
| | | st.ADDVCD, |
| | |
| | | |
| | | |
| | | <!--通过行政区编码查询站点--> |
| | | <select id="selectAddvcd" resultType="java.util.Map" > |
| | | <select id="selectAddvcd" resultType="java.util.Map"> |
| | | SELECT STCD |
| | | FROM dbo.ST_STBPRP_B |
| | | WHERE STTP='RR' AND ADDVCD=#{addvcd} |
| | | WHERE 1=1 |
| | | <if test="addvcd!=null and addvcd!='' and addvcd!='361000'"> |
| | | and ADDVCD = #{addvcd} |
| | | </if> |
| | | AND (STTP = 'PP' |
| | | OR STTP = 'ZQ' |
| | | OR STTP = 'ZZ') |
| | | </select> |
| | | |
| | | <!-- 批量插入预报信息--> |
| | | <insert id ="insertYuc" parameterType="java.util.List" > |
| | | <insert id="insertYuc" parameterType="java.util.List"> |
| | | insert into sys_yucpptn |
| | | (STCD,TM,DRP,INTV) |
| | | values |
| | | <foreach collection ="list" item="item" index= "index" separator =","> |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | | ( |
| | | #{item.STCD},#{item.TM}, |
| | | #{item.DRP}, |
| | | #{item.INTV} |
| | | ) |
| | | </foreach > |
| | | </insert > |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <!--预报雨量站预警--> |
| | | <select id="selectYup" resultType="java.util.Map"> |
| | | SELECT cs.STCD, |
| | | cs.STNM, |
| | | cs.STLC, |
| | | cs.ADDVNM, |
| | | cs.RVNM, |
| | | cs.HNNM, |
| | | cs.LTTD, |
| | | cs.LGTD, |
| | | isnull(a.drp, 0) AS drp, |
| | | a.INTV |
| | | FROM (SELECT str.DRP AS drp, STCD, INTV FROM sys_yucpptn str) a |
| | | LEFT JOIN ( |
| | | SELECT STCD, |
| | | st.STNM, |
| | | st.ADDVCD, |
| | | st.STLC, |
| | | st.LTTD, |
| | | st.LGTD, |
| | | st.RVNM, |
| | | st.HNNM, |
| | | ad.ADDVNM |
| | | FROM dbo.ST_STBPRP_B st |
| | | INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD |
| | | ) cs ON cs.STCD = a.STCD |
| | | </select> |
| | | |
| | | <delete id="del"> |
| | | delete |
| | | from sys_yucpptn |
| | | </delete> |
| | | |
| | | |
| | | <!--第二种预警--> |
| | | <select id="selectYum" resultMap="mountainrainResultMapcInfo"> |
| | | SELECT cs.id, |
| | | cs.cenconding, |
| | | cs.crainfall, |
| | | isnull(cs.gohour, 0) gohour, |
| | | isnull(cs.gthour, 0) gthour, |
| | | isnull(cs.gshour, 0) gshour, |
| | | isnull(cs.imohour, 0) imohour, |
| | | isnull(cs.imthour, 0) imthour, |
| | | isnull(cs.imshour, 0) imshour, |
| | | isnull(cs.gohours, 0) gohours, |
| | | isnull(cs.gthours, 0) gthours, |
| | | a.drp1, |
| | | cs.township, |
| | | cs.village, |
| | | cs.village_group, |
| | | cs.dj, |
| | | cs.bw, |
| | | cs.county, |
| | | isnull(cs.fyear, 0) AS fyear, |
| | | isnull(cs.tyear, 0) AS tyear, |
| | | isnull(cs.oyear, 0) AS oyear, |
| | | isnull(so.soilval, 0) AS soilval |
| | | FROM (SELECT DRP AS drp1, STCD FROM sys_yucpptn) a |
| | | LEFT JOIN ( |
| | | SELECT id, |
| | | cenconding, |
| | | crainfall, |
| | | township, |
| | | village, |
| | | village_group, |
| | | dj, |
| | | bw, |
| | | county, |
| | | fyear, |
| | | tyear, |
| | | oyear, |
| | | gohour, |
| | | gthour, |
| | | gshour, |
| | | imohour, |
| | | imthour, |
| | | imshour, |
| | | gohours, |
| | | gthours |
| | | FROM blade_mountain |
| | | ) cs ON cs.cenconding = a.STCD |
| | | INNER JOIN (SELECT stcd, soilval FROM sys_soleval) so ON so.stcd = a.STCD |
| | | </select> |
| | | |
| | | |
| | | <!--中小河流--> |
| | | <select id="selctsmriver" resultType="java.util.Map"> |
| | | SELECT cs1.STCD, |
| | | cs1.TM, |
| | | cs1.Z, |
| | | sm.yjsw, |
| | | sm.stname, |
| | | sm.river, |
| | | sm.addvnm, |
| | | st.LGTD, |
| | | st.LTTD |
| | | FROM ( |
| | | SELECT A.STCD, |
| | | MAX(A.TM) TM |
| | | FROM (SELECT STCD, TM FROM dbo.ST_RIVER_R where TM > #{dateEnd} AND TM <= #{time}) AS A |
| | | GROUP BY A.STCD |
| | | ) cs |
| | | INNER JOIN (SELECT STCD, TM, Z FROM dbo.ST_RIVER_R where TM > #{dateEnd} AND TM <= #{time}) cs1 |
| | | ON cs.STCD = cs1.STCD |
| | | AND cs.TM = cs1.TM |
| | | 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 |
| | | </select> |
| | | <!--大江大河--> |
| | | <select id="selctbgriver" resultType="java.util.Map"> |
| | | SELECT cs1.STCD, |
| | | cs1.TM, |
| | | cs1.Z, |
| | | sm.yjsw, |
| | | sm.stname, |
| | | sm.river, |
| | | sm.addvnm, |
| | | st.LGTD, |
| | | st.LTTD |
| | | FROM ( |
| | | SELECT A.STCD, |
| | | MAX(A.TM) TM |
| | | FROM (SELECT STCD, TM FROM dbo.ST_RIVER_R where TM > #{dateEnd} AND TM <= #{time}) AS A |
| | | GROUP BY A.STCD |
| | | ) cs |
| | | INNER JOIN (SELECT STCD, TM, Z FROM dbo.ST_RIVER_R where TM > #{dateEnd} AND TM <= #{time}) cs1 |
| | | ON cs.STCD = cs1.STCD |
| | | AND cs.TM = cs1.TM |
| | | 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 |
| | | </select> |
| | | |
| | | |
| | | <select id="selectTu" resultType="java.util.Map"> |
| | | SELECT m.cenconding, |
| | | m.village_group as village, |
| | | m.county, |
| | | isnull(s.soilval, 0) AS soilval |
| | | FROM blade_mountain m |
| | | LEFT JOIN sys_soleval s ON s.stcd = m.cenconding |
| | | GROUP BY m.cenconding, |
| | | s.soilval, |
| | | m.village_group, |
| | | m.county |
| | | </select> |
| | | |
| | | |
| | | <!--山洪1小时预警--> |
| | | <select id="MountainYi" resultMap="mountainrainResultMapcInfo"> |
| | | SELECT cs.id, |
| | | cs.cenconding, |
| | | cs.crainfall, |
| | | isnull(cs.gohour, 0) gohour, |
| | | isnull(cs.gthour, 0) gthour, |
| | | isnull(cs.gshour, 0) gshour, |
| | | isnull(cs.imohour, 0) imohour, |
| | | isnull(cs.imthour, 0) imthour, |
| | | isnull(cs.imshour, 0) imshour, |
| | | isnull(cs.gohours, 0) gohours, |
| | | isnull(cs.gthours, 0) gthours, |
| | | a.drp1, |
| | | cs.township, |
| | | cs.village, |
| | | cs.village_group, |
| | | cs.dj, |
| | | cs.bw, |
| | | cs.county, |
| | | isnull(cs.fyear, 0) as fyear, |
| | | isnull(cs.tyear, 0) as tyear, |
| | | isnull(cs.oyear, 0) as oyear, |
| | | isnull(so.soilval, 0) as soilval |
| | | FROM ( |
| | | SELECT ISNULL(SUM(str.DRP), 0) AS drp1, |
| | | STCD |
| | | FROM dbo.ST_PPTN_R str |
| | | WHERE str.TM > #{dateEnd1} |
| | | AND str.TM <= #{times} |
| | | AND str.STCD IN (${code}) |
| | | GROUP BY str.STCD |
| | | ) a |
| | | LEFT JOIN ( |
| | | SELECT id, |
| | | cenconding, |
| | | crainfall, |
| | | township, |
| | | village, |
| | | village_group, |
| | | dj, |
| | | bw, |
| | | county, |
| | | fyear, |
| | | tyear, |
| | | oyear, |
| | | gohour, |
| | | gthour, |
| | | gshour, |
| | | imohour, |
| | | imthour, |
| | | imshour, |
| | | gohours, |
| | | gthours |
| | | FROM blade_mountain |
| | | ) cs ON cs.cenconding = a.STCD |
| | | LEFT JOIN ( |
| | | SELECT stcd, soilval |
| | | FROM sys_soleval |
| | | ) so ON so.stcd = a.STCD |
| | | </select> |
| | | <!--山洪2小时预警--> |
| | | <select id="MountainTw" resultMap="mountainrainResultMapcInfo"> |
| | | SELECT cs.id, |
| | | cs.cenconding, |
| | | cs.crainfall, |
| | | isnull(cs.gohour, 0) gohour, |
| | | isnull(cs.gthour, 0) gthour, |
| | | isnull(cs.gshour, 0) gshour, |
| | | isnull(cs.imohour, 0) imohour, |
| | | isnull(cs.imthour, 0) imthour, |
| | | isnull(cs.imshour, 0) imshour, |
| | | isnull(cs.gohours, 0) gohours, |
| | | isnull(cs.gthours, 0) gthours, |
| | | a.drp1, |
| | | cs.township, |
| | | cs.village, |
| | | cs.village_group, |
| | | cs.dj, |
| | | cs.bw, |
| | | cs.county, |
| | | isnull(cs.fyear, 0) as fyear, |
| | | isnull(cs.tyear, 0) as tyear, |
| | | isnull(cs.oyear, 0) as oyear, |
| | | isnull(so.soilval, 0) as soilval |
| | | FROM ( |
| | | SELECT ISNULL(SUM(str.DRP), 0) AS drp1, |
| | | STCD |
| | | FROM dbo.ST_PPTN_R str |
| | | WHERE str.TM > #{dateEnd2} |
| | | AND str.TM <= #{times} |
| | | AND str.STCD IN (${code}) |
| | | GROUP BY str.STCD |
| | | ) a |
| | | LEFT JOIN ( |
| | | SELECT id, |
| | | cenconding, |
| | | crainfall, |
| | | township, |
| | | village, |
| | | village_group, |
| | | dj, |
| | | bw, |
| | | county, |
| | | fyear, |
| | | tyear, |
| | | oyear, |
| | | gohour, |
| | | gthour, |
| | | gshour, |
| | | imohour, |
| | | imthour, |
| | | imshour, |
| | | gohours, |
| | | gthours |
| | | FROM blade_mountain |
| | | ) cs ON cs.cenconding = a.STCD |
| | | LEFT JOIN ( |
| | | SELECT stcd, soilval |
| | | FROM sys_soleval |
| | | ) so ON so.stcd = a.STCD |
| | | </select> |
| | | <select id="MountainTr" resultMap="mountainrainResultMapcInfo"> |
| | | SELECT cs.id, |
| | | cs.cenconding, |
| | | cs.crainfall, |
| | | isnull(cs.gohour, 0) gohour, |
| | | isnull(cs.gthour, 0) gthour, |
| | | isnull(cs.gshour, 0) gshour, |
| | | isnull(cs.imohour, 0) imohour, |
| | | isnull(cs.imthour, 0) imthour, |
| | | isnull(cs.imshour, 0) imshour, |
| | | isnull(cs.gohours, 0) gohours, |
| | | isnull(cs.gthours, 0) gthours, |
| | | a.drp1, |
| | | cs.township, |
| | | cs.village, |
| | | cs.village_group, |
| | | cs.dj, |
| | | cs.bw, |
| | | cs.county, |
| | | isnull(cs.fyear, 0) as fyear, |
| | | isnull(cs.tyear, 0) as tyear, |
| | | isnull(cs.oyear, 0) as oyear, |
| | | isnull(so.soilval, 0) as soilval |
| | | FROM ( |
| | | SELECT ISNULL(SUM(str.DRP), 0) AS drp1, |
| | | STCD |
| | | FROM dbo.ST_PPTN_R str |
| | | WHERE str.TM > #{dateEnd3} |
| | | AND str.TM <= #{times} |
| | | AND str.STCD IN (${code}) |
| | | GROUP BY str.STCD |
| | | ) a |
| | | LEFT JOIN ( |
| | | SELECT id, |
| | | cenconding, |
| | | crainfall, |
| | | township, |
| | | village, |
| | | village_group, |
| | | dj, |
| | | bw, |
| | | county, |
| | | fyear, |
| | | tyear, |
| | | oyear, |
| | | gohour, |
| | | gthour, |
| | | gshour, |
| | | imohour, |
| | | imthour, |
| | | imshour, |
| | | gohours, |
| | | gthours |
| | | FROM blade_mountain |
| | | ) cs ON cs.cenconding = a.STCD |
| | | LEFT JOIN ( |
| | | SELECT stcd, soilval |
| | | FROM sys_soleval |
| | | ) so ON so.stcd = a.STCD |
| | | </select> |
| | | |
| | | <!--第一种预警一小时--> |
| | | <select id="selecMoneYi" resultType="java.util.Map"> |
| | | SELECT cs.STCD, |
| | | cs.STNM, |
| | | cs.STLC, |
| | | cs.ADDVNM, |
| | | cs.RVNM, |
| | | cs.HNNM, |
| | | cs.LTTD, |
| | | cs.LGTD, |
| | | isnull(a.drp1, 0) as drp1 |
| | | FROM ( |
| | | SELECT SUM(str.DRP) AS drp1, |
| | | STCD |
| | | FROM dbo.ST_PPTN_R str |
| | | WHERE str.TM > #{dateEnd1} |
| | | AND str.TM <= #{times} |
| | | AND str.STCD IN (${code}) |
| | | GROUP BY str.STCD |
| | | ) a |
| | | INNER JOIN ( |
| | | SELECT STCD, |
| | | st.STNM, |
| | | st.ADDVCD, |
| | | st.STLC, |
| | | st.LTTD, |
| | | st.LGTD, |
| | | st.RVNM, |
| | | st.HNNM, |
| | | ad.ADDVNM |
| | | FROM dbo.ST_STBPRP_B st |
| | | INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD |
| | | ) cs ON cs.STCD = a.STCD |
| | | </select> |
| | | <!--第一种预警两小时--> |
| | | <select id="selecMoneTw" resultType="java.util.Map"> |
| | | SELECT cs.STCD, |
| | | cs.STNM, |
| | | cs.STLC, |
| | | cs.ADDVNM, |
| | | cs.RVNM, |
| | | cs.HNNM, |
| | | cs.LTTD, |
| | | cs.LGTD, |
| | | isnull(a.drp1, 0) as drp1 |
| | | FROM ( |
| | | SELECT SUM(str.DRP) AS drp1, |
| | | STCD |
| | | FROM dbo.ST_PPTN_R str |
| | | WHERE str.TM > #{dateEnd2} |
| | | AND str.TM <= #{times} |
| | | AND str.STCD IN (${code}) |
| | | GROUP BY str.STCD |
| | | ) a |
| | | INNER JOIN ( |
| | | SELECT STCD, |
| | | st.STNM, |
| | | st.ADDVCD, |
| | | st.STLC, |
| | | st.LTTD, |
| | | st.LGTD, |
| | | st.RVNM, |
| | | st.HNNM, |
| | | ad.ADDVNM |
| | | FROM dbo.ST_STBPRP_B st |
| | | INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD |
| | | ) cs ON cs.STCD = a.STCD |
| | | </select> |
| | | <select id="selecMoneTr" resultType="java.util.Map"> |
| | | SELECT cs.STCD, |
| | | cs.STNM, |
| | | cs.STLC, |
| | | cs.ADDVNM, |
| | | cs.RVNM, |
| | | cs.HNNM, |
| | | cs.LTTD, |
| | | cs.LGTD, |
| | | isnull(a.drp1, 0) as drp1 |
| | | FROM ( |
| | | SELECT SUM(str.DRP) AS drp1, |
| | | STCD |
| | | FROM dbo.ST_PPTN_R str |
| | | WHERE str.TM > #{dateEnd3} |
| | | AND str.TM <= #{times} |
| | | AND str.STCD IN (${code}) |
| | | GROUP BY str.STCD |
| | | ) a |
| | | INNER JOIN ( |
| | | SELECT STCD, |
| | | st.STNM, |
| | | st.ADDVCD, |
| | | st.STLC, |
| | | st.LTTD, |
| | | st.LGTD, |
| | | st.RVNM, |
| | | st.HNNM, |
| | | ad.ADDVNM |
| | | FROM dbo.ST_STBPRP_B st |
| | | INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD |
| | | ) cs ON cs.STCD = a.STCD |
| | | </select> |
| | | |
| | | |
| | | <!--土壤色斑图--> |
| | | <select id="selectS" resultType="java.util.Map"> |
| | | SELECT |
| | | so.stcd, |
| | | so.soilval, |
| | | st.LGTD, |
| | | st.LTTD |
| | | FROM |
| | | sys_soleval so |
| | | INNER JOIN dbo.ST_STBPRP_B st ON so.stcd= st.STCD |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.mountainrain.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.springblade.modules.mountainrain.entity.Yucbig; |
| | | import org.springblade.modules.mountainrain.entity.Yucsma; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Mapper 接口 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-02-27 |
| | | */ |
| | | public interface SmariverMapper extends BaseMapper<Yucsma> { |
| | | List<Map<String, Object>> selctsmriver(); |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.springblade.modules.mountainrain.mapper.BigriverMapper"> |
| | | |
| | | <!--中小河流--> |
| | | <select id="selctsmriver" resultType="java.util.Map"> |
| | | SELECT cs1.stcd, |
| | | cs1.ftime, |
| | | cs1.ytime, |
| | | cs1.yuz, |
| | | cs1.yjsw, |
| | | cs1.stname, |
| | | cs1.river, |
| | | st.LGTD, |
| | | st.LTTD |
| | | FROM ( |
| | | SELECT A.stcd, |
| | | MAX(A.ftime) TM |
| | | 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 |
| | | ON cs.stcd = cs1.stcd |
| | | INNER JOIN (SELECT LGTD, LTTD, STCD FROM ST_STBPRP_B) st ON st.STCD = cs1.stcd |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.mountainrain.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.modules.mountainrain.entity.Mountainrain; |
| | | import org.springblade.modules.mountainrain.entity.Yucbig; |
| | | import org.springblade.modules.mountainrain.entity.Yucpptn; |
| | | import org.springblade.modules.mountainrain.excel.BgrExcel; |
| | | import org.springblade.modules.mountainrain.excel.MgrExcel; |
| | | import org.springblade.modules.mountainrain.vo.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 服务类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-02-27 |
| | | */ |
| | | public interface IBigriverService extends IService<Yucbig> { |
| | | /** |
| | | * 导入用户数据 |
| | | * |
| | | * @param data |
| | | * @param isCovered |
| | | * @return |
| | | */ |
| | | void importBgr(List<BgrExcel> data, Boolean isCovered); |
| | | List<Map<String, Object>> selctbgriver(); |
| | | } |
| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.modules.mountainrain.entity.Mountainrain; |
| | | import org.springblade.modules.mountainrain.entity.Yucpptn; |
| | | import org.springblade.modules.mountainrain.excel.BgrExcel; |
| | | import org.springblade.modules.mountainrain.excel.MgrExcel; |
| | | import org.springblade.modules.mountainrain.vo.*; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | |
| | | void soildel(); |
| | | //预报信息新增 |
| | | 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>> 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); |
| | | List<Map<String, Object>> selectTu(); |
| | | List<Map<String, Object>> selectS(); |
| | | void del(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.mountainrain.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.mountainrain.entity.Yucbig; |
| | | import org.springblade.modules.mountainrain.entity.Yucsma; |
| | | import org.springblade.modules.mountainrain.excel.BgrExcel; |
| | | import org.springblade.modules.mountainrain.excel.MgrExcel; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 服务类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-02-27 |
| | | */ |
| | | public interface ISmariverService extends IService<Yucsma> { |
| | | void importMgr(List<MgrExcel> data, Boolean isCovered); |
| | | List<Map<String, Object>> selctsmriver(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.mountainrain.service.impl; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.mountain.entity.Mountain; |
| | | import org.springblade.modules.mountain.service.IMountainService; |
| | | import org.springblade.modules.mountainrain.entity.Mountainrain; |
| | | import org.springblade.modules.mountainrain.entity.Yucbig; |
| | | import org.springblade.modules.mountainrain.entity.Yucpptn; |
| | | import org.springblade.modules.mountainrain.excel.BgrExcel; |
| | | import org.springblade.modules.mountainrain.excel.MgrExcel; |
| | | import org.springblade.modules.mountainrain.mapper.BigriverMapper; |
| | | import org.springblade.modules.mountainrain.mapper.MountainrainMapper; |
| | | import org.springblade.modules.mountainrain.service.IBigriverService; |
| | | import org.springblade.modules.mountainrain.service.IMountainrainService; |
| | | import org.springblade.modules.mountainrain.vo.*; |
| | | import org.springblade.modules.mountainrain.wrapper.MountainrainWrapper; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.InputStream; |
| | | import java.text.DecimalFormat; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-02-27 |
| | | */ |
| | | @Service |
| | | @DS("slaves") |
| | | public class BigriverServiceImpl extends ServiceImpl<BigriverMapper, Yucbig> implements IBigriverService { |
| | | |
| | | @Autowired |
| | | private IBigriverService iBigriverService; |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importBgr(List<BgrExcel> data, Boolean isCovered) { |
| | | data.forEach(BgrExcel -> { |
| | | Yucbig yucbig = Objects.requireNonNull(BeanUtil.copy(BgrExcel, Yucbig.class)); |
| | | iBigriverService.save(yucbig); |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selctbgriver() { |
| | | return baseMapper.selctbgriver(); |
| | | } |
| | | } |
| | |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springblade.common.cache.DictCache; |
| | | import org.springblade.common.cache.ParamCache; |
| | | import org.springblade.common.cache.SysCache; |
| | | import org.springblade.common.cache.UserCache; |
| | | import org.springblade.common.enums.DictEnum; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springblade.modules.mountain.entity.Mountain; |
| | | import org.springblade.modules.mountain.service.IMountainService; |
| | | import org.springblade.modules.mountainrain.entity.Mountainrain; |
| | | import org.springblade.modules.mountainrain.entity.Yucpptn; |
| | | import org.springblade.modules.mountainrain.excel.BgrExcel; |
| | | import org.springblade.modules.mountainrain.excel.MgrExcel; |
| | | import org.springblade.modules.mountainrain.mapper.MountainrainMapper; |
| | | import org.springblade.modules.mountainrain.service.IMountainrainService; |
| | | import org.springblade.modules.mountainrain.vo.*; |
| | | import org.springblade.modules.mountainrain.wrapper.MountainrainWrapper; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.InputStream; |
| | | import java.text.DecimalFormat; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | import static org.springblade.common.constant.CommonConstant.DEFAULT_PARAM_PASSWORD; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | |
| | | return baseMapper.insertYuc(yucpptnList); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectYup() { |
| | | return baseMapper.selectYup(); |
| | | } |
| | | |
| | | @Override |
| | | public List<MountainrainsCVO> selectYum() { |
| | | return baseMapper.selectYum(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selctsmriver(String time,String dateEnd) { |
| | | return baseMapper.selctsmriver(time, dateEnd); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selctbgriver(String time,String dateEnd) { |
| | | return baseMapper.selctbgriver(time, dateEnd); |
| | | } |
| | | |
| | | @Override |
| | | public List<MountainrainsCVO> MountainYi(String times, String dateEnd1, String code) { |
| | | return baseMapper.MountainYi(times, dateEnd1, code); |
| | | } |
| | | |
| | | @Override |
| | | public List<MountainrainsCVO> MountainTw(String times, String dateEnd2, String code) { |
| | | return baseMapper.MountainTw(times, dateEnd2, code); |
| | | } |
| | | |
| | | @Override |
| | | public List<MountainrainsCVO> MountainTr(String times, String dateEnd3, String code) { |
| | | return baseMapper.MountainTr(times, dateEnd3, code); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selecMoneYi(String times, String dateEnd1, String code) { |
| | | return baseMapper.selecMoneYi(times, dateEnd1, code); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selecMoneTw(String times, String dateEnd2, String code) { |
| | | return baseMapper.selecMoneTw(times, dateEnd2, code); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selecMoneTr(String times, String dateEnd3, String code) { |
| | | return baseMapper.selecMoneTr(times, dateEnd3, code); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectTu() { |
| | | return baseMapper.selectTu(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectS() { |
| | | return baseMapper.selectS(); |
| | | } |
| | | |
| | | @Override |
| | | public void del() { |
| | | baseMapper.del(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importMgr(List<MgrExcel> data, Boolean isCovered) { |
| | | data.forEach(MgrExcel -> { |
| | | User user = Objects.requireNonNull(BeanUtil.copy(MgrExcel, User.class)); |
| | | }); |
| | | } |
| | | |
| | | |
| | | /* |
| | | * 计算最大值 |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.mountainrain.service.impl; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.mountainrain.entity.Yucbig; |
| | | import org.springblade.modules.mountainrain.entity.Yucsma; |
| | | import org.springblade.modules.mountainrain.excel.BgrExcel; |
| | | import org.springblade.modules.mountainrain.excel.MgrExcel; |
| | | import org.springblade.modules.mountainrain.mapper.BigriverMapper; |
| | | import org.springblade.modules.mountainrain.mapper.SmariverMapper; |
| | | import org.springblade.modules.mountainrain.service.IBigriverService; |
| | | import org.springblade.modules.mountainrain.service.ISmariverService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-02-27 |
| | | */ |
| | | @Service |
| | | @DS("slaves") |
| | | public class SmariverServiceImpl extends ServiceImpl<SmariverMapper, Yucsma> implements ISmariverService { |
| | | |
| | | |
| | | @Autowired |
| | | private ISmariverService iSmariverService; |
| | | |
| | | @Override |
| | | public void importMgr(List<MgrExcel> data, Boolean isCovered) { |
| | | data.forEach(MgrExcel -> { |
| | | Yucsma yucsma = Objects.requireNonNull(BeanUtil.copy(MgrExcel, Yucsma.class)); |
| | | iSmariverService.save(yucsma); |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selctsmriver() { |
| | | return baseMapper.selctsmriver(); |
| | | } |
| | | } |
| New file |
| | |
| | | package org.springblade.modules.mountainrain.vo; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.modules.mountain.entity.Mountain; |
| | | import org.springblade.modules.mountainrain.entity.Yucbig; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class BigriverVO extends Yucbig { |
| | | } |
| New file |
| | |
| | | package org.springblade.modules.mountainrain.vo; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.modules.mountainrain.entity.Yucbig; |
| | | import org.springblade.modules.mountainrain.entity.Yucsma; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class SmariverVO extends Yucsma { |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.mountainrain.wrapper; |
| | | |
| | | import org.springblade.core.mp.support.BaseEntityWrapper; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.mountainrain.entity.Mountainrain; |
| | | import org.springblade.modules.mountainrain.entity.Yucbig; |
| | | import org.springblade.modules.mountainrain.vo.BigriverVO; |
| | | import org.springblade.modules.mountainrain.vo.MountainrainVO; |
| | | |
| | | /** |
| | | * 包装类,返回视图层所需的字段 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-02-27 |
| | | */ |
| | | public class BigriverWrapper extends BaseEntityWrapper<Yucbig, BigriverVO> { |
| | | |
| | | public static BigriverWrapper build() { |
| | | return new BigriverWrapper(); |
| | | } |
| | | |
| | | @Override |
| | | public BigriverVO entityVO(Yucbig yucbig) { |
| | | BigriverVO bigriverVO = BeanUtil.copy(yucbig, BigriverVO.class); |
| | | |
| | | return bigriverVO; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.mountainrain.wrapper; |
| | | |
| | | import org.springblade.core.mp.support.BaseEntityWrapper; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.mountainrain.entity.Yucbig; |
| | | import org.springblade.modules.mountainrain.entity.Yucsma; |
| | | import org.springblade.modules.mountainrain.vo.BigriverVO; |
| | | import org.springblade.modules.mountainrain.vo.SmariverVO; |
| | | |
| | | /** |
| | | * 包装类,返回视图层所需的字段 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-02-27 |
| | | */ |
| | | public class SmariverWrapper extends BaseEntityWrapper<Yucsma, SmariverVO> { |
| | | |
| | | public static SmariverWrapper build() { |
| | | return new SmariverWrapper(); |
| | | } |
| | | |
| | | @Override |
| | | public SmariverVO entityVO(Yucsma yucsma) { |
| | | SmariverVO smariverVO = BeanUtil.copy(yucsma, SmariverVO.class); |
| | | |
| | | return smariverVO; |
| | | } |
| | | |
| | | } |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.*; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Map.Entry; |
| | | |
| | |
| | | return R.data(tree); |
| | | } |
| | | |
| | | /** |
| | | * 面降雨量 |
| | | */ |
| | | @GetMapping("/selectReM") |
| | | public R selectReM(String beginTime, String endTime) { |
| | | String substring = beginTime.substring(0, 10); |
| | | String r = beginTime.substring(11, 13); |
| | | //截取月日 |
| | | String[] strs = substring.split("-"); |
| | | //月 |
| | | String year = strs[1].toString(); |
| | | //日 |
| | | String day = strs[2].toString(); |
| | | String substrings = endTime.substring(0, 10); |
| | | String rs = endTime.substring(11, 13); |
| | | //截取月日 |
| | | String[] strss = substrings.split("-"); |
| | | //月 |
| | | String years = strss[1].toString(); |
| | | //日 |
| | | String days = strss[2].toString(); |
| | | String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时"; |
| | | //最新雨量值 |
| | | List<Map<String, Object>> map = regionWeightService.selectReM(beginTime, endTime); |
| | | List<Map<String, Object>> mapAll = regionWeightService.selectAll(); |
| | | //权重值 |
| | | List<Map<String, Object>> list = regionWeightService.selectWeight(); |
| | | Map map1 = new HashMap(); |
| | | Map mapc = new HashMap(); |
| | | List<Map<String, Object>> list1 = new ArrayList<Map<String, Object>>(); |
| | | List<Map<String, Object>> lists = new ArrayList<Map<String, Object>>(); |
| | | List<Map<String, Object>> listc = new ArrayList<Map<String, Object>>(); |
| | | double v = 0; |
| | | //统计抚州市雨量 |
| | | Double num = 0.0; |
| | | String region_code = null; |
| | | if (map.size() == 0) { |
| | | List<Map<String, Object>> l = new ArrayList<Map<String, Object>>(); |
| | | List<Map<String, Object>> m = new ArrayList<Map<String, Object>>(); |
| | | mapc.put("List", l); |
| | | mapc.put("Num", m); |
| | | mapc.put("text", yday + "暂无降雨信息。"); |
| | | lists.add(mapc); |
| | | } else { |
| | | for (int i = 0; i < map.size(); i++) { |
| | | region_code = map.get(i).get("REGION_CODE").toString(); |
| | | //获取行政区编码 |
| | | if (i != 0) { |
| | | String region_code1 = map.get(i - 1).get("REGION_CODE").toString(); |
| | | if (!region_code.equals(region_code1)) { |
| | | map1.put("id", region_code1); |
| | | map1.put("value", v); |
| | | list1.add(map1); |
| | | v = 0; |
| | | map1 = new HashMap(); |
| | | for (int j = 0; j < list.size(); j++) { |
| | | if (region_code.equals(list.get(j).get("STATION_CODE").toString())) { |
| | | BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP"); |
| | | double drp = bigDecimaldrp.floatValue(); |
| | | String weight1 = map.get(i).get("WEIGHT").toString(); |
| | | float weight = Float.parseFloat(weight1); |
| | | v += drp * weight; |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | for (int j = 0; j < list.size(); j++) { |
| | | if (region_code.equals(list.get(j).get("STATION_CODE").toString())) { |
| | | BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP"); |
| | | double drp = bigDecimaldrp.floatValue(); |
| | | String weight1 = map.get(i).get("WEIGHT").toString(); |
| | | float weight = Float.parseFloat(weight1); |
| | | System.out.println(Math.round(drp)); |
| | | v += drp * weight; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | for (int j = 0; j < list.size(); j++) { |
| | | if (region_code.equals(list.get(j).get("STATION_CODE").toString())) { |
| | | BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP"); |
| | | double drp = bigDecimaldrp.floatValue(); |
| | | String weight1 = map.get(i).get("WEIGHT").toString(); |
| | | float weight = Float.parseFloat(weight1); |
| | | System.out.println(Math.round(drp)); |
| | | v += drp * weight; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | map1.put("id", region_code); |
| | | map1.put("value", v); |
| | | list1.add(map1); |
| | | Map<String, Object> result1 = new HashMap<String, Object>(); |
| | | //县/区面雨量值 |
| | | for (Map<String, Object> maps : list1) { |
| | | String id = maps.get("id").toString(); |
| | | Double value = Double.parseDouble(maps.get("value").toString()); |
| | | if (result1.containsKey(id)) { |
| | | Double temp = Double.parseDouble(result1.get(id).toString()); |
| | | value += temp; |
| | | } |
| | | result1.put(id, value); |
| | | } |
| | | //计算市的面雨量 |
| | | for (String k : result1.keySet()) { |
| | | for (int c = 0; c < list.size(); c++) { |
| | | if (k.equals(list.get(c).get("STATION_CODE").toString())) { |
| | | String s = result1.get(k).toString(); |
| | | Double w = Double.parseDouble(s); |
| | | String weight = list.get(c).get("WEIGHT").toString(); |
| | | Double weights = Double.parseDouble(weight); |
| | | double v1 = w * weights; |
| | | num += v1; |
| | | } else { |
| | | continue; |
| | | } |
| | | |
| | | } |
| | | } |
| | | // 排序 |
| | | List<Map.Entry<String, Object>> entryList2 = new ArrayList<Map.Entry<String, Object>>(result1.entrySet()); |
| | | Collections.sort(entryList2, new Comparator<Map.Entry<String, Object>>() { |
| | | @Override |
| | | public int compare(Entry<String, Object> me1, Entry<String, Object> me2) { |
| | | return me2.getValue().toString().compareTo(me1.getValue().toString()); // 升序排序 |
| | | } |
| | | }); |
| | | //拼接前3位降雨最大的区域 |
| | | double v3 = (double) Math.round(num * 10) / 10; |
| | | String text = "全市日平均降雨量:" + v3 + "毫米。 "; |
| | | String text1 = "县市区平均降雨量前3位为: "; |
| | | String tx = ""; |
| | | for (int i = 0; i < entryList2.size(); i++) { |
| | | Map mapa = new HashMap(); |
| | | String codes = entryList2.get(i).getKey(); |
| | | String values = entryList2.get(i).getValue().toString(); |
| | | Double a = Double.parseDouble(values); |
| | | double as = (double) Math.round(a * 10) / 10; |
| | | for (int j = 0; j < list.size(); j++) { |
| | | if (codes.equals(list.get(j).get("STATION_CODE").toString())) { |
| | | String station_name = list.get(j).get("STATION_NAME").toString(); |
| | | mapa.put("region", station_name); |
| | | mapa.put("dyp", as); |
| | | listc.add(mapa); |
| | | if (i < 3) { |
| | | tx += station_name + "降雨量为:" + as + "毫米,"; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | mapc.put("List", listc); |
| | | mapc.put("Num", mapAll); |
| | | mapc.put("text", yday + text); |
| | | lists.add(mapc); |
| | | } |
| | | return R.data(lists); |
| | | } |
| | | // /** |
| | | // * 面降雨量 |
| | | // */ |
| | | // @GetMapping("/selectReM") |
| | | // public R selectReM(String beginTime, String endTime) { |
| | | // String substring = beginTime.substring(0, 10); |
| | | // String r = beginTime.substring(11, 13); |
| | | // //截取月日 |
| | | // String[] strs = substring.split("-"); |
| | | // //月 |
| | | // String year = strs[1].toString(); |
| | | // //日 |
| | | // String day = strs[2].toString(); |
| | | // String substrings = endTime.substring(0, 10); |
| | | // String rs = endTime.substring(11, 13); |
| | | // //截取月日 |
| | | // String[] strss = substrings.split("-"); |
| | | // //月 |
| | | // String years = strss[1].toString(); |
| | | // //日 |
| | | // String days = strss[2].toString(); |
| | | // String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时"; |
| | | // //最新雨量值 |
| | | // List<Map<String, Object>> map = regionWeightService.selectReM(beginTime, endTime); |
| | | // List<Map<String, Object>> mapAll = regionWeightService.selectAll(); |
| | | // //权重值 |
| | | // List<Map<String, Object>> list = regionWeightService.selectWeight(); |
| | | // Map map1 = new HashMap(); |
| | | // Map mapc = new HashMap(); |
| | | // List<Map<String, Object>> list1 = new ArrayList<Map<String, Object>>(); |
| | | // List<Map<String, Object>> lists = new ArrayList<Map<String, Object>>(); |
| | | // List<Map<String, Object>> listc = new ArrayList<Map<String, Object>>(); |
| | | // double v = 0; |
| | | // //统计抚州市雨量 |
| | | // Double num = 0.0; |
| | | // String region_code = null; |
| | | // if (map.size() == 0) { |
| | | // List<Map<String, Object>> l = new ArrayList<Map<String, Object>>(); |
| | | // List<Map<String, Object>> m = new ArrayList<Map<String, Object>>(); |
| | | // mapc.put("List", l); |
| | | // mapc.put("Num", m); |
| | | // mapc.put("text", yday + "暂无降雨信息。"); |
| | | // lists.add(mapc); |
| | | // } else { |
| | | // for (int i = 0; i < map.size(); i++) { |
| | | // region_code = map.get(i).get("REGION_CODE").toString(); |
| | | // //获取行政区编码 |
| | | // if (i != 0) { |
| | | // String region_code1 = map.get(i - 1).get("REGION_CODE").toString(); |
| | | // if (!region_code.equals(region_code1)) { |
| | | // map1.put("id", region_code1); |
| | | // map1.put("value", v); |
| | | // list1.add(map1); |
| | | // v = 0; |
| | | // map1 = new HashMap(); |
| | | // for (int j = 0; j < list.size(); j++) { |
| | | // if (region_code.equals(list.get(j).get("STATION_CODE").toString())) { |
| | | // BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP"); |
| | | // double drp = bigDecimaldrp.floatValue(); |
| | | // String weight1 = map.get(i).get("WEIGHT").toString(); |
| | | // float weight = Float.parseFloat(weight1); |
| | | // v += drp * weight; |
| | | // break; |
| | | // } |
| | | // } |
| | | // } else { |
| | | // for (int j = 0; j < list.size(); j++) { |
| | | // if (region_code.equals(list.get(j).get("STATION_CODE").toString())) { |
| | | // BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP"); |
| | | // double drp = bigDecimaldrp.floatValue(); |
| | | // String weight1 = map.get(i).get("WEIGHT").toString(); |
| | | // float weight = Float.parseFloat(weight1); |
| | | // System.out.println(Math.round(drp)); |
| | | // v += drp * weight; |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // } else { |
| | | // for (int j = 0; j < list.size(); j++) { |
| | | // if (region_code.equals(list.get(j).get("STATION_CODE").toString())) { |
| | | // BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP"); |
| | | // double drp = bigDecimaldrp.floatValue(); |
| | | // String weight1 = map.get(i).get("WEIGHT").toString(); |
| | | // float weight = Float.parseFloat(weight1); |
| | | // System.out.println(Math.round(drp)); |
| | | // v += drp * weight; |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // map1.put("id", region_code); |
| | | // map1.put("value", v); |
| | | // list1.add(map1); |
| | | // Map<String, Object> result1 = new HashMap<String, Object>(); |
| | | // //县/区面雨量值 |
| | | // for (Map<String, Object> maps : list1) { |
| | | // String id = maps.get("id").toString(); |
| | | // Double value = Double.parseDouble(maps.get("value").toString()); |
| | | // if (result1.containsKey(id)) { |
| | | // Double temp = Double.parseDouble(result1.get(id).toString()); |
| | | // value += temp; |
| | | // } |
| | | // result1.put(id, value); |
| | | // } |
| | | // //计算市的面雨量 |
| | | // for (String k : result1.keySet()) { |
| | | // for (int c = 0; c < list.size(); c++) { |
| | | // if (k.equals(list.get(c).get("STATION_CODE").toString())) { |
| | | // String s = result1.get(k).toString(); |
| | | // Double w = Double.parseDouble(s); |
| | | // String weight = list.get(c).get("WEIGHT").toString(); |
| | | // Double weights = Double.parseDouble(weight); |
| | | // double v1 = w * weights; |
| | | // num += v1; |
| | | // } else { |
| | | // continue; |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | // // 排序 |
| | | // List<Map.Entry<String, Object>> entryList2 = new ArrayList<Map.Entry<String, Object>>(result1.entrySet()); |
| | | // Collections.sort(entryList2, new Comparator<Map.Entry<String, Object>>() { |
| | | // @Override |
| | | // public int compare(Entry<String, Object> me1, Entry<String, Object> me2) { |
| | | // return me2.getValue().toString().compareTo(me1.getValue().toString()); // 升序排序 |
| | | // } |
| | | // }); |
| | | // //拼接前3位降雨最大的区域 |
| | | // double v3 = (double) Math.round(num * 10) / 10; |
| | | // String text = "全市日平均降雨量:" + v3 + "毫米。 "; |
| | | // String text1 = "县市区平均降雨量前3位为: "; |
| | | // String tx = ""; |
| | | // for (int i = 0; i < entryList2.size(); i++) { |
| | | // Map mapa = new HashMap(); |
| | | // String codes = entryList2.get(i).getKey(); |
| | | // String values = entryList2.get(i).getValue().toString(); |
| | | // Double a = Double.parseDouble(values); |
| | | // double as = (double) Math.round(a * 10) / 10; |
| | | // for (int j = 0; j < list.size(); j++) { |
| | | // if (codes.equals(list.get(j).get("STATION_CODE").toString())) { |
| | | // String station_name = list.get(j).get("STATION_NAME").toString(); |
| | | // mapa.put("region", station_name); |
| | | // mapa.put("dyp", as); |
| | | // listc.add(mapa); |
| | | // if (i < 3) { |
| | | // tx += station_name + "降雨量为:" + as + "毫米,"; |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | // mapc.put("List", listc); |
| | | // mapc.put("Num", mapAll); |
| | | // mapc.put("text", yday + text); |
| | | // lists.add(mapc); |
| | | // } |
| | | // return R.data(lists); |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * 点降雨量(时段降雨,自定义降雨) |
| | | * |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | @GetMapping("/selectReD") |
| | | public R selectReD(String beginTime, String endTime) { |
| | | String substring = beginTime.substring(0, 10); |
| | | String r = beginTime.substring(11, 13); |
| | | //截取月日 |
| | | String[] strs = substring.split("-"); |
| | | //月 |
| | | String year = strs[1].toString(); |
| | | //日 |
| | | String day = strs[2].toString(); |
| | | String substrings = endTime.substring(0, 10); |
| | | String rs = endTime.substring(11, 13); |
| | | //截取月日 |
| | | String[] strss = substrings.split("-"); |
| | | //月 |
| | | String years = strss[1].toString(); |
| | | //日 |
| | | String days = strss[2].toString(); |
| | | List<Map<String, Object>> maps = regionWeightService.selectYjs(beginTime, endTime); |
| | | List<Map<String, Object>> lists = new ArrayList<>(); |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | String text = ""; |
| | | String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时。"; |
| | | //0-10降雨量范围 |
| | | List lista = new ArrayList<>(); |
| | | //10-25降雨量范围 |
| | | List listb = new ArrayList<>(); |
| | | //25-50降雨量范围 |
| | | List listc = new ArrayList<>(); |
| | | //50-100降雨量范围 |
| | | List listd = new ArrayList<>(); |
| | | //100-250降雨量范围 |
| | | List liste = new ArrayList<>(); |
| | | //250降雨量范围 |
| | | List listf = new ArrayList<>(); |
| | | for (int i = 0; i < maps.size(); i++) { |
| | | if (i < 3) { |
| | | String addvnm = maps.get(i).get("ADDVNM").toString(); |
| | | String stnm = maps.get(i).get("STNM").toString(); |
| | | BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量 |
| | | double dyp = bigDecimaldyp.doubleValue(); |
| | | if (dyp > 0 && dyp <= 10) { |
| | | lista.add(maps.get(i)); |
| | | } else if (dyp > 10 && dyp <= 25) { |
| | | listb.add(maps.get(i)); |
| | | } else if (dyp > 25 && dyp <= 50) { |
| | | listc.add(maps.get(i)); |
| | | } else if (dyp > 50 && dyp <= 100) { |
| | | listd.add(maps.get(i)); |
| | | } else if (dyp > 100 && dyp <= 250) { |
| | | liste.add(maps.get(i)); |
| | | } else if (dyp > 250) { |
| | | listf.add(maps.get(i)); |
| | | } |
| | | text += stnm + "站" + dyp + "毫米,"; |
| | | } else { |
| | | BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量 |
| | | double dyp = bigDecimaldyp.doubleValue(); |
| | | if (dyp > 0 && dyp <= 10) { |
| | | lista.add(maps.get(i)); |
| | | } else if (dyp > 10 && dyp <= 25) { |
| | | listb.add(maps.get(i)); |
| | | } else if (dyp > 25 && dyp <= 50) { |
| | | listc.add(maps.get(i)); |
| | | } else if (dyp > 50 && dyp <= 100) { |
| | | listd.add(maps.get(i)); |
| | | } else if (dyp > 100 && dyp <= 250) { |
| | | liste.add(maps.get(i)); |
| | | } else if (dyp > 250) { |
| | | listf.add(maps.get(i)); |
| | | } |
| | | } |
| | | } |
| | | //0-10 |
| | | map.put("one", lista); |
| | | //10-25 |
| | | map.put("two", listb); |
| | | //25-50 |
| | | map.put("three", listc); |
| | | //50-100 |
| | | map.put("four", listd); |
| | | //100-250 |
| | | map.put("five", liste); |
| | | //250 |
| | | map.put("six", listf); |
| | | String a = ""; |
| | | if (maps.size() == 0) { |
| | | a = yday + "暂无降雨信息。"; |
| | | } else { |
| | | a = yday + "站点最大降雨量前3位为:" + text.substring(0, text.length() - 1) + "。"; |
| | | } |
| | | 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++) { |
| | | // 第四步,创建单元格,并设置值 |
| | | 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()); |
| | | } |
| | | // 第六步,将文件存到指定位置 |
| | | try { |
| | | fileName = "D:/pptnd.xlsx"; |
| | | FileOutputStream fout = new FileOutputStream(fileName); |
| | | wb.write(fout); |
| | | fout.close(); |
| | | wb.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Process proc; |
| | | try { |
| | | proc = Runtime.getRuntime().exec("python D:\\fz\\fz.py"); |
| | | 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(); |
| | | } |
| | | return R.data(lists); |
| | | } |
| | | |
| | | // /** |
| | | // * 点降雨量(时段降雨,自定义降雨) |
| | | // * |
| | | // * @param beginTime |
| | | // * @param endTime |
| | | // * @return |
| | | // */ |
| | | // @GetMapping("/selectReD") |
| | | // public R selectReD(String beginTime, String endTime) { |
| | | // String substring = beginTime.substring(0, 10); |
| | | // String r = beginTime.substring(11, 13); |
| | | // //截取月日 |
| | | // String[] strs = substring.split("-"); |
| | | // //月 |
| | | // String year = strs[1].toString(); |
| | | // //日 |
| | | // String day = strs[2].toString(); |
| | | // String substrings = endTime.substring(0, 10); |
| | | // String rs = endTime.substring(11, 13); |
| | | // //截取月日 |
| | | // String[] strss = substrings.split("-"); |
| | | // //月 |
| | | // String years = strss[1].toString(); |
| | | // //日 |
| | | // String days = strss[2].toString(); |
| | | // List<Map<String, Object>> maps = regionWeightService.selectYjs(beginTime, endTime); |
| | | // List<Map<String, Object>> lists = new ArrayList<>(); |
| | | // Map<String, Object> map = new HashMap<String, Object>(); |
| | | // String text = ""; |
| | | // String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时。"; |
| | | // //0-10降雨量范围 |
| | | // List lista = new ArrayList<>(); |
| | | // //10-25降雨量范围 |
| | | // List listb = new ArrayList<>(); |
| | | // //25-50降雨量范围 |
| | | // List listc = new ArrayList<>(); |
| | | // //50-100降雨量范围 |
| | | // List listd = new ArrayList<>(); |
| | | // //100-250降雨量范围 |
| | | // List liste = new ArrayList<>(); |
| | | // //250降雨量范围 |
| | | // List listf = new ArrayList<>(); |
| | | // for (int i = 0; i < maps.size(); i++) { |
| | | // if (i < 3) { |
| | | // String addvnm = maps.get(i).get("ADDVNM").toString(); |
| | | // String stnm = maps.get(i).get("STNM").toString(); |
| | | // BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量 |
| | | // double dyp = bigDecimaldyp.doubleValue(); |
| | | // if (dyp > 0 && dyp <= 10) { |
| | | // lista.add(maps.get(i)); |
| | | // } else if (dyp > 10 && dyp <= 25) { |
| | | // listb.add(maps.get(i)); |
| | | // } else if (dyp > 25 && dyp <= 50) { |
| | | // listc.add(maps.get(i)); |
| | | // } else if (dyp > 50 && dyp <= 100) { |
| | | // listd.add(maps.get(i)); |
| | | // } else if (dyp > 100 && dyp <= 250) { |
| | | // liste.add(maps.get(i)); |
| | | // } else if (dyp > 250) { |
| | | // listf.add(maps.get(i)); |
| | | // } |
| | | // text += stnm + "站" + dyp + "毫米,"; |
| | | // } else { |
| | | // BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量 |
| | | // double dyp = bigDecimaldyp.doubleValue(); |
| | | // if (dyp > 0 && dyp <= 10) { |
| | | // lista.add(maps.get(i)); |
| | | // } else if (dyp > 10 && dyp <= 25) { |
| | | // listb.add(maps.get(i)); |
| | | // } else if (dyp > 25 && dyp <= 50) { |
| | | // listc.add(maps.get(i)); |
| | | // } else if (dyp > 50 && dyp <= 100) { |
| | | // listd.add(maps.get(i)); |
| | | // } else if (dyp > 100 && dyp <= 250) { |
| | | // liste.add(maps.get(i)); |
| | | // } else if (dyp > 250) { |
| | | // listf.add(maps.get(i)); |
| | | // } |
| | | // } |
| | | // } |
| | | // //0-10 |
| | | // map.put("one", lista); |
| | | // //10-25 |
| | | // map.put("two", listb); |
| | | // //25-50 |
| | | // map.put("three", listc); |
| | | // //50-100 |
| | | // map.put("four", listd); |
| | | // //100-250 |
| | | // map.put("five", liste); |
| | | // //250 |
| | | // map.put("six", listf); |
| | | // String a = ""; |
| | | // if (maps.size() == 0) { |
| | | // a = yday + "暂无降雨信息。"; |
| | | // } else { |
| | | // a = yday + "站点最大降雨量前3位为:" + text.substring(0, text.length() - 1) + "。"; |
| | | // } |
| | | // 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++) { |
| | | // // 第四步,创建单元格,并设置值 |
| | | // 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()); |
| | | // } |
| | | // // 第六步,将文件存到指定位置 |
| | | // try { |
| | | // fileName = "D:/pptnd.xlsx"; |
| | | // FileOutputStream fout = new FileOutputStream(fileName); |
| | | // wb.write(fout); |
| | | // fout.close(); |
| | | // wb.close(); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // Process proc; |
| | | // try { |
| | | // proc = Runtime.getRuntime().exec("python D:\\fz\\fz.py"); |
| | | // 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(); |
| | | // } |
| | | // return R.data(lists); |
| | | // } |
| | | // |
| | | |
| | | /** |
| | | * 流域 |
| | | */ |
| | | *//* |
| | | @GetMapping("/selectReL") |
| | | public R selectReL(String beginTime, String endTime) { |
| | | String substring = beginTime.substring(0, 10); |
| | |
| | | lists.add(mapc); |
| | | } |
| | | return R.data(lists); |
| | | } |
| | | }*/ |
| | | |
| | | /** |
| | | * @param type 类型 0:实时 1 历史 |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 点降雨 |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | @GetMapping("/selectReDc") |
| | | public R selectReDc(String beginTime, String endTime) { |
| | | String substring = beginTime.substring(0, 10); |
| | |
| | | } else if (dyp > 250) { |
| | | listf.add(maps.get(i)); |
| | | } |
| | | if (i==0){ |
| | | text += addvnm+stnm + "站" + dyp + "毫米,"; |
| | | if (i == 0) { |
| | | text += addvnm + stnm + "站" + dyp + "毫米,"; |
| | | } |
| | | if (i==1){ |
| | | text += addvnm+stnm + "站" + dyp + "毫米次之,"; |
| | | if (i == 1) { |
| | | text += addvnm + stnm + "站" + dyp + "毫米次之,"; |
| | | } |
| | | if (i==2){ |
| | | text += addvnm+stnm + "站" + dyp + "毫米第三,"; |
| | | if (i == 2) { |
| | | text += addvnm + stnm + "站" + dyp + "毫米第三,"; |
| | | } |
| | | } else { |
| | | BigDecimal bigDecimaldyp = (BigDecimal) maps.get(i).get("dyp");//日雨量 |
| | |
| | | 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 { |
| | |
| | | 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("python D:\\fz\\fz.py"); |
| | | 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); |
| | | //System.out.println(line); |
| | | } |
| | | in.close(); |
| | | proc.waitFor(); |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | lists.add(m); |
| | | return R.data(lists); |
| | | } |
| | | |
| | |
| | | } |
| | | String code = strArrays.substring(0, strArrays.length() - 1); |
| | | //List<Map<String, Object>> map = regionWeightService.selectReM(beginTime, endTime); |
| | | List<Map<String, Object>> map = regionWeightService.selectReMs(beginTime, endTime,code); |
| | | List<Map<String, Object>> mapAll = regionWeightService.selectAll(); |
| | | List<Map<String, Object>> map = regionWeightService.selectReMs(beginTime, endTime, code); |
| | | List<Map<String, Object>> mapAll = regionWeightService.selectAll(beginTime, endTime,code); |
| | | //权重值 |
| | | List<Map<String, Object>> list = regionWeightService.selectWeight(); |
| | | Map map1 = new HashMap(); |
| | |
| | | double drp = bigDecimaldrp.floatValue(); |
| | | String weight1 = map.get(i).get("WEIGHT").toString(); |
| | | float weight = Float.parseFloat(weight1); |
| | | System.out.println(Math.round(drp)); |
| | | //System.out.println(Math.round(drp)); |
| | | v += drp * weight; |
| | | break; |
| | | } |
| | |
| | | double drp = bigDecimaldrp.floatValue(); |
| | | String weight1 = map.get(i).get("WEIGHT").toString(); |
| | | float weight = Float.parseFloat(weight1); |
| | | System.out.println(Math.round(drp)); |
| | | v += drp * weight; |
| | | break; |
| | | } |
| | |
| | | return R.data(lists); |
| | | } |
| | | |
| | | /** |
| | | * 流域 |
| | | */ |
| | | @GetMapping("/selectReL") |
| | | public R selectReL(String beginTime, String endTime) { |
| | | String substring = beginTime.substring(0, 10); |
| | | String r = beginTime.substring(11, 13); |
| | | //截取月日 |
| | | String[] strs = substring.split("-"); |
| | | //月 |
| | | String year = strs[1].toString(); |
| | | //日 |
| | | String day = strs[2].toString(); |
| | | String substrings = endTime.substring(0, 10); |
| | | String rs = endTime.substring(11, 13); |
| | | //截取月日 |
| | | String[] strss = substrings.split("-"); |
| | | //月 |
| | | String years = strss[1].toString(); |
| | | //日 |
| | | String days = strss[2].toString(); |
| | | String yday = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时。"; |
| | | String text = ""; |
| | | String ss = regionWeightService.selectCodeM(); |
| | | String[] split = ss.split(","); |
| | | String strArrays = ""; |
| | | for (int i = 0; i < split.length; i++) { |
| | | strArrays += "'" + split[i] + "',"; |
| | | } |
| | | String codel = strArrays.substring(0, strArrays.length() - 1); |
| | | //最新雨量值 |
| | | List<Map<String, Object>> map = regionWeightService.selectReL(beginTime, endTime, codel); |
| | | // //色斑图 |
| | | // 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 < map.size(); i++) { |
| | | // // 第四步,创建单元格,并设置值 |
| | | // row = sheet.createRow((int) i + 1); |
| | | // HSSFCell celli = row.createCell((short) 0); |
| | | // row.createCell((short) 0).setCellValue(map.get(i).get("LGTD").toString()); |
| | | // row.createCell((short) 1).setCellValue(map.get(i).get("LTTD").toString()); |
| | | // row.createCell((short) 2).setCellValue(map.get(i).get("DRP").toString()); |
| | | // } |
| | | // // 第六步,将文件存到指定位置 |
| | | // try { |
| | | // fileName = "D:/myl.xlsx"; |
| | | // FileOutputStream fout = new FileOutputStream(fileName); |
| | | // wb.write(fout); |
| | | // fout.close(); |
| | | // wb.close(); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // Process proc; |
| | | // try { |
| | | // proc = Runtime.getRuntime().exec("python D:\\fz\\myl.py"); |
| | | // 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(); |
| | | // } |
| | | //权重值 |
| | | List<Map<String, Object>> list = regionWeightService.selectWeights(); |
| | | List<Map<String, Object>> list2 = regionWeightService.selectLALL(); |
| | | List<Map<String, Object>> list3 = regionWeightService.selectLNam(); |
| | | Map mc = new HashMap(); |
| | | for (int a = 0; a < list2.size(); a++) { |
| | | for (int b = 0; b < list3.size(); b++) { |
| | | String code = list2.get(a).get("code").toString(); |
| | | String num = list2.get(a).get("num").toString(); |
| | | String code1 = list3.get(b).get("code").toString(); |
| | | if (code.equals(code1)) { |
| | | mc.put(list3.get(b).get("cname").toString(), num); |
| | | } |
| | | } |
| | | } |
| | | Map map1 = new HashMap(); |
| | | Map mapc = new HashMap(); |
| | | List<Map<String, Object>> list1 = new ArrayList<Map<String, Object>>(); |
| | | List<Map<String, Object>> lists = new ArrayList<Map<String, Object>>(); |
| | | List<Map<String, Object>> listc = new ArrayList<Map<String, Object>>(); |
| | | double v = 0; |
| | | //统计抚州市雨量 |
| | | Double num = 0.0; |
| | | String region_code = null; |
| | | if (map.size() == 0) { |
| | | List<Map<String, Object>> l = new ArrayList<Map<String, Object>>(); |
| | | List<Map<String, Object>> m = new ArrayList<Map<String, Object>>(); |
| | | mapc.put("List", l); |
| | | mapc.put("Num", m); |
| | | mapc.put("text", yday + "暂无流域信息。"); |
| | | lists.add(mapc); |
| | | } else { |
| | | for (int i = 0; i < map.size(); i++) { |
| | | region_code = map.get(i).get("REGION_CODE").toString(); |
| | | //获取行政区编码 |
| | | if (i != 0) { |
| | | String region_code1 = map.get(i - 1).get("REGION_CODE").toString(); |
| | | if (!region_code.equals(region_code1)) { |
| | | map1.put("id", region_code1); |
| | | map1.put("value", v); |
| | | list1.add(map1); |
| | | v = 0; |
| | | map1 = new HashMap(); |
| | | for (int j = 0; j < list.size(); j++) { |
| | | if (region_code.equals(list.get(j).get("STATION_CODE").toString())) { |
| | | BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP"); |
| | | double drp = bigDecimaldrp.floatValue(); |
| | | String weight1 = map.get(i).get("WEIGHT").toString(); |
| | | float weight = Float.parseFloat(weight1); |
| | | v += drp * weight; |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | for (int j = 0; j < list.size(); j++) { |
| | | if (region_code.equals(list.get(j).get("STATION_CODE").toString())) { |
| | | BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP"); |
| | | double drp = bigDecimaldrp.floatValue(); |
| | | String weight1 = map.get(i).get("WEIGHT").toString(); |
| | | float weight = Float.parseFloat(weight1); |
| | | v += drp * weight; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | for (int j = 0; j < list.size(); j++) { |
| | | if (region_code.equals(list.get(j).get("STATION_CODE").toString())) { |
| | | BigDecimal bigDecimaldrp = (BigDecimal) map.get(i).get("DRP"); |
| | | double drp = bigDecimaldrp.floatValue(); |
| | | String weight1 = map.get(i).get("WEIGHT").toString(); |
| | | float weight = Float.parseFloat(weight1); |
| | | v += drp * weight; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | map1.put("id", region_code); |
| | | map1.put("value", v); |
| | | list1.add(map1); |
| | | Map<String, Object> result1 = new HashMap<String, Object>(); |
| | | //县/区面雨量值 |
| | | for (Map<String, Object> maps : list1) { |
| | | String id = maps.get("id").toString(); |
| | | Double value = Double.parseDouble(maps.get("value").toString()); |
| | | if (result1.containsKey(id)) { |
| | | Double temp = Double.parseDouble(result1.get(id).toString()); |
| | | value += temp; |
| | | } |
| | | result1.put(id, value); |
| | | } |
| | | // 排序 |
| | | List<Map.Entry<String, Object>> entryList2 = new ArrayList<Map.Entry<String, Object>>(result1.entrySet()); |
| | | Collections.sort(entryList2, new Comparator<Map.Entry<String, Object>>() { |
| | | @Override |
| | | public int compare(Entry<String, Object> me1, Entry<String, Object> me2) { |
| | | return me2.getValue().toString().compareTo(me1.getValue().toString()); // 升序排序 |
| | | } |
| | | }); |
| | | for (int i = 0; i < entryList2.size(); i++) { |
| | | Map mapa = new HashMap(); |
| | | String codes = entryList2.get(i).getKey(); |
| | | String values = entryList2.get(i).getValue().toString(); |
| | | Double a = Double.parseDouble(values); |
| | | double as = (double) Math.round(a * 10) / 10; |
| | | for (int j = 0; j < list.size(); j++) { |
| | | if (codes.equals(list.get(j).get("STATION_CODE").toString())) { |
| | | String station_name = list.get(j).get("STATION_NAME").toString(); |
| | | mapa.put("region", station_name); |
| | | mapa.put("dyp", as); |
| | | listc.add(mapa); |
| | | } |
| | | |
| | | } |
| | | } |
| | | Collections.sort(listc, new Comparator<Map<String, Object>>() { |
| | | public int compare(Map<String, Object> o1, Map<String, Object> o2) { |
| | | return (Double) o1.get("dyp") < (Double) o2.get("dyp") ? 1 : ((Double) o1.get("dyp") == (Double) o2.get("dyp") ? 0 : -1); |
| | | } |
| | | }); |
| | | for (int c = 0; c < listc.size(); c++) { |
| | | if (c < 3) { |
| | | text += listc.get(c).get("region").toString() + ":" + listc.get(c).get("dyp") + "毫米,"; |
| | | } |
| | | } |
| | | String a = "流域前三的为:" + text.substring(0, text.length() - 1) + "。"; |
| | | mapc.put("List", listc); |
| | | mapc.put("Num", mc); |
| | | mapc.put("text", yday + a); |
| | | lists.add(mapc); |
| | | } |
| | | return R.data(lists); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | //最新面降雨量 |
| | | List<Map<String, Object>> selectReM(String beginTime,String endTime); |
| | | List<Map<String, Object>> selectReMs(String beginTime,String endTime,String code); |
| | | List<Map<String, Object>> selectReL(String beginTime,String endTime); |
| | | List<Map<String, Object>> selectReL(String beginTime,String endTime,String code); |
| | | //List<Map<String, Object>> selectReL(String beginTime,String endTime); |
| | | List<Map<String, Object>> selectWeight(); |
| | | List<Map<String, Object>> selectWeights(); |
| | | 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(); |
| | | List<Map<String, Object>> selectAll(String beginTime, String endTime, String code); |
| | | List<Map<String, Object>> selectLALL(); |
| | | List<Map<String, Object>> selectLNam(); |
| | | /** |
| | |
| | | |
| | | String selectCode(); |
| | | String selectCodeM(); |
| | | String selectCodeL(); |
| | | } |
| | |
| | | st.STTP |
| | | </select> |
| | | |
| | | <!--流域--> |
| | | <select id="selectReL" resultType="java.util.HashMap"> |
| | | SELECT cs1.STCD, |
| | | isnull(cs1.DRP, 0) AS DRP, |
| | | s.STATION_NAME, |
| | | sc.STATION_NAME AS REGION_NAME, |
| | | s.WEIGHT, |
| | | s.BASIN_CODE as 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} |
| | | GROUP BY STCD |
| | | ) cs1 |
| | | INNER JOIN (SELECT STATION_CODE, STATION_NAME, WEIGHT, BASIN_CODE FROM ZHSW_BASIN_STATION) 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 |
| | | INNER JOIN (SELECT STATION_CODE, STATION_NAME, BASIN_CODE FROM ZHSW_BASIN_STATION) sc |
| | | ON sc.STATION_CODE = s.BASIN_CODE |
| | | GROUP BY cs1.STCD, |
| | | cs1.DRP, |
| | | s.STATION_NAME, |
| | | sc.STATION_NAME, |
| | | s.WEIGHT, |
| | | s.BASIN_CODE, |
| | | st.LGTD, |
| | | st.LTTD, |
| | | st.STTP |
| | | </select> |
| | | |
| | | <!--个县区权重值--> |
| | | <select id="selectWeight" resultType="java.util.HashMap"> |
| | | SELECT STATION_CODE, STATION_NAME, WEIGHT |
| | |
| | | order by csd.dyp desc |
| | | </select> |
| | | <select id="selectAll" resultType="java.util.HashMap"> |
| | | SELECT STATION_CODE AS STCD, |
| | | STATION_NAME AS STNM, |
| | | REGION_NAME AS ADDVNM |
| | | FROM ZHSW_REGION_WEIGHT |
| | | WHERE SPARE1 != 0 |
| | | SELECT r.STATION_CODE AS STCD, |
| | | r.STATION_NAME AS STNM, |
| | | r.REGION_NAME AS ADDVNM, |
| | | s.STNM, |
| | | s.STLC, |
| | | s.LTTD, |
| | | s.LGTD, |
| | | isnull(cs1.DRP, 0) as DRP |
| | | 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 |
| | | WHERE r.SPARE1 != 0 |
| | | </select> |
| | | |
| | | <select id="selectLALL" resultType="java.util.HashMap"> |
| | |
| | | </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 |
| | |
| | | SELECT ',' + CONVERT(VARCHAR (25), STATION_CODE) |
| | | FROM ZHSW_REGION_WEIGHT |
| | | WHERE SPARE1!=0 FOR XML PATH ('')), |
| | | 1, |
| | | 1, |
| | | '' |
| | | ) AS siteids |
| | | </select> |
| | | <select id="selectCodeL" resultType="java.lang.String"> |
| | | SELECT stuff(( |
| | | SELECT ',' + CONVERT(VARCHAR (25), STATION_CODE) |
| | | FROM ZHSW_BASIN_STATION |
| | | WHERE BASIN_CODE!=0 FOR XML PATH ('')), |
| | | 1, |
| | | 1, |
| | | '' |
| | |
| | | FROM (SELECT STCD, SUM(DRP) AS DRP |
| | | FROM dbo.ST_PPTN_R |
| | | WHERE TM > #{beginTime} |
| | | AND TM <= #{endTime} AND STCD IN (${code}) |
| | | 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 |
| | |
| | | st.LTTD, |
| | | st.STTP |
| | | </select> |
| | | <!--流域--> |
| | | <select id="selectReL" resultType="java.util.HashMap"> |
| | | SELECT cs1.STCD, |
| | | isnull(cs1.DRP, 0) AS DRP, |
| | | s.STATION_NAME, |
| | | s.WEIGHT, |
| | | s.BASIN_CODE as 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, WEIGHT, BASIN_CODE FROM ZHSW_BASIN_STATION) 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.WEIGHT, |
| | | s.BASIN_CODE, |
| | | st.LGTD, |
| | | st.LTTD, |
| | | st.STTP |
| | | </select> |
| | | </mapper> |
| | | |
| | |
| | | List<RegionWeightVO> lazyTree(String code); |
| | | //最新面降雨量 |
| | | List<Map<String, Object>> selectReM(String beginTime,String endTime); |
| | | List<Map<String, Object>> selectReL(String beginTime,String endTime); |
| | | //List<Map<String, Object>> selectReL(String beginTime,String endTime); |
| | | List<Map<String, Object>> selectReL(String beginTime,String endTime,String code); |
| | | List<Map<String, Object>> selectWeight(); |
| | | List<Map<String, Object>> selectWeights(); |
| | | List<Map<String, Object>> selectYjs(String beginTime,String endTime); |
| | | List<Map<String, Object>> selectAll(); |
| | | List<Map<String, Object>> selectAll(String beginTime, String endTime, String code); |
| | | List<regionExcel> exportRegion(String beginTime, String endTime); |
| | | List<Map<String, Object>> selectLALL(); |
| | | List<Map<String, Object>> selectLNam(); |
| | | List<Map<String, Object>> selectppyj(String time, String dateBegin1,String dateBegin3,String dateBegin6,String times); |
| | | String selectCode(); |
| | | String selectCodeM(); |
| | | String selectCodeL(); |
| | | List<Map<String, Object>> ss(String beginTime, String endTime, String code); |
| | | List<Map<String, Object>> selectReMs(String beginTime,String endTime,String code); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectReL(String beginTime, String endTime) { |
| | | return baseMapper.selectReL(beginTime, endTime); |
| | | public List<Map<String, Object>> selectReL(String beginTime, String endTime, String code) { |
| | | return baseMapper.selectReL(beginTime, endTime,code); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectAll() { |
| | | return baseMapper.selectAll(); |
| | | public List<Map<String, Object>> selectAll(String beginTime, String endTime, String code) { |
| | | return baseMapper.selectAll(beginTime, endTime,code); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String selectCodeL() { |
| | | return baseMapper.selectCodeL(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> ss(String beginTime, String endTime, String code) { |
| | | return baseMapper.ss(beginTime, endTime, code); |
| | | } |
| | |
| | | return R.status(riverRService.saveOrUpdate(riverR)); |
| | | } |
| | | |
| | | /** |
| | | * 河道自定义时间查询 |
| | | * |
| | | * @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 hs = beginTime.substring(11, 13); |
| | | String hss = endTime.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.selecthd(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(); |
| | | //查询数据为空 |
| | | 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(); |
| | | //超警戒水位值 |
| | | 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 { |
| | | DecimalFormat dfs = new DecimalFormat("#0.000"); |
| | | texta += "流量" + Q + "立方米每秒;"; |
| | | } |
| | | } |
| | | } |
| | | 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"); |
| | | texta += "流量" + Q + "立方米每秒;"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // /** |
| | | // * 河道自定义时间查询 |
| | | // * |
| | | // * @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 hs = beginTime.substring(11, 13); |
| | | // String hss = endTime.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.selecthd(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(); |
| | | // //查询数据为空 |
| | | // 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(); |
| | | // //超警戒水位值 |
| | | // 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 { |
| | | // DecimalFormat dfs = new DecimalFormat("#0.000"); |
| | | // texta += "流量" + Q + "立方米每秒;"; |
| | | // } |
| | | // } |
| | | // } |
| | | // 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"); |
| | | // texta += "流量" + Q + "立方米每秒;"; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | //// //河道涨幅,跌幅信息 |
| | | // //List<Map<String, Object>> selecthds = riverRService.selecthds(beginTime, endTime); |
| | | // Map m1 = new HashMap(); |
| | | // Map m2 = new HashMap(); |
| | | // Map c = new HashMap(); |
| | | // Map m = new HashMap(); |
| | | // List list = new ArrayList(); |
| | | //// for (int j = 0; j < selecthds.size(); j++) { |
| | | //// //站点编码 |
| | | //// String stcd = selecthds.get(j).get("STCD").toString(); |
| | | //// //站点名称 |
| | | //// String stnm = selecthds.get(j).get("STNM").toString(); |
| | | //// //省,市 |
| | | //// String addvcd5 = selecthds.get(j).get("ADDVNM").toString(); |
| | | //// //最大值 |
| | | //// BigDecimal maxZ = (BigDecimal) selecthds.get(j).get("maxZ"); |
| | | //// //最大值出现时间 |
| | | //// String maxTM = selecthds.get(j).get("maxTM").toString(); |
| | | //// //最小值 |
| | | //// BigDecimal minZ = (BigDecimal) selecthds.get(j).get("minZ"); |
| | | //// //最小值出现时间 |
| | | //// String minTM = selecthds.get(j).get("minTM").toString(); |
| | | //// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | //// Date sd1 = df.parse(maxTM); |
| | | //// Date sd2 = df.parse(minTM); |
| | | //// double v = maxZ.doubleValue(); |
| | | //// double v1 = minZ.doubleValue(); |
| | | //// //涨幅值 |
| | | //// double v2 = v - v1; |
| | | //// double v3 = (double) Math.round(v2 * 100) / 100; |
| | | //// m1.put(v3, stnm.replaceAll(" ", "") + "站"); |
| | | //// c.put(stcd, v3); |
| | | //// } |
| | | // 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", c); |
| | | // list.add(m); |
| | | // return R.data(list); |
| | | // |
| | | // } |
| | | |
| | | } |
| | | if (number == 0) { |
| | | text += "暂无河道超警戒信息。" + texta; |
| | | } else { |
| | | text += "有" + number + "个河道站超警戒。" + texta; |
| | | } |
| | | } |
| | | //河道涨幅,跌幅信息 |
| | | List<Map<String, Object>> selecthds = riverRService.selecthds(beginTime, endTime); |
| | | Map m1 = new HashMap(); |
| | | Map m2 = new HashMap(); |
| | | Map c = new HashMap(); |
| | | Map m = new HashMap(); |
| | | List list = new ArrayList(); |
| | | for (int j = 0; j < selecthds.size(); j++) { |
| | | //站点编码 |
| | | String stcd = selecthds.get(j).get("STCD").toString(); |
| | | //站点名称 |
| | | String stnm = selecthds.get(j).get("STNM").toString(); |
| | | //省,市 |
| | | String addvcd5 = selecthds.get(j).get("ADDVNM").toString(); |
| | | //最大值 |
| | | BigDecimal maxZ = (BigDecimal) selecthds.get(j).get("maxZ"); |
| | | //最大值出现时间 |
| | | String maxTM = selecthds.get(j).get("maxTM").toString(); |
| | | //最小值 |
| | | BigDecimal minZ = (BigDecimal) selecthds.get(j).get("minZ"); |
| | | //最小值出现时间 |
| | | String minTM = selecthds.get(j).get("minTM").toString(); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date sd1 = df.parse(maxTM); |
| | | Date sd2 = df.parse(minTM); |
| | | double v = maxZ.doubleValue(); |
| | | double v1 = minZ.doubleValue(); |
| | | //涨幅值 |
| | | double v2 = v - v1; |
| | | double v3 = (double) Math.round(v2 * 100) / 100; |
| | | m1.put(v3, stnm.replaceAll(" ", "") + "站"); |
| | | c.put(stcd, v3); |
| | | } |
| | | if (m1.size() != 0) { |
| | | Object maxKey = getMaxKey(m1); |
| | | String s1 = m1.get(maxKey).toString(); |
| | | text += " 涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。"; |
| | | } |
| | | // //如果最大时间大于最小时间就是涨幅 |
| | | // if (sd1.after(sd2)) { |
| | | // //创建一个map集合保存涨幅数据 |
| | | // double v = maxZ.doubleValue(); |
| | | // double v1 = minZ.doubleValue(); |
| | | // //涨幅值 |
| | | // double v2 = v - v1; |
| | | // double v3 = (double) Math.round(v2 * 100) / 100; |
| | | // m1.put(Math.abs(v3), stnm.replaceAll(" ", "") + "站"); |
| | | // c.put(stcd,Math.abs(v3)); |
| | | // |
| | | // |
| | | // } |
| | | // //跌幅 |
| | | // else { |
| | | // //创建一个map集合保存跌幅数据 |
| | | // double v = maxZ.doubleValue(); |
| | | // double v1 = minZ.doubleValue(); |
| | | // //涨幅值 |
| | | // double v2 = v1 - v; |
| | | // double v3 = (double) Math.round(v2 * 100) / 100; |
| | | // m2.put(Math.abs(v3), stnm.replaceAll(" ", "") + "站"); |
| | | // c.put(stcd,v3); |
| | | // |
| | | // } |
| | | // } |
| | | // if (m1.size()==0){ |
| | | // text += "暂无涨幅信息。"; |
| | | // } |
| | | // else { |
| | | // //获取涨幅最大的信息 |
| | | // Object maxKey = getMaxKey(m1); |
| | | // String s1 = m1.get(maxKey).toString(); |
| | | // text += "涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。"; |
| | | // } |
| | | // if (m2.size()==0){ |
| | | // text += "暂无跌幅信息。"; |
| | | // } |
| | | // else { |
| | | // //获取跌幅最大的信息 |
| | | // Object maxKey2 = getMaxKey(m2); |
| | | // String s2 = m2.get(maxKey2).toString(); |
| | | // text += "跌幅最大的是:" + s2 + "(跌" + maxKey2 + "米)。"; |
| | | // } |
| | | m.put("text", text); |
| | | m.put("number", number); |
| | | m.put("Yjlist", ylist); |
| | | m.put("list", alist); |
| | | m.put("list1", list1); |
| | | m.put("clist", c); |
| | | list.add(m); |
| | | return R.data(list); |
| | | } |
| | | |
| | | /** |
| | | * 河道最新 |
| | |
| | | String stnm = selecthd.get(i).get("STNM").toString(); |
| | | if (stnm.equals("廖家湾") || stnm.equals("娄家村")) { |
| | | String stcd = selecthd.get(i).get("STCD").toString(); |
| | | Map<String, Object> stringObjectMap = riverRService.selectZ(stcd, timec); |
| | | BigDecimal zc = (BigDecimal) stringObjectMap.get("Z"); |
| | | //Map<String, Object> stringObjectMap = riverRService.selectZ(stcd, timec); |
| | | BigDecimal zc = (BigDecimal) selecthd.get(i).get("Zc"); |
| | | double ZC = zc.doubleValue(); |
| | | double vz = Z - ZC; |
| | | DecimalFormat dfc = new DecimalFormat("#0.00"); |
| | |
| | | String stnm = selecthd.get(i).get("STNM").toString(); |
| | | if (stnm.equals("廖家湾") || stnm.equals("娄家村")) { |
| | | String stcd = selecthd.get(i).get("STCD").toString(); |
| | | Map<String, Object> stringObjectMap = riverRService.selectZ(stcd, timec); |
| | | BigDecimal zc = (BigDecimal) stringObjectMap.get("Z"); |
| | | //Map<String, Object> stringObjectMap = riverRService.selectZ(stcd, timec); |
| | | BigDecimal zc = (BigDecimal) selecthd.get(i).get("Zc"); |
| | | double ZC = zc.doubleValue(); |
| | | double vz = Z - ZC; |
| | | DecimalFormat dfc = new DecimalFormat("#0.00"); |
| | |
| | | String stnm = selecthd.get(i).get("STNM").toString(); |
| | | if (stnm.equals("廖家湾") || stnm.equals("娄家村")) { |
| | | String stcd = selecthd.get(i).get("STCD").toString(); |
| | | Map<String, Object> stringObjectMap = riverRService.selectZ(stcd, timec); |
| | | BigDecimal zc = (BigDecimal) stringObjectMap.get("Z"); |
| | | //Map<String, Object> stringObjectMap = riverRService.selectZ(stcd, timec); |
| | | BigDecimal zc = (BigDecimal) selecthd.get(i).get("Zc"); |
| | | double ZC = zc.doubleValue(); |
| | | double vz = Z - ZC; |
| | | DecimalFormat dfc = new DecimalFormat("#0.00"); |
| | |
| | | return obj[obj.length - 1]; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 河道自定义时间查询 |
| | | * |
| | | * @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 hs = beginTime.substring(11, 13); |
| | | String hss = endTime.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 { |
| | | DecimalFormat dfs = new DecimalFormat("#0.000"); |
| | | texta += "流量" + Q + "立方米每秒;"; |
| | | } |
| | | } |
| | | } |
| | | 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"); |
| | | texta += "流量" + Q + "立方米每秒;"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | 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); |
| | | |
| | | } |
| | | } |
| | |
| | | public interface RiverRMapper extends BaseMapper<RiverR> { |
| | | //河道超警信息(通过结束时间查询) |
| | | List<Map<String, Object>> selecthd(String beginTime,String endTime); |
| | | List<Map<String, Object>> selecthdcs(String beginTime,String endTime); |
| | | //河道最新超警信息 |
| | | List<Map<String, Object>> selecthdt(String dateBegin24,String time); |
| | | Map<String, Object> sel(); |
| | |
| | | </resultMap> |
| | | |
| | | <!--河道自定义超警信息--> |
| | | <!-- <select id="selecthd" resultType="java.util.HashMap"> |
| | | SELECT ri.STCD, |
| | | ri.TM, |
| | | ri.Z, |
| | | ri.Q, |
| | | rv.WRZ, |
| | | st.STNM, |
| | | st.LGTD, |
| | | st.LTTD, |
| | | ad.ADDVNM |
| | | FROM ST_RIVER_R ri |
| | | LEFT JOIN ST_RVFCCH_B rv ON ri.STCD = rv.STCD |
| | | LEFT JOIN ST_STBPRP_B st ON st.STCD = ri.STCD |
| | | INNER JOIN ST_ADDVCD_D ad on ad.ADDVCD = st.ADDVCD |
| | | WHERE ri.TM > #{beginTime} |
| | | AND ri.TM <= #{endTime} and ad.ADDVNM NOT LIKE '井冈山市' AND ad.ADDVNM NOT LIKE '吉水县' |
| | | ORDER BY ri.Z desc |
| | | </select>--> |
| | | |
| | | <select id="selecthd" resultType="java.util.HashMap"> |
| | | SELECT ri.STCD, |
| | | ri.TM, |
| | | ri.Z, |
| | | ri.Q, |
| | | SELECT cs.STCD, |
| | | cs1.TM, |
| | | cs1.Z, |
| | | cs1.Q, |
| | | cs2.STNM, |
| | | cs2.LGTD, |
| | | cs2.LTTD, |
| | | ad.ADDVNM, |
| | | rv.WRZ |
| | | FROM ( |
| | | SELECT A.STCD, |
| | | s.ADDVCD |
| | | FROM (SELECT STCD, TM, Z, Q |
| | | FROM dbo.ST_RIVER_R |
| | | WHERE TM > #{beginTime} |
| | | AND TM <= #{endTime}) AS A |
| | | INNER JOIN (SELECT STCD, STNM, LTTD, LGTD, ADDVCD, STTP |
| | | FROM dbo.ST_STBPRP_B |
| | | WHERE STTP = 'ZZ' |
| | | or STTP = 'ZQ') s ON A.STCD = s.STCD |
| | | LEFT JOIN (SELECT ADDVCD, ADDVNM |
| | | FROM dbo.ST_ADDVCD_D |
| | | WHERE ADDVNM NOT LIKE '井冈山市' |
| | | AND ADDVNM NOT LIKE '吉水县') c ON c.ADDVCD = s.ADDVCD |
| | | GROUP BY A.STCD, s.ADDVCD |
| | | ) cs |
| | | LEFT JOIN (SELECT STCD, TM, Z, Q |
| | | FROM dbo.ST_RIVER_R |
| | | WHERE TM > #{beginTime} |
| | | AND TM <= #{endTime}) cs1 ON cs.STCD = cs1.STCD |
| | | INNER JOIN (SELECT STCD, STNM, LTTD, LGTD, ADDVCD, STTP |
| | | FROM dbo.ST_STBPRP_B |
| | | WHERE STTP = 'ZZ' |
| | | 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 |
| | | LEFT JOIN (SELECT ADDVCD, ADDVNM FROM dbo.ST_ADDVCD_D) ad ON ad.ADDVCD = cs.ADDVCD |
| | | GROUP BY cs.STCD, |
| | | cs1.TM, |
| | | cs1.Z, |
| | | cs2.STNM, |
| | | ad.ADDVNM, |
| | | cs2.LGTD, |
| | | cs2.LTTD, |
| | | cs1.Q, |
| | | rv.WRZ |
| | | </select> |
| | | |
| | | |
| | | <!--河道自定义预警测试接口--> |
| | | <select id="selecthdcs" resultType="java.util.HashMap"> |
| | | SELECT cs.STCD, |
| | | cs1.TM, |
| | | cs1.Z, |
| | | cs1.Q, |
| | | cs2.STNM, |
| | | cs2.LGTD, |
| | | cs2.LTTD, |
| | | ad.ADDVNM, |
| | | rv.WRZ, |
| | | st.STNM, |
| | | st.LGTD, |
| | | st.LTTD, |
| | | ad.ADDVNM |
| | | FROM ST_RIVER_R ri |
| | | LEFT JOIN ST_RVFCCH_B rv ON ri.STCD = rv.STCD |
| | | LEFT JOIN ST_STBPRP_B st ON st.STCD = ri.STCD |
| | | INNER JOIN ST_ADDVCD_D ad on ad.ADDVCD = st.ADDVCD |
| | | WHERE ri.TM > #{beginTime} |
| | | AND ri.TM <= #{endTime} and ad.ADDVNM NOT LIKE '井冈山市' AND ad.ADDVNM NOT LIKE '吉水县' |
| | | ORDER BY ri.Z desc |
| | | cs3.maxZ, |
| | | cs4.minZ |
| | | FROM ( |
| | | SELECT A.STCD, |
| | | s.ADDVCD |
| | | FROM (SELECT STCD, TM, Z, Q |
| | | FROM dbo.ST_RIVER_R |
| | | WHERE TM > #{beginTime} |
| | | AND TM <= #{endTime}) AS A |
| | | INNER JOIN (SELECT STCD, STNM, LTTD, LGTD, ADDVCD, STTP |
| | | FROM dbo.ST_STBPRP_B |
| | | WHERE STTP = 'ZZ' |
| | | OR STTP = 'ZQ') s ON A.STCD = s.STCD |
| | | LEFT JOIN (SELECT ADDVCD, ADDVNM |
| | | FROM dbo.ST_ADDVCD_D |
| | | WHERE ADDVNM NOT LIKE '井冈山市' |
| | | AND ADDVNM NOT LIKE '吉水县') c ON c.ADDVCD = s.ADDVCD |
| | | GROUP BY A.STCD, |
| | | s.ADDVCD |
| | | ) cs |
| | | LEFT JOIN (SELECT STCD, TM, Z, Q |
| | | FROM dbo.ST_RIVER_R |
| | | WHERE TM > #{beginTime} |
| | | AND TM <= #{endTime}) cs1 ON cs.STCD = cs1.STCD |
| | | INNER JOIN (SELECT STCD, STNM, LTTD, LGTD, ADDVCD, STTP |
| | | FROM dbo.ST_STBPRP_B |
| | | WHERE STTP = 'ZZ' |
| | | 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 |
| | | LEFT JOIN (SELECT ADDVCD, ADDVNM FROM dbo.ST_ADDVCD_D) ad ON ad.ADDVCD = cs.ADDVCD |
| | | INNER 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 = cs.STCD |
| | | INNER 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 = cs.STCD |
| | | GROUP BY cs.STCD, |
| | | cs1.TM, |
| | | cs1.Z, |
| | | cs2.STNM, |
| | | ad.ADDVNM, |
| | | cs2.LGTD, |
| | | cs2.LTTD, |
| | | cs1.Q, |
| | | rv.WRZ, |
| | | cs3.maxZ, |
| | | cs4.minZ ORDER BY cs1.Z desc |
| | | </select> |
| | | |
| | | <!--河道最新超警信息--> |
| | |
| | | cs2.LGTD, |
| | | cs2.LTTD, |
| | | ad.ADDVNM, |
| | | rv.WRZ |
| | | rv.WRZ, |
| | | z.Z as Zc |
| | | FROM ( |
| | | SELECT A.STCD, |
| | | MAX(A.TM) TM, |
| | | s.ADDVCD |
| | | FROM (SELECT STCD, TM, Z,Q FROM dbo.ST_RIVER_R) AS A |
| | | LEFT JOIN (SELECT STCD, STNM, LTTD, LGTD, ADDVCD FROM dbo.ST_STBPRP_B) s ON A.STCD = s.STCD |
| | | FROM (SELECT STCD, TM, Z, Q FROM dbo.ST_RIVER_R) AS A |
| | | INNER JOIN (SELECT STCD, STNM, LTTD, LGTD, ADDVCD, STTP |
| | | FROM dbo.ST_STBPRP_B |
| | | WHERE STTP = 'ZZ' |
| | | or STTP = 'ZQ') s ON A.STCD = s.STCD |
| | | INNER JOIN (SELECT ADDVCD, ADDVNM |
| | | FROM dbo.ST_ADDVCD_D |
| | | WHERE ADDVNM NOT LIKE '井冈山市' AND ADDVNM NOT LIKE '吉水县') c ON c.ADDVCD = s.ADDVCD |
| | | WHERE ADDVNM NOT LIKE '井冈山市' |
| | | AND ADDVNM NOT LIKE '吉水县') c ON c.ADDVCD = s.ADDVCD |
| | | WHERE A.TM > #{dateBegin24} |
| | | AND A.TM <= #{time} |
| | | GROUP BY A.STCD, s.ADDVCD |
| | | ) cs |
| | | LEFT JOIN (SELECT STCD, TM, Z,Q FROM dbo.ST_RIVER_R) cs1 ON cs.STCD = cs1.STCD |
| | | LEFT JOIN (SELECT STCD, TM, Z, Q FROM dbo.ST_RIVER_R) cs1 ON cs.STCD = cs1.STCD |
| | | AND cs.TM = cs1.TM |
| | | LEFT JOIN (SELECT STCD, STNM, LTTD, LGTD, ADDVCD FROM dbo.ST_STBPRP_B) cs2 ON cs.STCD = cs2.STCD |
| | | INNER JOIN (SELECT STCD, STNM, LTTD, LGTD, ADDVCD, STTP |
| | | FROM dbo.ST_STBPRP_B |
| | | WHERE STTP = 'ZZ' |
| | | 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 |
| | | GROUP BY cs.STCD, |
| | | cs.TM, |
| | | cs1.Z, |
| | |
| | | cs2.LGTD, |
| | | cs2.LTTD, |
| | | cs1.Q, |
| | | rv.WRZ |
| | | rv.WRZ, |
| | | z.Z |
| | | </select> |
| | | <!--河道最新超警信息--> |
| | | <select id="sel" resultType="java.util.HashMap"> |
| | |
| | | SELECT A.STCD, |
| | | MAX(A.TM) TM, |
| | | s.ADDVCD |
| | | FROM (SELECT STCD, TM, Z,Q FROM dbo.ST_RIVER_R WHERE STCD='62407800') AS A |
| | | FROM (SELECT STCD, TM, Z, Q FROM dbo.ST_RIVER_R WHERE STCD = '62407800') AS A |
| | | LEFT JOIN (SELECT STCD, STNM, LTTD, LGTD, ADDVCD FROM dbo.ST_STBPRP_B) s ON A.STCD = s.STCD |
| | | INNER JOIN (SELECT ADDVCD, ADDVNM |
| | | FROM dbo.ST_ADDVCD_D |
| | | WHERE ADDVNM NOT LIKE '井冈山市' AND ADDVNM NOT LIKE '吉水县') c ON c.ADDVCD = s.ADDVCD |
| | | WHERE ADDVNM NOT LIKE '井冈山市' |
| | | AND ADDVNM NOT LIKE '吉水县') c ON c.ADDVCD = s.ADDVCD |
| | | GROUP BY A.STCD, s.ADDVCD |
| | | ) cs |
| | | LEFT JOIN (SELECT STCD, TM, Z,Q FROM dbo.ST_RIVER_R) cs1 ON cs.STCD = cs1.STCD |
| | | LEFT JOIN (SELECT STCD, TM, Z, Q FROM dbo.ST_RIVER_R) cs1 ON cs.STCD = cs1.STCD |
| | | AND cs.TM = cs1.TM |
| | | LEFT JOIN (SELECT STCD, STNM, LTTD, LGTD, ADDVCD FROM dbo.ST_STBPRP_B) cs2 ON cs.STCD = cs2.STCD |
| | | LEFT JOIN (SELECT STCD, WRZ FROM dbo.ST_RVFCCH_B) rv ON rv.STCD = cs.STCD |
| | |
| | | |
| | | |
| | | <select id="selectZ" resultType="java.util.HashMap"> |
| | | SELECT Z FROM ST_RIVER_R WHERE STCD=#{stcd} AND TM=#{ti} |
| | | SELECT Z |
| | | FROM ST_RIVER_R |
| | | WHERE STCD = #{stcd} |
| | | AND TM = #{ti} |
| | | </select> |
| | | <!--河道涨幅,跌幅信息--> |
| | | <select id="selecthds" resultType="java.util.HashMap"> |
| | | SELECT DISTINCT s.STCD, |
| | | isnull(s.maxZ,0) as maxZ, |
| | | isnull(s.maxZ, 0) as maxZ, |
| | | MAX(CASE s.maxAgeNum WHEN 1 THEN s.TM ELSE '' END) OVER ( partition BY s.STCD ) maxTM, |
| | | isnull(s.minZ,0) as minZ, |
| | | isnull(s.minZ, 0) as minZ, |
| | | MAX(CASE s.minAgeNum WHEN 1 THEN s.TM ELSE '' END) OVER ( partition BY s.STCD ) minTM, |
| | | st.STNM, |
| | | ad.ADDVNM |
| | |
| | | RANK() OVER ( partition BY STCD ORDER BY Z DESC ) maxAgeNum, |
| | | RANK() OVER ( partition BY STCD ORDER BY Z ) minAgeNum |
| | | FROM dbo.ST_RIVER_R |
| | | WHERE TM >= #{beginTime} |
| | | WHERE TM > #{beginTime} |
| | | AND TM <= #{endTime} |
| | | ) s |
| | | INNER JOIN dbo.ST_STBPRP_B st ON st.STCD = s.STCD |
| | | INNER JOIN (SELECT ADDVCD, ADDVNM FROM dbo.ST_ADDVCD_D WHERE ADDVNM NOT LIKE '井冈山市' AND ADDVNM NOT LIKE '吉水县') ad ON ad.ADDVCD = st.ADDVCD |
| | | INNER JOIN (SELECT ADDVCD, ADDVNM |
| | | FROM dbo.ST_ADDVCD_D |
| | | WHERE ADDVNM NOT LIKE '井冈山市' |
| | | AND ADDVNM NOT LIKE '吉水县') ad ON ad.ADDVCD = st.ADDVCD |
| | | </select> |
| | | |
| | | <!--河道基本站信息--> |
| | | <!--河道基本站信息--> |
| | | <select id="selectP" resultType="java.util.HashMap"> |
| | | SELECT STCD FROM sys_stbprp |
| | | SELECT STCD |
| | | FROM sys_stbprp |
| | | </select> |
| | | |
| | | <select id="selecthdyj" resultType="java.util.HashMap"> |
| | | SELECT |
| | | cs.STCD id, |
| | | cs.TM, |
| | | cs1.Z, |
| | | cs2.LTTD, |
| | | cs2.LGTD, |
| | | cs2.STNM, |
| | | cs2.RVNM, |
| | | cs2.STLC, |
| | | ad.ADDVNM, |
| | | ISNULL(cs3.WRZ,0) AS WRZ, |
| | | ISNULL(cs4.ty,0) AS ty, |
| | | ISNULL(cs4.oy,0) AS oy, |
| | | ISNULL(cs4.toy,0) AS toy, |
| | | ISNULL(cs4.fy,0) AS fy |
| | | FROM |
| | | ( |
| | | SELECT |
| | | A.STCD, |
| | | MAX ( A.TM ) TM, |
| | | s.ADDVCD |
| | | FROM |
| | | ( SELECT STCD, TM, Z FROM ST_RIVER_R WHERE TM >=#{dateEnd} AND TM<=#{times} ) AS A |
| | | INNER JOIN ( |
| | | SELECT |
| | | STCD, |
| | | STNM, |
| | | LTTD, |
| | | LGTD, |
| | | ADDVCD, |
| | | RVNM, |
| | | STLC |
| | | FROM |
| | | dbo.ST_STBPRP_B |
| | | WHERE |
| | | STTP = 'ZZ' |
| | | OR STTP = 'ZQ' |
| | | ) s ON A.STCD = s.STCD |
| | | LEFT JOIN ( SELECT STCD, WRZ FROM dbo.ST_RVFCCH_B ) rv ON A.STCD = rv.STCD |
| | | LEFT JOIN ( SELECT stcd,fy,oy,ty,toy FROM swz_chazhi WHERE ty IS NOT NULL ) c ON A.STCD= c.stcd |
| | | INNER JOIN ( SELECT ADDVCD, ADDVNM FROM dbo.ST_ADDVCD_D WHERE ADDVNM NOT LIKE '井冈山市' AND ADDVNM NOT LIKE '吉水县' ) d ON d.ADDVCD = s.ADDVCD |
| | | GROUP BY |
| | | A.STCD, |
| | | s.ADDVCD |
| | | ) cs |
| | | INNER JOIN ( SELECT STCD, TM, Z FROM ST_RIVER_R WHERE TM >=#{dateEnd} AND TM<=#{times} ) cs1 ON cs.STCD = cs1.STCD |
| | | AND cs.TM = cs1.TM |
| | | INNER JOIN ( |
| | | SELECT |
| | | STCD, |
| | | STNM, |
| | | LTTD, |
| | | LGTD, |
| | | ADDVCD, |
| | | RVNM, |
| | | STLC |
| | | FROM |
| | | dbo.ST_STBPRP_B |
| | | WHERE |
| | | STTP = 'ZZ' |
| | | OR STTP = 'ZQ' |
| | | SELECT cs.STCD id, |
| | | cs.TM, |
| | | cs1.Z, |
| | | cs2.LTTD, |
| | | cs2.LGTD, |
| | | cs2.STNM, |
| | | cs2.RVNM, |
| | | cs2.STLC, |
| | | ad.ADDVNM, |
| | | ISNULL(cs3.WRZ, 0) AS WRZ, |
| | | ISNULL(cs4.ty, 0) AS ty, |
| | | ISNULL(cs4.oy, 0) AS oy, |
| | | ISNULL(cs4.toy, 0) AS toy, |
| | | ISNULL(cs4.fy, 0) AS fy |
| | | FROM ( |
| | | SELECT A.STCD, |
| | | MAX(A.TM) TM, |
| | | s.ADDVCD |
| | | FROM (SELECT STCD, TM, Z FROM ST_RIVER_R WHERE TM >= #{dateEnd} AND TM <= #{times}) AS A |
| | | INNER JOIN ( |
| | | SELECT STCD, |
| | | STNM, |
| | | LTTD, |
| | | LGTD, |
| | | ADDVCD, |
| | | RVNM, |
| | | STLC |
| | | FROM dbo.ST_STBPRP_B |
| | | WHERE STTP = 'ZZ' |
| | | OR STTP = 'ZQ' |
| | | ) s ON A.STCD = s.STCD |
| | | LEFT JOIN (SELECT STCD, WRZ FROM dbo.ST_RVFCCH_B) rv ON A.STCD = rv.STCD |
| | | LEFT JOIN (SELECT stcd, fy, oy, ty, toy FROM swz_chazhi WHERE ty IS NOT NULL) c |
| | | ON A.STCD = c.stcd |
| | | INNER JOIN (SELECT ADDVCD, ADDVNM |
| | | FROM dbo.ST_ADDVCD_D |
| | | WHERE ADDVNM NOT LIKE '井冈山市' |
| | | AND ADDVNM NOT LIKE '吉水县') d ON d.ADDVCD = s.ADDVCD |
| | | GROUP BY A.STCD, |
| | | s.ADDVCD |
| | | ) cs |
| | | INNER JOIN (SELECT STCD, TM, Z FROM ST_RIVER_R WHERE TM >= #{dateEnd} AND TM <= #{times}) cs1 |
| | | ON cs.STCD = cs1.STCD |
| | | AND cs.TM = cs1.TM |
| | | INNER JOIN ( |
| | | SELECT STCD, |
| | | STNM, |
| | | LTTD, |
| | | LGTD, |
| | | ADDVCD, |
| | | RVNM, |
| | | STLC |
| | | FROM dbo.ST_STBPRP_B |
| | | WHERE STTP = 'ZZ' |
| | | OR STTP = 'ZQ' |
| | | ) cs2 ON cs.STCD = cs2.STCD |
| | | LEFT JOIN ( SELECT STCD, WRZ FROM dbo.ST_RVFCCH_B ) cs3 ON cs.STCD = cs3.STCD |
| | | 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 |
| | | LEFT JOIN (SELECT STCD, WRZ FROM dbo.ST_RVFCCH_B) cs3 ON cs.STCD = cs3.STCD |
| | | 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> |
| | | </mapper> |
| | |
| | | public interface IRiverRService extends IService<RiverR> { |
| | | //河道超警信息(通过结束时间查询) |
| | | List<Map<String, Object>> selecthd(String beginTime,String endTime); |
| | | List<Map<String, Object>> selecthdcs(String beginTime,String endTime); |
| | | //河道最新超警信息 |
| | | List<Map<String, Object>> selecthdt(String dateBegin24,String time); |
| | | //河道涨幅,跌幅信息 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selecthdcs(String beginTime, String endTime) { |
| | | return baseMapper.selecthdcs(beginTime, endTime); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selecthdt(String dateBegin24,String time) { |
| | | return baseMapper.selecthdt(dateBegin24, time); |
| | | } |
| | |
| | | edmd = e2; |
| | | } |
| | | } |
| | | //水库水情预警信息 |
| | | List<Map<String, Object>> map = rsvrRService.selectyjck(egmd, edmd, beginTime, endTime); |
| | | String s = rsvrRService.selectCode(beginTime, endTime); |
| | | String[] split = s.split(","); |
| | | String strArrays = ""; |
| | |
| | | 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>> sel = rsvrRService.sel(egmd, edmd, code); |
| | | map.addAll(sel); |
| | | //用来判断是否重复统计超警信息 |
| | |
| | | } else { |
| | | text += "有" + number + "个水库站预警;" + texta + texth; |
| | | } |
| | | //水库涨幅,跌幅信息 |
| | | List<Map<String, Object>> selecthds = rsvrRService.selectsk(beginTime, endTime); |
| | | // //水库涨幅,跌幅信息 |
| | | //List<Map<String, Object>> selecthds = rsvrRService.selectsk(beginTime, endTime); |
| | | Map m1 = new HashMap(); |
| | | Map m2 = new HashMap(); |
| | | Map m = new HashMap(); |
| | | for (int j = 0; j < selecthds.size(); j++) { |
| | | String stcd = selecthds.get(j).get("STCD").toString(); |
| | | //站点名称 |
| | | String stnm = selecthds.get(j).get("STNM").toString(); |
| | | if (selecthds.get(j).get("ADDVNM") == null) { |
| | | continue; |
| | | } |
| | | //省,市 |
| | | String addvcd5 = selecthds.get(j).get("ADDVNM").toString(); |
| | | //最大值 |
| | | BigDecimal maxZ = (BigDecimal) selecthds.get(j).get("maxZ"); |
| | | //最大值出现时间 |
| | | String maxTM = selecthds.get(j).get("maxTM").toString(); |
| | | //最小值 |
| | | BigDecimal minZ = (BigDecimal) selecthds.get(j).get("minZ"); |
| | | //最小值出现时间 |
| | | String minTM = selecthds.get(j).get("minTM").toString(); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date sd1 = df.parse(maxTM); |
| | | Date sd2 = df.parse(minTM); |
| | | double v = maxZ.doubleValue(); |
| | | double v1 = minZ.doubleValue(); |
| | | //涨幅值 |
| | | double v2 = v - v1; |
| | | double v3 = (double) Math.round(v2 * 100) / 100; |
| | | m1.put(v3, stnm.replaceAll(" ", "") + "站"); |
| | | c.put(stcd, v3); |
| | | //获取涨幅最大的信息 |
| | | } |
| | | if (m1.size() != 0) { |
| | | Object maxKey = getMaxKey(m1); |
| | | String s1 = m1.get(maxKey).toString(); |
| | | text += " 涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。"; |
| | | } |
| | | // //如果最大时间大于最小时间就是涨幅 |
| | | // if (sd1.after(sd2)) { |
| | | // //创建一个map集合保存涨幅数据 |
| | | // double v = maxZ.doubleValue(); |
| | | // double v1 = minZ.doubleValue(); |
| | | // //涨幅值 |
| | | // double v2 = v - v1; |
| | | // double v3 = (double) Math.round(v2 * 100) / 100; |
| | | // m1.put(v3, stnm.replaceAll(" ", "") + "站"); |
| | | // c.put(stcd, v3); |
| | | // for (int j = 0; j < selecthds.size(); j++) { |
| | | // String stcd = selecthds.get(j).get("STCD").toString(); |
| | | // //站点名称 |
| | | // String stnm = selecthds.get(j).get("STNM").toString(); |
| | | // if (selecthds.get(j).get("ADDVNM") == null) { |
| | | // continue; |
| | | // } |
| | | // //跌幅 |
| | | // else { |
| | | // //创建一个map集合保存跌幅数据 |
| | | // double v = maxZ.doubleValue(); |
| | | // double v1 = minZ.doubleValue(); |
| | | // //涨幅值 |
| | | // double v2 = v1 - v; |
| | | // double v3 = (double) Math.round(v2 * 100) / 100; |
| | | // m2.put(Math.abs(v3), stnm.replaceAll(" ", "") + "站"); |
| | | // c.put(stcd, v3); |
| | | // } |
| | | // } |
| | | // if (m1.size()!=0) { |
| | | // //省,市 |
| | | // String addvcd5 = selecthds.get(j).get("ADDVNM").toString(); |
| | | // //最大值 |
| | | // BigDecimal maxZ = (BigDecimal) selecthds.get(j).get("maxZ"); |
| | | // //最大值出现时间 |
| | | // String maxTM = selecthds.get(j).get("maxTM").toString(); |
| | | // //最小值 |
| | | // BigDecimal minZ = (BigDecimal) selecthds.get(j).get("minZ"); |
| | | // //最小值出现时间 |
| | | // String minTM = selecthds.get(j).get("minTM").toString(); |
| | | // SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // Date sd1 = df.parse(maxTM); |
| | | // Date sd2 = df.parse(minTM); |
| | | // double v = maxZ.doubleValue(); |
| | | // double v1 = minZ.doubleValue(); |
| | | // //涨幅值 |
| | | // double v2 = v - v1; |
| | | // double v3 = (double) Math.round(v2 * 100) / 100; |
| | | // m1.put(v3, stnm.replaceAll(" ", "") + "站"); |
| | | // c.put(stcd, v3); |
| | | // //获取涨幅最大的信息 |
| | | // } |
| | | // if (m1.size() != 0) { |
| | | // Object maxKey = getMaxKey(m1); |
| | | // String s1 = m1.get(maxKey).toString(); |
| | | // text += " 涨幅最大的是:" + s1 + "(涨" + maxKey + "米)。"; |
| | | // } |
| | | // if (m2.size()!=0) { |
| | | // //获取跌幅最大的信息 |
| | | // Object maxKey2 = getMaxKey(m2); |
| | | // String s2 = m2.get(maxKey2).toString(); |
| | | // text += " 跌幅最大的是:" + s2 + "(跌" + maxKey2 + "米)。"; |
| | | // } |
| | | |
| | | m.put("text", text); |
| | | m.put("number", number); |
| | | m.put("Yjlist", ylist); |
| | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | //水库水情预警信息 |
| | | List<Map<String, Object>> map = rsvrRService.selectyjcks(egmd, edmd, timec, timez); |
| | | List<Map<String, Object>> map = rsvrRService.selectyjcks(egmd, edmd, timec, timez,time,dateEnd); |
| | | //用来判断是否重复统计超警信息 |
| | | Map mnum = new HashMap(); |
| | | //定义list保存预警信息 |
| | |
| | | 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); |
| | | //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(); |
| | |
| | | List<Map<String, Object>> selectfx(); |
| | | List<Map<String, Object>> selectyjck(String egmd,String edmd,String beginTime,String endTime); |
| | | List<Map<String, Object>> sel(String egmd,String edmd,String code); |
| | | List<Map<String, Object>> selectyjcks(String egmd,String edmd,String tm,String timez); |
| | | List<Map<String, Object>> selectyjcks(String egmd,String edmd,String tm,String timez,String time,String dateEnd); |
| | | List<Map<String, Object>> selectsk(String beginTime,String endTime); |
| | | Map<String, Object> selectRZ(String stcd,String ti); |
| | | Map<String, Object> selectInfo(String stcd); |
| | |
| | | GROUP BY a.BGMD, EDMD |
| | | </select> |
| | | |
| | | <!-- <select id="selectyjck" resultType="java.util.HashMap">--> |
| | | <!-- SELECT rs.STCD,--> |
| | | <!-- rs.TM,--> |
| | | <!-- isnull(rs.RZ, 0) as RZ,--> |
| | | <!-- rsv.FSLTDZ,--> |
| | | <!-- st.STNM,--> |
| | | <!-- st.LGTD,--> |
| | | <!-- rs.INQ,--> |
| | | <!-- rs.W,--> |
| | | <!-- rs.OTQ,--> |
| | | <!-- st.LTTD,--> |
| | | <!-- st.ADDVNM--> |
| | | <!-- FROM dbo.ST_RSVR_R rs--> |
| | | <!-- 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--> |
| | | <!-- WHERE rs.TM >#{beginTime}--> |
| | | <!-- AND rs.TM <= #{endTime}--> |
| | | <!-- ORDER BY rs.TM DESC--> |
| | | <!-- </select>--> |
| | | <select id="selectyjck" resultType="java.util.HashMap"> |
| | | SELECT rs.STCD, |
| | | rs.TM, |
| | |
| | | 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 |
| | | WHERE rs.TM > #{beginTime} |
| | | WHERE rs.TM >= #{beginTime} |
| | | AND rs.TM <= #{endTime} |
| | | ORDER BY rs.TM DESC |
| | | </select> |
| | | |
| | | <!--水库最新信息--> |
| | | <!-- <select id="selectyjcks" resultType="java.util.HashMap">--> |
| | | <!-- SELECT cs.STCD,--> |
| | | <!-- cs.TM,--> |
| | | <!-- isnull(cs1.RZ, 0) as RZ,--> |
| | | <!-- isnull(rsvr.RZS, 0) as RZS,--> |
| | | <!-- cs2.STNM,--> |
| | | <!-- cs3.INQ,--> |
| | | <!-- cs1.W,--> |
| | | <!-- cs3.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 where TM >#{dateEnd} AND TM <=#{time}) AS A--> |
| | | <!-- INNER JOIN (SELECT STCD, STNM, ADDVNM, LTTD, LGTD 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 where TM >#{dateEnd} AND TM <=#{time}) 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--> |
| | | <!-- 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--> |
| | | <!-- INNER JOIN (SELECT isnull(RZ, 0) AS RZS, STCD FROM ST_RSVR_R WHERE TM = #{tm}) rsvr--> |
| | | <!-- ON rsvr.STCD = cs.STCD--> |
| | | <!-- INNER JOIN (SELECT STCD, INQ, OTQ FROM dbo.ST_RSVR_R WHERE TM = #{timez}) cs3 ON cs.STCD = cs3.STCD--> |
| | | <!-- GROUP BY cs.STCD,--> |
| | | <!-- cs.TM,--> |
| | | <!-- cs1.RZ,--> |
| | | <!-- rsvr.RZS,--> |
| | | <!-- cs3.INQ,--> |
| | | <!-- cs1.W,--> |
| | | <!-- cs3.OTQ,--> |
| | | <!-- cs2.STNM,--> |
| | | <!-- cs2.ADDVNM,--> |
| | | <!-- cs2.LGTD,--> |
| | | <!-- cs2.LTTD,--> |
| | | <!-- rsv.FSLTDZ--> |
| | | <!-- </select> --> |
| | | <select id="selectyjcks" resultType="java.util.HashMap"> |
| | | SELECT cs.STCD, |
| | | cs.TM, |
| | | isnull(cs1.RZ, 0) as RZ, |
| | | isnull(rsvr.RZS, 0) as RZS, |
| | | isnull(cs1.RZ, 0) AS RZ, |
| | | isnull(rsvr.RZS, 0) AS RZS, |
| | | cs2.STNM, |
| | | cs3.INQ, |
| | | cs1.W, |
| | |
| | | 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 |
| | | LEFT JOIN (SELECT FSLTDZ, STCD |
| | | FROM dbo.ST_RSVRFSR_B |
| | | WHERE BGMD = #{egmd} |
| | | AND EDMD = #{edmd} |
| | | AND FSLTDZ IS NOT NULL) d ON d.STCD = A.STCD |
| | | LEFT JOIN (SELECT isnull(RZ, 0) AS RZS, STCD FROM ST_RSVR_R WHERE TM = #{tm}) z |
| | | ON z.STCD = A.STCD |
| | | LEFT JOIN (SELECT STCD, INQ, OTQ FROM dbo.ST_RSVR_R WHERE TM = #{timez}) zz |
| | | ON A.STCD = zz.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 |
| | | 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 |
| | | LEFT JOIN (SELECT FSLTDZ, STCD |
| | | FROM dbo.ST_RSVRFSR_B |
| | |
| | | <!--水库涨幅,跌幅信息--> |
| | | <select id="selectsk" resultType="java.util.HashMap"> |
| | | SELECT DISTINCT s.STCD, |
| | | isnull(s.maxZ, 0) as maxZ, |
| | | isnull(s.maxZ, 0) as maxZ, |
| | | MAX(CASE s.maxAgeNum WHEN 1 THEN s.TM ELSE '' END) OVER ( partition BY s.STCD ) maxTM, |
| | | isnull(s.minZ, 0) as minZ, |
| | | isnull(s.minZ, 0) as minZ, |
| | | MAX(CASE s.minAgeNum WHEN 1 THEN s.TM ELSE '' END) OVER ( partition BY s.STCD ) minTM, |
| | | st.STNM, |
| | | ad.ADDVNM |
| | |
| | | TM, |
| | | MAX(RZ) OVER ( partition BY STCD ) maxZ, |
| | | MIN(RZ) OVER ( partition BY STCD ) minZ, |
| | | RANK() OVER ( partition BY STCD ORDER BY RZ DESC ) maxAgeNum, |
| | | RANK() OVER ( partition BY STCD ORDER BY RZ ) minAgeNum |
| | | RANK() OVER ( partition BY STCD ORDER BY RZ DESC ) maxAgeNum, |
| | | RANK() OVER ( partition BY STCD ORDER BY RZ ) minAgeNum |
| | | FROM dbo.ST_RSVR_R |
| | | WHERE TM > #{beginTime} |
| | | AND TM <= #{endTime} |
| | |
| | | |
| | | <select id="selectInfo" resultType="java.util.HashMap"> |
| | | SELECT top 1 r.*, |
| | | rs.*, |
| | | st.*, |
| | | rsv.FSLTDZ |
| | | rs.*, |
| | | st.*, |
| | | rsv.FSLTDZ |
| | | FROM ST_RSVR_R r |
| | | LEFT JOIN ST_RSVRFCCH_B rs ON r.STCD = rs.STCD |
| | | LEFT JOIN sys_rsvr st ON st.STCD = r.STCD |
| | |
| | | |
| | | |
| | | <select id="selectCode" resultType="java.lang.String"> |
| | | SELECT stuff((SELECT ',' + CONVERT(VARCHAR(25), rs.STCD) |
| | | 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 ( '' )), |
| | | FOR XML PATH ('')), |
| | | 1, |
| | | 1, |
| | | '' |
| | | ) AS stcd |
| | | </select> |
| | | <!-- <select id="selectCode" resultType="java.lang.String">--> |
| | | <!-- SELECT stuff((SELECT ',' + CONVERT(VARCHAR(25), rs.STCD)--> |
| | | <!-- FROM sys_rsvr rs--> |
| | | <!-- FOR XML PATH ( '' )),--> |
| | | <!-- 1,--> |
| | | <!-- 1,--> |
| | | <!-- ''--> |
| | | <!-- ) AS stcd--> |
| | | <!-- </select>--> |
| | | <select id="sel" resultType="java.util.HashMap"> |
| | | SELECT cs.STCD, |
| | | cs.TM, |
| | |
| | | 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 |
| | | 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, |
| | |
| | | List<Map<String, Object>> selectfx(); |
| | | List<Map<String, Object>> selectyjck(String egmd,String edmd,String beginTime,String endTime); |
| | | List<Map<String, Object>> selectsk(String beginTime,String endTime); |
| | | List<Map<String, Object>> selectyjcks(String egmd,String edmd,String tm,String timez); |
| | | 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); |
| | | Map<String, Object> selectInfo(String stcd); |
| | | Map<String, Object> selectTinfo(int mnth,String stcd); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectyjcks( String egmd, String edmd,String tm,String timez) { |
| | | return baseMapper.selectyjcks(egmd, edmd,tm,timez); |
| | | public List<Map<String, Object>> selectyjcks( String egmd, String edmd,String tm,String timez,String time,String dateEnd) { |
| | | return baseMapper.selectyjcks(egmd, edmd,tm,timez,time,dateEnd); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String selectCode(String beginTime, String endTime) { |
| | | public String selectCode(String beginTime,String endTime) { |
| | | return baseMapper.selectCode(beginTime, endTime); |
| | | } |
| | | |