| | |
| | | } |
| | | |
| | | //数据过滤 |
| | | data.remove("time"); |
| | | // data.remove("time"); |
| | | data.remove("entryTime"); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String format = dateFormat.format(new Date().getTime()); |
| | | //获取年份 |
| | | String substring = format.substring(0, 4); |
| | | |
| | | String substring1 = time.toString().substring(0, 4); |
| | | |
| | | String replace = time.toString().replace(substring1, substring); |
| | | |
| | | data.put("DataTime",replace); |
| | | // SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // String format = dateFormat.format(new Date().getTime()); |
| | | // //获取年份 |
| | | // String substring = format.substring(0, 4); |
| | | // |
| | | // String substring1 = time.toString().substring(0, 4); |
| | | // |
| | | // String replace = time.toString().replace(substring1, substring); |
| | | // |
| | | // data.put("DataTime",replace); |
| | | |
| | | Iterator<Map.Entry<String, Object>> iterator = data.entrySet().iterator(); |
| | | Map<String, Object> newMap = new HashMap<>(); |
| | |
| | | Map<String, Object> versionInfo = (Map<String, Object>) deviceInfo.get("version"); |
| | | Integer version = (Integer) versionInfo.get("id"); |
| | | //获取时间戳 |
| | | // String time1 = data.get("time").toString(); |
| | | // long l = Long.parseLong(time1); |
| | | // SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:00:00"); |
| | | // String format1 = dateFormat.format(l); |
| | | // Date time = DateUtils.getDate(format1, DateUtils.yyyy_MM_dd_HH_mm_ss_EN); |
| | | String time1 = data.get("time").toString(); |
| | | long l = Long.parseLong(time1); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:00:00"); |
| | | String format1 = dateFormat.format(l); |
| | | Date time = DateUtils.getDate(format1, DateUtils.yyyy_MM_dd_HH_mm_ss_EN); |
| | | |
| | | Date time = DateUtils.getDate((String) data.remove("DataTime"), DateUtils.yyyyMMddHHmmss_EN); |
| | | // Date time = DateUtils.getDate((String) data.remove("DataTime"), DateUtils.yyyyMMddHHmmss_EN); |
| | | String yearAndMonth = DateUtils.dateToDateString(DateUtils.addHours(time, -1), DateUtils.yyyyMM_EN); |
| | | |
| | | result.put("mac", mac); |
| | |
| | | } |
| | | if (code.equals("2")){ |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | // String time1 = deviceData.get("time").toString(); |
| | | // long l = Long.parseLong(time1); |
| | | String time1 = deviceData.get("time").toString(); |
| | | long l = Long.parseLong(time1); |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:00:00"); |
| | | // String format1 = simpleDateFormat.format(l); |
| | | // Date date = DateUtils.getDate(format1, DateUtils.yyyy_MM_dd_HH_mm_ss_EN); |
| | | String format1 = simpleDateFormat.format(l); |
| | | Date date = DateUtils.getDate(format1, DateUtils.yyyy_MM_dd_HH_mm_ss_EN); |
| | | |
| | | String yearAndMonth = DateUtils.dateToDateString(DateUtils.addHours(time, -2), DateUtils.yyyyMM_EN); |
| | | String format = simpleDateFormat.format(DateUtils.addHours(time, -2)); |
| | | String yearAndMonth = DateUtils.dateToDateString(DateUtils.addHours(date, -2), DateUtils.yyyyMM_EN); |
| | | String format = simpleDateFormat.format(DateUtils.addHours(date, -2)); |
| | | result.put("timeUnits",yearAndMonth); |
| | | result.put("mac",mac); |
| | | result.put("time",format); |