| | |
| | | */
|
| | | public class BattRealDataPro_Thread extends Thread{
|
| | | public MysqlConnPool con_pool;
|
| | | public AppConfig cfg;
|
| | | public AppParam param;
|
| | | public BattData_RT_Array data;
|
| | | Logger logger = null;
|
| | |
|
| | | public static int MinRecordTimeLong = 60; //每次记录的最短时间间隔
|
| | | public static int MaxRecordTimeLong = 366; //最大记录历史数据时间
|
| | |
|
| | | public BattRealDataPro_Thread(MysqlConnPool con_pool, AppConfig cfg, BattData_RT_Array data) {
|
| | | public BattRealDataPro_Thread(MysqlConnPool con_pool, AppParam param, BattData_RT_Array data) {
|
| | | logger = LogManager.getLogger(this.getClass());
|
| | |
|
| | | this.cfg = cfg;
|
| | | this.param = param;
|
| | | this.con_pool = con_pool;
|
| | | this.data = data;
|
| | | |
| | | MinRecordTimeLong = param.getRealdata_SaveDataTimeInterval();
|
| | | MaxRecordTimeLong = param.getRealdata_SaveDataTimeMax();
|
| | | }
|
| | |
|
| | |
|
| | |
| | | Date lastTime = new Date();
|
| | | Date lastdelTime = new Date(0);
|
| | | //线程启动前休眠60秒 //用于甄别还未通讯上的设备
|
| | | // for(int i =0; i<60; i++) {
|
| | | // try {
|
| | | // sleep(1000);
|
| | | // } catch (InterruptedException e) {
|
| | | // logger.error(e.toString(), e);
|
| | | // }
|
| | | // }
|
| | | logger.info("BattRealDataPro_Thread Start Record......");
|
| | | for(int i =0; i<60; i++) {
|
| | | try {
|
| | | sleep(1000);
|
| | | } catch (InterruptedException e) {
|
| | | logger.error(e.toString(), e);
|
| | | }
|
| | | }
|
| | | logger.warn("BattRealDataPro_Thread Start Record MinRecordTimeLong:" + MinRecordTimeLong + " MaxRecordTimeLong:"+MaxRecordTimeLong);
|
| | | Date nowTime = null;
|
| | | while(true) {
|
| | | /**************** mxpopstar add @ 20200817 ***************/
|
| | |
| | | */
|
| | | //获取指定天数之前的时间
|
| | | Date critical = getDateBefore(nowTime, MaxRecordTimeLong);
|
| | | logger.error("删除"+Com.get_DTF(critical, Com.DTF_YMDhms)+"之前创建的电池组历史实时数据库表");
|
| | | //logger.error("删除"+Com.get_DTF(critical, Com.DTF_YMDhms)+"之前创建的电池组历史实时数据库表");
|
| | | BTS61850_Task_Thread_SQL.deleteHistoryData(con_pool, critical);
|
| | | logger.error("删除结束。。。。。。");
|
| | | //logger.error("删除结束。。。。。。");
|
| | |
|
| | | lastdelTime = nowTime;
|
| | | }
|