From cc120d54e26f64753e99b349599875cf6911a0af Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Wed, 18 Oct 2023 08:26:19 +0800 Subject: [PATCH] chore:小程序测试提交 --- screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java | 46 +++++++++++++++++++++++++++++----------------- 1 files changed, 29 insertions(+), 17 deletions(-) diff --git a/screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java index 0a3d387..19a3c4e 100644 --- a/screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java +++ b/screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java @@ -141,14 +141,12 @@ //������������������������������������ if (sensorValues != null) return sensorValues; - QueryWrapper<HistoryFiveMinutely> queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("mac", mac); - queryWrapper.orderByDesc("time"); - queryWrapper.last("limit 0,1"); + Map<String, Object> mapParams = new HashMap<>(); + mapParams.put("mac",mac); //��������������������� Date date = new Date(); List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(date, date, SeparateTableType.MONTH); - List<HistoryFiveMinutely> datas = multiTableQuery(queryWrapper, tableNames); + List<HistoryFiveMinutely> datas = multiTableQuery(mapParams, tableNames); if (ObjectUtils.isEmpty(datas)) return null; HistoryFiveMinutely historyFiveMinutely = datas.get(0); @@ -225,7 +223,12 @@ data = data + " " + sensor.getShowUnit(); result.put(sensor.getCode(), data); } else { - result.put(sensor.getCode(), "-"); + if (sensor.getCode().equals("a01008") ||sensor.getCode().equals("a01007")){ + result.put(sensor.getCode(), "-"); + }else { + result.put(sensor.getCode(), "0"+" "+sensor.getShowUnit()); + } + } } //������������������ @@ -386,9 +389,9 @@ int nx = (int) Math.floor((lo2 - lo1) / dx); int ny = (int) Math.floor((la1 - la2) / dy); - - List<Double> uList = new ArrayList<>(); - List<Double> vList = new ArrayList<>(); + int nums = Objects.nonNull(nx*ny)?nx*ny+100:100; + List<Double> uList = new ArrayList<>(nums); + List<Double> vList = new ArrayList<>(nums); int x; int y; @@ -480,11 +483,12 @@ * @Date: 2021/9/23 */ public List<HistoryFiveMinutely> getValueByMacAndTime(String mac, Date startDate, Date endDate) { - QueryWrapper<HistoryFiveMinutely> wrapper = new QueryWrapper<>(); - wrapper.eq("mac", mac); - wrapper.between("time", startDate, endDate); + Map<String, Object> mapParams = new HashMap<>(); + mapParams.put("startDate",startDate); + mapParams.put("endDate",endDate); + mapParams.put("mac",mac); List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(startDate, endDate, SeparateTableType.MONTH); - List<HistoryFiveMinutely> datas = multiTableQuery(wrapper, tableNames); + List<HistoryFiveMinutely> datas = multiTableQueryResult(mapParams, tableNames); return datas; } @@ -496,14 +500,22 @@ * @Author: ��������� * @Date: 2021/9/23 */ - private List<HistoryFiveMinutely> multiTableQuery(QueryWrapper<HistoryFiveMinutely> wrapper, List<String> tableNames) { + private List<HistoryFiveMinutely> multiTableQuery(Map<String, Object> params, List<String> tableNames) { List<HistoryFiveMinutely> result = new ArrayList<>(); for (String tableName : tableNames) { - MybatisPlusConfig.tableName.set(tableName); - List<HistoryFiveMinutely> datas = historyFiveMinutelyMapper.selectList(wrapper); + params.put("table",tableName); + List<HistoryFiveMinutely> datas = historyFiveMinutelyMapper.listResultOne(params); result.addAll(datas); } - MybatisPlusConfig.tableName.remove(); + return result; + } + private List<HistoryFiveMinutely> multiTableQueryResult(Map<String, Object> params, List<String> tableNames) { + List<HistoryFiveMinutely> result = new ArrayList<>(); + for (String tableName : tableNames) { + params.put("table",tableName); + List<HistoryFiveMinutely> datas = historyFiveMinutelyMapper.listResult(params); + result.addAll(datas); + } return result; } } -- Gitblit v1.8.0