| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | |
| | | Map<String, Object> deviceInfo = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstants.DEVICE, mac); |
| | | 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); |
| | | |
| | | Date time = DateUtils.getDate((String) data.remove("DataTime"), DateUtils.yyyyMMddHHmmss_EN); |
| | | String yearAndMonth = DateUtils.dateToDateString(time, DateUtils.yyyyMM_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); |
| | | result.put("time", DateUtils.addHours(time, -1)); |
| | |
| | | historyHourlyMapper.insertHistoryHourly(result); |
| | | |
| | | //数据校准 |
| | | dataAdjust = deviceService.adjustDeviceData(dataAdjust); |
| | | dataAdjust = deviceService.adjustDeviceData(dataAdjust,"2"); |
| | | |
| | | //校准后小时表insert |
| | | result.put("timeUnits", yearAndMonth); |