| | |
| | | for (TimeForm timeForm : tables) { |
| | | String start = timeForm.getStart(); |
| | | String end = timeForm.getEnd(); |
| | | List<Double> dust = historySecondCruiserMapper.getDust(start, end, mac); |
| | | List<String> dust = historySecondCruiserMapper.getDust(start, end, mac); |
| | | ArrayList<Double> rsDouble = new ArrayList<>(); |
| | | for (Double aDouble : dust) { |
| | | double v =0.0; |
| | | for (String s : dust) { |
| | | double aDouble = Double.parseDouble(s); |
| | | |
| | | if (aDouble>=0 && aDouble<40 ){ |
| | | v = aDouble + 170; |
| | | aDouble = aDouble + 170; |
| | | }else if (aDouble>=40 && aDouble<60){ |
| | | aDouble = aDouble + 130; |
| | | }else if (aDouble>=60 && aDouble<100 ){ |
| | | aDouble = aDouble + 110; |
| | | }else if (aDouble>=100 && aDouble<150){ |
| | | aDouble = aDouble + 70; |
| | | }else if (aDouble>=150 && aDouble<180){ |
| | | aDouble = aDouble + 30; |
| | | }else { |
| | | aDouble= aDouble+0; |
| | | } |
| | | if (aDouble>=40 && aDouble<60 ){ |
| | | v = aDouble + 130; |
| | | } |
| | | if (aDouble>=60 && aDouble<100 ){ |
| | | v = aDouble + 110; |
| | | } |
| | | if (aDouble>=100 && aDouble<150 ){ |
| | | v = aDouble + 70; |
| | | } |
| | | if (aDouble>=150 && aDouble<180 ){ |
| | | v = aDouble + 30; |
| | | } |
| | | if (aDouble>=180){ |
| | | v= aDouble; |
| | | } |
| | | rsDouble.add(v); |
| | | rsDouble.add(aDouble); |
| | | } |
| | | list.addAll(rsDouble); |
| | | } |
| | |
| | | Map<String, List<DustldDTO>> collect = manageCoordinateMapper.CompareTo(orgId).stream().collect(Collectors.groupingBy(o -> o.getName())); |
| | | Set<String> strings = collect.keySet(); |
| | | ArrayList<DustForm> list1 = new ArrayList<>(); |
| | | ArrayList<DustForm> list2 = new ArrayList<>(); |
| | | //所有的高值路段 |
| | | StringBuilder builder = new StringBuilder(); |
| | | |
| | | int i = 1; |
| | |
| | | if (ObjectUtils.isEmpty(doubleArrayList)){ |
| | | continue; |
| | | } |
| | | |
| | | Double ListAva = doubleArrayList.stream() .collect(Collectors.averagingDouble(Double::doubleValue)); |
| | | double rsAvg = new BigDecimal(ListAva/1000).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | dustForm.setRoad(string); |
| | | dustForm.setValue(rsAvg); |
| | | list1.add(dustForm); |
| | | if (rsAvg>=0.3){ |
| | | builder.append("("+i+")"+string); |
| | | i++; |
| | | list1.add(dustForm); |
| | | //添加高值路段 |
| | | QueryWrapper<MaxRoad> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("name",string); |
| | |
| | | maxRoad.setTime(DateUtils.getDate(time1,DateUtils.yyyy_MM_dd_EN)); |
| | | maxRoadMapper.insert(maxRoad); |
| | | } |
| | | |
| | | }else { |
| | | list2.add(dustForm); |
| | | } |
| | | } |
| | | long timestamp2 = System.currentTimeMillis(); |
| | | log.info(timestamp2-timestamp+""); |
| | | //排序 |
| | | list1.sort(Comparator.comparing(DustForm::getValue).reversed()); |
| | | list2.sort(Comparator.comparing(DustForm::getValue).reversed()); |
| | | rsMap.put("list1",list1); |
| | | rsMap.put("list2",list2); |
| | | |
| | | |
| | | //获取上一次的高值路段 |
| | | ArrayList<Map<String, Object>> list3 = new ArrayList<>(); |
| | |
| | | wrapper2.eq("time",maxRoads.get(0).getTime()); |
| | | List<MaxRoad> maxRoads1 = maxRoadMapper.selectList(wrapper2); |
| | | |
| | | //合并数据 |
| | | ArrayList<DustForm> dustForms = new ArrayList<>(); |
| | | dustForms.addAll(list1); |
| | | dustForms.addAll(list2); |
| | | //获取两次路段相同的值 |
| | | for (MaxRoad road : maxRoads1) { |
| | | for (DustForm dustForm : dustForms) { |
| | | for (DustForm dustForm : list1) { |
| | | if (road.getName().equals(dustForm.getRoad())){ |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("road",road.getName()); |