Explorar o código

实时消息返回最新的7条

lingpeng.li hai 5 meses
pai
achega
40f2f90a70

+ 0 - 13
zgztBus/jeecg-module-lesm/src/main/java/org/jeecg/modules/deviceLesm/service/impl/DeviceRegionServiceImpl.java

@@ -224,9 +224,6 @@ public class DeviceRegionServiceImpl extends ServiceImpl<DeviceRegionMapper, Dev
                 powerMap.put(deviceRegion.getRegionTitle() + "谷时段总功率占比", "0%");
             }
 
-
-
-
 //            deviceInformationWrapper.eq(DeviceInformation::getDeviceRegionId, deviceRegion.getId())
 //                    .orderByAsc(DeviceInformation::getDeviceType);
 //            ;
@@ -283,16 +280,6 @@ public class DeviceRegionServiceImpl extends ServiceImpl<DeviceRegionMapper, Dev
                                     mapSum1.put("valleysSum", valleysSum.add(valleysAmount));
                                 }
                             }
-//                            // 检查 peaksAndValleysTimeMapLast 是否包含 "active_power" 且值不为 null 或空
-//                            if (peaksAndValleysTimeMapLast != null && peaksAndValleysTimeMapLast.containsKey("active_power")
-//                                    && peaksAndValleysTimeMapLast.get("active_power") != null) {
-//                                powerMap.put(mapDeviceType(deviceType) + "累计总功率", peaksAndValleysTimeMapLast.get("active_power"));
-//                            } else {
-//                                powerMap.put(mapDeviceType(deviceType) + "累计总功率", "0");  // 如果值为空,设置为默认值
-//                            }
-//
-//                            powerMap.put(mapDeviceType(deviceType) + "累计总功率", peaksAndValleysTimeMapLast.get("active_power"));
-
                         }
 
                         BigDecimal totalActivePower2 = BigDecimal.ZERO; // 假设需要累加 activePower

+ 3 - 1
zgztBus/jeecg-module-lesm/src/main/java/org/jeecg/modules/homePageData/service/impl/HomePageDataServiceImpl.java

@@ -329,7 +329,9 @@ public class HomePageDataServiceImpl implements IHomePageDataService {
     public List<String> latestMsg() {
 
         List<String> list = new ArrayList<>();
-        List<DeviceOperationLog> deviceOperationLogs = deviceOperationLogService.queryList();
+        LambdaQueryWrapper<DeviceOperationLog> wrapper = new LambdaQueryWrapper<>();
+        wrapper.orderByDesc(DeviceOperationLog::getOperationTime).last("LIMIT 7");
+        List<DeviceOperationLog> deviceOperationLogs = deviceOperationLogService.list(wrapper);
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
         for (DeviceOperationLog deviceOperationLog : deviceOperationLogs) {