[Open Source] Forest fire early warning system based on Vue and SpringBoot

Insert image description here

Project number: S 019, get the source code at the end of the article. \color{red}{Project number: S019, get the source code at the end of the article. }Item name: S019, End of sentence: Genka.



1. Abstract

1.1 Project introduction

The forest fire early warning system based on websocket+Vue+SpringBoot+MySQL includes the park data module, temperature sensor module, smoke sensor module, park monitoring module, park alarm history module, and also includes the system's own user management, department management, and role management. , menu management, log management, data dictionary management, file management, chart display and other basic modules. The forest fire early warning system has role-based access control for park administrators and ordinary users.

1.2 Project screen recording

Source code download


2. Function module

The forest fire early warning system designed in this article includes the system data center module, which is used to store common modules of the management system. In addition, five modules, namely system foundation, smoke sensor, temperature sensor, historical record, and park data, are designed to store the system. core business logic.

2.1 Data Center Module

The data center module contains the basic modules of the forest fire early warning system, such as managing who can log in to the system, recording what these people log in to the system, and different people having different permissions.

2.2 System basic modules

The basic module of the system manages park information, including user management, department management, cloud disk, role support, menu support, log management, data dictionary, front-end tables, etc. Parks can be added, edited, updated, and deleted through this module , query operation.

2.3 Smoke sensor module

The smoke sensor module records the smoke concentration, an important factor that causes forest fires, and sets a threshold for smoke concentration. When this threshold is reached, an alarm will be triggered. Accurate capture of smoke concentration data will effectively prevent forest fires. Forest managers can change the thresholds to respond to forest conditions in different seasons.

2.4 Temperature sensor module

The temperature sensor module records the forest temperature, an important factor that causes forest fires, and sets a forest temperature threshold. When this threshold is reached, an alarm will be triggered. Accurate capture of forest temperature data will effectively prevent forest fires. The higher the temperature of the forest, the greater the probability of forest fires. Therefore, changes in forest temperature should be paid attention to in a timely manner so that timely warnings can be obtained.

2.5 History module

The history recording module is designed to observe the number of forest fire warnings to see which park has a higher probability of forest fires. Corresponding personnel and materials can be arranged to deploy more to high-risk areas, which will be effective. To alleviate the problem of shortage of rescue personnel and materials, focus on fire prevention in areas that are highly prone to fires. If a forest fire occurs, corresponding measures can be taken in a timely manner.

2.6 Park data module

The design of the park data module is to integrate the relationship between various parks and collect the data of each park on one module. Administrators can use the park data module to discover the forest situation in a timely manner. If a forest fire occurs, or a detected The data reaches critical value quickly, which can achieve faster response speed.


3. System design

3.1 Use case design

3.1.1 Forest Park Basic System Use Case Design

Insert image description here

3.1.2 Forest early warning data use case design

Insert image description here

3.2 Database design

3.2.1 Smoke sensor

The smoke sensor module records the smoke concentration, an important factor that causes forest fires, and sets a threshold for smoke concentration. When this threshold is reached, an alarm will be triggered. Accurate capture of smoke concentration data will effectively prevent forest fires. Forest managers can change the thresholds to respond to forest conditions in different seasons.

Insert image description here

3.2.2 Temperature sensor

The temperature sensor module records the forest temperature, an important factor that causes forest fires, and sets a forest temperature threshold. When this threshold is reached, an alarm will be triggered. Accurate capture of forest temperature data will effectively prevent forest fires. The higher the temperature of the forest, the greater the probability of forest fires. Therefore, changes in forest temperature should be paid attention to in a timely manner so that timely warnings can be obtained.

Insert image description here

3.2.3 History

The history recording module is designed to observe the number of forest fire warnings to see which park has a higher probability of forest fires. Corresponding personnel and materials can be arranged to deploy more to high-risk areas, which will be effective. To alleviate the problem of shortage of rescue personnel and materials, focus on fire prevention in areas that are highly prone to fires. If a forest fire occurs, corresponding measures can be taken in a timely manner.

Insert image description here

3.2.4 Park data

The design of the park data module is to integrate the relationship between various parks and collect the data of each park on one module. Administrators can use the park data module to discover the forest situation in a timely manner. If a forest fire occurs, or a detected The data reaches critical value quickly, which can achieve faster response speed.

Insert image description here


