| | |
| | | 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")); |
| | | |
| | | if(listResult.size()>0){ |
| | | 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); |
| | | mapTemp.put("Value", value.setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | j.put("data",listResult); |
| | | }else { |
| | | j.put("msg","无数据"); |
| | | j.put("data",new ArrayList<>()); |
| | | } |
| | | }else{ |
| | | //错误提示 |