diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/smartDevicesController/TbMeterInfoController.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/smartDevicesController/TbMeterInfoController.java index 967996d2..716e3bfa 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/smartDevicesController/TbMeterInfoController.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/smartDevicesController/TbMeterInfoController.java @@ -44,6 +44,8 @@ public class TbMeterInfoController extends BaseController { @SaCheckPermission("property:meterInfo:list") @GetMapping("/list") public TableDataInfo list(TbMeterInfoBo bo, PageQuery pageQuery) { + pageQuery.setOrderByColumn("createTime"); + pageQuery.setIsAsc("desc"); return tbMeterInfoService.queryPageList(bo, pageQuery); } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/smartDevicesImpl/TbMeterInfoServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/smartDevicesImpl/TbMeterInfoServiceImpl.java index 565b37fc..4da94807 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/smartDevicesImpl/TbMeterInfoServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/smartDevicesImpl/TbMeterInfoServiceImpl.java @@ -3,6 +3,7 @@ package org.dromara.property.service.impl.smartDevicesImpl; import cn.dev33.satoken.context.mock.SaTokenContextMockUtil; import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.TimeInterval; import cn.hutool.core.lang.Assert; import com.alibaba.fastjson.JSONObject; import org.apache.dubbo.config.annotation.DubboReference; @@ -118,7 +119,6 @@ public class TbMeterInfoServiceImpl implements ITbMeterInfoService { private LambdaQueryWrapper buildQueryWrapper(TbMeterInfoBo bo) { Map params = bo.getParams(); LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); - lqw.orderByAsc(TbMeterInfo::getId); lqw.like(StringUtils.isNotBlank(bo.getHostIp()), TbMeterInfo::getHostIp, bo.getHostIp()); lqw.eq(StringUtils.isNotBlank(bo.getMeterCode()), TbMeterInfo::getMeterCode, bo.getMeterCode()); lqw.eq(StringUtils.isNotBlank(bo.getFactoryNo()), TbMeterInfo::getFactoryNo, bo.getFactoryNo()); @@ -314,7 +314,9 @@ public class TbMeterInfoServiceImpl implements ITbMeterInfoService { List meterResults; try { + TimeInterval timeInterval = new TimeInterval(); meterResults = meterRecordUtil.getMeterStatus(ipCountMap, hostIpArr); + log.info("仪表数据获取耗时:{}ms", timeInterval.interval()); } catch (Exception e) { // 获取数据失败,设置所有仪表通信状态为0并发送消息 handleMeterCommunicationFailure(user, jsonObject, meterInfoVoList, tokenValue); diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/utils/MeterRecordUtil.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/utils/MeterRecordUtil.java index aec441d0..bfec4d8e 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/utils/MeterRecordUtil.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/utils/MeterRecordUtil.java @@ -40,7 +40,7 @@ public class MeterRecordUtil { JSONObject jsonObject = new JSONObject(); jsonObject.putOnce("ipMap", ipMap); jsonObject.putOnce("ipArr", ipArr); - String post = HttpUtil.post(meterRecordUrl + READING_URL, jsonObject.toString(), 3000); + String post = HttpUtil.post(meterRecordUrl + READING_URL, jsonObject.toString()); Result> result = JSONUtil.toBean(post, new TypeReference>>() {}, true); return result.getData(); }