From 7f905053f3f879092e18558401185dd6595dbe10 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Tue, 13 Mar 2018 15:11:49 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/main/resources/system/sysConfig.properties | 2 +- src/main/java/com/moral/controller/ScreenController.java | 11 +++++++++++ src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java | 27 +++++++++++++++++---------- src/main/java/com/moral/service/impl/HistoryMinutelyServiceImpl.java | 10 +++++----- 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java index 7f87598..0fd2613 100644 --- a/src/main/java/com/moral/controller/ScreenController.java +++ b/src/main/java/com/moral/controller/ScreenController.java @@ -424,4 +424,15 @@ List<MonitorPoint> monitorPoints = monitorPointService.getMonitorPointsByOrganizationId(orgId); return new ResultBean<List<MonitorPoint>>(monitorPoints); } + + @GetMapping("report_avg_datas") + public ResultBean<List<Map<String, Object>>> getMonitorPointOrDeviceAvgData(HttpServletRequest request) throws Exception { + Map<String, Object> parameters = getParametersStartingWith(request, null); + parameters.put("type", "month"); + parameters.put("format", "yyyy-MM"); + parameters.put("typeFormat", "%Y-%m-%d"); + List<Map<String, Object>> list = historyMinutelyService.getMonitorPointOrDeviceAvgData(parameters); + + return new ResultBean<List<Map<String, Object>>>(list); + } } diff --git a/src/main/java/com/moral/service/impl/HistoryMinutelyServiceImpl.java b/src/main/java/com/moral/service/impl/HistoryMinutelyServiceImpl.java index fab186f..1518f85 100644 --- a/src/main/java/com/moral/service/impl/HistoryMinutelyServiceImpl.java +++ b/src/main/java/com/moral/service/impl/HistoryMinutelyServiceImpl.java @@ -271,7 +271,7 @@ @Override public List<Map<String, Object>> getMonitorPointOrDeviceAvgData(Map<String, Object> parameters) throws Exception { - List<Map<String, Object>> resul ; + List<Map<String, Object>> resultList ; String type = (String) parameters.get("type"); String time = (String) parameters.get("time"); @@ -308,7 +308,7 @@ //sensorKeys.clear(); // ������������������ if (!parameters.containsKey("mac")) { - resul = new ArrayList<Map<String,Object>>(); + resultList = new ArrayList<Map<String,Object>>(); Integer monitorPointId = Integer.valueOf(parameters.get("monitorPoint").toString()); List<Map<String, Object>> deviceVersions = deviceMapper.getDeviceVersionIdByMonitorPoint(monitorPointId); ExecutorService threadPool = Executors.newCachedThreadPool(); @@ -373,7 +373,7 @@ for (String sensorKey : value.keySet()) { resultMap.put(sensorKey, value.get(sensorKey)[2]); } - resul.add(resultMap); + resultList.add(resultMap); } // ������ ��������� } else { @@ -388,9 +388,9 @@ parameters.put("sensorKeyColumn", sensorKeyColumn); } - resul = historyMinutelyMapper.getMonitorPointOrDeviceAvgData(parameters); + resultList = historyMinutelyMapper.getMonitorPointOrDeviceAvgData(parameters); } - return resul; + return resultList; } private String getSensorKeyColumnBySensors(List<Map<String, Object>> sensors,Map<String, Object> parameters) { diff --git a/src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java b/src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java index 22c16d9..6e8c2c3 100644 --- a/src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java +++ b/src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java @@ -8,18 +8,22 @@ import javax.annotation.Resource; -import com.github.pagehelper.PageHelper; -import com.moral.common.bean.Constants; -import com.moral.common.bean.PageBean; -import com.moral.common.util.*; -import com.moral.entity.Device; -import com.moral.mapper.DeviceMapper; import org.apache.commons.collections.CollectionUtils; import org.springframework.stereotype.Service; +import com.github.pagehelper.PageHelper; +import com.moral.common.bean.Constants; +import com.moral.common.bean.PageBean; +import com.moral.common.util.ExampleUtil; +import com.moral.common.util.RedisUtils; +import com.moral.common.util.StringUtils; +import com.moral.common.util.ValidateUtil; +import com.moral.entity.Device; import com.moral.entity.MonitorPoint; +import com.moral.mapper.DeviceMapper; import com.moral.mapper.MonitorPointMapper; import com.moral.service.MonitorPointService; + import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example.Criteria; @@ -174,11 +178,14 @@ @Override public List<MonitorPoint> getMonitorPointsByOrganizationId(Integer orgId) { - MonitorPoint monitorPoint = new MonitorPoint(); - monitorPoint.setIsDelete(Constants.IS_DELETE_FALSE); + Example example = new Example(MonitorPoint.class); + Criteria criteria = example.createCriteria(); + + criteria.andEqualTo("isDelete", Constants.IS_DELETE_FALSE); if (Constants.isNotSpecialOrgId(orgId)) { - monitorPoint.setOrganizationId(orgId); + criteria.andEqualTo("organizationId", orgId); } - return monitorPointMapper.select(monitorPoint); + example.orderBy("name").asc(); + return monitorPointMapper.selectByExample(example); } } diff --git a/src/main/resources/system/sysConfig.properties b/src/main/resources/system/sysConfig.properties index cff6ebe..8caf11a 100644 --- a/src/main/resources/system/sysConfig.properties +++ b/src/main/resources/system/sysConfig.properties @@ -27,5 +27,5 @@ e19-standard=50 orgId=5 password=123456 -noFilters=/screen/**,/**/*.jsp,/**/*.js,/**/*.png,/**/*.ico +noFilters=/screen/**,/**/*.jsp,/**/*.js,/**/*.png,/**/*.ico,/machineactivate/**,/device/**,/sensor/** specialOrgIds=-1,5 \ No newline at end of file -- Gitblit v1.8.0