jinpengyong
2022-12-13 3d665d84b1a4ffd6749ca9354247838ce0622f4b
修改sql语句问题
5 files modified
30 ■■■■■ changed files
screen-job/src/main/java/com/moral/api/entity/HistoryAqi.java 5 ●●●● patch | view | raw | blame | history
screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
screen-job/src/main/java/com/moral/api/task/AlarmTask.java 12 ●●●● patch | view | raw | blame | history
screen-job/src/main/java/com/moral/api/task/InformationTask.java 4 ●●●● patch | view | raw | blame | history
screen-job/src/main/resources/mapper/HistoryAqiMapper.xml 4 ●●●● patch | view | raw | blame | history
screen-job/src/main/java/com/moral/api/entity/HistoryAqi.java
@@ -1,5 +1,7 @@
package com.moral.api.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
import java.util.Date;
@@ -34,7 +36,8 @@
    /**
     * 数据
     */
    private String value;
//    private String value;
    private String json;
    @Override
screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java
@@ -96,7 +96,8 @@
                historyAqi.setGuid(guid);
                historyAqi.setTime(DateUtils.addHours(time, -1));
                //存入数据库
                historyAqi.setValue(JSONObject.toJSONString(map));
//                historyAqi.setValue(JSONObject.toJSONString(map));
               historyAqi.setJson(JSONObject.toJSONString(map));
                historyAqis.add(historyAqi);
@@ -150,7 +151,7 @@
                historyAqi.setGuid(guid);
                historyAqi.setTime(DateUtils.addHours(time, -1));
                //存入数据库
                historyAqi.setValue(JSONObject.toJSONString(map));
                historyAqi.setJson(JSONObject.toJSONString(map));
                historyAqis.add(historyAqi);
screen-job/src/main/java/com/moral/api/task/AlarmTask.java
@@ -246,7 +246,7 @@
                                HistoryAqi historyAqi = null;
                                historyAqi = historyAqiMapper.selectOne(historyAqiQueryWrapper);
                                if (!com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(historyAqi)){
                                    String cityAqiValue = historyAqi.getValue();
                                    String cityAqiValue = historyAqi.getJson();
                                    JSONObject JsonObject = new JSONObject();
                                    JSONObject previousJsonObject = new JSONObject();
                                    previousJsonObject = JSONObject.parseObject(cityAqiValue);
@@ -367,7 +367,7 @@
                                HistoryAqi historyAqi = null;
                                historyAqi = historyAqiMapper.selectOne(historyAqiQueryWrapper);
                                if (!com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(historyAqi)){
                                    String cityAqiValue = historyAqi.getValue();
                                    String cityAqiValue = historyAqi.getJson();
                                    JSONObject JsonObject = new JSONObject();
                                    JSONObject previousJsonObject = new JSONObject();
                                    previousJsonObject = JSONObject.parseObject(cityAqiValue);
@@ -488,7 +488,7 @@
                                HistoryAqi historyAqi = null;
                                historyAqi = historyAqiMapper.selectOne(historyAqiQueryWrapper);
                                if (!com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(historyAqi)){
                                    String cityAqiValue = historyAqi.getValue();
                                    String cityAqiValue = historyAqi.getJson();
                                    JSONObject JsonObject = new JSONObject();
                                    JSONObject previousJsonObject = new JSONObject();
                                    previousJsonObject = JSONObject.parseObject(cityAqiValue);
@@ -609,7 +609,7 @@
                                HistoryAqi historyAqi = null;
                                historyAqi = historyAqiMapper.selectOne(historyAqiQueryWrapper);
                                if (!com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(historyAqi)){
                                    String cityAqiValue = historyAqi.getValue();
                                    String cityAqiValue = historyAqi.getJson();
                                    JSONObject JsonObject = new JSONObject();
                                    JSONObject previousJsonObject = new JSONObject();
                                    previousJsonObject = JSONObject.parseObject(cityAqiValue);
@@ -730,7 +730,7 @@
                                HistoryAqi historyAqi = null;
                                historyAqi = historyAqiMapper.selectOne(historyAqiQueryWrapper);
                                if (!com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(historyAqi)){
                                    String cityAqiValue = historyAqi.getValue();
                                    String cityAqiValue = historyAqi.getJson();
                                    JSONObject JsonObject = new JSONObject();
                                    JSONObject previousJsonObject = new JSONObject();
                                    previousJsonObject = JSONObject.parseObject(cityAqiValue);
@@ -851,7 +851,7 @@
                                HistoryAqi historyAqi = null;
                                historyAqi = historyAqiMapper.selectOne(historyAqiQueryWrapper);
                                if (!com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(historyAqi)){
                                    String cityAqiValue = historyAqi.getValue();
                                    String cityAqiValue = historyAqi.getJson();
                                    JSONObject JsonObject = new JSONObject();
                                    JSONObject previousJsonObject = new JSONObject();
                                    previousJsonObject = JSONObject.parseObject(cityAqiValue);
screen-job/src/main/java/com/moral/api/task/InformationTask.java
@@ -86,7 +86,7 @@
                        HistoryAqi beforeHistoryAqi = new HistoryAqi();
                        beforeHistoryAqi = historyAqiService.getHistoryApiByTimeAndGuid(guid,beforeTime);
                        if (!ObjectUtils.isEmpty(beforeHistoryAqi)){
                            String value = beforeHistoryAqi.getValue();
                            String value = beforeHistoryAqi.getJson();
                            if (!ObjectUtils.isEmpty(value)){
                                JSONObject jsonObject = new JSONObject();
                                jsonObject = JSONObject.parseObject(value);
@@ -104,7 +104,7 @@
                        HistoryAqi nowHistoryAqi = new HistoryAqi();
                        nowHistoryAqi = historyAqiService.getHistoryApiByTimeAndGuid(guid,nowTime);
                        if (!ObjectUtils.isEmpty(nowHistoryAqi)){
                            String value = nowHistoryAqi.getValue();
                            String value = nowHistoryAqi.getJson();
                            if (!ObjectUtils.isEmpty(value)){
                                JSONObject jsonObject = JSONObject.parseObject(value);
                                if (!ObjectUtils.isEmpty(jsonObject.get("pm2_5"))){
screen-job/src/main/resources/mapper/HistoryAqiMapper.xml
@@ -6,7 +6,7 @@
    <resultMap id="BaseResultMap" type="com.moral.api.entity.HistoryAqi">
        <result column="guid" property="guid"/>
        <result column="time" property="time"/>
        <result column="value" property="value"/>
        <result column="json" property="json"/>
    </resultMap>
    <insert id="insertHistoryAqi">
@@ -14,7 +14,7 @@
        history_aqi
        VALUES
        <foreach collection="list" item="item" separator=",">
        (#{item.guid},#{item.time},#{item.value})
        (#{item.guid},#{item.time},#{item.json})
        </foreach>
    </insert>
</mapper>