jinpengyong
2023-07-26 1af4bd87ce7cb6beef5dd3f448bc09d9fda7abff
chore:测试提交
4 files modified
66 ■■■■ changed files
screen-api/src/main/java/com/moral/api/mapper/HistorySecondCruiserMapper.java 3 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/HistoryDailyServiceImpl.java 6 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/SpecialDeviceServiceImpl.java 47 ●●●●● patch | view | raw | blame | history
screen-api/src/main/resources/mapper/HistorySecondCruiserMapper.xml 10 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/mapper/HistorySecondCruiserMapper.java
@@ -28,4 +28,7 @@
    List<Double> getDust(String start,String end,String mac);
    List<Map<String,Object>> getAllCruiserData(Map<String,Object> params);
}
screen-api/src/main/java/com/moral/api/service/impl/HistoryDailyServiceImpl.java
@@ -7,6 +7,7 @@
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -70,7 +71,10 @@
            result.put("avg", Constants.NULL_VALUE);
            return result;
        }
        result.put("avg", data.get(params.get("sensorCode")));
        double aDouble = Double.parseDouble(data.get(params.get("sensorCode")).toString());
        double v = new BigDecimal(aDouble).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
//        result.put("avg", data.get(params.get("sensorCode")));
        result.put("avg", ""+v);
        return result;
    }
screen-api/src/main/java/com/moral/api/service/impl/SpecialDeviceServiceImpl.java
@@ -211,7 +211,10 @@
        String time2 = params.get("time2").toString();
        String rsTime = getTime(time1, time2);
        list.add(rsTime);
        List<Map<String, Object>> maps = specialDeviceService.carTrajectory(params,false);
//        List<Map<String, Object>> maps = specialDeviceService.carTrajectory(params,false);
//        List<Map<String, Object>> maps = HistorySecondCruiserMapper.getCruiserData(params);
        List<Map<String, Object>> maps = HistorySecondCruiserMapper.getAllCruiserData(params);
        if (ObjectUtils.isEmpty(maps)){
            return null;
        }
@@ -223,7 +226,8 @@
            map.put("time1",time3);
            map.put("time2",time4);
            map.put("mac",mac);
            List<Map<String, Object>> maps1 = specialDeviceService.carTrajectory(map,false);
//            List<Map<String, Object>> maps1 = specialDeviceService.carTrajectory(map,false);
            List<Map<String, Object>> maps1 = HistorySecondCruiserMapper.getAllCruiserData(params);
            if (ObjectUtils.isEmpty(maps1)){
                return null;
            }
@@ -239,7 +243,8 @@
            map.put("time1",time5);
            map.put("time2",time6);
            map.put("mac",mac);
            List<Map<String, Object>> maps1 = specialDeviceService.carTrajectory(map,false);
//            List<Map<String, Object>> maps1 = specialDeviceService.carTrajectory(map,false);
            List<Map<String, Object>> maps1 = HistorySecondCruiserMapper.getAllCruiserData(params);
            if (ObjectUtils.isEmpty(maps1)){
                return null;
            }
@@ -459,20 +464,28 @@
        for (Map<String, Object> map : maps) {
//            String flylon = map.get("flylon").toString();
//            String flylat = map.get("flylat").toString();
//            String s = flylon + "-" + flylat;
//            if (Double.parseDouble(map.get("a34004").toString())>200){
//
//            }
            pm25List.add(Double.parseDouble(map.get("a34004").toString()));
            pm10List.add(Double.parseDouble(map.get("a34002").toString()));
            COList.add(Double.parseDouble(map.get("a21005").toString()));
            SO2List.add(Double.parseDouble(map.get("a21026").toString()));
            NO2List.add(Double.parseDouble(map.get("a21004").toString()));
            O3List.add(Double.parseDouble(map.get("a05024").toString()));
            VOCList.add(Double.parseDouble(map.get("a99054").toString()));
            Map value = JSON.parseObject(map.get("value").toString(), Map.class);
            if (!ObjectUtils.isEmpty(value.get("a34004"))){
                pm25List.add(Double.parseDouble(value.get("a34004").toString()));
            }
            if (!ObjectUtils.isEmpty(value.get("a34002"))){
                pm10List.add(Double.parseDouble(value.get("a34002").toString()));
            }
            if (!ObjectUtils.isEmpty(value.get("a21005"))){
                COList.add(Double.parseDouble(value.get("a21005").toString()));
            }
            if (!ObjectUtils.isEmpty(value.get("a21026"))){
                SO2List.add(Double.parseDouble(value.get("a21026").toString()));
            }
            if (!ObjectUtils.isEmpty(value.get("a21004"))){
                NO2List.add(Double.parseDouble(value.get("a21004").toString()));
            }
            if (!ObjectUtils.isEmpty(value.get("a05024"))){
                O3List.add(Double.parseDouble(value.get("a05024").toString()));
            }
            if (!ObjectUtils.isEmpty(value.get("a99054"))){
                VOCList.add(Double.parseDouble(value.get("a99054").toString()));
            }
        }
        //获取平均值
screen-api/src/main/resources/mapper/HistorySecondCruiserMapper.xml
@@ -57,4 +57,14 @@
          AND `time` <![CDATA[>=]]> #{start}
          AND `time` <![CDATA[<=]]> #{end}
    </select>
    <select id="getAllCruiserData" resultType="java.util.Map">
        SELECT
        `value`
        FROM `history_second_cruiser`
        WHERE mac = #{mac}
        AND `time` <![CDATA[>=]]> #{time1}
        AND `time` <![CDATA[<=]]> #{time2}
    </select>
</mapper>