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); } } 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) { 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); } } 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