From d0b261f701c86f55dd04365c620fb6f79cbe5c62 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Thu, 20 Jun 2024 13:11:12 +0800
Subject: [PATCH] fix:盐城热力图接口修改提交
---
screen-api/src/main/java/com/moral/api/service/impl/HandDeviceServiceImpl.java | 78 +++++++++++++++++++++++++--------------
1 files changed, 50 insertions(+), 28 deletions(-)
diff --git a/screen-api/src/main/java/com/moral/api/service/impl/HandDeviceServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/HandDeviceServiceImpl.java
index e7e23f1..7c76366 100644
--- a/screen-api/src/main/java/com/moral/api/service/impl/HandDeviceServiceImpl.java
+++ b/screen-api/src/main/java/com/moral/api/service/impl/HandDeviceServiceImpl.java
@@ -18,6 +18,7 @@
import com.moral.api.entity.HandDevice;
import com.moral.api.entity.HistoryFiveMinutely;
import com.moral.api.entity.HistoryHourly;
+import com.moral.api.entity.HistoryMinutely;
import com.moral.api.mapper.DeviceMapper;
import com.moral.api.mapper.HandDeviceMapper;
import com.moral.api.pojo.query.handdevice.HandDevicePageCond;
@@ -64,6 +65,7 @@
*/
@Override
public Page<HandDevice> page(HandDevicePageCond handDevicePageCond) {
+
Page<HandDevice> page = handDeviceMapper.Page(handDevicePageCond.getPage().convertPage(),
handDevicePageCond.getMac(),
handDevicePageCond.getName(),
@@ -95,14 +97,17 @@
*/
@Override
public HandDevice update(HandDevice handDevice) {
+ QxUser currentUser = UserHelper.getCurrentUser();
String state = handDevice.getState();
if (state.equals("0")){
HandDevice handDevice1 = getHand(handDevice);
+ handDevice1.setCreateName(currentUser.getUserName());
handDeviceMapper.insert(handDevice1);
return handDevice1;
}else {
handDevice.setEndTime(new Date());
handDevice.setState("0");
+ handDevice.setUpdateName(currentUser.getUserName());
handDeviceMapper.updateById(handDevice);
return handDevice;
}
@@ -140,7 +145,10 @@
Date startDate = DateUtils.getDate(startTime,DateUtils.yyyy_MM_dd_HH_mm_EN);
Date endDate = DateUtils.getDate(endTime,DateUtils.yyyy_MM_dd_HH_mm_EN);
List<Map<String, Object>> rsMap = new ArrayList<>();
+ if (ObjectUtils.isEmpty(endTime)){
+ endDate = new Date();
+ }
if (type.equals("hour")){
List<HistoryHourly> valueByMacAndTime = historyHourlyService.getValueByMacAndTime(mac, startDate, endDate);
for (HistoryHourly historyHourly : valueByMacAndTime) {
@@ -151,7 +159,17 @@
map.put("a21028",ObjectUtils.isEmpty(map.get("a21028"))?0:map.get("a21028"));
rsMap.add(map);
}
- }else {
+ }else if (type.equals("minute")){
+ List<HistoryMinutely> historyMinutelys = historyHourlyService.getHistoryMinutely(mac, startDate, endDate);
+ for (HistoryMinutely historyMinutely : historyMinutelys) {
+ String value = historyMinutely.getValue();
+ Map map = JSON.parseObject(value, Map.class);
+ map.put("time",DateUtils.dateToDateString(historyMinutely.getTime()));
+ map.put("a21001",ObjectUtils.isEmpty(map.get("a21001"))?0:map.get("a21001"));
+ map.put("a21028",ObjectUtils.isEmpty(map.get("a21028"))?0:map.get("a21028"));
+ rsMap.add(map);
+ }
+ }else if (type.equals("minutely")){
List<HistoryFiveMinutely> historyFiveMinutelies = historyFiveMinutelyService.queryFiveMinutely(mac, startDate, endDate);
for (HistoryFiveMinutely historyFiveMinutely : historyFiveMinutelies) {
String value = historyFiveMinutely.getValue();
@@ -175,9 +193,15 @@
public List<Map<String, Object>> detailsExecl(Map<String, Object> params) {
String type = params.get("type").toString();
String mac = params.get("mac").toString();
+ Object endTime = params.get("endTime");
Date startDate = DateUtils.getDate(params.get("startTime").toString(),DateUtils.yyyy_MM_dd_HH_mm_EN);
- Date endDate = DateUtils.getDate(params.get("endTime").toString(),DateUtils.yyyy_MM_dd_HH_mm_EN);
+ Date endDate;
List<Map<String, Object>> rsMap = new ArrayList<>();
+ if (ObjectUtils.isEmpty(endTime)){
+ endDate = new Date();
+ }else {
+ endDate = DateUtils.getDate(endTime.toString(),DateUtils.yyyy_MM_dd_HH_mm_EN);
+ }
if (type.equals("hour")){
List<HistoryHourly> valueByMacAndTime = historyHourlyService.getValueByMacAndTime(mac, startDate, endDate);
for (HistoryHourly historyHourly : valueByMacAndTime) {
@@ -185,18 +209,18 @@
String value = historyHourly.getValue();
Map map = JSON.parseObject(value, Map.class);
map1.put("������",DateUtils.dateToDateString(historyHourly.getTime()));
- map1.put("pm25",ObjectUtils.isEmpty(map.get("a34004"))?0:map.get("a34004"));
- map1.put("pm10",ObjectUtils.isEmpty(map.get("a34002"))?0:map.get("a34002"));
- map1.put("������������",ObjectUtils.isEmpty(map.get("a21004"))?0:map.get("a21004"));
- map1.put("������������",ObjectUtils.isEmpty(map.get("a21026"))?0:map.get("a21026"));
- map1.put("������������",ObjectUtils.isEmpty(map.get("a21005"))?0:map.get("a21005"));
- map1.put("������",ObjectUtils.isEmpty(map.get("a01006"))?0:map.get("a01006"));
- map1.put("������",ObjectUtils.isEmpty(map.get("a01001"))?0:map.get("a01001"));
- map1.put("������",ObjectUtils.isEmpty(map.get("a01002"))?0:map.get("a01002"));
- map1.put("tvoc",ObjectUtils.isEmpty(map.get("a99054"))?0:map.get("a99054"));
- map1.put("������",ObjectUtils.isEmpty(map.get("a31001"))?0:map.get("a31001"));
- map1.put("���������",ObjectUtils.isEmpty(map.get("a21028"))?0:map.get("a21028"));
- map1.put("������",ObjectUtils.isEmpty(map.get("a21001"))?0:map.get("a21001"));
+ map1.put("pm25ug/m��",ObjectUtils.isEmpty(map.get("a34004"))?0:map.get("a34004"));
+ map1.put("pm10ug/m��",ObjectUtils.isEmpty(map.get("a34002"))?0:map.get("a34002"));
+ map1.put("������������ug/m��",ObjectUtils.isEmpty(map.get("a21004"))?0:map.get("a21004"));
+ map1.put("������������ug/m��",ObjectUtils.isEmpty(map.get("a21026"))?0:map.get("a21026"));
+ map1.put("������������ug/m��",ObjectUtils.isEmpty(map.get("a21005"))?0:map.get("a21005"));
+ map1.put("������hpa",ObjectUtils.isEmpty(map.get("a01006"))?0:map.get("a01006"));
+ map1.put("���������",ObjectUtils.isEmpty(map.get("a01001"))?0:map.get("a01001"));
+ map1.put("������%",ObjectUtils.isEmpty(map.get("a01002"))?0:map.get("a01002"));
+ map1.put("tvocmg/m��",ObjectUtils.isEmpty(map.get("a99054"))?0:map.get("a99054"));
+ map1.put("������mg/m��",ObjectUtils.isEmpty(map.get("a31001"))?0:map.get("a31001"));
+ map1.put("���������ppm",ObjectUtils.isEmpty(map.get("a21028"))?0:map.get("a21028"));
+ map1.put("������ug/m��",ObjectUtils.isEmpty(map.get("a21001"))?0:map.get("a21001"));
rsMap.add(map1);
}
}else {
@@ -206,18 +230,18 @@
String value = historyFiveMinutely.getValue();
Map map = JSON.parseObject(value, Map.class);
map1.put("������",DateUtils.dateToDateString(historyFiveMinutely.getTime()));
- map1.put("pm25",ObjectUtils.isEmpty(map.get("a34004"))?0:map.get("a34004"));
- map1.put("pm10",ObjectUtils.isEmpty(map.get("a34002"))?0:map.get("a34002"));
- map1.put("������������",ObjectUtils.isEmpty(map.get("a21004"))?0:map.get("a21004"));
- map1.put("������������",ObjectUtils.isEmpty(map.get("a21026"))?0:map.get("a21026"));
- map1.put("������������",ObjectUtils.isEmpty(map.get("a21005"))?0:map.get("a21005"));
- map1.put("������",ObjectUtils.isEmpty(map.get("a01006"))?0:map.get("a01006"));
- map1.put("������",ObjectUtils.isEmpty(map.get("a01001"))?0:map.get("a01001"));
- map1.put("������",ObjectUtils.isEmpty(map.get("a01002"))?0:map.get("a01002"));
- map1.put("tvoc",ObjectUtils.isEmpty(map.get("a99054"))?0:map.get("a99054"));
- map1.put("������",ObjectUtils.isEmpty(map.get("a31001"))?0:map.get("a31001"));
- map1.put("���������",ObjectUtils.isEmpty(map.get("a21028"))?0:map.get("a21028"));
- map1.put("������",ObjectUtils.isEmpty(map.get("a21001"))?0:map.get("a21001"));
+ map1.put("pm25ug/m��",ObjectUtils.isEmpty(map.get("a34004"))?0:map.get("a34004"));
+ map1.put("pm10ug/m��",ObjectUtils.isEmpty(map.get("a34002"))?0:map.get("a34002"));
+ map1.put("������������ug/m��",ObjectUtils.isEmpty(map.get("a21004"))?0:map.get("a21004"));
+ map1.put("������������ug/m��",ObjectUtils.isEmpty(map.get("a21026"))?0:map.get("a21026"));
+ map1.put("������������ug/m��",ObjectUtils.isEmpty(map.get("a21005"))?0:map.get("a21005"));
+ map1.put("������hpa",ObjectUtils.isEmpty(map.get("a01006"))?0:map.get("a01006"));
+ map1.put("���������",ObjectUtils.isEmpty(map.get("a01001"))?0:map.get("a01001"));
+ map1.put("������%",ObjectUtils.isEmpty(map.get("a01002"))?0:map.get("a01002"));
+ map1.put("tvocmg/m��",ObjectUtils.isEmpty(map.get("a99054"))?0:map.get("a99054"));
+ map1.put("������ug/m��",ObjectUtils.isEmpty(map.get("a31001"))?0:map.get("a31001"));
+ map1.put("���������ppm",ObjectUtils.isEmpty(map.get("a21028"))?0:map.get("a21028"));
+ map1.put("������ug/m��",ObjectUtils.isEmpty(map.get("a21001"))?0:map.get("a21001"));
rsMap.add(map1);
}
}
@@ -226,7 +250,6 @@
private HandDevice getHand(HandDevice handDevice){
- QxUser currentUser = UserHelper.getCurrentUser();
HandDevice rsHandDevice = new HandDevice();
rsHandDevice.setName(handDevice.getName());
rsHandDevice.setMac(handDevice.getMac());
@@ -234,7 +257,6 @@
rsHandDevice.setLatitude(handDevice.getLatitude());
rsHandDevice.setLongitude(handDevice.getLongitude());
rsHandDevice.setIsDelete(Constants.NOT_DELETE);
- rsHandDevice.setUpdateName(currentUser.getUserName());
rsHandDevice.setStartTime(new Date());
rsHandDevice.setUpdateTime(new Date());
rsHandDevice.setCreateTime(new Date());
--
Gitblit v1.8.0