| | |
| | | @PreAuthorize("@ss.hasPermi('sy:syCar:getTrend')") |
| | | @ApiOperation("获取某油井一段时间的测量趋势") |
| | | @GetMapping("getTrend") |
| | | public Results getTrend(GetTrendParam getTrendParam){ |
| | | public JSONObject getTrend(GetTrendParam getTrendParam){ |
| | | String url = configService.getHealth(); |
| | | Map<String , Object> map = new HashMap<String , Object>(); |
| | | map.put("MeasureKey", getTrendParam.getMeasureKey()); |
| | |
| | | JSONObject j = new JSONObject(); |
| | | String result = ARDSoapUtil.postSoapResult(url ,"GetTrend" , map); |
| | | if ("".equals(result)){ |
| | | return Results.succeed("没有测点信息"); |
| | | j.put("msg", "没有测点信息"); |
| | | j.put("code", 500); |
| | | } |
| | | Map<String,Object> mapResult = (Map<String, Object>) JSON.parse((String)result); |
| | | if ( (int) mapResult.get("code") == 200){ |
| | | j.put("code", mapResult.get("code")); |
| | | List<Map<String , Object>> listResult = (List<Map<String, Object>>)JSON.parse((String)mapResult.get("resdata")); |
| | | for(int i = 0 ; i<listResult.size(); i++){ |
| | | Map<String , Object> mapTemp = listResult.get(i); |
| | | int id = (Integer)mapTemp.get("id"); //主键id |
| | | BigDecimal value = (BigDecimal)mapTemp.get("Value"); //数值 |
| | | String measureStr = (String)mapTemp.get("MeasureDate"); //测量时间 |
| | | measureStr = measureStr.substring(measureStr.indexOf("(")+1, measureStr.indexOf(")",2)); |
| | | SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String measureDate = f.format(Long.valueOf(measureStr)); |
| | | mapTemp.put("MeasureDate", measureDate); |
| | | j.put(id +"" , mapTemp); |
| | | |
| | | if(listResult.size()>0){ |
| | | for(int i = 0 ; i<listResult.size(); i++){ |
| | | Map<String , Object> mapTemp = listResult.get(i); |
| | | BigDecimal value = (BigDecimal)mapTemp.get("Value"); //数值 |
| | | String measureStr = (String)mapTemp.get("MeasureDate"); //测量时间 |
| | | measureStr = measureStr.substring(measureStr.indexOf("(")+1, measureStr.indexOf(")",2)); |
| | | SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String measureDate = f.format(Long.valueOf(measureStr)); |
| | | mapTemp.put("MeasureDate", measureDate); |
| | | mapTemp.put("Value", value.setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | j.put("data",listResult); |
| | | }else { |
| | | j.put("data",new ArrayList<>()); |
| | | } |
| | | }else{ |
| | | //错误提示 |
| | | j.put("errmsg", mapResult.get("errmsg")); |
| | | j.put("msg", mapResult.get("errmsg")); |
| | | j.put("code", mapResult.get("code")); |
| | | } |
| | | return Results.succeed(j); |
| | | return j; |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('sy:syCar:getWaveDataByIndex')") |