| | |
| | | JSONObject jsonObject = ztData.getJSONObject(i); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | // 水库信息设置 |
| | | flag = waterInfoSet(jsonObject, map,flag); |
| | | flag = waterInfoSet(jsonObject, map); |
| | | if (flag) { |
| | | // 测点信息设置 |
| | | flag = pointValueInfoSet(jsonObject, map, type,flag); |
| | |
| | | if (flag) { |
| | | map.put("batchId",UUID.randomUUID()); |
| | | map.put("serialNo",getSerialNo()); |
| | | log.info("发送数据:{}",map); |
| | | // 发送请求 |
| | | String response = sendPostJsonRequest(OpenApiConstant.POINT_VALUE_INLET_URL, map); |
| | | JSONObject parseObject = JSON.parseObject(response); |
| | |
| | | * @param jsonObject |
| | | * @param map |
| | | */ |
| | | private boolean waterInfoSet(JSONObject jsonObject, Map<String, Object> map,boolean flag) { |
| | | private boolean waterInfoSet(JSONObject jsonObject, Map<String, Object> map) { |
| | | String rz = jsonObject.getString("rz"); |
| | | flag = false; |
| | | if (!Strings.isBlank(rz)) { |
| | | flag = true; |
| | | String res_cd = replaceSpecialStr(jsonObject.getString("res_cd")); |
| | | List<Map<String, Object>> waterLevelInfoList = new ArrayList<>(); |
| | | Map<String, Object> waterLevelInfoMap = new HashMap<>(); |
| | | waterLevelInfoMap.put("damCode", res_cd); |
| | | waterLevelInfoMap.put("waterLevel", jsonObject.getString("rz")); |
| | | waterLevelInfoMap.put("waterLevelTime", jsonObject.getString("rz_tm")); |
| | | waterLevelInfoMap.put("rainCondition", jsonObject.getString("drp")); |
| | | waterLevelInfoMap.put("rainConditionTime", jsonObject.getString("drp_tm")); |
| | | waterLevelInfoList.add(waterLevelInfoMap); |
| | | map.put("waterLevelInfo", waterLevelInfoList); |
| | | if(Strings.isBlank(rz)){ |
| | | return false; |
| | | } |
| | | return flag; |
| | | // 需要过滤2022高标准水库才发送 |
| | | String res_cd = replaceSpecialStr(jsonObject.getString("res_cd")); |
| | | String flag = openApiMapper.getResInfoBy2022(res_cd); |
| | | if (Strings.isBlank(flag)){ |
| | | return false; |
| | | } |
| | | List<Map<String, Object>> waterLevelInfoList = new ArrayList<>(); |
| | | Map<String, Object> waterLevelInfoMap = new HashMap<>(); |
| | | waterLevelInfoMap.put("damCode", res_cd); |
| | | waterLevelInfoMap.put("waterLevel", jsonObject.getString("rz")); |
| | | waterLevelInfoMap.put("waterLevelTime", jsonObject.getString("rz_tm")); |
| | | waterLevelInfoMap.put("rainCondition", jsonObject.getString("drp")); |
| | | waterLevelInfoMap.put("rainConditionTime", jsonObject.getString("drp_tm")); |
| | | waterLevelInfoList.add(waterLevelInfoMap); |
| | | map.put("waterLevelInfo", waterLevelInfoList); |
| | | return true; |
| | | } |
| | | |
| | | /** |