|
@@ -0,0 +1,1876 @@
|
|
|
+package com.bfms.web.controller.metplatform;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.Comparator;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
+import com.alibaba.fastjson2.JSONArray;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.bfms.common.core.controller.BaseController;
|
|
|
+import com.bfms.common.core.domain.AjaxResult;
|
|
|
+import com.bfms.common.core.redis.RedisCache;
|
|
|
+import com.bfms.common.utils.DateUtils;
|
|
|
+import com.bfms.common.utils.http.HttpUtils;
|
|
|
+import com.bfms.system.domain.QxtFileData;
|
|
|
+import com.bfms.system.domain.SysYjdata;
|
|
|
+import com.bfms.system.service.IQxtFileDataService;
|
|
|
+import com.bfms.system.service.ISysYjdataService;
|
|
|
+import com.hp.hpl.sparta.ParseException;
|
|
|
+
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/metPlatform/api/water")
|
|
|
+public class OneMapController extends BaseController{
|
|
|
+ @Autowired
|
|
|
+ private ISysYjdataService sysYjdataService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RedisCache redisCache;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IQxtFileDataService qxtFileDataService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 气温时间轴
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/temperatureTimeline")
|
|
|
+ public AjaxResult qiwenGIS() {
|
|
|
+ try {
|
|
|
+ String redisKey = "NingXiang430182:QiWen:LatestData";
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无气温时间轴数据!", null);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("气温时间数据加载成功!", resultJSONObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.success("暂无气温时间轴数据!",null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 降水时间轴
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/precipitationTimeline")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult jiangshuiGIS(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ String redisKey = "NingXiang430182:JSYB:LatestData";
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无气温时间轴数据!", null);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("降水时间轴数据加载成功!", resultJSONObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("暂无降水时间轴数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 雷达图时间轴
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/radarTimeline")
|
|
|
+ public AjaxResult radarTimeline(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ String redisKey = "radar:LatestData";
|
|
|
+ String time = OBJ.getString("time");
|
|
|
+ if (!StringUtils.isEmpty(time)) {
|
|
|
+ redisKey = "radar:" + time;
|
|
|
+ }
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无雷达图时间轴数据!", null);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("雷达图时间轴加载成功!", resultJSONObject);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 卫星云图时间轴
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/starTimeline")
|
|
|
+ public AjaxResult starDatas(@RequestBody JSONObject OBJ) {
|
|
|
+ String redisKey = "star:LatestData";
|
|
|
+ String time = OBJ.getString("time");
|
|
|
+ if (!StringUtils.isEmpty(time)) {
|
|
|
+ redisKey = "star:" + time;
|
|
|
+ }
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无卫星图时间轴数据!", null);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("卫星图时间轴数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 风场数据
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/wind")
|
|
|
+ public AjaxResult getWindGFS() {
|
|
|
+ try {
|
|
|
+ String redisKey = "WindGFS:03:"+DateUtils.dateTimeNow(DateUtils.YYYYMMDDHH);
|
|
|
+ Object resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ String msg = "";
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ Date fromdt = DateUtils.addHours(new Date(), 2);
|
|
|
+ for (int i = 0; i < 5; i++) {
|
|
|
+ Date addHours = DateUtils.addHours(fromdt, -(1+i));
|
|
|
+ redisKey = "WindGFS:03:"+DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, addHours);
|
|
|
+ //System.out.println(redisKey);
|
|
|
+ resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if(resultJSONObject!=null) {
|
|
|
+ msg = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH1,addHours)+" 10米风向风速";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success1(DateUtils.dateTimeNow(DateUtils.YYYYMMDDHH1)+" 暂无风速风向数据!",null);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ msg = DateUtils.dateTimeNow(DateUtils.YYYYMMDDHH1)+" 10米风向风速";
|
|
|
+ }
|
|
|
+ return AjaxResult.success(msg, resultJSONObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("暂无风速风向数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取json
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/getJSON")
|
|
|
+ public AjaxResult getJSON(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ String res = HttpUtils.sendGet(OBJ.getString("uri"));
|
|
|
+ if (StringUtils.isEmpty(res))
|
|
|
+ return AjaxResult.success("暂无数据!",null);
|
|
|
+ return AjaxResult.success(" 获取json文件数据成功!", JSONObject.parseObject(res));
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.success("暂无数据!",null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取jsonarr
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/getJSONArr")
|
|
|
+ public AjaxResult getJSONArr(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ String res = HttpUtils.sendGet(OBJ.getString("uri"));
|
|
|
+ if (StringUtils.isEmpty(res))
|
|
|
+ return AjaxResult.success("暂无数据!",null);
|
|
|
+
|
|
|
+ JSONArray resultJSONObject=JSON.parseArray(res);
|
|
|
+ for(int i=0;i<resultJSONObject.size();i++) {
|
|
|
+ JSONObject jsonObject = resultJSONObject.getJSONObject(i);
|
|
|
+ List<Double> a = new ArrayList<Double>();
|
|
|
+ a.add(jsonObject.getDouble("lon"));
|
|
|
+ a.add(jsonObject.getDouble("lat"));
|
|
|
+ jsonObject.put("latlng", a);
|
|
|
+ jsonObject.put("nm", jsonObject.getString("stationName"));
|
|
|
+ }
|
|
|
+ return AjaxResult.success(" 获取json文件数据成功!",resultJSONObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.success("暂无数据!",null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 森林火险点列表
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/forestFireListGIS")
|
|
|
+ public AjaxResult forestFireListGIS(@RequestBody JSONObject OBJ) {
|
|
|
+ String redisKey = "NingXiang430182:forestFireListGIS";
|
|
|
+ JSONArray resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!",null);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("森林火险点列表数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 河道水文监测站
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/riverChannelListGIS")
|
|
|
+ public AjaxResult riverChannelListGIS() {
|
|
|
+ String redisKey = "NingXiang430182:riverChannelListGIS";
|
|
|
+ JSONArray resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!",null);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("河道水文监测站列表数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 水库水文监测站
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/reservoirListGIS")
|
|
|
+ public AjaxResult reservoirListGIS() {
|
|
|
+ String redisKey = "NingXiang430182:reservoirListGIS";
|
|
|
+ JSONObject OBJ = new JSONObject();
|
|
|
+ OBJ.put("sourceFlor", "NingXiang");
|
|
|
+ OBJ.put("regionCode", "430182");
|
|
|
+ JSONArray resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("水库水文监测站列表数据加载成功!", new JSONArray());
|
|
|
+ }else {
|
|
|
+ for(int i=0;i<resultJSONObject.size();i++) {
|
|
|
+ JSONObject jsonObject = resultJSONObject.getJSONObject(i);
|
|
|
+ String id = jsonObject.getString("id");
|
|
|
+ String xxsw = OBJ.getString("sourceFlor") + OBJ.getString("regionCode") + ":"
|
|
|
+ + "sksw:"+id+"_xxsw";
|
|
|
+ resultJSONObject.getJSONObject(i).put("xxsw", redisCache.getCacheObject(xxsw)==null?"-":redisCache.getCacheObject(xxsw));
|
|
|
+ String jjsw = OBJ.getString("sourceFlor") + OBJ.getString("regionCode") + ":"
|
|
|
+ + "sksw:"+id+"_jjsw";
|
|
|
+ resultJSONObject.getJSONObject(i).put("jjsw", redisCache.getCacheObject(jjsw)==null?"-":redisCache.getCacheObject(jjsw));
|
|
|
+ String dqsw = OBJ.getString("sourceFlor") + OBJ.getString("regionCode") + ":"
|
|
|
+ + "sksw:"+id+"_dqsw";
|
|
|
+ resultJSONObject.getJSONObject(i).put("dqsw",redisCache.getCacheObject(dqsw)==null?"-":redisCache.getCacheObject(dqsw));
|
|
|
+ String bxxsw= OBJ.getString("sourceFlor") + OBJ.getString("regionCode") + ":"
|
|
|
+ + "sksw:"+id+"_bxxsw";
|
|
|
+ resultJSONObject.getJSONObject(i).put("bxxsw",redisCache.getCacheObject(dqsw)==null?"-":redisCache.getCacheObject(bxxsw));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return AjaxResult.success("水库水文监测站列表数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 文件列表
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/graphicProduct/fileData")
|
|
|
+ public AjaxResult fileData(@RequestBody JSONObject OBJ) {
|
|
|
+ String queryText = OBJ.getString("queryText");
|
|
|
+ QxtFileData query = new QxtFileData();
|
|
|
+ query.setFilenm(queryText);
|
|
|
+ query.setCategoryids( OBJ.getString("categoryids"));
|
|
|
+ List<QxtFileData> selectQxtFileDataList = qxtFileDataService.selectQxtFileDataListLIMIT(query);
|
|
|
+ return AjaxResult.success("图文产品分类树加载成功!", selectQxtFileDataList);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 图文产品分类树
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/graphicProduct/treeData")
|
|
|
+ public AjaxResult graphicProduct() {
|
|
|
+ String redisKey = "NingXiang430182:graphicProductTree";
|
|
|
+ JSONArray resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ return AjaxResult.success("图文产品分类树加载成功!", resultJSONObject);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 山洪隐患点
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/mountainTorListGIS")
|
|
|
+ public AjaxResult mountainTorListGIS() {
|
|
|
+ String redisKey = "NingXiang430182:mountainTorListGIS";
|
|
|
+ JSONArray resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!",null);
|
|
|
+ }
|
|
|
+ for(int i=0;i<resultJSONObject.size();i++) {
|
|
|
+ JSONObject jsonObject = resultJSONObject.getJSONObject(i);
|
|
|
+ jsonObject.put("fxdj", "无风险");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("山洪隐患点列表数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 山洪预警信息
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/warningnewsSH")
|
|
|
+ public AjaxResult warningnewsSH(@RequestBody JSONObject OBJ) {
|
|
|
+ if(com.bfms.common.utils.StringUtils.isNotEmpty(OBJ.getString("queryall"))) {
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ query.setGeocode(OBJ.getString("regionCode"));
|
|
|
+ query.setTop(10);
|
|
|
+ query.setContenttype("分");
|
|
|
+ query.setDescription("山洪");
|
|
|
+ query.setQueryall(OBJ.getString("queryall"));
|
|
|
+ List<SysYjdata>resultList = sysYjdataService.selectSysYjdataList(query);
|
|
|
+ return AjaxResult.success("山洪预警信息数据加载成功!", resultList);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ String redisKey = "NingXiang430182:warningnewsSH";
|
|
|
+ List<SysYjdata> resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ query.setGeocode(OBJ.getString("regionCode"));
|
|
|
+ query.setTop(10);
|
|
|
+ query.setContenttype("分");
|
|
|
+ query.setDescription("山洪");
|
|
|
+ List<SysYjdata>resultList = sysYjdataService.selectSysYjdataList(query);
|
|
|
+ redisCache.setCacheObject(redisKey, resultList,15,TimeUnit.MINUTES);
|
|
|
+ return AjaxResult.success("山洪预警信息数据加载成功!", resultList);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("山洪预警信息数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 地质灾害隐患点
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/geolDisaListGIS")
|
|
|
+ public AjaxResult geolDisaListGIS() {
|
|
|
+ String redisKey = "NingXiang430182:geolDisaListGIS";
|
|
|
+ JSONArray resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!",null);
|
|
|
+ }
|
|
|
+ for(int i=0;i<resultJSONObject.size();i++) {
|
|
|
+ JSONObject jsonObject = resultJSONObject.getJSONObject(i);
|
|
|
+ jsonObject.put("fxdj", "无风险");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("地质灾害隐患点列表数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 径流量
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/jllDatas")
|
|
|
+ public AjaxResult jllDatas(@RequestBody JSONObject OBJ) {
|
|
|
+ String code = OBJ.getString("code");
|
|
|
+ String dateTime = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, OBJ.getDate("ts"));
|
|
|
+ String redisKey = "NingXiang430182:SHYHpoints"+ ":"+dateTime+"_"+code;
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ resultJSONObject = JSONObject.parseObject("{\"seriesData\":[],\"xAxisData\":[]}");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("山洪隐患点径流量数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 地质灾害预警信号
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/warningnewsDZ")
|
|
|
+ public AjaxResult warningnewsDZ(@RequestBody JSONObject OBJ) {
|
|
|
+ if(com.bfms.common.utils.StringUtils.isNotEmpty(OBJ.getString("queryall"))) {
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ query.setGeocode(OBJ.getString("regionCode"));
|
|
|
+ query.setTop(10);
|
|
|
+ query.setContenttype("分");
|
|
|
+ query.setDescription("地质");
|
|
|
+ query.setQueryall(OBJ.getString("queryall"));
|
|
|
+ List<SysYjdata>resultList = sysYjdataService.selectSysYjdataList(query);
|
|
|
+ return AjaxResult.success("地质预警信息数据加载成功!", resultList);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ String redisKey = "NingXiang430182:warningnewsDZ";
|
|
|
+ List<SysYjdata> resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ query.setGeocode(OBJ.getString("regionCode"));
|
|
|
+ query.setTop(10);
|
|
|
+ query.setContenttype("分");
|
|
|
+ query.setDescription("地质");
|
|
|
+ List<SysYjdata>resultList = sysYjdataService.selectSysYjdataList(query);
|
|
|
+ redisCache.setCacheObject(redisKey, resultList,120,TimeUnit.MINUTES);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("查询告警信息数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 山洪隐患点等级预报
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/dzzhdjybGIS")
|
|
|
+ public AjaxResult dzzhdjybGIS(@RequestBody JSONObject OBJ) {
|
|
|
+ String redisKey = "NingXiang430182" + ":DZYHpoints" + ":LatestData";
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!",null);
|
|
|
+ }
|
|
|
+ JSONObject sebiao = new JSONObject();
|
|
|
+ sebiao.put("title", "地质灾害等级");
|
|
|
+
|
|
|
+ sebiao.put("data", JSON.parseArray("[{\"title\":\"一级(高风险)\",\"colr\":\"rgb(255,0,0)\"},{\"title\":\"二级(中风险)\",\"colr\":\"rgb(255,165,0)\"},{\"title\":\"三级(低风险)\",\"colr\":\"rgb(255,255,0)\"},{\"title\":\"四级(无风险)\",\"colr\":\"rgb(65,105,225)\"}]"));
|
|
|
+ resultJSONObject.put("sebiao", sebiao);
|
|
|
+ return AjaxResult.success("地质灾害隐患点等级预报时间轴数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 降水时序
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/getTimeLineDataJSSX")
|
|
|
+ public AjaxResult getTimeLineDataJSSX(@RequestBody(required = false) JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ String keyname = OBJ.getString("keyname");
|
|
|
+ String lon = OBJ.getString("lon");
|
|
|
+ String lat = OBJ.getString("lat");
|
|
|
+ if(com.bfms.common.utils.StringUtils.isEmpty(lat)||com.bfms.common.utils.StringUtils.isEmpty(lon)||com.bfms.common.utils.StringUtils.isEmpty(keyname)) {
|
|
|
+
|
|
|
+ keyname ="宁乡站";
|
|
|
+ lon = "112.5436";
|
|
|
+ lat = "28.2514";
|
|
|
+ }
|
|
|
+ String redisKey2 = "NingXiang430182:"+ "DMZZDJSSX:"+keyname+"";
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmm");
|
|
|
+ JSONObject resultJSONObject2 = redisCache.getCacheObject(redisKey2);
|
|
|
+ if (resultJSONObject2 == null) {
|
|
|
+ JSONObject results = new JSONObject();
|
|
|
+ results.put("title", keyname+"-逐3小时累计降水时序图");
|
|
|
+ String sendGet = HttpUtils.sendGet("http://113.247.231.105:40039/data/grid/c?adminCodes=430182000000&count=15&lon="+lon+"&lat="+lat, null);
|
|
|
+ JSONArray jSONArray = JSONArray.parseArray(sendGet);
|
|
|
+ List<BigDecimal>a = new ArrayList<BigDecimal>();
|
|
|
+ List<String>b = new ArrayList<String>();
|
|
|
+ for(int i=0;i<jSONArray.size();i++) {
|
|
|
+ JSONObject jsonOBJ = (JSONObject) jSONArray.get(i);
|
|
|
+ Date parse = sdf.parse(jsonOBJ.getString("time"));
|
|
|
+ a.add(new BigDecimal(jsonOBJ.getString("pre")));
|
|
|
+ b.add(DateUtils.parseDateToStr(DateUtils.DD_HH, parse));
|
|
|
+ }
|
|
|
+ results.put("datas", a);
|
|
|
+ results.put("xdatas", b);
|
|
|
+ redisCache.setCacheObject(redisKey2, results,1,TimeUnit.HOURS);
|
|
|
+ return AjaxResult.success(keyname+"-降雨时序图",results);
|
|
|
+ }else {
|
|
|
+ return AjaxResult.success(keyname+"-降雨时序图",resultJSONObject2);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 山洪隐患点等级预报
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/shYhdjybGIS")
|
|
|
+ public AjaxResult shYhdjybGIS(@RequestBody JSONObject OBJ) {
|
|
|
+ String redisKey = "NingXiang430182" + ":SHYHpoints" + ":LatestData";
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!",null);
|
|
|
+ }
|
|
|
+ JSONObject sebiao = new JSONObject();
|
|
|
+ sebiao.put("title", "山洪灾害等级");
|
|
|
+
|
|
|
+ sebiao.put("data", JSON.parseArray("[{\"title\":\"一级(高风险)\",\"colr\":\"rgb(255,0,0)\"},{\"title\":\"二级(中风险)\",\"colr\":\"rgb(255,165,0)\"},{\"title\":\"三级(低风险)\",\"colr\":\"rgb(255,255,0)\"},{\"title\":\"四级(无风险)\",\"colr\":\"rgb(65,105,225)\"}]"));
|
|
|
+ resultJSONObject.put("sebiao", sebiao);
|
|
|
+ return AjaxResult.success("山洪隐患点等级预报时间轴数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 山洪告警统计
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/alarmStaticSH")
|
|
|
+ public AjaxResult alarmStaticSH(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ Date sdt = OBJ.getDate("sdt");
|
|
|
+ Date edt = OBJ.getDate("edt");
|
|
|
+
|
|
|
+
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ if(sdt!=null && edt!=null) {
|
|
|
+ query.setSdt(sdt);
|
|
|
+ query.setEdt(edt);
|
|
|
+ }
|
|
|
+
|
|
|
+ query.setGeocode(OBJ.getString("regionCode"));
|
|
|
+ query.setContenttype("分");
|
|
|
+ query.setDescription("山洪");
|
|
|
+
|
|
|
+ query.setSeverityZh("红");
|
|
|
+ Integer resultListRED = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+ query.setSeverityZh("橙");
|
|
|
+ Integer resultListORAN = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+ query.setSeverityZh("黄");
|
|
|
+ Integer resultListYELL = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+ query.setSeverityZh("蓝");
|
|
|
+ Integer resultListBULL = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject resultOBJ = new JSONObject();
|
|
|
+ resultOBJ.put("barTitle", "告警统计");
|
|
|
+
|
|
|
+ JSONArray dataList = new JSONArray();
|
|
|
+
|
|
|
+ JSONObject A = new JSONObject();
|
|
|
+ A.put("rkLlData", resultListRED);
|
|
|
+ A.put("dataNum", resultListRED);
|
|
|
+ A.put("colorStr", "rgb(255 73 73/100%)");
|
|
|
+ A.put("dateTim", "一级(高风险)");
|
|
|
+ dataList.add(A);
|
|
|
+
|
|
|
+ JSONObject B = new JSONObject();
|
|
|
+ B.put("rkLlData", resultListORAN);
|
|
|
+ B.put("dataNum", resultListORAN);
|
|
|
+ B.put("colorStr", "rgb(255 174 24/100%)");
|
|
|
+ B.put("dateTim", "二级(中风险)");
|
|
|
+ dataList.add(B);
|
|
|
+
|
|
|
+ JSONObject C = new JSONObject();
|
|
|
+ C.put("rkLlData", resultListYELL);
|
|
|
+ C.put("dataNum", resultListYELL);
|
|
|
+ C.put("colorStr", "rgb(255 255 47/100%)");
|
|
|
+ C.put("dateTim", "三级(低风险)");
|
|
|
+ dataList.add(C);
|
|
|
+
|
|
|
+ JSONObject D = new JSONObject();
|
|
|
+ D.put("rkLlData", resultListBULL);
|
|
|
+ D.put("dataNum", resultListBULL);
|
|
|
+ D.put("colorStr", "royalblue");
|
|
|
+ D.put("dateTim", "四级(无风险)");
|
|
|
+ dataList.add(D);
|
|
|
+
|
|
|
+
|
|
|
+ resultOBJ.put("data", dataList);
|
|
|
+ String desTitle = DateUtils.parseDateToStr(DateUtils.MMDDHH,sdt)+"-"+DateUtils.parseDateToStr(DateUtils.MMDDHH,edt)+"统计数据";
|
|
|
+ resultOBJ.put("desTitle",desTitle);
|
|
|
+ return AjaxResult.success("查询告警统计数据加载成功!", resultOBJ);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 防汛信息
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/FangXunGIS")
|
|
|
+ public AjaxResult cfInfoGIS() {
|
|
|
+ String redisKey = "NingXiang430182:FangXunCKWZGIS";
|
|
|
+ JSONArray resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ for(int i=0;i<resultJSONObject.size();i++) {
|
|
|
+ JSONObject jsonObject = resultJSONObject.getJSONObject(i);
|
|
|
+ List<Double> a = new ArrayList<Double>();
|
|
|
+ a.add(jsonObject.getDouble("lon"));
|
|
|
+ a.add(jsonObject.getDouble("lat"));
|
|
|
+ jsonObject.put("latlng", a);
|
|
|
+ jsonObject.put("nm", jsonObject.getString("cknm"));
|
|
|
+ }
|
|
|
+ return AjaxResult.success("防汛信息站列表数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 【应急一张图】一张图告警统计
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/alarmStatic")
|
|
|
+ public AjaxResult alarmStatic(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ Date sdt = OBJ.getDate("sdt");
|
|
|
+ Date edt = OBJ.getDate("edt");
|
|
|
+
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+
|
|
|
+
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ if(sdt!=null && edt!=null) {
|
|
|
+ query.setSdt(sdt);
|
|
|
+ query.setEdt(edt);
|
|
|
+ }
|
|
|
+
|
|
|
+ query.setGeocode(OBJ.getString("regionCode"));
|
|
|
+ query.setContenttype("分");
|
|
|
+
|
|
|
+ query.setSeverity("QXYJ");
|
|
|
+ Integer resultListQX = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+ //query.setDescription("水库");
|
|
|
+ query.setSeverity("SKYJ");
|
|
|
+ Integer resultListSK = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+ //query.setDescription("河道");
|
|
|
+ query.setSeverity("HDYJ");
|
|
|
+ Integer resultListHD = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+ query.setDescription("山洪");
|
|
|
+ Integer resultListSH = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+ query.setDescription("地质");
|
|
|
+ Integer resultListDZ = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+ query.setDescription("森林");
|
|
|
+ Integer resultListSL = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+ JSONObject resultOBJ = new JSONObject();
|
|
|
+ resultOBJ.put("barTitle", "告警统计");
|
|
|
+
|
|
|
+ List<String> EchartX = new ArrayList<String>();
|
|
|
+ List<Integer> EchartD = new ArrayList<Integer>();
|
|
|
+
|
|
|
+ EchartX.add("气象预警");
|
|
|
+ EchartX.add("水库水位");
|
|
|
+ EchartX.add("河道水位");
|
|
|
+ EchartX.add("山洪");
|
|
|
+ EchartX.add("地质灾害");
|
|
|
+ EchartX.add("森林火险");
|
|
|
+
|
|
|
+ EchartD.add(resultListQX);
|
|
|
+ EchartD.add(resultListSK);
|
|
|
+ EchartD.add(resultListHD);
|
|
|
+ EchartD.add(resultListSH);
|
|
|
+ EchartD.add(resultListDZ);
|
|
|
+ EchartD.add(resultListSL);
|
|
|
+ result.put("EchartX", EchartX);
|
|
|
+ result.put("EchartD", EchartD);
|
|
|
+
|
|
|
+ String desTitle = DateUtils.parseDateToStr(DateUtils.MMDDHH,sdt)+"-"+DateUtils.parseDateToStr(DateUtils.MMDDHH,edt)+"统计数据";
|
|
|
+ result.put("desTitle",desTitle);
|
|
|
+ return AjaxResult.success("查询告警统计数据加载成功!", result);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 一张图告警信息列表
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/warningInfosList")
|
|
|
+ public AjaxResult warningInfosList(@RequestBody JSONObject OBJ) {
|
|
|
+ Date startDt = null;
|
|
|
+ Date endDt = null;
|
|
|
+
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ query.setGeocode("430182");
|
|
|
+ query.setTop(10);
|
|
|
+ JSONArray jsonArray = OBJ.getJSONArray("time");
|
|
|
+ if(jsonArray!=null&&jsonArray.size()>0) {
|
|
|
+ query.setSeverity("NOall");
|
|
|
+ query.setSdt(jsonArray.getDate(0));
|
|
|
+ query.setEdt(jsonArray.getDate(1));
|
|
|
+ query.setQueryall("NO");
|
|
|
+
|
|
|
+ startDt = jsonArray.getDate(0);
|
|
|
+ endDt = jsonArray.getDate(1);
|
|
|
+ }else {
|
|
|
+ query.setSeverity("all");
|
|
|
+ }
|
|
|
+
|
|
|
+ query.setSender("系统监测预警");
|
|
|
+ List<SysYjdata>resultList = sysYjdataService.selectSysYjdataList(query);
|
|
|
+ JSONObject RES = JSON.parseObject("{'barTitle':'预警信息','ts':'2023-01-1616:06','data':[]}");
|
|
|
+
|
|
|
+ JSONArray R = new JSONArray();
|
|
|
+ for(int i=0;i<resultList.size();i++) {
|
|
|
+ SysYjdata sysYjdata = resultList.get(i);
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
+ obj.put("title", sysYjdata.getDescription());
|
|
|
+ obj.put("typ", sysYjdata.getEventname());
|
|
|
+ obj.put("tim", sysYjdata.getIseffect()+"小时");
|
|
|
+ obj.put("author", "-");
|
|
|
+ R.add(obj);
|
|
|
+ }
|
|
|
+ RES.put("data", R);
|
|
|
+ String desTitle = DateUtils.parseDateToStr(DateUtils.MMDDHH,startDt)+"-"+DateUtils.parseDateToStr(DateUtils.MMDDHH,endDt)+"告警信息";
|
|
|
+
|
|
|
+ return AjaxResult.success(desTitle, RES);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 未来7天天气数据
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/futureSevenDayWeather")
|
|
|
+ public AjaxResult futureSevenDayWeather(@RequestBody(required = false) JSONObject OBJ) {
|
|
|
+ String redisKey = "NingXiang430182:Weather" ;
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null && OBJ!=null ) {
|
|
|
+ String res = HttpUtils.sendGet(OBJ.getString("uri"));
|
|
|
+ if (StringUtils.isEmpty(res))
|
|
|
+ return AjaxResult.error(999, "未来7天天气数据失败!");
|
|
|
+ resultJSONObject = JSONObject.parseObject(res);
|
|
|
+ redisCache.setCacheObject(redisKey, resultJSONObject);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("未来7天天气数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预警信号
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/warningnews")
|
|
|
+ public AjaxResult warningnews(@RequestBody JSONObject OBJ) {
|
|
|
+
|
|
|
+ if(com.bfms.common.utils.StringUtils.isNotEmpty(OBJ.getString("queryall"))) {
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ query.setGeocode(OBJ.getString("regionCode"));
|
|
|
+ query.setTop(10);
|
|
|
+ query.setQueryall(OBJ.getString("queryall"));
|
|
|
+ List<SysYjdata>resultList = sysYjdataService.selectSysYjdataList(query);
|
|
|
+ return AjaxResult.success("查询交通告警信息数据加载成功!", resultList);
|
|
|
+
|
|
|
+ }
|
|
|
+ String redisKey = "NingXiang430182:warningnews";
|
|
|
+ List<SysYjdata> resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ query.setGeocode(OBJ.getString("regionCode"));
|
|
|
+ query.setTop(10);
|
|
|
+ List<SysYjdata>resultList = sysYjdataService.selectSysYjdataList(query);
|
|
|
+ redisCache.setCacheObject(redisKey, resultList,180,TimeUnit.MINUTES);
|
|
|
+ return AjaxResult.success("查询告警信息数据加载成功!", resultList);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("查询告警信息数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 气象灾害预警信息
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/QXZHWarning")
|
|
|
+ public AjaxResult QXZHWarning(@RequestBody JSONObject OBJ) {
|
|
|
+ if(com.bfms.common.utils.StringUtils.isNotEmpty(OBJ.getString("queryall"))) {
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ query.setGeocode(OBJ.getString("regionCode"));
|
|
|
+ query.setTop(10);
|
|
|
+ query.setContenttype("分");
|
|
|
+ query.setDescription("灾害");
|
|
|
+ query.setQueryall(OBJ.getString("queryall"));
|
|
|
+ List<SysYjdata>resultList = sysYjdataService.selectSysYjdataList(query);
|
|
|
+ return AjaxResult.success("查询交通告警信息数据加载成功!", resultList);
|
|
|
+
|
|
|
+ }
|
|
|
+ String redisKey = "NingXiang430182:QXZHWarning";
|
|
|
+ List<SysYjdata> resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ query.setGeocode(OBJ.getString("regionCode"));
|
|
|
+ query.setTop(10);
|
|
|
+ query.setContenttype("分");
|
|
|
+ query.setDescription("灾害");
|
|
|
+ List<SysYjdata>resultList = sysYjdataService.selectSysYjdataList(query);
|
|
|
+ redisCache.setCacheObject(redisKey, resultList,15,TimeUnit.MINUTES);
|
|
|
+ return AjaxResult.success("查询交通告警信息数据加载成功!", resultList);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("查询交通告警信息数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 森林防火灾害预警
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/SLFHWarning")
|
|
|
+ public AjaxResult SLFHWarning(@RequestBody JSONObject OBJ) {
|
|
|
+ if(com.bfms.common.utils.StringUtils.isNotEmpty(OBJ.getString("queryall"))) {
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ query.setGeocode(OBJ.getString("regionCode"));
|
|
|
+ query.setTop(10);
|
|
|
+ query.setContenttype("分");
|
|
|
+ query.setDescription("火");
|
|
|
+ query.setQueryall(OBJ.getString("queryall"));
|
|
|
+ List<SysYjdata>resultList = sysYjdataService.selectSysYjdataList(query);
|
|
|
+ return AjaxResult.success("查询森林防火灾害数据加载成功!", resultList);
|
|
|
+
|
|
|
+ }
|
|
|
+ String redisKey = "NingXiang430182:SLFHWarning";
|
|
|
+ List<SysYjdata> resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ query.setGeocode(OBJ.getString("regionCode"));
|
|
|
+ query.setTop(10);
|
|
|
+ query.setContenttype("分");
|
|
|
+ query.setDescription("火");
|
|
|
+ List<SysYjdata>resultList = sysYjdataService.selectSysYjdataList(query);
|
|
|
+ redisCache.setCacheObject(redisKey, resultList,15,TimeUnit.MINUTES);
|
|
|
+ return AjaxResult.success("查询森林防火灾害数据加载成功!", resultList);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("查询森林防火灾害数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 防汛物资列表
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/FangXunCKWZGIS")
|
|
|
+ public AjaxResult FangXunCKWZGIS(@RequestBody JSONObject OBJ) {
|
|
|
+ String cangkuid = OBJ.getString("CKid");
|
|
|
+ String redisKey = "NingXiang430182:FangXunCKWZ"+ ":" + cangkuid;
|
|
|
+ JSONArray resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!",null);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("防汛物资列表数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 流域负责人信息
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/riverTorListGIS")
|
|
|
+ public AjaxResult riverTorListGIS(@RequestBody JSONObject OBJ) {
|
|
|
+ String redisKey = "NingXiang430182:riverTorListGIS";
|
|
|
+ JSONArray resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!",null);
|
|
|
+ }
|
|
|
+ String key = "rankOfStationSQHD";
|
|
|
+
|
|
|
+ JSONArray resultJSONObjectRE = new JSONArray();
|
|
|
+ String msg = "";
|
|
|
+
|
|
|
+ for(int i=0;i<resultJSONObject.size();i++) {
|
|
|
+ JSONObject obj = (JSONObject) resultJSONObject.get(i);
|
|
|
+
|
|
|
+ JSONObject objNew = new JSONObject();
|
|
|
+ objNew.put("nm", obj.getString("nm"));
|
|
|
+ objNew.put("latlng", obj.getJSONArray("latlng"));
|
|
|
+ objNew.put("lon", obj.getJSONArray("latlng").get(0));
|
|
|
+ objNew.put("lat", obj.getJSONArray("latlng").get(1));
|
|
|
+ objNew.put("auth", obj.getString("auth"));
|
|
|
+ objNew.put("phone", obj.getString("phone"));
|
|
|
+ objNew.put("addr", obj.getString("addr"));
|
|
|
+ objNew.put("fxdj", "无风险");
|
|
|
+ String skcode = obj.getString("nm");
|
|
|
+ if(skcode.equals("石坝子")) {
|
|
|
+ skcode="61116900";
|
|
|
+ }else if(skcode.equals(("宁乡(三)"))) {
|
|
|
+ skcode="61116400";
|
|
|
+ }
|
|
|
+ String redisKey1 = "NingXiang430182:reservoirRainFall"+ ":" + skcode;;
|
|
|
+ JSONArray resultJSONObject11 = redisCache.getCacheObject(redisKey1);
|
|
|
+
|
|
|
+ if(resultJSONObject11!=null && resultJSONObject11.size()>0) {
|
|
|
+
|
|
|
+ JSONObject OBJT = (JSONObject) resultJSONObject11.get(0);
|
|
|
+ objNew.put("shuiwei", OBJT.getString("shuiwei"));
|
|
|
+ objNew.put("xxsw", OBJT.getString("xxsw"));
|
|
|
+ objNew.put("liuliang", OBJT.getString("liuliang"));
|
|
|
+ msg=OBJT.getString("timeObserve")+",当日河道最新水情数据";
|
|
|
+ objNew.put("time", OBJT.getString("timeObserve"));
|
|
|
+
|
|
|
+ }else {
|
|
|
+ objNew.put("waterLevel", "-");
|
|
|
+ objNew.put("floodLevel", "-");
|
|
|
+ objNew.put("time", "-");
|
|
|
+ objNew.put("liuliang", "-");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ resultJSONObjectRE.add(objNew);
|
|
|
+
|
|
|
+ }
|
|
|
+ return AjaxResult.success(msg, resultJSONObjectRE);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping(value = "/allWt")
|
|
|
+ public AjaxResult allWt(@RequestBody JSONObject OBJ) {
|
|
|
+ JSONObject RESULT = new JSONObject();
|
|
|
+ JSONArray allWtArray = OBJ.getJSONArray("ts");
|
|
|
+ Date st = allWtArray.getDate(0);
|
|
|
+ Date st1 = allWtArray.getDate(0);
|
|
|
+ Date et = allWtArray.getDate(1);
|
|
|
+ try {
|
|
|
+ Map<String,Object>marks = new HashMap<String, Object>();
|
|
|
+
|
|
|
+ long diffInMillis = et.getTime() - st.getTime(); // 计算毫秒差值
|
|
|
+ int count = Integer.valueOf(""+diffInMillis / (60 * 60 * 1000)); // 毫秒转换为小时
|
|
|
+
|
|
|
+ BigDecimal all = new BigDecimal(0);
|
|
|
+ Map<String,JSONObject> MAP = new HashMap<String, JSONObject>();
|
|
|
+ for(int i=0;i<count;i++) {
|
|
|
+
|
|
|
+ String redisKEY = "NingXiang430182:rankOfStation:"+DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, st);
|
|
|
+ System.out.println(redisKEY);
|
|
|
+ JSONArray resultJSONObject = redisCache.getCacheObject(redisKEY);
|
|
|
+ if(resultJSONObject!=null) {
|
|
|
+ for(int j=0;j<resultJSONObject.size()-1;j++) {
|
|
|
+ JSONObject jsonObject = resultJSONObject.getJSONObject(j);
|
|
|
+ JSONObject B = MAP.get(jsonObject.getString("stationName"));
|
|
|
+ if(B==null) {
|
|
|
+ MAP.put(jsonObject.getString("stationName"), jsonObject);
|
|
|
+ all=all.add(jsonObject.getBigDecimal("value"));
|
|
|
+ }else {
|
|
|
+ BigDecimal bigDecimal1 = B.getBigDecimal("value");
|
|
|
+ BigDecimal bigDecimal2 = jsonObject.getBigDecimal("value");
|
|
|
+ B.put("value", bigDecimal1.add(bigDecimal2));
|
|
|
+ all=all.add(bigDecimal2);
|
|
|
+ MAP.put(B.getString("stationName"), B);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Calendar instance = Calendar.getInstance();
|
|
|
+ instance.setTime(st);
|
|
|
+ instance.add(Calendar.HOUR_OF_DAY, 1);
|
|
|
+ st = instance.getTime();
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ JSONArray RESOBJ = new JSONArray();
|
|
|
+ for (Map.Entry<String, JSONObject> entry : MAP.entrySet()) {
|
|
|
+ JSONObject value = entry.getValue(); // 获取value值
|
|
|
+ JSONArray A = new JSONArray();
|
|
|
+ A.add(value.getString("lon"));
|
|
|
+ A.add(value.getString("lat"));
|
|
|
+ value.put("latlng",A);
|
|
|
+ RESOBJ.add(value);
|
|
|
+ }
|
|
|
+
|
|
|
+ return AjaxResult.success(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH1, st1)+"-"+DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH1, et)+"累积降水"+all+"(mm)", RESOBJ);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 【综合预报】某地区水库雨面量排名
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/areaRainOfHydroList")
|
|
|
+ public AjaxResult areaRainOfHydroList(@RequestBody JSONObject OBJ) {
|
|
|
+ String redisKey = "NingXiang430182:reservoirListGIS";
|
|
|
+ String time = OBJ.getString("time");
|
|
|
+ //resultJSONObject = JSONObject.parseObject("{\"forecastAreaRainOfHydroList\":[{\"hydroName\":\"黄材水库\",\"address\":\"湖南省长沙市宁乡市沩山风景名胜区黄材水库\",\"areaRain\":\"-\"},{\"hydroName\":\"田坪水库\",\"address\":\"湖南省长沙市宁乡市\",\"areaRain\":\"-\"},{\"hydroName\":\"洞庭桥水库\",\"address\":\"湖南省长沙市宁乡市\",\"areaRain\":\"-\"},{\"hydroName\":\"华光水库\",\"address\":\"湖南省长沙市宁乡市\",\"areaRain\":\"-\"},{\"hydroName\":\"铁冲水库\",\"address\":\"湖南省长沙市宁乡市\",\"areaRain\":\"-\"}]}");
|
|
|
+
|
|
|
+ String desTitle = "";
|
|
|
+ if(StringUtils.isEmpty(time)) {
|
|
|
+
|
|
|
+ time=DateUtils.dateTimeNow(DateUtils.YYYYMMDDHH+"00");
|
|
|
+ desTitle = DateUtils.dateTimeNow(DateUtils.YYYYMMDDHH1);
|
|
|
+ }
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ JSONArray jsonArray = redisCache.getCacheObject(redisKey);
|
|
|
+ for(int i=0;i<jsonArray.size();i++) {
|
|
|
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ String myl = "0";
|
|
|
+ if(com.bfms.common.utils.StringUtils.isNotEmpty(time)) {
|
|
|
+ myl = redisCache.getCacheObject("NingXiang430182:rankOfRainfallArea:SK:"+jsonObject.getString("nm")+":"+time);
|
|
|
+ }
|
|
|
+ jsonObject.put("hydroName", jsonObject.getString("nm"));
|
|
|
+ jsonObject.put("address", "湖南省长沙市宁乡市");
|
|
|
+ jsonObject.put("areaRain", myl==null?'-':myl);
|
|
|
+ jsonObject.put("basinId", jsonObject.getString("id"));
|
|
|
+ jsonObject.put("basinName",jsonObject.getString("nm"));
|
|
|
+ JSONArray jsonArray2 = jsonObject.getJSONArray("latlng");
|
|
|
+ jsonObject.put("centerPoint",jsonArray2.getString(0)+","+jsonArray2.getString(1));
|
|
|
+ jsonObject.put("lon",jsonArray2.getString(0));
|
|
|
+ jsonObject.put("lat",jsonArray2.getString(1));
|
|
|
+ }
|
|
|
+ result.put("forecastAreaRainOfHydroList", jsonArray);
|
|
|
+ return AjaxResult.success(desTitle+"水库面雨量排名", result);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 洪水等级预报
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/shdjybTimeline")
|
|
|
+ public AjaxResult shdjybTimeline(@RequestBody JSONObject OBJ) {
|
|
|
+ String redisKey = "NingXiang430182:HSJCpoints:LatestData";
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!",null);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("洪水等级预报时间轴数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 地质灾害告警统计
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/alarmStaticDZ")
|
|
|
+ public AjaxResult alarmStaticDZ(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ Date sdt = OBJ.getDate("sdt");
|
|
|
+ Date edt = OBJ.getDate("edt");
|
|
|
+
|
|
|
+
|
|
|
+ SysYjdata query = new SysYjdata();
|
|
|
+ if(sdt!=null && edt!=null) {
|
|
|
+ query.setSdt(sdt);
|
|
|
+ query.setEdt(edt);
|
|
|
+ }
|
|
|
+
|
|
|
+ query.setGeocode(OBJ.getString("regionCode"));
|
|
|
+ query.setContenttype("分");
|
|
|
+ query.setDescription("地质");
|
|
|
+
|
|
|
+ query.setSeverityZh("红");
|
|
|
+ Integer resultListRED = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+ query.setSeverityZh("橙");
|
|
|
+ Integer resultListORAN = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+ query.setSeverityZh("黄");
|
|
|
+ Integer resultListYELL = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+ query.setSeverityZh("蓝");
|
|
|
+ Integer resultListBULL = sysYjdataService.selectSysYjdataListCount(query);
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject resultOBJ = new JSONObject();
|
|
|
+ resultOBJ.put("barTitle", "告警统计");
|
|
|
+
|
|
|
+ JSONArray dataList = new JSONArray();
|
|
|
+
|
|
|
+ JSONObject A = new JSONObject();
|
|
|
+ A.put("rkLlData", resultListRED);
|
|
|
+ A.put("dataNum", resultListRED);
|
|
|
+ A.put("colorStr", "rgb(255 73 73/100%)");
|
|
|
+ A.put("dateTim", "一级(高风险)");
|
|
|
+ dataList.add(A);
|
|
|
+
|
|
|
+ JSONObject B = new JSONObject();
|
|
|
+ B.put("rkLlData", resultListORAN);
|
|
|
+ B.put("dataNum", resultListORAN);
|
|
|
+ B.put("colorStr", "rgb(255 174 24/100%)");
|
|
|
+ B.put("dateTim", "二级(中风险)");
|
|
|
+ dataList.add(B);
|
|
|
+
|
|
|
+ JSONObject C = new JSONObject();
|
|
|
+ C.put("rkLlData", resultListYELL);
|
|
|
+ C.put("dataNum", resultListYELL);
|
|
|
+ C.put("colorStr", "rgb(255 255 47/100%)");
|
|
|
+ C.put("dateTim", "三级(低风险)");
|
|
|
+ dataList.add(C);
|
|
|
+
|
|
|
+ JSONObject D = new JSONObject();
|
|
|
+ D.put("rkLlData", resultListBULL);
|
|
|
+ D.put("dataNum", resultListBULL);
|
|
|
+ D.put("colorStr", "royalblue");
|
|
|
+ D.put("dateTim", "四级(无风险)");
|
|
|
+ dataList.add(D);
|
|
|
+
|
|
|
+
|
|
|
+ resultOBJ.put("data", dataList);
|
|
|
+ String desTitle = DateUtils.parseDateToStr(DateUtils.MMDDHH,sdt)+"-"+DateUtils.parseDateToStr(DateUtils.MMDDHH,edt)+"统计数据";
|
|
|
+ resultOBJ.put("desTitle",desTitle);
|
|
|
+ return AjaxResult.success("查询告警统计数据加载成功!", resultOBJ);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.success("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 地质灾害预警信息列表
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/warningInfosListDZ")
|
|
|
+ public AjaxResult warningInfosListDZ(@RequestBody JSONObject OBJ) {
|
|
|
+
|
|
|
+ String redisKey = "NingXiang430182:warningInfosListDZ";
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("查询告警信息数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 综合预报时间轴
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/comprehensiveForecastLT")
|
|
|
+ public AjaxResult comprehensiveForecastLT(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ JSONObject RESULT = new JSONObject();
|
|
|
+ JSONObject RES = new JSONObject();
|
|
|
+ RES.put("step", 1);
|
|
|
+ RES.put("value", 0);
|
|
|
+ String typ = OBJ.getString("type");
|
|
|
+ if (StringUtils.isEmpty(typ)) {
|
|
|
+ typ ="0";
|
|
|
+ }
|
|
|
+ String redisKey = "NingXiang430182:comprehensiveForecastLT" + "_" + typ;
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ Map<String,Object>marks = new HashMap<String, Object>();
|
|
|
+ if(typ.equals("0")) {
|
|
|
+ //自己构建时间轴
|
|
|
+ Date start = new Date();
|
|
|
+ for(int i=0;i<7;i++) {
|
|
|
+ JSONObject mark = new JSONObject();
|
|
|
+ Calendar a = Calendar.getInstance();
|
|
|
+ a.setTime(start);
|
|
|
+ a.add(Calendar.DAY_OF_MONTH, +1);
|
|
|
+ Date endT = a.getTime();
|
|
|
+ String des =DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_zh, start)+"-"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_zh, endT)+"";
|
|
|
+ mark.put("des",des);
|
|
|
+ mark.put("rediskey",DateUtils.parseDateToStr(DateUtils.YYYYMMDD, start));
|
|
|
+ mark.put("nm", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_zh, start));
|
|
|
+ mark.put("ts",DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, start)+" 01:00");
|
|
|
+ marks.put(i+"", mark);
|
|
|
+ start=endT;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if(typ.equals("1")) {
|
|
|
+ //自己构建时间轴
|
|
|
+ Date start = new Date();
|
|
|
+ Calendar B = Calendar.getInstance();
|
|
|
+ B.setTime(start);
|
|
|
+ B.set(Calendar.HOUR_OF_DAY, 5);
|
|
|
+ start = B.getTime();
|
|
|
+ for(int i=0;i<7;i++) {
|
|
|
+ JSONObject mark = new JSONObject();
|
|
|
+ Calendar a = Calendar.getInstance();
|
|
|
+ a.setTime(start);
|
|
|
+ a.add(Calendar.HOUR_OF_DAY, +3);
|
|
|
+ Date endT = a.getTime();
|
|
|
+ String des =DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH1, start)+"-"+DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH1, endT)+"";
|
|
|
+ mark.put("des",des);
|
|
|
+ mark.put("rediskey",DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH+"00", endT));
|
|
|
+ mark.put("nm", DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH1, endT));
|
|
|
+ mark.put("ts",DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, endT));
|
|
|
+ marks.put(i+"", mark);
|
|
|
+ start=endT;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ RES.put("marks", marks);
|
|
|
+ RES.put("max", 7);
|
|
|
+ redisCache.setCacheObject(redisKey, RES, 2, TimeUnit.HOURS);
|
|
|
+ return AjaxResult.success("综合预报时间轴数据加载成功!", RES);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return AjaxResult.success("综合预报时间轴数据加载成功!", resultJSONObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 综合预报查询某个水库集雨区-降雨信息-未来集雨区面雨量预报
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/rainfallVolumeForcast")
|
|
|
+ public AjaxResult rainfallVolumeForcast(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ String skcode = OBJ.getString("skcode");
|
|
|
+ if(StringUtils.isEmpty(skcode)) {
|
|
|
+ skcode="14";
|
|
|
+ }
|
|
|
+ String redisKey = "NingXiang430182:" + "rainfallVolumeForcast:" + skcode;
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ resultJSONObject = JSONObject.parseObject("{\"seriesWl\":[],\"seriesInflow\":[],\"xAxisData\":[]}");
|
|
|
+ }
|
|
|
+
|
|
|
+ return AjaxResult.success("未来集雨区面雨量预报数据加载成功!", resultJSONObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping(value = "/LrainfallVolumeForcast")
|
|
|
+ public AjaxResult LrainfallVolumeForcast(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ String skcode = OBJ.getString("skcode");
|
|
|
+ String redisKey = "NingXiang430182:" + "LrainfallVolumeForcast:" + skcode;
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ resultJSONObject = JSONObject.parseObject("{\"lstableData\":[],\"title\":\"水库实况\",\"lsDesCol\":[]}");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("未来集雨区来水预报数据加载成功!", resultJSONObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 综合预报-水库未来入库流量面雨量预报
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/reservoirFInfo")
|
|
|
+ public AjaxResult reservoirFInfo(@RequestBody JSONObject OBJ) {
|
|
|
+ String skcode = OBJ.getString("skcode");
|
|
|
+ String type = OBJ.getString("type");
|
|
|
+ String redisKey = "NingXiang430182:" + "reservoirFInfo:" + skcode + "_" + type;
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ resultJSONObject = JSONObject.parseObject("{\"data\":[],\"title\":\"黄材水库实况\"}");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("水库未来水量数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 未来降水量预报
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/rainfallVolumeF")
|
|
|
+ public AjaxResult rainfallVolumeF(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ String skcode = OBJ.getString("skcode");
|
|
|
+ String type = OBJ.getString("type");
|
|
|
+ if(StringUtils.isEmpty(type)) {
|
|
|
+ type="0";
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(skcode)) {
|
|
|
+ skcode="14";
|
|
|
+ }
|
|
|
+ String redisKey = "";
|
|
|
+
|
|
|
+ if(type.equals("0")) {
|
|
|
+ if(skcode.equals("14")||skcode.indexOf("黄材")>=0) {
|
|
|
+ skcode="HC";
|
|
|
+ }else if(skcode.equals("46")||skcode.equals("611H1952")||skcode.indexOf("洞庭桥")>=0) {
|
|
|
+ skcode="DTQ";
|
|
|
+ }else if(skcode.equals("369")||skcode.indexOf("铁冲")>=0) {
|
|
|
+ skcode="TC";
|
|
|
+ }else if(skcode.equals("372")||skcode.equals("611H1951")||skcode.indexOf("田坪")>=0) {
|
|
|
+ skcode="TP";
|
|
|
+ }else if(skcode.equals("373")||skcode.indexOf("老龙")>=0) {
|
|
|
+ skcode="YL";
|
|
|
+ }
|
|
|
+ String time = DateUtils.dateTimeNow(DateUtils.YYYYMMDD);
|
|
|
+ redisKey= "NingXiang430182:HSReservoirs:"+time+"_"+skcode;
|
|
|
+
|
|
|
+ }else {
|
|
|
+ redisKey = "NingXiang430182:" + "rainfallVolumeF:" + skcode + "_" + type;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ resultJSONObject = JSONObject.parseObject("{\"seriesWl\": [],\"seriesInflow\": [], \"xAxisData\": [] }");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("未来降水量数据加载成功!", resultJSONObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 【综合预报】某地区流域雨面量排名
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/rankOfRainfallArea")
|
|
|
+ public AjaxResult rankOfRainfallArea(@RequestBody JSONObject OBJ) throws java.text.ParseException {
|
|
|
+ String time = OBJ.getString("time");
|
|
|
+ String type = OBJ.getString("type");
|
|
|
+ String myl = "-";//面雨量
|
|
|
+ String desTitle = "";
|
|
|
+ if(StringUtils.isEmpty(time)) {
|
|
|
+
|
|
|
+ time=DateUtils.dateTimeNow(DateUtils.YYYYMMDDHH+"00");
|
|
|
+ desTitle = DateUtils.dateTimeNow(DateUtils.YYYYMMDDHH1);
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(type)){
|
|
|
+ type="1";
|
|
|
+ }
|
|
|
+ String redisKey = "NingXiang430182:rankOfRainfallArea:data" ;
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject != null) {
|
|
|
+ JSONArray forecastAreaRainOfBasinList = resultJSONObject.getJSONArray("forecastAreaRainOfBasinList");
|
|
|
+ for(int i=0;i<forecastAreaRainOfBasinList.size();i++) {
|
|
|
+ JSONObject jsonObject = forecastAreaRainOfBasinList.getJSONObject(i);
|
|
|
+ if(com.bfms.common.utils.StringUtils.isNotEmpty(time)) {
|
|
|
+ if(type.equals("1")){
|
|
|
+ //逐三小时面雨量直接取值
|
|
|
+ myl = redisCache.getCacheObject("NingXiang430182:rankOfRainfallArea:LY:"+jsonObject.getString("basinId")+":"+time);
|
|
|
+ }else if(type.equals("0")){
|
|
|
+ BigDecimal avageMYL = new BigDecimal("0");
|
|
|
+ //如果是逐7天那么拿当前点的24小时计算平均值
|
|
|
+ time = time+"00";
|
|
|
+ SimpleDateFormat DF = new SimpleDateFormat("yyyyMMddHH");
|
|
|
+ Date TIME = DF.parse(time);
|
|
|
+ for(int j=0;j<24;j++){
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ c.setTime(TIME);
|
|
|
+ c.add(Calendar.HOUR_OF_DAY,j);
|
|
|
+ String timeD =DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH,c.getTime())+"00";
|
|
|
+
|
|
|
+ String a = redisCache.getCacheObject("NingXiang430182:rankOfRainfallArea:LY:"+jsonObject.getString("basinId")+":"+timeD);
|
|
|
+ avageMYL = avageMYL.add(a==null?new BigDecimal(0):new BigDecimal(a));
|
|
|
+ }
|
|
|
+
|
|
|
+ myl = avageMYL.divide(new BigDecimal(24),2, RoundingMode.HALF_UP)+"";
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ jsonObject.put("areaRain", myl==null?"0.0":new BigDecimal(myl));
|
|
|
+ jsonObject.put("latlng", new String[] {jsonObject.getString("lon"),jsonObject.getString("lat")});
|
|
|
+ jsonObject.put("nm", jsonObject.getString("basinName"));
|
|
|
+ //System.out.println(jsonObject.get("areaRain"));
|
|
|
+ }
|
|
|
+
|
|
|
+ forecastAreaRainOfBasinList.sort(Comparator.comparing(obj -> ((JSONObject) obj).getString("areaRain")).reversed());
|
|
|
+
|
|
|
+ }
|
|
|
+ return AjaxResult.success(desTitle+"流域面雨量排名", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 实况综合-水库集雨区面雨量实况
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/reservoirSKMYLSK")
|
|
|
+ public AjaxResult reservoirSKMYLSK(@RequestBody JSONObject OBJ) {
|
|
|
+ String skcode = OBJ.getString("skcode");
|
|
|
+ String type = OBJ.getString("type");
|
|
|
+ if(skcode.equals("石坝子")) {
|
|
|
+ skcode="61116900";
|
|
|
+ }else if(skcode.equals(("宁乡(三)"))) {
|
|
|
+ skcode="61116400";
|
|
|
+ }else if(skcode.equals(("黄材"))) {
|
|
|
+ skcode="14";
|
|
|
+ }else if(skcode.equals(("洞庭桥"))) {
|
|
|
+ skcode="46";
|
|
|
+ }else if(skcode.equals(("田坪"))) {
|
|
|
+ skcode="372";
|
|
|
+ }
|
|
|
+ String redisKey = "NingXiang430182:reservoirRainFall"+ ":" + skcode;
|
|
|
+ JSONArray resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if(resultJSONObject==null) {
|
|
|
+ resultJSONObject = new JSONArray();
|
|
|
+ }
|
|
|
+ if(type.equals("0")) {
|
|
|
+ for(int i=0;i<resultJSONObject.size();i++) {
|
|
|
+ JSONObject jsonObject = resultJSONObject.getJSONObject(i);
|
|
|
+ jsonObject.put("shuiwei",jsonObject.getString("waterLevel"));
|
|
|
+ jsonObject.put("xxsw",jsonObject.getString("waterFloor"));
|
|
|
+ jsonObject.put("xxsw",jsonObject.getString("waterFloor"));
|
|
|
+ jsonObject.put("rk",jsonObject.getString("inflowFlow"));
|
|
|
+ jsonObject.put("ck",jsonObject.getString("outboundFlow"));
|
|
|
+ jsonObject.put("xsl",jsonObject.getString("capacity"));
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return AjaxResult.success("水库集雨区面雨量实况数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 【实况统计】逐分钟降水时间轴
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/rankOfStationLTmin")
|
|
|
+ public AjaxResult rankOfStationLTmin(@RequestBody JSONObject OBJ) {
|
|
|
+ String redisKey ="NingXiang430182:rankOfStationLT_minutes";
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("【实况统计】分钟级降水时间轴数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 【实况统计】逐3小时降水时间轴
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/rankOfStationLT3hour")
|
|
|
+ public AjaxResult rankOfStationLT3hour(@RequestBody JSONObject OBJ) {
|
|
|
+ String redisKey = "NingXiang430182:rankOfStationLT_3hour";
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("【实况统计】逐3小时降水时间轴数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 【实况统计】逐小时降水时间轴
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/rankOfStationLT1hour")
|
|
|
+ public AjaxResult rankOfStationLT1hour(@RequestBody JSONObject OBJ) {
|
|
|
+ String redisKey = "NingXiang430182:rankOfStationLT_hour" ;
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("【实况统计】逐小时降水时间轴数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 【实况统计】某地区气象站排名
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ * @throws ParseException
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/rankOfStation")
|
|
|
+ public AjaxResult rankOfStation(@RequestBody JSONObject OBJ) throws ParseException {
|
|
|
+ JSONArray resultJSONObject = null;
|
|
|
+ try {
|
|
|
+ String redisKey = "NingXiang430182:rankOfStation:";
|
|
|
+ String time = OBJ.getString("time");
|
|
|
+ String ranktype = OBJ.getString("ranktype");
|
|
|
+ if (ranktype.equals("0")) {
|
|
|
+ redisKey += time;
|
|
|
+ } else if (ranktype.equals("1")) {
|
|
|
+ redisKey += time;
|
|
|
+ } else if (ranktype.equals("2")) {
|
|
|
+ redisKey += time;
|
|
|
+ }
|
|
|
+
|
|
|
+ resultJSONObject = redisCache.getCacheObject(time);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!",new JSONArray());
|
|
|
+ /*
|
|
|
+ * String res = HttpUtils.sendGet(OBJ.getString("uri"));
|
|
|
+ * if(StringUtils.isEmpty(res))return AjaxResult.error(999," 某地区流域雨面量排名数据失败!");
|
|
|
+ * resultJSONObject= JSONObject.parseObject(res);
|
|
|
+ * redisCache.setCacheObject(redisKey,resultJSONObject);
|
|
|
+ */
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.success("暂无数据!");
|
|
|
+ }
|
|
|
+ resultJSONObject.sort(Comparator.comparing(obj -> ((JSONObject) obj).getBigDecimal("value")).reversed());
|
|
|
+
|
|
|
+ for(int i=0;i<resultJSONObject.size();i++) {
|
|
|
+ JSONObject jsonObject = resultJSONObject.getJSONObject(i);
|
|
|
+ List<Double> a = new ArrayList<Double>();
|
|
|
+ a.add(jsonObject.getDouble("lon"));
|
|
|
+ a.add(jsonObject.getDouble("lat"));
|
|
|
+ jsonObject.put("latlng", a);
|
|
|
+ jsonObject.put("nm", jsonObject.getString("stationName"));
|
|
|
+ jsonObject.put("value",jsonObject.getBigDecimal("value"));
|
|
|
+ }
|
|
|
+ return AjaxResult.success("某地区气象站排名数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 实况统计气温列表
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/temperatureList")
|
|
|
+ public AjaxResult temperatureList(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ String redisKey = "NingXiang430182:temperatureList";
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ resultJSONObject = JSONObject.parseObject("{\"jsDesCol\":[{\"prop\":\"time\",\"label\":\"时间\"},{\"prop\":\"temp\",\"label\":\"气温℃\"}],\"title\":\"过去24小时平均气温\",\"jstableData\":[]}");
|
|
|
+
|
|
|
+ }
|
|
|
+ return AjaxResult.success("实况统计气温列表数据加载成功!", resultJSONObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 蒸发量
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/zflList")
|
|
|
+ public AjaxResult zflList(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ String redisKey = "NingXiang430182:zflList";
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("实况统计蒸发量数据加载成功!", resultJSONObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.success("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 土壤湿度
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/humidityList")
|
|
|
+ public AjaxResult humidityList(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ String redisKey = "NingXiang430182:humidityList";
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ resultJSONObject = JSONObject.parseObject("{\"jsDesCol\":[{\"prop\":\"time\",\"label\":\"时间\"},{\"prop\":\"temp\",\"label\":\"土壤湿度(%)\"}],\"title\":\"24小时10cm土壤湿度\",\"jstableData\":[]}");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("实况统计土壤湿度数据加载成功!", resultJSONObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 土壤湿度统计图
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/initTRSDTJData")
|
|
|
+ public AjaxResult initTRSDTJData(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ String redisKey = "NingXiang430182:temperatureEcharts" ;
|
|
|
+ JSONObject resultJSONObject = redisCache.getCacheObject(redisKey);
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.success("暂无数据!");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("土壤湿度统计数据加载成功!", resultJSONObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.success("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping(value = "/getTimeLineData")
|
|
|
+ public AjaxResult getTimeLineData(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+
|
|
|
+ String redisKey2 = "NingXiang430182:comprehensiveForecastLT"+ "_0" ;
|
|
|
+ JSONObject resultJSONObject2 = redisCache.getCacheObject(redisKey2);
|
|
|
+ if(resultJSONObject2==null) {
|
|
|
+ JSONObject RES = new JSONObject();
|
|
|
+ RES.put("step", 1);
|
|
|
+ RES.put("value", 0);
|
|
|
+ String typ = OBJ.getString("type");
|
|
|
+ if (StringUtils.isEmpty(typ)) {
|
|
|
+ typ ="0";
|
|
|
+ }
|
|
|
+ String redisKey = "NingXiang430182:comprehensiveForecastLT" + "_" + typ;
|
|
|
+ Map<String,Object>marks = new HashMap<String, Object>();
|
|
|
+ if(typ.equals("0")) {
|
|
|
+ //自己构建时间轴
|
|
|
+ Date start = new Date();
|
|
|
+ for(int i=0;i<7;i++) {
|
|
|
+ JSONObject mark = new JSONObject();
|
|
|
+ Calendar a = Calendar.getInstance();
|
|
|
+ a.setTime(start);
|
|
|
+ a.add(Calendar.DAY_OF_MONTH, +1);
|
|
|
+ Date endT = a.getTime();
|
|
|
+ String des =DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_zh, start)+"-"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_zh, endT)+"";
|
|
|
+ mark.put("des",des);
|
|
|
+ mark.put("rediskey",DateUtils.parseDateToStr(DateUtils.YYYYMMDD, start));
|
|
|
+ mark.put("nm", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_zh, start));
|
|
|
+ mark.put("ts",DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, start)+" 01:00");
|
|
|
+ marks.put(i+"", mark);
|
|
|
+ start=endT;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if(typ.equals("1")) {
|
|
|
+ //自己构建时间轴
|
|
|
+ Date start = new Date();
|
|
|
+ Calendar B = Calendar.getInstance();
|
|
|
+ B.setTime(start);
|
|
|
+ B.set(Calendar.HOUR_OF_DAY, 5);
|
|
|
+ start = B.getTime();
|
|
|
+ for(int i=0;i<7;i++) {
|
|
|
+ JSONObject mark = new JSONObject();
|
|
|
+ Calendar a = Calendar.getInstance();
|
|
|
+ a.setTime(start);
|
|
|
+ a.add(Calendar.HOUR_OF_DAY, +3);
|
|
|
+ Date endT = a.getTime();
|
|
|
+ String des =DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH1, start)+"-"+DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH1, endT)+"";
|
|
|
+ mark.put("des",des);
|
|
|
+ mark.put("rediskey",DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH+"00", endT));
|
|
|
+ mark.put("nm", DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH1, endT));
|
|
|
+ mark.put("ts",DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM, endT));
|
|
|
+ marks.put(i+"", mark);
|
|
|
+ start=endT;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ RES.put("marks", marks);
|
|
|
+ RES.put("max", 7);
|
|
|
+ redisCache.setCacheObject(redisKey, RES, 2, TimeUnit.HOURS);
|
|
|
+ resultJSONObject2= RES;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (resultJSONObject2 != null) {
|
|
|
+ String keyname = OBJ.getString("keyname");
|
|
|
+ if(StringUtils.isEmpty(keyname)) {
|
|
|
+ //keyname="宁乡流域";
|
|
|
+ keyname="宁乡流域";
|
|
|
+ }
|
|
|
+ String jsonsStr = "";
|
|
|
+ JSONObject jsonObject = resultJSONObject2.getJSONObject("marks");
|
|
|
+ Map<String, JSONObject> map = JSONObject.parseObject(jsonObject.toString(), Map.class);
|
|
|
+ for (Map.Entry<String, JSONObject> entry : map.entrySet()) {
|
|
|
+ JSONObject value = entry.getValue(); // 获取value值
|
|
|
+ jsonsStr+=value.getString("rediskey")+",";
|
|
|
+ }
|
|
|
+ String[] jsons = jsonsStr.split(",");
|
|
|
+ String name = keyname;
|
|
|
+ List<String>x = new ArrayList<String>();
|
|
|
+ List<String>y = new ArrayList<String>();
|
|
|
+ for (String rediskey : jsons) {
|
|
|
+ String time = rediskey;
|
|
|
+ x.add((time.substring(4,6)+"月"+time.substring(6,time.length())+"日"));
|
|
|
+ String areaRain = redisCache.getCacheObject("NingXiang430182:rankOfRainfallArea:LY:"+name+":"+time);
|
|
|
+ y.add(areaRain==null?"0":areaRain);
|
|
|
+ }
|
|
|
+ JSONObject RESULT = new JSONObject();
|
|
|
+ RESULT.put("xdatas", x);
|
|
|
+ RESULT.put("datas", y);
|
|
|
+ RESULT.put("title",name+ "-面雨量时序图");
|
|
|
+ return AjaxResult.success("未来集雨区来水预报数据加载成功!", RESULT);
|
|
|
+
|
|
|
+ }
|
|
|
+ return AjaxResult.success("暂无数据!");
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.success("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 流域轮廓
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/liuyu")
|
|
|
+ public AjaxResult liuyu(@RequestBody JSONObject OBJ) {
|
|
|
+ try {
|
|
|
+ String res = HttpUtils.sendGet(OBJ.getString("uri"));
|
|
|
+ JSONObject parse = (JSONObject) JSONObject.parse(res);
|
|
|
+ return AjaxResult.success("流域轮廓数据加载成功!", JSON.parse(parse.getString("data")));
|
|
|
+ }catch (Exception e){
|
|
|
+ return AjaxResult.success("暂无数据");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 实况统计水情列表排名
|
|
|
+ *
|
|
|
+ * @param OBJ
|
|
|
+ * @return
|
|
|
+ * @throws ParseException
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/waterRegime")
|
|
|
+ public AjaxResult waterRegime(@RequestBody JSONObject OBJ) throws ParseException {
|
|
|
+ String redisKey = "";
|
|
|
+ String time = OBJ.getString("time");
|
|
|
+ String ranktype = OBJ.getString("ranktype");
|
|
|
+ String rtype = OBJ.getString("rtype");
|
|
|
+ String key = "";
|
|
|
+ JSONArray resultJSONObject = new JSONArray();
|
|
|
+ if (rtype.equals("0")) {
|
|
|
+ key = "rankOfStationSQSK";
|
|
|
+
|
|
|
+ String redisKey1 = "NingXiang430182:reservoirListGIS";
|
|
|
+ resultJSONObject = redisCache.getCacheObject(redisKey1);
|
|
|
+ String msg = "";
|
|
|
+ JSONArray resultJSONObjectRE = new JSONArray();
|
|
|
+ for(int i=0;i<resultJSONObject.size();i++) {
|
|
|
+ JSONObject obj = (JSONObject) resultJSONObject.get(i);
|
|
|
+
|
|
|
+ JSONObject objNew = new JSONObject();
|
|
|
+ objNew.put("stationName", obj.getString("nm"));
|
|
|
+ objNew.put("lon", obj.getJSONArray("latlng").get(0));
|
|
|
+ objNew.put("lat", obj.getJSONArray("latlng").get(1));
|
|
|
+ objNew.put("nm", obj.getString("nm"));
|
|
|
+ objNew.put("latlng", obj.getJSONArray("latlng"));
|
|
|
+
|
|
|
+ String skcode = obj.getString("id");
|
|
|
+
|
|
|
+ String redisKey11 = "NingXiang430182:"+ "reservoirRainFall:" + skcode;
|
|
|
+ JSONArray resultJSONObject11 = redisCache.getCacheObject(redisKey11);
|
|
|
+
|
|
|
+ if(resultJSONObject11!=null && resultJSONObject11.size()>0) {
|
|
|
+
|
|
|
+ JSONObject OBJT = (JSONObject) resultJSONObject11.get(0);
|
|
|
+ msg=OBJT.getString("timeObserve")+",当日水库最新水情数据";
|
|
|
+ objNew.put("waterLevel", OBJT.getString("waterLevel"));
|
|
|
+ objNew.put("floodLevel", OBJT.getString("waterFloor"));
|
|
|
+ objNew.put("cxx", OBJT.getBigDecimal("waterLevel").subtract(OBJT.getBigDecimal("waterFloor")));
|
|
|
+
|
|
|
+ }else {
|
|
|
+ objNew.put("waterLevel", "-");
|
|
|
+ objNew.put("floodLevel", "-");
|
|
|
+ objNew.put("cxx", "-");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ resultJSONObjectRE.add(objNew);
|
|
|
+
|
|
|
+ }
|
|
|
+ return AjaxResult.success(msg, resultJSONObjectRE);
|
|
|
+ } else if (rtype.equals("1")) {
|
|
|
+ key = "rankOfStationSQHD";
|
|
|
+ String redisKey1 = "NingXiang430182:riverTorListGIS" ;
|
|
|
+ resultJSONObject = redisCache.getCacheObject(redisKey1);
|
|
|
+
|
|
|
+ JSONArray resultJSONObjectRE = new JSONArray();
|
|
|
+ String msg = "";
|
|
|
+
|
|
|
+ for(int i=0;i<resultJSONObject.size();i++) {
|
|
|
+ JSONObject obj = (JSONObject) resultJSONObject.get(i);
|
|
|
+
|
|
|
+ JSONObject objNew = new JSONObject();
|
|
|
+ objNew.put("stationName", obj.getString("nm"));
|
|
|
+ objNew.put("lon", obj.getJSONArray("latlng").get(0));
|
|
|
+ objNew.put("lat", obj.getJSONArray("latlng").get(1));
|
|
|
+ objNew.put("nm", obj.getString("nm"));
|
|
|
+ objNew.put("latlng", obj.getJSONArray("latlng"));
|
|
|
+ String skcode = obj.getString("nm");
|
|
|
+ if(skcode.equals("石坝子")) {
|
|
|
+ skcode="61116900";
|
|
|
+ }else if(skcode.equals(("宁乡(三)"))) {
|
|
|
+ skcode="61116400";
|
|
|
+ }
|
|
|
+ String redisKey11 = "NingXiang430182:reservoirRainFall" + ":" + skcode;
|
|
|
+ JSONArray resultJSONObject11 = redisCache.getCacheObject(redisKey11);
|
|
|
+
|
|
|
+ if(resultJSONObject11!=null && resultJSONObject11.size()>0) {
|
|
|
+
|
|
|
+ JSONObject OBJT = (JSONObject) resultJSONObject11.get(0);
|
|
|
+ objNew.put("waterLevel", OBJT.getString("shuiwei"));
|
|
|
+ objNew.put("floodLevel", OBJT.getString("xxsw"));
|
|
|
+ msg=OBJT.getString("timeObserve")+",当日河道最新水情数据";
|
|
|
+ objNew.put("cxx", OBJT.getBigDecimal("shuiwei").subtract(OBJT.getBigDecimal("xxsw")));
|
|
|
+ }else {
|
|
|
+ objNew.put("waterLevel", "-");
|
|
|
+ objNew.put("floodLevel", "-");
|
|
|
+ objNew.put("cxx", "-");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ resultJSONObjectRE.add(objNew);
|
|
|
+
|
|
|
+ }
|
|
|
+ return AjaxResult.success(msg, resultJSONObjectRE);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ranktype.equals("0")) {
|
|
|
+ redisKey = "NingXiang430182:" + key + ":" + time;
|
|
|
+ } else if (ranktype.equals("1")) {
|
|
|
+ redisKey = "NingXiang430182:" + key + ":" + time;
|
|
|
+ } else if (ranktype.equals("2")) {
|
|
|
+ redisKey = "NingXiang430182:" + key + ":" + time;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (resultJSONObject == null) {
|
|
|
+ return AjaxResult.error("暂无数据!");
|
|
|
+ /*
|
|
|
+ * String res = HttpUtils.sendGet(OBJ.getString("uri"));
|
|
|
+ * if(StringUtils.isEmpty(res))return AjaxResult.error(999," 水库未来水量数据加载失败!");
|
|
|
+ * resultJSONObject= JSONObject.parseObject(res);
|
|
|
+ * redisCache.setCacheObject(redisKey,resultJSONObject);
|
|
|
+ */
|
|
|
+ }
|
|
|
+ return AjaxResult.success("水库未来水量数据加载成功!", resultJSONObject);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|