| | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private BattStationTempService service; |
| | | |
| | | @Autowired |
| | | private BattStationTempHisService hisService; |
| | | |
| | | @Autowired |
| | | private BattStationTempAlarmService alarmService; |
| | |
| | | battStationTemp.setStationId(stationId); |
| | | |
| | | service.addOrUpdate(battStationTemp); |
| | | //温度历史-TODO |
| | | |
| | | 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); |