whycxzp
2025-03-30 39b74c6fb4a50bed412bbebdd38440d384f47733
src/main/java/com/whyc/schedule/BattStationTempScheduleService.java
@@ -7,18 +7,23 @@
import com.whyc.pojo.db_alarm.BattStationTempAlarm;
import com.whyc.pojo.db_batt.BattCamera;
import com.whyc.pojo.db_param.PageParam;
import com.whyc.pojo.db_power_history.BattStationTempHistory;
import com.whyc.pojo.db_power_rt.BattStationTemp;
import com.whyc.service.BattStationTempAlarmService;
import com.whyc.service.BattStationTempHisService;
import com.whyc.service.BattStationTempService;
import com.whyc.service.PageParamService;
import com.whyc.util.DateUtil;
import com.whyc.util.HikTempUtil;
import com.whyc.util.ThreadLocalUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -91,9 +96,20 @@
                    battStationTemp.setStationId(stationId);
                    service.addOrUpdate(battStationTemp);
                    //温度历史 - 按电池组id,月度表
                    String yearMonth = ThreadLocalUtil.format(date, 2);
                    //温度历史 - 记录到 按电池组id,月度表
                    boolean exist = hisService.existTempHisTableByMonth(battGroupId,yearMonth);
                    //不存在则创建.插入记录
                    if(!exist){
                        hisService.createTableByMonth(battGroupId,yearMonth);
                    }
                    BattStationTempHistory tempHistory = new BattStationTempHistory();
                    try {
                        BeanUtils.copyProperties(tempHistory,battStationTemp);
                    } catch (IllegalAccessException | InvocationTargetException e) {
                        throw new RuntimeException(e);
                    }
                    hisService.add(battGroupId,yearMonth,tempHistory);
                    //温度告警判断
                    //查询温度告警表,如果存在
                    BattStationTempAlarm alarmInDB = alarmService.getByBattGroupId(battGroupId);