ref(Property): 优化仪表数据获取和列表展示
This commit is contained in:
@@ -44,6 +44,8 @@ public class TbMeterInfoController extends BaseController {
|
||||
@SaCheckPermission("property:meterInfo:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<TbMeterInfoVo> list(TbMeterInfoBo bo, PageQuery pageQuery) {
|
||||
pageQuery.setOrderByColumn("createTime");
|
||||
pageQuery.setIsAsc("desc");
|
||||
return tbMeterInfoService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
|
@@ -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<TbMeterInfo> buildQueryWrapper(TbMeterInfoBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<TbMeterInfo> 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<MeterResult> 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);
|
||||
|
@@ -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<List<MeterResult>> result = JSONUtil.toBean(post, new TypeReference<Result<List<MeterResult>>>() {}, true);
|
||||
return result.getData();
|
||||
}
|
||||
|
Reference in New Issue
Block a user