| | |
| | | package com.moral.service.impl; |
| | | |
| | | import io.swagger.models.auth.In; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | import org.apache.jasper.compiler.JspUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | |
| | | import com.moral.mapper.MonitorPointMapper; |
| | | import com.moral.mapper.ProvinceMapper; |
| | | import com.moral.mapper.SensorMapper; |
| | | import com.moral.mapper.ShAreaMapper; |
| | | import com.moral.service.HistoryMinutelyService; |
| | | import com.sun.org.apache.bcel.internal.generic.ANEWARRAY; |
| | | |
| | | import static com.moral.common.bean.Constants.NULL_VALUE; |
| | | import static org.springframework.util.ObjectUtils.isEmpty; |
| | |
| | | parameters.put("timeUnits", "10min"); |
| | | } |
| | | return historyMinutelyMapper.getMonitorPointOrDeviceAvgData(parameters); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> get(Map<String, Object> parameters) throws Exception { |
| | | convertQueryParam(parameters); |
| | | if (!ObjectUtils.isEmpty(parameters.get("compensate"))) { |
| | | parameters.put("timeUnits", "10min"); |
| | | } |
| | | return historyMinutelyMapper.getMultiDeviceSensorData(parameters); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getMultiDeviceSensorData(Map<String, Object> parameters) throws Exception { |
| | | String sensorKey = parameters.get("sensorKey").toString(); |
| | | System.out.println(parameters); |
| | | String[] macs = parameters.get("macs").toString().split(","); |
| | | List<String> sensorKeys = new ArrayList<>(); |
| | | sensorKeys.add(sensorKey); |
| | | parameters.put("sensorKeys", sensorKeys); |
| | | parameters.put("sensors", sensorKeys); |
| | | System.out.println(parameters); |
| | | List<Map<String, Object>> list = new ArrayList<>(24); |
| | | int max = 0; |
| | | for (String mac : macs) { |
| | | parameters.put("mac", mac); |
| | | List<Map<String, Object>> data = getMonitorPointOrDeviceAvgData(parameters); |
| | | if (data.size() >= max) { |
| | | max = data.size(); |
| | | } |
| | | for (Map<String, Object> map : data) { |
| | | List<String> values = new ArrayList<>(); |
| | | Map<String, Object> hashMap = new HashMap<>(); |
| | | String time = map.get("time").toString(); |
| | | hashMap.put("time",time); |
| | | int length = time.length(); |
| | | Integer t = Integer.valueOf(time.substring(time.length() - 2)); |
| | | String value = map.get(sensorKey).toString(); |
| | | /* if (length > 10) { |
| | | |
| | | }*/ |
| | | values.add(value); |
| | | |
| | | |
| | | } |
| | | System.out.println(data); |
| | | } |
| | | return null; |
| | | } |
| | | } |