4. System display

Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here


5. Core code

5.1 Create sensors with one click

@RequestMapping(value = "/createSensor", method = RequestMethod.GET)
@ApiOperation(value = "一键创建传感器")
public Result<ForestPark> createSensor(@RequestParam String id){
    
    
    ForestPark park = iForestParkService.getById(id);
    if(park == null) {
    
    
        return ResultUtil.error("园区不存在");
    }
    // 删除原烟雾传感器
    QueryWrapper<SmokeSensor> ssOldQw = new QueryWrapper<>();
    ssOldQw.eq("park_id",park.getId());
    iSmokeSensorService.remove(ssOldQw);
    // 删除原温度传感器
    QueryWrapper<TemperatureSensor> tsOldQw = new QueryWrapper<>();
    tsOldQw.eq("park_id",park.getId());
    iTemperatureSensorService.remove(tsOldQw);
    // 创建传感器
    SmokeSensor ss = new SmokeSensor();
    ss.setParkId(park.getId());
    ss.setParkName(park.getTitle());
    ss.setValue(0);
    ss.setLastTime("");
    iSmokeSensorService.saveOrUpdate(ss);
    TemperatureSensor ts = new TemperatureSensor();
    ts.setParkId(park.getId());
    ts.setParkName(park.getTitle());
    ts.setValue(0);
    ts.setLastTime("");
    iTemperatureSensorService.saveOrUpdate(ts);
    return ResultUtil.success();
}

5.2 Simulate sensor data changes

private void changeValue1Fx() {
    
    
    List<SmokeSensor> sensorList = iSmokeSensorService.list();
    Random r = new Random();
    for (SmokeSensor ss : sensorList) {
    
    
        int tempValue = r.nextInt(100);
        ss.setValue(tempValue);
        ss.setLastTime(DateUtil.now());
        iSmokeSensorService.saveOrUpdate(ss);
        try {
    
    
            parkTask.updatePartAlertTime(ss.getParkId());
        } catch (InterruptedException e) {
    
    }
        BaseWebSocketService.sendInfo("Smoke@@" + ss.getParkId() + "@@" + tempValue);
    }
}

5.3 WebSocket setup

@Configuration
@EnableWebSocketMessageBroker
public class StompWebSocketConfig implements WebSocketMessageBrokerConfigurer {
    
    

    @Autowired
    private StompChannelInterceptor myChannelInterceptor;

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
    
    
        // 1.定义客户端连接地址/stomp-ws
        // 2.使用sockJS,stomp协议
        // 3.配置跨域
        registry.addEndpoint("/stomp-ws").setAllowedOriginPatterns("*").withSockJS();
    }

    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {
    
    
        // 1.设置服务端推送数据的主题节点
        registry.enableSimpleBroker("/topic", "/queue");
        // 2.设置客户端向服务端推送消息的前缀
//        registry.setApplicationDestinationPrefixes("app");
    }

    @Override
    public void configureClientInboundChannel(ChannelRegistration registration) {
    
    
        // 注册拦截器中间件
        registration.interceptors(myChannelInterceptor);
    }
}


6. Disclaimer

  • This project is for personal study only. For commercial authorization, please contact the blogger, otherwise you will be responsible for the consequences.
  • The blogger owns all content and independent intellectual property rights of the application system built by this software, and has the final right of interpretation.
  • If you have any questions, please leave a message in the warehouse Issue. We will reply as soon as possible after seeing it. Relevant opinions will be considered as appropriate, but there is no promise or guarantee that they will be adopted.

Users who download this system code or use this system must agree to the following content, otherwise please do not download!

  1. You use/develop this software voluntarily, understand the risks of using this software, and agree to bear the risks of using this software.
  2. Any information content of the website built using this software and any resulting copyright disputes, legal disputes and consequences have nothing to do with the blogger, and the blogger does not bear any responsibility for this.
  3. Under no circumstances will the blogger be liable for any loss that is difficult to reasonably predict (including but not limited to loss of commercial profits, business interruption, and loss of business information) resulting from the use or inability to use this software.
  4. You must understand the risks of using this software. The blogger does not promise to provide one-on-one technical support or use guarantee, nor does it assume any responsibility for unforeseen problems caused by this software.

Insert image description here

Guess you like

Origin blog.csdn.net/yangyin1998/article/details/134918338