From 65b70cf13a2ec91013d876771be878c165cae3a4 Mon Sep 17 00:00:00 2001 From: cjl <909710561@qq.com> Date: Tue, 23 Apr 2024 15:32:45 +0800 Subject: [PATCH] fix:补充提交 --- screen-api/src/main/java/com/moral/api/service/impl/HistoryDailyServiceImpl.java | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-) diff --git a/screen-api/src/main/java/com/moral/api/service/impl/HistoryDailyServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/HistoryDailyServiceImpl.java index ca43937..b88640b 100644 --- a/screen-api/src/main/java/com/moral/api/service/impl/HistoryDailyServiceImpl.java +++ b/screen-api/src/main/java/com/moral/api/service/impl/HistoryDailyServiceImpl.java @@ -3,10 +3,12 @@ import com.moral.api.entity.*; import com.moral.api.mapper.ServicesScopeDeviceMapper; import com.moral.api.mapper.ServicesScopeMapper; +import com.moral.api.pojo.vo.historyMonthly.HistoryResultVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; +import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -70,7 +72,10 @@ result.put("avg", Constants.NULL_VALUE); return result; } - result.put("avg", data.get(params.get("sensorCode"))); + double aDouble = Double.parseDouble(data.get(params.get("sensorCode")).toString()); + double v = new BigDecimal(aDouble).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); +// result.put("avg", data.get(params.get("sensorCode"))); + result.put("avg", ""+v); return result; } @@ -106,6 +111,19 @@ wrapper.between("time", startDate, endDate); List<HistoryDaily> historyDailies = historyDailyMapper.selectList(wrapper); return historyDailies; + } + + @Override + public List<HistoryDaily> getHistoryDailyByMacAndTimeSlot( List<String> macs, Date startDate, Date endDate) { + QueryWrapper<HistoryDaily> wrapper = new QueryWrapper<>(); + wrapper.in("mac", macs); + wrapper.between("time", startDate, endDate); + List<HistoryDaily> historyDailies = historyDailyMapper.selectList(wrapper); + return historyDailies; + } + @Override + public List<HistoryResultVo> listAvgResult(String type, List<String> macs, String startTime, String endTime) { + return historyDailyMapper.listAvgResult(type, macs, startTime, endTime); } @Override @@ -276,6 +294,9 @@ boundary_point_one.add(Double.parseDouble(boundary_point_one_array[0])); boundary_point_one.add(Double.parseDouble(boundary_point_one_array[1])); boundary_pointList.add(boundary_point_one); + } + if (boundary_pointList.size()>0){ + boundary_pointList.add(boundary_pointList.get(0)); } bound.add(boundary_pointList); resultMap.put("bound", bound); @@ -450,6 +471,9 @@ boundary_point_one.add(Double.parseDouble(boundary_point_one_array[1])); boundary_pointList.add(boundary_point_one); } + if (boundary_pointList.size()>0){ + boundary_pointList.add(boundary_pointList.get(0)); + } bound.add(boundary_pointList); List centerPoint = new ArrayList(); centerPoint.add(servicesScope.getCenterLongitude()); -- Gitblit v1.8.0