| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | |
| | | import com.moral.api.entity.*; |
| | | import com.moral.api.mapper.DeviceMapper; |
| | | import com.moral.api.mapper.HistoryMonthlyMapper; |
| | | import com.moral.api.mapper.OrganizationMapper; |
| | | |
| | | import com.moral.api.pojo.dto.dataDisplay.HeatMapDTO; |
| | | import com.moral.api.pojo.dto.dataDisplay.MonitorPointDataDisplayDTO; |
| | | import com.moral.api.pojo.dto.dataDisplay.SensorComparisonDisplayDTO; |
| | | import com.moral.api.pojo.form.dataDisplay.MonitorPointDataDisplayForm; |
| | | import com.moral.api.pojo.form.dataDisplay.SensorComparisonDisplayForm; |
| | | |
| | | import com.moral.api.service.*; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.constant.SeparateTableType; |
| | | import com.moral.pojo.AQI; |
| | | import com.moral.util.*; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 热力图 |
| | | * 热力图显示 |
| | | * @param code |
| | | * @param startTime |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ArrayList<Map<String, Object>> getHeatMapData(String code, String startTime, String type,String form) { |
| | | public List<HeatMapDTO> getHeatMapData(String code, String startTime, String type, String form) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("start",startTime); |
| | | map.put("type","$."+ type); |
| | |
| | | list.add(organizationId); |
| | | } |
| | | |
| | | ArrayList<Map<String, Object>> rsHeatMap = new ArrayList<>(); |
| | | // ArrayList<HeatMapDTO> rsHeatMap = new ArrayList<>(); |
| | | // ArrayList<Map<String, Object>> rsHeatMap = new ArrayList<>(); |
| | | ArrayList<HeatMapDTO> rsHeatMap = new ArrayList<>(); |
| | | |
| | | if (form.equals("hour")){ //小时 |
| | | Date date1 = DateUtils.getDate(startTime, DateUtils.yyyy_MM_dd_HH_EN); |
| | |
| | | // for (Integer integer : list) { |
| | | map.put("organizationIds",list); |
| | | map.put("tableName",tableNames.get(0)); |
| | | List<Map<String, Object>> heatMap = deviceMapper.getHeatMap(map); |
| | | // List<HeatMapDTO> heatMap = deviceMapper.getHeatMap(map); |
| | | // List<Map<String, Object>> heatMap = deviceMapper.getHeatMap(map); |
| | | List<HeatMapDTO> heatMap = deviceMapper.getHeatMap(map); |
| | | rsHeatMap.addAll(heatMap); |
| | | // } |
| | | |
| | | }else { //天 |
| | | // for (Integer integer : list) { |
| | | map.put("organizationIds",list); |
| | | List<Map<String, Object>> heatMap = deviceMapper.getHeatMap(map); |
| | | // List<HeatMapDTO> heatMap = deviceMapper.getHeatMap(map); |
| | | // List<Map<String, Object>> heatMap = deviceMapper.getHeatMap(map); |
| | | List<HeatMapDTO> heatMap = deviceMapper.getHeatMap(map); |
| | | rsHeatMap.addAll(heatMap); |
| | | // } |
| | | } |
| | | |
| | | //除去为空数据 |
| | | ArrayList<Map<String, Object>> filteredList = new ArrayList<>(); |
| | | for (Map<String, Object> map1 : rsHeatMap) { |
| | | boolean hasEmptyValue = false; |
| | | for (Object value : map1.values()) { |
| | | if (value == null) { |
| | | hasEmptyValue = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!hasEmptyValue) { |
| | | filteredList.add(map1); |
| | | return distrinList(rsHeatMap); |
| | | } |
| | | /** |
| | | * 字段去重 |
| | | * @param responseList |
| | | * @return |
| | | */ |
| | | private List<HeatMapDTO> distrinList(List<HeatMapDTO> responseList){ |
| | | List<HeatMapDTO> rsMap = new ArrayList<>(); |
| | | Set<String> keysSet = new HashSet<String>(); |
| | | for (HeatMapDTO heatMapDTO : responseList) { |
| | | String keys = String.valueOf(heatMapDTO.getMac()); |
| | | int beforeSize = keysSet.size(); |
| | | keysSet.add(keys); |
| | | int afterSize = keysSet.size(); |
| | | if(afterSize == beforeSize + 1){ |
| | | rsMap.add(heatMapDTO); |
| | | } |
| | | } |
| | | log.info(filteredList.size()+""); |
| | | return filteredList; |
| | | log.info(responseList.size()+""); |
| | | log.info(rsMap.size()+""); |
| | | return rsMap; |
| | | |
| | | |
| | | } |
| | | |
| | | /** |