whycxzp
2025-06-10 5005f4916ae1240cf4cd91bb4ed82be43598f568
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.whyc.schedule;
 
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.pojo.db_alarm.BattStationTempAlarm;
import com.whyc.pojo.db_batt.BattMonsLocation;
import com.whyc.pojo.db_param.BattAlarmParam;
import com.whyc.pojo.db_real_batt.RtData;
import com.whyc.service.BattAlarmParamService;
import com.whyc.service.BattStationTempAlarmService;
import com.whyc.service.BattStationTempService;
import com.whyc.service.RtDataService;
import lombok.extern.slf4j.Slf4j;
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.util.List;
 
@EnableScheduling
@Component
@Slf4j
public class FireRobotSchedule {
 
    @Autowired
    private BattStationTempAlarmService battStationTempAlarmService;
 
    @Autowired
    private RtDataService rtDataService;
 
    @Autowired
    private BattAlarmParamService battAlarmParamService;
 
    //查询电池站点温度告警并校验是否存在电池单体温度高. 存在的情况下,给电池单体温度高的电池单体.进行消防机器人灭火处理
    @Scheduled(fixedRate = 4000,initialDelay = 2000)
    public void checkAndStopFire() {
        //查询正在发生一级告警的电池单体有哪些
        Response<PageInfo<BattStationTempAlarm>> page = battStationTempAlarmService.getPage(1, 10, 1);
        PageInfo<BattStationTempAlarm> data = page.getData();
        List<BattStationTempAlarm> alarmList = data.getList();
 
        for (int i = 0; i < alarmList.size(); i++) {
            //查询温度告警的阈值
            BattAlarmParam param = battAlarmParamService.getTempAlarmParam();
 
            BattStationTempAlarm tempAlarm = alarmList.get(i);
            BattMonsLocation battMonsLocation = tempAlarm.getBattMonsLocation();
            String battMons = battMonsLocation.getBattMons();
            Integer battGroupId = battMonsLocation.getBattGroupId();
            String[] battMonsArray = battMons.split(",");
            //转为int类型数组
            Integer[] battMonsArrayInt = new Integer[battMonsArray.length];
            for (int j = 0; j < battMonsArray.length; j++) {
                battMonsArrayInt[j] = Integer.parseInt(battMonsArray[j]);
            }
            //查询对应的电池组和电池单体的温度数据
            List<RtData> rtDataList = rtDataService.getList(battGroupId, battMonsArrayInt);
            for (int j = 0; j < rtDataList.size(); j++) {
                RtData rtData = rtDataList.get(j);
                //温度基准值固定为25度
                int tempBase = 25;
                if (rtData.getMonTmp() > tempBase*param.getAlmHighCoe()) { //单体温度高于温度阈值
                    //TODO 单体灭火指令没给,在电池站点温度告警表中设计增加列-是否发送了灭火指令,默认为否,暂没追加!!!!!!!!!! 追加后,上面的要查询并判断是否发送了灭火指令,如果发送了,则不进行下述的灭火流程
                    //给电池单体温度高的电池单体.进行消防机器人灭火处理
                    Integer monNum = rtData.getMonNum();
                }
            }
        }
 
 
    }
 
}