Commit d8349475 authored by zhangsen's avatar zhangsen

预警存入 td相关

parent 7c0f50b3
...@@ -30,9 +30,13 @@ import org.springframework.util.ObjectUtils; ...@@ -30,9 +30,13 @@ import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.biz.common.utils.DateUtils.DATE_TIME_PATTERN;
@EnableScheduling @EnableScheduling
@Service @Service
@Slf4j @Slf4j
...@@ -318,10 +322,10 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -318,10 +322,10 @@ public class HealthStatusIndicatorServiceImpl {
return; return;
} }
Date time = new Date(); Date time = new Date();
Date date = DateUtils.dateAddHours(time, -8); Date date = DateUtils.dateAddHours(time, -13);
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-5); // calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-5);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); // SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String format = DateUtil.format(time, "yyyy-MM-dd HH:mm:00"); String format = DateUtil.format(time, "yyyy-MM-dd HH:mm:00");
...@@ -480,11 +484,12 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -480,11 +484,12 @@ public class HealthStatusIndicatorServiceImpl {
if (!openHealth){ if (!openHealth){
return; return;
} }
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
Date time = new Date(); Date time = new Date();
Date date = DateUtils.dateAddHours(time, -8); //三天 + 8小时
calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)-3); Date date = DateUtils.dateAddHours(time, -80);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); // calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)-3);
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
String format = DateUtil.format(time, "yyyy-MM-dd HH:mm:00"); String format = DateUtil.format(time, "yyyy-MM-dd HH:mm:00");
LambdaQueryWrapper<PvHealthIndexDay> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PvHealthIndexDay> wrapper = new LambdaQueryWrapper<>();
...@@ -815,10 +820,10 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -815,10 +820,10 @@ public class HealthStatusIndicatorServiceImpl {
} }
Date time = new Date(); Date time = new Date();
String format = DateUtil.format(time, "yyyy-MM-dd HH:00:00"); String format = DateUtil.format(time, "yyyy-MM-dd HH:00:00");
Date date = DateUtils.dateAddHours(time, -8); Date date = DateUtils.dateAddHours(time, -13);
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-5); // calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-5);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); // SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
LambdaQueryWrapper<FanHealthIndexHour> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<FanHealthIndexHour> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FanHealthIndexHour::getAnalysisObjType, "测点"); wrapper.eq(FanHealthIndexHour::getAnalysisObjType, "测点");
...@@ -976,10 +981,11 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -976,10 +981,11 @@ public class HealthStatusIndicatorServiceImpl {
} }
Date time = new Date(); Date time = new Date();
String format = DateUtil.format(time, "yyyy-MM-dd 00:00:00"); String format = DateUtil.format(time, "yyyy-MM-dd 00:00:00");
Date date = DateUtils.dateAddHours(time, -8); //三天 + 8小时
Calendar calendar = Calendar.getInstance(); Date date = DateUtils.dateAddHours(time, -80);
calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)-3); // Calendar calendar = Calendar.getInstance();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); // calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)-3);
// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
LambdaQueryWrapper<FanHealthIndexDay> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<FanHealthIndexDay> wrapper = new LambdaQueryWrapper<>();
wrapper.ne(FanHealthIndexDay::getHealthLevel,"安全"); wrapper.ne(FanHealthIndexDay::getHealthLevel,"安全");
......
...@@ -12,7 +12,7 @@ public class PvWarningRecord implements Serializable { ...@@ -12,7 +12,7 @@ public class PvWarningRecord implements Serializable {
private Long ts; private Long ts;
private String recDate; private String recDate;
private String disposotionState; private String disposotionState;
private String healthIndexSeq; private String healthIndex;
private String analysisPointId; private String analysisPointId;
private String warningName; private String warningName;
private String arae; private String arae;
......
...@@ -6,34 +6,33 @@ ...@@ -6,34 +6,33 @@
insert insert
into into
pv_warning_record pv_warning_record
(ts, <!-- (ts,-->
rec_date, <!-- rec_date,-->
disposotion_state, <!-- disposotion_state,-->
health_index_seq, <!-- health_index_seq,-->
health_index, <!-- health_index,-->
analysis_point_id, <!-- analysis_point_id,-->
warning_name, <!-- warning_name,-->
arae, <!-- arae,-->
station, <!-- station,-->
subarray, <!-- subarray,-->
manufacturer, <!-- manufacturer,-->
device_type, <!-- device_type,-->
equipment_name, <!-- equipment_name,-->
gateway_id, <!-- gateway_id,-->
index_address, <!-- index_address,-->
content, <!-- content,-->
point_name, <!-- point_name,-->
health_level, <!-- health_level,-->
disposotion_date, <!-- disposotion_date,-->
kks, <!-- kks,-->
warning_period, <!-- warning_period,-->
status) <!-- status)-->
values values
<foreach collection="list" separator="," item="item" index="index"> <foreach collection="list" separator="," item="item" index="index">
(#{item.ts, jdbcType=TIMESTAMP}, (#{item.ts, jdbcType=TIMESTAMP},
#{item.recDate, jdbcType=VARCHAR}, #{item.recDate, jdbcType=VARCHAR},
#{item.disposotionState, jdbcType=VARCHAR}, #{item.disposotionState, jdbcType=VARCHAR},
#{item.healthIndexSeq, jdbcType=VARCHAR},
#{item.healthIndex, jdbcType=VARCHAR}, #{item.healthIndex, jdbcType=VARCHAR},
#{item.analysisPointId, jdbcType=VARCHAR}, #{item.analysisPointId, jdbcType=VARCHAR},
#{item.warningName, jdbcType=VARCHAR}, #{item.warningName, jdbcType=VARCHAR},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment